mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Toolchain+Ports: Update binutils to 2.41
Aside from a straightforward rebase, this contains an out-of-tree patch from MaskRay which adds the `-Bsymbolic-non-weak-functions` flag to ld.
This commit is contained in:
parent
ae21002cb5
commit
4defa401d3
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/4defa401d3 Pull-request: https://github.com/SerenityOS/serenity/pull/21018 Reviewed-by: https://github.com/ADKaster ✅
@ -270,7 +270,7 @@ ensure_toolchain() {
|
||||
if [ "$TOOLCHAIN_TYPE" = "GNU" ]; then
|
||||
local ld_version
|
||||
ld_version="$("$TOOLCHAIN_DIR"/bin/"$TARGET"-pc-serenity-ld -v)"
|
||||
local expected_version="GNU ld (GNU Binutils) 2.40"
|
||||
local expected_version="GNU ld (GNU Binutils) 2.41"
|
||||
if [ "$ld_version" != "$expected_version" ]; then
|
||||
echo "Your toolchain has an old version of binutils installed."
|
||||
echo " installed version: \"$ld_version\""
|
||||
|
@ -18,7 +18,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
|
||||
| [`bass`](bass/) | Beneath a Steel Sky | cd-1.2 | https://www.scummvm.org/games |
|
||||
| [`bc`](bc/) | bc | 6.5.0 | https://github.com/gavinhoward/bc |
|
||||
| [`bdwgc`](bdwgc/) | Boehm-Demers-Weiser Garbage Collector (libgc) | 8.2.2 | https://github.com/ivmai/bdwgc |
|
||||
| [`binutils`](binutils/) | GNU Binutils | 2.40 | https://www.gnu.org/software/binutils/ |
|
||||
| [`binutils`](binutils/) | GNU Binutils | 2.41 | https://www.gnu.org/software/binutils/ |
|
||||
| [`bison`](bison/) | GNU Bison | 3.8 | https://www.gnu.org/software/bison/ |
|
||||
| [`bochs`](bochs/) | Bochs x86 PC emulator | 2.7 | https://sourceforge.net/projects/bochs/ |
|
||||
| [`boost`](boost/) | Boost C++ libraries | 1.80.0 | https://www.boost.org/ |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env -S bash ../.port_include.sh
|
||||
port='binutils'
|
||||
version='2.40'
|
||||
version='2.41'
|
||||
useconfigure='true'
|
||||
use_fresh_config_sub='true'
|
||||
configopts=(
|
||||
@ -13,7 +13,7 @@ configopts=(
|
||||
"--enable-libiberty"
|
||||
)
|
||||
files=(
|
||||
"https://ftpmirror.gnu.org/gnu/binutils/binutils-${version}.tar.xz#0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1"
|
||||
"https://ftpmirror.gnu.org/gnu/binutils/binutils-${version}.tar.xz#ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450"
|
||||
)
|
||||
depends=(
|
||||
'zlib'
|
||||
|
@ -74,8 +74,8 @@ echo SYSROOT is "$SYSROOT"
|
||||
|
||||
mkdir -p "$DIR/Tarballs"
|
||||
|
||||
BINUTILS_VERSION="2.40"
|
||||
BINUTILS_MD5SUM="007b59bd908a737c06e5a8d3d2c737eb"
|
||||
BINUTILS_VERSION="2.41"
|
||||
BINUTILS_MD5SUM="256d7e0ad998e423030c84483a7c1e30"
|
||||
BINUTILS_NAME="binutils-$BINUTILS_VERSION"
|
||||
BINUTILS_PKG="${BINUTILS_NAME}.tar.xz"
|
||||
BINUTILS_BASE_URL="https://ftpmirror.gnu.org/gnu/binutils"
|
||||
|
@ -32,10 +32,10 @@ On AArch64, we set `COMMONPAGESIZE` to enable RELRO support.
|
||||
create mode 100644 ld/emulparams/elf_x86_64_serenity.sh
|
||||
|
||||
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
||||
index 1b0111fd410dcef529bc4d94e2c314678cdd4a2b..e488c40982f8ddb62861aa333dffeb06341f56f8 100644
|
||||
index bdee53957c0ca034161715f86e84fcc950d7b625..dc97a5e4a57709736c62f4f4555dd92c0cabd507 100644
|
||||
--- a/bfd/config.bfd
|
||||
+++ b/bfd/config.bfd
|
||||
@@ -285,6 +285,11 @@ case "${targ}" in
|
||||
@@ -283,6 +283,11 @@ case "${targ}" in
|
||||
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
|
||||
want64=true
|
||||
;;
|
||||
@ -44,10 +44,10 @@ index 1b0111fd410dcef529bc4d94e2c314678cdd4a2b..e488c40982f8ddb62861aa333dffeb06
|
||||
+ targ_selvecs=
|
||||
+ want64=true
|
||||
+ ;;
|
||||
aarch64-*-linux* | aarch64-*-netbsd*)
|
||||
aarch64-*-linux* | aarch64-*-netbsd* | aarch64-*-nto*)
|
||||
targ_defvec=aarch64_elf64_le_vec
|
||||
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_le_vec aarch64_pe_le_vec"
|
||||
@@ -736,6 +741,11 @@ case "${targ}" in
|
||||
@@ -734,6 +739,11 @@ case "${targ}" in
|
||||
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec"
|
||||
want64=true
|
||||
;;
|
||||
@ -60,10 +60,10 @@ index 1b0111fd410dcef529bc4d94e2c314678cdd4a2b..e488c40982f8ddb62861aa333dffeb06
|
||||
i[3-7]86-*-lynxos*)
|
||||
targ_defvec=i386_elf32_vec
|
||||
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
|
||||
index 66d5ea5a99da47a61bf18623f6bd09b10c5f124d..5bc391ab7c3ee5028b91e5652e978daef0bc33d1 100644
|
||||
index de35ee2a2c6952e596e2f5092a22dee5cc54d92c..7f9c91019432a86d4eb1e94bfe7b9ffd6976057a 100644
|
||||
--- a/gas/config/tc-i386.c
|
||||
+++ b/gas/config/tc-i386.c
|
||||
@@ -492,7 +492,8 @@ const char extra_symbol_chars[] = "*%-([{}"
|
||||
@@ -501,7 +501,8 @@ const char extra_symbol_chars[] = "*%-([{}"
|
||||
&& !defined (TE_Haiku) \
|
||||
&& !defined (TE_FreeBSD) \
|
||||
&& !defined (TE_DragonFly) \
|
||||
@ -83,18 +83,18 @@ index 0000000000000000000000000000000000000000..f38faf598cba7f561ed9528ee3732822
|
||||
+
|
||||
+#define TE_SerenityOS 1
|
||||
diff --git a/gas/configure.tgt b/gas/configure.tgt
|
||||
index 765ba73633df54b51eec560002cc234ce98205c3..67bc105e8c8b2a64afad2ae6d7a360f423cb65ab 100644
|
||||
index 3429f850d05a23783d6736d875c649f5acf48afa..cc83c4d94da21fa278f7f2bdd32b436bd4b540a3 100644
|
||||
--- a/gas/configure.tgt
|
||||
+++ b/gas/configure.tgt
|
||||
@@ -134,6 +134,7 @@ case ${generic_target} in
|
||||
aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
|
||||
esac ;;
|
||||
aarch64*-*-netbsd*) fmt=elf em=nbsd;;
|
||||
+ aarch64*-*-serenity*) fmt=elf em=serenity ;;
|
||||
@@ -137,6 +137,7 @@ case ${generic_target} in
|
||||
aarch64*-*-nto*) fmt=elf;;
|
||||
aarch64*-*-openbsd*) fmt=elf;;
|
||||
aarch64*-*-pe*) fmt=coff em=pepaarch64 ;;
|
||||
aarch64*-*-pe* | aarch64*-*-mingw*) fmt=coff em=pepaarch64 ;;
|
||||
+ aarch64*-*-serenity*) fmt=elf em=serenity ;;
|
||||
alpha-*-*vms*) fmt=evax ;;
|
||||
@@ -264,6 +265,7 @@ case ${generic_target} in
|
||||
alpha-*-osf*) fmt=ecoff ;;
|
||||
alpha-*-linux*ecoff*) fmt=ecoff ;;
|
||||
@@ -265,6 +266,7 @@ case ${generic_target} in
|
||||
i386-*-*nt*) fmt=coff em=pe ;;
|
||||
i386-*-rdos*) fmt=elf ;;
|
||||
i386-*-darwin*) fmt=macho ;;
|
||||
@ -111,18 +111,18 @@ index 765ba73633df54b51eec560002cc234ce98205c3..67bc105e8c8b2a64afad2ae6d7a360f4
|
||||
riscv*-*-*) fmt=elf ;;
|
||||
|
||||
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
||||
index 12b2c3c453fdbdb1fcac74bf5047bc4d0001483f..476c508b114ee81e0aebe25682635807bb7d84ec 100644
|
||||
index c3adbb0ccadacb5060988fe0aa24700b7cb489b4..5bbb3a61738a4cce09ba9b8b58d329c3bd5a36ec 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -389,6 +389,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eaarch64linux32b.c \
|
||||
@@ -390,6 +390,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eaarch64linuxb.c \
|
||||
eaarch64nto.c \
|
||||
eaarch64pe.c \
|
||||
+ eaarch64serenity.c \
|
||||
earm64pe.c \
|
||||
eelf32_x86_64.c \
|
||||
eelf32b4300.c \
|
||||
eelf32bmip.c \
|
||||
@@ -442,6 +443,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
@@ -444,6 +445,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eelf64lppc.c \
|
||||
eelf64lppc_fbsd.c \
|
||||
eelf64lriscv.c \
|
||||
@ -130,7 +130,7 @@ index 12b2c3c453fdbdb1fcac74bf5047bc4d0001483f..476c508b114ee81e0aebe25682635807
|
||||
eelf64lriscv_lp64.c \
|
||||
eelf64lriscv_lp64f.c \
|
||||
eelf64ltsmip.c \
|
||||
@@ -457,6 +459,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
@@ -459,6 +461,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eelf_x86_64_cloudabi.c \
|
||||
eelf_x86_64_fbsd.c \
|
||||
eelf_x86_64_haiku.c \
|
||||
@ -138,15 +138,15 @@ index 12b2c3c453fdbdb1fcac74bf5047bc4d0001483f..476c508b114ee81e0aebe25682635807
|
||||
eelf_x86_64_sol2.c \
|
||||
ehppa64linux.c \
|
||||
ei386pep.c \
|
||||
@@ -881,6 +884,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Pc@am__quote@
|
||||
@@ -885,6 +888,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nto.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64pe.Pc@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64serenity.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm64pe.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_x86_64.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32b4300.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32bmip.Pc@am__quote@
|
||||
@@ -934,6 +938,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@@ -939,6 +943,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@
|
||||
@ -154,7 +154,7 @@ index 12b2c3c453fdbdb1fcac74bf5047bc4d0001483f..476c508b114ee81e0aebe25682635807
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Pc@am__quote@
|
||||
@@ -949,6 +954,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@@ -954,6 +959,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
|
||||
@ -163,18 +163,18 @@ index 12b2c3c453fdbdb1fcac74bf5047bc4d0001483f..476c508b114ee81e0aebe25682635807
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehppa64linux.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pep.Pc@am__quote@
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293ad9d4e2fb 100644
|
||||
index d1a5602643787c240b5323c6c09b9d2bbc813e79..b18a0ed9cede77b1665bb0716176091ac02f5fe9 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -889,6 +889,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eaarch64linux32b.c \
|
||||
@@ -890,6 +890,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eaarch64linuxb.c \
|
||||
eaarch64nto.c \
|
||||
eaarch64pe.c \
|
||||
+ eaarch64serenity.c \
|
||||
earm64pe.c \
|
||||
eelf32_x86_64.c \
|
||||
eelf32b4300.c \
|
||||
eelf32bmip.c \
|
||||
@@ -942,6 +943,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
@@ -944,6 +945,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eelf64lppc.c \
|
||||
eelf64lppc_fbsd.c \
|
||||
eelf64lriscv.c \
|
||||
@ -182,7 +182,7 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
eelf64lriscv_lp64.c \
|
||||
eelf64lriscv_lp64f.c \
|
||||
eelf64ltsmip.c \
|
||||
@@ -957,6 +959,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
@@ -959,6 +961,7 @@ ALL_64_EMULATION_SOURCES = \
|
||||
eelf_x86_64_cloudabi.c \
|
||||
eelf_x86_64_fbsd.c \
|
||||
eelf_x86_64_haiku.c \
|
||||
@ -190,15 +190,15 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
eelf_x86_64_sol2.c \
|
||||
ehppa64linux.c \
|
||||
ei386pep.c \
|
||||
@@ -1266,6 +1269,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Po@am__quote@
|
||||
@@ -1271,6 +1274,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nto.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64pe.Po@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64serenity.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaix5ppc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaix5rs6.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaixppc.Po@am__quote@
|
||||
@@ -1441,6 +1445,7 @@ distclean-compile:
|
||||
@@ -1447,6 +1451,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Po@am__quote@
|
||||
@ -206,7 +206,7 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@
|
||||
@@ -1465,6 +1470,7 @@ distclean-compile:
|
||||
@@ -1471,6 +1476,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
|
||||
@ -214,15 +214,15 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf_linux.Po@am__quote@
|
||||
@@ -2555,6 +2561,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Pc@am__quote@
|
||||
@@ -2602,6 +2608,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linuxb.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64nto.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64pe.Pc@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64serenity.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm64pe.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32_x86_64.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32b4300.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32bmip.Pc@am__quote@
|
||||
@@ -2608,6 +2615,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@@ -2656,6 +2663,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@
|
||||
@ -230,7 +230,7 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Pc@am__quote@
|
||||
@@ -2623,6 +2631,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@@ -2671,6 +2679,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
|
||||
@ -239,7 +239,7 @@ index 3d5685d6bae1ce6258f053190da8d84f9eaba463..cefb4b831053e24322081900d8f3293a
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehppa64linux.Pc@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pep.Pc@am__quote@
|
||||
diff --git a/ld/configure.tgt b/ld/configure.tgt
|
||||
index de04a44b8125f08095b792285be5ddbaf41e95f2..69d017f96fa5cb908a9119973374b1752e1b9563 100644
|
||||
index c62b9581d9b8bb0bb000ff83247baa6144b9921b..6d0d7b2e0dee06be5c808aa933643e4c9eff0a7a 100644
|
||||
--- a/ld/configure.tgt
|
||||
+++ b/ld/configure.tgt
|
||||
@@ -97,6 +97,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd
|
||||
@ -252,7 +252,7 @@ index de04a44b8125f08095b792285be5ddbaf41e95f2..69d017f96fa5cb908a9119973374b175
|
||||
aarch64_be-*-linux-gnu_ilp32)
|
||||
targ_emul=aarch64linux32b
|
||||
targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi"
|
||||
@@ -820,6 +823,9 @@ riscv64*-*-linux*) targ_emul=elf64lriscv
|
||||
@@ -825,6 +828,9 @@ riscv64*-*-linux*) targ_emul=elf64lriscv
|
||||
targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
||||
@ -262,7 +262,7 @@ index de04a44b8125f08095b792285be5ddbaf41e95f2..69d017f96fa5cb908a9119973374b175
|
||||
riscv64be*-*-*) targ_emul=elf64briscv
|
||||
targ_extra_emuls="elf32briscv elf64lriscv elf32lriscv"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
@@ -1012,6 +1018,9 @@ x86_64-*-linux-*) targ_emul=elf_x86_64
|
||||
@@ -1011,6 +1017,9 @@ x86_64-*-linux-*) targ_emul=elf_x86_64
|
||||
x86_64-*-redox*) targ_emul=elf_x86_64
|
||||
targ_extra_emuls=elf_i386
|
||||
;;
|
||||
|
@ -0,0 +1,270 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fangrui Song <maskray@google.com>
|
||||
Date: Sat, 22 May 2021 23:10:21 -0700
|
||||
Subject: [PATCH] ld: Add -Bsymbolic-non-weak-functions
|
||||
|
||||
This option is a subset of -Bsymbolic-functions: only STB_GLOBAL are
|
||||
considered. Vague linkage functions are STB_WEAK. A vague linkage
|
||||
function may have different addresses in a -Bsymbolic-functions linked
|
||||
shared object and outside the shared object.
|
||||
-Bsymbolic-non-weak-functions can keep pointer equality while providing
|
||||
most benefits: (a) fewer JUMP_SLOT (symbol lookups) (b) avoid PLT
|
||||
entries for default visibility defined functions.
|
||||
|
||||
PR 27871
|
||||
include/
|
||||
* bfdlink.h (struct bfd_link_info): Add dynamic_weak_functions.
|
||||
ld/
|
||||
* ldlex.h (enum option_values): Add OPTION_SYMBOLIC_NON_WEAK_FUNCTIONS.
|
||||
* lexsup.c (struct ld_options): Add -Bsymbolic-non-weak-functions.
|
||||
(enum symbolic_enum): Add symbolic_non_weak_functions.
|
||||
(parse_args): Handle -Bsymbolic-non-weak-functions.
|
||||
* ld.texi: Document -Bsymbolic-non-weak-functions.
|
||||
* NEWS: Mention -Bsymbolic-non-weak-functions.
|
||||
* testsuite/ld-elf/shared.exp: Add tests.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func.s: New file.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func-a.rd: Likewise.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func-b.rd: Likewise.
|
||||
---
|
||||
bfd/elflink.c | 12 +++++-----
|
||||
include/bfdlink.h | 3 +++
|
||||
ld/NEWS | 2 ++
|
||||
ld/ld.texi | 15 ++++++++++---
|
||||
ld/ldlex.h | 1 +
|
||||
ld/lexsup.c | 17 +++++++++++---
|
||||
ld/testsuite/ld-elf/shared.exp | 22 +++++++++++++++++++
|
||||
.../ld-elf/symbolic-non-weak-func-a.rd | 4 ++++
|
||||
.../ld-elf/symbolic-non-weak-func-b.rd | 4 ++++
|
||||
ld/testsuite/ld-elf/symbolic-non-weak-func.s | 18 +++++++++++++++
|
||||
10 files changed, 85 insertions(+), 13 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-elf/symbolic-non-weak-func-a.rd
|
||||
create mode 100644 ld/testsuite/ld-elf/symbolic-non-weak-func-b.rd
|
||||
create mode 100644 ld/testsuite/ld-elf/symbolic-non-weak-func.s
|
||||
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index 7217c2f038baf9cf1df122cc5bb82ac99c00a51e..b7f14694f277f91e6a58491548fae52382683ca6 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -608,14 +608,12 @@ bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
|
||||
if(h->dynamic || bfd_link_relocatable (info))
|
||||
return;
|
||||
|
||||
+ int type = sym != NULL ? ELF_ST_TYPE (sym->st_info) : STT_NOTYPE;
|
||||
if ((info->dynamic_data
|
||||
- && (h->type == STT_OBJECT
|
||||
- || h->type == STT_COMMON
|
||||
- || (sym != NULL
|
||||
- && (ELF_ST_TYPE (sym->st_info) == STT_OBJECT
|
||||
- || ELF_ST_TYPE (sym->st_info) == STT_COMMON))))
|
||||
- || (d != NULL
|
||||
- && h->non_elf
|
||||
+ && (type == STT_OBJECT || type == STT_COMMON))
|
||||
+ || (info->dynamic_weak_functions && type == STT_FUNC
|
||||
+ && ELF_ST_BIND (sym->st_info) == STB_WEAK)
|
||||
+ || (d != NULL && h->non_elf
|
||||
&& (*d->match) (&d->head, NULL, h->root.root.string)))
|
||||
{
|
||||
h->dynamic = 1;
|
||||
diff --git a/include/bfdlink.h b/include/bfdlink.h
|
||||
index 840790a298c3f8894494c5266b2de0560ceecfd2..632bf8fdd2ec2c4bf1ee8573884c18b3a2c1bb3f 100644
|
||||
--- a/include/bfdlink.h
|
||||
+++ b/include/bfdlink.h
|
||||
@@ -368,6 +368,9 @@ struct bfd_link_info
|
||||
/* TRUE if all data symbols should be dynamic. */
|
||||
unsigned int dynamic_data: 1;
|
||||
|
||||
+ /* TRUE if all weak function symbols should be dynamic. */
|
||||
+ unsigned int dynamic_weak_functions: 1;
|
||||
+
|
||||
/* TRUE if section groups should be resolved. */
|
||||
unsigned int resolve_section_groups: 1;
|
||||
|
||||
diff --git a/ld/NEWS b/ld/NEWS
|
||||
index e1ac20b8a97399136cc04b21e677292dd3bf8c66..5e37f9d0c11f8ef8a4900a9d11ba1df50e26c3d6 100644
|
||||
--- a/ld/NEWS
|
||||
+++ b/ld/NEWS
|
||||
@@ -104,6 +104,8 @@ Changes in 2.37:
|
||||
|
||||
* Add -Bno-symbolic to cancel -Bsymbolic and -Bsymbolic-functions.
|
||||
|
||||
+* Add -Bsymbolic-non-weak-functions as a safe subset of -Bsymbolic-functions.
|
||||
+
|
||||
Changes in 2.36:
|
||||
|
||||
* Add libdep plugin, for linking dependencies of static libraries that
|
||||
diff --git a/ld/ld.texi b/ld/ld.texi
|
||||
index aa8b1aa86eb386358bc18662f1f0b2fce4996763..49b7dfe80d81ba59e7bd86dbae8c4dadc25b9c77 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -1739,7 +1739,7 @@ libraries.
|
||||
|
||||
@kindex -Bsymbolic
|
||||
@item -Bsymbolic
|
||||
-When creating a shared library, bind references to global symbols to the
|
||||
+When creating a shared library, bind references to non-local symbols to the
|
||||
definition within the shared library, if any. Normally, it is possible
|
||||
for a program linked against a shared library to override the definition
|
||||
within the shared library. This option is only meaningful on ELF
|
||||
@@ -1747,11 +1747,20 @@ platforms which support shared libraries.
|
||||
|
||||
@kindex -Bsymbolic-functions
|
||||
@item -Bsymbolic-functions
|
||||
-When creating a shared library, bind references to global function
|
||||
-symbols to the definition within the shared library, if any.
|
||||
+When creating a shared library, bind references to non-local function
|
||||
+symbols to the definition within the shared library, if any. A vague linkage
|
||||
+function definition is weak. It may have different addresses in the linked
|
||||
+shared library and outside the shared library.
|
||||
This option is only meaningful on ELF platforms which support shared
|
||||
libraries.
|
||||
|
||||
+@kindex -Bsymbolic-non-weak-functions
|
||||
+@item -Bsymbolic-non-weak-functions
|
||||
+When creating a shared library, bind references to @code{STB_GLOBAL} function
|
||||
+symbols to the definition within the shared library, if any. Noticeably this
|
||||
+option skips C++ vague linkage functions and is thus safe.
|
||||
+This option is only meaningful on ELF platforms which support shared libraries.
|
||||
+
|
||||
@kindex -Bno-symbolic
|
||||
@item -Bno-symbolic
|
||||
This option can cancel previously specified @samp{-Bsymbolic} and
|
||||
diff --git a/ld/ldlex.h b/ld/ldlex.h
|
||||
index 87cac02141d8c8cf090001ec877dd4e458d19c1b..1a571a7ce331487b2d809bbbd562a5ce32d4e6d7 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -64,6 +64,7 @@ enum option_values
|
||||
OPTION_SORT_SECTION,
|
||||
OPTION_STATS,
|
||||
OPTION_SYMBOLIC,
|
||||
+ OPTION_SYMBOLIC_NON_WEAK_FUNCTIONS,
|
||||
OPTION_SYMBOLIC_FUNCTIONS,
|
||||
OPTION_TASK_LINK,
|
||||
OPTION_TBSS,
|
||||
diff --git a/ld/lexsup.c b/ld/lexsup.c
|
||||
index fe8722313fedf6d72846fc45418831e5c77efab6..128ffadea5e9a8751336bcc86e3243f66a4e7411 100644
|
||||
--- a/ld/lexsup.c
|
||||
+++ b/ld/lexsup.c
|
||||
@@ -315,9 +315,11 @@ static const struct ld_option ld_options[] =
|
||||
{ {"Bno-symbolic", no_argument, NULL, OPTION_NO_SYMBOLIC},
|
||||
'\0', NULL, N_("Don't bind global references locally"), ONE_DASH },
|
||||
{ {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
|
||||
- '\0', NULL, N_("Bind global references locally"), ONE_DASH },
|
||||
+ '\0', NULL, N_("Bind default visibility defined symbols locally for -shared"), ONE_DASH },
|
||||
+ { {"Bsymbolic-non-weak-functions", no_argument, NULL, OPTION_SYMBOLIC_NON_WEAK_FUNCTIONS},
|
||||
+ '\0', NULL, N_("Bind default visibility defined STB_GLOBAL function symbols locally for -shared"), ONE_DASH },
|
||||
{ {"Bsymbolic-functions", no_argument, NULL, OPTION_SYMBOLIC_FUNCTIONS},
|
||||
- '\0', NULL, N_("Bind global function references locally"), ONE_DASH },
|
||||
+ '\0', NULL, N_("Bind default visibility defined function symbols locally for -shared"), ONE_DASH },
|
||||
{ {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
|
||||
'\0', NULL, N_("Check section addresses for overlaps (default)"),
|
||||
TWO_DASHES },
|
||||
@@ -647,8 +649,9 @@ parse_args (unsigned argc, char **argv)
|
||||
enum symbolic_enum
|
||||
{
|
||||
symbolic_unset = 0,
|
||||
- symbolic,
|
||||
+ symbolic_non_weak_functions,
|
||||
symbolic_functions,
|
||||
+ symbolic,
|
||||
} opt_symbolic = symbolic_unset;
|
||||
enum dynamic_list_enum
|
||||
{
|
||||
@@ -1372,6 +1375,9 @@ parse_args (unsigned argc, char **argv)
|
||||
case OPTION_SYMBOLIC:
|
||||
opt_symbolic = symbolic;
|
||||
break;
|
||||
+ case OPTION_SYMBOLIC_NON_WEAK_FUNCTIONS:
|
||||
+ opt_symbolic = symbolic_non_weak_functions;
|
||||
+ break;
|
||||
case OPTION_SYMBOLIC_FUNCTIONS:
|
||||
opt_symbolic = symbolic_functions;
|
||||
break;
|
||||
@@ -1996,6 +2002,11 @@ parse_args (unsigned argc, char **argv)
|
||||
link_info.dynamic = true;
|
||||
link_info.dynamic_data = true;
|
||||
break;
|
||||
+ case symbolic_non_weak_functions:
|
||||
+ link_info.dynamic = true;
|
||||
+ link_info.dynamic_data = true;
|
||||
+ link_info.dynamic_weak_functions = true;
|
||||
+ break;
|
||||
}
|
||||
|
||||
/* -z nosectionheader implies --strip-all. */
|
||||
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
|
||||
index cf010e5b0e59576a047476ecaa2d9a74c8cc7ed0..d5508912aa286e4a552b9b0270afa815a7d8a960 100644
|
||||
--- a/ld/testsuite/ld-elf/shared.exp
|
||||
+++ b/ld/testsuite/ld-elf/shared.exp
|
||||
@@ -459,6 +459,28 @@ run_ld_link_tests [list \
|
||||
"symbolic-func.so"] \
|
||||
]
|
||||
|
||||
+if {[istarget "aarch64*-*-*"] || [istarget "powerpc*-*-*"] ||
|
||||
+ [istarget "i?86-*-*"] || [istarget "x86_64-*-*"]} {
|
||||
+ run_ld_link_tests [list \
|
||||
+ [list "-Bsymbolic-non-weak-functions -Bsymbolic" \
|
||||
+ "-shared -Bsymbolic-non-weak-functions -Bsymbolic" "" "$AFLAGS_PIC" \
|
||||
+ {symbolic-non-weak-func.s} {{readelf {-r --wide} symbolic-non-weak-func-a.rd}} \
|
||||
+ "symbolic-non-weak-func-a.so"] \
|
||||
+ ]
|
||||
+ run_ld_link_tests [list \
|
||||
+ [list "-Bsymbolic-non-weak-functions" \
|
||||
+ "-shared -Bsymbolic-non-weak-functions" "" "$AFLAGS_PIC" \
|
||||
+ {symbolic-non-weak-func.s} {{readelf {-r --wide} symbolic-non-weak-func-b.rd}} \
|
||||
+ "symbolic-non-weak-func-b.so"] \
|
||||
+ ]
|
||||
+ run_ld_link_tests [list \
|
||||
+ [list "-Bsymbolic-functions -Bsymbolic-non-weak-functions" \
|
||||
+ "-shared -Bsymbolic-functions -Bsymbolic-non-weak-functions" "" "$AFLAGS_PIC" \
|
||||
+ {symbolic-non-weak-func.s} {{readelf {-r --wide} symbolic-non-weak-func-b.rd}} \
|
||||
+ "symbolic-non-weak-func-b.so"] \
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
run_ld_link_tests [list \
|
||||
[list "Build pr20995.so" \
|
||||
"-shared" "" "$AFLAGS_PIC" \
|
||||
diff --git a/ld/testsuite/ld-elf/symbolic-non-weak-func-a.rd b/ld/testsuite/ld-elf/symbolic-non-weak-func-a.rd
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ef591840f5c338a55f6d44fc372568569011c430
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/symbolic-non-weak-func-a.rd
|
||||
@@ -0,0 +1,4 @@
|
||||
+#...
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.*_RELATIVE .*
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.*_RELATIVE .*
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.*_RELATIVE .*
|
||||
diff --git a/ld/testsuite/ld-elf/symbolic-non-weak-func-b.rd b/ld/testsuite/ld-elf/symbolic-non-weak-func-b.rd
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34228b0627b226cfdc76e3cedff6f515b7c27872
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/symbolic-non-weak-func-b.rd
|
||||
@@ -0,0 +1,4 @@
|
||||
+#...
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.*_RELATIVE .*
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.*_RELATIVE .*
|
||||
+[0-9a-f]+ +[0-9a-f]+ +R_.* weak_fun.*
|
||||
diff --git a/ld/testsuite/ld-elf/symbolic-non-weak-func.s b/ld/testsuite/ld-elf/symbolic-non-weak-func.s
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e259f12bfc126bf2ef9bf16aba64667ca4e2bfd5
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/symbolic-non-weak-func.s
|
||||
@@ -0,0 +1,18 @@
|
||||
+ .text
|
||||
+ .global global_fun
|
||||
+ .type global_fun, %function
|
||||
+global_fun:
|
||||
+ .space 4
|
||||
+ .weak weak_fun
|
||||
+ .type weak_fun, %function
|
||||
+weak_fun:
|
||||
+ .space 4
|
||||
+
|
||||
+ .section .data,"aw",%progbits
|
||||
+ .p2align 3
|
||||
+ .dc.a global_data
|
||||
+ .dc.a global_fun
|
||||
+ .dc.a weak_fun
|
||||
+
|
||||
+ .global global_data
|
||||
+global_data:
|
@ -14,3 +14,30 @@ division in constant expressions in assembly files (cf. as --divide).
|
||||
|
||||
On AArch64, we set `COMMONPAGESIZE` to enable RELRO support.
|
||||
|
||||
## `0002-ld-Add-Bsymbolic-non-weak-functions.patch`
|
||||
|
||||
ld: Add -Bsymbolic-non-weak-functions
|
||||
|
||||
This option is a subset of -Bsymbolic-functions: only STB_GLOBAL are
|
||||
considered. Vague linkage functions are STB_WEAK. A vague linkage
|
||||
function may have different addresses in a -Bsymbolic-functions linked
|
||||
shared object and outside the shared object.
|
||||
-Bsymbolic-non-weak-functions can keep pointer equality while providing
|
||||
most benefits: (a) fewer JUMP_SLOT (symbol lookups) (b) avoid PLT
|
||||
entries for default visibility defined functions.
|
||||
|
||||
PR 27871
|
||||
include/
|
||||
* bfdlink.h (struct bfd_link_info): Add dynamic_weak_functions.
|
||||
ld/
|
||||
* ldlex.h (enum option_values): Add OPTION_SYMBOLIC_NON_WEAK_FUNCTIONS.
|
||||
* lexsup.c (struct ld_options): Add -Bsymbolic-non-weak-functions.
|
||||
(enum symbolic_enum): Add symbolic_non_weak_functions.
|
||||
(parse_args): Handle -Bsymbolic-non-weak-functions.
|
||||
* ld.texi: Document -Bsymbolic-non-weak-functions.
|
||||
* NEWS: Mention -Bsymbolic-non-weak-functions.
|
||||
* testsuite/ld-elf/shared.exp: Add tests.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func.s: New file.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func-a.rd: Likewise.
|
||||
* testsuite/ld-elf/symbolic-non-weak-func-b.rd: Likewise.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user