Skip to content

Commit

Permalink
powerpc: suppress some linker warnings in recent linker versions
Browse files Browse the repository at this point in the history
This is a follow on from commit

  0d362be ("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 linuxppc/issues#417

Signed-off-by: Stephen Rothwell <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
sfrothwell authored and mpe committed Nov 24, 2022
1 parent 2cb1dfa commit 579aee9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion arch/powerpc/boot/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 579aee9

Please sign in to comment.