| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update
commit 68c4956b1401de70173848a6bdf620cb42fa9358
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Apr 26 09:08:54 2022 -0700
x86: Properly handle function pointer reference
to properly handle IFUNC function pointer reference. Since IFUNC symbol
value is only known at run-time, set pointer_equality_needed for IFUNC
function pointer reference in PDE so that it will be resolved to its PLT
entry directly.
bfd/
PR ld/29216
* elf32-i386.c (elf_i386_scan_relocs): Set pointer_equality_needed
for IFUNC function pointer reference in PDE.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
ld/
PR ld/29216
* testsuite/ld-ifunc/ifunc.exp: Run PR ld/29216 test.
* testsuite/ld-ifunc/pr29216.c: New file.
(cherry picked from commit 98a1627f19ca125476d5d58d9999c7a8d381f403)
(cherry picked from commit e1ea1dafff64a9be37d275dbcfc71ef08ef84324)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Armv9-A SVE is mandatory, and for SVE FP16 is mandatory. This fixes a disconnect
between GCC and binutils where GCC has FP16 on by default and gas doesn't.
include/ChangeLog:
2022-05-16 Tamar Christina <tamar.christina@arm.com>
* opcode/aarch64.h (AARCH64_ARCH_V9_FEATURES): Add AARCH64_FEATURE_F16.
(cherry picked from commit e1e15284481896505eab0cbc556f2348ef8fffbf)
Signed-off-by: Tamar Christina <tamar.christina@arm.com>
(cherry picked from commit ffc7aa903b9789440b380ff1a9f2a93880477252)
|
|
|
|
|
|
|
|
| |
PR 29142
* ar.c (main): Properly handle libdeps for zero file_count.
(cherry picked from commit fa445221958a9b8c8c4a804a339bc54cedfd83b9)
(cherry picked from commit 3d549e5ccc0cc0615bc340073078b660399c915e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before the change tc-m68k maintained a list of seen labels.
Alignment check traversed label list to resolve symbol to label.
This caused quadratic slowdown as each symbol was checked against
each label. Worst affected files are the ones built with debugging
enabled as DWARF generates many labels.
The change embeds auxiliary label information right into symbol using
TC_SYMFIELD_TYPE.
Before the change test from PR 29058 did not finish in 10 minutes. After
the change it finishes in 2 seconds.
gas/ChangeLog:
PR 29058
* config/tc-m68k.h (TC_SYMFIELD_TYPE): define as m68k_tc_sy.
* config/tc-m68k.c (m68k_frob_label): Use TC_SYMFIELD_TYPE to
store label information.
(cherry picked from commit c641fe0dcb886dc1b8a235ab2b236275ee46510a)
(cherry picked from commit c473aa1b9d85e08a4620a16f755eb047d3216d85)
|
|
|
|
|
|
|
|
|
|
| |
powerpc-linux, and I suspect other 32-bit targets, report "aligned at
0x4" for this test.
* testsuite/ld-ctf/nonrepresentable.d: Accept any alignment.
(cherry picked from commit db120fb808dc24538e89b851d6dda1890aad5a1f)
(cherry picked from commit 8d1187516e31cdf25edc0366e837e171c50e8af9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update
commit ebb191adac4ab45498dec0bfaac62f0a33537ba4
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Feb 9 15:51:22 2022 -0800
x86: Disallow invalid relocation against protected symbol
to allow function pointer reference and make sure that PLT entry isn't
used for function reference due to function pointer reference.
bfd/
PR ld/29087
* elf32-i386.c (elf_i386_scan_relocs): Don't set
pointer_equality_needed nor check non-canonical reference for
function pointer reference.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
ld/
PR ld/29087
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/29087 tests.
* testsuite/ld-x86-64/protected-func-3.c: New file.
(cherry picked from commit 68c4956b1401de70173848a6bdf620cb42fa9358)
(cherry picked from commit 9c67f6382ac2c90fbde5729feaf7d59ce662147a)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
bfd/
elf64-s390.c (elf_s390_size_dynamic_sections):
Enforce DT_JMPREL via htab->elf.dt_jmprel_required.
(cherry picked from commit d942d8db12adf4c9e5c7d9ed6496a779ece7149e)
(cherry picked from commit 9a01457e02e7bb594ff9a9ac62a38c909e2e3083)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No dynamic relocs are needed for TLS defined in an executable, the
TP relative offset is known at link time.
Fixes
FAIL: Build pr22263-1
bfd/
PR ld/22263
* elf64-s390.c (elf_s390_tls_transition): Use bfd_link_dll
instead of bfd_link_pic for TLS.
(elf_s390_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(elf_s390_relocate_section): Likewise.
(cherry picked from commit 26b1426577b5dcb32d149c64cca3e603b81948a9)
(cherry picked from commit 82a5bb730a16f8c7962568030268e784b4fb42c8)
|
|
|
|
| |
(cherry picked from commit d54081c642ac0f3bd2d057fdbccebd2163c91233)
|
|
|
|
|
|
|
|
| |
So far z16 was identified as arch14. After the machine has been
announced we can now add the real name.
(cherry picked from commit 69341966def7f6551bc4452684136831d6a6941c)
(cherry picked from commit fb4d148004f28494e9fb5d2400a13308d07a7988)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The last section in a CTF dict is the string table, at an offset
represented by the cth_stroff header field. Its length is recorded in
the next field, cth_strlen, and the two added together are taken as the
size of the CTF dict. Upon opening a dict, we check that none of the
header offsets exceed this size, and we check when uncompressing a
compressed dict that the result of the uncompression is the same length:
but CTF dicts need not be compressed, and short ones are not.
Uncompressed dicts just use the ctf_size without checking it. This
field is thankfully almost unused: it is mostly used when reserializing
a dict, which can't be done to dicts read off disk since they're
read-only.
However, when opening an uncompressed foreign-endian dict we have to
copy it out of the mmaped region it is stored in so we can endian-
swap it, and we use ctf_size when doing that. When the cth_strlen is
corrupt, this can overrun.
Fix this by checking the ctf_size in all uncompressed cases, just as we
already do in the compressed case. Add a new test.
This came to light because various corrupted-CTF raw-asm tests had an
incorrect cth_strlen: fix all of them so they produce the expected
error again.
libctf/
PR libctf/28933
* ctf-open.c (ctf_bufopen_internal): Always check uncompressed
CTF dict sizes against the section size in case the cth_strlen is
corrupt.
ld/
PR libctf/28933
* testsuite/ld-ctf/diag-strlen-invalid.*: New test,
derived from diag-cttname-invalid.s.
* testsuite/ld-ctf/diag-cttname-invalid.s: Fix incorrect cth_strlen.
* testsuite/ld-ctf/diag-cttname-null.s: Likewise.
* testsuite/ld-ctf/diag-cuname.s: Likewise.
* testsuite/ld-ctf/diag-parlabel.s: Likewise.
* testsuite/ld-ctf/diag-parname.s: Likewise.
(cherry picked from commit 975b5540232ffe37c6c2ce37fa2b480c2d6cc0ab)
|
|
|
|
|
|
|
|
| |
PR 28885
* dlltool.c (main): use imp_name rather than dll_name when
generating a temporary file name.
(cherry picked from commit 99852365513266afdd793289813e8e565186c9e6)
|
|
|
|
| |
(cherry picked from commit 210bf1d622569a71c4b734909297c47a6785004d)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without a -M cpu option given, powerpc objdump defaults currently to
-Mpower10 but -Many is also given. Commit 1ff6a3b8e562 regressed
-Many disassembly of instructions that are encoded differently
depending on cpu, such as mftb which has pre- and post-power4
encodings.
PR 28959
* ppc-dis.c (lookup_powerpc): Revert 2021-05-28 change. Instead
only look at deprecated PPC_OPCODE_RAW bit when -Many.
(cherry picked from commit b508e46bf9c5b2cef5821b399dfc3b8009a81836)
(cherry picked from commit fcf60fe8482346f543efdc4879a34c6bbd9cfea9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Section addresses can change between ppc64_elf_size_stubs and
ppc64_elf_build_stubs due to .eh_frame editing. The idea of stashing
r_offset final addresses calculated in ppc64_elf_size_stubs for use by
ppc64_elf_build_stubs was never a good idea. Instead, we need to keep
section/offset pairs.
* elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr.
Add relr section/offset array.
(append_relr_off): Rewrite. Update all callers.
(sort_relr): New function.
(ppc64_elf_size_stubs): Adjust to suit new relative reloc stash.
(ppc64_elf_build_stubs): Likewise.
(cherry picked from commit 0aac2413d39d9f6d9e6879a0daa6bd5dea3e0fe3)
(cherry picked from commit e26ff4b5a90a67fc440052f6101464939347b1f2)
(cherry picked from commit e4a35c7319628045302d4c597cb27f1b0a08c858)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
elf64-ppc.c: In function 'ppc64_elf_size_dynamic_sections':
elf64-ppc.c:10309:45: error: value computed is not used [-Werror=unused-value]
++lgot_ents, ++lgot_masks, isym != NULL && isym++)
It is of course a silly warning, fixed in later versions of gcc. I
wrote "isym != NULL && isym++" rather than the simpler "isym++" to
stop sanitisers complaining about incrementing a NULL pointer. isym
is of course unused in any code path where it might start off as
NULL. Sometimes you can't win. So don't try to be clever in reading
local symbols only when needed. 99 times out of 100 they will be
cached anyway.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Avoid annoying
warnings by always reading local syms.
(ppc64_elf_layout_multitoc): Likewise.
(cherry picked from commit c9fecd62838e481d9902a7fba42a6928370c9b10)
(cherry picked from commit 7183434818ec77ff8d81063c4cd2a5083f89f30a)
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 48e3e6aec8a4f37d00ea6c0da3ab45e76490e3db.
PR 28929
* archive.c (_bfd_get_elt_at_filepos): Don't check thin archive
element file size.
(cherry picked from commit 581c5ba435538c23fe63d6884ff885b7ef333568)
(cherry picked from commit 2d92604cd30a254d6a8dcba206b8baba10ed51c7)
|
|
|
|
|
|
|
|
|
|
| |
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.
(cherry picked from commit cebc89b9328eab994f6b0314c263f94e7949a553)
(cherry picked from commit ed9b2e40ebffec835d63473367da8dd8f80d7d5b)
|
|
|
|
| |
(cherry picked from commit 40d32f56f6320bcd11a0d104d54dd667ab3d4d1c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't change indirect symbol defined in IR to undefined if it is
referenced from shared object.
bfd/
PR ld/28879
* elflink.c (_bfd_elf_merge_symbol): Don't change indirect
symbol defined in IR to undefined if it is referenced from
shared object.
ld/
PR ld/28879
* testsuite/ld-plugin/lto.exp: Run PR ld/28879 tests.
* testsuite/ld-plugin/pr28879a.cc: New file.
* testsuite/ld-plugin/pr28879b.cc: Likewise.
(cherry picked from commit 20ea3acc727f3be6322dfbd881e506873535231d)
(cherry picked from commit 6aa1b7df2fc435ba1b744f20db5c6d3013496249)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
in read-only section.
bfd/
PR ld/28894
* elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
R_386_TLS_IE.
ld/
PR ld/28894
* testsuite/ld-i386/i386.exp: Run pr28894.
* testsuite/ld-i386/pr28894.d: New file.
* testsuite/ld-i386/pr28894.s: Likewise.
(cherry picked from commit 3319ba7a8d6a42ba071d691789bc184632399331)
(cherry picked from commit ae1cab7d3f39686d9c7ddadbac297e9ae76ffccf)
|
|
|
|
|
|
|
|
| |
PR 28882
* elf/loongarch.h: Replace binary literals with hex.
(cherry picked from commit ccbaaa36174c2c3184344ee0e6db648491149a33)
(cherry picked from commit df9071487a8ff69370e932a1522054a69fa7cbb1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I am checking this into master and will backport it to 2.38 branch.
H.J
----
On x86, GCC 12 supports -mno-direct-extern-access to enable canonical
reference to protected function and disable copy relocation. With
-mno-direct-extern-access, the canonical protected function symbols must
be accessed via canonical reference and the protected data symbols in
shared libraries are non-copyable. Under glibc 2.35, non-canonical
reference to the canonical protected function will get the run-time error:
./y: internal_f: ./libfoo.so: non-canonical reference to canonical protected function
and copy relocations against the non-copyable protected symbols will get
the run-time error:
./x: internal_i: ./libfoo.so: copy relocation against non-copyable protected symbol
Update x86 linker to disallow non-canonical reference to the canonical
protected function:
ld: plt.o: non-canonical reference to canonical protected function `internal_f' in libfoo.so
ld: failed to set dynamic section sizes: bad value
and copy relocation against the non-copyable protected symbol:
ld: main.o: copy relocation against non-copyable protected symbol `internal_i' in libfoo.so
at link-time.
bfd/
PR ld/28875
* elf-properties.c (_bfd_elf_parse_gnu_properties): Don't skip
shared libraries for GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
* elf32-i386.c (elf_i386_scan_relocs): Disallow non-canonical
reference to canonical protected function.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Don't allow copy
relocation against non-copyable protected symbol.
ld/
PR ld/28875
* testsuite/ld-i386/i386.exp: Check non-canonical reference to
canonical protected function and check copy relocation against
non-copyable protected symbol.
* testsuite/ld-i386/pr21997-1.err: New file.
* testsuite/ld-i386/pr28875.err: Likewise.
* testsuite/ld-i386/pr28875a.c: Likewise.
* testsuite/ld-i386/pr28875b.c: Likewise.
* testsuite/ld-x86-64/pr21997-1a.err: Updated.
* testsuite/ld-x86-64/pr21997-1b.err: Likewise.
* testsuite/ld-x86-64/pr28875-data.err: New file.
* testsuite/ld-x86-64/pr28875-func.err: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Check non-canonical reference
to canonical protected function and check copy relocation against
non-copyable protected symbol.
(cherry picked from commit ebb191adac4ab45498dec0bfaac62f0a33537ba4)
(cherry picked from commit caa6172de4b5100c9b45fd03eae714167a6085c1)
|
|
|
|
|
|
|
|
|
|
| |
It seems like either the tests or ld.gold in general cannot handle
compilers built with --enable-default-pie. No fix yet, so let's ignore
these test failures for the moment. For details see the linked bugs.
Bug: https://bugs.gentoo.org/684046
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22755
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--with-extra-soversion-suffix= will allow Gentoo to
distinct libbfd.so and libopcodes.so to have more precise
SONAME.
Today --enable-targets=all and --enable-64-bit-bfd change
libbfd.so ABI:
--enable-targets=all adds new symbols to the library
--enable-64-bit-bfd modifies BFD_ARCH_SIZE default and
changes sizes of integer parameters and fields to most
APIs.
--with-extra-soversion-suffix= will allow Gentoo to inject
additional keys into SONAME to indicate ABI change and avoid
hard to diagnose crashes when user reinstalls libbfd.so
built with different flags (see https://bugs.gentoo.org/663690).
Bug: https://bugs.gentoo.org/666100
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Ported to binutils 2.37 Andreas K. Hüttel <dilfridge@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will install a PIC version of libiberty.a by overwriting the non-PIC
version of libiberty.a while compiling. We do this because there is no
shared version of libiberty for random apps to link against which means if
someone wants to use this in a shared library or PIE, they're out of luck.
It's arguable whether people should be able to use this in a shared lib,
but usage in PIE should be fine. You could argue that this penalizes the
non-PIE users, but the counter point is that people using this library in
general are fairly low, and we'd rather have things work for all of them.
(cherry picked from commit 112aff9ad3e2675556370c4281117a6df0a879d9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is based on the old CodeSourcery patch written by Joseph Myers to add
support to the link for detecting & rejecting bad -L paths when using a
cross-compiler. The differences here:
* The command line flags are always available.
* We can turn on & off the warning via the command line.
* The configure option controls the default warning behavior.
* Add support for gold.
It is not currently upstream, nor has it been submitted at all. There are
no plans to do so currently either.
BUG=chromium:488360
TEST=`cbuildbot chromiumos-sdk` passes # tests arm/amd64/mipsel/x86
TEST=`cbuildbot panther_moblab-full whirlwind-release` pass
TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures
TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)
Reviewed-on: https://chromium-review.googlesource.com/272083
(cherry picked from commit f92dbf35c00ab13cee36f6be8ae5ca46454d9000)
Ported to binutils 2.37 Andreas K. Hütte <dilfridge@gentoo.org>
|
|
|
|
| |
(cherry picked from commit d9198f9316553eab6093e46372599ce778429185)
|
|
|
|
| |
This reverts commit e98beab54f5eb6ee00a1d6559d6d7e7058ecdc90.
|
|
|
|
| |
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The extension version checking logic is really just too complicated to
encode into the linker, trying to do so causes more harm than good.
This removes the checks and the associated tests, leaving the logic to
keep the largest version of each extension linked into the target.
bfd/
* elfnn-riscv.c (riscv_version_mismatch): Rename to
riscv_update_subset_version, and stop reporting warnings on
version mismatches.
(riscv_merge_std_ext): Adjust calls to riscv_version_mismatch.
(riscv_merge_multi_letter_ext): Likewise.
ld/
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Remove
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: New test.
* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p0.s:
Likewise.
* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p1.s:
Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Remove obselete
attr-merge-arch-failed-{01,02}, replace with
attr-merge-user-ext-01.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GOT32 relocations are allowed since absolute value + addend is stored in
the GOT slot.
Tested on glibc 2.35 build with GCC 11.2 and -Os.
bfd/
PR ld/28870
* elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
relocations.
ld/
PR ld/28870
* testsuite/ld-i386/i386.exp: Run pr28870.
* testsuite/ld-i386/pr28870.d: New file.
* testsuite/ld-i386/pr28870.s: Likewise.
(cherry picked from commit 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2f83249c13d86065b4c7cdb198ea871017b4bba1.
PR ld/28743
* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
* testsuite/ld-i386/pr20830.d: Likewise.
* testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
* testsuite/ld-x86-64/pr14207.d: Likewise.
* testsuite/ld-x86-64/pr18176.d: Likewise.
* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
* testsuite/ld-x86-64/pr20830a.d: Likewise.
* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
* testsuite/ld-x86-64/pr20830b.d: Likewise.
* testsuite/ld-x86-64/pr21038a-now.d: Likewise.
* testsuite/ld-x86-64/pr21038a.d: Likewise.
* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c.d: Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018.
PR ld/28743
PR ld/28819
* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
testsuite/ld-x86-64/pr28743-1.d: Likewise.
testsuite/ld-x86-64/pr28743-1.s: Likewise.
testsuite/ld-x86-64/x86-64.exp: Likewise.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Don't abort for undefined symbol when finishing DT_RELR. Instead, skip
undefined symbol. Undefined symbol will be reported by relocate_section.
* elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Skip
undefined symbol in finishing phase.
(cherry picked from commit a9e61227c09c03d5cb54f9c88520baffc1d86c86)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This testcase triggers a stub sizing error with the patches applied
for PR28743 (commit 2f83249c13d8 and c804c6f98d34).
PR 28827
* testsuite/ld-powerpc/pr28827-1.s,
* testsuite/ld-powerpc/pr28827-1.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.
(cherry picked from commit 9810db10f726f47c8e878ca4b0b4b4f5e9c16a5d)
(cherry picked from commit 0acf434a23768449cbb4b3732355f3f2febecaee)
|
|
|
|
|
|
|
|
|
|
| |
binutils/
* testsuite/lib/binutils-common.exp (run_dump_test): Reference
global SIZE and SIZEFLAGS.
ld/
* testsuite/config/default.exp: Define SIZE and SIZEFLAGS.
(cherry picked from commit cd8adbf3017272877c7e196e2e326f888f207bd9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current code detects the need for PT_GNU_EH_FRAME using a field set by
_bfd_elf_discard_section_eh_frame_hdr, which is called fairly late in
the linking process. Use the elf hash table eh_info instead, which is
set up earlier by size_dynamic_sections.
* elf-bfd.h (struct output_elf_obj_tdata): Delete eh_frame_hdr.
(elf_eh_frame_hdr): Don't define.
(_bfd_elf_discard_section_eh_frame_hdr): Update prototype.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Delete
abfd parameter. Don't set elf_eh_frame_hdr.
* elf.c (elf_eh_frame_hdr): New function.
(get_program_header_size): Adjust elf_eh_frame_hdr call.
(_bfd_elf_map_sections_to_segments): Likewise.
(cherry picked from commit 8df52eeeb06efcccd6b840689ad8e11ebb264e7f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Supporting -static-pie on PowerPC64 requires the linker to properly
treat SHN_ABS symbols for cases like glibc's _nl_current_LC_CTYPE_used
absolute symbol. I've been slow to fix the linker on powerpc because
there is some chance that this will break some shared libraries or
PIEs.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Consolidate local sym
handling code. Don't count dyn relocs against non-dynamic
absolute symbols.
(dec_dynrel_count): Adjust to suit.
(ppc64_elf_edit_toc): Don't remove entries for absolute symbols
when pic.
(allocate_got): Don't allocate space for got relocs against
non-dynamic absolute syms.
(ppc64_elf_layout_multitoc): Likewise.
(got_and_plt_relr): Likewise.
(ppc64_elf_size_dynamic_sections): Likewise for local got.
(got_and_plt_relr_for_local_syms): Likewise.
(ppc64_elf_size_stubs): Don't allocate space for relr either.
(ppc64_elf_relocate_section): Don't write relocs against non-dynamic
absolute symbols. Don't optimise got and toc code sequences
loading absolute symbol entries.
ld/
* testsuite/ld-powerpc/abs-reloc.s,
* testsuite/ld-powerpc/abs-static.d,
* testsuite/ld-powerpc/abs-static.r,
* testsuite/ld-powerpc/abs-pie.d,
* testsuite/ld-powerpc/abs-pie.r,
* testsuite/ld-powerpc/abs-shared.d,
* testsuite/ld-powerpc/abs-shared.r,
* testsuite/ld-powerpc/abs-pie-relr.d,
* testsuite/ld-powerpc/abs-pie-relr.r,
* testsuite/ld-powerpc/abs-shared-relr.d,
* testsuite/ld-powerpc/abs-shared-relr.r: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
(cherry picked from commit 3a3a4c1fe4ccb1914d29fbf8f5930d55aacec78f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The assertion is this one in ppc_build_one_stub
BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
It is checking that a stub doesn't overwrite the tail of a previous
stub, so not something trivial.
Normally, stub sizing iterates until no stubs are added, detected by
no change in stub section size. Iteration also continues if no stubs
are added but one or more stubs increases in size, which also can be
detected by a change in stub section size. But there is a
pathological case where stub section sizing decreases one iteration
then increases the next. To handle that situation, stub sizing also
stops at more than STUB_SHRINK_ITER (20) iterations when calculated
stub section size is smaller. The previous larger size is kept for
the actual layout (so that building the stubs, which behaves like
another iteration of stub sizing, will see the stub section sizes
shrink). The problem with that stopping condition is that it assumes
that stub sizing is only affected by addresses external to the stub
sections, which isn't always true.
This patch fixes that by also keeping larger individual stub_offset
addresses past STUB_SHRINK_ITER. It also catches a further
pathological case where one stub shrinks and another expands in such a
way that no stub section size change is seen.
PR 28827
* elf64-ppc.c (struct ppc_link_hash_table): Add stub_changed.
(STUB_SHRINK_ITER): Move earlier in file.
(ppc_size_one_stub): Detect any change in stub_offset. Keep
larger one if past STUB_SHRINK_ITER.
(ppc64_elf_size_stubs): Iterate on stub_changed too.
(cherry picked from commit 0441f94fba61998b4bd18487aacf70a672df099c)
Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
The previous patch wasn't quite correct. The size and padding depends
on offset used in the current iteration, and if we're fudging the
offset past STUB_SHRINK_ITER then we'd better use that offset. We
can't have plt_stub_pad using stub_sec->size as the offset.
PR 28827
* elf64-ppc.c (plt_stub_pad): Add stub_off param.
(ppc_size_one_stub): Set up stub_offset to value used in this
iteration before sizing the stub. Adjust plt_stub_pad calls.
(cherry picked from commit 2405fc4016feadea33cb747d5654514f62b74ff4)
Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
In trying to find a testcase for PR28827, I managed to hit a linker
error in bfd_set_section_contents with a .branch_lt input section
being too large for the output .branch_lt.
bfd/
PR 28827
* elf64-ppc.c (ppc64_elf_size_stubs): Set section size to
maxsize past STUB_SHRINK_ITER before laying out. Remove now
unnecessary conditional setting of maxsize at start of loop.
ld/
* testsuite/ld-powerpc/pr28827-2.d,
* testsuite/ld-powerpc/pr28827-2.lnk,
* testsuite/ld-powerpc/pr28827-2.s: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.
(cherry picked from commit 9ff8aa7d418bc508dbd429576b93e30ed9dc5891)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using a symbol other than .TOC. with @tocbase is an extension to the
ABI. It is never valid to use a symbol without a definition in the
binary, and symbols on these expressions cannot be overridden. Make
this explicit by using ".hidden" in the testcase.
* testsuite/ld-powerpc/symtocbase-1.s: Align data. Make function
entry symbol hidden.
* testsuite/ld-powerpc/symtocbase-2.s: Likewise.
* testsuite/ld-powerpc/symtocbase.d: Adjust expected output.
(cherry picked from commit ef5684c2bdf4d4f9975650e3b7b8f9b0ff98abee)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Peilin Ye <peilin.ye@bytedance.com>
objcopy's --only-keep-debug option has been broken for ELF files since
commit 8c803a2dd7d3.
1. binutils/objcopy.c:setup_section() marks non-debug sections as
SHT_NOBITS, then calls bfd_copy_private_section_data();
2. If ISEC and OSEC share the same section flags,
bfd/elf.c:_bfd_elf_init_private_section_data() restores OSEC's
section type back to ISEC's section type, effectively undoing
"make_nobits".
* objcopy.c (setup_section): Act on make_nobits after calling
bfd_copy_private_section_data.
(cherry picked from commit 7c4643efe7befea8e5063e8b56c0400fd8cee2d5)
|
|
|
|
|
|
|
|
|
| |
Fallout from commit e86fc4a5bc37
PR 28826
* coffgen.c (coff_write_alien_symbol): Init dummy to zeros.
(cherry picked from commit 07c9f243b3a12cc6749bc02ee7b165859979348b)
|