summaryrefslogtreecommitdiff
path: root/ld
Commit message (Collapse)AuthorAgeFilesLines
* Decorated symbols in import libs (BUG 30421)Luca Bacci2023-05-174-8/+94
| | | | | | | | | | | PR 30421 * cofflink.c (_decoration_hash_newfunc): New function. (_bfd_coff_link_hash_table_init): Call it. * libcoff-in.h (struct coff_link_hash_table): Add decoration_hash field. (struct decoration_hash_entry): Declare. (_decoration_hash_newfunc): Prototype. * libcoff.h: Regenerate. * emultempl/pe.em (set_decoration): New function. (pe_fixup_stdcalls): Call the new function. * emultempl/pep.em (set_decoration): New function. (pep_fixup_stdcalls): Call the new function. * pe-dll.c (make_one): Check for decoated symbols.
* Document how to use the linker to create a resource only DLL.Nick Clifton2023-05-162-0/+38
| | | | | PR 30359 * ld.texi (WIN32): Document how to create a resource only DLL.
* -Ur option documentationNick Clifton2023-05-162-8/+16
| | | | * ld.texi (-Ur): Clarify the actions of this option.
* LoongArch: Fix PLT entry generate bugmengqinggang2023-05-151-1/+2
| | | | | | | | | | | | | | If a function symbol only get its address by la.global, without directly called by bl instruction, the PLT entry is not required. bfd/ChangeLog: * elfnn-loongarch.c (loongarch_elf_adjust_dynamic_symbol): Fix PLT entry generate bug. ld/ChangeLog: * testsuite/ld-elf/shared.exp: Clear xfail for LoongArch.
* PR28902, -T script with INSERT orderingAlan Modra2023-05-131-1/+8
| | | | | | | | | | | | | | | The answer to PR28902 may be deduced from the existing INSERT documentation that says the default script is parsed after the -T INSERT script, if you assume (correctly) that nothing special is done when inserting into -T scripts overriding the default script. In both cases INSERT handling looks for the specified output section later on the internal list of parsed script commands. This isn't obvious though, so make the ordering explicit, and mention that section assignments are the same too. PR 28902 * ld.texi (INSERT): Specify ordering when -T is used both to override the default script and to augment.
* Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128]Joseph Myers2023-05-1125-6/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one part of the fix for GCC PR109128, along with a corresponding GCC change. Without this patch, what happens in the linker, when an unused object in a .a file has offload data, is that elf_link_is_defined_archive_symbol calls bfd_link_plugin_object_p, which ends up calling the plugin's claim_file_handler, which then records the object as one with offload data. That is, the linker never decides to use the object in the first place, but use of this _p interface (called as part of trying to decide whether to use the object) results in the plugin deciding to use its offload data (and a consequent mismatch in the offload data present at runtime). The new hook allows the linker plugin to distinguish calls to claim_file_handler that know the object is being used by the linker (from ldmain.c:add_archive_element), from calls that don't know it's being used by the linker (from elf_link_is_defined_archive_symbol); in the latter case, the plugin should avoid recording the object as one with offload data. bfd/ * plugin.c (struct plugin_list_entry): Add claim_file_v2. (register_claim_file_v2): New. (try_load_plugin): Use LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (ld_plugin_object_p): Take second argument. (bfd_link_plugin_object_p): Update call to ld_plugin_object_p. (register_ld_plugin_object_p): Update argument prototype. (bfd_plugin_object_p): Update call to ld_plugin_object_p. * plugin.h (register_ld_plugin_object_p): Update argument prototype. include/ * plugin.api.h (ld_plugin_claim_file_handler_v2) (ld_plugin_register_claim_file_v2) (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (struct ld_plugin_tv): Add tv_register_claim_file_v2. ld/ * plugin.c (struct plugin): Add claim_file_handler_v2. (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (plugin_object_p): Add second argument. Update call to plugin_call_claim_file. (register_claim_file_v2): New. (set_tv_header): Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (plugin_call_claim_file): Add argument known_used. (plugin_maybe_claim): Update call to plugin_object_p. * testplug.c, testplug2.c, testplug3.c, testplug4.c: Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. * testsuite/ld-plugin/plugin-1.d, testsuite/ld-plugin/plugin-10.d, testsuite/ld-plugin/plugin-11.d, testsuite/ld-plugin/plugin-13.d, testsuite/ld-plugin/plugin-14.d, testsuite/ld-plugin/plugin-15.d, testsuite/ld-plugin/plugin-16.d, testsuite/ld-plugin/plugin-17.d, testsuite/ld-plugin/plugin-18.d, testsuite/ld-plugin/plugin-19.d, testsuite/ld-plugin/plugin-2.d, testsuite/ld-plugin/plugin-26.d, testsuite/ld-plugin/plugin-3.d, testsuite/ld-plugin/plugin-30.d, testsuite/ld-plugin/plugin-4.d, testsuite/ld-plugin/plugin-5.d, testsuite/ld-plugin/plugin-6.d, testsuite/ld-plugin/plugin-7.d, testsuite/ld-plugin/plugin-8.d, testsuite/ld-plugin/plugin-9.d: Update test expectations.
* Add linker option to include local symbols in the linker map.Nick Clifton2023-05-1010-2/+168
| | | | | | | | | | | | | PR 16566 * ldlang.c (ld_is_local_symbol): New function. (print_input_section): Add code to display local symbols in the section. * ldlex.h (enum option_values): Add OPTION_PRINT_MAP_LOCALS and OPTION_PRINT_MAP_LOCALS. * lexsup.c (ld_options[]): Add entries for --print-map-locals and --no-print-map-locals. * NEWS: Mention the new feature. * ld.h (struct ld_config_type): Add print_map_locals field. * ld.texi: Document the new command line option. * testsuite/ld-scripts/sizeof.s: Add a local symbol. * testsuite/ld-scripts/map-locals.d: New test control file. * testsuite/ld-scripts/map-address.exp: Run the new test.
* regen ld/Makefile.inAlan Modra2023-05-091-33/+45
|
* pe.em and pep.em make_import_fixupAlan Modra2023-05-082-40/+76
| | | | | | | | | | | | This is a little cleanup that I made when looking at pr30343 that makes it more obvious that make_import_fixup in both files are identical (and in fact the new pep.em read_addend could be used in both files). * emultempl/pep.em (read_addend): Extract from.. (make_import_fixup): ..here. * emultempl/pe.em (read_addend): Similarly. (make_import_fixup): Similarly. Add debug code from pep.em.
* PR30343, LTO ignores linker reference to _pei386_runtime_relocatorAlan Modra2023-05-083-0/+67
| | | | | | | | | | | | | | | | | | | Make a reference to _pei386_runtime_relocator before LTO recompilation. This is done regardless of whether such a reference will be used, because it can't be known whether it is needed before LTO. I also found it necessary to enable long section names for the bfd created in make_runtime_pseudo_reloc, because otherwise when writing it out to the bfd-in-memory we get the section written as .rdata_r which when read back in leads to a linker warning ".rdata_r: section below image base" and likely runtime misbehaviour. PR 30343 * emultempl/pe.em (make_runtime_ref): New function. (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New function. (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): Define. * emultempl/pep.em: Similarly to pe.em. * pe-dll.c (make_runtime_pseudo_reloc): Set long section names.
* Stop the linker from loosing the entry point for COFF/PE code when compiling ↵Nick Clifton2023-05-043-0/+13
| | | | | | | | with LTO enabled. PR 30300 * emultempl/pep.em (set_entry_point): Add an undefined reference to the entry point if it has been constructed heuristically. * emultempl/pe.em (set_entry_point): Likewise.
* ld: pru: Place exception-handling sections correctlyDimitar Dimitrov2023-05-042-8/+36
| | | | | | | | | * scripttempl/pru.sc (OUTPUT_SECTION_ALIGN): New helper variable to place at end of DMEM output sections. (.data): Use the helper variable. (.eh_frame): New output section. (.gnu_extab): Ditto. (.gcc_except_table): Ditto. (.resource_table): Use the helper variable.
* ld: Use run_cc_link_tests for PR ld/26391 testsH.J. Lu2023-04-281-11/+4
| | | | | | | | | Use run_cc_link_tests for PR ld/26391 tests to compile PR ld/26391 tests in C. PR ld/30002 * testsuite/ld-elf/elf.exp: Use run_cc_link_tests for PR ld/26391 tests.
* Fix PR30358, performance with --sort-sectionMichael Matz2023-04-271-31/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | since af31506c we only use the binary tree when section sorting is required. While its unbalanced and hence can degrade to a linear list it should otherwise have been equivalent to the old code relying on insertion sort. Unfortunately it was not. The old code directly used lang_add_section to populate the sorted list, the new code first populates the tree and only then does lang_add_section on the sorted result. In the testcase we have very many linkonce section groups, and hence lang_add_section won't actually insert anything for most of them. That limited the to-be-sorted list length previously. The tree-sorting code OTOH first created a tree of all candidates sections, including those that wouldn't be inserted by lang_add_section, hence increasing the size of the sorting problem. In the testcase the chain length went from about 1500 to 106000, and in the degenerated case (as in the testcase) that goes in quadratically. This splits out most of the early-out code from lang_add_section to its own function and uses the latter to avoid inserting into the tree. This refactoring slightly changes the order of early-out tests (the ones based on section flags is now done last, and only in lang_add_section). The new function is not a pure predicate: it can give warnings and it might change output_section, like the old early-out code did. I have also added a skip-warning case in the first discard case, whose non-existence seemed to have been an oversight. PR 30358 * ldlang.c (wont_add_section_p): Split out from ... (lang_add_section): ... here. (output_section_callback_sort): Use wont_add_section_p to not always add sections to the sort tree.
* Add support for %x and %lx formats to the linker's vinfo() function.Nick Clifton2023-04-272-1/+21
|
* section-select: Fix performance problem (PR30367)Michael Matz2023-04-251-4/+12
| | | | | | | | | | | | | | | | | | | | when using many wild-statements with non-wildcard filenames we were running into quadraticness via repeatedly using lookup_name on a long list of loaded files. I've originally retained using lookup_name because that preserved existing behaviour most obviously. In particular in matching wild-statements when using a non-wildcard filename it matches against local_sym_name, not the filename member. If the wildspec would have an archive-spec or a wildcard it would use the filename member, though. Also it would load the named file (and ignore it, as being not equal to the currently considered input-statement). Rewrite this to not use lookup_name but retain the comparison against local_sym_name with a comment to that effect. PR 30367 * ldlang.c (walk_wild_section_match): Don't use lookup_name but directly compare spec and local_sym_name.
* MIPS: support mips*64 as CPU and gnuabi64 as ABIYunQiang Su2023-04-231-2/+10
| | | | | | | | | | For MIPS64r6 ports, Debian as an example, `mipsisa64r6el` is used as the cpu name in triple. Let's recognize them by `mips*64*(el)`. For 64bit Ports, like Debian's mips64el and mips64r6el ports, `gnuabi64` is used as the abi section. Let's use N64 abi by default for the triple with gnuabi64.
* LoongArch: Fix loongarch32 test failsmengqinggang2023-04-231-7/+7
| | | | | | | | | | | | Regenerated macro_op_32.d and add skip loongarch64-*-*. gas/ChangeLog: * testsuite/gas/loongarch/macro_op_32.d: Regenerated. ld/ChangeLog: * testsuite/ld-loongarch-elf/macro_op_32.d: Regenerated.
* RISC-V: Optimize relaxation of gp with max_alignment.Lifang Xia2023-04-213-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should be the first related issue, which posted in riscv-gnu-toolchain, https://github.com/riscv-collab/riscv-gnu-toolchain/issues/497 If the output sections are not between gp and the symbol, then their alignments shouldn't affect the gp relaxation. However, this patch improves this idea even more, it limits the range to the gp+-2k, which means only the output section which are in the [gp-2K, gp+2K) range need to be considered. Even if the output section candidates may be different for each relax passes, the symbol that can be relaxed ar this round will not be truncated at next round. That is because this round you can do relaxation which means that the section where the symbol is located is within the [gp-2K, gp+2K) range, so all the output section alignments between them should be considered. In other words, if the alignments between them may cause truncated, then we should already preserve the size and won't do the gp relaxation this time. This patch can resolve the github issue which mentioned above, and also passed all gcc/binutils regressions of riscv-gnu-toolchain, so should be worth and safe enough to commit. Originally, this patch also do the same optimization for the call relaxations, https://sourceware.org/pipermail/binutils/2022-October/123918.html But just in case there is something that has not been considered, we only deal with the gp relaxation at this time. bfd/ * elfnn-riscv.c (riscv_elf_link_hash_table): Added new bfd_vma, max_alignment_for_gp. It is used to record the maximum alignment of the output sections, which are in the [gp-2K, gp+2k) range. (riscv_elf_link_hash_table_create): Init max_alignment_for_gp to -1. (_bfd_riscv_get_max_alignment): Added new parameter, gp. If gp is zero, then all the output section alignments are possible candidates; Otherwise, only the output sections which are in the [gp-2K, gp+2K) range need to be considered. (_bfd_riscv_relax_lui): Called _bfd_riscv_get_max_alignment with the non-zero gp if the max_alignment_for_gp is -1. (_bfd_riscv_relax_pc): Likewise. (_bfd_riscv_relax_section): Record the first input section, so that we can reset the max_alignment_for_gp for each repeated relax passes. ld/ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. * testsuite/ld-riscv-elf/relax-max-align-gp.*: New testcase. It fails without this patch.
* ld: add missing period after @xrefJan Beulich2023-04-211-1/+1
| | | | | At least older versions of one of the doc generation tools complain (warn) about it missing.
* PR30343 infrastructureAlan Modra2023-04-202-9/+10
| | | | | | | | | | Make ldemul_before_plugin_all_symbols_read more useful. * ldlang.c (lang_process): Move call to ldemul_before_plugin_all_symbols_read outside BFD_SUPPORTS_PLUGINS. Allow backends to add to gc_sym_list before handling entry sym. * ldelf.c (ldelf_before_plugin_all_symbols_read): Test lto_plugin_active.
* Symbols with GOT relocatios do not fix adjustbalemengqinggang2023-04-182-27/+31
| | | | | | | | | gas * config/tc-loongarch.c (loongarch_fix_adjustable): Symbols with GOT relocatios do not fix adjustbale. * testsuite/gas/loongarch/macro_op_large_abs.d: Regenerated. * testsuite/gas/loongarch/macro_op_large_pc.d: Regenerated. ld * testsuite/ld-loongarch-elf/macro_op.d: Regenerated. -
* Add support for the .gnu.sgstubs section to the linker for ARM/ELF based ↵Nick Clifton2023-04-172-0/+8
| | | | | | | targets. PR 30354 * emulparams/armelf.sh (OTHER_PLT_SECTIONS): Define in order to handle the .gnu.sgstubs section.
* arc: Update ARC specific linker tests.Claudiu Zissulescu2023-04-135-5/+12
| | | | | | | | All the tests are designed for a little-endian ARC system. Thus, update the arc predicate in arc.exp, improve the matching pattern for linker relaxation test, and add linker scripts to nps-1x tests. Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
* Fix typos in the linker's documentation of the ↵Nick Clifton2023-04-122-3/+8
| | | | --enable-non-contiguous-regions option.
* bfd+ld: when / whether to generate .c filesJan Beulich2023-04-045-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | Having been irritated by seeing bfd/elf{32,64}-aarch64.c to be re- generated in x86-only builds, I came across 769a27ade588 ("Re: bfd BLD-POTFILES.in dependencies"). I think this went slightly too far, as outside of maintainer mode dependencies will cause the subset of files to be (re-)generated which are actually needed for the build. Generating them all is only needed when wanting to update certain files under bfd/po/, i.e. in maintainer mode. In the course of looking around in an attempt to try to understand how things are meant to work, I further noticed that ld has got things slightly wrong too: BLD-POTFILES.in depending on $(BLD_POTFILES) isn't quite right (the output doesn't change when any of the enumerated files changes; it's the mere presence which matters); like in bfd it looks like we would better extend BUILT_SOURCES accordingly. Furthermore it became apparent that ld fails to enumerate the .c files generated from the .l and .y ones. While in their absence it was benign whether translatable strings in the source files were actually marked as such, this now becomes relevant. Mark respective strings at the same time, but skipping ones which look to be of interest for debugging purposes only (e.g. such used by printf() enclosed in #ifdef TRACE).
* lto: Don't add indirect symbols for versioned aliases in IRH.J. Lu2023-03-313-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Linker adds indirect symbols for versioned symbol aliases, which are created by ".symver foo, foo@FOO", by checking symbol type, value and section so that references to foo will be replaced by references to foo@FOO if foo and foo@FOO have the same symbol type, value and section. But in IR, since all symbols of the same type have the same value and section, we can't tell if a symbol is an alias of another symbol by their types, values and sections. We shouldn't add indirect symbols for versioned symbol aliases in IR. bfd/ PR ld/30281 * elflink.c (elf_link_add_object_symbols): Don't add indirect symbols for ".symver foo, foo@FOO" aliases in IR. ld/ PR ld/30281 * testsuite/ld-plugin/lto.exp: Add PR ld/30281 test. * testsuite/ld-plugin/pr30281.t: New file. * testsuite/ld-plugin/pr30281.c: Likewise.
* Fix typo in ld manual --enable-non-contiguous-regions exampleRoland McGrath2023-03-291-1/+1
|
* RISC-V: PR28789, Reject R_RISCV_PCREL relocations with ABS symbol in PIC/PIE.Palmer Dabbelt2023-03-308-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The non-preemptible SHN_ABS symbol with a pc-relative relocation should be disallowed when generating shared object (pic and pie). Generally, the following cases, which refer to pr25749, will cause a symbol be non-preemptible, * -pie, or -shared with -symbolic * STV_HIDDEN, STV_INTERNAL, STV_PROTECTED * Have dynamic symbol table, but without the symbol * VER_NDX_LOCAL However, PCREL_HI20/LO12 relocs are always bind locally when generating shared object, so not only the non-preemptible absolute symbol need to be disallowed, all absolute symbol references need but except that they are defined in linker script. If we also disallow the absolute symbol in linker script, then the glibc-linux toolchain build failed, so regard them as pc-relative symbols, just like what x86 did. Maybe we should add this check for all pc-relative relocations, rather than just handle in R_RISCV_PCREL relocs. Ideally, since the value of SHN_ABS symbol is a constant, only S - A relocations should be allowed in the shared object, so only BFD_RELOC_8/16/32/64 are allowed, which means R_RISCV_32/R_RISCV_64. bfd/ PR 28789 * elfnn-riscv.c (riscv_elf_check_relocs): The absolute symbol cannot be referneced with pc-relative relocation when generating shared object. ld/ PR 28789 * ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. * ld/testsuite/ld-riscv-elf/pcrel-reloc*: New testcases.
* RISC-V: Clarify link behaviors of R_RISCV_32/64 relocations with ABS symbol.Nelson Chu2023-03-3013-2/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two improvements, which are all referenced to aarch64, * R_RISCV_32 with non ABS symbol cannot be used under RV64 when making shard objects. * Don't need dynamic relocation for R_RISCV_32/64 under RV32/RV64 when making shared objects, if the referenced symbol is local ABS symbol. However, considering this link, https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/341 Seems like we should makes all R_RISCV_32/64 relocs with ABS symbol that don't need any dynamic relocations when making the shared objects. But anyway, I just sync the current behavior as aarch64 ld, in case there are any unexpected behaviors happen. Passed the gcc/binutils regressions in riscv-gnu-toolchain. bfd/ * elfnn-riscv.c (riscv_elf_check_relocs): Only allow R_RISCV_32 with ABS symbol under RV64. (riscv_elf_relocate_section): R_RISCV_32/64 with local ABS symbol under RV32/RV64 doesn't need any dynamic relocation when making shared objects. I just make the implementations similar to other targets, so that will be more easy to mainatain. ld/ * testsuite/ld-riscv-elf/data-reloc*: New testcases. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Added new data-reloc* testcases, and need to make ifunc-seperate* testcases work for rv32. * testsuite/ld-riscv-elf/ifunc-seperate-caller-nonplt.s: Likewise. * testsuite/ld-riscv-elf/ifunc-seperate-caller-plt.s: Likewise.
* ld testsuite CFLAGS_FOR_TARGETAlan Modra2023-03-292-11/+7
| | | | | | | | | | | | | | | | | | | run_host_cmd adds $gcc_B_opt and $ld_L_opt to the command line if it detects the program being run is a compiler. Since the program being run in lto.exp linking pr28138 is "sh", we need to add these by hand. This isn't exactly as run_host_cmd does, as it lacks reordering of any user -B option in $CC_FOR_TARGET, but it's better than ignoring gcc_B_opt. This fixes a mips64 testsuite fail. ld_compile adds CFLAGS_FOR_TARGET and other flags as well, so there is no need for the ld_compile command line to include CFLAGS_FOR_TARGET. Fixing this is just a tidy. * testsuite/ld-plugin/lto.exp: Add gcc_B_opt, CFLAGS_FOR_TARGET and $ld_L_opt to pr28138 link line. * testsuite/lib/ld-lib.exp (run_ld_link_tests): Don't pass unnecessary flags to ld_compile. (run_ld_link_exec_tests, run_cc_link_tests): Likewise.
* Use stdint types in coff internal_auxentAlan Modra2023-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | long is a poor choice of type to store 32-bit values read from objects files by H_GET_32. H_GET_32 doesn't sign extend so tests like that in gdb/coffread.c for "negative" values won't work if long is larger than 32 bits. If long is 32-bit then code needs to be careful to not accidentally index negative array elements. (I'd rather see a segfault on an unmapped 4G array index than silently reading bogus data.) long is also a poor choice for x_sect.s_scnlen, which might have 64-bit values. It's better to use unsigned exact width types to avoid surprises. I decided to change the field names too, which makes most of this patch simply renaming. Besides that there are a few places where casts are no longer needed, and where printf format strings or tests need adjusting. include/ * coff/internal.h (union internal_auxent): Use unsigned stdint types. Rename l fields to u32 and u64 as appropriate. bfd/ * coff-bfd.c, * coff-rs6000.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * peXXigen.c, * xcofflink.c: Adjust to suit internal_auxent changes. binutils/ * rdcoff.c: Adjust to suit internal_auxent changes. gas/ * config/obj-coff.h, * config/tc-ppc.c: Adjust to suit internal_auxent changes. gdb/ * coffread.c, * xcoffread.c: Adjust to suit internal_auxent changes. ld/ * pe-dll.c: Adjust to suit internal_auxent changes.
* bfd: aarch64: Optimize BTI stubs PR30076Szabolcs Nagy2023-03-233-0/+207
| | | | | Don't insert a second stub if the target is already compatible with an indirect branch.
* bfd: aarch64: Fix stubs that may break BTI PR30076Szabolcs Nagy2023-03-235-0/+192
| | | | | | | | | | | | | | Insert two stubs in a BTI enabled binary when fixing long calls: The first is near the call site and uses an indirect jump like before, but it targets the second stub that is near the call target site and uses a direct jump. This is needed when a single stub breaks BTI compatibility. The stub layout is kept fixed between sizing and building the stubs, so the location of the second stub is known at build time, this may introduce padding between stubs when those are relaxed. Stub layout with BTI disabled is unchanged.
* Changed ld and gas BPF testsCupertino Miranda2023-03-2012-99/+3
| | | | | | Recent BPF patch removed and renamed the list of relocations based on the limitations of BPF instruction set. This patch is a correction to the tests.
* Regen ld/po/BLD-POTFILES.inAlan Modra2023-03-191-0/+1
|
* Another source_shAlan Modra2023-03-171-1/+1
| | | | * scripttempl/z80.sc: Use source_sh to source elf.sc.
* Re: Add --enable-linker-version optionChristophe Lyon2023-03-162-2/+2
| | | | | | | | | | | | | | | | | | | | The recently-added ld-version*.d tests expect .*GNU ld \(GNU Binutils\) 2.* in the .comment section. However, when buidling --with-pkgversion=XXX, we get GNU ld (XXX) 2.[...] instead, leading to a spurious FAIL. This small patch replaces "GNU Binutils" with ".*" instead. I inspected other testcases to see if we already had similar occurrences but I couldn't see any, so I hope this fix is OK for the purpose? Thanks, Christophe
* ld/testsuite: disable ilp32 tests for aarch64-qnxClément Chigot2023-03-1639-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aarch64nto32 emulation isn't supported. The tests will then fall back on aarch64elf32. It does work but some extra warnings are being generated because the "-z relro" being added aarch64nto but ignored by aarch64elf32 emulation. Skip the tests to avoid any problems. ld/ChangeLog: * testsuite/ld-aarch64/emit-relocs-112-overflow.d: Skip for aarch64nto. * testsuite/ld-aarch64/emit-relocs-112.d: Likewise. * testsuite/ld-aarch64/emit-relocs-113.d: Likewise. * testsuite/ld-aarch64/emit-relocs-114-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-114.d: Likewise. * testsuite/ld-aarch64/emit-relocs-115.d: Likewise. * testsuite/ld-aarch64/emit-relocs-116-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-116.d: Likewise. * testsuite/ld-aarch64/emit-relocs-117.d: Likewise. * testsuite/ld-aarch64/emit-relocs-118-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-118.d: Likewise. * testsuite/ld-aarch64/emit-relocs-119.d: Likewise. * testsuite/ld-aarch64/emit-relocs-22.d: Likewise. * testsuite/ld-aarch64/emit-relocs-23.d: Likewise. * testsuite/ld-aarch64/emit-relocs-28.d: Likewise. * testsuite/ld-aarch64/emit-relocs-86-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-86.d: Likewise. * testsuite/ld-aarch64/emit-relocs-87.d: Likewise. * testsuite/ld-aarch64/emit-relocs-88-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-88.d: Likewise. * testsuite/ld-aarch64/emit-relocs-89.d: Likewise. * testsuite/ld-aarch64/emit-relocs-90-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-90.d: Likewise. * testsuite/ld-aarch64/emit-relocs-92.d: Likewise. * testsuite/ld-aarch64/tls-desc-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-all-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: Likewise.
* ld/testsuite: add aarch64nto to ld-aarch64Clément Chigot2023-03-161-0/+3
| | | | | | | ld/ChangeLog: * testsuite/ld-aarch64/aarch64-elf.exp: Add support for aarch64nto.
* ld: add support of QNX stack arguments for aarch64ntoClément Chigot2023-03-166-1/+220
| | | | | | | | | | | | | | | | | | | QNX is handling the stack argument using a .note section. Generate it according to ELF argument -zexecstack, -zstack-size and a new NTO argument --lazy-stack. Another NTO argument --stack mimicking -zstack-size is added in order to ensure compatibility with previously made NTO linkers. This requires a new emultempl nto.em which is applied above the default ${ARCH}elf.em. ld/ChangeLog: * emulparams/aarch64nto.sh: Move to nto.em. * emultempl/nto.em: New file. * testsuite/ld-aarch64/aarch64-nto.exp: New test. * testsuite/ld-aarch64/nto-stack-note-1.d: New test. * testsuite/ld-aarch64/nto-stack-note-2.d: New test. * testsuite/ld-aarch64/start.s: New test.
* configure: add new target aarch64-*-nto*Clément Chigot2023-03-164-0/+49
| | | | This target has its own ld emulation based on aarch64elf.em.
* Re: Add --enable-linker-verssionAlan Modra2023-03-1638-87/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output sections without any input sections to initialise their flags have their flags initialised by data statements to LOAD, ALLOC, HAS_CONTENTS by default. This is wrong for .comment. Fix that by making the script initialise the section type to INFO, one of the noalloc section types. That also allows the address of .comment to be set to zero, as is usual for non-alloc sections. Also, use source_sh for all of the sourced scripts to set up make dependencies. PR 30187 * scripttempl/misc-sections.sc: Set .comment address to zero and type to INFO. * scripttempl/ft32.sc: Fix breakages from last edit. * scripttempl/arclinux.sc: Use source_sh to source DWARF.sc and misc-sections.sc. * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/i386beos.sc: Likewise. * scripttempl/i386go32.sc: Likewise. * scripttempl/ia64vms.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/mmo.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/ld-version-2.d: Don't skip ft32 or pru.
* Add --enable-linker-version option to bfd linker to add an entry in the ↵Nick Clifton2023-03-1546-278/+243
| | | | | | | .comment section. PR 30187 * NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
* Revert ld ASCII supportAlan Modra2023-03-1011-213/+33
| | | | | | | | | | | | Revert "Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant." This reverts commit adbe951fc95943016325af08d677f18e8c177ac1. Revert "ld test asciz and ascii fails" This reverts the ascii.d part of commit 5f497256bee624f0fa470949aa41534093bc5b25. Revert "Add support for the ASCII directive inside linker scripts." This mostly reverts commit 9fe129a4105bb59398f73ce96938a94f19265b79 leaving the asciz.d and asciz.t changes in place.
* Revert ld DIGEST supportAlan Modra2023-03-1076-3903/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a hopefully temporary reversion of new ld features for embedded processors by Ulf Samuelsson, plus some followup patches. Squashed together from the following: Revert "lddigest 32-bit support and gcc-4 compile errors" This reverts commit d7ee19be87110a8f5342cec6e323d83d01c641d1. Revert "ld: Use correct types for crc64 calculations" This reverts commit 9a534b9f8e3d0f3cdb5a20f19ff165693fbb84d2. Revert "Re: DIGEST: testsuite" This reverts commit c8e85484d8a0fe9f7b88e00a6b9ae63bcb53ba32. Revert "Regen potfiles" This reverts commit 4d98c966f8bf305ab25badd34cb295631873cf7c. Revert "DIGEST: Makefile.*" This reverts commit 78ef6ab03f56ce83a606d974bb8a9f34b5d6e0b7. Revert "DIGEST: calculation" This reverts commit 5243990191e683d5066d3dd622c76deaba0bf15c. Revert "DIGEST: ldlang.*: add timestamp" This reverts commit bd9466d4aa277a469a9d8b12f0a6e6fa51678e36. Revert "DIGEST: ldmain.c" This reverts commit c8f8653fa7eeb3dc0769ac23039eadb5c5f09dff. Revert "DIGEST: ldgram.y" This reverts commit d73c01be2669e9c5267fab669a269f95a32048c9. Revert "DIGEST: ldlex.l" This reverts commit 48b5163a9dd5759cc87171331bbd6e902c547b5a. Revert "DIGEST: testsuite" This reverts commit a4135d1a4886400ea29af2da782dd8dd40ccad23. Revert "DIGEST: Documentation" This reverts commit 3ec28966c3e4c63704212778f96c517cbf2e0090. Revert "DIGEST: NEWS" This reverts commit 099bf2927d446424e8585a60cf4ce63209999aa2. Revert "DIGEST: LICENSING" This reverts commit 5c8a0c6654fb55926985edf3b360b62d4f20691d.
* lddigest 32-bit support and gcc-4 compile errorsAlan Modra2023-03-098-49/+82
| | | | | | | | | | | | | | * ld.texi: Revert 2023-03-08 commit 9a534b9f8e3d. * testsuite/ld-scripts/crc64-poly.d: Likewise. * testsuite/ld-scripts/crc64-poly.t: Likewise. * lddigest.c: Formatting. (get_uint64_t): New function. (lang_add_digest): Take etree_type* args. Replace "illegal" with "invalid" in error message. * lddigest.h (lang_add_digest): Update prototype. * lddigest_tab.c (algorithms): Work around gcc-4 errors. * ldgram.y (polynome): Adjust lang_add_digest call. * testsuite/ld-scripts/crc64-poly-size.d: Update expected error.
* ld: Use correct types for crc64 calculationsNick Clifton2023-03-086-44/+70
|
* Re: DIGEST: testsuiteAlan Modra2023-03-0815-50/+25
| | | | | | | Correct test target/skip lines to fix fails on alpha-dec-vms, alpha-linux-gnuecoff, i386-bsd, i386-msdos, ns32k-openbsd, ns32k-pc532-mach, pdp11-dec-aout, rs6000-aix*, tic4x-coff, and tic54x-coff.
* Regen potfilesAlan Modra2023-03-081-0/+7
|