Skip to content

Commit

Permalink
amd64: do not pass -z rodynamic to ld.bfd when building vdso
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kostikbel committed Oct 18, 2024
1 parent d41a40f commit 3b2cf93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion sys/tools/amd64_ia32_vdso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions sys/tools/amd64_vdso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3b2cf93

Please sign in to comment.