Compare commits

...

216 Commits
master ... f37

Author SHA1 Message Date
Miloš Prchlík a6be4be2ad tests: fix tmt plan setup, "how: beakerlib" is no longer supported
Tests set their "framework" key correctly to "beakerlib", the correct setting for plan is therefore "tmt". This was not needed until recently, the old form was deprecated but still supported by Testing Farm, but not anymore.
2022-12-14 10:11:12 +01:00
yahmad f44b483e75 - Fic configuration of s390x binutils so that it does not include support for extraneous targets. (#2139143)
- Fix readelf's decoding of files with no sections.  (#2131609)
- Stop potential infinite loop in the binutils DWARF parser.  (#2122675)
2022-11-17 16:07:26 +01:00
yahmad aff59727ba Improving the performance of bfd function lookup_func_by_offset 2022-09-07 11:51:47 +02:00
Nick Clifton 9ee9ffc894 Add the --package-metadata option to the linkers. (#2099999) 2022-08-04 13:47:53 +01:00
Nick Clifton 0859b9f54c fix typo 2022-07-28 12:06:36 +01:00
Nick Clifton 17f6d21f57 Fix linker testsuite failure 2022-07-28 10:35:16 +01:00
Nick Clifton 544bea2339 Tweak the PowerPC assembler's handling of the .machine directive.
Resolves: #2111082
2022-07-26 16:36:29 +01:00
Amit Shah fa2df7c5e7 Check and enable 64-bit bfd on aarch64 and riscv64. 2022-07-26 09:39:35 +01:00
Nick Clifton 1b1ba83846 Restore the use of --enable-64-bit-bfd for the AArch64 and Riscv targets. 2022-07-25 16:56:47 +01:00
Fedora Release Engineering fc45567d6a Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-20 22:00:00 +00:00
Nick Clifton 3b3292ed1e Move update to the correct patch file 2022-06-30 15:57:49 +01:00
Nick Clifton fa5c6f55b2 Fix a problem honouring readelf's -wE and -wN command line options. 2022-06-30 15:28:09 +01:00
Nick Clifton 4c13eef881 Fix a problem with PowerPC's handling of DT_RELR relocs. (#2095622)
Move annobin data into a separate debuginfo file.
2022-06-13 13:08:30 +01:00
Nick Clifton 7fccd0d7e7 add in renamed rpath patch 2022-06-08 12:00:22 +01:00
Nick Clifton 2d6725c1a9 Fix typos which were preventing the linker tests from running 2022-06-08 11:59:39 +01:00
Nick Clifton fae26da53a Fix use of LDFLAGS 2022-05-28 12:39:19 +01:00
Nick Clifton 15c0289a28 Change the ld man page so that it says that --enable-new-dtags is the default.
Resolves: #2090818
2022-05-27 11:34:21 +01:00
Nick Clifton 97c0e8e507 x86 linker: Disallow invalid relocations against protected symbols. (#2089358) 2022-05-24 12:35:34 +01:00
Nick Clifton 2749aba2e5 Stop readelf and objdump from unnecessarily following links. (#2086863) 2022-05-21 13:11:18 +01:00
Nick Clifton 107db84d77 Fix bug preventing ld testsuite from running 2022-05-19 14:13:15 +01:00
Nick Clifton b223b873be Add support for generating static PIE binaries for s390x. (#2088331) 2022-05-19 12:21:43 +01:00
Nick Clifton f02d283cbb Fix description of gold subpackage so that it does not include the Requires fields. (#2082919) 2022-05-12 10:58:15 +01:00
Nick Clifton 9c952780c9 remove unused patches 2022-05-06 13:53:51 +01:00
Nick Clifton c0d31e974b Fix linker testsuite failures 2022-04-05 11:26:53 +01:00
Nick Clifton 467b87538d Fix a bug handling indirect symbols. (PR 28879) (#2068343) 2022-03-30 12:25:35 +01:00
Nick Clifton 6bd3a0b7c2 fix loc view patch 2022-03-10 13:31:23 +00:00
Nick Clifton 4a7c8e040b Add an option to objdump/readelf to disable accessing debuginfod servers.
Resolves: #2051741
2022-03-10 09:42:01 +00:00
Nick Clifton c074b4afae Simplify the assembler's evaluation of chained .loc view expressions.
Resolves: #2059646
2022-03-09 13:56:31 +00:00
Nick Clifton d685480361 Do not export any windows tools (if they were built).
Resolves: #2057636
2022-02-28 13:11:07 +00:00
Nick Clifton b04b2360b7 Add support for specifying a section type in linker scripts.
Resolves: #2052801
2022-02-16 18:04:53 +00:00
Václav Kadlčík 10575a5d52 Fix RHBZ#1311352 test for newer Fedora versions
The test used nscd which has been obsoleted by Fedora [1].  Fortunately
that package was just an example, any package using the same debuginfo
layout will do. Let's use coreutils instead.

[1] https://fedoraproject.org/wiki/Changes/RemoveNSCD
2022-02-16 13:37:38 +01:00
Nick Clifton ea9a413173 fix sources 2022-02-10 12:03:25 +00:00
Nick Clifton 24c5f0f956 Rebase on GNU Binutils 2.38. 2022-02-10 11:51:11 +00:00
Nick Clifton c13a28efbc Borrow a patch from the GCC package to stop libtool from inserting needless runpaths into binaries. (#2030667) 2022-01-27 16:47:47 +00:00
Fedora Release Engineering 95c35f80af - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-19 22:21:08 +00:00
Nick Clifton 9a25c9f346 Fix a potential illegal memory access parsing a COFF format file. (#2033716) 2021-12-20 14:07:45 +00:00
Nick Clifton 14b1fc0e7b Backport upstream patch to allow readelf to recognize packaging metadata note. 2021-12-02 13:21:29 +00:00
Luca Boccassi a2393deeee Backport upstream patch to allow readelf to recognize packaging metadata note
Will be useful to implement:

https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-12-01 17:42:19 +00:00
Nick Clifton 893b61d358 Add support for the EFI format to the AArch64 target.
Resolves: #2027515
2021-12-01 14:52:45 +00:00
Nick Clifton 94be2cd1fb Add ability to warn about multibyte characters in the assembler. (#2018848) 2021-11-19 12:14:31 +00:00
Martin Cermak 5bb4d15d3c Merge #31 `Fix the setup in tests/Sanity/testsuite` 2021-11-16 16:15:55 +00:00
Nick Clifton 5074d55c3d Add changelog entry for latest update 2021-11-16 11:01:54 +00:00
Václav Kadlčík 5dbfbba047 Fix the setup in tests/Sanity/testsuite
"koji download-build" is a wrong tool to download artifacts being
tested. They are freshly scratch-built and hosted in a local repo
called "test-artifacts" unknown to koji. Using "dnf download"
directly and limited to that specific repo is a correct way to
reach them.

I'm adding a fallback using the repo's local files just in case
"dnf" suffers some temporary hiccup.
2021-11-16 08:47:43 +00:00
Luca Boccassi 5f97030592 Add BuildRequires: bison, needed to regenerate ld files
Can be dropped after moving to 2.38

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-11-15 23:19:30 +00:00
Luca Boccassi df67e06692 Add upstream patch to allow creating read-only notes from linker scripts
Required to facilitate implementing:

https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-11-15 22:28:42 +00:00
Nick Clifton 86336d536a Add ability to show unicode characters to display tools. 2021-11-09 14:19:07 +00:00
Nick Clifton 9e8ef94636 Add upstream patch to use the directory name in .file 0, fixes ccache FTBFS
Resolves: #1996936
2021-10-27 13:19:02 +01:00
Orion Poplawski ca8ef33300 Add upstream patch to use the directory name in .file 0, fixes ccache FTBFS (bz#1996936) 2021-10-26 20:20:10 -06:00
Timm Bäder 47508dc848 Remove leftover .la files
The rpm included /usr/lib64/libctf-nobfd.la and /usr/lib64/libctf.la via
the libctf* wildcard in %files.
2021-10-26 12:22:18 +02:00
Nick Clifton 92a1236ab3 Fix linker seg-fault compiling efivar libraries.
Resolves: #2012247
2021-10-13 15:23:37 +01:00
Nick Clifton 752fe419ea Fix linker testsuite failures triggered by 2.27-13 patch.
Resolves: #2008203
2021-10-01 11:17:12 +01:00
Nick Clifton e59cdcdfc5 Default to an entry address of 0 for shared libraries.
Resolves: #2004952
2021-09-17 12:23:04 +01:00
Tom Stellard 73c2d21c11 Disable LTO on arm. (#1918924) 2021-09-14 16:08:12 -07:00
Nick Clifton 75c516c6c2 Enable -separate-code for all architectures, not just x86/x86_64. 2021-09-13 14:46:30 +01:00
Nick Clifton 50232d48dc Allow configuring with autonconf 2.71.
Resolves: #1999437
2021-09-10 10:39:51 +01:00
Nick Clifton dcb64b3d34 Fix a couple of test failures 2021-08-19 16:29:28 +01:00
Stephen Gallagher 252f93244d
Fix regression breaking Node.js builds
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

https://github.com/nodejs/node/issues/39452

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2021-08-11 10:38:16 -04:00
Nick Clifton a2d562c07d Ensure that the manual pages are generated. (#1989836) 2021-08-10 18:47:33 +01:00
Nick Clifton f4ad5792af Fix a local change to readelf which resulted in a success exit code for non-existant files.
Resolves: #1990817
2021-08-10 11:13:56 +01:00
Nick Clifton ffc81ff11e Add new patch 2021-08-09 19:57:00 +01:00
Nick Clifton 01ca902e23 Ensure that dir[0] contains pwd in gas generated DWARF-5 directory tables. (#1966987) 2021-08-09 19:41:14 +01:00
Fedora Release Engineering d5ffebd3b7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 18:37:30 +00:00
Nick Clifton 9eaca4038a Various fixes for testsuite failures. 2021-07-21 11:40:49 +01:00
Nick Clifton 6d1ff8eb0b Fix sources 2021-07-19 17:24:33 +01:00
Nick Clifton 90f5896dac Rebase to GNU Binutils 2.37.
- Retire: binutils-2.36-branch-updates.patch
- Retire: binutils-CVE-2021-20197.patch
- Retire: binutils-CVE-2021-3530.patch
- Retire: binutils-plugin-file-descriptors.patch
- Retire: binutils-ppc-weak-undefined-plt-relocs.patch
- Retire: binutils-ppc64le-note-merge.patch
- Retire: binutils-s390-arch14-insns.patch
2021-07-19 17:07:20 +01:00
Václav Kadlčík acab70872f Remove RHEL's regression test for #1804696
After [1] the reproducer isn't valid any more. Fortunately there's
a better reproducer and it's included in the internal test suite
(pr25458) and we run the suite (see tests/Sanity/testsuite). To sum
it up, we can delete the #1804696 test.

[1] 52d0948022?branch=rawhide
2021-07-01 21:02:27 +02:00
Václav Kadlčík 24cc8051d1 More debuginfos needed in test Regression/bz1311352 2021-07-01 18:15:39 +02:00
Václav Kadlčík 58f355fcc3 Un-break test Sanity/dts-probe-binaries for glibc 2.34
Don't look for __libc_csu_init, it's not in binaries built with glibc
2.34. See [1].

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=035c012e32c11e84d64905efaf55e74f704d3668
2021-07-01 16:47:41 +02:00
Nick Clifton fba59c4283 Enable the creation of .note.gnu.property sections by the GOLD linker for x86 binaries. (#1970961) 2021-06-21 18:02:11 +01:00
Nick Clifton fb7c644d99 Set clang bconf default based on %%toolchain.
Diable LTO when using clang.
Disable check-rpath's test for standard runpaths.
Make the existing tests have the gating effect.
2021-06-03 15:01:45 +01:00
Václav Kadlčík c82e600f3f Unbreak tests/Sanity/rebuild-coreutils
Work around #1960792 (a coreutils bug). While the systems running
Fedora CI are still affected, the fix is already in the update
repos. Using "dnf update coreutils" should be enough to make our
test pass.
2021-06-01 14:08:24 +00:00
Nick Clifton 3ebde0f76b Remove spurious spaces from binutils.spec 2021-05-27 13:06:57 +01:00
Nick Clifton a4b106ec38 Increase number of file descriptors available to plugins. (#1918924)
Remove uses of RPATH.
2021-05-27 10:44:25 +01:00
Václav Kadlčík 284ad2a04b Import RHEL's regression test for #1804696
A tweak was needed for Rawhide (or anything after [1]): readelf
requires "-W" to display the "_environ" symbol without truncating.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0942c7ab94e554657c3e11ab85ae7f15373ee80d
2021-05-26 07:34:05 +02:00
Václav Kadlčík 8b9a64065d Import RHEL's test Sanity/rebuild-coreutils 2021-05-25 08:38:59 +02:00
Václav Kadlčík 518691547f Import RHEL's test Sanity/rebuild-wget 2021-05-25 08:38:34 +02:00
Václav Kadlčík 8d1431acf8 Import RHEL's test Sanity/rebuild-emacs 2021-05-25 08:37:46 +02:00
Václav Kadlčík f5c84aa932 Merge branch 'rawhide' of https://src.fedoraproject.org/forks/vkadlcik/rpms/binutils into rawhide 2021-05-25 08:08:19 +02:00
Václav Kadlčík 473ccf2683 Import RHEL's test Sanity/testsuite
It's a wrapper for the upstream test suite.

There's one small addition (already inherited from RHEL) covering
but I'm keeping it here for convenience as it works with the upstream
test suite too. I've slightly modified it to make it work beyond
RHEL 8. The modification is based on the final upstream fix [1] and
the related discussion in thread [2].

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6bf4a34047452f882c5cc66bd85812ee1bb5a41c
[2] https://sourceware.org/pipermail/binutils/2018-August/104304.html
2021-05-21 17:02:51 +00:00
Václav Kadlčík 54c8d3242b Merge remote-tracking branch 'upstream/rawhide' into rawhide 2021-05-21 12:22:29 +02:00
Nick Clifton 2680508b04 Spec file tidy ups 2021-05-21 10:32:35 +01:00
Václav Kadlčík 0b3adba8ff Merge remote-tracking branch 'upstream/rawhide' into rawhide 2021-05-19 06:42:47 +02:00
Nick Clifton fc998ec612 Generate PLT relocs for weak undefined PPC function symbols.
Resolves: #1960730
2021-05-18 12:50:19 +01:00
Václav Kadlčík 5069c58e30 Import RHEL's test Sanity/testsuite
It's a wrapper for the upstream test suite.

There's one small addition (already inherited from RHEL) covering
but I'm keeping it here for convenience as it works with the upstream
test suite too. I've slightly modified it to make it work beyond
RHEL 8. The modification is based on the final upstream fix [1] and
the related discussion in thread [2].

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6bf4a34047452f882c5cc66bd85812ee1bb5a41c
[2] https://sourceware.org/pipermail/binutils/2018-August/104304.html
2021-05-14 10:11:23 +02:00
Nick Clifton 616b9e8e44 Enable new dtags 2021-05-13 12:07:17 +01:00
Václav Kadlčík 64cf74e8a3 Fix RHEL's test Sanity/dts-probe-binaries
Here are the changes, promised in the import commit:
- Adapt to binutils 2.36.1:
  - ".dynstr" no longer in the symbol table, see
    https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8
  - only one '@' for undefined symbols in the symbol table, see
    https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3f2e9699234ca31d083bc93ea6e03903f10baeaf
- Remove code specific to older RHELs
2021-05-12 05:41:19 +02:00
Václav Kadlčík 22348da57d Import RHEL's test Sanity/dts-probe-binaries
Unchanged yet, failing on Fedora Rawhide. I'll fix it in the
upcoming commit.
2021-05-12 05:39:34 +02:00
Václav Kadlčík 8e50243c45 Import RHEL's regression test for #241252 2021-05-11 15:30:04 +00:00
Václav Kadlčík 95e9eaea23 Import RHEL's regression test for #430856 2021-05-11 15:30:04 +00:00
Václav Kadlčík 3740b5fe3f Import RHEL's regression test for #435078 2021-05-11 15:30:04 +00:00
Václav Kadlčík 2c6bc398b0 Import RHEL's regression test for #480009 2021-05-11 15:30:04 +00:00
Václav Kadlčík fe3f218ee7 Import RHEL's regression test for #495196 2021-05-11 15:30:04 +00:00
Václav Kadlčík ba92017b68 Import RHEL's regression test for #509124 2021-05-11 15:30:04 +00:00
Václav Kadlčík 14a74d027d Import RHEL's regression test for #531269 2021-05-11 15:30:04 +00:00
Václav Kadlčík 1f73172fe0 Import RHEL's regression test for #533321 2021-05-11 15:30:04 +00:00
Václav Kadlčík 001cb68e0a Import RHEL's regression test for #578576 2021-05-11 15:30:04 +00:00
Václav Kadlčík 22c57fab15 Import RHEL's regression test for #587788 2021-05-11 15:30:04 +00:00
Timm Bäder 117b4ee5c2 spec: Consistently use %set_build_flags
So we can always refer to CFLAGS and LDFLAGS instead of swithing between
them and the RPM_ equivalent.
2021-05-08 10:42:18 +02:00
Timm Bäder 5e669f0402 Remove unnecessary parameters from make macros
%make_build already passes %{_smp_mflags) and %make_install passes
DESTDIR=%{buildroot}
2021-05-08 10:01:11 +02:00
Nick Clifton 2c147eaf06 Stop stack exhaustion when demangling corrupt rust names.
Resolves: #1956424
2021-05-07 17:42:52 +01:00
Václav Kadlčík 4594b7d025 Fix a too old path to the test framework in a CI test 2021-04-29 13:52:03 +02:00
Václav Kadlčík 37d46f62b4 More precise setup in the #1311352 CI test 2021-04-29 11:00:35 +02:00
Václav Kadlčík eb66e6ad98 Remove a useless import breaking the #689829 CI test 2021-04-29 08:55:09 +02:00
Václav Kadlčík 248005fd4b Import RHEL's regression test for #689829 2021-04-28 13:38:57 +02:00
Václav Kadlčík cf75a87f18 Import RHEL's regression test for #698005 2021-04-28 13:38:57 +02:00
Václav Kadlčík aa0db47566 Import RHEL's regression test for #748927 2021-04-28 13:38:57 +02:00
Václav Kadlčík 06dff1c717 Import RHEL's regression test for #755872 2021-04-28 13:38:57 +02:00
Václav Kadlčík 6becef8c86 Import RHEL's regression test for #850832 2021-04-28 13:38:57 +02:00
Václav Kadlčík 5368a04b59 Import RHEL's regression test for #872148 2021-04-28 13:38:57 +02:00
Václav Kadlčík c58376bae6 Import RHEL's regression test for #895241 2021-04-28 13:38:57 +02:00
Václav Kadlčík d8a8efd579 Import RHEL's regression test for #916214 2021-04-28 13:38:57 +02:00
Václav Kadlčík 8b0542614c Import RHEL's regression test for #959422 2021-04-28 08:27:22 +02:00
Václav Kadlčík b0c79a4304 Import RHEL's regression test for #1174826 2021-04-28 08:26:46 +02:00
Václav Kadlčík 6df1ce83dc Import RHEL's regression test for #1080077 2021-04-28 08:25:53 +02:00
Václav Kadlčík 0fc29a6fe4 Import RHEL's regression test for #1117458 2021-04-28 08:25:53 +02:00
Václav Kadlčík 31a5e2d113 Import RHEL's regression test for #1172766 2021-04-28 08:25:53 +02:00
Václav Kadlčík 4504773204 Import RHEL's regression test for #1226864 2021-04-16 13:02:35 +02:00
Václav Kadlčík 565577c240 Import RHEL's regression test for #1243559 2021-04-16 13:02:35 +02:00
Václav Kadlčík d78b2cccc1 Import RHEL's regression test for #1248929 2021-04-16 13:02:35 +02:00
Václav Kadlčík ae526f4dc7 Import RHEL's regression test for #1311352 2021-04-16 13:02:35 +02:00
Václav Kadlčík c468b0dfdd Import RHEL's regression test for #1366145 2021-04-16 13:02:35 +02:00
Václav Kadlčík 484107a803 Import RHEL's regression test for #1433075 2021-04-14 06:31:29 +02:00
Václav Kadlčík 9cd058771f Import RHEL's regression test for #1439350 2021-04-14 06:31:29 +02:00
Václav Kadlčík 57106a8254 Import RHEL's regression test for #1465318 2021-04-14 06:31:29 +02:00
Václav Kadlčík 6a906104d9 Import RHEL's regression test for #1573872 2021-04-14 06:29:51 +02:00
Václav Kadlčík e05b04d76b Import RHEL's regression test for #1624776 2021-04-12 11:06:09 +02:00
Václav Kadlčík c7ad9ce6c4 Import RHEL's regression test for #1693661 2021-04-12 10:59:29 +02:00
Václav Kadlčík e429ddcadc Import RHEL's regression test for #1785294 2021-04-12 10:59:08 +02:00
Václav Kadlčík 195ba30ad9 Import RHEL's regression test for #1406430 2021-04-08 14:43:47 +02:00
Václav Kadlčík a6c5799515 Remove a broken test case
The kernel rebuild test has been broken since the beginning and is
hard to debug due to CI's limitations when dealing with larger logs.
Fortunately, a better replacement has been introduced by mcermak
in commits 044ff51 and 49b89d9 that renders the broken test case
pointless.
2021-04-08 14:39:38 +02:00
Nick Clifton 7453caeb33 Add an explicit dependency upon autoconf 2.69.
Resolves: #1942991
2021-03-25 13:39:49 +00:00
Nick Clifton ac55f50329 Extend vulnerability fix yet again.
Resolves: #1925779
2021-03-11 14:30:48 +00:00
Nick Clifton 0b119dd9d5 Unretire the CVE 2021-20197 patch.
Fix merging ppc64le notes (again).  (#1928936)
2021-02-22 16:49:04 +00:00
Nick Clifton e184e98697 Add support for the Z extensions to the s390x architecture. 2021-02-19 13:32:41 +00:00
Nick Clifton 2f53574f32 Fix merging ppc64le notes. 2021-02-18 12:42:56 +00:00
Nick Clifton e5b60c3bbb Fix some unexpected failures in the linker testsuite which are triggered by the locally applied patches 2021-02-12 14:27:01 +00:00
Nick Clifton 2e8b4af2b9 Re-add output-format.sed source file 2021-02-11 13:40:22 +00:00
Nick Clifton e1785a2a4b Rebase to GNU Binutils 2.36.1. 2021-02-11 13:36:12 +00:00
Nick Clifton bbafdb8775 Extend vulnerability fix again.
Resolves: #1925779
2021-02-08 13:07:23 +00:00
Nick Clifton c014d04d53 Preserve debug information in libbfd.a and libopcodes.a.
Resolves: #1924068
2021-02-04 20:29:52 +00:00
Nick Clifton 5cef9601f1 Extend vulnerability fix again.
Resolves: #1913744
2021-02-04 11:18:37 +00:00
Nick Clifton 34f3e5e618 Enable PEP support for all targets.
Resolves: #1920373
2021-02-03 11:57:16 +00:00
Nicholas Clifton 84771fa58a Merge #8 `Introduce kernel rebuild CI test.` 2021-02-03 09:52:28 +00:00
Nick Clifton 8bb6c79408 Extend vulnerability fix.
Re4solves: #1913744
2021-02-02 15:42:25 +00:00
Martin Cermak 49b89d94ef Use baseos-qe.koji-build.scratch-build.validation as gating.
Replace fedora-ci.koji-build.tier0.functional with
baseos-qe.koji-build.scratch-build.validation.

The former testcase, fedora-ci.koji-build.tier0.functional, aims to
perform the kernel rebuild on a fedora CI test system, not in koji.

The latter, baseos-qe.koji-build.scratch-build.validation is supposed
to run a kernel rebuild in a side-tag koji buildroot, which is closer
to a real kernel rebuild.

This commit sets baseos-qe.koji-build.scratch-build.validation as
the default kernel rebuild gating test for binutils.
2021-02-01 17:41:51 +01:00
Martin Cermak 044ff519e9 Introduce kernel rebuild CI test.
Introduce baseos-qe.koji-build.scratch-build.validation as a new
gating test for binutils.  The test makes sure that the binutils
update under test doesn't break the kernel build process.  The
testing kernel build happens in koji in a side-tag buildroot
containing the binutils build under test.

The source code of this new testcase lives here:
https://github.com/fedora-ci/scratch-build-test

In case of a failure that is considered a false positive, the test
result can be waived using Bodhi this way:
https://docs.fedoraproject.org/en-US/ci/gating/#_waive
2021-02-01 16:38:26 +01:00
Nick Clifton 94c52a6c76 Add support for DWARF-5 sections to the bfd linker's scripts.
Resolves: #1922707
2021-02-01 11:03:26 +00:00
Nick Clifton 1c9437f634 Fix a vulnerability in the smart_rename function.
Resolves: #1913744
2021-01-29 14:55:39 +00:00
Nick Clifton da81b23637 Fix failures is gas and ld testsuites. 2021-01-28 10:27:32 +00:00
Fedora Release Engineering 90ca16a5d6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 01:09:07 +00:00
Nick Clifton 88880dcb05 Update the BFD library to handle DWARF-5 line number ranges. 2021-01-25 11:53:12 +00:00
Václav Kadlčík 1171dfa950 Disk space tuning in CI test code 2021-01-22 12:54:58 +01:00
Václav Kadlčík 7294ce61bc Make some CI test code optional
The only present test case rebuilt, installed and booted the kernel.
Now let's make the install and boot steps optional, just on explicit
request. Skipping these steps will be the default behaviour, at least
for now.

You can override the default by setting variable "JUST_BUILD" in the
environment the test runs in. The variable defaults to "yes" which
means the test will just build the kernel. If you use JUST_BUILD=no
(or JUST_BUILD=false or JUST_BUILD=0) then the test will not only
build but install and boot the kernel, too.

Note that the acceptable values of JUST_BUILD are case insensitive.
2021-01-22 12:22:21 +01:00
Václav Kadlčík 4db8f84f7e Improve CI test code - remove bloat
* Remove code related to RHEL versions and not interesting in Fedora.
* Remove or simplify some architecture-specific code because Fedora CI
  aims at x86_64 only.
* Remove some older and commented out experiments.
2021-01-22 12:15:53 +01:00
Václav Kadlčík c29a5d4751 Introduce CI with one test imported form RHEL
Sanity/rebuild-kernel-and-reboot is imported from RHEL's
tests/binutils/Sanity/rebuild-kernel-and-reboot (as of commit c5bc77c).
It needs some adaptations first before running in Fedora.
2021-01-22 12:13:50 +01:00
Nick Clifton 433c9b01d4 Update the GOLD linker to handle x86 .note.gnu.property sections.
Resolves: #1916925
2021-01-21 19:23:49 +00:00
Nick Clifton d5e63f6505 Add a fix to gas to automatically enable DWARF-5 style file name tables. 2021-01-18 16:28:08 +00:00
Nick Clifton 0960a4713d Add an option (currently disabled) to build a linker which generates new dtags. 2021-01-15 13:11:49 +00:00
Nick Clifton c3a1a4ef17 Ensure that bfd.h is the same for i686- and x86_64 versions of the devel rpm.
Resolves: #1915317
2021-01-12 16:34:38 +00:00
Nick Clifton eeeb57f8ed Fix bug running readelf on an empty file. (#1903448) 2021-01-08 17:48:06 +00:00
Nick Clifton e056abea7e Fix bug running readelf on a file that cannot be read.
Resolves: #1913589
2021-01-07 14:20:35 +00:00
Nick Clifton 5aee897b5c Fix linking with multiple same-name sections. (PR 27100) 2021-01-04 16:31:41 +00:00
Nick Clifton 4b3b7c0eda Fix linking mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections. (#1907945) 2021-01-04 14:24:14 +00:00
Tom Stellard 1c6ed47920 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-17 22:56:04 +00:00
Florian Weimer 05722a7935 NVR bump for toolchain rebuild 2020-11-26 13:58:42 +01:00
Nick Clifton 0781ec435c Import latest fixes on 2.35 branch 2020-11-25 15:49:04 +00:00
Nick Clifton b69788edf8 Tweaks for building cross binutils rpms. 2020-11-25 15:00:22 +00:00
Nick Clifton c9f1c0ef4c rename spec.cross to spec.binutils.cross 2020-11-18 14:10:35 +00:00
Nick Clifton 2040d52e17 Add spec.cross file which can be used to create a meta cross binutils rpm 2020-11-12 14:58:34 +00:00
Nick Clifton 540feda45b Tweaks to improve cross building 2020-11-10 14:31:42 +00:00
Nick Clifton 7c556a22c9 Add support for DW_FORM_ref8 when parsing DWARF types. 2020-11-10 12:01:43 +00:00
Nick Clifton 9138ef7327 Fix dwarf type handling - again! 2020-11-03 20:03:31 +00:00
Nick Clifton a4573e9c3e Another correction for plugin as-needed patch. (#1889763) 2020-11-03 13:16:50 +00:00
Nick Clifton 611c7aa70b Another fix for the plugin as-needed problem. 2020-10-30 14:41:16 +00:00
Nick Clifton 63965bc14d Correction for plugin as-needed patch.
Resolves: #1889763
2020-10-29 16:58:38 +00:00
Nick Clifton b5f49511e0 This time without the debugging 2020-10-29 08:07:17 +00:00
Nick Clifton a1dc8e2d32 Correction for plugin as-needed patch.
Resolves: #1889763
2020-10-28 21:18:47 +00:00
Nick Clifton 45e67f9ccb Really fix erroneous decoding of LEB128 values.
Resolves: #1891171
2020-10-27 16:59:21 +00:00
Nick Clifton 9051ca66fa Fix erroneous decoding of LEB128 values.
Resolves: #188716
2020-10-21 15:08:45 +01:00
Nick Clifton 842839bbb1 Make readelf and objdump recursively follow debug links. (PR 26595) 2020-10-15 15:11:10 +01:00
Nick Clifton 13a86b8b66 Allow plugin syms to mark as-needed shared libs needed 2020-10-09 13:23:57 +01:00
Nick Clifton 2592e35890 Fix various problems with Power10 support. 2020-10-08 17:08:25 +01:00
Nick Clifton a04d2461fb Really add the patch to fix strip this time. 2020-10-07 14:42:08 +01:00
Nick Clifton 2c9d39bc55 Fix strip when merging multiple same-named sections.
Resolves: #1885607
2020-10-06 16:58:40 +01:00
Nick Clifton 7e6a1748ba Rebase to GNU Binutils 2.35.1 release.
Retire: binutils-gas-dwarf-level-4.patch
Retire: binutils-aarch64-plt-sh_entsize.patch
Retire: binutils-ppc-rename-xvcvbf16sp-to-xvcvbf16spn.patch
Retire: binutils-dwarf-5-fixes.patch
2020-09-21 11:06:32 +01:00
Nick Clifton 7691c28cb0 Add missing patches. 2020-09-11 11:37:55 +01:00
Nick Clifton ba80920a4c Fix the PowerPC disassembler so that it ignores annobin symbols. 2020-09-11 11:37:10 +01:00
Nick Clifton 2e0c2015a5 Import fixes from GNU binutils mainline for handling DWARF-5 debug information. 2020-08-25 16:57:53 +01:00
Nick Clifton d62f898ae7 Rename the PPC xvcvbf16sp instruction to xvcvbf16spn. 2020-08-24 15:12:48 +01:00
Jeff Law 7bb2daa612 Re-enable LTO 2020-07-31 18:39:00 -06:00
Jeff Law e315473f6c Disable LTO for bootstrapping purposes 2020-07-31 15:25:01 -06:00
Nick Clifton b22933e83e Fix building with LTO enabled. 2020-07-31 14:35:26 +01:00
Nick Clifton 93bf869662 Set the sh_entsize field of the AArch64's PLT section to 0. (PR 26312) 2020-07-31 08:13:17 +01:00
Richard W.M. Jones 6442193bff Disable LTO again, it causes "ar" to segfault. 2020-07-30 22:31:29 +01:00
Nick Clifton 722dceebdb Fix assembler to default to DWARF level 3 2020-07-30 14:05:32 +01:00
Nick Clifton a8b0efde87 Default to DWARF level 4 in the assembler. 2020-07-30 09:29:21 +01:00
Nick Clifton 3eb4862ad3 Remove unneeded patches 2020-07-27 15:21:06 +01:00
Fedora Release Engineering 74b3ce8462 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 13:08:28 +00:00
Jeff Law 0af851ae02 Disable LTO for now 2020-07-26 12:02:43 -06:00
Nick Clifton 15a78ff3d8 Rebase to GNU BInutils 2.35
Resolves: #1854613
2020-07-26 11:33:09 +01:00
Nick Clifton 5cfc5a91d2 Add gcc 10 build fixes 2020-07-24 19:57:15 +01:00
Nick Clifton 385f20222d Enable debuginfod support. 2020-07-24 19:56:24 +01:00
Jeff Law 426edf4a6e - Fix more configure tests compromised by LTO. 2020-07-20 13:58:21 -06:00
Jeff Law 32bf168f75 - Fix configure test compromised by LTO. Add appropriate BuildRequires
and force rebuliding the configure files in the appropriate dirs
- Fix various warnings exposed by LTO.
2020-07-19 11:35:06 -06:00
Nick Clifton d8ce39864a Switch to using %autosetup 2020-07-07 10:56:06 +01:00
Nick Clifton c548afa128 Add BPF support to the s390x target.
Resolves: #1825193
2020-06-16 20:38:14 +01:00
Nick Clifton 347bbd0dc5 Enhance the error message displayed by the BFD library when it fails to load a plugin.
Resolves: #1836618
2020-05-26 14:05:33 +01:00
Nick Clifton 72f99ab293 Rebase to tip of GNU Binutils 2.34 branch, brining in LTO fixes.
Retire: binutils-nm-lto-plugin.patch
2020-05-22 15:50:12 +01:00
Nick Clifton e8f39243b8 Fix seg fault when loading plugins via symlinks.
Resolves: #1828587
2020-04-28 15:33:47 +01:00
Nick Clifton d1aeab2109 readd sed script 2020-04-20 16:05:49 +01:00
Nick Clifton 07a3e80865 Add support for the BPF target.
Resolves: #1825193
2020-04-20 15:22:40 +01:00
Nick Clifton beb7b8e936 Fix the plugin support architecture to allow proper symbol info handling. (PR 25355) 2020-02-16 11:34:52 +00:00
Nick Clifton 657e3d5a3e Rebase to GNU Binutils 2.34. (#1793098)
Retire: binutils-improved-note-merging.patch
Retire: binutils-CVE-2019-17451.patch
Retire: binutils-CVE-2019-17450.patch
Retire: binutils-addr2line-fixes.patch
2020-02-02 14:55:39 +00:00
Fedora Release Engineering bf57373ec8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 12:59:08 +00:00
Nick Clifton dcf3d266fa Enable 64-bit BFD and PEP support for riscv. 2020-01-23 12:27:30 +00:00
Nick Clifton 7111265a8a Improve the accuracy of addr2line.
Resolves: #1760967
2020-01-02 17:26:12 +00:00
248 changed files with 13532 additions and 2967 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

86
.gitignore vendored
View File

@ -1,20 +1,70 @@
binutils-2.*/
i386
i686
x86_64
/binutils-*.tar.bz2
.build-*
*.src.rpm
*.log
HOWTO
build-sources
*.diff
*.orig
*.rej
/binutils-2.29.tar.xz
/binutils-2.29.1.tar.xz
*~
.#*
*#
*.flt
*.gmo
*.info
*.la
*.lo
*.o
*.pyc
*.tmp
*.a
.deps
.libs
autom4te.cache
config.cache
config.h
config.intl
config.log
config.status
libtool
POTFILES
*-POTFILES
TAGS
TAGS.sub
.local.vimrc
.lvimrc
.clang-format
.gdbinit
.gdb_history
perf.data
perf.data.old
# ignore core files, but not java/net/protocol/core/
core
!core/
lost+found
# ignore ./contrib/gcc_update output
LAST_UPDATED
REVISION
stamp-*
*.stamp
# ignore in-tree prerequisites
/mpfr*
/mpc*
/gmp*
/isl*
/binutils-2.34.0-5dfc0c955dbe912cd328fc2688e5fceb3239ac2a.tar.xz
/binutils-2.19.50.0.1-output-format.sed
/binutils-2.30.tar.xz
/binutils-2.30.90.tar.xz
/binutils-2.31.1.tar.xz
/binutils-special-sections-in-groups.patch
/binutils-2.32.tar.xz
/binutils-2.33.1.tar.xz
/binutils-2.35.tar.xz
/binutils-2.35.1.tar.xz
/binutils-2.36.1.tar.xz
/binutils-2.37.tar.xz
/binutils-2.38.tar.xz

View File

@ -1,38 +0,0 @@
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
# Imported from glibc/Makerules.
/ld.*[ ]-E[BL]/b f
/collect.*[ ]-E[BL]/b f
/OUTPUT_FORMAT[^)]*$/{N
s/\n[ ]*/ /
}
t o
: o
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
t s
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
t q
d
: s
s/"//g
G
s/\n//
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q
: q
s/"//g
p
q
: f
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
t h
s/^.*[ ]-E\([BL]\)$/,\1/
t h
d
: h
h

View File

@ -1,62 +0,0 @@
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:49:52.211121564 +0000
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:53:26.991423055 +0000
@@ -2813,8 +2813,8 @@ static bfd_boolean comp_unit_maybe_decod
static bfd_boolean
find_abstract_instance (struct comp_unit * unit,
- bfd_byte * orig_info_ptr,
struct attribute * attr_ptr,
+ unsigned int recur_count,
const char ** pname,
bfd_boolean * is_linkage,
char ** filename_ptr,
@@ -2829,6 +2829,14 @@ find_abstract_instance (struct comp_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,7 @@ find_abstract_instance (struct comp_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 +2984,7 @@ find_abstract_instance (struct comp_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 +3200,7 @@ scan_unit_for_symbols (struct comp_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,

View File

@ -1,20 +0,0 @@
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:32:09.395430104 +0000
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:33:17.272899503 +0000
@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
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)

View File

@ -0,0 +1,15 @@
--- binutils.orig/binutils/dwarf.c 2022-08-31 11:58:08.918685348 +0100
+++ binutils-2.39/binutils/dwarf.c 2022-08-31 15:24:13.881865797 +0100
@@ -6365,7 +6365,11 @@ display_debug_abbrev (struct dwarf_secti
list->start_of_next_abbrevs = start;
}
else
- start = list->start_of_next_abbrevs;
+ {
+ if (start == list->start_of_next_abbrevs)
+ break;
+ start = list->start_of_next_abbrevs;
+ }
if (list->first_abbrev == NULL)
continue;

View File

@ -0,0 +1,129 @@
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.38/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2022-08-25 17:21:26.955360836 +0200
+++ binutils-2.38/bfd/dwarf2.c 2022-08-25 18:03:57.766380659 +0200
@@ -36,6 +36,7 @@
#include "elf-bfd.h"
#include "dwarf2.h"
#include "hashtab.h"
+#include "splay-tree.h"
/* The data in the .debug_line statement prologue looks like this. */
@@ -82,6 +83,45 @@ struct adjusted_section
bfd_vma adj_vma;
};
+struct addr_range
+{
+ bfd_byte *start;
+ bfd_byte *end;
+};
+
+/* Return true if address range do intersect. */
+
+static bool
+addr_range_intersects (struct addr_range *r1, struct addr_range *r2)
+{
+ return (r1->start <= r2->start && r2->start < r1->end)
+ || (r1->start <= (r2->end - 1) && (r2->end - 1) < r1->end);
+}
+
+/* Compare function for splay tree of addr_ranges. */
+
+static int
+splay_tree_compare_addr_range (splay_tree_key xa, splay_tree_key xb)
+{
+ struct addr_range *r1 = (struct addr_range *) xa;
+ struct addr_range *r2 = (struct addr_range *) xb;
+
+ if (addr_range_intersects (r1, r2) || addr_range_intersects (r2, r1))
+ return 0;
+ else if (r1->end <= r2->start)
+ return -1;
+ else
+ return 1;
+}
+
+/* Splay tree release function for keys (addr_range). */
+
+static void
+splay_tree_free_addr_range (splay_tree_key key)
+{
+ free ((struct addr_range *)key);
+}
+
struct dwarf2_debug_file
{
/* The actual bfd from which debug info was loaded. Might be
@@ -2997,16 +3037,12 @@ find_abstract_instance (struct comp_unit
else
{
/* Check other CUs to see if they contain the abbrev. */
- struct comp_unit *u;
-
- for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
- if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
- break;
-
- if (u == NULL)
- for (u = unit->next_unit; u != NULL; u = u->next_unit)
- if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
- break;
+ struct comp_unit *u = NULL;
+ struct addr_range range = { info_ptr, info_ptr };
+ splay_tree_node v = splay_tree_lookup (unit->file->comp_unit_tree,
+ (splay_tree_key)&range);
+ if (v != NULL)
+ u = (struct comp_unit *)v->value;
if (attr_ptr->form == DW_FORM_ref_addr)
while (u == NULL)
@@ -4910,6 +4946,22 @@ stash_comp_unit (struct dwarf2_debug *st
info_ptr_unit, offset_size);
if (each)
{
+ if (file->comp_unit_tree == NULL)
+ file->comp_unit_tree
+ = splay_tree_new (splay_tree_compare_addr_range,
+ splay_tree_free_addr_range, NULL);
+
+ struct addr_range *r
+ = (struct addr_range *)bfd_malloc (sizeof (struct addr_range));
+ r->start = each->info_ptr_unit;
+ r->end = each->end_ptr;
+ splay_tree_node v = splay_tree_lookup (file->comp_unit_tree,
+ (splay_tree_key)r);
+ if (v != NULL || r->end <= r->start)
+ abort ();
+ splay_tree_insert (file->comp_unit_tree, (splay_tree_key)r,
+ (splay_tree_value)each);
+
if (file->all_comp_units)
file->all_comp_units->prev_unit = each;
else
@@ -5361,6 +5413,8 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abf
free (file->line_table->dirs);
}
htab_delete (file->abbrev_offsets);
+ if (file->comp_unit_tree != NULL)
+ splay_tree_delete (file->comp_unit_tree);
free (file->dwarf_line_str_buffer);
free (file->dwarf_str_buffer);
Only in binutils-2.38/bfd: dwarf2.c.orig
Only in binutils-2.38/bfd: dwarf2.c.rej
Only in binutils-2.38: binutils-add-splay-tree-for-info_ptr.patch
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.38/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2022-09-07 10:41:11.992242841 +0200
+++ binutils-2.38/bfd/dwarf2.c 2022-09-07 10:44:29.268266746 +0200
@@ -187,6 +187,9 @@ struct dwarf2_debug_file
/* Hash table to map offsets to decoded abbrevs. */
htab_t abbrev_offsets;
+
+ /* Splay tree to map info_ptr address to compilation units. */
+ splay_tree comp_unit_tree;
};
struct dwarf2_debug

View File

@ -1,447 +0,0 @@
diff -rup binutils.orig/bfd/bfd.c binutils-2.31.1/bfd/bfd.c
--- binutils.orig/bfd/bfd.c 2019-02-18 11:53:32.155652114 +0000
+++ binutils-2.31.1/bfd/bfd.c 2019-02-18 12:03:21.591459682 +0000
@@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd
bfd_put_32 (abfd, sec->size, &echdr->ch_size);
bfd_put_32 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
+ /* bfd_log2 (alignof (Elf32_Chdr)). */
+ bfd_set_section_alignment (abfd, sec, 2);
}
else
{
@@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd
bfd_put_64 (abfd, sec->size, &echdr->ch_size);
bfd_put_64 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
+ /* bfd_log2 (alignof (Elf64_Chdr)). */
+ bfd_set_section_alignment (abfd, sec, 3);
}
}
else
@@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd
order. */
memcpy (contents, "ZLIB", 4);
bfd_putb64 (sec->size, contents + 4);
+ /* No way to keep the original alignment, just use 1 always. */
+ bfd_set_section_alignment (abfd, sec, 0);
}
}
}
@@ -2368,12 +2374,15 @@ bfd_update_compression_header (bfd *abfd
SYNOPSIS
bfd_boolean bfd_check_compression_header
(bfd *abfd, bfd_byte *contents, asection *sec,
- bfd_size_type *uncompressed_size);
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power);
+
DESCRIPTION
Check the compression header at CONTENTS of SEC in ABFD and
- store the uncompressed size in UNCOMPRESSED_SIZE if the
- compression header is valid.
+ store the uncompressed size in UNCOMPRESSED_SIZE and the
+ uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
+ if the compression header is valid.
RETURNS
Return TRUE if the compression header is valid.
@@ -2382,7 +2391,8 @@ RETURNS
bfd_boolean
bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
asection *sec,
- bfd_size_type *uncompressed_size)
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (elf_section_flags (sec) & SHF_COMPRESSED) != 0)
@@ -2404,9 +2414,10 @@ bfd_check_compression_header (bfd *abfd,
chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
}
if (chdr.ch_type == ELFCOMPRESS_ZLIB
- && chdr.ch_addralign == 1U << sec->alignment_power)
+ && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
{
*uncompressed_size = chdr.ch_size;
+ *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);
return TRUE;
}
}
diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.31.1/bfd/bfd-in2.h
--- binutils.orig/bfd/bfd-in2.h 2019-02-18 11:53:32.156652107 +0000
+++ binutils-2.31.1/bfd/bfd-in2.h 2019-02-18 12:00:23.849723903 +0000
@@ -7274,7 +7274,8 @@ void bfd_update_compression_header
bfd_boolean bfd_check_compression_header
(bfd *abfd, bfd_byte *contents, asection *sec,
- bfd_size_type *uncompressed_size);
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power);
int bfd_get_compression_header_size (bfd *abfd, asection *sec);
@@ -7850,7 +7851,8 @@ void bfd_cache_section_contents
bfd_boolean bfd_is_section_compressed_with_header
(bfd *abfd, asection *section,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p);
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_alignment_power_p);
bfd_boolean bfd_is_section_compressed
(bfd *abfd, asection *section);
diff -rup binutils.orig/bfd/compress.c binutils-2.31.1/bfd/compress.c
--- binutils.orig/bfd/compress.c 2019-02-18 11:53:32.153652128 +0000
+++ binutils-2.31.1/bfd/compress.c 2019-02-18 12:11:44.899886376 +0000
@@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd
int zlib_size = 0;
int orig_compression_header_size;
bfd_size_type orig_uncompressed_size;
+ unsigned int orig_uncompressed_alignment_pow;
int header_size = bfd_get_compression_header_size (abfd, NULL);
bfd_boolean compressed
= bfd_is_section_compressed_with_header (abfd, sec,
&orig_compression_header_size,
- &orig_uncompressed_size);
+ &orig_uncompressed_size,
+ &orig_uncompressed_alignment_pow);
/* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
overhead in .zdebug* section. */
@@ -153,6 +155,8 @@ bfd_compress_section_contents (bfd *abfd
return 0;
}
free (uncompressed_buffer);
+ bfd_set_section_alignment (abfd, sec,
+ orig_uncompressed_alignment_pow);
sec->contents = buffer;
sec->compress_status = COMPRESS_SECTION_DONE;
return orig_uncompressed_size;
@@ -364,20 +368,25 @@ SYNOPSIS
bfd_boolean bfd_is_section_compressed_with_header
(bfd *abfd, asection *section,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p);
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_alignment_power_p);
+
DESCRIPTION
Return @code{TRUE} if @var{section} is compressed. Compression
- header size is returned in @var{compression_header_size_p} and
- uncompressed size is returned in @var{uncompressed_size_p}. If
- compression is unsupported, compression header size is returned
- with -1 and uncompressed size is returned with 0.
+ header size is returned in @var{compression_header_size_p},
+ uncompressed size is returned in @var{uncompressed_size_p}
+ and the uncompressed data alignement power is returned in
+ @var{uncompressed_align_pow_p}. If compression is
+ unsupported, compression header size is returned with -1
+ and uncompressed size is returned with 0.
*/
bfd_boolean
bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p)
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_align_pow_p)
{
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
int compression_header_size;
@@ -385,6 +394,8 @@ bfd_is_section_compressed_with_header (b
unsigned int saved = sec->compress_status;
bfd_boolean compressed;
+ *uncompressed_align_pow_p = 0;
+
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
abort ();
@@ -412,7 +423,8 @@ bfd_is_section_compressed_with_header (b
if (compression_header_size != 0)
{
if (!bfd_check_compression_header (abfd, header, sec,
- uncompressed_size_p))
+ uncompressed_size_p,
+ uncompressed_align_pow_p))
compression_header_size = -1;
}
/* Check for the pathalogical case of a debug string section that
@@ -449,9 +461,11 @@ bfd_is_section_compressed (bfd *abfd, se
{
int compression_header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_align_power;
return (bfd_is_section_compressed_with_header (abfd, sec,
&compression_header_size,
- &uncompressed_size)
+ &uncompressed_size,
+ &uncompressed_align_power)
&& compression_header_size >= 0
&& uncompressed_size > 0);
}
@@ -480,6 +494,7 @@ bfd_init_section_decompress_status (bfd
int compression_header_size;
int header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_alignment_power = 0;
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
@@ -508,7 +523,8 @@ bfd_init_section_decompress_status (bfd
uncompressed_size = bfd_getb64 (header + 4);
}
else if (!bfd_check_compression_header (abfd, header, sec,
- &uncompressed_size))
+ &uncompressed_size,
+ &uncompressed_alignment_power))
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -516,6 +532,7 @@ bfd_init_section_decompress_status (bfd
sec->compressed_size = sec->size;
sec->size = uncompressed_size;
+ bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);
sec->compress_status = DECOMPRESS_SECTION_SIZED;
return TRUE;
diff -rup binutils.orig/bfd/elf.c binutils-2.31.1/bfd/elf.c
--- binutils.orig/bfd/elf.c 2019-02-18 11:53:32.161652071 +0000
+++ binutils-2.31.1/bfd/elf.c 2019-02-18 12:08:52.135108638 +0000
@@ -1177,10 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *ab
enum { nothing, compress, decompress } action = nothing;
int compression_header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_align_power;
bfd_boolean compressed
= bfd_is_section_compressed_with_header (abfd, newsect,
&compression_header_size,
- &uncompressed_size);
+ &uncompressed_size,
+ &uncompressed_align_power);
if (compressed)
{
diff -rup binutils.orig/binutils/readelf.c binutils-2.31.1/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2019-02-18 11:53:32.947646480 +0000
+++ binutils-2.31.1/binutils/readelf.c 2019-02-18 12:10:13.142535034 +0000
@@ -13366,12 +13366,6 @@ dump_section_as_strings (Elf_Internal_Sh
printable_section_name (filedata, section), chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != section->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- printable_section_name (filedata, section));
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
new_size -= compression_header_size;
@@ -13513,12 +13507,6 @@ dump_section_as_bytes (Elf_Internal_Shdr
printable_section_name (filedata, section), chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != section->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- printable_section_name (filedata, section));
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
new_size -= compression_header_size;
@@ -13688,12 +13676,6 @@ load_specific_debug_section (enum dwarf_
section->name, chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != sec->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- section->name);
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
size -= compression_header_size;
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 11:53:32.908646758 +0000
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 12:10:40.884338917 +0000
@@ -1,3 +1,3 @@
#...
- +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
+ +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8)
#pass
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 11:53:32.905646779 +0000
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 12:11:13.476108521 +0000
@@ -1,6 +1,6 @@
#...
+\[[ 0-9]+\] .debug_info
- +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
+ +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)
+\[0+800\]: COMPRESSED
+ZLIB, 0+9d, 1
#pass
diff -rup binutils.orig/gold/merge.cc binutils-2.31.1/gold/merge.cc
--- binutils.orig/gold/merge.cc 2019-02-18 11:53:32.210651723 +0000
+++ binutils-2.31.1/gold/merge.cc 2019-02-18 12:12:59.027362334 +0000
@@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_i
{
section_size_type sec_len;
bool is_new;
+ uint64_t addralign = this->addralign();
const unsigned char* pdata = object->decompressed_section_contents(shndx,
&sec_len,
- &is_new);
+ &is_new,
+ &addralign);
const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
const Char_type* pend = p + sec_len / sizeof(Char_type);
@@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_i
// aligned, so each string within the section must retain the same
// modulo.
uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata)
- & (this->addralign() - 1));
+ & (addralign - 1));
bool has_misaligned_strings = false;
while (p < pend)
@@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_i
// Within merge input section each string must be aligned.
if (len != 0
- && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
+ && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1))
!= init_align_modulo))
has_misaligned_strings = true;
diff -rup binutils.orig/gold/object.cc binutils-2.31.1/gold/object.cc
--- binutils.orig/gold/object.cc 2019-02-18 11:53:32.208651737 +0000
+++ binutils-2.31.1/gold/object.cc 2019-02-18 12:16:35.938828914 +0000
@@ -751,11 +751,13 @@ build_compressed_section_map(
const unsigned char* contents =
obj->section_contents(i, &len, false);
uint64_t uncompressed_size;
+ Compressed_section_info info;
if (is_zcompressed)
{
// Skip over the ".zdebug" prefix.
name += 7;
uncompressed_size = get_uncompressed_size(contents, len);
+ info.addralign = shdr.get_sh_addralign();
}
else
{
@@ -763,8 +765,8 @@ build_compressed_section_map(
name += 6;
elfcpp::Chdr<size, big_endian> chdr(contents);
uncompressed_size = chdr.get_ch_size();
+ info.addralign = chdr.get_ch_addralign();
}
- Compressed_section_info info;
info.size = convert_to_section_size_type(uncompressed_size);
info.flag = shdr.get_sh_flags();
info.contents = NULL;
@@ -3060,7 +3062,8 @@ const unsigned char*
Object::decompressed_section_contents(
unsigned int shndx,
section_size_type* plen,
- bool* is_new)
+ bool* is_new,
+ uint64_t* palign)
{
section_size_type buffer_size;
const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,
@@ -3087,6 +3090,8 @@ Object::decompressed_section_contents(
{
*plen = uncompressed_size;
*is_new = false;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return p->second.contents;
}
@@ -3108,6 +3113,8 @@ Object::decompressed_section_contents(
// once in this pass.
*plen = uncompressed_size;
*is_new = true;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return uncompressed_data;
}
diff -rup binutils.orig/gold/object.h binutils-2.31.1/gold/object.h
--- binutils.orig/gold/object.h 2019-02-18 11:53:32.210651723 +0000
+++ binutils-2.31.1/gold/object.h 2019-02-18 12:17:50.625300926 +0000
@@ -373,6 +373,7 @@ struct Compressed_section_info
{
section_size_type size;
elfcpp::Elf_Xword flag;
+ uint64_t addralign;
const unsigned char* contents;
};
typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;
@@ -808,7 +809,8 @@ class Object
bool
section_is_compressed(unsigned int shndx,
- section_size_type* uncompressed_size) const
+ section_size_type* uncompressed_size,
+ elfcpp::Elf_Xword* palign = NULL) const
{
if (this->compressed_sections_ == NULL)
return false;
@@ -818,6 +820,8 @@ class Object
{
if (uncompressed_size != NULL)
*uncompressed_size = p->second.size;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return true;
}
return false;
@@ -828,7 +832,7 @@ class Object
// by the caller.
const unsigned char*
decompressed_section_contents(unsigned int shndx, section_size_type* plen,
- bool* is_cached);
+ bool* is_cached, uint64_t* palign = NULL);
// Discard any buffers of decompressed sections. This is done
// at the end of the Add_symbols task.
diff -rup binutils.orig/gold/output.cc binutils-2.31.1/gold/output.cc
--- binutils.orig/gold/output.cc 2019-02-18 11:53:32.209651729 +0000
+++ binutils-2.31.1/gold/output.cc 2019-02-18 12:18:39.729953797 +0000
@@ -2448,7 +2448,14 @@ Output_section::add_input_section(Layout
unsigned int reloc_shndx,
bool have_sections_script)
{
+ section_size_type input_section_size = shdr.get_sh_size();
+ section_size_type uncompressed_size;
elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
+
+ if (object->section_is_compressed(shndx, &uncompressed_size,
+ &addralign))
+ input_section_size = uncompressed_size;
+
if ((addralign & (addralign - 1)) != 0)
{
object->error(_("invalid alignment %lu for section \"%s\""),
@@ -2498,11 +2505,6 @@ Output_section::add_input_section(Layout
}
}
- section_size_type input_section_size = shdr.get_sh_size();
- section_size_type uncompressed_size;
- if (object->section_is_compressed(shndx, &uncompressed_size))
- input_section_size = uncompressed_size;
-
off_t offset_in_section;
if (this->has_fixed_layout())

View File

@ -1,68 +0,0 @@
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100
+++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100
@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int);
static void obj_elf_tls_common (int);
static void obj_elf_lcomm (int);
static void obj_elf_struct (int);
+static void obj_elf_attach_to_group (int);
static const pseudo_typeS elf_pseudo_table[] =
{
+ {"attach_to_group", obj_elf_attach_to_group, 0},
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
@@ -1007,6 +1009,27 @@ obj_elf_section_name (void)
return name;
}
+static void
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
+{
+ const char * gname = obj_elf_section_name ();
+
+ if (gname == NULL)
+ {
+ as_warn ("group name not parseable");
+ return;
+ }
+
+ if (elf_group_name (now_seg))
+ {
+ as_warn ("already has a group");
+ return;
+ }
+
+ elf_group_name (now_seg) = xstrdup (gname);
+ elf_section_flags (now_seg) |= SHF_GROUP;
+}
+
void
obj_elf_section (int push)
{
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
--- binutils.orig/gas/doc/as.texi 2018-09-24 17:50:06.984172788 +0100
+++ binutils-2.30/gas/doc/as.texi 2018-09-25 15:19:43.557748972 +0100
@@ -4407,6 +4407,7 @@ Some machine configurations provide addi
* Altmacro:: @code{.altmacro}
* Ascii:: @code{.ascii "@var{string}"}@dots{}
* Asciz:: @code{.asciz "@var{string}"}@dots{}
+* Attach_to_group:: @code{.attach_to_group @var{name}}
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
* Byte:: @code{.byte @var{expressions}}
@@ -4703,6 +4704,12 @@ trailing zero byte) into consecutive add
@code{.asciz} is just like @code{.ascii}, but each string is followed by
a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
+@node Attach_to_group
+@section @code{.attach_to_group @var{name}}
+Attaches the current section to the named group. This is like declaring
+the section with the @code{G} attribute, but can be done after the section
+has been created.
+
@node Balign
@section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}}

View File

@ -0,0 +1,11 @@
--- binutils.orig/config/override.m4 2021-08-31 14:20:17.275574804 +0100
+++ binutils-2.37/config/override.m4 2021-08-31 14:36:37.793954247 +0100
@@ -41,7 +41,7 @@ dnl Or for updating the whole tree at on
AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
m4_defn([m4_PACKAGE_VERSION]), [],
- [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
+ [])
])
m4_define([AC_INIT], m4_defn([AC_INIT])[
_GCC_AUTOCONF_VERSION_CHECK

View File

@ -0,0 +1,258 @@
diff -rup binutils.orig/binutils/NEWS binutils-2.38/binutils/NEWS
--- binutils.orig/binutils/NEWS 2022-03-10 09:13:18.284641005 +0000
+++ binutils-2.38/binutils/NEWS 2022-03-10 09:13:26.007586352 +0000
@@ -1,5 +1,8 @@
-*- text -*-
+* Add an option to objdump and readelf to prevent attempts to access debuginfod
+ servers when following links.
+
Changes in 2.38:
* elfedit: Add --output-abiversion option to update ABIVERSION.
diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.38/binutils/doc/binutils.texi
--- binutils.orig/binutils/doc/binutils.texi 2022-03-10 09:13:18.285640998 +0000
+++ binutils-2.38/binutils/doc/binutils.texi 2022-03-10 09:13:26.009586338 +0000
@@ -2246,6 +2246,8 @@ objdump [@option{-a}|@option{--archive-h
@option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
[@option{-WK}|@option{--dwarf=follow-links}]
[@option{-WN}|@option{--dwarf=no-follow-links}]
+ [@option{-wD}|@option{--dwarf=use-debuginfod}]
+ [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}]
[@option{-L}|@option{--process-links}]
[@option{--ctf=}@var{section}]
[@option{-G}|@option{--stabs}]
@@ -4879,6 +4881,8 @@ readelf [@option{-a}|@option{--all}]
@option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
[@option{-wK}|@option{--debug-dump=follow-links}]
[@option{-wN}|@option{--debug-dump=no-follow-links}]
+ [@option{-wD}|@option{--debug-dump=use-debuginfod}]
+ [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}]
[@option{-P}|@option{--process-links}]
[@option{--dwarf-depth=@var{n}}]
[@option{--dwarf-start=@var{n}}]
@@ -5504,7 +5508,8 @@ deduced from the input file
@cindex separate debug files
debuginfod is a web service that indexes ELF/DWARF debugging resources
-by build-id and serves them over HTTP.
+by build-id and serves them over HTTP. For more information see:
+@emph{https://sourceware.org/elfutils/Debuginfod.html}
Binutils can be built with the debuginfod client library
@code{libdebuginfod} using the @option{--with-debuginfod} configure option.
@@ -5516,6 +5521,10 @@ separate debug files when the files are
debuginfod is packaged with elfutils, starting with version 0.178.
You can get the latest version from `https://sourceware.org/elfutils/'.
+The DWARF info dumping tools (@command{readelf} and @command{objdump})
+have options to control when they should access the debuginfod
+servers. By default this access is enabled.
+
@node Reporting Bugs
@chapter Reporting Bugs
@cindex bugs
Only in binutils-2.38/binutils/doc: binutils.texi.orig
diff -rup binutils.orig/binutils/doc/debug.options.texi binutils-2.38/binutils/doc/debug.options.texi
--- binutils.orig/binutils/doc/debug.options.texi 2022-03-10 09:13:18.285640998 +0000
+++ binutils-2.38/binutils/doc/debug.options.texi 2022-03-10 09:13:26.009586338 +0000
@@ -68,10 +68,27 @@ chosen when configuring the binutils via
@option{--enable-follow-debug-links=no} options. If these are not
used then the default is to enable the following of debug links.
+Note - if support for the debuginfod protocol was enabled when the
+binutils were built then this option will also include an attempt to
+contact any debuginfod servers mentioned in the @var{DEBUGINFOD_URLS}
+environment variable. This could take some time to resolve. This
+behaviour can be disabled via the @option{=do-not-use-debuginfod} debug
+option.
+
@item N
@itemx =no-follow-links
Disables the following of links to separate debug info files.
+@item D
+@itemx =use-debuginfod
+Enables contacting debuginfod servers if there is a need to follow
+debug links. This is the default behaviour.
+
+@item E
+@itemx =do-not-use-debuginfod
+Disables contacting debuginfod servers when there is a need to follow
+debug links.
+
@item l
@itemx =rawline
Displays the contents of the @samp{.debug_line} section in a raw
diff -rup binutils.orig/binutils/dwarf.c binutils-2.38/binutils/dwarf.c
--- binutils.orig/binutils/dwarf.c 2022-03-10 09:13:18.283641012 +0000
+++ binutils-2.38/binutils/dwarf.c 2022-03-10 09:13:26.010586331 +0000
@@ -109,6 +109,9 @@ int do_debug_cu_index;
int do_wide;
int do_debug_links;
int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS;
+#ifdef HAVE_LIBDEBUGINFOD
+int use_debuginfod = 1;
+#endif
bool do_checks;
int dwarf_cutoff_level = -1;
@@ -11038,7 +11041,7 @@ debuginfod_fetch_separate_debug_info (st
return false;
}
-#endif
+#endif /* HAVE_LIBDEBUGINFOD */
static void *
load_separate_debug_info (const char * main_filename,
@@ -11157,9 +11160,10 @@ load_separate_debug_info (const char *
{
char * tmp_filename;
- if (debuginfod_fetch_separate_debug_info (xlink,
- & tmp_filename,
- file))
+ if (use_debuginfod
+ && debuginfod_fetch_separate_debug_info (xlink,
+ & tmp_filename,
+ file))
{
/* File successfully downloaded from server, replace
debug_filename with the file's path. */
@@ -11207,13 +11211,15 @@ load_separate_debug_info (const char *
warn (_("tried: %s\n"), debug_filename);
#if HAVE_LIBDEBUGINFOD
- {
- char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
- if (urls == NULL)
- urls = "";
+ if (use_debuginfod)
+ {
+ char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
- warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
- }
+ if (urls == NULL)
+ urls = "";
+
+ warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
+ }
#endif
}
@@ -11707,6 +11713,9 @@ dwarf_select_sections_by_names (const ch
{ "aranges", & do_debug_aranges, 1 },
{ "cu_index", & do_debug_cu_index, 1 },
{ "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
+#ifdef HAVE_LIBDEBUGINFOD
+ { "do-not-use-debuginfod", & use_debuginfod, 0 },
+#endif
{ "follow-links", & do_follow_links, 1 },
{ "frames", & do_debug_frames, 1 },
{ "frames-interp", & do_debug_frames_interp, 1 },
@@ -11730,6 +11739,9 @@ dwarf_select_sections_by_names (const ch
{ "trace_abbrev", & do_trace_abbrevs, 1 },
{ "trace_aranges", & do_trace_aranges, 1 },
{ "trace_info", & do_trace_info, 1 },
+#ifdef HAVE_LIBDEBUGINFOD
+ { "use-debuginfod", & use_debuginfod, 1 },
+#endif
{ NULL, NULL, 0 }
};
@@ -11783,6 +11795,10 @@ dwarf_select_sections_by_letters (const
case 'A': do_debug_addr = 1; break;
case 'a': do_debug_abbrevs = 1; break;
case 'c': do_debug_cu_index = 1; break;
+#ifdef HAVE_LIBDEBUGINFOD
+ case 'D': use_debuginfod = 1; break;
+ case 'E': use_debuginfod = 0; break;
+#endif
case 'F': do_debug_frames_interp = 1; /* Fall through. */
case 'f': do_debug_frames = 1; break;
case 'g': do_gdb_index = 1; break;
diff -rup binutils.orig/binutils/dwarf.h binutils-2.38/binutils/dwarf.h
--- binutils.orig/binutils/dwarf.h 2022-03-10 09:13:18.284641005 +0000
+++ binutils-2.38/binutils/dwarf.h 2022-03-10 09:13:26.010586331 +0000
@@ -224,6 +224,9 @@ extern int do_debug_cu_index;
extern int do_wide;
extern int do_debug_links;
extern int do_follow_links;
+#ifdef HAVE_LIBDEBUGINFOD
+extern int use_debuginfod;
+#endif
extern bool do_checks;
extern int dwarf_cutoff_level;
diff -rup binutils.orig/binutils/objdump.c binutils-2.38/binutils/objdump.c
--- binutils.orig/binutils/objdump.c 2022-03-10 09:13:18.283641012 +0000
+++ binutils-2.38/binutils/objdump.c 2022-03-10 09:13:26.011586324 +0000
@@ -281,6 +281,14 @@ usage (FILE *stream, int status)
Do not follow links to separate debug info files\n\
(default)\n"));
#endif
+#if HAVE_LIBDEBUGINFOD
+ fprintf (stream, _("\
+ -WD --dwarf=use-debuginfod\n\
+ When following links, also query debuginfod servers (default)\n"));
+ fprintf (stream, _("\
+ -WE --dwarf=do-not-use-debuginfod\n\
+ When following links, do not query debuginfod servers\n"));
+#endif
fprintf (stream, _("\
-L, --process-links Display the contents of non-debug sections in\n\
separate debuginfo files. (Implies -WK)\n"));
Only in binutils-2.38/binutils/: objdump.c.orig
diff -rup binutils.orig/binutils/readelf.c binutils-2.38/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2022-03-10 09:13:18.302640878 +0000
+++ binutils-2.38/binutils/readelf.c 2022-03-10 09:13:26.012586316 +0000
@@ -5126,6 +5126,14 @@ usage (FILE * stream)
Do not follow links to separate debug info files\n\
(default)\n"));
#endif
+#if HAVE_LIBDEBUGINFOD
+ fprintf (stream, _("\
+ -wD --debug-dump=use-debuginfod\n\
+ When following links, also query debuginfod servers (default)\n"));
+ fprintf (stream, _("\
+ -wE --debug-dump=do-not-use-debuginfod\n\
+ When following links, do not query debuginfod servers\n"));
+#endif
fprintf (stream, _("\
--dwarf-depth=N Do not display DIEs at depth N or greater\n"));
fprintf (stream, _("\
Only in binutils-2.38/binutils/: readelf.c.orig
diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp
--- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:18.291640956 +0000
+++ binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:26.012586316 +0000
@@ -185,8 +185,14 @@ proc test_fetch_debugaltlink { prog prog
}
if { [regexp ".*DEBUGINFOD.*" $conf_objdump] } {
- test_fetch_debuglink $OBJDUMP "-W"
+ test_fetch_debuglink $OBJDUMP "-W -WD"
test_fetch_debugaltlink $OBJDUMP "-Wk"
+
+ set test "disabling debuginfod access"
+ setup_xfail *-*-*
+ test_fetch_debuglink $OBJDUMP "-W -WE"
+ set test "debuginfod"
+
} else {
untested "$test (objdump not configured with debuginfod)"
}
@@ -194,6 +200,12 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } {
test_fetch_debuglink $READELF "-w"
test_fetch_debugaltlink $READELF "-wk"
+
+ set test "disabling debuginfod access"
+ setup_xfail *-*-*
+ test_fetch_debuglink $READELF "-w -wE"
+ set test "debuginfod"
+
} else {
untested "$test (readelf not configured with debuginfod)"
}

View File

@ -5,8 +5,8 @@ diff -rup binutils.orig/bfd/Makefile.am binutils-2.32/bfd/Makefile.am
bfdincludedir = @bfdincludedir@
bfdlib_LTLIBRARIES = libbfd.la
bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
- bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
+ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
+ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
else !INSTALL_LIBBFD
# Empty these so that the respective installation directories will not be created.
bfdlibdir =
@ -16,7 +16,7 @@ diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in
@@ -249,7 +249,7 @@ am__can_run_installinfo = \
esac
am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bfd_stdint.h \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
+ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
HEADERS = $(bfdinclude_HEADERS)
@ -26,8 +26,8 @@ diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in
@INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2)
@INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
-@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h \
+@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \
-@INSTALL_LIBBFD_TRUE@ $(INCDIR)/diagnostics.h \
+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2)
@INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la

View File

@ -1,11 +1,9 @@
--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000
+++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000
@@ -19019,75 +19019,85 @@ process_file (char * file_name)
Filedata * filedata = NULL;
--- binutils.orig/binutils/readelf.c 2021-07-19 12:39:14.206556025 +0100
+++ binutils-2.37/binutils/readelf.c 2021-07-19 12:44:37.712728732 +0100
@@ -21873,45 +21873,52 @@ process_file (char * file_name)
struct stat statbuf;
char armag[SARMAG];
- bfd_boolean ret = TRUE;
+ bfd_boolean ret = FALSE;
bool ret = true;
+ char * name;
+ char * saved_program_name;
+
@ -25,7 +23,7 @@
else
- error (_("Could not locate '%s'. System error message: %s\n"),
- file_name, strerror (errno));
- return FALSE;
- return false;
+ error (_("Could not locate file. System error message: %s\n"),
+ strerror (errno));
+ goto done;
@ -34,7 +32,7 @@
if (! S_ISREG (statbuf.st_mode))
{
- error (_("'%s' is not an ordinary file\n"), file_name);
- return FALSE;
- return false;
+ error (_("Not an ordinary file\n"));
+ goto done;
}
@ -43,7 +41,7 @@
if (filedata == NULL)
{
error (_("Out of memory allocating file data structure\n"));
- return FALSE;
- return false;
+ goto done;
}
@ -53,7 +51,7 @@
{
- error (_("Input file '%s' is not readable.\n"), file_name);
- free (filedata);
- return FALSE;
- return false;
+ error (_("Not readable\n"));
+ goto done;
}
@ -63,62 +61,74 @@
- error (_("%s: Failed to read file's magic number\n"), file_name);
- fclose (filedata->handle);
- free (filedata);
- return FALSE;
- }
-
- filedata->file_size = (bfd_size_type) statbuf.st_size;
-
- if (memcmp (armag, ARMAG, SARMAG) == 0)
- {
- if (! process_archive (filedata, FALSE))
- ret = FALSE;
- }
- else if (memcmp (armag, ARMAGT, SARMAG) == 0)
- {
- if ( ! process_archive (filedata, TRUE))
- ret = FALSE;
- return false;
+ error (_("Failed to read file's magic number\n"));
+ goto done;
}
filedata->file_size = (bfd_size_type) statbuf.st_size;
@@ -21919,33 +21926,39 @@ process_file (char * file_name)
if (memcmp (armag, ARMAG, SARMAG) == 0)
{
- if (! process_archive (filedata, false))
- ret = false;
+ if (process_archive (filedata, false))
+ ret = true;
}
else if (memcmp (armag, ARMAGT, SARMAG) == 0)
{
- if ( ! process_archive (filedata, true))
- ret = false;
+ if (process_archive (filedata, true))
+ ret = true;
}
else
{
- if (do_archive_index)
if (do_archive_index && !check_all)
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
- file_name);
+ filedata->file_size = (bfd_size_type) statbuf.st_size;
+ error (_("Not an archive so its index cannot be displayed.\n"));
rewind (filedata->handle);
filedata->archive_file_size = filedata->archive_file_offset = 0;
- rewind (filedata->handle);
- archive_file_size = archive_file_offset = 0;
-
- if (! process_object (filedata))
- ret = FALSE;
+ if (memcmp (armag, ARMAG, SARMAG) == 0)
+ {
+ if (process_archive (filedata, FALSE))
+ ret = TRUE;
+ }
+ else if (memcmp (armag, ARMAGT, SARMAG) == 0)
+ {
+ if (process_archive (filedata, TRUE))
+ ret = TRUE;
+ }
+ else
+ {
+ if (do_archive_index)
+ error (_("Not an archive so its index cannot be displayed.\n"));
+
+ rewind (filedata->handle);
+ archive_file_size = archive_file_offset = 0;
+
+ if (process_object (filedata))
+ ret = TRUE;
+ }
- ret = false;
+ if (process_object (filedata))
+ ret = true;
}
fclose (filedata->handle);
- fclose (filedata->handle);
- free (filedata->section_headers);
- free (filedata->program_headers);
- free (filedata->string_table);
- free (filedata->dump.dump_sects);
- free (filedata);
+ done:
free (filedata);
+ if (filedata)
+ {
+ if (filedata->handle != NULL)
+ fclose (filedata->handle);
+ free (filedata->section_headers);
+ free (filedata->program_headers);
+ free (filedata->string_table);
+ free (filedata->dump.dump_sects);
+ free (filedata);
+ }
+ free (program_name);
+ program_name = saved_program_name;
return ret;
}
free (ba_cache.strtab);
ba_cache.strtab = NULL;
--- binutils.orig/binutils/readelf.c 2021-08-10 10:15:22.088016072 +0100
+++ binutils-2.37/binutils/readelf.c 2021-08-10 10:15:55.567907891 +0100
@@ -21884,7 +21884,7 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
- bool ret = true;
+ bool ret = false;
char * name;
char * saved_program_name;

View File

@ -223,35 +223,6 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp binutils-2.32/ld/test
proc srec_off { l } {
if [string match "S1*" $l] {
return 8
diff -rup binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:33:22.030626874 +0000
+++ binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:57:34.295106041 +0000
@@ -1275,25 +1275,6 @@ if { [isnative] && [which $CC] != 0 } {
"$NOPIE_CFLAGS" \
] \
]
- } else {
- run_cc_link_tests [list \
- [list \
- "Build pr22001-1b" \
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { pr22001-1c.c } \
- {{error_output "pr22001-1b.err"}} \
- "pr22001-1b" \
- ] \
- [list \
- "Build pr21997-1b" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { pr21997-1c.c } \
- {{error_output "pr21997-1b.err"}} \
- "pr21997-1b" \
- ] \
- ]
}
run_ld_link_exec_tests [list \
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:10:59.038709514 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:13:53.532300721 +0000
@ -326,3 +297,34 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-elfvers/vers24.rd binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd
--- binutils.orig/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 09:45:44.013108697 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 12:06:17.287425232 +0100
@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e
# And ensure the dynamic symbol table contains at least x@VERS.0
# and foo@@VERS.0 symbols
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
Symbol table '.symtab' contains [0-9]+ entries:
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 09:45:44.023108605 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 11:18:53.997202105 +0100
@@ -118,6 +118,12 @@ if { $can_compile && !$failed_compile }
}
}
+# I do not know why, but the underscore prefix test is going
+# wrong on ppc64le targets. So override it here.
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
+ set _ ""
+}
+
set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"

View File

@ -0,0 +1,91 @@
diff -rup binutils.orig/gas/symbols.c binutils-2.38/gas/symbols.c
--- binutils.orig/gas/symbols.c 2022-03-09 11:43:34.706610216 +0000
+++ binutils-2.38/gas/symbols.c 2022-03-09 11:45:57.540686508 +0000
@@ -61,8 +61,10 @@ struct symbol_flags
/* Whether the symbol can be re-defined. */
unsigned int volatil : 1;
- /* Whether the symbol is a forward reference. */
+ /* Whether the symbol is a forward reference, and whether such has
+ been determined. */
unsigned int forward_ref : 1;
+ unsigned int forward_resolved : 1;
/* This is set if the symbol is defined in an MRI common section.
We handle such sections as single common symbols, so symbols
@@ -202,7 +204,7 @@ static void *
symbol_entry_find (htab_t table, const char *name)
{
hashval_t hash = htab_hash_string (name);
- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
hash, name, 0, 0, 0 } };
return htab_find_with_hash (table, &needle, hash);
}
@@ -784,7 +786,9 @@ symbol_clone (symbolS *orgsymP, int repl
symbolS *
symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
{
- if (symbolP && !symbolP->flags.local_symbol)
+ if (symbolP
+ && !symbolP->flags.local_symbol
+ && !symbolP->flags.forward_resolved)
{
symbolS *orig_add_symbol = symbolP->x->value.X_add_symbol;
symbolS *orig_op_symbol = symbolP->x->value.X_op_symbol;
@@ -837,6 +841,7 @@ symbol_clone_if_forward_ref (symbolS *sy
symbolP->x->value.X_add_symbol = add_symbol;
symbolP->x->value.X_op_symbol = op_symbol;
+ symbolP->flags.forward_resolved = 1;
}
return symbolP;
diff -rup binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d
--- binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:43:34.487611632 +0000
+++ binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:48:03.298873228 +0000
@@ -2,9 +2,8 @@
#readelf: -x.rodata -wL
#name: DWARF2 18
# The am33 cr16 crx ft32 mn10 msp430 nds32 and rl78 targets do not evaluate the subtraction of symbols at assembly time.
-# The mep targets turns some view computations into complex relocations.
# The riscv targets do not support the subtraction of symbols.
-#xfail: am3*-* cr16-* crx-* ft32*-* mep-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
+#xfail: am3*-* cr16-* crx-* ft32*-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
Hex dump of section '\.rodata':
0x00000000 0100 *.*
--- binutils.orig/gas/dwarf2dbg.c 2022-03-10 09:13:18.516639363 +0000
+++ binutils-2.38/gas/dwarf2dbg.c 2022-03-10 12:45:25.191933733 +0000
@@ -402,18 +402,27 @@ set_or_check_view (struct line_entry *e,
if (viewx.X_op != O_constant || viewx.X_add_number)
{
expressionS incv;
+ expressionS *p_view;
if (!p->loc.u.view)
- {
- p->loc.u.view = symbol_temp_make ();
- gas_assert (!S_IS_DEFINED (p->loc.u.view));
- }
+ p->loc.u.view = symbol_temp_make ();
memset (&incv, 0, sizeof (incv));
incv.X_unsigned = 1;
incv.X_op = O_symbol;
incv.X_add_symbol = p->loc.u.view;
incv.X_add_number = 1;
+ p_view = symbol_get_value_expression (p->loc.u.view);
+ if (p_view->X_op == O_constant || p_view->X_op == O_symbol)
+ {
+ /* If we can, constant fold increments so that a chain of
+ expressions v + 1 + 1 ... + 1 is not created.
+ resolve_expression isn't ideal for this purpose. The
+ base v might not be resolvable until later. */
+ incv.X_op = p_view->X_op;
+ incv.X_add_symbol = p_view->X_add_symbol;
+ incv.X_add_number = p_view->X_add_number + 1;
+ }
if (viewx.X_op == O_constant)
{

180
binutils-gcc-10-fixes.patch Normal file
View File

@ -0,0 +1,180 @@
diff -rup binutils.orig/gold/gdb-index.cc binutils-2.34.0/gold/gdb-index.cc
--- binutils.orig/gold/gdb-index.cc 2020-07-24 09:12:29.241306445 +0100
+++ binutils-2.34.0/gold/gdb-index.cc 2020-07-24 09:15:48.332095898 +0100
@@ -817,7 +817,7 @@ Gdb_index_info_reader::get_qualified_nam
void
Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die)
{
- unsigned int shndx;
+ unsigned int shndx = 0;
unsigned int shndx2;
off_t ranges_offset = die->ref_attribute(elfcpp::DW_AT_ranges, &shndx);
diff -rup binutils.orig/gold/layout.cc binutils-2.34.0/gold/layout.cc
--- binutils.orig/gold/layout.cc 2020-07-24 09:12:29.243306433 +0100
+++ binutils-2.34.0/gold/layout.cc 2020-07-24 09:15:11.464320064 +0100
@@ -1986,7 +1986,7 @@ Layout::attach_allocated_section_to_segm
seg_flags |= os->extra_segment_flags();
// Check for --section-start.
- uint64_t addr;
+ uint64_t addr = 0;
bool is_address_set = parameters->options().section_start(os->name(), &addr);
// In general the only thing we really care about for PT_LOAD
diff -rup binutils.orig/binutils/dlltool.c binutils-2.34.0/binutils/dlltool.c
--- binutils.orig/binutils/dlltool.c 2020-07-24 09:12:28.974308069 +0100
+++ binutils-2.34.0/binutils/dlltool.c 2020-07-24 12:09:37.527121295 +0100
@@ -1305,7 +1305,7 @@ run (const char *what, char *args)
int pid, wait_status;
int i;
const char **argv;
- char *errmsg_fmt, *errmsg_arg;
+ char *errmsg_fmt = "", *errmsg_arg = "";
char *temp_base = choose_temp_base ();
inform (_("run: %s %s"), what, args);
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 09:12:32.368287432 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:14:19.842360634 +0100
@@ -28416,9 +28416,12 @@ md_apply_fix (fixS * fixP,
perform relaxation. */
if (value == -2)
{
- newval = md_chars_to_number (buf, THUMB_SIZE);
- newval = 0xbf00; /* NOP encoding T1 */
- md_number_to_chars (buf, newval, THUMB_SIZE);
+ if (fixP->fx_done || !seg->use_rela_p)
+ {
+ newval = md_chars_to_number (buf, THUMB_SIZE);
+ newval = 0xbf00; /* NOP encoding T1 */
+ md_number_to_chars (buf, newval, THUMB_SIZE);
+ }
}
else
{
@@ -28631,17 +28634,14 @@ md_apply_fix (fixS * fixP,
case BFD_RELOC_ARM_GOTFUNCDESC:
case BFD_RELOC_ARM_GOTOFFFUNCDESC:
case BFD_RELOC_ARM_FUNCDESC:
- if (arm_fdpic)
- {
- if (fixP->fx_done || !seg->use_rela_p)
- md_number_to_chars (buf, 0, 4);
- }
- else
+ if (!arm_fdpic)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Relocation supported only in FDPIC mode"));
- }
- break;
+ break;
+ }
+ value = 0;
+ /* Fall through. */
#endif
case BFD_RELOC_RVA:
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 12:16:02.099719884 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:34:17.690858328 +0100
@@ -28641,7 +28641,7 @@ md_apply_fix (fixS * fixP,
break;
}
value = 0;
- /* Fall through. */
+ goto fred;
#endif
case BFD_RELOC_RVA:
@@ -28653,6 +28653,7 @@ md_apply_fix (fixS * fixP,
#ifdef TE_PE
case BFD_RELOC_32_SECREL:
#endif
+ fred:
if (fixP->fx_done || !seg->use_rela_p)
#ifdef TE_WINCE
/* For WinCE we only do this for pcrel fixups. */
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 13:28:26.926553452 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 13:31:57.835215763 +0100
@@ -28416,12 +28416,8 @@ md_apply_fix (fixS * fixP,
perform relaxation. */
if (value == -2)
{
- if (fixP->fx_done || !seg->use_rela_p)
- {
- newval = md_chars_to_number (buf, THUMB_SIZE);
- newval = 0xbf00; /* NOP encoding T1 */
- md_number_to_chars (buf, newval, THUMB_SIZE);
- }
+ newval = 0xbf00; /* NOP encoding T1 */
+ goto jim;
}
else
{
@@ -28432,6 +28428,7 @@ md_apply_fix (fixS * fixP,
{
newval = md_chars_to_number (buf, THUMB_SIZE);
newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3);
+ jim:
md_number_to_chars (buf, newval, THUMB_SIZE);
}
}
diff -rup binutils.orig/binutils/mclex.c binutils-2.34.0/binutils/mclex.c
--- binutils.orig/binutils/mclex.c 2020-07-24 13:28:26.297557441 +0100
+++ binutils-2.34.0/binutils/mclex.c 2020-07-24 14:46:53.587940149 +0100
@@ -207,7 +207,7 @@ enum_severity (int e)
static void
mc_add_keyword_ascii (const char *sz, int rid, const char *grp, rc_uint_type nv, const char *sv)
{
- unichar *usz, *usv = NULL;
+ unichar *usz = NULL, *usv = NULL;
rc_uint_type usz_len;
unicode_from_codepage (&usz_len, &usz, sz, CP_ACP);
diff -rup binutils.orig/binutils/windmc.c binutils-2.34.0/binutils/windmc.c
--- binutils.orig/binutils/windmc.c 2020-07-24 13:28:26.279557556 +0100
+++ binutils-2.34.0/binutils/windmc.c 2020-07-24 14:48:05.460477478 +0100
@@ -338,7 +338,7 @@ mc_add_node_lang (mc_node *root, const m
static char *
convert_unicode_to_ACP (const unichar *usz)
{
- char *s;
+ char *s = NULL;
rc_uint_type l;
if (! usz)
@@ -607,10 +607,10 @@ mc_generate_bin_item (mc_node_lang *n, r
else
{
rc_uint_type txt_len, l;
- char *cvt_txt;
+ char *cvt_txt = NULL;
codepage_from_unicode( &l, n->message, &cvt_txt, n->lang->lang_info.wincp);
- if (! cvt_txt)
+ if (cvt_txt == NULL)
fatal ("Failed to convert message to language codepage.\n");
txt_len = strlen (cvt_txt);
if (mcset_automatic_null_termination && txt_len > 0)
@@ -1107,7 +1107,7 @@ main (int argc, char **argv)
/* Load the input file and do code page transformations to UTF16. */
{
- unichar *u;
+ unichar *u = NULL;
rc_uint_type ul;
char *buff;
bfd_size_type flen;
--- binutils.orig/binutils/srconv.c 2020-07-24 15:37:25.847459208 +0100
+++ binutils-2.34.0/binutils/srconv.c 2020-07-24 15:39:12.853773423 +0100
@@ -316,6 +316,7 @@ wr_hd (struct coff_ofile *p)
struct IT_hd hd;
hd.spare1 = 0;
+ hd.spare2 = 0;
if (bfd_get_file_flags (abfd) & EXEC_P)
hd.mt = MTYPE_ABS_LM;
else

View File

@ -0,0 +1,193 @@
diff --git a/gold/i386.cc b/gold/i386.cc
index bf209fe9a86..31161ff091c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -360,7 +360,11 @@ class Target_i386 : public Sized_target<32, false>
got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL),
got_tlsdesc_(NULL), global_offset_table_(NULL), rel_dyn_(NULL),
rel_irelative_(NULL), copy_relocs_(elfcpp::R_386_COPY),
- got_mod_index_offset_(-1U), tls_base_symbol_defined_(false)
+ got_mod_index_offset_(-1U), tls_base_symbol_defined_(false),
+ isa_1_used_(0), isa_1_needed_(0),
+ feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
+ object_isa_1_used_(0), object_feature_1_(0),
+ object_feature_2_used_(0), seen_first_object_(false)
{ }
// Process the relocations to determine unreferenced sections for
@@ -859,6 +863,21 @@ class Target_i386 : public Sized_target<32, false>
this->rel_dyn_section(layout));
}
+ // Record a target-specific program property in the .note.gnu.property
+ // section.
+ void
+ record_gnu_property(unsigned int, unsigned int, size_t,
+ const unsigned char*, const Object*);
+
+ // Merge the target-specific program properties from the current object.
+ void
+ merge_gnu_properties(const Object*);
+
+ // Finalize the target-specific program properties and add them back to
+ // the layout.
+ void
+ do_finalize_gnu_properties(Layout*) const;
+
// Information about this specific target which we pass to the
// general Target structure.
static const Target::Target_info i386_info;
@@ -898,6 +917,26 @@ class Target_i386 : public Sized_target<32, false>
unsigned int got_mod_index_offset_;
// True if the _TLS_MODULE_BASE_ symbol has been defined.
bool tls_base_symbol_defined_;
+
+ // Target-specific program properties, from .note.gnu.property section.
+ // Each bit represents a specific feature.
+ uint32_t isa_1_used_;
+ uint32_t isa_1_needed_;
+ uint32_t feature_1_;
+ uint32_t feature_2_used_;
+ uint32_t feature_2_needed_;
+ // Target-specific properties from the current object.
+ // These bits get ORed into ISA_1_USED_ after all properties for the object
+ // have been processed. But if either is all zeroes (as when the property
+ // is absent from an object), the result should be all zeroes.
+ // (See PR ld/23486.)
+ uint32_t object_isa_1_used_;
+ // These bits get ANDed into FEATURE_1_ after all properties for the object
+ // have been processed.
+ uint32_t object_feature_1_;
+ uint32_t object_feature_2_used_;
+ // Whether we have seen our first object, for use in initializing FEATURE_1_.
+ bool seen_first_object_;
};
const Target::Target_info Target_i386::i386_info =
@@ -1042,6 +1081,126 @@ Target_i386::rel_irelative_section(Layout* layout)
return this->rel_irelative_;
}
+// Record a target-specific program property from the .note.gnu.property
+// section.
+void
+Target_i386::record_gnu_property(
+ unsigned int, unsigned int pr_type,
+ size_t pr_datasz, const unsigned char* pr_data,
+ const Object* object)
+{
+ uint32_t val = 0;
+
+ switch (pr_type)
+ {
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
+ if (pr_datasz != 4)
+ {
+ gold_warning(_("%s: corrupt .note.gnu.property section "
+ "(pr_datasz for property %d is not 4)"),
+ object->name().c_str(), pr_type);
+ return;
+ }
+ val = elfcpp::Swap<32, false>::readval(pr_data);
+ break;
+ default:
+ gold_warning(_("%s: unknown program property type 0x%x "
+ "in .note.gnu.property section"),
+ object->name().c_str(), pr_type);
+ break;
+ }
+
+ switch (pr_type)
+ {
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
+ this->object_isa_1_used_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
+ this->isa_1_needed_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
+ // If we see multiple feature props in one object, OR them together.
+ this->object_feature_1_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
+ this->object_feature_2_used_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
+ this->feature_2_needed_ |= val;
+ break;
+ }
+}
+
+// Merge the target-specific program properties from the current object.
+void
+Target_i386::merge_gnu_properties(const Object*)
+{
+ if (this->seen_first_object_)
+ {
+ // If any object is missing the ISA_1_USED property, we must omit
+ // it from the output file.
+ if (this->object_isa_1_used_ == 0)
+ this->isa_1_used_ = 0;
+ else if (this->isa_1_used_ != 0)
+ this->isa_1_used_ |= this->object_isa_1_used_;
+ this->feature_1_ &= this->object_feature_1_;
+ // If any object is missing the FEATURE_2_USED property, we must
+ // omit it from the output file.
+ if (this->object_feature_2_used_ == 0)
+ this->feature_2_used_ = 0;
+ else if (this->feature_2_used_ != 0)
+ this->feature_2_used_ |= this->object_feature_2_used_;
+ }
+ else
+ {
+ this->isa_1_used_ = this->object_isa_1_used_;
+ this->feature_1_ = this->object_feature_1_;
+ this->feature_2_used_ = this->object_feature_2_used_;
+ this->seen_first_object_ = true;
+ }
+ this->object_isa_1_used_ = 0;
+ this->object_feature_1_ = 0;
+ this->object_feature_2_used_ = 0;
+}
+
+static inline void
+add_property(Layout* layout, unsigned int pr_type, uint32_t val)
+{
+ unsigned char buf[4];
+ elfcpp::Swap<32, false>::writeval(buf, val);
+ layout->add_gnu_property(elfcpp::NT_GNU_PROPERTY_TYPE_0, pr_type, 4, buf);
+}
+
+// Finalize the target-specific program properties and add them back to
+// the layout.
+void
+Target_i386::do_finalize_gnu_properties(Layout* layout) const
+{
+ if (this->isa_1_used_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_USED,
+ this->isa_1_used_);
+ if (this->isa_1_needed_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED,
+ this->isa_1_needed_);
+ if (this->feature_1_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
+ this->feature_1_);
+ if (this->feature_2_used_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
+ this->feature_2_used_);
+ if (this->feature_2_needed_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
+ this->feature_2_needed_);
+}
+
// Write the first three reserved words of the .got.plt section.
// The remainder of the section is written while writing the PLT
// in Output_data_plt_i386::do_write.

View File

@ -1,10 +0,0 @@
--- binutils.orig/gold/target-reloc.h 2018-07-12 11:37:24.894494658 +0100
+++ binutils-2.30.90/gold/target-reloc.h 2018-07-12 15:38:50.049083904 +0100
@@ -136,6 +136,7 @@ class Default_comdat_behavior
if (Layout::is_debug_info_section(name))
return CB_PRETEND;
if (strcmp(name, ".eh_frame") == 0
+ || strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for ST_NOTE...
|| strcmp(name, ".gcc_except_table") == 0)
return CB_IGNORE;
return CB_ERROR;

View File

@ -0,0 +1,66 @@
Only in binutils-2.34/gold: autom4te.cache
diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure
--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100
+++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100
@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5
+$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;}
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100
+++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100
@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- AC_MSG_ERROR("unsupported target $targ")
+ AC_MSG_WARN("unsupported target $targ")
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
--- binutils.orig/ld/configure.tgt 2020-04-20 12:35:12.465301359 +0100
+++ binutils-2.34/ld/configure.tgt 2020-04-20 14:17:52.123066333 +0100
@@ -220,7 +220,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi
targ_extra_emuls="elf32bfin"
targ_extra_libpath=$targ_extra_emuls
;;
-bpf-*-*) targ_emul=elf64bpf
+bpf-* | bpf-*-*) targ_emul=elf64bpf
;;
cr16-*-elf*) targ_emul=elf32cr16
;;
@@ -1026,7 +1026,7 @@ z8k-*-coff) targ_emul=z8002
targ_extra_ofiles=
;;
*)
- echo 2>&1 "*** ld does not support target ${targ}"
+ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY"
echo 2>&1 "*** see ld/configure.tgt for supported targets"
exit 1
--- binutils.orig/bfd/config.bfd 2020-04-20 12:35:13.038297375 +0100
+++ binutils-2.34/bfd/config.bfd 2020-04-20 14:25:26.452869193 +0100
@@ -473,7 +473,7 @@ case "${targ}" in
;;
#ifdef BFD64
- bpf-*-none)
+ bpf-*-none | bpf-*)
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
@@ -1427,7 +1427,7 @@ case "${targ}" in
;;
*)
- echo 1>&2 "*** BFD does not support target ${targ}."
+ echo 1>&2 "*** BFD does not support target '${targ}'. Honest."
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
exit 1
;;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
--- binutils.orig/bfd/elflink.c 2022-03-30 11:44:05.686040593 +0100
+++ binutils-2.38/bfd/elflink.c 2022-03-30 11:45:18.066541463 +0100
@@ -1294,9 +1294,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
h->root.non_ir_ref_dynamic = true;
hi->root.non_ir_ref_dynamic = true;
}
-
- if ((oldbfd->flags & BFD_PLUGIN) != 0
- && hi->root.type == bfd_link_hash_indirect)
+ else if ((oldbfd->flags & BFD_PLUGIN) != 0
+ && hi->root.type == bfd_link_hash_indirect)
{
/* Change indirect symbol from IR to undefined. */
hi->root.type = bfd_link_hash_undefined;

View File

@ -0,0 +1,158 @@
From a0b911576eb49e06a457ebf757b42543d2c7e548 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@microsoft.com>
Date: Wed, 21 Jul 2021 14:32:03 +0100
Subject: [PATCH] Allows linker scripts to set the SEC_READONLY flag.
* ld.texi: Document new output section type.
* ldgram.y: Add new token.
* ldlang.c: Handle the new flag.
* ldlang.h: Add readonly_section to list of section types.
* ldlex.l: Add a new identifier.
* testsuite/ld-scripts/output-section-types.t: New example linker script.
* testsuite/ld-scripts/output-section-types.d: Test driver.
* testsyute/ld-scripts/script.exp: Run the new test.
(cherry picked from commit 6b86da53d5ee2022b9065f445d23356190380746)
---
ld/ld.texi | 2 ++
ld/ldgram.y | 2 ++
ld/ldlang.c | 6 ++++++
ld/ldlang.h | 3 ++-
ld/ldlex.l | 1 +
ld/testsuite/ld-scripts/output-section-types.d | 13 +++++++++++++
ld/testsuite/ld-scripts/output-section-types.t | 7 +++++++
ld/testsuite/ld-scripts/script.exp | 1 +
8 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 ld/testsuite/ld-scripts/output-section-types.d
create mode 100644 ld/testsuite/ld-scripts/output-section-types.t
diff --git a/ld/ld.texi b/ld/ld.texi
index dd8f571d4e4..cf1e637adbf 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -5456,6 +5456,8 @@ parentheses. The following types are defined:
@item NOLOAD
The section should be marked as not loadable, so that it will not be
loaded into memory when the program is run.
+@item READONLY
+The section should be marked as read-only.
@item DSECT
@itemx COPY
@itemx INFO
diff --git a/ld/ldgram.y b/ld/ldgram.y
index dd911f46169..31e0071c6fc 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -139,6 +139,7 @@ static int error_index;
%token REGION_ALIAS
%token LD_FEATURE
%token NOLOAD DSECT COPY INFO OVERLAY
+%token READONLY
%token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token <integer> NEXT
%token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
@@ -1123,6 +1124,7 @@ type:
| COPY { sectype = noalloc_section; }
| INFO { sectype = noalloc_section; }
| OVERLAY { sectype = noalloc_section; }
+ | READONLY { sectype = readonly_section; }
;
atype:
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 37b64c89ee1..2610be995ca 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2639,6 +2639,9 @@ lang_add_section (lang_statement_list_type *ptr,
case noalloc_section:
flags &= ~SEC_ALLOC;
break;
+ case readonly_section:
+ flags |= SEC_READONLY;
+ break;
case noload_section:
flags &= ~SEC_LOAD;
flags |= SEC_NEVER_LOAD;
@@ -4232,6 +4235,9 @@ map_input_to_output_sections
case noalloc_section:
flags = SEC_HAS_CONTENTS;
break;
+ case readonly_section:
+ flags |= SEC_READONLY;
+ break;
case noload_section:
if (bfd_get_flavour (link_info.output_bfd)
== bfd_target_elf_flavour)
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 6fbe16d97d9..f68ae27b409 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -121,7 +121,8 @@ enum section_type
first_overlay_section,
overlay_section,
noload_section,
- noalloc_section
+ noalloc_section,
+ readonly_section
};
/* This structure holds a list of program headers describing
diff --git a/ld/ldlex.l b/ld/ldlex.l
index c1b15263587..25b4bcaae01 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -294,6 +294,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<BOTH,SCRIPT>"SORT_BY_INIT_PRIORITY" { RTOKEN(SORT_BY_INIT_PRIORITY); }
<BOTH,SCRIPT>"SORT_NONE" { RTOKEN(SORT_NONE); }
<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
+<EXPRESSION,BOTH,SCRIPT>"READONLY" { RTOKEN(READONLY);}
<EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
<EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
<EXPRESSION,BOTH,SCRIPT>"INFO" { RTOKEN(INFO);}
diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d
new file mode 100644
index 00000000000..ab124fa4dd7
--- /dev/null
+++ b/ld/testsuite/ld-scripts/output-section-types.d
@@ -0,0 +1,13 @@
+#ld: -Toutput-section-types.t
+#source: align2a.s
+#objdump: -h
+#target: [is_elf_format]
+
+#...
+ . \.rom.*
+[ ]+ALLOC, READONLY
+ . \.ro.*
+[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA
+ . \.over.*
+[ ]+CONTENTS, READONLY
+#pass
diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t
new file mode 100644
index 00000000000..d8fdfda1a03
--- /dev/null
+++ b/ld/testsuite/ld-scripts/output-section-types.t
@@ -0,0 +1,7 @@
+SECTIONS {
+ .rom (NOLOAD) : { LONG(1234); }
+ .ro (READONLY) : { LONG(5678); }
+ .over (OVERLAY) : { LONG(0123); }
+ /DISCARD/ : { *(*) }
+
+}
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 961cd08c4b1..ff50199b3ae 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -229,6 +229,7 @@ foreach test_script $test_script_list {
run_dump_test "align-with-input"
run_dump_test "pr20302"
+run_dump_test "output-section-types"
run_dump_test "segment-start" {{name (default)}}
run_dump_test "segment-start" {{name (overridden)} \
--
2.30.2

View File

@ -0,0 +1,28 @@
diff -rup binutils.orig/ltmain.sh binutils-2.37/ltmain.sh
--- binutils.orig/ltmain.sh 2022-01-27 16:23:09.304207432 +0000
+++ binutils-2.37/ltmain.sh 2022-01-27 16:23:18.380143759 +0000
@@ -7103,6 +7103,7 @@ EOF
rpath="$finalize_rpath"
test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
@@ -7798,6 +7799,7 @@ EOF
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
@@ -7849,6 +7851,7 @@ EOF
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
Only in binutils-2.37: ltmain.sh.orig

View File

@ -0,0 +1,358 @@
diff -rup binutils.orig/binutils/dwarf.c binutils-2.38/binutils/dwarf.c
--- binutils.orig/binutils/dwarf.c 2022-05-20 16:57:16.563961379 +0100
+++ binutils-2.38/binutils/dwarf.c 2022-05-20 16:57:32.880853694 +0100
@@ -11693,7 +11693,11 @@ free_debug_memory (void)
free_dwo_info ();
}
-void
+/* Enable display of specific DWARF sections as determined by the comma
+ separated strings in NAMES. Returns non-zero if any displaying was
+ enabled. */
+
+int
dwarf_select_sections_by_names (const char *names)
{
typedef struct
@@ -11746,6 +11750,7 @@ dwarf_select_sections_by_names (const ch
};
const char *p;
+ int result = 0;
p = names;
while (*p)
@@ -11760,6 +11765,7 @@ dwarf_select_sections_by_names (const ch
&& (p[len] == ',' || p[len] == '\0'))
{
* entry->variable = entry->val;
+ result |= entry->val;
/* The --debug-dump=frames-interp option also
enables the --debug-dump=frames option. */
@@ -11782,48 +11788,82 @@ dwarf_select_sections_by_names (const ch
if (*p == ',')
p++;
}
+
+ return result;
}
-void
+/* Enable display of specific DWARF sections as determined by the characters
+ in LETTERS. Returns non-zero if any displaying was enabled. */
+
+int
dwarf_select_sections_by_letters (const char *letters)
{
- unsigned int lindex = 0;
+ typedef struct
+ {
+ const char letter;
+ int * variable;
+ int val;
+ bool cont;
+ }
+ debug_dump_letter_opts;
- while (letters[lindex])
- switch (letters[lindex++])
- {
- case 'A': do_debug_addr = 1; break;
- case 'a': do_debug_abbrevs = 1; break;
- case 'c': do_debug_cu_index = 1; break;
+ static const debug_dump_letter_opts letter_table [] =
+ {
+ { 'A', & do_debug_addr, 1, false},
+ { 'a', & do_debug_abbrevs, 1, false },
+ { 'c', & do_debug_cu_index, 1, false },
#ifdef HAVE_LIBDEBUGINFOD
- case 'D': use_debuginfod = 1; break;
- case 'E': use_debuginfod = 0; break;
+ { 'D', & use_debuginfod, 1, false },
+ { 'E', & use_debuginfod, 0, false },
#endif
- case 'F': do_debug_frames_interp = 1; /* Fall through. */
- case 'f': do_debug_frames = 1; break;
- case 'g': do_gdb_index = 1; break;
- case 'i': do_debug_info = 1; break;
- case 'K': do_follow_links = 1; break;
- case 'N': do_follow_links = 0; break;
- case 'k': do_debug_links = 1; break;
- case 'l': do_debug_lines |= FLAG_DEBUG_LINES_RAW; break;
- case 'L': do_debug_lines |= FLAG_DEBUG_LINES_DECODED; break;
- case 'm': do_debug_macinfo = 1; break;
- case 'O': do_debug_str_offsets = 1; break;
- case 'o': do_debug_loc = 1; break;
- case 'p': do_debug_pubnames = 1; break;
- case 'R': do_debug_ranges = 1; break;
- case 'r': do_debug_aranges = 1; break;
- case 's': do_debug_str = 1; break;
- case 'T': do_trace_aranges = 1; break;
- case 't': do_debug_pubtypes = 1; break;
- case 'U': do_trace_info = 1; break;
- case 'u': do_trace_abbrevs = 1; break;
-
- default:
- warn (_("Unrecognized debug option '%s'\n"), letters);
- break;
- }
+ { 'F', & do_debug_frames_interp, 1, true }, /* Note the fall through. */
+ { 'f', & do_debug_frames, 1, false },
+ { 'g', & do_gdb_index, 1, false },
+ { 'i', & do_debug_info, 1, false },
+ { 'K', & do_follow_links, 1, false },
+ { 'k', & do_debug_links, 1, false },
+ { 'L', & do_debug_lines, FLAG_DEBUG_LINES_DECODED, false },
+ { 'l', & do_debug_lines, FLAG_DEBUG_LINES_RAW, false },
+ { 'm', & do_debug_macinfo, 1, false },
+ { 'N', & do_follow_links, 0, false },
+ { 'O', & do_debug_str_offsets, 1, false },
+ { 'o', & do_debug_loc, 1, false },
+ { 'p', & do_debug_pubnames, 1, false },
+ { 'R', & do_debug_ranges, 1, false },
+ { 'r', & do_debug_aranges, 1, false },
+ { 's', & do_debug_str, 1, false },
+ { 'T', & do_trace_aranges, 1, false },
+ { 't', & do_debug_pubtypes, 1, false },
+ { 'U', & do_trace_info, 1, false },
+ { 'u', & do_trace_abbrevs, 1, false },
+ { 0, NULL, 0, false }
+ };
+
+ int result = 0;
+
+ while (* letters)
+ {
+ const debug_dump_letter_opts * entry;
+
+ for (entry = letter_table; entry->letter; entry++)
+ {
+ if (entry->letter == * letters)
+ {
+ * entry->variable |= entry->val;
+ result |= entry->val;
+
+ if (! entry->cont)
+ break;
+ }
+ }
+
+ if (entry->letter == 0)
+ warn (_("Unrecognized debug letter option '%c'\n"), * letters);
+
+ letters ++;
+ }
+
+ return result;
}
void
Only in binutils-2.38/binutils: dwarf.c.orig
diff -rup binutils.orig/binutils/dwarf.h binutils-2.38/binutils/dwarf.h
--- binutils.orig/binutils/dwarf.h 2022-05-20 16:57:16.565961366 +0100
+++ binutils-2.38/binutils/dwarf.h 2022-05-20 16:57:32.880853694 +0100
@@ -246,8 +246,8 @@ extern void *open_debug_file (const char
extern void free_debug_memory (void);
-extern void dwarf_select_sections_by_names (const char *);
-extern void dwarf_select_sections_by_letters (const char *);
+extern int dwarf_select_sections_by_names (const char *);
+extern int dwarf_select_sections_by_letters (const char *);
extern void dwarf_select_sections_all (void);
extern unsigned int * find_cu_tu_set (void *, unsigned int);
Only in binutils-2.38/binutils: dwarf.h.orig
diff -rup binutils.orig/binutils/objdump.c binutils-2.38/binutils/objdump.c
--- binutils.orig/binutils/objdump.c 2022-05-20 16:57:16.566961359 +0100
+++ binutils-2.38/binutils/objdump.c 2022-05-20 16:57:32.881853688 +0100
@@ -5008,6 +5008,26 @@ sign_extend_address (bfd *abfd ATTRIBUTE
return (((vma & ((mask << 1) - 1)) ^ mask) - mask);
}
+static bool
+might_need_separate_debug_info (bool is_mainfile)
+{
+ /* We do not follow links from debug info files. */
+ if (! is_mainfile)
+ return false;
+
+ /* Since do_follow_links might be enabled by default, only treat it as an
+ indication that separate files should be loaded if setting it was a
+ deliberate user action. */
+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links)
+ return true;
+
+ if (process_links || dump_symtab || dump_debugging
+ || dump_dwarf_section_info)
+ return true;
+
+ return false;
+}
+
/* Dump selected contents of ABFD. */
static void
@@ -5022,16 +5042,8 @@ dump_bfd (bfd *abfd, bool is_mainfile)
else
byte_get = NULL;
- /* Load any separate debug information files.
- We do this now and without checking do_follow_links because separate
- debug info files may contain symbol tables that we will need when
- displaying information about the main file. Any memory allocated by
- load_separate_debug_files will be released when we call
- free_debug_memory below.
-
- The test on is_mainfile is there because the chain of separate debug
- info files is a global variable shared by all invocations of dump_bfd. */
- if (byte_get != NULL && is_mainfile)
+ /* Load any separate debug information files. */
+ if (byte_get != NULL && might_need_separate_debug_info (is_mainfile))
{
load_separate_debug_files (abfd, bfd_get_filename (abfd));
@@ -5593,20 +5605,30 @@ main (int argc, char **argv)
do_follow_links = true;
break;
case 'W':
- dump_dwarf_section_info = true;
seenflag = true;
if (optarg)
- dwarf_select_sections_by_letters (optarg);
+ {
+ if (dwarf_select_sections_by_letters (optarg))
+ dump_dwarf_section_info = true;
+ }
else
- dwarf_select_sections_all ();
+ {
+ dump_dwarf_section_info = true;
+ dwarf_select_sections_all ();
+ }
break;
case OPTION_DWARF:
- dump_dwarf_section_info = true;
seenflag = true;
if (optarg)
- dwarf_select_sections_by_names (optarg);
+ {
+ if (dwarf_select_sections_by_names (optarg))
+ dump_dwarf_section_info = true;
+ }
else
- dwarf_select_sections_all ();
+ {
+ dwarf_select_sections_all ();
+ dump_dwarf_section_info = true;
+ }
break;
case OPTION_DWARF_DEPTH:
{
Only in binutils-2.38/binutils: objdump.c.orig
diff -rup binutils.orig/binutils/readelf.c binutils-2.38/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2022-05-20 16:57:16.565961366 +0100
+++ binutils-2.38/binutils/readelf.c 2022-05-20 16:57:32.883853675 +0100
@@ -21900,6 +21900,26 @@ initialise_dump_sects (Filedata * fileda
}
}
+static bool
+might_need_separate_debug_info (Filedata * filedata)
+{
+ /* Debuginfo files do not need further separate file loading. */
+ if (filedata->file_header.e_shstrndx == SHN_UNDEF)
+ return false;
+
+ /* Since do_follow_links might be enabled by default, only treat it as an
+ indication that separate files should be loaded if setting it was a
+ deliberate user action. */
+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links)
+ return true;
+
+ if (process_links || do_syms || do_unwind
+ || do_dump || do_debugging)
+ return true;
+
+ return false;
+}
+
/* Process one ELF object file according to the command line options.
This file may actually be stored in an archive. The file is
positioned at the start of the ELF object. Returns TRUE if no
@@ -21983,7 +22003,7 @@ process_object (Filedata * filedata)
if (! process_version_sections (filedata))
res = false;
- if (filedata->file_header.e_shstrndx != SHN_UNDEF)
+ if (might_need_separate_debug_info (filedata))
have_separate_files = load_separate_debug_files (filedata, filedata->file_name);
else
have_separate_files = false;
Only in binutils-2.38/binutils: readelf.c.orig
Only in binutils-2.38/binutils: readelf.c.rej
diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp
--- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-20 16:57:16.579961273 +0100
+++ binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-20 16:57:32.883853675 +0100
@@ -189,7 +189,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
test_fetch_debugaltlink $OBJDUMP "-Wk"
set test "disabling debuginfod access"
- setup_xfail *-*-*
+ # setup_xfail *-*-*
test_fetch_debuglink $OBJDUMP "-W -WE"
set test "debuginfod"
@@ -202,7 +202,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_read
test_fetch_debugaltlink $READELF "-wk"
set test "disabling debuginfod access"
- setup_xfail *-*-*
+ # setup_xfail *-*-*
test_fetch_debuglink $READELF "-w -wE"
set test "debuginfod"
diff -rup binutils.orig/binutils/testsuite/binutils-all/objdump.Wk binutils-2.38/binutils/testsuite/binutils-all/objdump.Wk
--- binutils.orig/binutils/testsuite/binutils-all/objdump.Wk 2022-05-20 16:57:16.574961306 +0100
+++ binutils-2.38/binutils/testsuite/binutils-all/objdump.Wk 2022-05-20 16:57:32.883853675 +0100
@@ -1,8 +1,9 @@
+#...
tmpdir/debuglink\.o: file format .*
-Contents of the \.gnu_debuglink section:
+Contents of the \.gnu_debuglink section.*
Separate debug info file: this_is_a_debuglink\.debug
CRC value: 0x12345678
-Contents of the \.gnu_debugaltlink section:
+Contents of the \.gnu_debugaltlink section.*
Separate debug info file: linkdebug\.debug
Build-ID \(0x18 bytes\):
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef
diff -rup binutils.orig/binutils/testsuite/binutils-all/readelf.k binutils-2.38/binutils/testsuite/binutils-all/readelf.k
--- binutils.orig/binutils/testsuite/binutils-all/readelf.k 2022-05-20 16:57:16.575961300 +0100
+++ binutils-2.38/binutils/testsuite/binutils-all/readelf.k 2022-05-20 16:57:32.883853675 +0100
@@ -1,7 +1,8 @@
-Contents of the \.gnu_debuglink section:
+#...
+Contents of the \.gnu_debuglink section.*
Separate debug info file: this_is_a_debuglink\.debug
CRC value: 0x12345678
-Contents of the \.gnu_debugaltlink section:
+Contents of the \.gnu_debugaltlink section.*
Separate debug info file: linkdebug\.debug
Build-ID \(0x18 bytes\):
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef
--- binutils.ori/binutils/dwarf.c 2022-06-30 14:55:24.390992919 +0100
+++ binutils-2.38/binutils/dwarf.c 2022-06-30 14:58:06.540908399 +0100
@@ -11849,7 +11852,10 @@ dwarf_select_sections_by_letters (const
{
if (entry->letter == * letters)
{
- * entry->variable |= entry->val;
+ if (entry->val == 0)
+ * entry->variable = 0;
+ else
+ * entry->variable |= entry->val;
result |= entry->val;
if (! entry->cont)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
From cebc89b9328eab994f6b0314c263f94e7949a553 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 21 Feb 2022 10:58:57 +1030
Subject: [PATCH] binutils 2.38 vs. ppc32 linux kernel
Commit b25f942e18d6 made .machine more strict. Weaken it again.
* config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
keeping sticky options to work around gcc bugs.
---
gas/config/tc-ppc.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 054f9c72161..89bc7d3f9b9 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
options do not count as a new machine, instead they add
to currently selected opcodes. */
ppc_cpu_t machine_sticky = 0;
- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string);
+ /* Unfortunately, some versions of gcc emit a .machine
+ directive very near the start of the compiler's assembly
+ output file. This is bad because it overrides user -Wa
+ cpu selection. Worse, there are versions of gcc that
+ emit the *wrong* cpu, not even respecting the -mcpu given
+ to gcc. See gcc pr101393. And to compound the problem,
+ as of 20220222 gcc doesn't pass the correct cpu option to
+ gas on the command line. See gcc pr59828. Hack around
+ this by keeping sticky options for an early .machine. */
+ asection *sec;
+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
+ {
+ segment_info_type *info = seg_info (sec);
+ /* Are the frags for this section perturbed from their
+ initial state? Even .align will count here. */
+ if (info != NULL
+ && (info->frchainP->frch_root != info->frchainP->frch_last
+ || info->frchainP->frch_root->fr_type != rs_fill
+ || info->frchainP->frch_root->fr_fix != 0))
+ break;
+ }
+ new_cpu = ppc_parse_cpu (ppc_cpu,
+ sec == NULL ? &sticky : &machine_sticky,
+ cpu_string);
if (new_cpu != 0)
ppc_cpu = new_cpu;
else
--
2.37.1

View File

@ -0,0 +1,266 @@
--- binutils.orig/bfd/elf64-ppc.c 2022-06-13 12:05:13.325289568 +0100
+++ binutils-2.38/bfd/elf64-ppc.c 2022-06-13 12:05:36.080143584 +0100
@@ -3270,10 +3270,14 @@ struct ppc_link_hash_table
/* The size of reliplt used by got entry relocs. */
bfd_size_type got_reli_size;
- /* DT_RELR array of r_offset. */
+ /* DT_RELR array of section/r_offset. */
size_t relr_alloc;
size_t relr_count;
- bfd_vma *relr_addr;
+ struct
+ {
+ asection *sec;
+ bfd_vma off;
+ } *relr;
/* Statistics. */
unsigned long stub_count[ppc_stub_save_res];
@@ -13419,16 +13423,11 @@ maybe_strip_output (struct bfd_link_info
}
}
-static int
-compare_relr_address (const void *arg1, const void *arg2)
-{
- bfd_vma a = *(bfd_vma *) arg1;
- bfd_vma b = *(bfd_vma *) arg2;
- return a < b ? -1 : a > b ? 1 : 0;
-}
+/* Stash R_PPC64_RELATIVE reloc at input section SEC, r_offset OFF to
+ the array of such relocs. */
static bool
-append_relr_off (struct ppc_link_hash_table *htab, bfd_vma off)
+append_relr_off (struct ppc_link_hash_table *htab, asection *sec, bfd_vma off)
{
if (htab->relr_count >= htab->relr_alloc)
{
@@ -13436,16 +13435,51 @@ append_relr_off (struct ppc_link_hash_ta
htab->relr_alloc = 4096;
else
htab->relr_alloc *= 2;
- htab->relr_addr
- = bfd_realloc (htab->relr_addr,
- htab->relr_alloc * sizeof (htab->relr_addr[0]));
- if (htab->relr_addr == NULL)
+ htab->relr = bfd_realloc (htab->relr,
+ htab->relr_alloc * sizeof (*htab->relr));
+ if (htab->relr == NULL)
return false;
}
- htab->relr_addr[htab->relr_count++] = off;
+ htab->relr[htab->relr_count].sec = sec;
+ htab->relr[htab->relr_count].off = off;
+ htab->relr_count++;
return true;
}
+/* qsort comparator for bfd_vma args. */
+
+static int
+compare_relr_address (const void *arg1, const void *arg2)
+{
+ bfd_vma a = *(bfd_vma *) arg1;
+ bfd_vma b = *(bfd_vma *) arg2;
+ return a < b ? -1 : a > b ? 1 : 0;
+}
+
+/* Produce a malloc'd sorted array of reloc addresses from the info
+ stored by append_relr_off. */
+
+static bfd_vma *
+sort_relr (struct ppc_link_hash_table *htab)
+{
+ bfd_vma *addr = bfd_malloc (htab->relr_count * sizeof (*addr));
+ if (addr == NULL)
+ return NULL;
+
+ for (size_t i = 0; i < htab->relr_count; i++)
+ addr[i] = (htab->relr[i].sec->output_section->vma
+ + htab->relr[i].sec->output_offset
+ + htab->relr[i].off);
+
+ if (htab->relr_count > 1)
+ qsort (addr, htab->relr_count, sizeof (*addr), compare_relr_address);
+
+ return addr;
+}
+
+/* Look over GOT and PLT entries saved on elf_local_got_ents for all
+ input files, stashing info about needed relative relocs. */
+
static bool
got_and_plt_relr_for_local_syms (struct bfd_link_info *info)
{
@@ -13493,10 +13527,7 @@ got_and_plt_relr_for_local_syms (struct
&& isym->st_shndx != SHN_ABS)
{
asection *got = ppc64_elf_tdata (gent->owner)->got;
- bfd_vma r_offset = (got->output_section->vma
- + got->output_offset
- + gent->got.offset);
- if (!append_relr_off (htab, r_offset))
+ if (!append_relr_off (htab, got, gent->got.offset))
{
htab->stub_error = true;
return false;
@@ -13511,10 +13542,7 @@ got_and_plt_relr_for_local_syms (struct
if (pent->plt.offset != (bfd_vma) -1
&& ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC)
{
- bfd_vma r_offset = (pent->plt.offset
- + htab->pltlocal->output_offset
- + htab->pltlocal->output_section->vma);
- if (!append_relr_off (htab, r_offset))
+ if (!append_relr_off (htab, htab->pltlocal, pent->plt.offset))
{
if (symtab_hdr->contents != (unsigned char *) local_syms)
free (local_syms);
@@ -13534,6 +13562,9 @@ got_and_plt_relr_for_local_syms (struct
return true;
}
+/* Stash info about needed GOT and PLT entry relative relocs for
+ global symbol H. */
+
static bool
got_and_plt_relr (struct elf_link_hash_entry *h, void *inf)
{
@@ -13565,10 +13596,7 @@ got_and_plt_relr (struct elf_link_hash_e
&& gent->got.offset != (bfd_vma) -1)
{
asection *got = ppc64_elf_tdata (gent->owner)->got;
- bfd_vma r_offset = (got->output_section->vma
- + got->output_offset
- + gent->got.offset);
- if (!append_relr_off (htab, r_offset))
+ if (!append_relr_off (htab, got, gent->got.offset))
{
htab->stub_error = true;
return false;
@@ -13580,10 +13608,7 @@ got_and_plt_relr (struct elf_link_hash_e
for (pent = h->plt.plist; pent != NULL; pent = pent->next)
if (pent->plt.offset != (bfd_vma) -1)
{
- bfd_vma r_offset = (htab->pltlocal->output_section->vma
- + htab->pltlocal->output_offset
- + pent->plt.offset);
- if (!append_relr_off (htab, r_offset))
+ if (!append_relr_off (htab, htab->pltlocal, pent->plt.offset))
{
htab->stub_error = true;
return false;
@@ -13861,9 +13886,7 @@ ppc64_elf_size_stubs (struct bfd_link_in
irela->r_offset);
if (r_offset >= (bfd_vma) -2)
continue;
- r_offset += (section->output_section->vma
- + section->output_offset);
- if (!append_relr_off (htab, r_offset))
+ if (!append_relr_off (htab, section, r_offset))
goto error_ret_free_internal;
continue;
}
@@ -14214,9 +14237,7 @@ ppc64_elf_size_stubs (struct bfd_link_in
bfd_vma r_offset;
for (r_offset = 0; r_offset < htab->brlt->size; r_offset += 8)
- if (!append_relr_off (htab, (r_offset
- + htab->brlt->output_section->vma
- + htab->brlt->output_offset)))
+ if (!append_relr_off (htab, htab->brlt, r_offset))
return false;
if (!got_and_plt_relr_for_local_syms (info))
@@ -14225,28 +14246,28 @@ ppc64_elf_size_stubs (struct bfd_link_in
if (htab->stub_error)
return false;
- if (htab->relr_count > 1)
- qsort (htab->relr_addr, htab->relr_count, sizeof (*htab->relr_addr),
- compare_relr_address);
+ bfd_vma *relr_addr = sort_relr (htab);
+ if (htab->relr_count != 0 && relr_addr == NULL)
+ return false;
size_t i = 0;
while (i < htab->relr_count)
{
- bfd_vma base = htab->relr_addr[i];
+ bfd_vma base = relr_addr[i];
htab->elf.srelrdyn->size += 8;
i++;
/* Handle possible duplicate address. This can happen
as sections increase in size when adding stubs. */
while (i < htab->relr_count
- && htab->relr_addr[i] == base)
+ && relr_addr[i] == base)
i++;
base += 8;
while (1)
{
size_t start_i = i;
while (i < htab->relr_count
- && htab->relr_addr[i] - base < 63 * 8
- && (htab->relr_addr[i] - base) % 8 == 0)
+ && relr_addr[i] - base < 63 * 8
+ && (relr_addr[i] - base) % 8 == 0)
i++;
if (i == start_i)
break;
@@ -14254,6 +14275,7 @@ ppc64_elf_size_stubs (struct bfd_link_in
base += 63 * 8;
}
}
+ free (relr_addr);
}
for (group = htab->group; group != NULL; group = group->next)
@@ -15193,17 +15215,21 @@ ppc64_elf_build_stubs (struct bfd_link_i
if (htab->elf.srelrdyn->contents == NULL)
return false;
+ bfd_vma *relr_addr = sort_relr (htab);
+ if (htab->relr_count != 0 && relr_addr == NULL)
+ return false;
+
size_t i = 0;
bfd_byte *loc = htab->elf.srelrdyn->contents;
while (i < htab->relr_count)
{
- bfd_vma base = htab->relr_addr[i];
+ bfd_vma base = relr_addr[i];
BFD_ASSERT (base % 2 == 0);
bfd_put_64 (htab->elf.dynobj, base, loc);
loc += 8;
i++;
while (i < htab->relr_count
- && htab->relr_addr[i] == base)
+ && relr_addr[i] == base)
{
htab->stub_error = true;
i++;
@@ -15213,10 +15239,10 @@ ppc64_elf_build_stubs (struct bfd_link_i
{
bfd_vma bits = 0;
while (i < htab->relr_count
- && htab->relr_addr[i] - base < 63 * 8
- && (htab->relr_addr[i] - base) % 8 == 0)
+ && relr_addr[i] - base < 63 * 8
+ && (relr_addr[i] - base) % 8 == 0)
{
- bits |= (bfd_vma) 1 << ((htab->relr_addr[i] - base) / 8);
+ bits |= (bfd_vma) 1 << ((relr_addr[i] - base) / 8);
i++;
}
if (bits == 0)
@@ -15226,6 +15252,7 @@ ppc64_elf_build_stubs (struct bfd_link_i
base += 63 * 8;
}
}
+ free (relr_addr);
/* Pad any excess with 1's, a do-nothing encoding. */
while ((size_t) (loc - htab->elf.srelrdyn->contents)
< htab->elf.srelrdyn->size)

View File

@ -0,0 +1,29 @@
--- binutils.orig/binutils/readelf.c 2022-10-03 13:20:42.707527855 +0100
+++ binutils-2.39/binutils/readelf.c 2022-10-03 13:21:25.785436781 +0100
@@ -6357,6 +6357,13 @@ get_32bit_section_headers (Filedata * fi
/* PR binutils/17531: Cope with unexpected section header sizes. */
if (size == 0 || num == 0)
return false;
+
+ /* The section header cannot be at the start of the file - that is
+ where the ELF file header is located. A file with absolutely no
+ sections in it will use a shoff of 0. */
+ if (filedata->file_header.e_shoff == 0)
+ return false;
+
if (size < sizeof * shdrs)
{
if (! probe)
@@ -6421,6 +6428,12 @@ get_64bit_section_headers (Filedata * fi
if (size == 0 || num == 0)
return false;
+ /* The section header cannot be at the start of the file - that is
+ where the ELF file header is located. A file with absolutely no
+ sections in it will use a shoff of 0. */
+ if (filedata->file_header.e_shoff == 0)
+ return false;
+
if (size < sizeof * shdrs)
{
if (! probe)

View File

@ -1,25 +1,24 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-12-12 16:24:19.571221194 +0000
+++ binutils-2.29/binutils/readelf.c 2017-12-12 16:27:26.997979803 +0000
@@ -11018,12 +11018,14 @@ print_dynamic_symbol (bfd_vma si, unsign
--- binutils.orig/binutils/readelf.c 2020-07-24 15:08:30.317597020 +0100
+++ binutils-2.35/binutils/readelf.c 2020-07-24 15:09:39.029155552 +0100
@@ -12069,11 +12069,13 @@ print_dynamic_symbol (Filedata *filedata
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very
rare. */
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx));
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
else
printf (_(" <corrupt: %14ld>"), psym->st_name);
@@ -12112,7 +12114,17 @@ print_dynamic_symbol (Filedata *filedata
version_string);
}
- putchar ('\n');
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
@ -29,38 +28,8 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
+ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
}
+
+ putchar ('\n');
--- binutils.orig/binutils/readelf.c 2017-12-12 16:36:21.806561149 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-12-12 16:38:17.763168514 +0000
@@ -11548,11 +11548,13 @@ process_symbol_table (FILE * file)
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
version_string);
}
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
&& section != NULL

View File

@ -0,0 +1,184 @@
From 30cbd32aec30b4bc13427bbd87c4c63c739d4578 Mon Sep 17 00:00:00 2001
From: Steiner H Gunderson <steinar+sourceware@gunderson.no>
Date: Mon, 21 Mar 2022 14:29:12 +0000
Subject: [PATCH] Reduce O(n2) performance overhead when parsing DWARF unit
information.
PR 28978
* dwarf2.c (scan_unit_for_symbols): When performing second pass,
check to see if the function or variable being processed is the
same as the previous one.
---
bfd/ChangeLog | 7 ++++
bfd/dwarf2.c | 93 +++++++++++++++++++++++++++++++++------------------
2 files changed, 67 insertions(+), 33 deletions(-)
//diff --git a/bfd/ChangeLog b/bfd/ChangeLog
//index 6ac8b96c57a..fcf5abad5a1 100644
//--- a/bfd/ChangeLog
//+++ b/bfd/ChangeLog
//@@ -1,3 +1,10 @@
//+2022-03-21 Steiner H Gunderson <steinar+sourceware@gunderson.no>
//+
//+ PR 28978
//+ * dwarf2.c (scan_unit_for_symbols): When performing second pass,
//+ check to see if the function or variable being processed is the
//+ same as the previous one.
//+
2022-03-18 Viorel Preoteasa <viorel.preoteasa@gmail.com>
PR 28924
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index fdf071c36e9..bb176798f9a 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3293,6 +3293,36 @@ lookup_var_by_offset (bfd_uint64_t offset, struct varinfo * table)
/* DWARF2 Compilation unit functions. */
+static struct funcinfo *
+reverse_funcinfo_list (struct funcinfo *head)
+{
+ struct funcinfo *rhead;
+ struct funcinfo *temp;
+
+ for (rhead = NULL; head; head = temp)
+ {
+ temp = head->prev_func;
+ head->prev_func = rhead;
+ rhead = head;
+ }
+ return rhead;
+}
+
+static struct varinfo *
+reverse_varinfo_list (struct varinfo *head)
+{
+ struct varinfo *rhead;
+ struct varinfo *temp;
+
+ for (rhead = NULL; head; head = temp)
+ {
+ temp = head->prev_var;
+ head->prev_var = rhead;
+ rhead = head;
+ }
+ return rhead;
+}
+
/* Scan over each die in a comp. unit looking for functions to add
to the function table and variables to the variable table. */
@@ -3308,7 +3338,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
struct funcinfo *func;
} *nested_funcs;
int nested_funcs_size;
-
+ struct funcinfo *last_func;
+ struct varinfo *last_var;
+
/* Maintain a stack of in-scope functions and inlined functions, which we
can use to set the caller_func field. */
nested_funcs_size = 32;
@@ -3442,10 +3474,16 @@ scan_unit_for_symbols (struct comp_unit *unit)
}
}
+ unit->function_table = reverse_funcinfo_list (unit->function_table);
+ unit->variable_table = reverse_varinfo_list (unit->variable_table);
+
/* This is the second pass over the abbrevs. */
info_ptr = unit->first_child_die_ptr;
nesting_level = 0;
+ last_func = NULL;
+ last_var = NULL;
+
while (nesting_level >= 0)
{
unsigned int abbrev_number, i;
@@ -3481,16 +3519,32 @@ scan_unit_for_symbols (struct comp_unit *unit)
|| abbrev->tag == DW_TAG_entry_point
|| abbrev->tag == DW_TAG_inlined_subroutine)
{
- func = lookup_func_by_offset (current_offset, unit->function_table);
+ if (last_func
+ && last_func->prev_func
+ && last_func->prev_func->unit_offset == current_offset)
+ func = last_func->prev_func;
+ else
+ func = lookup_func_by_offset (current_offset, unit->function_table);
+
if (func == NULL)
goto fail;
+
+ last_func = func;
}
else if (abbrev->tag == DW_TAG_variable
|| abbrev->tag == DW_TAG_member)
{
- var = lookup_var_by_offset (current_offset, unit->variable_table);
+ if (last_var
+ && last_var->prev_var
+ && last_var->prev_var->unit_offset == current_offset)
+ var = last_var->prev_var;
+ else
+ var = lookup_var_by_offset (current_offset, unit->variable_table);
+
if (var == NULL)
goto fail;
+
+ last_var = var;
}
for (i = 0; i < abbrev->num_attrs; ++i)
@@ -3684,6 +3738,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
}
}
+ unit->function_table = reverse_funcinfo_list (unit->function_table);
+ unit->variable_table = reverse_varinfo_list (unit->variable_table);
+
free (nested_funcs);
return true;
@@ -4047,36 +4104,6 @@ comp_unit_find_line (struct comp_unit *unit,
linenumber_ptr);
}
-static struct funcinfo *
-reverse_funcinfo_list (struct funcinfo *head)
-{
- struct funcinfo *rhead;
- struct funcinfo *temp;
-
- for (rhead = NULL; head; head = temp)
- {
- temp = head->prev_func;
- head->prev_func = rhead;
- rhead = head;
- }
- return rhead;
-}
-
-static struct varinfo *
-reverse_varinfo_list (struct varinfo *head)
-{
- struct varinfo *rhead;
- struct varinfo *temp;
-
- for (rhead = NULL; head; head = temp)
- {
- temp = head->prev_var;
- head->prev_var = rhead;
- rhead = head;
- }
- return rhead;
-}
-
/* Extract all interesting funcinfos and varinfos of a compilation
unit into hash tables for faster lookup. Returns TRUE if no
errors were enountered; FALSE otherwise. */
--
2.37.2

View File

@ -67,29 +67,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.29.1/ld/tes
#...
+0x[0-9a-f]+ +\(PLTREL.*
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 13:32:39.405064420 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 15:06:53.694623801 +0000
@@ -1,7 +1,4 @@
-#...
-Disassembly of section .plt.got:
-[a-f0-9]+ <[a-z_]+@plt>:
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
+#...
[ ]*[a-f0-9]+: 90 nop
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 13:32:39.412064336 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 15:06:35.148842897 +0000
@@ -1,7 +1,3 @@
#...
-Disassembly of section .plt.got:
-
-[a-f0-9]+ <[_a-z]+@plt>:
[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <[_a-z]+>
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 13:32:39.407064397 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 15:06:17.244054423 +0000

View File

@ -0,0 +1,142 @@
diff -rup binutils-2.38/bfd/elf64-s390.c binutils-2.38.new/bfd/elf64-s390.c
--- binutils-2.38/bfd/elf64-s390.c 2022-01-22 12:14:07.000000000 +0000
+++ binutils-2.38.new/bfd/elf64-s390.c 2022-05-19 11:07:33.353913654 +0100
@@ -774,7 +774,7 @@ elf_s390_tls_transition (struct bfd_link
int r_type,
int is_local)
{
- if (bfd_link_pic (info))
+ if (bfd_link_dll (info))
return r_type;
switch (r_type)
@@ -1026,7 +1026,7 @@ elf_s390_check_relocs (bfd *abfd,
case R_390_TLS_GOTIE20:
case R_390_TLS_GOTIE64:
case R_390_TLS_IEENT:
- if (bfd_link_pic (info))
+ if (bfd_link_dll (info))
info->flags |= DF_STATIC_TLS;
/* Fall through */
@@ -1107,7 +1107,7 @@ elf_s390_check_relocs (bfd *abfd,
if (r_type == R_390_TLS_LE64 && bfd_link_pie (info))
break;
- if (!bfd_link_pic (info))
+ if (!bfd_link_dll (info))
break;
info->flags |= DF_STATIC_TLS;
/* Fall through */
@@ -1571,7 +1571,7 @@ allocate_dynrelocs (struct elf_link_hash
to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT
we can save the dynamic TLS relocation. */
if (h->got.refcount > 0
- && !bfd_link_pic (info)
+ && !bfd_link_dll (info)
&& h->dynindx == -1
&& elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
{
@@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *out
else if (startswith (bfd_section_name (s), ".rela"))
{
if (s->size != 0 && s != htab->elf.srelplt)
- relocs = true;
+ {
+ relocs = true;
+ if (s == htab->elf.irelplt)
+ {
+ /* In static-pie case, there are IRELATIVE-relocs in
+ .rela.iplt (htab->irelplt), which will later be grouped
+ to .rela.plt. On s390, the IRELATIVE relocations are
+ always located in .rela.iplt - even for non-static case.
+ Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added
+ to the dynamic section even if htab->srelplt->size == 0.
+ See _bfd_elf_add_dynamic_tags in bfd/elflink.c. */
+ htab->elf.dt_jmprel_required = true;
+ }
+ }
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -2662,7 +2675,7 @@ elf_s390_relocate_section (bfd *output_b
/* Relocations for tls literal pool entries. */
case R_390_TLS_IE64:
- if (bfd_link_pic (info))
+ if (bfd_link_dll (info))
{
Elf_Internal_Rela outrel;
asection *sreloc;
@@ -2690,7 +2703,7 @@ elf_s390_relocate_section (bfd *output_b
else if (h != NULL)
{
tls_type = elf_s390_hash_entry(h)->tls_type;
- if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
+ if (!bfd_link_dll (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
r_type = R_390_TLS_LE64;
}
if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE)
@@ -2801,14 +2814,14 @@ elf_s390_relocate_section (bfd *output_b
if (local_got_offsets == NULL)
abort();
off = local_got_offsets[r_symndx];
- if (bfd_link_pic (info))
+ if (bfd_link_dll (info))
goto emit_tls_relocs;
}
else
{
off = h->got.offset;
tls_type = elf_s390_hash_entry(h)->tls_type;
- if (bfd_link_pic (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE)
+ if (bfd_link_dll (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE)
goto emit_tls_relocs;
}
@@ -2825,7 +2838,7 @@ elf_s390_relocate_section (bfd *output_b
break;
case R_390_TLS_LDM64:
- if (! bfd_link_pic (info))
+ if (! bfd_link_dll (info))
/* The literal pool entry this relocation refers to gets ignored
by the optimized code of the local exec model. Do nothing
and the value will turn out zero. */
@@ -2900,7 +2913,7 @@ elf_s390_relocate_section (bfd *output_b
continue;
case R_390_TLS_LDO64:
- if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING))
+ if (bfd_link_dll (info) || (input_section->flags & SEC_DEBUGGING))
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -2922,7 +2935,7 @@ elf_s390_relocate_section (bfd *output_b
if (r_type == R_390_TLS_LOAD)
{
- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
{
/* IE->LE transition. Four valid cases:
lg %rx,(0,%ry) -> sllg %rx,%ry,0
@@ -2972,7 +2985,7 @@ elf_s390_relocate_section (bfd *output_b
invalid_tls_insn (input_bfd, input_section, rel);
return false;
}
- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
{
/* GD->LE transition.
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
@@ -2991,7 +3004,7 @@ elf_s390_relocate_section (bfd *output_b
}
else if (r_type == R_390_TLS_LDCALL)
{
- if (!bfd_link_pic (info))
+ if (!bfd_link_dll (info))
{
unsigned int insn0, insn1;
Only in binutils-2.38.new/bfd/: elf64-s390.c.orig

369
binutils-section-type.patch Normal file
View File

@ -0,0 +1,369 @@
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3b2a4f49a9b..78a0a1dea42 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1170,6 +1170,9 @@ typedef struct bfd_section
This is used when support for non-contiguous memory regions is enabled. */
struct bfd_section *already_assigned;
+ /* Explicitly specified section type, if non-zero. */
+ unsigned int type;
+
} asection;
/* Relax table contains information about instructions which can
@@ -1352,8 +1355,8 @@ discarded_section (const asection *sec)
/* symbol, symbol_ptr_ptr, */ \
(struct bfd_symbol *) SYM, &SEC.symbol, \
\
- /* map_head, map_tail, already_assigned */ \
- { NULL }, { NULL }, NULL \
+ /* map_head, map_tail, already_assigned, type */ \
+ { NULL }, { NULL }, NULL, 0 \
\
}
diff --git a/bfd/elf.c b/bfd/elf.c
index a67415e76e1..82b53be99f9 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3280,7 +3280,9 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
/* If the section type is unspecified, we set it based on
asect->flags. */
- if ((asect->flags & SEC_GROUP) != 0)
+ if (asect->type != 0)
+ sh_type = asect->type;
+ else if ((asect->flags & SEC_GROUP) != 0)
sh_type = SHT_GROUP;
else
sh_type = bfd_elf_get_default_section_type (asect->flags);
diff --git a/bfd/section.c b/bfd/section.c
index 899438a1c5e..2de7dbf661a 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -737,8 +737,8 @@ CODE_FRAGMENT
. {* symbol, symbol_ptr_ptr, *} \
. (struct bfd_symbol *) SYM, &SEC.symbol, \
. \
-. {* map_head, map_tail, already_assigned *} \
-. { NULL }, { NULL }, NULL \
+. {* map_head, map_tail, already_assigned, type *} \
+. { NULL }, { NULL }, NULL, 0 \
. \
. }
.
diff --git a/ld/NEWS b/ld/NEWS
index dbb402d1f8a..a498abaf0f9 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,8 @@
-*- text -*-
+* TYPE=<type> is now supported in an output section description to set the
+ section type value.
+
Changes in 2.38:
* Add -z pack-relative-relocs/-z no pack-relative-relocs to x86 ELF
diff --git a/ld/ld.texi b/ld/ld.texi
index fc75e9b3625..d57e9221410 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -5483,13 +5483,23 @@ loaded into memory when the program is run.
@item READONLY
The section should be marked as read-only.
@item DSECT
-@itemx COPY
-@itemx INFO
-@itemx OVERLAY
+@item COPY
+@item INFO
+@item OVERLAY
These type names are supported for backward compatibility, and are
rarely used. They all have the same effect: the section should be
marked as not allocatable, so that no memory is allocated for the
section when the program is run.
+@item TYPE = @var{type}
+Set the section type to the integer @var{type}. When generating an ELF
+output file, type names @code{SHT_PROGBITS}, @code{SHT_STRTAB},
+@code{SHT_NOTE}, @code {SHT_NOBITS}, @code{SHT_INIT_ARRAY},
+@code{SHT_FINI_ARRAY}, and @code{SHT_PREINIT_ARRAY} are also allowed
+for @var{type}. It is the user's responsibility to ensure that any
+special requirements of the section type are met.
+@item READONLY ( TYPE = @var{type} )
+This form of the syntax combines the @var{READONLY} type with the
+type specified by @var{type}.
@end table
@kindex NOLOAD
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 11c2f219c05..3a904e39482 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -47,6 +47,7 @@
#endif
static enum section_type sectype;
+static etree_type *sectype_value;
static lang_memory_region_type *region;
static bool ldgram_had_keep = false;
@@ -139,6 +140,7 @@ static int error_index;
%token LD_FEATURE
%token NOLOAD DSECT COPY INFO OVERLAY
%token READONLY
+%token TYPE
%token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token <integer> NEXT
%token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
@@ -1058,9 +1060,8 @@ section: NAME
{
ldlex_popstate ();
ldlex_wild ();
- lang_enter_output_section_statement($1, $3, sectype,
- $5, $7, $4,
- $8, $6);
+ lang_enter_output_section_statement ($1, $3, sectype,
+ sectype_value, $5, $7, $4, $8, $6);
}
'{'
statement_list_opt
@@ -1130,8 +1131,10 @@ type:
| COPY { sectype = noalloc_section; }
| INFO { sectype = noalloc_section; }
| OVERLAY { sectype = noalloc_section; }
+ | READONLY '(' TYPE '=' exp ')' { sectype = typed_readonly_section; sectype_value = $5; }
| READONLY { sectype = readonly_section; }
- ;
+ | TYPE '=' exp { sectype = type_section; sectype_value = $3; }
+ ;
atype:
'(' type ')'
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 474784c874a..1733f8e65c4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1891,8 +1891,8 @@ lang_insert_orphan (asection *s,
address = exp_intop (0);
os_tail = (lang_output_section_statement_type **) lang_os_list.tail;
- os = lang_enter_output_section_statement (secname, address, normal_section,
- NULL, NULL, NULL, constraint, 0);
+ os = lang_enter_output_section_statement (
+ secname, address, normal_section, 0, NULL, NULL, NULL, constraint, 0);
if (add_child == NULL)
add_child = &os->children;
@@ -2635,10 +2635,12 @@ lang_add_section (lang_statement_list_type *ptr,
case normal_section:
case overlay_section:
case first_overlay_section:
+ case type_section:
break;
case noalloc_section:
flags &= ~SEC_ALLOC;
break;
+ case typed_readonly_section:
case readonly_section:
flags |= SEC_READONLY;
break;
@@ -4209,6 +4211,7 @@ map_input_to_output_sections
{
lang_output_section_statement_type *tos;
flagword flags;
+ unsigned int type = 0;
switch (s->header.type)
{
@@ -4264,6 +4267,42 @@ map_input_to_output_sections
case readonly_section:
flags |= SEC_READONLY;
break;
+ case typed_readonly_section:
+ flags |= SEC_READONLY;
+ /* Fall through. */
+ case type_section:
+ if (os->sectype_value->type.node_class == etree_name
+ && os->sectype_value->type.node_code == NAME)
+ {
+ const char *name = os->sectype_value->name.name;
+ if (strcmp (name, "SHT_PROGBITS") == 0)
+ type = SHT_PROGBITS;
+ else if (strcmp (name, "SHT_STRTAB") == 0)
+ type = SHT_STRTAB;
+ else if (strcmp (name, "SHT_NOTE") == 0)
+ type = SHT_NOTE;
+ else if (strcmp (name, "SHT_NOBITS") == 0)
+ type = SHT_NOBITS;
+ else if (strcmp (name, "SHT_INIT_ARRAY") == 0)
+ type = SHT_INIT_ARRAY;
+ else if (strcmp (name, "SHT_FINI_ARRAY") == 0)
+ type = SHT_FINI_ARRAY;
+ else if (strcmp (name, "SHT_PREINIT_ARRAY") == 0)
+ type = SHT_PREINIT_ARRAY;
+ else
+ einfo (_ ("%F%P: invalid type for output section `%s'\n"),
+ os->name);
+ }
+ else
+ {
+ exp_fold_tree_no_dot (os->sectype_value);
+ if (expld.result.valid_p)
+ type = expld.result.value;
+ else
+ einfo (_ ("%F%P: invalid type for output section `%s'\n"),
+ os->name);
+ }
+ break;
case noload_section:
if (bfd_get_flavour (link_info.output_bfd)
== bfd_target_elf_flavour)
@@ -4276,6 +4315,7 @@ map_input_to_output_sections
init_os (os, flags | SEC_READONLY);
else
os->bfd_section->flags |= flags;
+ os->bfd_section->type = type;
break;
case lang_input_section_enum:
break;
@@ -7506,6 +7546,7 @@ lang_output_section_statement_type *
lang_enter_output_section_statement (const char *output_section_statement_name,
etree_type *address_exp,
enum section_type sectype,
+ etree_type *sectype_value,
etree_type *align,
etree_type *subalign,
etree_type *ebase,
@@ -7523,10 +7564,12 @@ lang_enter_output_section_statement (const char *output_section_statement_name,
os->addr_tree = address_exp;
}
os->sectype = sectype;
- if (sectype != noload_section)
- os->flags = SEC_NO_FLAGS;
- else
+ if (sectype == type_section || sectype == typed_readonly_section)
+ os->sectype_value = sectype_value;
+ else if (sectype == noload_section)
os->flags = SEC_NEVER_LOAD;
+ else
+ os->flags = SEC_NO_FLAGS;
os->block_value = 1;
/* Make next things chain into subchain of this. */
@@ -8842,7 +8885,7 @@ lang_enter_overlay_section (const char *name)
etree_type *size;
lang_enter_output_section_statement (name, overlay_vma, overlay_section,
- 0, overlay_subalign, 0, 0, 0);
+ 0, 0, overlay_subalign, 0, 0, 0);
/* If this is the first section, then base the VMA of future
sections on this one. This will work correctly even if `.' is
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 0d057c9bee9..95f6e468b30 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -122,7 +122,9 @@ enum section_type
overlay_section,
noload_section,
noalloc_section,
- readonly_section
+ type_section,
+ readonly_section,
+ typed_readonly_section
};
/* This structure holds a list of program headers describing
@@ -166,6 +168,7 @@ typedef struct lang_output_section_statement_struct
int constraint;
flagword flags;
enum section_type sectype;
+ etree_type *sectype_value;
unsigned int processed_vma : 1;
unsigned int processed_lma : 1;
unsigned int all_input_readonly : 1;
@@ -545,7 +548,7 @@ extern void lang_add_output
(const char *, int from_script);
extern lang_output_section_statement_type *lang_enter_output_section_statement
(const char *, etree_type *, enum section_type, etree_type *, etree_type *,
- etree_type *, int, int);
+ etree_type *, etree_type *, int, int);
extern void lang_final
(void);
extern void lang_relax_sections
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 78db16e3a48..c38b46b9336 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -323,6 +323,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<EXPRESSION>"DSECT" { RTOKEN(DSECT); }
<EXPRESSION>"COPY" { RTOKEN(COPY); }
<EXPRESSION>"INFO" { RTOKEN(INFO); }
+<EXPRESSION>"TYPE" { RTOKEN(TYPE); }
<SCRIPT,EXPRESSION>"ONLY_IF_RO" { RTOKEN(ONLY_IF_RO); }
<SCRIPT,EXPRESSION>"ONLY_IF_RW" { RTOKEN(ONLY_IF_RW); }
<SCRIPT,EXPRESSION>"SPECIAL" { RTOKEN(SPECIAL); }
diff --git a/ld/mri.c b/ld/mri.c
index b428ab0d0bf..5749870ef1e 100644
--- a/ld/mri.c
+++ b/ld/mri.c
@@ -210,8 +210,8 @@ mri_draw_tree (void)
base = p->vma ? p->vma : exp_nameop (NAME, ".");
lang_enter_output_section_statement (p->name, base,
- p->ok_to_load ? normal_section : noload_section,
- align, subalign, NULL, 0, 0);
+ p->ok_to_load ? normal_section : noload_section, 0,
+ align, subalign, NULL, 0, 0);
base = 0;
tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
tmp->next = NULL;
diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d
index ab124fa4dd7..2ecacaba57d 100644
--- a/ld/testsuite/ld-scripts/output-section-types.d
+++ b/ld/testsuite/ld-scripts/output-section-types.d
@@ -1,13 +1,17 @@
#ld: -Toutput-section-types.t
#source: align2a.s
-#objdump: -h
+#readelf: -S --wide
#target: [is_elf_format]
#...
- . \.rom.*
-[ ]+ALLOC, READONLY
- . \.ro.*
-[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA
- . \.over.*
-[ ]+CONTENTS, READONLY
+.* .rom +NOBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
+.* .ro +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
+.* .over +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 + +0 +0 +[1248]
+.* progbits +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
+.* strtab +STRTAB +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
+.* note +NOTE +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
+.* init_array +INIT_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248]
+.* fini_array +FINI_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248]
+.* preinit_array +PREINIT_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248]
+.* .ro.note +NOTE +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248]
#pass
diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t
index d8fdfda1a03..18fc5c11980 100644
--- a/ld/testsuite/ld-scripts/output-section-types.t
+++ b/ld/testsuite/ld-scripts/output-section-types.t
@@ -2,6 +2,13 @@ SECTIONS {
.rom (NOLOAD) : { LONG(1234); }
.ro (READONLY) : { LONG(5678); }
.over (OVERLAY) : { LONG(0123); }
+ progbits (TYPE=SHT_PROGBITS) : { BYTE(1) }
+ strtab (TYPE = SHT_STRTAB) : { BYTE(0) }
+ note (TYPE =SHT_NOTE) : { BYTE(8) }
+ init_array (TYPE= 14) : { QUAD(14) }
+ fini_array ( TYPE=SHT_FINI_ARRAY) : { QUAD(15) }
+ preinit_array (TYPE=SHT_PREINIT_ARRAY ) : { QUAD(16) }
+ .ro.note (READONLY (TYPE=SHT_NOTE)) : { LONG(5678); }
/DISCARD/ : { *(*) }
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
diff -rup binutils.orig/ld/ld.1 binutils-2.38/ld/ld.1
--- binutils.orig/ld/ld.1 2022-05-27 10:56:44.937044892 +0100
+++ binutils-2.38/ld/ld.1 2022-05-27 11:10:50.311802310 +0100
@@ -2595,7 +2595,7 @@ systems may not understand them. If you
\&\fB\-\-enable\-new\-dtags\fR, the new dynamic tags will be created as needed
and older dynamic tags will be omitted.
If you specify \fB\-\-disable\-new\-dtags\fR, no new dynamic tags will be
-created. By default, the new dynamic tags are not created. Note that
+created. By default, the new dynamic tags are created. Note that
those options are only available for \s-1ELF\s0 systems.
.IP "\fB\-\-hash\-size=\fR\fInumber\fR" 4
.IX Item "--hash-size=number"
diff -rup binutils.orig/ld/ld.info binutils-2.38/ld/ld.info
--- binutils.orig/ld/ld.info 2022-05-27 11:01:12.286346357 +0100
+++ binutils-2.38/ld/ld.info 2022-05-27 11:11:24.585709176 +0100
@@ -2236,7 +2236,7 @@ GNU linker:
'--enable-new-dtags', the new dynamic tags will be created as
needed and older dynamic tags will be omitted. If you specify
'--disable-new-dtags', no new dynamic tags will be created. By
- default, the new dynamic tags are not created. Note that those
+ default, the new dynamic tags are created. Note that those
options are only available for ELF systems.
'--hash-size=NUMBER'
diff -rup binutils.orig/ld/ld.texi binutils-2.38/ld/ld.texi
--- binutils.orig/ld/ld.texi 2022-05-27 11:01:24.081314960 +0100
+++ binutils-2.38/ld/ld.texi 2022-05-27 11:10:05.608923798 +0100
@@ -2796,7 +2796,7 @@ systems may not understand them. If you
@option{--enable-new-dtags}, the new dynamic tags will be created as needed
and older dynamic tags will be omitted.
If you specify @option{--disable-new-dtags}, no new dynamic tags will be
-created. By default, the new dynamic tags are not created. Note that
+created. By default, the new dynamic tags are created. Note that
those options are only available for ELF systems.
@kindex --hash-size=@var{number}

View File

@ -0,0 +1,38 @@
diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac
--- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000
+++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000
@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8";
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi
diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
--- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100
+++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100
@@ -12819,11 +12819,13 @@
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi

View File

@ -1,9 +1,10 @@
--- binutils-2.26.orig/bfd/Makefile.am 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.am 2016-01-25 10:13:23.489964145 +0000
@@ -1043,8 +1043,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD
diff -rup binutils.orig/bfd/Makefile.am binutils-2.38/bfd/Makefile.am
--- binutils.orig/bfd/Makefile.am 2022-02-09 14:10:42.659300681 +0000
+++ binutils-2.38/bfd/Makefile.am 2022-02-09 14:12:40.562532916 +0000
@@ -977,8 +977,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
$(AM_V_GEN)\
bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
@ -11,7 +12,7 @@
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -1055,7 +1055,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
@@ -989,7 +989,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \
@ -20,12 +21,13 @@
-e "s,@report_bugs_to@,$$report_bugs_to," \
< $(srcdir)/version.h > $@; \
echo "$${bfd_soversion}" > libtool-soversion
--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:14:17.818297941 +0000
@@ -2111,8 +2111,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
diff -rup binutils.orig/bfd/Makefile.in binutils-2.38/bfd/Makefile.in
--- binutils.orig/bfd/Makefile.in 2022-02-09 14:10:42.653300720 +0000
+++ binutils-2.38/bfd/Makefile.in 2022-02-09 14:19:03.362040188 +0000
@@ -2094,8 +2094,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES) $(MKDOC
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
$(AM_V_GEN)\
bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
@ -33,7 +35,7 @@
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -2123,7 +2123,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
@@ -2106,7 +2106,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \

View File

@ -0,0 +1,92 @@
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.38/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2022-05-24 12:01:20.307998318 +0100
+++ binutils-2.38/bfd/elf32-i386.c 2022-05-24 12:04:48.789688224 +0100
@@ -1772,11 +1772,14 @@ elf_i386_scan_relocs (bfd *abfd,
}
else
{
- h->pointer_equality_needed = 1;
- /* R_386_32 can be resolved at run-time. */
+ /* R_386_32 can be resolved at run-time. Function
+ pointer reference doesn't need PLT for pointer
+ equality. */
if (r_type == R_386_32
&& (sec->flags & SEC_READONLY) == 0)
func_pointer_ref = true;
+ else
+ h->pointer_equality_needed = 1;
}
if (!func_pointer_ref)
@@ -1798,6 +1801,23 @@ elf_i386_scan_relocs (bfd *abfd,
if (!h->def_regular
|| (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
h->plt.refcount = 1;
+
+ if (h->pointer_equality_needed
+ && h->type == STT_FUNC
+ && eh->def_protected
+ && elf_has_indirect_extern_access (h->root.u.def.section->owner))
+ {
+ /* Disallow non-canonical reference to canonical
+ protected function. */
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: non-canonical reference to canonical "
+ "protected function `%s' in %pB"),
+ abfd, h->root.root.string,
+ h->root.u.def.section->owner);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
}
}
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.38/bfd/elf64-x86-64.c
--- binutils.orig/bfd/elf64-x86-64.c 2022-05-24 12:01:20.296998387 +0100
+++ binutils-2.38/bfd/elf64-x86-64.c 2022-05-24 12:06:07.720192208 +0100
@@ -2211,16 +2211,18 @@ elf_x86_64_scan_relocs (bfd *abfd, struc
else if (r_type != R_X86_64_PC32_BND
&& r_type != R_X86_64_PC64)
{
- h->pointer_equality_needed = 1;
/* At run-time, R_X86_64_64 can be resolved for both
x86-64 and x32. But R_X86_64_32 and R_X86_64_32S
- can only be resolved for x32. */
+ can only be resolved for x32. Function pointer
+ reference doesn't need PLT for pointer equality. */
if ((sec->flags & SEC_READONLY) == 0
&& (r_type == R_X86_64_64
|| (!ABI_64_P (abfd)
&& (r_type == R_X86_64_32
|| r_type == R_X86_64_32S))))
func_pointer_ref = true;
+ else
+ h->pointer_equality_needed = 1;
}
if (!func_pointer_ref)
@@ -2242,6 +2244,23 @@ elf_x86_64_scan_relocs (bfd *abfd, struc
if (!h->def_regular
|| (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
h->plt.refcount = 1;
+
+ if (h->pointer_equality_needed
+ && h->type == STT_FUNC
+ && eh->def_protected
+ && elf_has_indirect_extern_access (h->root.u.def.section->owner))
+ {
+ /* Disallow non-canonical reference to canonical
+ protected function. */
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: non-canonical reference to canonical "
+ "protected function `%s' in %pB"),
+ abfd, h->root.root.string,
+ h->root.u.def.section->owner);
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
}
}

File diff suppressed because it is too large Load Diff

15
gating.yaml Normal file
View File

@ -0,0 +1,15 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: baseos-qe.koji-build.scratch-build.validation}
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

5
plans/ci.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: CI Gating Plan
discover:
how: fmf
execute:
how: tmt

View File

@ -1,2 +1,2 @@
SHA512 (binutils-2.33.1.tar.xz) = b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
SHA512 (binutils-2.38.tar.xz) = 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2

67
spec.binutils.cross Normal file
View File

@ -0,0 +1,67 @@
# Note - this is an rpm spec file, but it has been renamed in order to avoid
# conflict with the real binutils.spec file.
#
# Its only use is to build a set of cross-binutils rpms by putting it into
# the SPECS directory of an rpmbuild tree, installing the binutils source
# rpm into the SOURCES directory and then running:
#
# rpmbuild -bb spec.binutils.cross
Summary: A meta collection of GNU binutils executables for cross builds
Name: cross-binutils
License: GPLv3+
URL: https://sourceware.org/binutils
#----------------------------------------------------------------------------
#
# Configurable settings - adjust to match your needs:
#
Version: 2.30
Release: 89.el8
# The list of cross architectures to build.
# Note: this list assumes that we are building on an x86_64-linux-gnu host.
%define arch_list aarch64-linux-gnu ppc64le-linux-gnu s390x-linux-gnu
#----------------------------------------------------------------------------
%define binutils_source_rpm binutils-%{version}-%{release}.src.rpm
Source: %{binutils_source_rpm}
# Provides: bundled(libiberty)
BuildRequires: autoconf automake
BuildRequires: perl, sed, coreutils
BuildRequires: gcc, bison
BuildRequires: gettext, flex, zlib-devel
BuildRequires: findutils, texinfo
BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc
# BuildRequires: elfutils-debuginfod-client-devel
BuildRequires: rpm-build
#----------------------------------------------------------------------------
%description
Provides a collection of cross built binutils for the targets
supported by RHEL (aarch64, ppc64le, s390x).
#----------------------------------------------------------------------------
%build
# Install the binutils sources.
rpm -ivh %{_sourcedir}/%{binutils_source_rpm}
# Build each set of cross binutils individually.
for f in %{arch_list}; do
rpmbuild -bb --define "binutils_target $f" %{_specdir}/binutils.spec --without testsuite --without gold
done
#----------------------------------------------------------------------------
%changelog
* Wed Nov 11 2020 Nick Clifton <nickc@redhat.com> - 2.35.1-14
- First release of cross binutils rpm.

2
tests/README Normal file
View File

@ -0,0 +1,2 @@
The test's Makefiles are not used in Fedora CI infrastructure. But are kept here
for backward compatibility with traditional beakerlib test harness in RHEL.

View File

@ -0,0 +1,62 @@
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# Testcases for this bugzilla were provided by Jakub Jelinek <jakub@redhat.com>
# I've only wrapped them to RHTS
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=binutils
RELATIVE_PATH=bugzillas/241252
export TESTVERSION=1.0
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
.PHONY: all install download clean
FILES=$(METADATA) \
runtest.sh \
Makefile \
x.i \
y.i
run: $(FILES) #build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Regression test for bz241252." >> $(METADATA)
@echo "TestTime: 3m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME) gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "Releases: -RHEL4" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,12 @@
summary: Regression test for bz241252.
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc
duration: 3m
extra-summary: /tools/binutils/bugzillas/241252
extra-task: /tools/binutils/bugzillas/241252

View File

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp x.i y.i $TmpDir
rlRun "pushd $TmpDir"
rlRun "gcc -c -O2 -fpic -o x.o x.i -g" 0 "Compile test case 'x'"
rlRun "gcc -c -O2 -fpic -o y.o y.i -g" 0 "Compile test case 'y'"
rlRun "gcc -Wl,--unique -o x [xy].o" 0 "Link 'x' and 'y'"
# Note: debug_ranges replaced by debug_rnglist (since DWARF 5 in Fedora 34)
rlLogInfo 'x.o + y.o:'
rlLogInfo "$( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS )"
rlLogInfo 'x:'
rlLogInfo "$( readelf -WS x | grep debug_rnglist )"
rlPhaseEnd
rlPhaseStartTest Testing
if [ $( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS | wc -l ) -eq 2 ] \
&& [ $( readelf -WS x | grep debug_rnglist | wc -l ) -eq 1 ]; then
rlPass "Debug ranges sections were merged"
else
rlFail "Debug ranges sections were not merged"
fi
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlRun "popd"
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,62 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
foo (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}

View File

@ -0,0 +1,71 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
void bar (void *x)
{
}
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
baz (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}
int
main (void)
{
}

View File

@ -0,0 +1,82 @@
#
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Author: Michal Nowak <mnowak@redhat.com>
# The toplevel namespace within which the test lives.
TOPLEVEL_NAMESPACE=tools
# The name of the package under test:
PACKAGE_NAME=binutils
# The path of the test below the package:
RELATIVE_PATH=Sanity/430856-libbfd.a-not-compiled-with-fPIC
# Version of the Test. Used with make tag.
export TESTVERSION=1.1
# The combined namespace of the test.
export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
# A phony target is one that is not really the name of a file.
# It is just a name for some commands to be executed when you
# make an explicit request. There are two reasons to use a
# phony target: to avoid a conflict with a file of the same
# name, and to improve performance.
.PHONY: all install download clean
# executables to be built should be added here, they will be generated on the system under test.
BUILT_FILES=
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh Makefile PURPOSE bz430856.tar.gz
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ *.rpm $(BUILT_FILES)
# You may need to add other targets e.g. to build executables from source code
# Add them here:
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
# Change to the test owner's name
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: libbfd.a not compiled with -fPIC">> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
# add any other packages for which your test ought to run here
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)-devel" >> $(METADATA)
@echo "Requires: gcc glibc-headers" >> $(METADATA)
# add any other requirements for the script to run here
# You may need other fields here; see the documentation
rhts-lint $(METADATA)

View File

@ -0,0 +1,11 @@
Would it be possible to have /usr/lib64/libbfd.a in binutils
compiled with -fPIC? Otherwise, shared apps can't link against
libbfd. In binutils.spec, libiberty.a is already recreated
with -fPIC, is there some reason the same isn't done for
libbfd?
From binutils.spec:
# Rebuild libiberty.a with -fPIC
make -C libiberty clean
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" -C libiberty

View File

@ -0,0 +1,20 @@
summary: libbfd.a not compiled with -fPIC
description: "Would it be possible to have /usr/lib64/libbfd.a in binutils\ncompiled\
\ with -fPIC? Otherwise, shared apps can't link against\nlibbfd. In binutils.spec,\
\ libiberty.a is already recreated \nwith -fPIC, is there some reason the same\
\ isn't done for \nlibbfd?\n\nFrom binutils.spec:\n\n # Rebuild libiberty.a with\
\ -fPIC\n make -C libiberty clean\n make CFLAGS=\"-g -fPIC $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64\"\
\ -C libiberty\n"
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- binutils-devel
- gcc
- glibc-headers
duration: 5m
extra-summary: /tools/binutils/Sanity/430856-libbfd.a-not-compiled-with-fPIC
extra-task: /tools/binutils/Sanity/430856-libbfd.a-not-compiled-with-fPIC

View File

@ -0,0 +1,21 @@
CC=gcc
CFLAGS=-g -Wall
all: test
libbfdtest.so bfdtest: Makefile
libbfdtest.so: libbfdtest.c libbfdtest.h
$(CC) $(CFLAGS) -shared -o $@ -fPIC $< -lbfd -liberty
bfdtest: bfdtest.c libbfdtest.h libbfdtest.so
$(CC) -o $@ $< -L. -Wl,-rpath,. -lbfdtest -ldl
.PHONY: test
test: bfdtest
./$<
@echo OK
clean:
$(RM) libbfdtest.so bfdtest

View File

@ -0,0 +1,7 @@
#include "libbfdtest.h"
int
main (void)
{
return libbfdtest () ? 0 : 1;
}

View File

@ -0,0 +1,10 @@
#include <bfd.h>
#include "libbfdtest.h"
int
libbfdtest (void)
{
bfd_set_error (bfd_error_no_error);
return bfd_get_error () == bfd_error_no_error;
}

View File

@ -0,0 +1 @@
extern int libbfdtest (void);

View File

@ -0,0 +1,49 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp reproducer/* $TmpDir
rlRun "pushd $TmpDir"
rlRun "make clean" 0 "Make clean"
rlPhaseEnd
rlPhaseStartTest
rlRun "make" 0 "Build the files"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,85 @@
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Author: Michal Nowak <mnowak@redhat.com>
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Example Makefile for RHTS #
# This example is geared towards a test for a specific package #
# It does most of the work for you, but may require further coding #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# The toplevel namespace within which the test lives.
TOPLEVEL_NAMESPACE=tools
# The name of the package under test:
PACKAGE_NAME=binutils
# The path of the test below the package:
RELATIVE_PATH=Sanity/435078-output-of-strings-0-n-is-incorrect
# Version of the Test. Used with make tag.
export TESTVERSION=1.1
# The combined namespace of the test.
export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
# A phony target is one that is not really the name of a file.
# It is just a name for some commands to be executed when you
# make an explicit request. There are two reasons to use a
# phony target: to avoid a conflict with a file of the same
# name, and to improve performance.
.PHONY: all install download clean
# executables to be built should be added here, they will be generated on the system under test.
BUILT_FILES=
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh Makefile PURPOSE
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ *.rpm $(BUILT_FILES)
# You may need to add other targets e.g. to build executables from source code
# Add them here:
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
# Change to the test owner's name
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: The output of "strings -0 file" is in loop and "-n 0xA" cannot be correctly recognized">> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
# add any other packages for which your test ought to run here
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
# add any other requirements for the script to run here
# You may need other fields here; see the documentation
rhts-lint $(METADATA)

View File

@ -0,0 +1,2 @@
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"

View File

@ -0,0 +1,14 @@
summary: The output of strings -0 file is in loop and -n 0xA cannot be correctly recognized
description: |
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
duration: 5m
extra-summary: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect
extra-task: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect

View File

@ -0,0 +1,56 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "echo -e \"asdjkhsd\nsdsdsdssd\n\nsdsd\n\" > tstfile" 0 "Generating test file tstfile"
rlPhaseEnd
rlPhaseStartTest TestingOne
rlRun "strings -0 tstfile > errorfile 2>&1 &"
rlRun "sleep 5"
rlRun "jobs"
rlRun "kill -9 %1" 1 "strings in the loop"
rlAssertGrep "minim" errorfile
rlPhaseEnd
rlPhaseStartTest TestingTwo
rlRun "strings -n 0xA tstfile" 0 "echo \"PASS: tstfile processed.\""
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlBundleLogs "binutils-outputs" errorfile tstfile
rlRun "popd"
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,60 @@
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=binutils
RELATIVE_PATH=Sanity/480009-when-mistaking-argument-of-strings
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: When mistaking the argument of strings command , the same error message is output." >> $(METADATA)
@echo "Bug: 480009" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
@echo "Releases: -RHEL4 -RHEL5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,27 @@
[RHEL5.2]
# strings -n file1
strings: invalid integer argument file1
# strings --bytes file1
strings: invalid integer argument file1
# strings -n 0
strings: invalid number 0
# strings --bytes 0
strings: invalid number 0
[RHEL5.3]
# strings -n file1
strings: invalid minimum string length 0
# strings --bytes file1
strings: invalid minimum string length 0
# strings -n 0
strings: invalid minimum string length 0
# strings --bytes 0
strings: invalid minimum string length 0

View File

@ -0,0 +1,42 @@
summary: When mistaking the argument of strings command , the same error message is
output.
description: |+
[RHEL5.2]
# strings -n file1
strings: invalid integer argument file1
# strings --bytes file1
strings: invalid integer argument file1
# strings -n 0
strings: invalid number 0
# strings --bytes 0
strings: invalid number 0
[RHEL5.3]
# strings -n file1
strings: invalid minimum string length 0
# strings --bytes file1
strings: invalid minimum string length 0
# strings -n 0
strings: invalid minimum string length 0
# strings --bytes 0
strings: invalid minimum string length 0
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=480009
extra-summary: /tools/binutils/Sanity/480009-when-mistaking-argument-of-strings
extra-task: /tools/binutils/Sanity/480009-when-mistaking-argument-of-strings

View File

@ -0,0 +1,49 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# source the test script helpers
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE=binutils
rlJournalStart
rlPhaseStartSetup
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlPhaseEnd
rlPhaseStartTest "#1: strings -n file1"
rlRun "strings -n file1 2>&1 | grep 'invalid integer argument file1'" 0 "Produced expected error msg: 'strings: invalid integer argument file1'"
rlPhaseEnd
rlPhaseStartTest "#2: strings --bytes file1"
rlRun "strings --bytes file1 2>&1 | grep 'invalid integer argument file1'" 0 "Produced expected error msg: 'strings: invalid integer argument file1'"
rlPhaseEnd
rlPhaseStartTest "#3: strings -n 0"
rlRun "strings -n 0 2>&1 | grep 'invalid minimum string length 0'" 0 "Produced expected error msg: 'strings: invalid minimum string length 0'"
rlPhaseEnd
rlPhaseStartTest "#4: strings --bytes 0"
rlRun "strings --bytes 0 2>&1 | grep 'invalid minimum string length 0'" 0 "Produced expected error msg: 'strings: invalid minimum string length 0'"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,59 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regressions/readelf/509124-holes-in-debuginfo
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE ascend.C test.c
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: holes in debuginfo" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils gcc44 gcc gcc44-c++ gcc-c++" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 509124 499164" >> $(METADATA)
@echo "Releases: -RHEL4 -RHEL5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,14 @@
(1) readelf fix now posted upstream:
http://sourceware.org/ml/binutils/2009-07/msg00123.html
QA: New testcase: binutils-all/testranges.s
(2) gcc has been fixed based on this bugreport by Jakub upstream:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713
gcc44 backport request for RHEL-5.5 is: Bug 510958
(3) Going to be backported for RHEL-5.5 readelf.
It has been already fixed by Nick Clifton upstream:
http://sourceware.org/ml/binutils/2009-06/msg00418.html
http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html
QA: RHEL-only new testcase: binutils-all/testloc.S
as a part of binutils-all/readelf.exp (not shown when PASSing)

View File

@ -0,0 +1,15 @@
class A {
public:
A();
void f(){}
};
class C {
C();
};
C::C() {
A* p = new A;
p->f();
}

View File

@ -0,0 +1,25 @@
summary: holes in debuginfo
description: "(1) readelf fix now posted upstream:\n http://sourceware.org/ml/binutils/2009-07/msg00123.html\n\
QA: New testcase: binutils-all/testranges.s\n\n(2) gcc has been fixed based on\
\ this bugreport by Jakub upstream:\n http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713\n\
\ gcc44 backport request for RHEL-5.5 is: Bug 510958\n\n(3) Going to be backported\
\ for RHEL-5.5 readelf.\n It has been already fixed by Nick Clifton upstream:\n\
\ http://sourceware.org/ml/binutils/2009-06/msg00418.html\n http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html\n\
QA: RHEL-only new testcase: binutils-all/testloc.S\n as a part of binutils-all/readelf.exp\
\ (not shown when PASSing) \n"
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc44
- gcc
- gcc44-c++
- gcc-c++
duration: 15m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=509124
extra-summary: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo
extra-task: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo

View File

@ -0,0 +1,73 @@
#!/bin/bash
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author: Michal Nowak <mnowak@redhat.com>
#
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp ascend.C test.c $TmpDir
rlRun "pushd $TmpDir"
rlPhaseEnd
for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do
for opt in s $( seq 0 3 ); do
rlPhaseStartTest "ascend.C: gcc=$gcc opt=$opt"
rlRun "$gcc -O${opt} ascend.C -c -g"
rlAssertExists "ascend.o"
# kinda weird running readelf on .o file, but...
rlRun "readelf -a -w -W ./ascend.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output"
rlLog "$( cat readelf.errout.g++ )"
rlAssertNotGrep "readelf" readelf.errout.g++
rm -f ./ascend.o
rlPhaseEnd
done
done
for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do
for opt in s $( seq 0 3 ); do
rlPhaseStartTest "test.c: gcc=$gcc opt=$opt"
rlRun "$gcc -O${opt} test.c -c -g"
rlAssertExists "test.o"
# kinda weird running readelf on .o file, but...
rlRun "readelf -a -w -W ./test.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output"
rlLog "$( cat readelf.errout.g++ )"
rlAssertNotGrep "readelf" readelf.errout.g++
rm -f ./test.o
rlPhaseEnd
done
done
rlPhaseStartCleanup Cleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,14 @@
void f(int i) {
k(i);
}
void g(int i) {
int j[65537];
l(i,j);
}
struct s {
void (*m)(int i);
void (*n)(int i);
} t={f,g};

View File

@ -0,0 +1,59 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE bar.c foo.c
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: ld fails to merge different visibility for the same symbol in distinct object files" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils binutils220" >> $(METADATA)
@echo "Requires: binutils binutils220 gcc44 gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 531269" >> $(METADATA)
@echo "Architectures: i386 x86_64" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,19 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"),
visibility ("hidden"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1"), visibility ("hidden")))
bar ()
{
return 1;
}
int
get_foo ()
{
return foo;
}
int
get_bar ()
{
return bar ();
}

View File

@ -0,0 +1,7 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1")))
bar ()
{
return 1;
}

View File

@ -0,0 +1,19 @@
summary: ld fails to merge different visibility for the same symbol in distinct object
files
description: ''
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
- binutils220
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- binutils220
- gcc44
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531269
extra-summary: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
extra-task: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol

View File

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author: Michal Nowak <mnowak@redhat.com>
#
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
# Choose the compiler.
GCC=${GCC:-gcc}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp foo.c bar.c $TmpDir
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "gcc=$GCC Testing"
rlRun "$GCC -fPIC -c -o foo.o foo.c" 0 "Compile foo.c => foo.o"
rlRun "$GCC -fPIC -c -o bar.o bar.c" 0 "Compile bar.c => bar.o"
rlRun "ld -shared -o foobar.so foo.o bar.o" 0 "Link foo.o & bar.o => foobar.so"
rlAssertExists foobar.so
rm foobar.so foo.o bar.o
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/RELRO-protection-effective
# Description: bz1174826
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/RELRO-protection-effective
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: bz1174826" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1174826" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,34 @@
PURPOSE of /tools/binutils/Regression/RELRO-protection-effective
Description: bz1174826
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: RELRO is not read-only on PowerLE
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1174826
/*
* Test to exercise PIE and RELRO provided by Roland McGrath <roland@redhat.com>.
*
* Description:
* Simple test for RELRO, which happens to be a PIE too, but that's only
* because this kind of example has to be in PIC code to make RELRO relevant,
* and PIE makes it simpler to write a standalone one-file test than writing
* a DSO.
*
* The "const" makes "foo" .rodata material, and the init to an external symbol
* reference makes it require a data relocation. Enabling -z relro for this
* link puts that .rodata into a RELRO area. This program will crash because
* the page containing "foo" has been made read-only when "main" runs.
* Without RELRO, it would let you modify "foo" even though it's supposed to
* be const.
*
* Test with RELRO should fail:
* $ gcc -pie -fPIE -g -Wl,-z,relro -o relro relro.c
* $ ./relro
* Segmentation fault (core dumped)
*
* Test without RELRO should pass:
* $ gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c
* $ ./no-relro
*
**/

View File

@ -0,0 +1,43 @@
summary: bz1174826
description: "Bug summary: RELRO is not read-only on PowerLE\nBugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1174826\n\
\n/* \
\ \n * Test to exercise PIE and RELRO provided by Roland McGrath <roland@redhat.com>.\n\
\ * \
\ \n * Description: \
\ \n * Simple test for RELRO, which happens to be a PIE too,\
\ but that's only \n * because this kind of example has to be in PIC\
\ code to make RELRO relevant, \n * and PIE makes it simpler to write a standalone\
\ one-file test than writing \n * a DSO. \
\ \n * \
\ \n * The \"const\" makes \"\
foo\" .rodata material, and the init to an external symbol\n * reference makes\
\ it require a data relocation. Enabling -z relro for this \n * link puts\
\ that .rodata into a RELRO area. This program will crash because \n * the\
\ page containing \"foo\" has been made read-only when \"main\" runs. \
\ \n * Without RELRO, it would let you modify \"foo\" even though it's supposed\
\ to \n * be const. \
\ \n * \
\ \n * Test with RELRO should fail: \
\ \n * $ gcc -pie -fPIE -g -Wl,-z,relro -o relro\
\ relro.c \n * $ ./relro \
\ \n * Segmentation fault (core\
\ dumped) \n * \
\ \n * Test without\
\ RELRO should pass: \n * $\
\ gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c \
\ \n * $ ./no-relro \
\ \n * \
\ \n**/\n\n\n"
contact: Martin Cermak <mcermak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1174826
extra-summary: /tools/binutils/Regression/RELRO-protection-effective
extra-task: /tools/binutils/Regression/RELRO-protection-effective

View File

@ -0,0 +1,65 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/RELRO-protection-effective
# Description: bz1174826
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
touch /tmp/disable-qe-abrt
rlRun "TMPD=\$(mktemp -d)"
rlRun "pushd $TMPD"
cat > relro.c <<-EOF
#include <stdio.h>
void *const foo = &stdout;
int main (void)
{
*(void **) &foo = &stderr;
return 0;
}
EOF
rlRun "gcc -pie -fPIE -g -Wl,-z,relro -o relro relro.c"
rlRun "gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c"
rlPhaseEnd
rlPhaseStartTest
rlRun "./relro" 139
rlRun "./no-relro"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMPD"
rm -f /tmp/disable-qe-abrt
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
# Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1080077" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: [RFE] - Please configure ld.bfd to allow --sysroot
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1080077

View File

@ -0,0 +1,16 @@
summary: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
description: |
Bug summary: [RFE] - Please configure ld.bfd to allow --sysroot
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1080077
contact: Martin Cermak <mcermak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1080077
extra-summary: /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
extra-task: /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot

View File

@ -0,0 +1,39 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
# Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartTest
LD_BDF=$(which ld.bfd)
RPM=$(rpm -qf $LD_BDF)
rlLogInfo "ld.bfd is $LD_BDF of $RPM"
rlRun "ld.bfd --sysroot=/tmp |& grep 'not configured to use sysroots'" 1
rlRun "ld.bfd --sysroot=/tmp |& grep 'no input files'"
rlPhaseEnd
rlJournalEnd

View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
# Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE libtest.tar.gz
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Milos Prchlik <mprchlik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils" >> $(METADATA)
@echo "Requires: devtoolset-3.0-tools-devtoolset-3.0-Install-latest" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: yes" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1117458" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
Author: Milos Prchlik <mprchlik@redhat.com>
Bug summary: ld from devtoolset copies SONAME to DT_NEEDED without checking if its empty
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1117458

View File

@ -0,0 +1,3 @@
int foo(void) {
return 10;
}

View File

@ -0,0 +1,17 @@
summary: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
description: |
Bug summary: ld from devtoolset copies SONAME to DT_NEEDED without checking if its empty
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1117458
contact: Milos Prchlik <mprchlik@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1117458
extra-summary: /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
extra-task: /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED

View File

@ -0,0 +1,63 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
# Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp user.c libfoo.c $TmpDir/"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -fPIC -g -c libfoo.c"
rlAssertExists "libfoo.o"
rlRun "gcc -shared -Wl,-soname, -o libfoo.so -lc libfoo.o 2>&1 | tee out" 0
rlAssertExists "libfoo.so"
rlLogInfo "gcc output:"
rlLogInfo "$(cat out)"
rlAssertGrep "SONAME must not be empty string; ignored" out
rlRun "objdump -p libfoo.so | grep SONAME | awk '{print \$2}' > soname"
if [ "`stat -c '%s' soname`" != "0" ]; then
rlLogInfo "SONAME='$(cat soname)'"
rlFail "Detected SONAME is empty"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd" # $TmpDir
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,9 @@
#include <stdio.h>
extern int foo(void);
int main(void) {
int a = foo();
printf("a is %d\n", a);
return 0;
}

View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd
# Description: Test for BZ#1172766 (ppc64 segv in libbfd)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Milos Prchlik <mprchlik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1172766 (ppc64 segv in libbfd)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 30m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils kernel-debuginfo xz" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: yes" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1172766" >> $(METADATA)
@echo "Releases: RHEL7" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd
Description: Test for BZ#1172766 (ppc64 segv in libbfd)
Author: Milos Prchlik <mprchlik@redhat.com>
Bug summary: ppc64: segv in libbfd
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1172766

View File

@ -0,0 +1,20 @@
summary: Test for BZ#1172766 (ppc64 segv in libbfd)
description: |
Bug summary: ppc64: segv in libbfd
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1172766
contact: Milos Prchlik <mprchlik@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- elfutils
- koji
- kernel-debuginfo
- xz
duration: 30m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1172766
extra-summary: /tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd
extra-task: /tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd

View File

@ -0,0 +1,85 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/binutils/Regression/bz1172766-ppc64-segv-in-libbfd
# Description: Test for BZ#1172766 (ppc64 segv in libbfd)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="binutils"
REQUIRES="${REQUIRES:-kernel-debuginfo}"
__have_kernel_debuginfo () {
local RELEASE ARCH TEMPDIR
rlRun "RELEASE=$(uname -r)"
rlRun "ARCH=$(uname -i)"
if ! rpm -q kernel-debuginfo-$RELEASE &>/dev/null; then
rlLogInfo 'kernel-debuginfo not present, trying to install it'
rlRun "TEMPDIR=$(mktemp -d -p $HOME)" # $HOME to avoid "small" tmpfs
rlRun "pushd '$TEMPDIR'"
rlRun "koji download-build -q --debuginfo kernel-$RELEASE --arch $ARCH"
rlRun "dnf -y install ./kernel-debuginfo-*.rpm"
rlRun 'popd'
rlRun "rm -rf '$TEMPDIR'"
fi
rlAssertRpm kernel-debuginfo-$RELEASE
}
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "KERNEL=$(uname -a)"
__have_kernel_debuginfo
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "KERNEL_RELEASE=$(uname -r)"
rlRun "KMOD=/usr/lib/modules/$KERNEL_RELEASE/kernel/fs/nfsd/nfsd.ko"
rlRun "KMOD_XZ=$KMOD.xz"
rlRun "KMOD_DEBUG=/usr/lib/debug/$KMOD.debug"
rlAssertExists "$KMOD_DEBUG"
rlAssertExists "$KMOD_XZ"
[[ -e "$KMOD" ]] || rlRun "unxz -k $KMOD_XZ"
rlAssertExists "$KMOD"
rlPhaseEnd
rlPhaseStartTest
rlRun "eu-unstrip $KMOD $KMOD_DEBUG --output=$TmpDir/unstripped.ko"
rlRun "objdump -drS $TmpDir/unstripped.ko &> /dev/null"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,66 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/binutils/Regression/bz1226864-ld-crashes-on-ppc64-when-being-used-with-oformat
# Description: Test for BZ#1226864 (ld crashes on ppc64 when being used with --oformat)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regression/bz1226864-ld-crashes-on-ppc64-when-being-used-with-oformat
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE ldtest.S
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Milos Prchlik <mprchlik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1226864 (ld crashes on ppc64 when being used with --oformat)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: yes" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1226864" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
@echo "Architectures: x86_64 ppc64 ppc64le s390x" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /tools/binutils/Regression/bz1226864-ld-crashes-on-ppc64-when-being-used-with-oformat
Description: Test for BZ#1226864 (ld crashes on ppc64 when being used with --oformat)
Author: Milos Prchlik <mprchlik@redhat.com>
Bug summary: ld crashes on ppc64 when being used with --oformat binary
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1226864

View File

@ -0,0 +1,3 @@
.org 0x100
nop

Some files were not shown because too many files have changed in this diff Show More