* [PATCH] powerpc: suppress some linker warnings in recent linker versions
@ 2022-10-10 5:57 Stephen Rothwell
2022-11-30 9:24 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2022-10-10 5:57 UTC (permalink / raw)
To: Michael Ellerman; +Cc: PowerPC, Joel Stanley
[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]
This is a follow on from commit
0d362be5b142 ("Makefile: link with -z noexecstack --no-warn-rwx-segments")
for arch/powerpc/boot to address wanrings like:
ld: warning: opal-calls.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
This fixes issue https://github.com/linuxppc/issues/issues/417
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/boot/wrapper | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
I have only done a positive test on this i.e. I have binutils v2.39
installed.
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 55978f32fa77..d78c34bd5d41 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -215,6 +215,11 @@ ld_version()
}'
}
+ld_is_lld()
+{
+ ${CROSS}ld -V 2>&1 | grep -q LLD
+}
+
# Do not include PT_INTERP segment when linking pie. Non-pie linking
# just ignores this option.
LD_VERSION=$(${CROSS}ld --version | ld_version)
@@ -223,6 +228,14 @@ if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
nodl="--no-dynamic-linker"
fi
+# suppress some warnings in recent ld versions
+nowarn="-z noexecstack"
+if ! ld_is_lld; then
+ if [ "$LD_VERSION" -ge "$(echo 2.39 | ld_version)" ]; then
+ nowarn="$nowarn --no-warn-rwx-segments"
+ fi
+fi
+
platformo=$object/"$platform".o
lds=$object/zImage.lds
ext=strip
@@ -504,7 +517,7 @@ if [ "$platform" != "miboot" ]; then
text_start="-Ttext $link_address"
fi
#link everything
- ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic $notext -o "$ofile" $map \
+ ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $nowarn $rodynamic $notext -o "$ofile" $map \
$platformo $tmp $object/wrapper.a
rm $tmp
fi
--
2.35.1
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: suppress some linker warnings in recent linker versions
2022-10-10 5:57 [PATCH] powerpc: suppress some linker warnings in recent linker versions Stephen Rothwell
@ 2022-11-30 9:24 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2022-11-30 9:24 UTC (permalink / raw)
To: Stephen Rothwell, Michael Ellerman; +Cc: PowerPC, Joel Stanley
On Mon, 10 Oct 2022 16:57:21 +1100, Stephen Rothwell wrote:
> This is a follow on from commit
>
> 0d362be5b142 ("Makefile: link with -z noexecstack --no-warn-rwx-segments")
>
> for arch/powerpc/boot to address wanrings like:
>
> ld: warning: opal-calls.o: missing .note.GNU-stack section implies executable stack
> ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
> ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
>
> [...]
Applied to powerpc/next.
[1/1] powerpc: suppress some linker warnings in recent linker versions
https://git.kernel.org/powerpc/c/579aee9fc594af94c242068c011b0233563d4bbf
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 9:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10 5:57 [PATCH] powerpc: suppress some linker warnings in recent linker versions Stephen Rothwell
2022-11-30 9:24 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).