amd64: do not pass -z rodynamic to ld.bfd when building vdso

Apparently newer versions of binutils complain instead of silently
ignoring the unknown -z option.

Reported by:	bz
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47176
This commit is contained in:
Konstantin Belousov 2024-10-18 17:09:26 +03:00
parent d41a40f484
commit 3b2cf9381e
2 changed files with 13 additions and 3 deletions

View File

@ -34,9 +34,14 @@ ${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c -m32 \
-o ia32_sigtramp.pico -I. -I"${S}" -include opt_global.h \
"${S}"/amd64/ia32/ia32_sigtramp.S
if ${LD} --version | ${AWK} '/^GNU ld/{exit 1}' ; then
RODYNAMIC="-z rodynamic"
else
RODYNAMIC=""
fi
${LD} --shared -Bsymbolic -soname="elf-vdso32.so.1" \
-T "${S}"/conf/vdso_amd64_ia32.ldscript \
--eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \
--eh-frame-hdr --no-undefined ${RODYNAMIC} -z norelro -nmagic \
--hash-style=sysv --fatal-warnings --strip-all \
-o elf-vdso32.so.1 ia32_sigtramp.pico

View File

@ -40,12 +40,17 @@ ${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \
#
# -z rodynamic is undocumented lld-specific option, seemingly required
# for lld to avoid putting dynamic into dedicated writeable segment,
# despite ldscript placement. It is ignored by ld.bfd but ldscript
# despite ldscript placement. It is omitted for ld.bfd, but ldscript
# alone is enough there.
#
if ${LD} --version | ${AWK} '/^GNU ld/{exit 1}' ; then
RODYNAMIC="-z rodynamic"
else
RODYNAMIC=""
fi
${LD} --shared -Bsymbolic -soname="elf-vdso.so.1" \
-T "${S}"/conf/vdso_amd64.ldscript \
--eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \
--eh-frame-hdr --no-undefined ${RODYNAMIC} -z norelro -nmagic \
--hash-style=sysv --fatal-warnings --strip-all \
-o elf-vdso.so.1 sigtramp.pico