aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
4 daysbuild error with 32-bit host and 64-bit time_tAlan Modra1-2/+2
A fix for commit c4fce3ef2927.
5 daystestsuite: fix typo in bti-plt-1-b.d testYury Khrustalev1-1/+1
This test is not supposed to use -z force-bti
5 daysaarch64: ld: add tests for combination of bti and memory-sealYury Khrustalev2-0/+59
Both BTI and memory sealing require use of GNU properties and we should check that there is no interference.
8 daysPR 32871 ld/ldmain.c#L425 incorrect location of #endifAlan Modra1-1/+1
Fix commit c4fce3ef2927 brace position.
8 daysRe: ld: Skip the LTO archive member only for the earlier DSOAlan Modra1-10/+10
Add -fPIC when compiling the test, to fix complaints on some targets about certains relocation not being valid for shared libraries.
8 daysld/PE: restrict non-zero default DLL characteristics to MinGWJan Beulich3-18/+25
While commit ef6379e16dd1 ("Set the default DLL chracteristics to 0 for Cygwin based targets") tried to undo the too broad earlier 514b4e191d5f ("Change the default characteristics of DLLs built by the linker to more secure settings"), it didn't go quite far enough. Apparently the assumption was that if it's not MinGW, it must be Cygwin. Whether it really is okay to default three of the flags to non-zero on MinGW also remains unclear - sadly neither of the commits came with any description whatsoever. (Documentation also wasn't updated to indicate the restored default.) Setting effectively any of the DLL characteristics flags depends on properties of the binary being linked. While defaulting to "more secure" is a fair goal, it's only the programmer who can know whether their code is actually compatible with the respective settings. On the assumption that the change of defaults was indeed deliberate (and justifiable) for MinGW, limit them to just that. In particular, don't default any of the flags to set also for non-MinGW, non-Cygwin targets, like e.g. UEFI. At least the mere applicability of the high-entropy-VA bit is pretty questionable there in the first place - UEFI applications, after all, run in "physical mode", i.e. either unpaged or (where paging is a requirement, like for x86-64) direct-mapped. The situation is particularly problematic with NX-compat: Many UEFI implementations respect the "physical mode" property, where permissions can't be enforced anyway. Some, like reportedly OVMF, even have a build option to behave either way. Hence successfully testing a UEFI binary on any number of systems does not guarantee it won't crash elsewhere if the flag is wrongly set. Get rid of excess semicolons as well.
12 daysld: Skip the LTO archive member only for the earlier DSOH.J. Lu6-0/+64
commit 2707d55e539ef323dd14a1293e762bf3d9739ee7 Author: Michael Matz <matz@suse.de> Date: Mon Mar 31 15:57:08 2025 +0200 skipped the LTO archive member even when the earlier item is also an archive. Instead, skip the LTO archive member only if the earlier item is a shared library. bfd/ PR ld/32846 PR ld/32854 * elflink.c (elf_link_add_archive_symbols): Skip the LTO archive member only if the earlier item is a shared library. ld/ PR ld/32846 PR ld/32854 * testsuite/ld-plugin/lto.exp: Run ld/32846 test. * testsuite/ld-plugin/pr32846a.c: New file. * testsuite/ld-plugin/pr32846b.c: Likewise. * testsuite/ld-plugin/pr32846c.c: Likewise. * testsuite/ld-plugin/pr32846d.c: Likewise. * testsuite/ld-plugin/pr32846e.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-07[lto] Fix symlookup in archives vs sharedMichael Matz4-0/+24
when a shared library defines 'foo@@FOO' (default version), a static archive defines 'foo', the shared lib comes in front of the archive and under effect of --as-needed, and the requesting object file uses LTO, then the link editor was wrongly including the definition from the static archive. It must use the one from the shared lib, like in the non-LTO or the --no-as-needed case. See the added testcase that would wrongly print "FAIL" before this patch. The problem stems from several connected problems: (1) only the decorated symbol was entered into first_hash (the hash table designed to handle definition order in the pre-LTO-plugin phase of the symbol table walks) (2) in the archive symbol walk only the undecorated name would be looked up in first_hash (and hence not found due to (1)) (3) in the archive symbol walk first_hash would only be consulted when the linker hash table had a defined symbol. In pre-LTO phase shared lib symbols aren't entered into the linker symbol table. So: add also the undecorated name into first_hash when it stems from a default version and consult first_hash in the archive walker also for currently undefined symbols. If it has an entry which doesn't point to the archive, then it comes from an earlier library (shared or static), and so _this_ archive won't provide the definition.
2025-04-07bfd/COFF: drop link_add_one_symbol() hookJan Beulich1-3/+3
The need for this has disappeared with dc12032bca08 ("Remove m68k-aout and m68k-coff support"); avoid the unnecessary indirection. Sadly, with ld/pe-dll.c using the wrapper, the removal requires moving the declaration out of libcoff.h, to properly export the underlying BFD function.
2025-04-03ld/testsuite/ld-pe: Escape dots in regular expressionsLIU Hao1-4/+4
Signed-off-by: LIU Hao <lh_mouse@126.com> ld/ChangeLog: * testsuite/ld-pe/secidx.d: Escape dots in regular expressions.
2025-04-02Add optional filename argument to the linker's --stats option, allowing ↵Nick Clifton14-28/+622
extra resource use information to be reported.
2025-03-31ld/PE: Add another mingw UCRT library name to the autoexport exclusion listMartin Storsjö1-0/+1
Since 2020, mingw-w64 provides a C runtime import library variant named "libucrtapp" too, exclude this one from autoexports like the others. Signed-off-by: Martin Storsjö <martin@martin.st>
2025-03-28x86: Pass $NOPIE_LDFLAGS to undefined weak testsJens Remus1-2/+2
Some distributions configure GCC with --enable-default-pie, so that it defaults to compile with -fPIE and link with -pie, which is unexpected by some of the tests. Therefore link the PDE test programs with $NOPIE_LDFLAGS to disable PIE. This complements commit a7eaf017f959 ("Use NOPIE_CFLAGS and NOPIE_LDFLAGS to disable PIE"). ld/testsuite/ PR ld/21090 * ld-x86-64/x86-64.exp (undefined_weak): Use NOPIE_LDFLAGS to disable PIE for the non-PIE versions of the test. Bug: https://sourceware.org/PR21090 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-28ld: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF visibility testsJens Remus1-7/+9
Some distributions configure GCC with --enable-default-pie, so that it defaults to compile with -fPIE and link with -pie, which is unexpected by the test. Therefore compile the non-PIC sources with $NOPIE_CFLAGS and link the test programs with $NOPIE_LDFLAGS. Commit 922109c71828 ("Pass $NOPIE_CFLAGS to ELF visibility tests") added $NOPIE_CFLAGS when compiling sh1np.o and sh2np.o. It missed to add it to mainnp.o. ld/testsuite/ PR ld/21090 * ld-vsb/vsb.exp (visibility_test): Add support for optional ldflags argument and use it when linking the test program. (mainnp.o): Compile with $NOPIE_CFLAGS. (vnp, vp, vmpnp, vmpp): Link with $NOPIE_LDFLAGS. Fixes: 922109c71828 ("Pass $NOPIE_CFLAGS to ELF visibility tests") Bug: https://sourceware.org/PR21090 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-28ld: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to even more ELF shared testsJens Remus1-16/+18
Some distributions configure GCC with --enable-default-pie, so that it defaults to compile with -fPIE and link with -pie, which is unexpected by the test. Therefore compile the non-PIC sources with $NOPIE_CFLAGS and link the test programs with $NOPIE_LDFLAGS. Commit 9d1c54ed7f3a ("Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests") added $NOPIE_CFLAGS when compiling sh1np.o. It missed to add it to sh2np.o and mainnp.o. ld/testsuite/ PR ld/21090 * ld-shared/shared.exp (shared_test): Add support for optional ldflags argument and use it when linking the test program. (sh2np.o, mainnp.o): Compile with $NOPIE_CFLAGS. (shnp, shp, shmpnp, shmpp): Link with $NOPIE_LDFLAGS. Fixes: 9d1c54ed7f3a ("Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests") Bug: https://sourceware.org/PR21090 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-28ld: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to test pr21964-4Jens Remus1-2/+2
Linker test "pr21964-4" fails on s390x on Ubuntu 24.10 but not on Fedora 41. The reason is that GCC on Ubuntu is configured with --enable-default-pie, so that it defaults to compile with -fPIE and link with -pie, which causes the test to erroneously fail. ld/testsuite/ PR ld/21090 * ld-elf/shared.exp: Compile pr21964-4 with $NOPIE_CFLAGS and link with $NOPIE_LDFLAGS. Bug: https://sourceware.org/PR21090 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-28ld: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to test pr19719Jens Remus1-1/+1
Linker test "pr19719 fun defined" (non PIE) fails on s390x on Fedora 41 but not on Ubuntu 24.10. The reason is that GCC on Ubuntu is configured with --enable-default-pie, so that it defaults to compile with -fPIE and link with -pie, which hides the test fail. ld/testsuite/ PR ld/21090 * ld-elf/shared.exp: Compile pr19719 (non-PIE) with $NOPIE_CFLAGS and link with $NOPIE_LDFLAGS. Bug: https://sourceware.org/PR21090 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-26ld: Correct test pr19719 naming mix-upJens Remus1-4/+4
The suffix "defined/undefined" in the ld test pr19719 name specifies whether weak fun() is defined or undefined is mixed up. The test builds an executable and a shared library. The latter in two flavors, one with weak fun() defined (libpr19719a.so, "defined") and one without weak fun() defined (libpr19719b.so, "undefined"). The first "Run $exe fun [...]" invocation uses libpr19719b.so as libpr19719.so, which is build from dummy.c, which does not define fun. Thus fun is undefined during this test run. The second "Run $exe fun [...]" invocation uses libpr19719a.so as libpr19719.so, which is build from pr19719d.c, which does define fun. Thus fun is defined during this test run. Correct the test naming mix-up accordingly. ld/testsuite/ * ld-elf/shared.exp (mix_pic_and_non_pic): Correct test naming mix-up of when weak fun is un-/defined. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-26ld: Support RELRO in aarch64-elf targetRoland McGrath2-0/+2
Other *-elf targets set COMMONPAGESIZE in emulparams/*.sh and so enable `-z relro` and related features. Make aarch64-elf match. There is no reason to think that a "generic ELF" target should have any particular set of features disabled.
2025-03-20x86-64: Remove the unused pr19636-3d.dH.J. Lu1-10/+0
Remove the unused pr19636-3d.d since static Position Dependent Executable doesn't have a dynamic symbol table. PR ld/32807 * testsuite/ld-x86-64/pr19636-3d.d: Removed. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-17ld/testsuite: add gnu property section in nto-stack-note*Clément Chigot2-0/+10
A GNU property section is now always generated when `-z stack-size` is passed. This was probably introduced by GNU Property refactoring within elfxx-aarch64.c.
2025-03-14elf: Clear the SEC_ALLOC bit for NOLOAD note sectionsH.J. Lu4-3/+32
When generating an ELF output file, if a note section is marked as NOLOAD, clear the SEC_ALLOC bit so that it won't be treated as an SHF_ALLOC section, like a .bss style section. PR ld/32787 * ld.texi: Update NOLOAD for ELF output files. * ldlang.c (lang_add_section): Clear the SEC_ALLOC bit for NOLOAD note sections for ELF output files. * testsuite/ld-elf/pr32787.d: New file. * testsuite/ld-elf/pr32787.t: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07v850: improve linker scripts for relocatable linkingJan Beulich2-14/+14
Quite a few constructs where unconditional when they should take $RELOCATING into account. The original observation was that output of "ld -r" had .text start at 0x00100000.
2025-03-07Re: ld: Add a test for PR ld/25237Alan Modra2-28/+0
Delete the test. It doesn't make sense to check a linker hack for a meaningless p_offset.
2025-03-06ld: Update PR ld/25237 testH.J. Lu2-4/+7
1. Skip targets which don't support the .bss section alignment, 1 << 16. 2. Replace .bss with ".section .bss". 3. Use ".zero 0xb60000" for targets which pad the section to its alignment. PR ld/25237 * testsuite/ld-elf/pr25237.d: Skip avr-*-* and h8300-*-*. Update expected segment size to 0xb60000. * testsuite/ld-elf/pr25237.s: Use ".section .bss" and ".zero 0xb60000". Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-05ld: Add a test for PR ld/25237H.J. Lu2-0/+25
PR ld/25237 * testsuite/ld-elf/pr25237.d: New file. * testsuite/ld-elf/pr25237.s: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-05ld: Pass -Wl,-z,lazy to compiler for i386 lazy binding testsH.J. Lu2-8/+8
Pass -Wl,-z,lazy to compiler for i386 tests which require lazy binding to support compilers which default to non-lazy binding. PR ld/32762 * testsuite/ld-i386/i386.exp: Pass -Wl,-z,lazy for "Build ifunc-1a with PIE -z ibtplt" test. * testsuite/ld-i386/no-plt.exp: Pass -Wl,-z,lazy for "Build libno-plt-1b.so", "No PLT (dynamic 1a)", "No PLT (dynamic 1b)", "No PLT (dynamic 1c)", "No PLT (PIE 1e)", "No PLT (PIE 1f)", "No PLT (PIE 1g)" tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-27x86-64: Pass -z separate-code to ld for -z mark-plt testsH.J. Lu8-8/+8
Pass -z separate-code to ld for -z mark-plt tests to fix: FAIL: ld-x86-64/mark-plt-1a FAIL: ld-x86-64/mark-plt-1b FAIL: ld-x86-64/mark-plt-1c FAIL: ld-x86-64/mark-plt-1d FAIL: ld-x86-64/mark-plt-1a-x32 FAIL: ld-x86-64/mark-plt-1b-x32 FAIL: ld-x86-64/mark-plt-1c-x32 FAIL: ld-x86-64/mark-plt-1d-x32 when binutils is configured with --disable-separate-code. * ld-x86-64/mark-plt-1a-x32.d: Pass -z separate-code to ld. * ld-x86-64/mark-plt-1a.d: Likewise. * ld-x86-64/mark-plt-1b-x32.d: Likewise. * ld-x86-64/mark-plt-1b.d: Likewise. * ld-x86-64/mark-plt-1c-x32.d: Likewise. * ld-x86-64/mark-plt-1c.d: Likewise. * ld-x86-64/mark-plt-1d-x32.d: Likewise. * ld-x86-64/mark-plt-1d.d: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-26ld/testsuite: add -z separate-code to sframe x86_64 testsClément Chigot5-5/+5
Those tests were generated by a linker having "-z separate-code" on by default. However, being controlled by a configure option, it can be off by default. Forcing the option as part of the tests ensures clean results in both cases.
2025-02-23PR 32731 ub sanitizer accessing filenames_reversedAlan Modra1-1/+2
tic4x-coff and mcore-pe tickle this bug by a peculiarity of their default ld scripts. PR 32731 * ldlang.c (lang_add_wild): Init filenames_reversed when no filespec.
2025-02-21ix86: restrict use of GOT32X relocsJan Beulich3-0/+10
The ELF linker rejects use of this reloc type without a base register for PIC code. Suppress its use by gas in such cases. To keep things building for non-ELF, include the entire containing if() in an #ifdef: All consumers of ->fx_tcbit* live in such conditionals as well, hence there's no reason to keep the producer active.
2025-02-21x86-64: further tighten convert-load-reloc checkingJan Beulich2-3/+12
REX2.M affects what insn we're actually dealing with, so we better check this to avoid transforming (future) insns we must not touch.
2025-02-21x86: widen @got{,pcrel} support to PUSH and APX IMULJan Beulich12-0/+119
With us doing the transformation to an immediate operand for MOV and various ALU insns, there's little reason to then not support the same conversion for the other two insns which have respective immediate operand forms. Unfortunately for IMUL (due to the 0F opcode prefix) there's no suitable relocation, so the pre-APX forms cannot be marked for relaxation in the assembler.
2025-02-21x86/APX: use CS: in place of ES: in @gotpcrel and @gottpoff relaxationJan Beulich3-20/+20
H.J. requested this adjustment; I'm unaware of any specific technical background.
2025-02-21ix86: tighten convert-load-reloc checkingJan Beulich3-0/+36
Just like was done recently for x86-64 (commit 4998f9ea9d35): Even if the assembler avoids using the relaxable relocation for inapplicable insns, the relocation type can still appear for other reasons. Be more thorough in the opcode checking we do, to avoid bogusly altering other insns. Furthermore correct an opcode mask (even if with the added condition that's now fully benign).
2025-02-19PR32715, ld-elf/pr29072 fail with --disable-default-execstackAlan Modra1-4/+6
--disable-default-stack is an alias for --enable-default-execstack=no. The existing check only looked for the latter config option. PR 32715 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Look in config.h for result of --enable-default-execstack.
2025-02-18ld: Add tests for PR ld/32690H.J. Lu4-0/+3456
Without commit 230a788eb28a64d628e623068c44add2a24aa5d3 Author: Alan Modra <amodra@gmail.com> Date: Tue Feb 18 08:54:06 2025 +1030 PR32690, assertion failure in lang_size_relro_segment this test triggers the linker error: .../ld: internal error .../ld/ldlang.c 6618 collect2: error: ld returned 1 exit status with GCC 10 or above on x86-64. PR ld/32690 * testsuite/ld-elf/elf.exp: Run PR ld/32690 tests. * testsuite/ld-elf/pr32690.h: New file. * testsuite/ld-elf/pr32690a.c: Likewise. * testsuite/ld-elf/pr32690b.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-18PR 32603, more ld -w misbehaviourAlan Modra1-0/+1
Commit 8d97c1a53f3d claimed to replace all einfo calls using %F with a call to fatal. It did so only for the ld/ directory. This patch adds a "fatal" to linker callbacks, and replaces those calls in bfd/ too.
2025-02-15alpha, ld: remove -taso optionIvan Kokshaysky3-32/+3
The -taso switch was quite useful 25 years ago for porting 32-bit code with broken integer-pointer casting. Not anymore. The EF_ALPHA_32BIT Linux support is going to be dropped in kernel v6.14 [1], NetBSD and OpenBSD never had it, so there is no point in keeping the -taso option around. Also remove alpha special case that uses -taso from gdb.base/dump.exp in gdb testsuite. [1] https://lore.kernel.org/all/87jzb2tdb7.fsf_-_@email.froward.int.ebiederm.org Signed-off-by: Ivan Kokshaysky <ink@unseen.parts> Reviewed-By: Maciej W. Rozycki <macro@orcam.me.uk> Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-10x86: Return error for invalid relocation offsetH.J. Lu3-0/+8
Return error if relocation offset + relocation size > section size. bfd/ PR ld/32665 * elf32-i386.c (elf_i386_scan_relocs): Return error for invalid relocation offset. * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise. ld/ PR ld/32665 * testsuite/ld-x86-64/pr32665.err: New file. * testsuite/ld-x86-64/pr32665.o.bz2: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR ld/32665 test. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-08sparc: define _GLOBAL_OFFSET_TABLE_ when referencedAlexandre Oliva3-0/+28
GCC testsuite gcc.dg/20050321-2.c hit link errors on undefined _GLOBAL_OFFSET_TABLE_. The compiler output referenced only _GLOBAL_OFFSET_TABLE_-offsets to set it up, and to compute the GOT-relative address of local symbols, none of which triggered the machinery that enabled the creation of the dynamic section, so _GLOBAL_OFFSET_TABLE_ ended up undefined. Enable the dynamic section if we find a relocation involving _GLOBAL_OFFSET_TABLE_. While at that, optimize checks for references to it. for bfd/ChangeLog * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Check for _GLOBAL_OFFSET_TABLE_ references early, then compare hashed symbols instead of strings. (_bfd_sparc_elf_relocate_section): Compare hashed symbols. for ld/ChangeLog * testsuite/ld-sparc/got-def.s: New test. * testsuite/ld-sparc/sparc.exp: Add it.
2025-02-08Re: x86-64: Estimate output section layout before sizing dynamic sectionsAlan Modra1-1/+1
Commit 73ab3b9825 results in a warning compiling eelf_x86_64_sol2.c, breaking --enable-targets=all builds. warning: ‘elf_x86_64_before_allocation’ defined but not used Fix this by hooking up the chain of before_allocation functions, so x86_64-solaris2 calls elf_x86_64_before_allocation, while sparc64-solaris2 calls gldelf64_sparc_sol2_before_allocation.
2025-02-07x86-64: Estimate output section layout before sizing dynamic sectionsH.J. Lu32-8/+465
When sizing dynamic sections, elf_x86_64_scan_relocs converts GOTPCREL relocations to R_X86_64_PC32, R_X86_64_32S or R_X86_64_32 for local symbols. But at that time, since the output section layout is unknown, the local symbol values can't be determined. Later linker issues an error if the converted relocation overflows when resolving relocations against these local symbols. Update the x86-64 ELF linker to estimate output section layout before sizing dynamic sections and use the preliminary output section layout info to skip the GOTPCREL relocation conversion if the converted relocation overflows. bfd/ PR ld/32591 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Add an input section argument. Use the lowest-addressed section to estimate the __ehdr_start symbol value. Don't convert relocation if the converted relocation will overflow. ld/ PR ld/32591 * emultempl/elf-x86.em (elf_x86_64_before_allocation): New. Defined for x86-64. (LDEMUL_BEFORE_ALLOCATION): Likewise. * testsuite/ld-x86-64/pr19609-2a.d: Don't fail. * testsuite/ld-x86-64/pr19609-2b.d: Likewise. * testsuite/ld-x86-64/pr19609-4a.d: Likewise. * testsuite/ld-x86-64/pr19609-5d.d: Likewise. * testsuite/ld-x86-64/pr19609-7a.d: Likewise. * testsuite/ld-x86-64/pr19609-7c.d: Likewise. * testsuite/ld-x86-64/pr32591-1.s: New file. * testsuite/ld-x86-64/pr32591-1a-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1a.d: Likewise. * testsuite/ld-x86-64/pr32591-1a.t: Likewise. * testsuite/ld-x86-64/pr32591-1b-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1b.d: Likewise. * testsuite/ld-x86-64/pr32591-1b.t: Likewise. * testsuite/ld-x86-64/pr32591-1c-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1c.d: Likewise. * testsuite/ld-x86-64/pr32591-1c.t: Likewise. * testsuite/ld-x86-64/pr32591-1d-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1d.d: Likewise. * testsuite/ld-x86-64/pr32591-1d.t: Likewise. * testsuite/ld-x86-64/pr32591-2.s: Likewise. * testsuite/ld-x86-64/pr32591-2-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-2.d: Likewise. * testsuite/ld-x86-64/pr32591-2.t: Likewise. * testsuite/ld-x86-64/pr32591-3.s: Likewise. * testsuite/ld-x86-64/pr32591-3-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-3.d: Likewise. * testsuite/ld-x86-64/pr32591-3.t: Likewise. * testsuite/ld-x86-64/pr32591-4.s: Likewise. * testsuite/ld-x86-64/pr32591-4-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-4.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR ld/32591 tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-02-06PR 32603, ld -w misbehaviourAlan Modra55-393/+379
ld -w currently causes segmentation faults and other misbehaviour since it changes einfo with %F in the format string (fatal error) to not exit. This patch fixes that by introducing a new variant of einfo called "fatal" that always exits, and replaces all einfo calls using %F with a call to fatal without the %F. I considered modifying einfo to inspect the first 2 or 4 chars in the format string, looking for %F, but decided that was probably a bad idea given that translators might have moved the %F. It's also a little nicer to inform the compiler of a function that doesn't return. The patch also fixes some formatting nits, and makes use of %pA to print section names in a couple of places in aix.em.
2025-02-06Fix illegal memory access when linking a corrupt input file.Nick Clifton1-0/+1
PR 32647
2025-02-04elf: Store __ehdr_start hash in elf_link_hash_tableH.J. Lu2-2/+2
Since commit 97da0e2677c4a38df2406576428ec27d1da26e7c Author: Alan Modra <amodra@gmail.com> Date: Wed Jan 12 23:42:23 2022 +1030 tweak __ehdr_start visibility and flags for check_relocs creates __ehdr_start hash in lang_symbol_tweaks, store __ehdr_start hash in elf_link_hash_table so that we just need to lookup it up only once. bfd/ * elf-bfd.h (elf_link_hash_table): Add hehdr_start. * elf.c (assign_file_positions_for_load_sections): Use hehdr_start. ld/ * ldelf.c (ldelf_before_allocation): Use hehdr_start for __ehdr_start hash. * ldlang.c (lang_symbol_tweaks): Store hehdr_start hash in hehdr_start. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-31LoongArch: Do not relax against __[start|stop]_SECNAME symbolLulu Cai3-0/+25
2025-01-31x86/APX: correct libbfd's EVEX Rn -> Bn transformationsJan Beulich1-44/+44
In the recent GOTPCREL addition I screwed up, in clearing the Rn bits afterwards rather than setting them. While that ought to be benign (for the bits being ignored in situations like this), we still want to leave "canonical" encodings. The pre-existing GOTTPOFF conversion wasn't doing quite correctly either: We cannot assume the incoming Bn bits to be in a particular state, as for the addressing form in question they're ignored as well. To address both, introduce a helper function. This is then also an overall reduction of (source) code size (and use of "magic" numbers).
2025-01-30x86-64: Remove pr19609-4c.d and pr19609-4d.dH.J. Lu4-30/+11
Remove pr19609-4c.d and pr19609-4d.d since they are identical to pr19609-4a.d and pr19609-4b.d, respectively. * testsuite/ld-x86-64/pr19609-4c.d: Removed. * testsuite/ld-x86-64/pr19609-4d.d: Likewise. * testsuite/ld-x86-64/pr19609-4e.d: Renamed to ... * testsuite/ld-x86-64/pr19609-4c.d: This. * testsuite/ld-x86-64/x86-64.exp: Updated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-28Add translations for various sub-directoriesNick Clifton1-1808/+2041