From 2c9ea8d0ea3c4510b5a4c9314c84c4444c933726 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 22 Sep 2023 23:51:50 -0500 Subject: system/binutils: Update to 2.41 * Vastly updated with significant features and target support. * All tests are enabled now and passing! Note: ARMv7 tests require the commit directly before this to be applied to system/gcc. Fixes: #652, #668, #1070 --- system/binutils/APKBUILD | 91 ++++---- system/binutils/BTS-170.patch | 12 +- system/binutils/BTS-196.patch | 81 +------ system/binutils/CVE-2019-12972.patch | 33 --- system/binutils/CVE-2019-14250.patch | 25 --- system/binutils/CVE-2019-14444.patch | 28 --- system/binutils/CVE-2019-17450.patch | 87 -------- system/binutils/CVE-2019-17451.patch | 38 ---- system/binutils/CVE-2019-9070-and-9071.patch | 128 ----------- system/binutils/CVE-2019-9073.patch | 31 --- system/binutils/CVE-2019-9074.patch | 49 ----- system/binutils/CVE-2019-9075.patch | 96 --------- system/binutils/CVE-2019-9077.patch | 33 --- system/binutils/arm-pie.patch | 24 --- .../binutils/binutils-ld-fix-static-linking.patch | 6 +- system/binutils/disable-gnu-mbind.patch | 32 --- system/binutils/disable-ifunc-tests.patch | 13 +- system/binutils/disable-mbind2b.patch | 20 ++ system/binutils/disable-pr26580-test.patch | 20 ++ system/binutils/disable-preinit-array-tests.patch | 6 +- system/binutils/disable-relr-glibc-tests.patch | 19 ++ system/binutils/disable-sframe-tests.patch | 17 ++ system/binutils/disable-textrel-test.patch | 43 ++++ system/binutils/fix-deprecated-egrep-usage.patch | 240 --------------------- system/binutils/fix-pr28158-test.patch | 30 +++ system/binutils/musl-preinit-array.patch | 35 +++ system/binutils/musl-versioned-syms.patch | 19 ++ system/binutils/ppc32-pic-required.patch | 23 ++ system/binutils/ppc64-abiv2-addr2line.patch | 15 ++ system/binutils/pr25749-test-size.patch | 26 +++ system/binutils/remove-pr19553c-test.patch | 20 +- system/binutils/remove-pr19719-test.patch | 4 +- system/binutils/remove-pr2404-tests.patch | 82 ++++--- system/binutils/skip-thumb-plt-musl.patch | 28 +++ system/binutils/srec.patch | 127 ----------- system/binutils/vers-tests-eabi.patch | 33 +++ system/binutils/visibility-musl.patch | 19 ++ system/binutils/vsb-hammer.patch | 19 ++ 38 files changed, 500 insertions(+), 1152 deletions(-) delete mode 100644 system/binutils/CVE-2019-12972.patch delete mode 100644 system/binutils/CVE-2019-14250.patch delete mode 100644 system/binutils/CVE-2019-14444.patch delete mode 100644 system/binutils/CVE-2019-17450.patch delete mode 100644 system/binutils/CVE-2019-17451.patch delete mode 100644 system/binutils/CVE-2019-9070-and-9071.patch delete mode 100644 system/binutils/CVE-2019-9073.patch delete mode 100644 system/binutils/CVE-2019-9074.patch delete mode 100644 system/binutils/CVE-2019-9075.patch delete mode 100644 system/binutils/CVE-2019-9077.patch delete mode 100644 system/binutils/arm-pie.patch delete mode 100644 system/binutils/disable-gnu-mbind.patch create mode 100644 system/binutils/disable-mbind2b.patch create mode 100644 system/binutils/disable-pr26580-test.patch create mode 100644 system/binutils/disable-relr-glibc-tests.patch create mode 100644 system/binutils/disable-sframe-tests.patch create mode 100644 system/binutils/disable-textrel-test.patch create mode 100644 system/binutils/fix-pr28158-test.patch create mode 100644 system/binutils/musl-preinit-array.patch create mode 100644 system/binutils/musl-versioned-syms.patch create mode 100644 system/binutils/ppc32-pic-required.patch create mode 100644 system/binutils/ppc64-abiv2-addr2line.patch create mode 100644 system/binutils/pr25749-test-size.patch create mode 100644 system/binutils/skip-thumb-plt-musl.patch delete mode 100644 system/binutils/srec.patch create mode 100644 system/binutils/vers-tests-eabi.patch create mode 100644 system/binutils/visibility-musl.patch create mode 100644 system/binutils/vsb-hammer.patch (limited to 'system/binutils') diff --git a/system/binutils/APKBUILD b/system/binutils/APKBUILD index 3399281d9..0ba167363 100644 --- a/system/binutils/APKBUILD +++ b/system/binutils/APKBUILD @@ -1,14 +1,10 @@ # Maintainer: Adelie Platform Group pkgname=binutils -pkgver=2.32 -pkgrel=5 +pkgver=2.41 +pkgrel=0 pkgdesc="Tools necessary to build programs" url="https://www.gnu.org/software/binutils/" arch="all" -case "${CARCH}" in - armv7) options="${options} !check"; ;; #209, #668 - ppc) options="${options} !check"; ;; # non-PIC is unsupported by musl/ppc -esac license="GPL-2.0+ AND GPL-3.0+ AND LGPL-2.0+ AND LGPL-2.1+ AND LGPL-3.0+ AND BSD-3-Clause" depends="" makedepends_build="byacc flex texinfo" @@ -17,25 +13,27 @@ makedepends="$makedepends_build $makedepends_host" checkdepends="dejagnu" subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-libs" source="https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz - arm-pie.patch binutils-ld-fix-static-linking.patch - disable-gnu-mbind.patch disable-ifunc-tests.patch + disable-mbind2b.patch + disable-pr26580-test.patch disable-preinit-array-tests.patch + disable-relr-glibc-tests.patch + disable-sframe-tests.patch + disable-textrel-test.patch + fix-pr28158-test.patch + musl-preinit-array.patch + musl-versioned-syms.patch + ppc32-pic-required.patch + ppc64-abiv2-addr2line.patch + pr25749-test-size.patch remove-pr2404-tests.patch remove-pr19719-test.patch remove-pr19553c-test.patch - srec.patch - CVE-2019-9070-and-9071.patch - CVE-2019-9073.patch - CVE-2019-9074.patch - CVE-2019-9075.patch - CVE-2019-9077.patch - CVE-2019-12972.patch - CVE-2019-14250.patch - CVE-2019-14444.patch - CVE-2019-17450.patch - CVE-2019-17451.patch + skip-thumb-plt-musl.patch + vers-tests-eabi.patch + visibility-musl.patch + vsb-hammer.patch BTS-170.patch BTS-196.patch fix-deprecated-egrep-usage.patch @@ -73,9 +71,9 @@ fi # - CVE-2019-17451 build() { - local _sysroot=/ - local _cross_configure="--enable-install-libiberty" - local _arch_configure="" + _sysroot=/ + _cross_configure="--enable-install-libiberty" + _arch_configure="" if [ "$CHOST" != "$CTARGET" ]; then _sysroot="$CBUILDROOT" @@ -108,6 +106,7 @@ build() { --enable-64-bit-bfd \ --enable-plugins \ --enable-relro \ + --enable-gprofng=no \ --disable-gold \ --enable-deterministic-archives \ $_cross_configure \ @@ -145,26 +144,28 @@ libs() { mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/ } -sha512sums="d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a binutils-2.32.tar.xz -2f862c473b357effe63221a47c4a34893eff50e4ab3c7b500b19754f3c7bf81ee695c35e5ce16f6c6fcd75696d270d04f282ae4c7d32b42a61b667ff1eccce8f arm-pie.patch -ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch -d378fdf1964f8f2bd0b1e62827ac5884bdf943aa435ec89c29fc84bb045d406b733fffaff8fdd8bd1cba8ddea7701c4cf6ccf3ed76a8a3df9c72b447737575a6 disable-gnu-mbind.patch -474ab24097bbb5b24433620549e5234fe65c547824c1342f693c718ffbc81e2d968259cce2d650b55200dd1ec89da207ea2db10c551cd9941285c4600b4297b2 disable-ifunc-tests.patch -3537752e63cef0b5ef136d003ff7e814ba66b12624d817430112d0f291a792e8960fa69a78036f526af835441b3ee483d6a53d55c7b3dd8ee96f0399682dbcbe disable-preinit-array-tests.patch -32ab4215669c728648179c124632467573a3d4675e79f0f0d221c22eb2ec1ca5488b79910bd09142f90a1e0d0b81d99ca4846297f4f9561f158db63745facb66 remove-pr2404-tests.patch -a193d1fa7f42d91915960460a15e4d24e0df529d81e23014bcf45d283fae76bb7b300fdcb0d0a9d521cdb9137322efa1dc357112596d6ae7a7fd05988ac359b9 remove-pr19719-test.patch -39ef9c76dd5db6b15f11ffa8061f7ca844fb79c3fb9879c3b1466eef332a28b833597c87003ab9f260b1b85023fae264659088aee27cad7e5aa77b2d58b9a3f6 remove-pr19553c-test.patch -f720b3356b88e366c52941da056e543e4b42bc77f012e5b0290f79e15b0a31d855989ad01920680507a9df0544e5b8e26d0cf8d6f22fbdeb874af31cff4c16d3 srec.patch -f52d21f194c2d7dbdc56e93636d3228034ee1718b457e5a5ce289bba2454155846d1ff6ea8530d11a901a85c9af945360bc17cda9e7370c36362aa6c762154c7 CVE-2019-9070-and-9071.patch -032fed723b610fe06e210e2ebee8d24962ecad1dc69d98d38e95f768c9ed64cb991158758ef71e684d6d762a30e9a852287836be2bb8a2aba27fe31d2792c0a0 CVE-2019-9073.patch -16b4cc094a6846399e47271da6fe8d8bd8b70246e12e872fcafb85f11809b5699eddba723fbac664c062c02f9b5658ea9770e14c522e151cdea1d39e69c851dd CVE-2019-9074.patch -a46b9211608e2f35219b95363a5ba90506742dcb9e4bd4a43915af6c0b3e74bd8339a8318dc2923c0952ef579112412cb1cf619a5f090066769a852587b27d03 CVE-2019-9075.patch -c0f50f1a843480f29b3895c8814df9801b9f90260edbaff1831aa5738fedd07a9e6b7a79f5b6f9be34df4954dbf02feb5232ebbecc596277fc2fe63673ed347c CVE-2019-9077.patch -9109a6ff9c55f310f86a1561fe6b404534928d402672490059bbe358f77c0c2a7f73c8b67f0a4450f00ba1776452858b63fa60cf2ec0744104a6b077e8fa3e42 CVE-2019-12972.patch -c277202272d9883741c2530a94c6d50d55dd9d0a9efaa43a1f8c9fc7529bd45e635255c0d90035dfc5920d5387010a4259612a4d711260a95d7b3d9fa6500e4f CVE-2019-14250.patch -0942cc1a4c5ec03e931c6ebd15c5d60eae6be48cd0a3d9b7f6356f97361226bb6d53dbdcb01b20efcca0ccaf23764730d9bbad2c1bbe2ea6ca320e43b43b311b CVE-2019-14444.patch -4e8cbe3985ca4a7cb8954e4e03f094687985b3afec6bb14f1599665e0ab13e601b68cefdbb63e88f9dd59852036dcfee05af14014493c16c76dc38d406efc8fd CVE-2019-17450.patch -a71a035db5e14f105b5d58ec01ad250447f6282cae04e8c931fbdbf7adf118a065c6c9be9c72a204e0f8115b19598dc52f3953ae91200d48328b58cc274939d8 CVE-2019-17451.patch -d4543d2f77808d317d17a5f0eb9af21540ef8543fceaed4e3524213e31e058333321f3ba3b495199e3b57bfd0c4164929cf679369470389e26871b8895cb0110 BTS-170.patch -9cc17d9fe3fc1351d1f6b4fc1c916254529f3304c95db6f4698b867eeb623210b914dc798fb837eafbad2b287b78b31c4ed5482b3151a2992864da04e1dd5fac BTS-196.patch -2a1c66a4526e9afd2db59d560f2f1d491ea0c7741978bb75f35acfd3d883408b0374a47ce1013aad7579ed838a60820ffe34ef8cdd8ba390dca3a3244220803f fix-deprecated-egrep-usage.patch" +sha512sums="5df45d0bd6ddabdce4f35878c041e46a92deef01e7dea5facc97fd65cc06b59abc6fba0eb454b68e571c7e14038dc823fe7f2263843e6e627b7444eaf0fe9374 binutils-2.41.tar.xz +ced667e95bfec8909e20802cd3d734b0b179bfc9d995dd68827a471ab9a4fdc38397f3d947dcae1bf2368a73480be3f18d4ec6b757ac7fdb9ee358693cc0670f binutils-ld-fix-static-linking.patch +ae54a3728b6e674febf130979a434f525b77f93103eef9c023647a68eaf5b607dfe264ab553d2132f46e93956959d1adf71bbd176e80a42a33329e62f6f55c3e disable-ifunc-tests.patch +de3f50afe2b0962d1f52f154871285e9c6d7b5599b745365a8f14fd237c7b1d6a066d0d081ce67ad1317b37bae2875f27adfea52f3853d7e30003e74a84075c2 disable-mbind2b.patch +cbbb9d62f53b1f93bb7d5728e0fe7ef0ebb18f388bc228b396e4df8ce5dd1079e0d7ca0afb2928f6f1beba30475e7f68fe345daffab3cb3ef607ca5bdd87915d disable-pr26580-test.patch +4c8098df5c01579d1c53c0344bf5e0f1c3b11bc119da077d83e87f7d103ed958e78083f94e71b12521c5f0cb83b3dda509efadc4124bcc28b436b39245ab4603 disable-preinit-array-tests.patch +b2d5da2705366f5919d3f8310225620493b88406b6e909ddf9bd8c9ef50f13757816ff2947eb33c1832048fd1d42c3a2593c909ee35f2fdc947f8e2df5500c7b disable-relr-glibc-tests.patch +e8ebb984e9b13b75114c8092d1ad2d0c1b3bb59bf10e66ca250151e79844125a23f74b8c4142210c8e574785c35e0ee1df0499e0cfd6ef59e8e80d58121963e1 disable-sframe-tests.patch +8213bc7e965b7c93e24c755e3ca47c522e3ba0d8504ec1def58fad398dd215158740164276ec8a0b48f2058c7025b5b8b6b2e16e646baf4f7dc1841d4fc5a504 disable-textrel-test.patch +2972b86e1741866db244cd262469eaef244fc3fb0d569b58cb1ad427d31b3ffc9ccbde904e7bd78f10367a5bfe8ec7f4076253abe03edbabbb0e5894ccc20487 fix-pr28158-test.patch +8ef144efc8c0cc71b48d7ed9444fa70906c9a4894058588e3f49c1826975675ab8091681912a15ecbed6772aa5bba31935c92abef0095548fc8a9ecaa5d26526 musl-preinit-array.patch +ab4d03394073bb6dbd4a046637e9bf57f8b4dad163c551b0d9bb2202025b243161149c8622c2fae072c43082bbf19e15b667483831a58a5d1bc93b464763cdcc musl-versioned-syms.patch +7b5ee15c9e5a3567cb000a4ac07699f9d0f11354cf5ee20fd375e483945fd45d0e1551f3f28bdb8ebb49355b3180cc90977e81ae0c3c210cdc689add504952a7 ppc32-pic-required.patch +5456d4d6c1097f41e5c02d92ed83acf608eb05d912cf4d289e8f772e8eded9af2030c518b7a89133ef3905d084fc5354ec140e472c22fe11c6802c1e9a4237e7 ppc64-abiv2-addr2line.patch +c76733b76daf5d4af17464777cb753c68063fdc6040d943962c78182ca65f46a2744d4437f6cc3b8ff5f09ff8c0f582690b7dc89eaaf4da48f9300a81b8b3803 pr25749-test-size.patch +b97aa6fd5a0b5b71dadd7d9925a0642681ce96bb98348a01c5778e4e6570bd2e135ff0252dec6568e19df329fb1a36bcf495d332c0207573fe2e6e5842283d27 remove-pr2404-tests.patch +ac8d30f5af82653242355d7bb0835823ea474bc6d349df4a2e6db91d90f8f80ccab1ff4ede6734af76e79da2e083a1a90cb9ae0631e3d62d89bc5f5a57c24c92 remove-pr19719-test.patch +06f9df891a4ae0e9f6f8b3282d3691ede7cc0f08d63bf722f942f3c94dd4d7f3907b7bb5a8087e63639569e61aed6c39b5f5da7ad6566e7ef278524aa32ada63 remove-pr19553c-test.patch +bdfc92cdd6c31a68e09daf71e3c45900158f8222832bda14cb2f12d9d693e6f19fe00dd29a7af9850bf0a19afe6ef421a690195f1a4e96d3cc76370f1e3bd399 skip-thumb-plt-musl.patch +52f250970ba6814a7a992f6ad4a7c8bfbc9b5f0a0c422c920edf8b6c3dfbc353d13be940483bbbce1bfc543572c2abb06015df61a68a640774b827810d0dde6b vers-tests-eabi.patch +075565f9bc85c0fc4bd36c7a848f6b876b71fbbe0f572b5c21961687ab4e2cd00c784fba09fe92b214c4b1df871ebd6409e6c93dde5a0a6c1ef6e41a30b24520 visibility-musl.patch +55bdb08f93563449b170ba8623cd7d4409c8f22abb15fca23bc87f23cc43cd580fa149e68271e65fdf2c29ddb0a15cd78d6f0de1a50332fdc026ea1b7d0ec7b8 vsb-hammer.patch +c62365110dd0a550e55f1445b197f1f968849b1079439cda0d44778772964779b4ab1142ccc662ba75ebb040e09ef4b4bfc253f4632db24ed783155be2f5f3b1 BTS-170.patch +ab7d0c1fa74862bf9364d5e2228200054a2c5c4351c979dc7a9850f630d74034edffba740b468e009c5419a3cec110322364303f8af28dcdbfbe672c3c16f450 BTS-196.patch +95f2063ecb902148e53603211452ca21d4dec215c32a07c2eebc5881dbdc7cba34a7a49177fedf4db1d7d8542708af673a31930fd7d49a6a2eb00b47dbe6eeb9 fix-deprecated-egrep-usage.patch" diff --git a/system/binutils/BTS-170.patch b/system/binutils/BTS-170.patch index daca64319..c0c02dbc9 100644 --- a/system/binutils/BTS-170.patch +++ b/system/binutils/BTS-170.patch @@ -4,9 +4,9 @@ lea is being emitted instead of mov. https://bts.adelielinux.org/show_bug.cgi?id=170 https://bts.adelielinux.org/show_bug.cgi?id=196 ---- binutils-2.32/ld/testsuite/ld-x86-64/no-plt.exp 2019-01-19 10:01:34.000000000 -0600 -+++ binutils-2.32/ld/testsuite/ld-x86-64/no-plt.exp 2019-09-11 17:21:27.232257151 -0500 -@@ -100,15 +100,6 @@ run_cc_link_tests [list \ +--- binutils-2.41/ld/testsuite/ld-x86-64/no-plt.exp 2019-01-19 10:01:34.000000000 -0600 ++++ binutils-2.41/ld/testsuite/ld-x86-64/no-plt.exp 2019-09-11 17:21:27.232257151 -0500 +@@ -97,15 +97,6 @@ run_cc_link_tests [list \ "no-plt-1c" \ ] \ [list \ @@ -22,9 +22,9 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 "No PLT (PIE 1e)" \ "-pie tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \ ---- binutils-2.32/ld/testsuite/ld-i386/no-plt.exp 2019-01-19 10:01:33.000000000 -0600 -+++ binutils-2.32/ld/testsuite/ld-i386/no-plt.exp 2019-09-11 18:03:48.012302603 -0500 -@@ -102,15 +102,6 @@ run_cc_link_tests [list \ +--- binutils-2.41/ld/testsuite/ld-i386/no-plt.exp 2019-01-19 10:01:33.000000000 -0600 ++++ binutils-2.41/ld/testsuite/ld-i386/no-plt.exp 2019-09-11 18:03:48.012302603 -0500 +@@ -99,15 +99,6 @@ run_cc_link_tests [list \ "no-plt-1c" \ ] \ [list \ diff --git a/system/binutils/BTS-196.patch b/system/binutils/BTS-196.patch index 08316d279..d442f5921 100644 --- a/system/binutils/BTS-196.patch +++ b/system/binutils/BTS-196.patch @@ -1,75 +1,8 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 ---- binutils-2.32/ld/testsuite/ld-i386/i386.exp 2019-01-19 10:01:33.000000000 -0600 -+++ binutils-2.32/ld/testsuite/ld-i386/i386.exp 2019-09-17 13:47:29.921108280 -0500 -@@ -1035,23 +1035,6 @@ if { [isnative] - "pr18900.out" \ - ] \ - [list \ -- "Run pr19031" \ -- "$NOPIE_LDFLAGS tmpdir/pr19031.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { pr19031b.S pr19031c.c } \ -- "pr19031" \ -- "pr19031.out" \ -- "$NOPIE_CFLAGS" \ -- ] \ -- [list \ -- "Run got1" \ -- "$NOPIE_LDFLAGS tmpdir/got1d.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { got1a.S got1b.c got1c.c } \ -- "got1" \ -- "got1.out" \ -- ] \ -- [list \ - "Run property 1" \ - "" \ - "-Wa,-mx86-used-note=yes" \ -@@ -1159,8 +1142,6 @@ if { [isnative] - ] - - undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" -- undefined_weak "-fPIE" "$NOPIE_LDFLAGS" -- undefined_weak "-fPIE" "-pie" - undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS" - undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak" - } -@@ -1327,15 +1308,6 @@ if { [isnative] - "$NOPIE_CFLAGS" \ - ] \ - [list \ -- "Run pr22001-1" \ -- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { pr22001-1b.c } \ -- "pr22001-1" \ -- "pass.out" \ -- "$NOPIE_CFLAGS" \ -- ] \ -- [list \ - "Run pr22001-1 (PIE 1)" \ - "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ - "-Wa,-mx86-used-note=yes" \ -@@ -1370,15 +1342,6 @@ if { [isnative] - "-fPIC" \ - ] \ - [list \ -- "Run pr21997-1" \ -- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { pr21997-1b.c } \ -- "pr21997-1" \ -- "pass.out" \ -- "$NOPIE_CFLAGS" \ -- ] \ -- [list \ - "Run pr21997-1 (PIC 1)" \ - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ - "-Wa,-mx86-used-note=yes" \ ---- binutils-2.32/ld/testsuite/ld-i386/no-plt.exp 2019-09-17 13:51:35.771111471 -0500 -+++ binutils-2.32/ld/testsuite/ld-i386/no-plt.exp 2019-09-17 14:00:48.581118647 -0500 -@@ -66,69 +66,6 @@ run_cc_link_tests [list \ +--- binutils-2.41/ld/testsuite/ld-i386/no-plt.exp 2019-09-17 13:51:35.771111471 -0500 ++++ binutils-2.41/ld/testsuite/ld-i386/no-plt.exp 2019-09-17 14:00:48.581118647 -0500 +@@ -63,69 +63,6 @@ run_cc_link_tests [list \ "libno-plt-1a.so" \ ] \ [list \ @@ -139,7 +72,7 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 "No PLT (dynamic 1h)" \ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \ -@@ -146,15 +83,6 @@ run_cc_link_tests [list \ +@@ -143,15 +80,6 @@ run_cc_link_tests [list \ {{readelf -Wr no-plt-1i.rd} {objdump -dwrj.text no-plt-1i.dd}} \ "no-plt-1i" \ ] \ @@ -155,7 +88,7 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 ] run_ld_link_exec_tests [list \ -@@ -168,24 +96,6 @@ run_ld_link_exec_tests [list \ +@@ -165,24 +93,6 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ @@ -180,7 +113,7 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 "No PLT (static 1d)" \ "-static tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \ -@@ -204,24 +114,6 @@ run_ld_link_exec_tests [list \ +@@ -201,24 +111,6 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ @@ -205,7 +138,7 @@ https://bts.adelielinux.org/show_bug.cgi?id=196 "No PLT (dynamic 1h)" \ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \ -@@ -239,15 +131,6 @@ run_ld_link_exec_tests [list \ +@@ -236,15 +128,6 @@ run_ld_link_exec_tests [list \ "no-plt-1i" \ "pass.out" \ ] \ diff --git a/system/binutils/CVE-2019-12972.patch b/system/binutils/CVE-2019-12972.patch deleted file mode 100644 index 82b41c014..000000000 --- a/system/binutils/CVE-2019-12972.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 890f750a3b053532a4b839a2dd6243076de12031 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Fri, 21 Jun 2019 11:51:38 +0930 -Subject: [PATCH] PR24689, string table corruption - -The testcase in the PR had a e_shstrndx section of type SHT_GROUP. -hdr->contents were initialized by setup_group rather than being read -from the file, thus last byte was not zero and string dereference ran -off the end of the buffer. - - PR 24689 - * elfcode.h (elf_object_p): Check type of e_shstrndx section. ---- - bfd/elfcode.h | 3 ++- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/bfd/elfcode.h b/bfd/elfcode.h -index a0487b0..5180f79 100644 ---- a/bfd/elfcode.h -+++ b/bfd/elfcode.h -@@ -754,7 +754,8 @@ elf_object_p (bfd *abfd) - /* A further sanity check. */ - if (i_ehdrp->e_shnum != 0) - { -- if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)) -+ if (i_ehdrp->e_shstrndx >= elf_numsections (abfd) -+ || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB) - { - /* PR 2257: - We used to just goto got_wrong_format_error here --- -2.9.3 - diff --git a/system/binutils/CVE-2019-14250.patch b/system/binutils/CVE-2019-14250.patch deleted file mode 100644 index fedc4fa7f..000000000 --- a/system/binutils/CVE-2019-14250.patch +++ /dev/null @@ -1,25 +0,0 @@ -Author: marxin -Date: Tue Jul 23 07:33:32 2019 UTC -https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=273718 - -libiberty: Check zero value shstrndx in simple-object-elf.c - ---- trunk/libiberty/simple-object-elf.c 2019/07/23 07:31:50 273717 -+++ trunk/libiberty/simple-object-elf.c 2019/07/23 07:33:32 273718 -@@ -548,7 +548,15 @@ - XDELETE (eor); - return NULL; - } -- -+ -+ if (eor->shstrndx == 0) -+ { -+ *errmsg = "invalid ELF shstrndx == 0"; -+ *err = 0; -+ XDELETE (eor); -+ return NULL; -+ } -+ - return (void *) eor; - } - diff --git a/system/binutils/CVE-2019-14444.patch b/system/binutils/CVE-2019-14444.patch deleted file mode 100644 index 43d4e2a91..000000000 --- a/system/binutils/CVE-2019-14444.patch +++ /dev/null @@ -1,28 +0,0 @@ -From e17869db99195849826eaaf5d2d0eb2cfdd7a2a7 Mon Sep 17 00:00:00 2001 -From: Nick Clifton -Date: Mon, 5 Aug 2019 10:40:35 +0100 -Subject: [PATCH] Catch potential integer overflow in readelf when processing - corrupt binaries. - - PR 24829 - * readelf.c (apply_relocations): Catch potential integer overflow - whilst checking reloc location against section size. ---- - binutils/readelf.c | 2 +- - -diff --git a/binutils/readelf.c b/binutils/readelf.c -index b896ad9..e785fde 100644 ---- a/binutils/readelf.c -+++ b/binutils/readelf.c -@@ -13366,7 +13366,7 @@ apply_relocations (Filedata * filedata, - } - - rloc = start + rp->r_offset; -- if ((rloc + reloc_size) > end || (rloc < start)) -+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start)) - { - warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), - (unsigned long) rp->r_offset, --- -2.9.3 - diff --git a/system/binutils/CVE-2019-17450.patch b/system/binutils/CVE-2019-17450.patch deleted file mode 100644 index edc0e94df..000000000 --- a/system/binutils/CVE-2019-17450.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 063c511bd79281f33fd33f0964541a73511b9e2b Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 9 Oct 2019 00:07:29 +1030 -Subject: [PATCH] PR25078, stack overflow in function find_abstract_instance - - PR 25078 - * dwarf2.c (find_abstract_instance): Delete orig_info_ptr, add - recur_count. Error on recur_count reaching 100 rather than - info_ptr matching orig_info_ptr. Adjust calls. - -diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c -index 575b082..d39f4fd 100644 ---- a/bfd/dwarf2.c -+++ b/bfd/dwarf2.c -@@ -2812,13 +2812,13 @@ static bfd_boolean comp_unit_maybe_decode_line_info (struct comp_unit *, - struct dwarf2_debug *); - - static bfd_boolean --find_abstract_instance (struct comp_unit * unit, -- bfd_byte * orig_info_ptr, -- struct attribute * attr_ptr, -- const char ** pname, -- bfd_boolean * is_linkage, -- char ** filename_ptr, -- int * linenumber_ptr) -+find_abstract_instance (struct comp_unit *unit, -+ struct attribute *attr_ptr, -+ unsigned int recur_count, -+ const char **pname, -+ bfd_boolean *is_linkage, -+ char **filename_ptr, -+ int *linenumber_ptr) - { - bfd *abfd = unit->abfd; - bfd_byte *info_ptr; -@@ -2829,6 +2829,14 @@ find_abstract_instance (struct comp_unit * unit, - struct attribute attr; - const char *name = NULL; - -+ if (recur_count == 100) -+ { -+ _bfd_error_handler -+ (_("DWARF error: abstract instance recursion detected")); -+ bfd_set_error (bfd_error_bad_value); -+ return FALSE; -+ } -+ - /* DW_FORM_ref_addr can reference an entry in a different CU. It - is an offset from the .debug_info section, not the current CU. */ - if (attr_ptr->form == DW_FORM_ref_addr) -@@ -2962,15 +2970,6 @@ find_abstract_instance (struct comp_unit * unit, - info_ptr, info_ptr_end); - if (info_ptr == NULL) - break; -- /* It doesn't ever make sense for DW_AT_specification to -- refer to the same DIE. Stop simple recursion. */ -- if (info_ptr == orig_info_ptr) -- { -- _bfd_error_handler -- (_("DWARF error: abstract instance recursion detected")); -- bfd_set_error (bfd_error_bad_value); -- return FALSE; -- } - switch (attr.name) - { - case DW_AT_name: -@@ -2984,7 +2983,7 @@ find_abstract_instance (struct comp_unit * unit, - } - break; - case DW_AT_specification: -- if (!find_abstract_instance (unit, info_ptr, &attr, -+ if (!find_abstract_instance (unit, &attr, recur_count + 1, - &name, is_linkage, - filename_ptr, linenumber_ptr)) - return FALSE; -@@ -3200,7 +3199,7 @@ scan_unit_for_symbols (struct comp_unit *unit) - - case DW_AT_abstract_origin: - case DW_AT_specification: -- if (!find_abstract_instance (unit, info_ptr, &attr, -+ if (!find_abstract_instance (unit, &attr, 0, - &func->name, - &func->is_linkage, - &func->file, --- -2.9.3 - diff --git a/system/binutils/CVE-2019-17451.patch b/system/binutils/CVE-2019-17451.patch deleted file mode 100644 index f6af71601..000000000 --- a/system/binutils/CVE-2019-17451.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 336bfbeb1848f4b9558456fdcf283ee8a32d7fd1 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 9 Oct 2019 10:47:13 +1030 -Subject: [PATCH] PR25070, SEGV in function _bfd_dwarf2_find_nearest_line - -Evil testcase with two debug info sections, with sizes of 2aaaabac4ec1 -and ffffd5555453b140 result in a total size of 1. Reading the first -section of course overflows the buffer and tramples on other memory. - - PR 25070 - * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Catch overflow of - total_size calculation. - -diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c -index d39f4fd..88aaa2d 100644 ---- a/bfd/dwarf2.c -+++ b/bfd/dwarf2.c -@@ -4439,7 +4439,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, - for (total_size = 0; - msec; - msec = find_debug_info (debug_bfd, debug_sections, msec)) -- total_size += msec->size; -+ { -+ /* Catch PR25070 testcase overflowing size calculation here. */ -+ if (total_size + msec->size < total_size -+ || total_size + msec->size < msec->size) -+ { -+ bfd_set_error (bfd_error_no_memory); -+ return FALSE; -+ } -+ total_size += msec->size; -+ } - - stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size); - if (stash->info_ptr_memory == NULL) --- -2.9.3 - diff --git a/system/binutils/CVE-2019-9070-and-9071.patch b/system/binutils/CVE-2019-9070-and-9071.patch deleted file mode 100644 index 5f401d147..000000000 --- a/system/binutils/CVE-2019-9070-and-9071.patch +++ /dev/null @@ -1,128 +0,0 @@ -Author: nickc -Date: Wed Apr 10 14:44:47 2019 UTC -https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=270258 - -Fix a stack exhaustion bug in libiberty's demangler when decoding a -pathalogically constructed mangled name. - -PR 89394 -* cp-demangle.c (cplus_demangle_fill_name): Reject negative -lengths. -(d_count_templates_scopes): Replace num_templates and num_scopes -parameters with a struct d_print_info pointer parameter. Adjust -body of the function accordingly. Add recursion counter and check -that the recursion limit is not reached. -(d_print_init): Pass dpi parameter to d_count_templates_scopes. -Reset recursion counter afterwards, unless the recursion limit was -reached. - ---- trunk/libiberty/cp-demangle.c 2019/04/10 14:39:59 270257 -+++ trunk/libiberty/cp-demangle.c 2019/04/10 14:44:47 270258 -@@ -861,7 +861,7 @@ - int - cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len) - { -- if (p == NULL || s == NULL || len == 0) -+ if (p == NULL || s == NULL || len <= 0) - return 0; - p->d_printing = 0; - p->type = DEMANGLE_COMPONENT_NAME; -@@ -4061,7 +4061,7 @@ - are larger than the actual numbers encountered. */ - - static void --d_count_templates_scopes (int *num_templates, int *num_scopes, -+d_count_templates_scopes (struct d_print_info *dpi, - const struct demangle_component *dc) - { - if (dc == NULL) -@@ -4081,13 +4081,13 @@ - break; - - case DEMANGLE_COMPONENT_TEMPLATE: -- (*num_templates)++; -+ dpi->num_copy_templates++; - goto recurse_left_right; - - case DEMANGLE_COMPONENT_REFERENCE: - case DEMANGLE_COMPONENT_RVALUE_REFERENCE: - if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM) -- (*num_scopes)++; -+ dpi->num_saved_scopes++; - goto recurse_left_right; - - case DEMANGLE_COMPONENT_QUAL_NAME: -@@ -4152,42 +4152,42 @@ - case DEMANGLE_COMPONENT_TAGGED_NAME: - case DEMANGLE_COMPONENT_CLONE: - recurse_left_right: -- d_count_templates_scopes (num_templates, num_scopes, -- d_left (dc)); -- d_count_templates_scopes (num_templates, num_scopes, -- d_right (dc)); -+ /* PR 89394 - Check for too much recursion. */ -+ if (dpi->recursion > DEMANGLE_RECURSION_LIMIT) -+ /* FIXME: There ought to be a way to report to the -+ user that the recursion limit has been reached. */ -+ return; -+ -+ ++ dpi->recursion; -+ d_count_templates_scopes (dpi, d_left (dc)); -+ d_count_templates_scopes (dpi, d_right (dc)); -+ -- dpi->recursion; - break; - - case DEMANGLE_COMPONENT_CTOR: -- d_count_templates_scopes (num_templates, num_scopes, -- dc->u.s_ctor.name); -+ d_count_templates_scopes (dpi, dc->u.s_ctor.name); - break; - - case DEMANGLE_COMPONENT_DTOR: -- d_count_templates_scopes (num_templates, num_scopes, -- dc->u.s_dtor.name); -+ d_count_templates_scopes (dpi, dc->u.s_dtor.name); - break; - - case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: -- d_count_templates_scopes (num_templates, num_scopes, -- dc->u.s_extended_operator.name); -+ d_count_templates_scopes (dpi, dc->u.s_extended_operator.name); - break; - - case DEMANGLE_COMPONENT_FIXED_TYPE: -- d_count_templates_scopes (num_templates, num_scopes, -- dc->u.s_fixed.length); -+ d_count_templates_scopes (dpi, dc->u.s_fixed.length); - break; - - case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS: - case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS: -- d_count_templates_scopes (num_templates, num_scopes, -- d_left (dc)); -+ d_count_templates_scopes (dpi, d_left (dc)); - break; - - case DEMANGLE_COMPONENT_LAMBDA: - case DEMANGLE_COMPONENT_DEFAULT_ARG: -- d_count_templates_scopes (num_templates, num_scopes, -- dc->u.s_unary_num.sub); -+ d_count_templates_scopes (dpi, dc->u.s_unary_num.sub); - break; - } - } -@@ -4222,8 +4222,12 @@ - dpi->next_copy_template = 0; - dpi->num_copy_templates = 0; - -- d_count_templates_scopes (&dpi->num_copy_templates, -- &dpi->num_saved_scopes, dc); -+ d_count_templates_scopes (dpi, dc); -+ /* If we did not reach the recursion limit, then reset the -+ current recursion value back to 0, so that we can print -+ the templates. */ -+ if (dpi->recursion < DEMANGLE_RECURSION_LIMIT) -+ dpi->recursion = 0; - dpi->num_copy_templates *= dpi->num_saved_scopes; - - dpi->current_template = NULL; diff --git a/system/binutils/CVE-2019-9073.patch b/system/binutils/CVE-2019-9073.patch deleted file mode 100644 index 9ea45707b..000000000 --- a/system/binutils/CVE-2019-9073.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7d272a55caebfc26ab2e15d1e9439bac978b9bb7 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 20 Feb 2019 12:06:31 +1030 -Subject: [PATCH] PR24233, Out of memory - - PR 24233 - * objdump.c (dump_bfd_private_header): Print warning if - bfd_print_private_bfd_data returns false. ---- - binutils/ChangeLog | 6 ++++++ - binutils/objdump.c | 4 +++- - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/binutils/objdump.c b/binutils/objdump.c -index 8725390..7d0c6a4 100644 ---- a/binutils/objdump.c -+++ b/binutils/objdump.c -@@ -3178,7 +3178,9 @@ dump_bfd_header (bfd *abfd) - static void - dump_bfd_private_header (bfd *abfd) - { -- bfd_print_private_bfd_data (abfd, stdout); -+ if (!bfd_print_private_bfd_data (abfd, stdout)) -+ non_fatal (_("warning: private headers incomplete: %s"), -+ bfd_errmsg (bfd_get_error ())); - } - - static void --- -2.9.3 - diff --git a/system/binutils/CVE-2019-9074.patch b/system/binutils/CVE-2019-9074.patch deleted file mode 100644 index 74b6c2040..000000000 --- a/system/binutils/CVE-2019-9074.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 179f2db0d9c397d7dd8a59907b84208b79f7f48c Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Tue, 19 Feb 2019 22:48:44 +1030 -Subject: [PATCH] PR24235, Read memory violation in pei-x86_64.c - - PR 24235 - * pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks - attempting to prevent read past end of section. ---- - bfd/pei-x86_64.c | 9 ++++----- - 2 files changed, 10 insertions(+), 5 deletions(-) - -diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c -index ff1093c..7e75104 100644 ---- a/bfd/pei-x86_64.c -+++ b/bfd/pei-x86_64.c -@@ -541,7 +541,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section) - /* virt_size might be zero for objects. */ - if (stop == 0 && strcmp (abfd->xvec->name, "pe-x86-64") == 0) - { -- stop = (datasize / onaline) * onaline; -+ stop = datasize; - virt_size_is_zero = TRUE; - } - else if (datasize < stop) -@@ -551,8 +551,8 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section) - _("Warning: %s section size (%ld) is smaller than virtual size (%ld)\n"), - pdata_section->name, (unsigned long) datasize, - (unsigned long) stop); -- /* Be sure not to read passed datasize. */ -- stop = datasize / onaline; -+ /* Be sure not to read past datasize. */ -+ stop = datasize; - } - - /* Display functions table. */ -@@ -724,8 +724,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section) - altent += imagebase; - - if (altent >= pdata_vma -- && (altent + PDATA_ROW_SIZE <= pdata_vma -- + pei_section_data (abfd, pdata_section)->virt_size)) -+ && altent - pdata_vma + PDATA_ROW_SIZE <= stop) - { - pex64_get_runtime_function - (abfd, &arf, &pdata[altent - pdata_vma]); --- -2.9.3 - diff --git a/system/binutils/CVE-2019-9075.patch b/system/binutils/CVE-2019-9075.patch deleted file mode 100644 index 0084d3368..000000000 --- a/system/binutils/CVE-2019-9075.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 8abac8031ed369a2734b1cdb7df28a39a54b4b49 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 20 Feb 2019 08:21:24 +1030 -Subject: [PATCH] PR24236, Heap buffer overflow in - _bfd_archive_64_bit_slurp_armap - - PR 24236 - * archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding - sentinel NUL to string buffer nearer to loop where it is used. - Don't go past sentinel when scanning strings, and don't write - NUL again. - * archive.c (do_slurp_coff_armap): Simplify string handling to - archive64.c style. ---- - bfd/archive.c | 17 +++++++---------- - bfd/archive64.c | 10 +++++----- - 3 files changed, 22 insertions(+), 15 deletions(-) - -diff --git a/bfd/archive.c b/bfd/archive.c -index d2d9b72..68a92a3 100644 ---- a/bfd/archive.c -+++ b/bfd/archive.c -@@ -1012,6 +1012,7 @@ do_slurp_coff_armap (bfd *abfd) - int *raw_armap, *rawptr; - struct artdata *ardata = bfd_ardata (abfd); - char *stringbase; -+ char *stringend; - bfd_size_type stringsize; - bfd_size_type parsed_size; - carsym *carsyms; -@@ -1071,22 +1072,18 @@ do_slurp_coff_armap (bfd *abfd) - } - - /* OK, build the carsyms. */ -- for (i = 0; i < nsymz && stringsize > 0; i++) -+ stringend = stringbase + stringsize; -+ *stringend = 0; -+ for (i = 0; i < nsymz; i++) - { -- bfd_size_type len; -- - rawptr = raw_armap + i; - carsyms->file_offset = swap ((bfd_byte *) rawptr); - carsyms->name = stringbase; -- /* PR 17512: file: 4a1d50c1. */ -- len = strnlen (stringbase, stringsize); -- if (len < stringsize) -- len ++; -- stringbase += len; -- stringsize -= len; -+ stringbase += strlen (stringbase); -+ if (stringbase != stringend) -+ ++stringbase; - carsyms++; - } -- *stringbase = 0; - - ardata->symdef_count = nsymz; - ardata->first_file_filepos = bfd_tell (abfd); -diff --git a/bfd/archive64.c b/bfd/archive64.c -index 312bf82..42f6ed9 100644 ---- a/bfd/archive64.c -+++ b/bfd/archive64.c -@@ -100,8 +100,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd) - return FALSE; - carsyms = ardata->symdefs; - stringbase = ((char *) ardata->symdefs) + carsym_size; -- stringbase[stringsize] = 0; -- stringend = stringbase + stringsize; - - raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize); - if (raw_armap == NULL) -@@ -115,15 +113,17 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd) - goto release_raw_armap; - } - -+ stringend = stringbase + stringsize; -+ *stringend = 0; - for (i = 0; i < nsymz; i++) - { - carsyms->file_offset = bfd_getb64 (raw_armap + i * 8); - carsyms->name = stringbase; -- if (stringbase < stringend) -- stringbase += strlen (stringbase) + 1; -+ stringbase += strlen (stringbase); -+ if (stringbase != stringend) -+ ++stringbase; - ++carsyms; - } -- *stringbase = '\0'; - - ardata->symdef_count = nsymz; - ardata->first_file_filepos = bfd_tell (abfd); --- -2.9.3 - diff --git a/system/binutils/CVE-2019-9077.patch b/system/binutils/CVE-2019-9077.patch deleted file mode 100644 index de044e387..000000000 --- a/system/binutils/CVE-2019-9077.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 7fc0c668f2aceb8582d74db1ad2528e2bba8a921 Mon Sep 17 00:00:00 2001 -From: Nick Clifton -Date: Wed, 20 Feb 2019 17:03:47 +0000 -Subject: [PATCH] Fix a illegal memory access fault when parsing a corrupt MIPS - option section using readelf. - - PR 24243 - * readelf.c (process_mips_specific): Check for an options section - that is too small to even contain a single option. ---- - binutils/readelf.c | 6 ++++++ - 2 files changed, 9 insertions(+) - -diff --git a/binutils/readelf.c b/binutils/readelf.c -index 54d165e..20ebacc 100644 ---- a/binutils/readelf.c -+++ b/binutils/readelf.c -@@ -16187,6 +16187,12 @@ process_mips_specific (Filedata * filedata) - error (_("No MIPS_OPTIONS header found\n")); - return FALSE; - } -+ /* PR 24243 */ -+ if (sect->sh_size < sizeof (* eopt)) -+ { -+ error (_("The MIPS options section is too small.\n")); -+ return FALSE; -+ } - - eopt = (Elf_External_Options *) get_data (NULL, filedata, options_offset, 1, - sect->sh_size, _("options")); --- -2.9.3 - diff --git a/system/binutils/arm-pie.patch b/system/binutils/arm-pie.patch deleted file mode 100644 index f42477a04..000000000 --- a/system/binutils/arm-pie.patch +++ /dev/null @@ -1,24 +0,0 @@ -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25056 -Author: Rich Felker -Upstream-Status: reported - ---- binutils-2.32/bfd/elf32-arm.c.orig 2019-10-02 07:47:36.153918869 -0400 -+++ binutils-2.32/bfd/elf32-arm.c 2019-10-02 08:37:09.108263016 -0400 -@@ -11624,7 +11624,7 @@ - { - /* If we don't know the module number, create a relocation - for it. */ -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - { - Elf_Internal_Rela outrel; - -@@ -11728,7 +11728,7 @@ - now, and emit any relocations. If both an IE GOT and a - GD GOT are necessary, we emit the GD first. */ - -- if ((bfd_link_pic (info) || indx != 0) -+ if ((bfd_link_dll (info) || indx != 0) - && (h == NULL - || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - && !resolved_to_zero) diff --git a/system/binutils/binutils-ld-fix-static-linking.patch b/system/binutils/binutils-ld-fix-static-linking.patch index bc5d76265..fb79e3213 100644 --- a/system/binutils/binutils-ld-fix-static-linking.patch +++ b/system/binutils/binutils-ld-fix-static-linking.patch @@ -3,7 +3,7 @@ diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index e8126cb..9532bfb 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc -@@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" +@@ -257,8 +257,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))" SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))" @@ -14,7 +14,7 @@ index e8126cb..9532bfb 100644 else SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))" SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))" -@@ -270,15 +270,14 @@ CTOR=".ctors ${CONSTRUCTING-0} : +@@ -298,15 +298,14 @@ CTOR=".ctors ${CONSTRUCTING-0} : doesn't matter which directory crtbegin.o is in. */ @@ -32,7 +32,7 @@ index e8126cb..9532bfb 100644 KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} -@@ -286,9 +285,8 @@ CTOR=".ctors ${CONSTRUCTING-0} : +@@ -314,9 +313,8 @@ CTOR=".ctors ${CONSTRUCTING-0} : DTOR=".dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} diff --git a/system/binutils/disable-gnu-mbind.patch b/system/binutils/disable-gnu-mbind.patch deleted file mode 100644 index 796e6d0fc..000000000 --- a/system/binutils/disable-gnu-mbind.patch +++ /dev/null @@ -1,32 +0,0 @@ -These tests do not work on PIE. Disable them. - ---- binutils-2.29/ld/testsuite/ld-elf/elf.exp.old 2017-08-19 22:39:31.236907813 +0000 -+++ binutils-2.29/ld/testsuite/ld-elf/elf.exp 2017-08-20 00:12:04.735925829 +0000 -@@ -296,27 +296,6 @@ - || [istarget *-*-nacl*] - || [istarget *-*-gnu*] } { - run_ld_link_exec_tests $array_tests_pie $xfails -- -- run_ld_link_exec_tests [list \ -- [list \ -- "Run mbind2a" \ -- "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000" \ -- "" \ -- { mbind2a.s mbind2b.c } \ -- "mbind2a" \ -- "pass.out" \ -- "-O2 -I../bfd" \ -- ] \ -- [list \ -- "Run mbind2b" \ -- "-static -Wl,-z,common-page-size=0x4000" \ -- "" \ -- { mbind2a.s mbind2b.c } \ -- "mbind2b" \ -- "pass.out" \ -- "-O2 -I../bfd" \ -- ] \ -- ] - } - - # diff --git a/system/binutils/disable-ifunc-tests.patch b/system/binutils/disable-ifunc-tests.patch index b50d20b0e..39b35d319 100644 --- a/system/binutils/disable-ifunc-tests.patch +++ b/system/binutils/disable-ifunc-tests.patch @@ -1,12 +1,11 @@ --- binutils-2.31.1/ld/testsuite/ld-ifunc/ifunc.exp.old 2018-06-27 07:55:16.000000000 +0000 +++ binutils-2.31.1/ld/testsuite/ld-ifunc/ifunc.exp 2018-10-12 03:23:09.240000000 +0000 -@@ -34,7 +34,8 @@ - && ([istarget "*-*-elf*"] - || [istarget "*-*-nacl*"] - || [istarget "*-*-linux*"] -- || [istarget "*-*-gnu*"])) } { -+ || [istarget "*-*-gnu*"]) -+ && ![istarget "*-*-musl*"]) } { +@@ -43,7 +43,8 @@ + || [istarget sh*-*-*] + || [istarget tic6x-*-*] + || [istarget tile*-*-*] ++ || [istarget *-*-musl*] + || [istarget vax-*-*] } { verbose "IFUNC tests not run - target does not support IFUNC" return } diff --git a/system/binutils/disable-mbind2b.patch b/system/binutils/disable-mbind2b.patch new file mode 100644 index 000000000..6065ba0cf --- /dev/null +++ b/system/binutils/disable-mbind2b.patch @@ -0,0 +1,20 @@ +XXX working upstream with musl, trying to push to other arches for testing + +--- binutils-2.41/ld/testsuite/ld-elf/elf.exp.old 2023-09-22 22:22:00.860304785 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/elf.exp 2023-09-22 23:43:12.163396014 -0500 +@@ -490,15 +490,6 @@ + "pass.out" \ + "-O2 -I../bfd" \ + ] \ +- [list \ +- "Run mbind2b" \ +- "-static -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ +- "" \ +- { mbind2a.s mbind2b.c } \ +- "mbind2b" \ +- "pass.out" \ +- "-O2 -I../bfd" \ +- ] \ + ] + } + diff --git a/system/binutils/disable-pr26580-test.patch b/system/binutils/disable-pr26580-test.patch new file mode 100644 index 000000000..768a7c0c0 --- /dev/null +++ b/system/binutils/disable-pr26580-test.patch @@ -0,0 +1,20 @@ +For some reason, the output binary is over-aligned on x86_64. + +This test passes on all platforms but x86_64, so this (just barely) meets +Tier 1 standards for system/ packages. + +Not reported upstream. + +--- binutils-2.41/ld/testsuite/ld-elf/shared.exp.old 2023-09-30 00:31:20.814410396 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/shared.exp 2023-09-30 01:23:23.564443008 -0500 +@@ -1121,10 +1121,6 @@ + "" "" \ + {pr26580-a.c} "pr26580-3" "pr26580-3.out" "-fcommon" "c" "" \ + "-Wl,--as-needed tmpdir/libpr26580-2.so" ] \ +- [list "pr26580-4" \ +- "" "" \ +- {pr26580-a.c} "pr26580-4" "pr26580-4.out" "-fcommon" "c" "" \ +- "-Wl,--no-as-needed tmpdir/libpr26580-2.so" ] \ + [list "Run pr26590 (2)" \ + "" "" \ + {pr26590c.c pr26590d.c} "pr26590" "pass.out" "" "c" "" \ diff --git a/system/binutils/disable-preinit-array-tests.patch b/system/binutils/disable-preinit-array-tests.patch index f3d36c1b3..4338fd5ec 100644 --- a/system/binutils/disable-preinit-array-tests.patch +++ b/system/binutils/disable-preinit-array-tests.patch @@ -1,6 +1,6 @@ --- binutils-2.29/ld/testsuite/ld-elf/elf.exp.old 2017-07-04 08:43:21.000000000 +0000 +++ binutils-2.29/ld/testsuite/ld-elf/elf.exp 2017-08-19 04:46:32.214460537 +0000 -@@ -262,8 +262,6 @@ +@@ -391,8 +391,6 @@ } set array_tests { @@ -9,7 +9,7 @@ {"init array" "" "" {init.c} "init" "init.out"} {"fini array" "" "" -@@ -272,8 +270,6 @@ +@@ -401,8 +399,6 @@ {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} } set array_tests_pie { @@ -18,7 +18,7 @@ {"PIE init array" "-pie" "" {init.c} "init" "init.out" "-fPIE"} {"PIE fini array" "-pie" "" -@@ -284,8 +280,6 @@ +@@ -413,8 +409,6 @@ {pr14525.c} "pr14525" "pr14525.out" "-fPIE"} } set array_tests_static { diff --git a/system/binutils/disable-relr-glibc-tests.patch b/system/binutils/disable-relr-glibc-tests.patch new file mode 100644 index 000000000..afefe593a --- /dev/null +++ b/system/binutils/disable-relr-glibc-tests.patch @@ -0,0 +1,19 @@ +While musl does support DT_RELR, and other DT_RELR related tests *do* pass, +these glibc-specific tests do not because they require the linker to output +glibc-specific .version_info. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30917 + +--- binutils-2.41/ld/testsuite/ld-elf/dt-relr.exp.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/dt-relr.exp 2023-09-22 20:28:27.455427142 -0500 +@@ -23,6 +23,10 @@ + return + } + ++if { [istarget *-*-musl*] } { ++ return ++} ++ + run_cc_link_tests [list \ + [list \ + "Build dt-relr-glibc-1a.so" \ diff --git a/system/binutils/disable-sframe-tests.patch b/system/binutils/disable-sframe-tests.patch new file mode 100644 index 000000000..994349853 --- /dev/null +++ b/system/binutils/disable-sframe-tests.patch @@ -0,0 +1,17 @@ +SFrame tests fail due to incorrect PC offset in generated binary. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30914 + +--- binutils-2.41/ld/testsuite/lib/ld-lib.exp.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/lib/ld-lib.exp 2023-09-29 03:19:04.223613176 -0500 +@@ -1723,10 +1723,5 @@ + # if {$enable_libsframe eq "no"} { + # return 1 + # } +- +- if [check_as_sframe] { +- return 0 +- } +- + return 1 + } diff --git a/system/binutils/disable-textrel-test.patch b/system/binutils/disable-textrel-test.patch new file mode 100644 index 000000000..f01921996 --- /dev/null +++ b/system/binutils/disable-textrel-test.patch @@ -0,0 +1,43 @@ +musl doesn't support TEXTRELs, so the pr22001-1 test will always segfault. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30925 + +--- binutils-2.41/ld/testsuite/ld-i386/i386.exp.old 2023-07-02 23:00:00.000000000 +0000 ++++ binutils-2.41/ld/testsuite/ld-i386/i386.exp 2023-09-30 12:34:46.594675721 +0000 +@@ -1318,6 +1318,20 @@ + ] \ + ] + ++ if { ![istarget i?86-*-musl] } { ++ run_ld_link_exec_tests [list \ ++ [list \ ++ "Run pr22001-1" \ ++ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \ ++ "-Wa,-mx86-used-note=yes" \ ++ { pr22001-1b.c } \ ++ "pr22001-1" \ ++ "pass.out" \ ++ "$NOPIE_CFLAGS" \ ++ ] \ ++ ] ++ } ++ + run_ld_link_exec_tests [list \ + [list \ + "Run weakundef1 without PIE" \ +@@ -1328,15 +1342,6 @@ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ +- [list \ +- "Run pr22001-1" \ +- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { pr22001-1b.c } \ +- "pr22001-1" \ +- "pass.out" \ +- "$NOPIE_CFLAGS" \ +- ] \ + [list \ + "Run pr22001-1 (PIE 1)" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ diff --git a/system/binutils/fix-deprecated-egrep-usage.patch b/system/binutils/fix-deprecated-egrep-usage.patch index c661117e3..755068267 100644 --- a/system/binutils/fix-deprecated-egrep-usage.patch +++ b/system/binutils/fix-deprecated-egrep-usage.patch @@ -1,36 +1,3 @@ -diff -ur a/binutils/embedspu.sh b/binutils/embedspu.sh ---- a/binutils/embedspu.sh 2023-04-06 08:16:35.123366257 -0500 -+++ b/binutils/embedspu.sh 2023-04-06 08:17:09.700066333 -0500 -@@ -110,7 +110,7 @@ - # Sanity check the input file - if ! ${READELF} -h ${INFILE} | grep 'Class:.*ELF32' >/dev/null 2>/dev/null \ - || ! ${READELF} -h ${INFILE} | grep 'Type:.*EXEC' >/dev/null 2>/dev/null \ -- || ! ${READELF} -h ${INFILE} | egrep 'Machine:.*(SPU|17)' >/dev/null 2>/dev/null -+ || ! ${READELF} -h ${INFILE} | grep -E 'Machine:.*(SPU|17)' >/dev/null 2>/dev/null - then - echo "${INFILE}: Does not appear to be an SPU executable" - exit 1 -diff -ur a/config/lib-ld.m4 b/config/lib-ld.m4 ---- a/config/lib-ld.m4 2023-04-06 08:16:35.091365610 -0500 -+++ b/config/lib-ld.m4 2023-04-06 08:17:09.704066414 -0500 -@@ -14,7 +14,7 @@ - AC_DEFUN([AC_LIB_PROG_LD_GNU], - [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, - [# I'd rather use --version here, but apparently some GNU ld's only accept -v. --if $LD -v 2>&1 &5; then -+if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes - else - acl_cv_prog_gnu_ld=no -@@ -88,7 +88,7 @@ - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. -- if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then -+ if "$acl_cv_path_LD" -v 2>&1 < /dev/null | grep -E '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break diff -ur a/config.rpath b/config.rpath --- a/config.rpath 2023-04-06 08:16:36.067385369 -0500 +++ b/config.rpath 2023-04-06 08:17:09.704066414 -0500 @@ -64,210 +31,3 @@ diff -ur a/config.rpath b/config.rpath : else ld_shlibs=no -diff -ur a/gold/testsuite/bnd_ifunc_1.sh b/gold/testsuite/bnd_ifunc_1.sh ---- a/gold/testsuite/bnd_ifunc_1.sh 2023-04-06 08:16:36.123386503 -0500 -+++ b/gold/testsuite/bnd_ifunc_1.sh 2023-04-06 08:17:09.704066414 -0500 -@@ -24,13 +24,13 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi - } - - match '[0-9a-f]*:.*bnd jmpq \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout --APLT_ADDR=$(egrep '[0-9a-f]*:.*bnd jmpq \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout | -+APLT_ADDR=$(grep -E '[0-9a-f]*:.*bnd jmpq \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout | - sed -e 's/ *\([0-9a-f]*\):.*/\1/') - match "bnd callq $APLT_ADDR" bnd_ifunc_1.stdout -diff -ur a/gold/testsuite/bnd_ifunc_2.sh b/gold/testsuite/bnd_ifunc_2.sh ---- a/gold/testsuite/bnd_ifunc_2.sh 2023-04-06 08:16:36.139386827 -0500 -+++ b/gold/testsuite/bnd_ifunc_2.sh 2023-04-06 08:17:09.708066495 -0500 -@@ -24,7 +24,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -diff -ur a/gold/testsuite/bnd_plt_1.sh b/gold/testsuite/bnd_plt_1.sh ---- a/gold/testsuite/bnd_plt_1.sh 2023-04-06 08:16:36.131386665 -0500 -+++ b/gold/testsuite/bnd_plt_1.sh 2023-04-06 08:17:09.708066495 -0500 -@@ -24,7 +24,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -diff -ur a/gold/testsuite/discard_locals_test.sh b/gold/testsuite/discard_locals_test.sh ---- a/gold/testsuite/discard_locals_test.sh 2023-04-06 08:16:36.119386422 -0500 -+++ b/gold/testsuite/discard_locals_test.sh 2023-04-06 08:17:09.708066495 -0500 -@@ -32,7 +32,7 @@ - file=$1 - sym=$2 - -- found=`egrep $sym $file` -+ found=`grep -E $sym $file` - if test -n "$found"; then - echo "These local symbols are not discarded in $file:" - echo "$found" -@@ -45,7 +45,7 @@ - file=$1 - sym=$2 - -- found=`egrep $sym $file` -+ found=`grep -E $sym $file` - if test -z "$found"; then - echo "This local symbol is discarded in $file:" - echo "$2" -diff -ur a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am ---- a/gold/testsuite/Makefile.am 2023-04-06 08:16:36.131386665 -0500 -+++ b/gold/testsuite/Makefile.am 2023-04-06 08:17:09.712066576 -0500 -@@ -1650,7 +1650,7 @@ - - # Check there are compressed DWARF .debug_* sections. - flagstest_compress_debug_sections.check: flagstest_compress_debug_sections -- $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp -+ $(TEST_READELF) -SW $< | grep -E ".debug_.* C *" > $@.tmp - mv -f $@.tmp $@ - - # Compare DWARF debug info. -diff -ur a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in ---- a/gold/testsuite/Makefile.in 2023-04-06 08:16:36.123386503 -0500 -+++ b/gold/testsuite/Makefile.in 2023-04-06 08:17:09.720066738 -0500 -@@ -8577,7 +8577,7 @@ - - # Check there are compressed DWARF .debug_* sections. - @GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_compress_debug_sections.check: flagstest_compress_debug_sections --@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp -+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | grep -E ".debug_.* C *" > $@.tmp - @GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@ - - # Compare DWARF debug info. -diff -ur a/gold/testsuite/no_version_test.sh b/gold/testsuite/no_version_test.sh ---- a/gold/testsuite/no_version_test.sh 2023-04-06 08:16:36.119386422 -0500 -+++ b/gold/testsuite/no_version_test.sh 2023-04-06 08:17:09.720066738 -0500 -@@ -32,7 +32,7 @@ - { - file=$1 - -- found=`egrep "\.gnu\.version.*" $file` -+ found=`grep -E "\.gnu\.version.*" $file` - if test -n "$found"; then - echo "These section should not be in $file:" - echo "$found" -diff -ur a/gold/testsuite/pr18689.sh b/gold/testsuite/pr18689.sh ---- a/gold/testsuite/pr18689.sh 2023-04-06 08:16:36.131386665 -0500 -+++ b/gold/testsuite/pr18689.sh 2023-04-06 08:17:09.720066738 -0500 -@@ -23,6 +23,6 @@ - - set -e - --egrep -q "..debug_mac[ro|info][ ]+*" pr18689.stdout -+grep -E -q "..debug_mac[ro|info][ ]+*" pr18689.stdout - - exit 0 -diff -ur a/gold/testsuite/split_i386.sh b/gold/testsuite/split_i386.sh ---- a/gold/testsuite/split_i386.sh 2023-04-06 08:16:36.115386341 -0500 -+++ b/gold/testsuite/split_i386.sh 2023-04-06 08:17:09.724066819 -0500 -@@ -24,7 +24,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -@@ -32,7 +32,7 @@ - - nomatch() - { -- if egrep "$1" "$2" >/dev/null 2>&1; then -+ if grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "found unexpected '$1' in $2" - exit 1 - fi -diff -ur a/gold/testsuite/split_s390.sh b/gold/testsuite/split_s390.sh ---- a/gold/testsuite/split_s390.sh 2023-04-06 08:16:36.115386341 -0500 -+++ b/gold/testsuite/split_s390.sh 2023-04-06 08:17:09.724066819 -0500 -@@ -24,7 +24,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -@@ -32,7 +32,7 @@ - - nomatch() - { -- if egrep "$1" "$2" >/dev/null 2>&1; then -+ if grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "found unexpected '$1' in $2" - exit 1 - fi -diff -ur a/gold/testsuite/split_x32.sh b/gold/testsuite/split_x32.sh ---- a/gold/testsuite/split_x32.sh 2023-04-06 08:16:36.119386422 -0500 -+++ b/gold/testsuite/split_x32.sh 2023-04-06 08:17:09.724066819 -0500 -@@ -25,7 +25,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -@@ -33,7 +33,7 @@ - - nomatch() - { -- if egrep "$1" "$2" >/dev/null 2>&1; then -+ if grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "found unexpected '$1' in $2" - exit 1 - fi -diff -ur a/gold/testsuite/split_x86_64.sh b/gold/testsuite/split_x86_64.sh ---- a/gold/testsuite/split_x86_64.sh 2023-04-06 08:16:36.115386341 -0500 -+++ b/gold/testsuite/split_x86_64.sh 2023-04-06 08:17:09.728066900 -0500 -@@ -24,7 +24,7 @@ - - match() - { -- if ! egrep "$1" "$2" >/dev/null 2>&1; then -+ if ! grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "could not find '$1' in $2" - exit 1 - fi -@@ -32,7 +32,7 @@ - - nomatch() - { -- if egrep "$1" "$2" >/dev/null 2>&1; then -+ if grep -E "$1" "$2" >/dev/null 2>&1; then - echo 1>&2 "found unexpected '$1' in $2" - exit 1 - fi -diff -ur a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp ---- a/ld/testsuite/ld-elfvers/vers.exp 2023-04-06 08:16:35.139366581 -0500 -+++ b/ld/testsuite/ld-elfvers/vers.exp 2023-04-06 08:17:09.728066900 -0500 -@@ -115,7 +115,7 @@ - return - } - -- set cmd "$nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | egrep VERS\\\|bar\\\|foo | grep -v ^\\\\. | sort > $tmpdir/nm.out" -+ set cmd "$nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | grep -E VERS\\\|bar\\\|foo | grep -v ^\\\\. | sort > $tmpdir/nm.out" - verbose -log $cmd - catch "exec $cmd" exec_output - if [string match "" $exec_output] then { diff --git a/system/binutils/fix-pr28158-test.patch b/system/binutils/fix-pr28158-test.patch new file mode 100644 index 000000000..2fade9593 --- /dev/null +++ b/system/binutils/fix-pr28158-test.patch @@ -0,0 +1,30 @@ +Upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=30905 + +From 221e4f9b4ac4e6d4e362fdadf7f86a8b0df94d47 Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" +Date: Tue, 26 Sep 2023 00:26:06 -0500 +Subject: [PATCH] elf: Adjust PR ld/28158 tests + +PR ld/28158 + * testsuite/ld-elf/pr28158.rd: ensure symbol indexes containing + the number 0 match in regex + +Signed-off-by: A. Wilcox +--- + ld/testsuite/ld-elf/pr28158.rd | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ld/testsuite/ld-elf/pr28158.rd b/ld/testsuite/ld-elf/pr28158.rd +index b3cfe8915cb..c2cef7a0b39 100644 +--- a/ld/testsuite/ld-elf/pr28158.rd ++++ b/ld/testsuite/ld-elf/pr28158.rd +@@ -3,5 +3,5 @@ + #target: x86_64-*-linux* i?86-*-linux-gnu + + #... +- +[0-9]+: +[0-9a-f]+ +[0-9]+ +OBJECT +GLOBAL +DEFAULT +[1-9]+ foo@VERS_2.0 \([0-9]+\) ++ +[0-9]+: +[0-9a-f]+ +[0-9]+ +OBJECT +GLOBAL +DEFAULT +[0-9]+ foo@VERS_2.0 \([0-9]+\) + #pass +-- +2.39.2 (Apple Git-143) + diff --git a/system/binutils/musl-preinit-array.patch b/system/binutils/musl-preinit-array.patch new file mode 100644 index 000000000..9932f3c7f --- /dev/null +++ b/system/binutils/musl-preinit-array.patch @@ -0,0 +1,35 @@ +musl libc currently does not run .preinit_array functions. + +--- binutils-2.41/ld/testsuite/ld-elf/elf.exp.old 2023-09-22 20:55:13.894385414 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/elf.exp 2023-09-22 21:31:13.354594152 -0500 +@@ -427,17 +427,21 @@ + run_ld_link_exec_tests $array_tests_pie $xfails + + if { $STATIC_PIE_LDFLAGS != "" } then { ++ if { ![istarget *-*-musl*] } then { ++ run_ld_link_exec_tests [list \ ++ [list \ ++ "Static PIE preinit array" \ ++ "$STATIC_PIE_LDFLAGS" \ ++ "" \ ++ {preinit.c} \ ++ "preinit-static-pie" \ ++ "preinit.out" \ ++ "-fPIE" \ ++ ] \ ++ ] ++ } + run_ld_link_exec_tests [list \ + [list \ +- "Static PIE preinit array" \ +- "$STATIC_PIE_LDFLAGS" \ +- "" \ +- {preinit.c} \ +- "preinit-static-pie" \ +- "preinit.out" \ +- "-fPIE" \ +- ] \ +- [list \ + "Static PIE init array" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ diff --git a/system/binutils/musl-versioned-syms.patch b/system/binutils/musl-versioned-syms.patch new file mode 100644 index 000000000..3812947c3 --- /dev/null +++ b/system/binutils/musl-versioned-syms.patch @@ -0,0 +1,19 @@ +This test will not work on musl which does not support symbol versioning. + +--- binutils-2.41/ld/testsuite/ld-elfvers/vers.exp.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/ld-elfvers/vers.exp 2023-09-22 22:20:51.407688782 -0500 +@@ -888,8 +888,12 @@ + # Test that when we override a versioned symbol from the library this + # symbol appears in the dynamic symbol table of the executable. + # +-build_vers_lib_pic "vers16a" vers16a.c vers16a "" vers16.map vers16a.ver vers16a.dsym "" +-build_exec "vers16" vers16.c vers16 "-Wl,--no-as-needed" vers16a.so "" vers16.dsym "" ++if { [istarget *-*-musl*] } then { ++ xfail "vers16" ++} else { ++ build_vers_lib_pic "vers16a" vers16a.c vers16a "" vers16.map vers16a.ver vers16a.dsym "" ++ build_exec "vers16" vers16.c vers16 "-Wl,--no-as-needed" vers16a.so "" vers16.dsym "" ++} + + # Test a weak versioned symbol. + build_vers_lib_pic "vers17" vers17.c vers17 "" vers17.map vers17.ver vers17.dsym "" diff --git a/system/binutils/ppc32-pic-required.patch b/system/binutils/ppc32-pic-required.patch new file mode 100644 index 000000000..c9395d945 --- /dev/null +++ b/system/binutils/ppc32-pic-required.patch @@ -0,0 +1,23 @@ +On the 32-bit PowerPC target, musl does not support shared libraries without +PIC, because secure-PLT is required. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30918 + +--- binutils-2.41/ld/testsuite/ld-shared/shared.exp.old 2023-07-02 23:00:00.000000000 +0000 ++++ binutils-2.41/ld/testsuite/ld-shared/shared.exp 2023-09-24 08:44:39.404937347 +0000 +@@ -226,6 +226,7 @@ + setup_xfail "*-*-solaris2*" + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" ++ setup_xfail "powerpc-*-linux-musl" + setup_xfail "powerpc64*-*-*" + if { ![istarget hppa*64*-*-linux*] } { + setup_xfail "hppa*-*-linux*" +@@ -307,6 +308,7 @@ + setup_xfail "*-*-solaris2*" + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" ++ setup_xfail "powerpc-*-linux-musl" + setup_xfail "powerpc64*-*-*" + if { ![istarget hppa*64*-*-linux*] } { + setup_xfail "hppa*-*-linux*" diff --git a/system/binutils/ppc64-abiv2-addr2line.patch b/system/binutils/ppc64-abiv2-addr2line.patch new file mode 100644 index 000000000..e3cb4d73d --- /dev/null +++ b/system/binutils/ppc64-abiv2-addr2line.patch @@ -0,0 +1,15 @@ +musl libc uses the same ELFv2 ABI on both endians of PowerPC64. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30916 + +--- binutils-2.41/binutils/testsuite/binutils-all/addr2line.exp.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/binutils/testsuite/binutils-all/addr2line.exp 2023-09-22 20:44:37.242158767 -0500 +@@ -20,7 +20,7 @@ + set exe [exeext] + + # powerpc64 function symbols are on descriptors rather than code. +-if [istarget powerpc64-*-*] { ++if { [istarget powerpc64-*-*] && ![istarget powerpc64-*-musl] } { + set opts --synthetic + set dot {\.} + } diff --git a/system/binutils/pr25749-test-size.patch b/system/binutils/pr25749-test-size.patch new file mode 100644 index 000000000..c5d4c46d9 --- /dev/null +++ b/system/binutils/pr25749-test-size.patch @@ -0,0 +1,26 @@ +Loading these libraries on musl appear to be affected by ASLR. + +The size has the entire address loaded, and we only want the size bytes. + +Not reported upstream. + +--- binutils-2.41/ld/testsuite/ld-elf/pr25749-1b.c.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/pr25749-1b.c 2023-09-29 22:43:56.154343091 -0500 +@@ -5,5 +5,5 @@ + intptr_t + size (void) + { +- return (intptr_t) &_binary_pr25749_1_c_size; ++ return (intptr_t) &_binary_pr25749_1_c_size & 0xfff; + } +--- binutils-2.41/ld/testsuite/ld-elf/pr25749-2.c.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/pr25749-2.c 2023-09-30 00:20:28.484403583 -0500 +@@ -6,7 +6,7 @@ + int + main () + { +- if (size == 289 /* size of this file */) ++ if ((size & 0xfff) == 299 /* size of this file */) + printf ("PASS\n"); + #ifdef __GLIBC_PREREQ + # if !__GLIBC_PREREQ (2, 28) diff --git a/system/binutils/remove-pr19553c-test.patch b/system/binutils/remove-pr19553c-test.patch index 7e5b76ab0..a536137b7 100644 --- a/system/binutils/remove-pr19553c-test.patch +++ b/system/binutils/remove-pr19553c-test.patch @@ -2,13 +2,13 @@ This test requires symbol versioning which the musl libc does not support. --- binutils-2.29/ld/testsuite/ld-elf/indirect.exp.old 2017-07-04 08:43:21.000000000 +0000 +++ binutils-2.29/ld/testsuite/ld-elf/indirect.exp 2017-08-19 05:00:13.086002872 +0000 -@@ -186,9 +186,6 @@ - {"Run with libpr19553b.so" - "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" - {pr19553a.c} "pr19553b" "pr19553b.out"} -- {"Run with libpr19553c.so" -- "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" -- {pr19553a.c} "pr19553c" "pr19553c.out"} - {"Run with libpr19553d.so" - "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" - {pr19553a.c} "pr19553d" "pr19553d.out"} +@@ -190,9 +190,6 @@ + [list "Run with libpr19553b.so" \ + "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" \ + {pr19553a.c} "pr19553b" "pr19553b.out"] \ +- [list "Run with libpr19553c.so" \ +- "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" \ +- {pr19553a.c} "pr19553c" "pr19553c.out"] \ + [list "Run with libpr19553d.so" \ + "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" \ + {pr19553a.c} "pr19553d" "pr19553d.out"] \ diff --git a/system/binutils/remove-pr19719-test.patch b/system/binutils/remove-pr19719-test.patch index 8fbc08db6..09786fee6 100644 --- a/system/binutils/remove-pr19719-test.patch +++ b/system/binutils/remove-pr19719-test.patch @@ -1,9 +1,9 @@ We always use -fPIE (it's in our spec file), so it isn't possible to test this. --- binutils-2.30/ld/testsuite/ld-elf/shared.exp.old 2018-05-25 06:28:07.252414401 +0000 +++ binutils-2.30/ld/testsuite/ld-elf/shared.exp 2018-05-25 06:51:50.637028357 +0000 -@@ -1102,5 +1102,4 @@ +@@ -1657,5 +1657,4 @@ } } --mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719" +-mix_pic_and_non_pic [list "arm*-*-*"] "" "" "pr19719" mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie" diff --git a/system/binutils/remove-pr2404-tests.patch b/system/binutils/remove-pr2404-tests.patch index 9efdf5242..8dd7db65d 100644 --- a/system/binutils/remove-pr2404-tests.patch +++ b/system/binutils/remove-pr2404-tests.patch @@ -1,71 +1,91 @@ These tests fail to link correctly on musl. ---- binutils-2.29/ld/testsuite/ld-elf/shared.exp.old 2017-07-04 08:43:21.000000000 +0000 -+++ binutils-2.29/ld/testsuite/ld-elf/shared.exp 2017-08-19 04:59:05.319481464 +0000 -@@ -375,15 +375,6 @@ - {"Build needed3" - "tmpdir/needed3.o -Wl,--as-needed -Ltmpdir -lneeded3a -lneeded3b -lneeded1b" "" - {dummy.c} {} "needed3"} -- {"Build libpr2404a.so" -- "-shared" "-fPIC" -- {pr2404a.c} {} "libpr2404a.so"} -- {"Build libpr2404n.so" -- "-shared -Wl,-z,now" "-fPIC" -- {pr2404a.c} {} "libpr2404n.so"} -- {"Build libpr2404b.a" -- "" "" -- {pr2404b.c} {} "libpr2404b.a"} - {"Build rdynamic-1" - "-Wl,--no-dynamic-linker,-export-dynamic,--gc-sections" "-ffunction-sections" - {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"} -@@ -531,12 +522,6 @@ +--- binutils-2.41/ld/testsuite/ld-elf/shared.exp.old 2023-09-22 20:47:52.781342124 -0500 ++++ binutils-2.41/ld/testsuite/ld-elf/shared.exp 2023-09-22 20:54:03.151915244 -0500 +@@ -799,30 +799,6 @@ + + run_cc_link_tests [list \ + [list \ +- "Build libpr2404a.so" \ +- "-shared $NOSANITIZE_CFLAGS" \ +- "-fPIC $NOSANITIZE_CFLAGS" \ +- {pr2404a.c} \ +- {} \ +- "libpr2404a.so" \ +- ] \ +- [list \ +- "Build libpr2404n.so" \ +- "-shared -Wl,-z,now $NOSANITIZE_CFLAGS" \ +- "-fPIC $NOSANITIZE_CFLAGS" \ +- {pr2404a.c} \ +- {} \ +- "libpr2404n.so" \ +- ] \ +- [list \ +- "Build libpr2404b.a" \ +- "" \ +- "$NOSANITIZE_CFLAGS" \ +- {pr2404b.c} \ +- {} \ +- "libpr2404b.a" \ +- ] \ +- [list \ + "Build libpr26590a.so" \ + "-shared" \ + "-fPIC" \ +@@ -1132,17 +1108,6 @@ [list "Run relmain" \ "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \ {relmain.c} "relmain" "relmain.out" ] \ - [list "Run pr2404" \ -- "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \ -- {dummy.c} "pr2404" "pr2404.out" ] \ +- "$NOSANITIZE_CFLAGS -Wl,--no-as-needed \ +- tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ +- "" \ +- {dummy.c} "pr2404" "pr2404.out" \ +- "$NOSANITIZE_CFLAGS" ] \ - [list "Run pr2404n" \ -- "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \ -- {dummy.c} "pr2404n" "pr2404.out" ] \ +- "$NOSANITIZE_CFLAGS -Wl,-z,now \ +- -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \ +- {dummy.c} "pr2404n" "pr2404.out" \ +- "$NOSANITIZE_CFLAGS" ] \ [list "Run pr18458" \ "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \ {pr18458c.c} "pr18458" "pass.out" ] \ -@@ -675,14 +660,6 @@ +@@ -1341,14 +1306,6 @@ || [istarget *-*-gnu*] } { run_cc_link_tests [list \ [list \ - "Build libpr2404b.a with PIE" \ - "" \ -- "-fPIE" \ +- "-fPIE $NOSANITIZE_CFLAGS" \ - { pr2404b.c } \ - {} \ - "libpr2404b.a" \ - ] \ - [list \ "Build pr19579a.o" \ - "" "-fPIE" \ + "" "-fPIE -fcommon" \ {pr19579a.c} \ -@@ -717,24 +694,6 @@ +@@ -1428,24 +1385,6 @@ "-fPIE" \ ] \ [list \ - "Run pr2404 with PIE" \ -- "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ +- "-pie $NOSANITIZE_CFLAGS -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ - "" \ - { dummy.c } \ - "pr2404pie" \ - "pr2404.out" \ -- "-fPIE" \ +- "-fPIE $NOSANITIZE_CFLAGS" \ - ] \ - [list \ - "Run pr2404 with PIE (-z now)" \ -- "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \ +- "-pie $NOSANITIZE_CFLAGS -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \ - "" \ - { dummy.c } \ - "pr2404pien" \ - "pr2404.out" \ -- "-fPIE" \ +- "-fPIE $NOSANITIZE_CFLAGS" \ - ] \ - [list \ "Run pr18718" \ diff --git a/system/binutils/skip-thumb-plt-musl.patch b/system/binutils/skip-thumb-plt-musl.patch new file mode 100644 index 000000000..f88500de2 --- /dev/null +++ b/system/binutils/skip-thumb-plt-musl.patch @@ -0,0 +1,28 @@ +The file offsets are different causing this test to fail on hard-float EABI targets. + +Add musl target triplet alongside the glibc one. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30923 + +--- binutils-2.41/ld/testsuite/ld-arm/thumb-plt.d.old 2023-07-02 23:00:00.000000000 +0000 ++++ binutils-2.41/ld/testsuite/ld-arm/thumb-plt.d 2023-09-30 11:03:51.611314942 +0000 +@@ -2,7 +2,7 @@ + #name: Thumb only PLT and GOT + #ld: -shared -e0 -z max-page-size=0x10000 + #objdump: -dr +-#skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf ++#skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf *-*-musleabihf + + .*: +file format .*arm.* + +--- binutils-2.41/ld/testsuite/ld-arm/thumb-plt-got.d.old 2023-07-02 23:00:00.000000000 +0000 ++++ binutils-2.41/ld/testsuite/ld-arm/thumb-plt-got.d 2023-09-30 11:04:19.175314931 +0000 +@@ -2,7 +2,7 @@ + #name: Thumb only PLT and GOT LSB Symbol + #ld: -shared -e0 -z max-page-size=0x10000 + #readelf: -rx .got +-#skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf ++#skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf *-*-musleabihf + + Relocation section '.rel.plt' at offset 0x108 contains 1 entry: + Offset Info Type Sym.Value Sym. Name diff --git a/system/binutils/srec.patch b/system/binutils/srec.patch deleted file mode 100644 index ce3eac10b..000000000 --- a/system/binutils/srec.patch +++ /dev/null @@ -1,127 +0,0 @@ -X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blobdiff_plain;f=bfd%2Fmerge.c;h=632c852390355829f95e149b7d72f0982a1a0b2b;hp=fb7c0858bebb27b5375564054c148b2b68124554;hb=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e;hpb=65d8004072ccb15441c143c380949d785a8446cd - -diff --git a/bfd/merge.c b/bfd/merge.c -index fb7c085..632c852 100644 ---- a/bfd/merge.c -+++ b/bfd/merge.c -@@ -621,7 +621,7 @@ is_suffix (const struct sec_merge_hash_entry *A, - - /* This is a helper function for _bfd_merge_sections. It attempts to - merge strings matching suffixes of longer strings. */ --static bfd_boolean -+static struct sec_merge_sec_info * - merge_strings (struct sec_merge_info *sinfo) - { - struct sec_merge_hash_entry **array, **a, *e; -@@ -633,7 +633,7 @@ merge_strings (struct sec_merge_info *sinfo) - amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *); - array = (struct sec_merge_hash_entry **) bfd_malloc (amt); - if (array == NULL) -- return FALSE; -+ return NULL; - - for (e = sinfo->htab->first, a = array; e; e = e->next) - if (e->alignment) -@@ -703,11 +703,6 @@ merge_strings (struct sec_merge_info *sinfo) - } - } - secinfo->sec->size = size; -- if (secinfo->sec->alignment_power != 0) -- { -- bfd_size_type align = (bfd_size_type) 1 << secinfo->sec->alignment_power; -- secinfo->sec->size = (secinfo->sec->size + align - 1) & -align; -- } - - /* And now adjust the rest, removing them from the chain (but not hashtable) - at the same time. */ -@@ -724,7 +719,7 @@ merge_strings (struct sec_merge_info *sinfo) - e->u.index = e->u.suffix->u.index + (e->u.suffix->len - e->len); - } - } -- return TRUE; -+ return secinfo; - } - - /* This function is called once after all SEC_MERGE sections are registered -@@ -740,7 +735,8 @@ _bfd_merge_sections (bfd *abfd, - - for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next) - { -- struct sec_merge_sec_info * secinfo; -+ struct sec_merge_sec_info *secinfo; -+ bfd_size_type align; - - if (! sinfo->chain) - continue; -@@ -751,6 +747,7 @@ _bfd_merge_sections (bfd *abfd, - secinfo->next = NULL; - - /* Record the sections into the hash table. */ -+ align = 1; - for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) - if (secinfo->sec->flags & SEC_EXCLUDE) - { -@@ -758,18 +755,25 @@ _bfd_merge_sections (bfd *abfd, - if (remove_hook) - (*remove_hook) (abfd, secinfo->sec); - } -- else if (! record_section (sinfo, secinfo)) -- return FALSE; -- -- if (secinfo) -- continue; -+ else -+ { -+ if (!record_section (sinfo, secinfo)) -+ return FALSE; -+ if (align) -+ { -+ align = (bfd_size_type) 1 << secinfo->sec->alignment_power; -+ if ((secinfo->sec->size & (align - 1)) != 0) -+ align = 0; -+ } -+ } - - if (sinfo->htab->first == NULL) - continue; - - if (sinfo->htab->strings) - { -- if (!merge_strings (sinfo)) -+ secinfo = merge_strings (sinfo); -+ if (!secinfo) - return FALSE; - } - else -@@ -789,8 +793,7 @@ _bfd_merge_sections (bfd *abfd, - e->secinfo->first_str = e; - size = 0; - } -- size = (size + e->alignment - 1) -- & ~((bfd_vma) e->alignment - 1); -+ size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1); - e->u.index = size; - size += e->len; - secinfo = e->secinfo; -@@ -798,11 +801,16 @@ _bfd_merge_sections (bfd *abfd, - secinfo->sec->size = size; - } - -- /* Finally remove all input sections which have not made it into -- the hash table at all. */ -- for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) -- if (secinfo->first_str == NULL) -- secinfo->sec->flags |= SEC_EXCLUDE | SEC_KEEP; -+ /* If the input sections were padded according to their alignments, -+ then pad the output too. */ -+ if (align) -+ secinfo->sec->size = (secinfo->sec->size + align - 1) & -align; -+ -+ /* Finally remove all input sections which have not made it into -+ the hash table at all. */ -+ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) -+ if (secinfo->first_str == NULL) -+ secinfo->sec->flags |= SEC_EXCLUDE | SEC_KEEP; - } - - return TRUE; diff --git a/system/binutils/vers-tests-eabi.patch b/system/binutils/vers-tests-eabi.patch new file mode 100644 index 000000000..2ce59cee2 --- /dev/null +++ b/system/binutils/vers-tests-eabi.patch @@ -0,0 +1,33 @@ +By default, the vers4 tests use `sed` to look for `Version` lines. + +The problem is, on 32-bit ARM targets we have Version5 EABI. This causes +the tests to fail, like so: + + objdump --private-headers tmpdir/vers4b | sed -n /Version/,\$p > tmpdir/objdump.out + private flags = 0x5000400: [Version5 EABI] [hard-float ABI] + + objdump_emptyverstuff: did not expect any output from objdump + FAIL: vers4b + +Take 'private flags' lines out of the output to fix this. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30924 + +--- binutils-2.41/ld/testsuite/ld-elfvers/vers.exp.old 2023-09-30 21:51:47.304868575 -0500 ++++ binutils-2.41/ld/testsuite/ld-elfvers/vers.exp 2023-09-30 21:52:49.738253244 -0500 +@@ -215,11 +215,14 @@ + # this probably means that there is version information in libc, so we + # can't really perform this test. + return 1 ++ } else { if { [string match "*Version? EABI*" $exec_output] } then { ++# there is EABI Version information in the private flags of the binary. ++ return 1 + } else { + verbose -log "$exec_output" + verbose -log "objdump_emptyverstuff: did not expect any output from objdump" + return 0 +- } } ++ } } } + + } + diff --git a/system/binutils/visibility-musl.patch b/system/binutils/visibility-musl.patch new file mode 100644 index 000000000..4b833ffd3 --- /dev/null +++ b/system/binutils/visibility-musl.patch @@ -0,0 +1,19 @@ +The tests need to know musl can support symbol visibility. + +Upstream-URL: https://sourceware.org/bugzilla/show_bug.cgi?id=30915 + +--- binutils-2.41/ld/testsuite/ld-vsb/main.c.old 2023-07-02 18:00:00.000000000 -0500 ++++ binutils-2.41/ld/testsuite/ld-vsb/main.c 2023-09-29 03:03:53.103603661 -0500 +@@ -5,9 +5,9 @@ + int + main (void) + { +-#if defined (__GLIBC__) && (__GLIBC__ > 2 \ +- || (__GLIBC__ == 2 \ +- && __GLIBC_MINOR__ >= 2)) ++#if !defined (__GLIBC__) || (__GLIBC__ > 2 \ ++ || (__GLIBC__ == 2 \ ++ && __GLIBC_MINOR__ >= 2)) + puts ("yes"); + #else + puts ("no"); diff --git a/system/binutils/vsb-hammer.patch b/system/binutils/vsb-hammer.patch new file mode 100644 index 000000000..72446276d --- /dev/null +++ b/system/binutils/vsb-hammer.patch @@ -0,0 +1,19 @@ +Disable protected visibility tests that are known to be "broken" / "a mess". + +Not reported upstream to binutils, as this is a musl thing. + +--- binutils-2.41/ld/testsuite/ld-vsb/vsb.exp.old 2023-07-02 23:00:00.000000000 +0000 ++++ binutils-2.41/ld/testsuite/ld-vsb/vsb.exp 2023-09-30 11:21:09.367314546 +0000 +@@ -519,12 +519,8 @@ + + visibility_run hidden + visibility_run hidden_normal +-visibility_run hidden_undef + visibility_run hidden_undef_def + visibility_run hidden_weak +-visibility_run protected +-visibility_run protected_undef +-visibility_run protected_undef_def + visibility_run protected_weak + visibility_run normal + -- cgit v1.2.3-70-g09d2