1 From 579aee9fc594af94c242068c011b0233563d4bbf Mon Sep 17 00:00:00 2001
2 From: Stephen Rothwell <sfr@canb.auug.org.au>
3 Date: Mon, 10 Oct 2022 16:57:21 +1100
4 Subject: [PATCH] powerpc: suppress some linker warnings in recent linker
7 This is a follow on from commit
9 0d362be5b142 ("Makefile: link with -z noexecstack --no-warn-rwx-segments")
11 for arch/powerpc/boot to address wanrings like:
13 ld: warning: opal-calls.o: missing .note.GNU-stack section implies executable stack
14 ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
15 ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
17 This fixes issue https://github.com/linuxppc/issues/issues/417
19 Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
20 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
21 Link: https://lore.kernel.org/r/20221010165721.106267e6@canb.auug.org.au
23 arch/powerpc/boot/wrapper | 15 ++++++++++++++-
24 1 file changed, 14 insertions(+), 1 deletion(-)
26 --- a/arch/powerpc/boot/wrapper
27 +++ b/arch/powerpc/boot/wrapper
28 @@ -213,6 +213,11 @@ ld_version()
34 + ${CROSS}ld -V 2>&1 | grep -q LLD
37 # Do not include PT_INTERP segment when linking pie. Non-pie linking
38 # just ignores this option.
39 LD_VERSION=$(${CROSS}ld --version | ld_version)
40 @@ -221,6 +226,14 @@ if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VE
41 nodl="--no-dynamic-linker"
44 +# suppress some warnings in recent ld versions
45 +nowarn="-z noexecstack"
47 + if [ "$LD_VERSION" -ge "$(echo 2.39 | ld_version)" ]; then
48 + nowarn="$nowarn --no-warn-rwx-segments"
52 platformo=$object/"$platform".o
53 lds=$object/zImage.lds
55 @@ -502,7 +515,7 @@ if [ "$platform" != "miboot" ]; then
56 text_start="-Ttext $link_address"
59 - ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic $notext -o "$ofile" $map \
60 + ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $nowarn $rodynamic $notext -o "$ofile" $map \
61 $platformo $tmp $object/wrapper.a