aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
AgeCommit message (Collapse)AuthorFilesLines
2024-04-24Update readelf's display of RELR sections to include the number of locations ↵Nick Clifton2-2/+2
relocated
2024-04-16Simplify readelf's RELR relocation display.Fangrui Song2-4/+4
2024-04-11Improve readelf's display of RELR relocs.Nick Clifton2-10/+8
2024-01-09x86: Don't check R_386_NONE nor R_X86_64_NONEH.J. Lu2-0/+14
Update x86 ELF linker to skip R_386_NONE/R_X86_64_NONE when scanning relocations. bfd/ * PR ld/31047 * elf32-i386.c (elf_i386_scan_relocs): Don't check R_386_NONE. * elf64-x86-64.c (elf_x86_64_scan_relocs): Don't check R_X86_64_NONE. ld/ * PR ld/31047 * testsuite/ld-i386/i386.exp: Run PR ld/31047 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr31047.d: New file. * testsuite/ld-x86-64/pr31047-x32.d: Likewise. * testsuite/ld-x86-64/pr31047.d: Likewise. * testsuite/ld-x86-64/pr31047a.s: Likewise. * testsuite/ld-x86-64/pr31047b.s: Likewise.
2024-01-04Update year range in copyright notice of binutils filesAlan Modra4-4/+4
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-11-10Add ability to change linker warning messages into errors when reporting ↵Nick Clifton4-4/+4
executable stacks and/or executable segments. include * bfdlink.h (struct bfd_link_info): Update descriptions of the 'execstack', 'noexecstack' and 'warn_execstack' fields. Add 'error_exectack' and 'warn_is_error_for_rwx_segments' fields. bfd * elf.c (assign_file_positions_except_relocs): Turn warnings about executable segments into errors if so requested. * elflink.c (bfd_elf_size_dynamic_sections): Turn warnings about executable stacks into errors if so requested. ld * ldlex.h (enum option_values): Add OPTION_ERROR_EXECSTACK, OPTION_NO_ERROR_EXECSTACK, OPTION_WARN_EXECSTACK_OBJECTS, OPTION_ERROR_RWX_SEGMENTS and OPTION_NO_ERROR_RWX_SEGMENTS. (struct ld_option): Add new long options. (parse_args): Parse new long options. (elf_static_list_options): Display the new options. * ld.texi: Document the new command line options. * configure.ac (error-execstack): New configuration option. (error-rwx-segments): New configuration option. * emultempl/elf.em (_before_parse): Initialse the new linkinfo fields. * NEWS: Mention the new features. * config.in: Regenerate. * configure: Regenerate. * testsuite/ld-elf/commonpage2.d: Disable errors for RWX segments and/or executable stacks. * testsuite/ld-elf/elf.exp: Likewise. * testsuite/ld-elf/header.d: Likewise. * testsuite/ld-elf/loadaddr1.d: Likewise. * testsuite/ld-elf/loadaddr2.d: Likewise. * testsuite/ld-elf/maxpage4.d: Likewise. * testsuite/ld-elf/nobits-1.d: Likewise. * testsuite/ld-elf/note-1.d: Likewise. * testsuite/ld-elf/orphan-10.d: Likewise. * testsuite/ld-elf/orphan-11.d: Likewise. * testsuite/ld-elf/orphan-12.d: Likewise. * testsuite/ld-elf/orphan-5.d: Likewise. * testsuite/ld-elf/orphan-7.d: Likewise. * testsuite/ld-elf/orphan-8.d: Likewise. * testsuite/ld-elf/orphan-9.d: Likewise. * testsuite/ld-elf/orphan-region.d: Likewise. * testsuite/ld-elf/orphan.d: Likewise. * testsuite/ld-elf/pr19539.d: Likewise. * testsuite/ld-elf/pr26256-1a.d: Likewise. * testsuite/ld-elf/pr26907.d: Likewise. * testsuite/ld-elf/pr28597.d: Likewise. * testsuite/ld-elf/retain2.d: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elf/size-1.d: Likewise. * testsuite/ld-elf/textaddr7.d: Likewise. * testsuite/ld-elf/warn1.d: Likewise. * testsuite/ld-elf/warn2.d: Likewise. * testsuite/ld-i386/discarded1.d: Likewise. * testsuite/ld-i386/pr19175.d: Likewise. * testsuite/ld-i386/pr19539.d: Likewise. * testsuite/ld-i386/pr23189.d: Likewise. * testsuite/ld-plugin/lto-3r.d: Likewise. * testsuite/ld-plugin/lto-5r.d: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-powerpc/ppc476-shared.d: Likewise. * testsuite/ld-powerpc/ppc476-shared2.d: Likewise. * testsuite/ld-powerpc/pr28827-2.d: Likewise. * testsuite/ld-s390/s390.exp: Likewise. * testsuite/ld-scripts/align2a.d: Likewise. * testsuite/ld-scripts/align2b.d: Likewise. * testsuite/ld-scripts/align5.d: Likewise. * testsuite/ld-scripts/alignof.exp: Likewise. * testsuite/ld-scripts/crossref.exp: Likewise. * testsuite/ld-scripts/defined2.d: Likewise. * testsuite/ld-scripts/defined3.d: Likewise. * testsuite/ld-scripts/defined5.d: Likewise. * testsuite/ld-scripts/pr14962.d: Likewise. * testsuite/ld-scripts/pr18963.d: Likewise. * testsuite/ld-scripts/pr20302.d: Likewise. * testsuite/ld-scripts/print-memory-usage.exp: Likewise. * testsuite/ld-scripts/rgn-at1.d: Likewise. * testsuite/ld-scripts/rgn-at10.d: Likewise. * testsuite/ld-scripts/rgn-at4.d: Likewise. * testsuite/ld-scripts/rgn-at6.d: Likewise. * testsuite/ld-scripts/rgn-at8.d: Likewise. * testsuite/ld-scripts/rgn-at9.d: Likewise. * testsuite/ld-scripts/rgn-over1.d: Likewise. * testsuite/ld-scripts/rgn-over2.d: Likewise. * testsuite/ld-scripts/rgn-over4.d: Likewise. * testsuite/ld-scripts/rgn-over5.d: Likewise. * testsuite/ld-scripts/rgn-over6.d: Likewise. * testsuite/ld-scripts/script.exp: Likewise. * testsuite/ld-scripts/sizeof.exp: Likewise. * testsuite/ld-scripts/sort-file.d: Likewise. * testsuite/ld-x86-64/discarded1.d: Likewise. * testsuite/ld-x86-64/pr19175.d: Likewise. * testsuite/ld-x86-64/pr19539a.d: Likewise. * testsuite/ld-x86-64/pr19539b.d: Likewise. * testsuite/ld-x86-64/pr23189.d: Likewise.
2023-10-05Fix: ld testsuite: pr22001-1 test segfaults on musl/x86A. Wilcox1-10/+16
PR 30925 PR 22001 * testsuite/ld-i386/i386.exp: Skip the pr22001 test with TEXTREL relocations enabled on configurations using the MUSL library.
2023-08-23x86: Fix DT_JMPREL/DT_PLTRELSZ when relocs share a sectionPeter Edwards4-0/+18
If a linker script does not place the PLT relocations and "normal" relocations in separate ELF sections, `ld` will currently output incorrect values for DT_JMPREL and DT_PLTRELSZ - they cover the entire ELF section, rather than just the PLT relocations Don't ignore the extent of the BFD section - use the size of the srelplt BFD section and its offset from the output_secttion bfd/ PR ld/30787 * elfxx-x86.c (_bfd_x86_elf_finish_dynamic_sections): Use input section for DT_JMPREL and DT_PLTRELSZ. ld/ PR ld/30787 * testsuite/ld-i386/i386.exp: Run pr30787. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr30787.d: New file. * testsuite/ld-i386/pr30787.s: Likewise. * testsuite/ld-i386/pr30787.t: Likewise. * testsuite/ld-x86-64/pr30787.d: Likewise. * testsuite/ld-x86-64/pr30787.s: Likewise. * testsuite/ld-x86-64/pr30787.t: Likewise.
2023-08-02Revert "2.41 Release sources"Sam James5-5/+5
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d. See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-022.41 Release sourcesbinutils-2_41-releaseNick Clifton5-5/+5
2023-08-01ld: Fix test failures with --enable-textrel-check=errorSam James4-4/+4
2023-07-27/DISCARD/ in ld testsuiteAlan Modra1-1/+1
The canonical form to discard all sections not mentioned earlier in the script is /DISCARD/ : { *(*) } not /DISCARD/ : { *(.*) } ".*" happens to work with the usual section names starting with a dot, but let's not promote something not quite right.
2023-07-17PR10957, Missing option to really print section+offsetAlan Modra1-1/+1
Many of the reloc error messages have already been converted from using %C to using %H in ld.bfd, to print section+offset as well as file/line/function. This catches a few remaining, and changes gold to do the same. PR 10957 bfd/ * elf32-sh.c (sh_elf_relocate_section): Use %H in error messages. gold/ * object.cc (Relocate_info::location): Always report section+offset. * testsuite/debug_msg.sh: Adjust to suit. * testsuite/x32_overflow_pc32.sh: Likewise. * testsuite/x86_64_overflow_pc32.sh: Likewise. ld/ * emultempl/pe.em (read_addend): Use %H in error message. * emultempl/pep.em (read_addend): Likewise. * ldcref.c (check_reloc_refs): Likewise. * ldmain.c (warning_find_reloc, undefined_symbol): Likewise. * pe-dll.c (pe_create_import_fixup): Likewise. * testsuite/ld-cris/undef2.d: Adjust expected output to suit. * testsuite/ld-cris/undef3.d: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-i386/compressed1.d: Likewise. * testsuite/ld-ia64/line.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-undefined/undefined.exp: Likewise. * testsuite/ld-x86-64/compressed1.d: Likewise. * testsuite/ld-x86-64/line.exp: Likewise. * testsuite/ld-x86-64/pr27587.err: Likewise.
2023-01-25i386: Pass -Wl,--no-as-needed to compiler as neededH.J. Lu1-3/+4
Pass -Wl,--no-as-needed to linker tests to fix FAIL: Run pr19031 FAIL: Run got1 FAIL: Undefined weak symbol (-fPIE -no-pie) FAIL: Undefined weak symbol (-fPIE -pie) when --as-needed is passed to linker by compiler. PR ld/30050 * testsuite/ld-i386/i386.exp: Pass -Wl,--no-as-needed to compiler as needed.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra4-4/+4
The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2022-07-21i386: Don't allow GOTOFF relocation against IFUNC symbol for PICH.J. Lu2-6/+2
We can't use the PLT entry as the function address for PIC since the PIC register may not be set up properly for indirect call. bfd/ PR ld/27998 * elf32-i386.c (elf_i386_relocate_section): Don't allow GOTOFF relocation against IFUNC symbol for PIC. ld/ PR ld/27998 * testsuite/ld-i386/pr27998a.d: Replace -shared with -e bar. * testsuite/ld-i386/pr27998b.d: Expect a linker error. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Updated. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386.s: Replace @GOTOFF with @GOT. * testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise.
2022-07-19x86: Disallow invalid relocations against protected symbolsH.J. Lu3-5/+3
Since glibc 2.36 will issue warnings for copy relocation against protected symbols and non-canonical reference to canonical protected functions, change the linker to always disallow such relocations. bfd/ * elf32-i386.c (elf_i386_scan_relocs): Remove check for elf_has_indirect_extern_access. * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise. (elf_x86_64_relocate_section): Remove check for elf_has_no_copy_on_protected. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check for building executable instead of elf_has_no_copy_on_protected. (_bfd_x86_elf_adjust_dynamic_symbol): Disallow copy relocation against non-copyable protected symbol. * elfxx-x86.h (SYMBOL_NO_COPYRELOC): Remove check for elf_has_no_copy_on_protected. ld/ * testsuite/ld-i386/i386.exp: Expect linker error for PR ld/17709 test. * testsuite/ld-i386/pr17709.rd: Removed. * testsuite/ld-i386/pr17709.err: New file. * testsuite/ld-x86-64/pr17709.rd: Removed. * testsuite/ld-x86-64/pr17709.err: New file. * testsuite/ld-x86-64/pr28875-func.err: Updated. * testsuite/ld-x86-64/x86-64.exp: Expect linker error for PR ld/17709 test. Add tests for function pointer against protected function.
2022-07-19x86: Make protected symbols local for -sharedFangrui Song3-3/+7
Call _bfd_elf_symbol_refs_local_p with local_protected==true. This has 2 noticeable effects for -shared: * GOT-generating relocations referencing a protected data symbol no longer lead to a GLOB_DAT (similar to a hidden symbol). * Direct access relocations (e.g. R_X86_64_PC32) no longer has the confusing diagnostic below. __attribute__((visibility("protected"))) void *foo() { return (void *)foo; } // gcc -fpic -shared -fuse-ld=bfd relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object The new behavior matches arm, aarch64 (commit 83c325007c5599fa9b60b8d5f7b84842160e1d1b), and powerpc ports, and other linkers: gold and ld.lld. Note: if some code tries to use direct access relocations to take the address of foo, the pointer equality will break, but the error should be reported on the executable link, not on the innocent shared object link. glibc 2.36 will give a warning at relocation resolving time. With this change, `#define elf_backend_extern_protected_data 1` is no longer effective. Just remove it. Remove the test "Run protected-func-1 without PIE" since -fno-pic address taken operation in the executable doesn't work with protected symbol in a shared object by default. Similarly, remove protected-data-1a and protected-data-1b. protected-data-1b can be made working by removing HAVE_LD_PIE_COPYRELOC from GCC (https://sourceware.org/pipermail/gcc-patches/2022-June/596678.html).
2022-06-27-z relro relaxation and ld script SIZEOFAlan Modra1-2/+2
A number of targets use assignments like: . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 12 ? 12 : 0, .); (from i386) in linker scripts to put the end of the relro segment past the header in .got.plt. Examination of testcases like those edited by this patch instead sees the end of the relro segment being placed at the start of .got.plt. For the i386 pie1 test: [ 9] .got.plt PROGBITS 00002000 001000 00000c 04 WA 0 0 4 GNU_RELRO 0x000f90 0x00001f90 0x00001f90 0x00070 0x00070 R 0x1 A map file shows: .dynamic 0x0000000000001f90 0x70 *(.dynamic) .dynamic 0x0000000000001f90 0x70 tmpdir/pie1.o 0x0000000000001f90 _DYNAMIC .got 0x0000000000002000 0x0 *(.got) .got 0x0000000000002000 0x0 tmpdir/pie1.o *(.igot) 0x0000000000002ff4 . = DATA_SEGMENT_RELRO_END (., (SIZEOF (.got.plt) >= 0xc)?0xc:0x0) .got.plt 0x0000000000002000 0xc *(.got.plt) .got.plt 0x0000000000002000 0xc tmpdir/pie1.o 0x0000000000002000 _GLOBAL_OFFSET_TABLE_ The DATA_SEGMENT_RELRO_END value in the map file is weird too. All of this is triggered by SIZEOF (.got.plt) being evaluated wrongly as zero. Fix it by taking into account the action of lang_reset_memory_regions during relaxation. * ldexp.c (fold_name <SIZEOF>): Use rawsize if size has been reset. * ldlang.c (lang_size_sections_1): Don't reset processed_vma here. * testsuite/ld-i386/pie1.d: Adjust to suit. * testsuite/ld-x86-64/pr20830a.d: Likewise. * testsuite/ld-x86-64/pr20830b.d: Likewise. * testsuite/ld-x86-64/pr21038a.d: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038c.d: Likewise.
2022-05-31i386: Ajdust more tests for opcodes/i386: remove trailing whitespaceH.J. Lu13-19/+19
This fixes: FAIL: Build ifunc-1a with -z ibtplt FAIL: Build ifunc-1a with PIE -z ibtplt FAIL: Build libno-plt-1b.so FAIL: No PLT (dynamic 1a) FAIL: No PLT (dynamic 1b) FAIL: No PLT (dynamic 1c) FAIL: No PLT (static 1d) FAIL: No PLT (PIE 1e) FAIL: No PLT (PIE 1f) FAIL: No PLT (PIE 1g) FAIL: No PLT (dynamic 1h) FAIL: No PLT (dynamic 1i) FAIL: No PLT (static 1j) * ld-i386/libno-plt-1b.dd: Remove trailing whitespaces. * ld-i386/no-plt-1a.dd: Likewise. * ld-i386/no-plt-1b.dd: Likewise. * ld-i386/no-plt-1c.dd: Likewise. * ld-i386/no-plt-1d.dd: Likewise. * ld-i386/no-plt-1e.dd: Likewise. * ld-i386/no-plt-1f.dd: Likewise. * ld-i386/no-plt-1g.dd: Likewise. * ld-i386/no-plt-1h.dd: Likewise. * ld-i386/no-plt-1i.dd: Likewise. * ld-i386/no-plt-1j.dd: Likewise. * ld-i386/plt-main-ibt.dd: Likewise. * ld-i386/plt-pie-ibt.dd: Likewise.
2022-05-31Ajdust more tests for opcodes/i386: remove trailing whitespaceAlan Modra2-4/+4
git commit 202be274a4 also missed adjusting a few testsuite files. This fixes i686-vxworks +FAIL: VxWorks shared library test 1 i686-vxworks +FAIL: VxWorks executable test 1 (dynamic)
2022-05-27opcodes/i386: remove trailing whitespace from insns with zero operandsAndrew Burgess18-50/+50
While working on another patch[1] I had need to touch this code in i386-dis.c: ins->obufp = ins->mnemonicendp; for (i = strlen (ins->obuf) + prefix_length; i < 6; i++) oappend (ins, " "); oappend (ins, " "); (*ins->info->fprintf_styled_func) (ins->info->stream, dis_style_mnemonic, "%s", ins->obuf); What this code does is add whitespace after the instruction mnemonic and before the instruction operands. The problem I ran into when working on this code can be seen by assembling this input file: .text nop retq Now, when I disassemble, here's the output. I've replaced trailing whitespace with '_' so that the issue is clearer: Disassembly of section .text: 0000000000000000 <.text>: 0: 90 nop 1: c3 retq___ Notice that there's no trailing whitespace after 'nop', but there are three spaces after 'retq'! What happens is that instruction mnemonics are emitted into a buffer instr_info::obuf, then instr_info::mnemonicendp is setup to point to the '\0' character at the end of the mnemonic. When we emit the whitespace, this is then added starting at the mnemonicendp position. Lets consider 'retq', first the buffer is setup like this: 'r' 'e' 't' 'q' '\0' Then we add whitespace characters at the '\0', converting the buffer to this: 'r' 'e' 't' 'q' ' ' ' ' ' ' '\0' However, 'nop' is actually an alias for 'xchg %rax,%rax', so, initially, the buffer is setup like this: 'x' 'c' 'h' 'g' '\0' Then in NOP_Fixup we spot that we have an instruction that is an alias for 'nop', and adjust the buffer to this: 'n' 'o' 'p' '\0' '\0' The second '\0' is left over from the original buffer contents. However, when we rewrite the buffer, we don't afjust mnemonicendp, which still points at the second '\0' character. Now, when we insert whitespace we get: 'n' 'o' 'p' '\0' ' ' ' ' ' ' ' ' '\0' Notice the whitespace is inserted after the first '\0', so, when we print the buffer, the whitespace is not printed. The fix for this is pretty easy, I can change NOP_Fixup to adjust mnemonicendp, but now a bunch of tests start failing, we now produce whitespace after the 'nop', which the tests don't expect. So, I could update the tests to expect the whitespace.... ...except I'm not a fan of trailing whitespace, so I'd really rather not. Turns out, I can pretty easily update the whitespace emitting code to spot instructions that have zero operands and just not emit any whitespace in this case. So this is what I've done. I've left in the fix for NOP_Fixup, I think updating mnemonicendp is probably a good thing, though this is not really required any more. I've then updated all the tests that I saw failing to adjust the expected patterns to account for the change in whitespace. [1] https://sourceware.org/pipermail/binutils/2022-April/120610.html
2022-04-26i386: Pass -z noexecstack to linker testsH.J. Lu1-2/+4
PR ld/29072 * testsuite/ld-i386/i386.exp: Pass -z noexecstack to gotpc1 and property-6.
2022-04-20Add linker warning for when it creates an executable stack.Nick Clifton1-2/+2
PR 29072
2022-02-15i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTRELH.J. Lu3-0/+11
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.
2022-02-11x86: Disallow invalid relocation against protected symbolH.J. Lu5-9/+40
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.
2022-02-07i386: Allow GOT32 relocations against ABS symbolsH.J. Lu3-0/+17
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.
2022-02-07Revert "elf: Remove the 1-page gap before the RELRO segment"Alan Modra1-2/+2
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.
2022-01-13ld: Disable DT_RELR in some -z relro testsH.J. Lu1-1/+1
Disable DT_RELR in the following -z relro tests which don't expect DT_RELR in linker outputs. * testsuite/ld-i386/pr20830.d: Pass $NO_DT_RELR_LDFLAGS to ld. * 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.
2022-01-13elf: Remove the 1-page gap before the RELRO segmentH.J. Lu1-2/+2
The existing RELRO scheme may leave a 1-page gap before the RELRO segment and align the end of the RELRO segment to the page size: [18] .eh_frame PROGBITS 408fa0 008fa0 005e80 00 A 0 0 8 [19] .init_array INIT_ARRAY 410de0 00fde0 000008 08 WA 0 0 8 [20] .fini_array FINI_ARRAY 410de8 00fde8 000008 08 WA 0 0 8 [21] .dynamic DYNAMIC 410df0 00fdf0 000200 10 WA 7 0 8 [22] .got PROGBITS 410ff0 00fff0 000010 08 WA 0 0 8 [23] .got.plt PROGBITS 411000 010000 000048 08 WA 0 0 8 Instead, we can remove the 1-page gap if the maximum page size >= the maximum section alignment: [18] .eh_frame PROGBITS 408fa0 008fa0 005e80 00 A 0 0 8 [19] .init_array INIT_ARRAY 40fde0 00fde0 000008 08 WA 0 0 8 [20] .fini_array FINI_ARRAY 40fde8 00fde8 000008 08 WA 0 0 8 [21] .dynamic DYNAMIC 40fdf0 00fdf0 000200 10 WA 7 0 8 [22] .got PROGBITS 40fff0 00fff0 000010 08 WA 0 0 8 [23] .got.plt PROGBITS 410000 010000 000048 08 WA 0 0 8 Because the end of the RELRO segment is always aligned to the page size and may not be moved, the RELRO segment size may be increased: [ 3] .dynstr STRTAB 000148 000148 000001 00 A 0 0 1 [ 4] .eh_frame PROGBITS 000150 000150 000000 00 A 0 0 8 [ 5] .init_array INIT_ARRAY 200150 000150 000010 08 WA 0 0 1 [ 6] .fini_array FINI_ARRAY 200160 000160 000010 08 WA 0 0 1 [ 7] .jcr PROGBITS 200170 000170 000008 00 WA 0 0 1 [ 8] .data.rel.ro PROGBITS 200180 000180 000020 00 WA 0 0 16 [ 9] .dynamic DYNAMIC 2001a0 0001a0 0001c0 10 WA 3 0 8 [10] .got PROGBITS 200360 000360 0002a8 00 WA 0 0 8 [11] .bss NOBITS 201000 000608 000840 00 WA 0 0 1 vs the old section layout: [ 3] .dynstr STRTAB 000148 000148 000001 00 A 0 0 1 [ 4] .eh_frame PROGBITS 000150 000150 000000 00 A 0 0 8 [ 5] .init_array INIT_ARRAY 200b48 000b48 000010 08 WA 0 0 1 [ 6] .fini_array FINI_ARRAY 200b58 000b58 000010 08 WA 0 0 1 [ 7] .jcr PROGBITS 200b68 000b68 000008 00 WA 0 0 1 [ 8] .data.rel.ro PROGBITS 200b70 000b70 000020 00 WA 0 0 16 [ 9] .dynamic DYNAMIC 200b90 000b90 0001c0 10 WA 3 0 8 [10] .got PROGBITS 200d50 000d50 0002a8 00 WA 0 0 8 [11] .bss NOBITS 201000 000ff8 000840 00 WA 0 0 1 But there is no 1-page gap. PR ld/28743 * ldlang.c (lang_size_relro_segment_1): Remove the 1-page gap before the RELRO segment if the maximum page size >= the maximum section alignment. * testsuite/ld-i386/pr20830.d: Adjusted. * 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.
2022-01-12ld: Add simple DT_RELR testsH.J. Lu4-0/+73
* testsuite/ld-elf/dt-relr-1.s: New file. * testsuite/ld-elf/dt-relr-1a.d: Likewise. * testsuite/ld-elf/dt-relr-1b.d: Likewise. * testsuite/ld-elf/dt-relr-1c.d: Likewise. * testsuite/ld-elf/dt-relr-2.s: Likewise. * testsuite/ld-elf/dt-relr-2a.d: Likewise. * testsuite/ld-elf/dt-relr-2b.d: Likewise. * testsuite/ld-elf/dt-relr-2c.d: Likewise. * testsuite/ld-elf/dt-relr-2d.d: Likewise. * testsuite/ld-elf/dt-relr-2e.d: Likewise. * testsuite/ld-elf/dt-relr-2f.d: Likewise. * testsuite/ld-elf/dt-relr-2g.d: Likewise. * testsuite/ld-elf/dt-relr-2h.d: Likewise. * testsuite/ld-elf/dt-relr-3.s: Likewise. * testsuite/ld-elf/dt-relr-3a.d: Likewise. * testsuite/ld-elf/dt-relr-3b.d: Likewise. * testsuite/ld-i386/dt-relr-1.s: Likewise. * testsuite/ld-i386/dt-relr-1a.d: Likewise. * testsuite/ld-i386/dt-relr-1b.d: Likewise. * testsuite/ld-x86-64/dt-relr-1a-x32.d: Likewise. * testsuite/ld-x86-64/dt-relr-1a.d: Likewise. * testsuite/ld-x86-64/dt-relr-1b-x32.d: Likewise. * testsuite/ld-x86-64/dt-relr-1b.d: Likewise. * testsuite/ld-x86-64/dt-relr-1.s: Likewise. * testsuite/ld-i386/i386.exp: Run dt-relr-1a and dt-relr-1b. * testsuite/ld-x86-64/x86-64.exp: Run dt-relr-1a, dt-relr-1a-x32 dt-relr-1b and dt-relr-1b-x32.
2022-01-12elf: Support DT_RELR in linker testsH.J. Lu7-12/+20
Allow eabling and disabling DT_RELR in linker tests. Disable DT_RELR in linker tests which don't expect DT_RELR in linker outputs. binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Make DT_RELR_LDFLAGS and NO_DT_RELR_LDFLAGS global. ld/ * testsuite/config/default.exp (DT_RELR_LDFLAGS): New. (DT_RELR_CC_LDFLAGS): Likewise. (NO_DT_RELR_LDFLAGS): Likewise. (NO_DT_RELR_CC_LDFLAGS): Likewise. * testsuite/ld-elf/shared.exp: Pass $NO_DT_RELR_LDFLAGS to linker for some tests. * testsuite/ld-i386/export-class.exp: Likewise. * testsuite/ld-i386/i386.exp: Likewise. * testsuite/ld-i386/ibt-plt-2a.d: Pass $NO_DT_RELR_LDFLAGS to linker. * testsuite/ld-i386/ibt-plt-3a.d: Likewise. * testsuite/ld-i386/ibt-plt-3c.d: Likewise. * testsuite/ld-i386/pr26869.d: Likewise. * testsuite/ld-i386/report-reloc-1.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise. * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ilp32-4.d: Likewise. * testsuite/ld-x86-64/load1c.d: Likewise. * testsuite/ld-x86-64/load1d.d: Likewise. * testsuite/ld-x86-64/pr13082-2b.d: Likewise. * testsuite/ld-x86-64/pr14207.d: Likewise. * testsuite/ld-x86-64/pr18176.d: Likewise. * testsuite/ld-x86-64/pr19162.d: Likewise. * testsuite/ld-x86-64/pr19636-2d.d: Likewise. * testsuite/ld-x86-64/pr19636-2l.d: Likewise. * testsuite/ld-x86-64/pr20253-1d.d: Likewise. * testsuite/ld-x86-64/pr20253-1f.d: Likewise. * testsuite/ld-x86-64/pr20253-1j.d: Likewise. * testsuite/ld-x86-64/pr20253-1l.d: Likewise. * testsuite/ld-x86-64/report-reloc-1-x32.d: Likewise. * testsuite/ld-x86-64/report-reloc-1.d: Likewise. * testsuite/ld-x86-64/export-class.exp (x86_64_export_class_test): Pass $NO_DT_RELR_LDFLAGS to linker. * testsuite/ld-x86-64/x86-64.exp: Pass $NO_DT_RELR_LDFLAGS to linker for some tests.
2022-01-07ld: Extract _bfd_elf_link_iterate_on_relocsH.J. Lu1-2/+2
DT_RELR encodes consecutive R_*_RELATIVE relocations in GOT (the global offset table) and data sections in a compact format: https://groups.google.com/g/generic-abi/c/bX460iggiKg On some targets, R_*_RELATIVE relocations are counted and the GOT offsets are allocated when setting the dynamic section sizes after seeing all relocations. R_*_RELATIVE relocations are generated while relocating sections after section layout has been finalized. To prepare for DT_RELR implementation on these targets, extract _bfd_elf_link_iterate_on_relocs from _bfd_elf_link_check_relocs so that a backend can scan relocations in elf_backend_always_size_sections For x86 targets, the old check_relocs is renamed to scan_relocs and a new check_relocs is added to chek input sections and create dynamic relocation sections so that they will be mapped to output sections. scan_relocs is now called from elf_backend_always_size_sections. Since relocations are scanned after __start, __stop, .startof. and .sizeof. symbols have been finalized on x86, __[start|stop]_SECNAME for --gc-sections -z start-stop-gc are now zero when all SECNAME sections been garbage collected. This is no need for elf_x86_start_stop_gc_p. bfd/ * elf-bfd.h (_bfd_elf_link_iterate_on_relocs): New. * elf32-i386.c (elf_i386_convert_load_reloc): Don't call elf_x86_start_stop_gc_p. (elf_i386_check_relocs): Renamed to ... (elf_i386_scan_relocs): This. Don't call _bfd_elf_make_dynamic_reloc_section. (elf_i386_always_size_sections): New. (elf_backend_check_relocs): Removed. (elf_backend_always_size_sections): New. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Don't call elf_x86_start_stop_gc_p. (elf_x86_64_check_relocs): Renamed to ... (elf_x86_64_scan_relocs): This. Don't call _bfd_elf_make_dynamic_reloc_section. (elf_x86_64_always_size_sections): New. (elf_backend_check_relocs): Removed. (elf_backend_always_size_sections): New. * elflink.c (elf_link_check_or_scan_relocs): New. Extracted from _bfd_elf_link_check_relocs. (_bfd_elf_link_check_relocs): Call elf_link_check_or_scan_relocs. * elfxx-x86.c (_bfd_x86_elf_check_relocs): New. * elfxx-x86.h (X86_64_NEED_DYNAMIC_RELOC_TYPE_P): New. (I386_NEED_DYNAMIC_RELOC_TYPE_P): Likewise. (X86_NEED_DYNAMIC_RELOC_TYPE_P): Likewise. (_bfd_x86_elf_check_relocs): Likewise. (elf_backend_check_relocs): Likewise. (elf_backend_always_size_sections): Removed. (elf_x86_start_stop_gc_p): Likewise. ld/ * testsuite/ld-i386/pr27491-1a.d: Updated. * testsuite/ld-x86-64/pr27491-1a.d: Likewise.
2022-01-04ld/x86: Update -z report-relative-relocH.J. Lu1-2/+2
Use 0x%v, instead of bfd_sprintf_vma, to report relative relocations. Change linker relative relocations report from tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x0000000000002000, info: 0x0000000000000025, addend: 0x0000000000001007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o to tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x2000, info: 0x25, addend: 0x1007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o bfd/ * elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): Use 0x%v instead of bfd_sprintf_vma. ld/ * testsuite/ld-i386/report-reloc-1.l: Updated. * testsuite/ld-x86-64/report-reloc-1.l: Likewise.
2022-01-02Update year range in copyright notice of binutils filesAlan Modra4-4/+4
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-12-13x86: Adjust linker tests for --disable-separate-codeH.J. Lu1-2/+2
Adjust linker tests for linker configured with --disable-separate-code: 1. Update expected outputs. 2. Pass -z max-page-size=0x1000 -z separate-code" to linker. * testsuite/ld-i386/report-reloc-1.l: Updated. * testsuite/ld-x86-64/report-reloc-1.l: Likewise. * testsuite/ld-x86-64/pe-x86-64.exp: Pass "-z max-page-size=0x1000 -z separate-code" to linker. * testsuite/ld-x86-64/pr19609-4e.d: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Likewise. * testsuite/ld-x86-64/pr19609-6b.d: Likewise. * testsuite/ld-x86-64/pr19609-7b.d: Likewise. * testsuite/ld-x86-64/pr19609-7d.d: Likewise.
2021-12-02x86: Skip __[start|stop]_SECNAME for --gc-sections -z start-stop-gcH.J. Lu12-0/+168
Don't convert memory load to immediate load on __start_SECNAME and __stop_SECNAME for --gc-sections -z start-stop-gc if all SECNAME sections been garbage collected. bfd/ PR ld/27491 * elf32-i386.c (elf_i386_convert_load_reloc): Skip __start_SECNAME and __stop_SECNAME for --gc-sections -z start-stop-gc if the input section been garbage collected. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. * elfxx-x86.h (elf_x86_start_stop_gc_p): New function. ld/ PR ld/27491 * testsuite/ld-i386/i386.exp: Run PR ld/27491 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr27491-1.s: New file. * testsuite/ld-i386/pr27491-1a.d: Likewise. * testsuite/ld-i386/pr27491-1b.d: Likewise. * testsuite/ld-i386/pr27491-1c.d: Likewise. * testsuite/ld-i386/pr27491-2.d: Likewise. * testsuite/ld-i386/pr27491-2.s: Likewise. * testsuite/ld-i386/pr27491-3.d: Likewise. * testsuite/ld-i386/pr27491-3.s: Likewise. * testsuite/ld-i386/pr27491-4.d: Likewise. * testsuite/ld-i386/pr27491-4a.s: Likewise. * testsuite/ld-i386/pr27491-4b.s: Likewise. * testsuite/ld-x86-64/pr27491-1.s: Likewise. * testsuite/ld-x86-64/pr27491-1a.d: Likewise. * testsuite/ld-x86-64/pr27491-1b.d: Likewise. * testsuite/ld-x86-64/pr27491-1c.d: Likewise. * testsuite/ld-x86-64/pr27491-2.d: Likewise. * testsuite/ld-x86-64/pr27491-2.s: Likewise. * testsuite/ld-x86-64/pr27491-3.d: Likewise. * testsuite/ld-x86-64/pr27491-3.s: Likewise. * testsuite/ld-x86-64/pr27491-4.d: Likewise. * testsuite/ld-x86-64/pr27491-4a.s: Likewise. * testsuite/ld-x86-64/pr27491-4b.s: Likewise.
2021-09-22Fix x86 "FAIL: TLS -fno-pic -shared"Alan Modra1-1/+1
Fix a typo in commit 5d0869d9872a * testsuite/ld-i386/tlsnopic.rd: Typo fix.
2021-09-21Change the linker's heuristic for computing the entry point for binaries so ↵Nick Clifton1-1/+1
that shared libraries default to an entry point of 0. * ldlang.c (lang_end): When computing the entry point, only try the start address of the entry section when creating an executable. * ld.texi (Entry point): Update description of heuristic used to choose the entry point. testsuite/ld-alpha/tlspic.rd: Update expected entry point address. testsuite/ld-arm/tls-gdesc-got.d: Likewise. testsuite/ld-i386/tlsnopic.rd: Likewise. testsuite/ld-ia64/tlspic.rd: Likewise. testsuite/ld-sparc/gotop32.rd: Likewise. testsuite/ld-sparc/gotop64.rd: Likewise. testsuite/ld-sparc/tlssunnopic32.rd: Likewise. testsuite/ld-sparc/tlssunnopic64.rd: Likewise. testsuite/ld-sparc/tlssunpic32.rd: Likewise. testsuite/ld-sparc/tlssunpic64.rd: Likewise. testsuite/ld-tic6x/shlib-1.rd: Likewise. testsuite/ld-tic6x/shlib-1b.rd: Likewise. testsuite/ld-tic6x/shlib-1r.rd: Likewise. testsuite/ld-tic6x/shlib-1rb.rd: Likewise. testsuite/ld-tic6x/shlib-noindex.rd: Likewise. testsuite/ld-x86-64/pr14207.d: Likewise. testsuite/ld-x86-64/tlsdesc.rd: Likewise. testsuite/ld-x86-64/tlspic.rd: Likewise. testsuite/ld-x86-64/tlspic2.rd: Likewise.
2021-06-19x86: Count PLT for GOTOFF relocation against IFUNC symbolH.J. Lu5-0/+58
Since GOTOFF relocations against IFUNC symbols must go through PLT, set PLT reference count to 1 for GOTOFF relocation. bfd/ PR ld/27998 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Count PLT for GOTOFF relocation against IFUNC symbols. (_bfd_x86_elf_adjust_dynamic_symbol): Likewise. ld/ PR ld/27998 * testsuite/ld-i386/i386.exp: Run PR ld/27998 tests. * testsuite/ld-i386/pr27998a.d: New file. * testsuite/ld-i386/pr27998a.s: Likewise. * testsuite/ld-i386/pr27998b.d: Likewise. * testsuite/ld-i386/pr27998b.s: Likewise.
2021-05-28x86: Restore PC16 relocation overflow checkH.J. Lu1-0/+1
The x86-64 psABI has --- A program or object file using R_X86_64_8, R_X86_64_16, R_X86_64_PC16 or R_X86_64_PC8 relocations is not conformant to this ABI, these relocations are only added for documentation purposes. --- Since x86 PC16 relocations have been used for 16-bit programs in an ELF32 or ELF64 container, PC16 relocation should wrap-around in 16-bit address space. Revert commit a7664973b24a242cd9ea17deb5eaf503065fc0bd Author: Jan Beulich <jbeulich@suse.com> Date: Mon Apr 26 10:41:35 2021 +0200 x86: correct overflow checking for 16-bit PC-relative relocs and xfail the related tests. Also revert commit 50c95a739c91ae70cf8481936611aa1f5397a384 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed May 26 12:13:13 2021 -0700 x86: Propery check PC16 reloc overflow in 16-bit mode instructions while keeping PR ld/27905 tests for PC16 relocation in 16-bit programs. bfd/ PR ld/27905 * elf32-i386.c: Don't include "libiberty.h". (elf_howto_table): Revert commits a7664973b24 and 50c95a739c9. (elf_i386_rtype_to_howto): Revert commit 50c95a739c9. (elf_i386_info_to_howto_rel): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (x86_64_elf_howto_table): Revert commits a7664973b24 and 50c95a739c9. (elf_x86_64_rtype_to_howto): Revert commit 50c95a739c9. * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Likewise. * elfxx-x86.h (elf_x86_obj_tdata): Likewise. (elf_x86_has_code16): Likewise. binutils/ PR ld/27905 * readelf.c (decode_x86_feature_2): Revert commit 50c95a739c9. gas/ PR ld/27905 * config/tc-i386.c (set_code_flag): Revert commit 50c95a739c9. (set_16bit_gcc_code_flag): Likewise. (x86_cleanup): Likewise. * testsuite/gas/i386/code16-2.d: Updated. * testsuite/gas/i386/x86-64-code16-2.d: Likewise. include/ PR ld/27905 * elf/common.h (GNU_PROPERTY_X86_FEATURE_2_CODE16): Removed. ld/ PR ld/27905 * testsuite/ld-i386/pcrel16-2.d: xfail. * testsuite/ld-x86-64/pcrel16-2.d: Likewise.
2021-05-26x86: Propery check PC16 reloc overflow in 16-bit mode instructionsH.J. Lu3-0/+27
commit a7664973b24a242cd9ea17deb5eaf503065fc0bd Author: Jan Beulich <jbeulich@suse.com> Date: Mon Apr 26 10:41:35 2021 +0200 x86: correct overflow checking for 16-bit PC-relative relocs caused linker failure when building 16-bit program in a 32-bit ELF container. Update GNU_PROPERTY_X86_FEATURE_2_USED with #define GNU_PROPERTY_X86_FEATURE_2_CODE16 (1U << 12) to indicate that 16-bit mode instructions are used in the input object: https://groups.google.com/g/x86-64-abi/c/UvvXWeHIGMA to indicate that 16-bit mode instructions are used in the object to allow linker to properly perform relocation overflow check for 16-bit PC-relative relocations in 16-bit mode instructions. 1. Update x86 assembler to always generate the GNU property note with GNU_PROPERTY_X86_FEATURE_2_CODE16 for .code16 in ELF object. 2. Update i386 and x86-64 linkers to use 16-bit PC16 relocations if input object is marked with GNU_PROPERTY_X86_FEATURE_2_CODE16. bfd/ PR ld/27905 * elf32-i386.c: Include "libiberty.h". (elf_howto_table): Add 16-bit R_386_PC16 entry. (elf_i386_rtype_to_howto): Add a BFD argument. Use 16-bit R_386_PC16 if input has 16-bit mode instructions. (elf_i386_info_to_howto_rel): Update elf_i386_rtype_to_howto call. (elf_i386_tls_transition): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (x86_64_elf_howto_table): Add 16-bit R_X86_64_PC16 entry. (elf_x86_64_rtype_to_howto): Use 16-bit R_X86_64_PC16 if input has 16-bit mode instructions. * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Set elf_x86_has_code16 if relocatable input is marked with GNU_PROPERTY_X86_FEATURE_2_CODE16. * elfxx-x86.h (elf_x86_obj_tdata): Add has_code16. (elf_x86_has_code16): New. binutils/ PR ld/27905 * readelf.c (decode_x86_feature_2): Support GNU_PROPERTY_X86_FEATURE_2_CODE16. gas/ PR ld/27905 * config/tc-i386.c (set_code_flag): Update x86_feature_2_used with GNU_PROPERTY_X86_FEATURE_2_CODE16 for .code16 in ELF object. (set_16bit_gcc_code_flag): Likewise. (x86_cleanup): Always generate the GNU property note if x86_feature_2_used isn't 0. * testsuite/gas/i386/code16-2.d: New file. * testsuite/gas/i386/code16-2.s: Likewise. * testsuite/gas/i386/x86-64-code16-2.d: Likewise. * testsuite/gas/i386/i386.exp: Run code16-2 and x86-64-code16-2. include/ PR ld/27905 * elf/common.h (GNU_PROPERTY_X86_FEATURE_2_CODE16): New. ld/ PR ld/27905 * testsuite/ld-i386/code16.d: New file. * testsuite/ld-i386/code16.t: Likewise. * testsuite/ld-x86-64/code16.d: Likewise. * testsuite/ld-x86-64/code16.t: Likewise. * testsuite/ld-i386/i386.exp: Run code16. * testsuite/ld-x86-64/x86-64.exp: Likewise.
2021-04-26x86: correct overflow checking for 16-bit PC-relative relocsJan Beulich3-0/+18
The only insn requiring a truly 16-bit PC-relative relocation outside of 16-bit mode is XBEGIN (with an operand size override). For it, the relocation generated should behave similar to 8- and (for 64-bit) 32-bit PC-relatives ones, i.e. be checked for a signed value to fit the field. This same mode is also correct for 16-bit code. Outside of 16-bit code, branches with operand size overrides act in a truly PC-relative way only when living in the low 32k of address space, as they truncate rIP to 16 bits. This can't be expressed by a PC-relative relocation. Putting in place a new testcase, I'd like to note that the two existing ones (pcrel16 and pcrel16abs) appear to be pretty pointless: They don't expect any error despite supposedly checking for overflow, and in fact there can't possibly be any error for the - former since gas doesn't emit any relocation in the first place there, - latter because the way the relocation gets expressed by gas doesn't allow the linker to notice the overflow; it should be detected by gas if at all, but see above (an error would be reported here for x86-64 afaict, but this test doesn't get re-used there).
2021-03-18elf: Handle .gnu.debuglto_.debug_* sectionsH.J. Lu1-2/+7
commit 994b25132814f4c2be93ce53a616a74139c4cf3c Author: H.J. Lu <hjl.tools@gmail.com> Date: Sun Jan 17 20:01:16 2021 -0800 ld/elf: Ignore section symbols when matching linkonce with comdat ignored section symbols when comparing symbols in 2 sections. Since all references to debugging sections are done with section symbols, symbols in debugging sections are ignored and we fail to match symbols in comdat debugging sections. Also .gnu.debuglto_.debug_* sections aren't treated as debugging sections. 1. Treate .gnu.debuglto_.debug_ section as debugging section unless it is marked with SHF_EXCLUDE. 2. Revert commit 994b2513281 in elf_create_symbuf. 3. Ignore section symbols only when matching non-debugging sections or linkonce section with comdat section. bfd/ PR ld/27590 * elf.c (_bfd_elf_make_section_from_shdr): Treate .gnu.debuglto_.debug_ section as debugging section unless it is marked with SHF_EXCLUDE. * elflink.c (elf_create_symbuf): Revert commit 994b2513281. (bfd_elf_match_symbols_in_sections): Ignore section symbols when matching non-debugging sections or linkonce section with comdat section. ld/ PR ld/27590 * testsuite/ld-elf/pr27590.s: New file. * testsuite/ld-elf/pr27590a.d: Likewise. * testsuite/ld-elf/pr27590b.d: Likewise. * testsuite/ld-i386/i386.exp: Also run ld/27193 test with --reduce-memory-overheads.
2021-02-20readelf: Replace procesor with processorH.J. Lu1-1/+1
binutils/ PR binutils/27445 * readelf.c (print_gnu_property_note): Replace procesor with processor. ld/ PR binutils/27445 * testsuite/ld-i386/property-x86-isa1.d: Replace procesor with processor. * testsuite/ld-x86-64/property-x86-isa1-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-isa1.d: Likewise.
2021-02-07ld: Remove x86 ISA level run-time testsH.J. Lu1-63/+0
Remove x86 ISA level run-time tests since with glibc 2.33, they will fail to run on machines with lesser x86 ISA level: tmpdir/property-5-pie: CPU ISA level is lower than required PR ld/27358 * testsuite/ld-i386/i386.exp: Remove property 3/4/5 run-time tests. * testsuite/ld-x86-64/x86-64.exp: Likewise.
2021-01-17ld/elf: Ignore section symbols when matching linkonce with comdatH.J. Lu4-0/+18
When deciding if a single member comdat group section in file FOO should be discarded by a linkonce section in file BAR, we check if 2 sections define the same set of local and global symbols. When only one of the files doesn't contain the unused section symbols in the symbol table, such as object files generated by clang or GNU assembler with commit d1bcae833b32f1408485ce69f844dcd7ded093a8 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Jan 7 06:42:00 2021 -0800 ELF: Don't generate unused section symbols the check will fail since one file has the extra unused section symbols. We should ignore both undefined and section symbols in the symbol table when making such a decision. bfd/ PR ld/27193 * elflink.c (elf_create_symbuf): Also ignore section symbols. ld/ PR ld/27193 * testsuite/ld-i386/i386.exp: Run PR ld/27193 test. * testsuite/ld-i386/pr27193.dd: New file. * testsuite/ld-i386/pr27193a.o.bz2: Likewise. * testsuite/ld-i386/pr27193b.s: Likewise.
2021-01-15ld/x86: Add -z report-relative-relocH.J. Lu4-0/+25
Linker generated relative relocations don't have symbol info: [hjl@gnu-cfl-2 tmpdir]$ readelf -rW dump Relocation section '.rela.dyn' at offset 0x180 contains 2 entries: Offset Info Type Sym. Value Symbol's Name + Addend 00002f70 00000008 R_X86_64_RELATIVE 1000 00002f68 00000025 R_X86_64_IRELATIVE 1007 [hjl@gnu-cfl-2 tmpdir]$ Add -z report-relative-reloc to x86 ELF linker to report dynamic relative relocations: [hjl@gnu-cfl-2 tmpdir]$ ../ld-new -pie -melf32_x86_64 -z report-relative-reloc -o dump report-reloc-1.o dump: R_X86_64_IRELATIVE (offset: 0x00002f68, info: 0x00000025, addend: 0x00001007) against 'ifunc' for section '.data.rel.ro.local' in report-reloc-1.o dump: R_X86_64_RELATIVE (offset: 0x00002f70, info: 0x00000008, addend: 0x00001000) against '_start' for section '.data.rel.ro.local' in report-reloc-1.o [hjl@gnu-cfl-2 tmpdir]$ It can be used to map relative relocations to corresponding symbols. bfd/ * elf-linker-x86.h (elf_linker_x86_params): Add report_relative_reloc. * elf32-i386.c (elf_i386_relocate_section): Call _bfd_x86_elf_link_report_relative_reloc to report relative relocations for -z report-relative-reloc. (elf_i386_finish_dynamic_symbol): Likewse. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewse. (elf_x86_64_finish_dynamic_symbol): Likewse. * elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): New function. * elfxx-x86.h (_bfd_x86_elf_link_report_relative_reloc): New prototype. ld/ * NEWS: Mention -z report-relative-reloc. * ld.texi: Document -z report-relative-reloc. * emulparams/elf32_x86_64.sh: Source x86-report-relative.sh. * emulparams/elf_i386.sh: Likewse. * emulparams/elf_x86_64.sh: Likewse. * emulparams/x86-report-relative.sh: New file. * testsuite/ld-i386/report-reloc-1.d: Likewse. * testsuite/ld-i386/report-reloc-1.l: Likewse. * testsuite/ld-i386/report-reloc-1.s: Likewse. * testsuite/ld-x86-64/report-reloc-1-x32.d: Likewse. * testsuite/ld-x86-64/report-reloc-1.d: Likewse. * testsuite/ld-x86-64/report-reloc-1.l: Likewse. * testsuite/ld-x86-64/report-reloc-1.s: Likewse. * testsuite/ld-i386/i386.exp: Run report-reloc-1. * testsuite/ld-x86-64/x86-64.exp: Run report-reloc-1 and report-reloc-1-x32.
2021-01-07ELF: Don't generate unused section symbolsH.J. Lu20-112/+25
For ELF targets, section symbols are required only for relocations. With -ffunction-sections -fdata-sections, there can be many unused section symbols. Sizes of libstdc++.a on Linux/x86-64 in GCC 11 are With unused section symbols : 39411698 bytes Without unused section symbols: 39227002 bytes The unused section symbols in libstdc++.a occupy more than 180 KB. Add BSF_SECTION_SYM_USED to indicate if a section symbol should be included in the symbol table. The BSF_SECTION_SYM_USED should be set if the section symbol is used for relocation or the section symbol is always included in the symbol table. Add keep_unused_section_symbols to bfd_target to indicate if unused section symbols should be kept. If TARGET_KEEP_UNUSED_SECTION_SYMBOLS is defined as FALSE, unused ection symbols will be removed. Tested on Linux/x86. Other ELF backends need to: 1. Define TARGET_KEEP_UNUSED_SECTION_SYMBOLS to FALSE. 2. Mark used section symbols in assembler backend. 3. Remove unused section symbols from expected assembler and linker outputs. bfd/ PR 27109 * aix386-core.c (core_aix386_vec): Initialize keep_unused_section_symbol to TARGET_KEEP_UNUSED_SECTION_SYMBOLS. * aout-target.h (MY (vec)): Likewise. * binary.c (binary_vec): Likewise. * cisco-core.c (core_cisco_be_vec): Likewise. (core_cisco_le_vec): Likewise. * coff-alpha.c (alpha_ecoff_le_vec): Likewise. * coff-i386.c (TARGET_SYM): Likewise. (TARGET_SYM_BIG): Likewise. * coff-ia64.c (TARGET_SYM): Likewise. * coff-mips.c (mips_ecoff_le_vec): Likewise. (mips_ecoff_be_vec): Likewise. (mips_ecoff_bele_vec): Likewise. * coff-rs6000.c (rs6000_xcoff_vec): Likewise. (powerpc_xcoff_vec): Likewise. * coff-sh.c (sh_coff_small_vec): Likewise. (sh_coff_small_le_vec): Likewise. * coff-tic30.c (tic30_coff_vec): Likewise. * coff-tic54x.c (tic54x_coff0_vec): Likewise. (tic54x_coff0_beh_vec): Likewise. (tic54x_coff1_vec): Likewise. (tic54x_coff1_beh_vec): Likewise. (tic54x_coff2_vec): Likewise. (tic54x_coff2_beh_vec): Likewise. * coff-x86_64.c (TARGET_SYM): Likewise. (TARGET_SYM_BIG): Likewise. * coff64-rs6000.c (rs6000_xcoff64_vec): Likewise. (rs6000_xcoff64_aix_vec): Likewise. * coffcode.h (CREATE_BIG_COFF_TARGET_VEC): Likewise. (CREATE_BIGHDR_COFF_TARGET_VEC): Likewise. (CREATE_LITTLE_COFF_TARGET_VEC): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Likewise. (TARGET_LITTLE_SYM): Likewise. * hppabsd-core.c (core_hppabsd_vec): Likewise. * hpux-core.c (core_hpux_vec): Likewise. * i386msdos.c (i386_msdos_vec): Likewise. * ihex.c (ihex_vec): Likewise. * irix-core.c (core_irix_vec): Likewise. * mach-o-target.c (TARGET_NAME): Likewise. * mmo.c (mmix_mmo_vec): Likewise. * netbsd-core.c (core_netbsd_vec): Likewise. * osf-core.c (core_osf_vec): Likewise. * pdp11.c (MY (vec)): Likewise. * pef.c (pef_vec): Likewise. (pef_xlib_vec): Likewise. * plugin.c (plugin_vec): Likewise. * ppcboot.c (powerpc_boot_vec): Likewise. * ptrace-core.c (core_ptrace_vec): Likewise. * sco5-core.c (core_sco5_vec): Likewise. * som.c (hppa_som_vec): Likewise. * srec.c (srec_vec): Likewise. (symbolsrec_vec): Likewise. * tekhex.c (tekhex_vec): Likewise. * trad-core.c (core_trad_vec): Likewise. * verilog.c (verilog_vec): Likewise. * vms-alpha.c (alpha_vms_vec): Likewise. * vms-lib.c (alpha_vms_lib_txt_vec): Likewise. * wasm-module.c (wasm_vec): Likewise. * xsym.c (sym_vec): Likewise. * elf.c (ignore_section_sym): Return TRUE if BSF_SECTION_SYM_USED isn't set. (elf_map_symbols): Don't include ignored section symbols. * elfcode.h (elf_slurp_symbol_table): Also set BSF_SECTION_SYM_USED on STT_SECTION symbols. * elflink.c (bfd_elf_final_link): Generated section symbols only when emitting relocations or reqired. * elfxx-x86.h (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New. * syms.c (BSF_SECTION_SYM_USED): New. * targets.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New. (bfd_target): Add keep_unused_section_symbols. (bfd_keep_unused_section_symbols): New. * bfd-in2.h: Regenerated. binutils/ PR 27109 * objcopy.c (copy_object): Handle section symbols for non-relocatable inputs. * testsuite/binutils-all/readelf.exp (readelf_test): Check is_elf_unused_section_symbols. * testsuite/binutils-all/readelf.s-64: Updated. * testsuite/binutils-all/readelf.ss: Likewise. * testsuite/binutils-all/readelf.ss-64: Likewise. * testsuite/binutils-all/readelf.s-64-unused: New file. * testsuite/binutils-all/readelf.ss-64-unused: Likewise. * testsuite/binutils-all/readelf.ss-unused: Likewise. * testsuite/lib/binutils-common.exp (is_elf_unused_section_symbols): New proc. gas/ChangeLog: PR 27109 * read.c (s_reloc): Call symbol_mark_used_in_reloc on the section symbol. * subsegs.c (subseg_set_rest): Set BSF_SECTION_SYM_USED if needed. * write.c (adjust_reloc_syms): Call symbol_mark_used_in_reloc on the section symbol. (set_symtab): Don't generate unused section symbols. (maybe_generate_build_notes): Call symbol_mark_used_in_reloc on the section symbol. * config/obj-elf.c (elf_adjust_symtab): Call symbol_mark_used_in_reloc on the group signature symbol. * testsuite/gas/cfi/cfi-label.d: Remove unused section symbols from expected output. * testsuite/gas/elf/elf.exp (run_elf_list_test): Check is_elf_unused_section_symbols. * testsuite/gas/elf/section2.e: Updated. * testsuite/gas/elf/section2.e-unused: New file. * testsuite/gas/elf/symver.d: Remove unused section symbols. * testsuite/gas/i386/ilp32/elf/symver.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-size-1.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-size-3.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-size-5.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-unwind.d: Likewise. * testsuite/gas/i386/size-1.d: Likewise. * testsuite/gas/i386/size-3.d: Likewise. * testsuite/gas/i386/svr4.d: Likewise. * testsuite/gas/i386/x86-64-size-1.d: Likewise. * testsuite/gas/i386/x86-64-size-3.d: Likewise. * testsuite/gas/i386/x86-64-size-5.d: Likewise. * testsuite/gas/i386/x86-64-unwind.d: Likewise. ld/ PR 27109 * testsuite/ld-elf/export-class.sd: Adjust the expected output. * testsuite/ld-elf/loadaddr3b.d: Likewise. * testsuite/ld-i386/ibt-plt-1.d: Likewise. * testsuite/ld-i386/ibt-plt-2a.d: Likewise. * testsuite/ld-i386/ibt-plt-2c.d: Likewise. * testsuite/ld-i386/ibt-plt-3a.d: Likewise. * testsuite/ld-i386/ibt-plt-3c.d: Likewise. * testsuite/ld-i386/pr19636-1d.d: Likewise. * testsuite/ld-i386/pr19636-1l.d: Likewise. * testsuite/ld-i386/pr19636-2c.d: Likewise. * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise. * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise. * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. * testsuite/ld-ifunc/pr17154-i386.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise. * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/pr19609-4e.d: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Likewise. * testsuite/ld-x86-64/pr19609-6b.d: Likewise. * testsuite/ld-x86-64/pr19609-7b.d: Likewise. * testsuite/ld-x86-64/pr19609-7d.d: Likewise. * testsuite/ld-x86-64/pr19636-2l.d: Likewise. * testsuite/ld-x86-64/pr20253-1d.d: Likewise. * testsuite/ld-x86-64/pr20253-1h.d: Likewise. * testsuite/ld-x86-64/pr21038b-now.d: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038c-now.d: Likewise. * testsuite/ld-x86-64/pr21038c.d: Likewise. * testsuite/ld-x86-64/pr23854.d: Likewise. * testsuite/ld-x86-64/pr25416-3.d: Likewise. * testsuite/ld-x86-64/pr25416-4.d: Likewise. * testsuite/ld-i386/plt-pic.pd: Likewise. * testsuite/ld-i386/plt-pic2.dd: Likewise. * testsuite/ld-i386/plt.pd: Likewise. * testsuite/ld-i386/plt2.dd: Likewise. * testsuite/ld-i386/tlsbin.rd: Likewise. * testsuite/ld-i386/tlsbin2.rd: Likewise. * testsuite/ld-i386/tlsbindesc.rd: Likewise. * testsuite/ld-i386/tlsdesc.rd: Likewise. * testsuite/ld-i386/tlsgdesc.rd: Likewise. * testsuite/ld-i386/tlsnopic.rd: Likewise. * testsuite/ld-i386/tlspic.rd: Likewise. * testsuite/ld-i386/tlspic2.rd: Likewise. * testsuite/ld-x86-64/mpx3.dd: Likewise. * testsuite/ld-x86-64/mpx3n.dd: Likewise. * testsuite/ld-x86-64/mpx4.dd: Likewise. * testsuite/ld-x86-64/mpx4n.dd: Likewise. * testsuite/ld-x86-64/pe-x86-64-1.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-2.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-3.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-4.od: Likewise. * testsuite/ld-x86-64/plt.pd: Likewise. * testsuite/ld-x86-64/plt2.dd: Likewise. * testsuite/ld-x86-64/tlsbin.rd: Likewise. * testsuite/ld-x86-64/tlsbin2.rd: Likewise. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise. * testsuite/ld-x86-64/tlsdesc.rd: Likewise. * testsuite/ld-x86-64/tlsgdesc.rd: Likewise. * testsuite/ld-x86-64/tlspic.rd: Likewise. * testsuite/ld-x86-64/tlspic2.rd: Likewise. * testsuite/ld-elf/sec64k.exp: Check is_elf_unused_section_symbols.
2021-01-04PR26822, How to prevent a STT_FILE with absolute path in the linked imageAlan Modra7-10/+10
bfd/ PR 26822 * elflink.c (elf_link_input_bfd): Use the file base name in linker generated STT_FILE symbols. ld/ PR 26822 * testsuite/ld-arm/non-contiguous-arm2.d: Adjust STT_FILE symbol match. * testsuite/ld-arm/non-contiguous-arm3.d: Likewise. * testsuite/ld-arm/non-contiguous-arm5.d: Likewise. * testsuite/ld-arm/non-contiguous-arm6.d: Likewise. * testsuite/ld-i386/tlsbin.rd: Likewise. * testsuite/ld-i386/tlsbin2.rd: Likewise. * testsuite/ld-i386/tlsbindesc.rd: Likewise. * testsuite/ld-i386/tlsdesc.rd: Likewise. * testsuite/ld-i386/tlsnopic.rd: Likewise. * testsuite/ld-i386/tlspic.rd: Likewise. * testsuite/ld-i386/tlspic2.rd: Likewise. * testsuite/ld-mips-elf/global-local-symtab-sort-n64.d: Likewise. * testsuite/ld-mips-elf/global-local-symtab-sort-n64t.d: Likewise. * testsuite/ld-mips-elf/global-local-symtab-sort-o32.d: Likewise. * testsuite/ld-mips-elf/global-local-symtab-sort-o32t.d: Likewise. * testsuite/ld-plugin/pr17973.d: Likewise. * testsuite/ld-tic6x/shlib-1.rd: Likewise. * testsuite/ld-tic6x/shlib-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise. * testsuite/ld-tic6x/shlib-noindex.rd: Likewise. * testsuite/ld-tic6x/static-app-1.rd: Likewise. * testsuite/ld-tic6x/static-app-1b.rd: Likewise. * testsuite/ld-tic6x/static-app-1r.rd: Likewise. * testsuite/ld-tic6x/static-app-1rb.rd: Likewise. * testsuite/ld-x86-64/tlsbin.rd: Likewise. * testsuite/ld-x86-64/tlsbin2.rd: Likewise. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise. * testsuite/ld-x86-64/tlsdesc.rd: Likewise. * testsuite/ld-x86-64/tlspic.rd: Likewise. * testsuite/ld-x86-64/tlspic2.rd: Likewise. * testsuite/ld-xtensa/tlsbin.rd: Likewise. * testsuite/ld-xtensa/tlspic.rd: Likewise.