LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] Fixes for clang/lld
@ 2020-10-17  0:47 Bill Wendling
  2020-10-17  0:47 ` [PATCH 1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic Bill Wendling
  2020-10-17  0:47 ` [PATCH 2/2] powerpc/boot: Use clang when CC is clang Bill Wendling
  0 siblings, 2 replies; 3+ messages in thread
From: Bill Wendling @ 2020-10-17  0:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras, Bill Wendling

These patches fix some compilation / linking issues with clang & lld.

Bill Wendling (2):
  powerpc/wrapper: Add "-z notext" flag to disable diagnostic
  powerpc/boot: Use clang when CC is clang

 arch/powerpc/boot/Makefile | 4 ++++
 arch/powerpc/boot/wrapper  | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.29.0.rc1.297.gfa9743e501-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic
  2020-10-17  0:47 [PATCH 0/2] Fixes for clang/lld Bill Wendling
@ 2020-10-17  0:47 ` Bill Wendling
  2020-10-17  0:47 ` [PATCH 2/2] powerpc/boot: Use clang when CC is clang Bill Wendling
  1 sibling, 0 replies; 3+ messages in thread
From: Bill Wendling @ 2020-10-17  0:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Fangrui Song, Alan Modra, Paul Mackerras, Bill Wendling

The "-z notext" flag disables reporting an error if DT_TEXTREL is set.

  ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against
    symbol: _start in readonly segment; recompile object files with
    -fPIC or pass '-Wl,-z,notext' to allow text relocations in the
    output
  >>> defined in
  >>> referenced by crt0.o:(.text+0x8) in archive arch/powerpc/boot/wrapper.a

The BFD linker disables this by default (though it's configurable in
current versions). LLD enables this by default. So we add the flag to
keep LLD from emitting the error.

Cc: Fangrui Song <maskray@google.com>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: Bill Wendling <morbo@google.com>
---
 arch/powerpc/boot/wrapper | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index cd58a62e810d..e576d3e4b23f 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -46,6 +46,7 @@ compression=.gz
 uboot_comp=gzip
 pie=
 format=
+notext=
 
 # cross-compilation prefix
 CROSS=
@@ -353,6 +354,7 @@ epapr)
     platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o"
     link_address='0x20000000'
     pie=-pie
+    notext='-z notext'
     ;;
 mvme5100)
     platformo="$object/fixed-head.o $object/mvme5100.o"
@@ -493,8 +495,8 @@ if [ "$platform" != "miboot" ]; then
         text_start="-Ttext $link_address"
     fi
 #link everything
-    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" $map \
-	$platformo $tmp $object/wrapper.a
+    ${CROSS}ld -m $format -T $lds $text_start $pie $notext $nodl -o "$ofile" \
+        $map $platformo $tmp $object/wrapper.a
     rm $tmp
 fi
 
-- 
2.29.0.rc1.297.gfa9743e501-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] powerpc/boot: Use clang when CC is clang
  2020-10-17  0:47 [PATCH 0/2] Fixes for clang/lld Bill Wendling
  2020-10-17  0:47 ` [PATCH 1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic Bill Wendling
@ 2020-10-17  0:47 ` Bill Wendling
  1 sibling, 0 replies; 3+ messages in thread
From: Bill Wendling @ 2020-10-17  0:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Fangrui Song, Alan Modra, Paul Mackerras, Bill Wendling

The gcc compiler may not be available if CC is clang.

Cc: Fangrui Song <maskray@google.com>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: Bill Wendling <morbo@google.com>
---
 arch/powerpc/boot/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index b88fd27a45f0..218f1c9adb5b 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -21,7 +21,11 @@
 all: $(obj)/zImage
 
 ifdef CROSS32_COMPILE
+ifdef CONFIG_CC_IS_CLANG
+    BOOTCC := $(CROSS32_COMPILE)clang
+else
     BOOTCC := $(CROSS32_COMPILE)gcc
+endif
     BOOTAR := $(CROSS32_COMPILE)ar
 else
     BOOTCC := $(CC)
-- 
2.29.0.rc1.297.gfa9743e501-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-17  0:47 [PATCH 0/2] Fixes for clang/lld Bill Wendling
2020-10-17  0:47 ` [PATCH 1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic Bill Wendling
2020-10-17  0:47 ` [PATCH 2/2] powerpc/boot: Use clang when CC is clang Bill Wendling

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git