aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2022-11-10ld/testsuite: skip ld-size when -shared is not supportedClément Chigot1-0/+6
ld/ChangeLog: * testsuite/ld-size/size.exp: Skip when -shared is not supported.
2022-11-10ld: Add module information substream to PDB filesMark Harmstone5-44/+427
2022-11-07configure: require libzstd >= 1.4.0Christophe Lyon1-10/+10
gas uses ZSTD_compressStream2 which is only available with libzstd >= 1.4.0, leading to build errors when an older version is installed. This patch updates the check libzstd presence to check its version is >= 1.4.0. However, since gas seems to be the only component requiring such a recent version this may imply that we disable ZSTD support for all components although some would still benefit from an older version. I ran 'autoreconf -f' in all directories containing a configure.ac file, using vanilla autoconf-2.69 and automake-1.15.1. I noticed several errors from autoheader in readline, as well as warnings in intl, but they are unrelated to this patch. This should fix some of the buildbots. OK for trunk? Thanks, Christophe
2022-11-07ld/testsuite: skip tests related to -shared when disabledClément Chigot3-0/+15
Call the helper function "check_shared_lib_support" to ensure -shared is enabled before launching ld-shared, ld-elfweak and ld-elfvers. This allows to catch custom targets explicitly disabling it. ld/ChangeLog: * testsuite/ld-elfvers/vers.exp: Call check_shared_lib_support. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise.
2022-11-03V850 Linker: do not complain about RWX segments.Nick Clifton2-2/+9
PR 29748 * configure.tgt (ac_default_ld_warn_rwx_segments): Set to 0 for the V850.
2022-11-03AVR Linker: Allow the start of the data region to be specified on the linker ↵Nick Clifton1-1/+1
command line. [Fix PR number in ChangeLog entry] PR 29741 * scripttempl/avr.sc (__DATA_REGION_ORIGIN__): Define. If a value has not been provided on the command line then use DATA_ORIGIN. (MEMORY): Use __DATA_REGION_ORIGIN__ as the start of the data region.
2022-11-03AVR Linker: Allow the start of the data region to specified on the command line.Nick Clifton2-1/+10
PR 29471 * scripttempl/avr.sc (__DATA_REGION_ORIGIN__): Define. If a value has not been provided on the command line then use DATA_ORIGIN. (MEMORY): Use __DATA_REGION_ORIGIN__ as the start of the data region.
2022-11-02arm: PR 29739 Fix typo where ';' should not have been replaced with '@'Christophe Lyon3-3/+3
';' does not always indicate the start of a comment, and commit 8cb6e17571f3fb66ccd4fa19f881602542cd06fc incorrectly replaced 3 instances of ';' with '@' in expected diagnostics, leading to tests failures. This patch restores the original ';' as needed in these testcases. Fixes bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29739
2022-11-01opcodes/arm: use '@' consistently for the comment characterAndrew Burgess115-1209/+1209
Looking at the ARM disassembler output, every comment seems to start with a ';' character, so I assumed this was the correct character to start an assembler comment. I then spotted a couple of places where there was no ';', but instead, just a '@' character. I thought that this was a case of a missing ';', and proposed a patch to add the missing ';' characters. Turns out I was wrong, '@' is actually the ARM assembler comment character, while ';' is the statement separator. Thus this: nop ;@ comment is two statements, the first is the 'nop' instruction, while the second contains no instructions, just the '@ comment' comment text. This: nop @ comment is a single 'nop' instruction followed by a comment. And finally, this: nop ; comment is two statements, the first contains the 'nop' instruction, while the second contains the instruction 'comment', which obviously isn't actually an instruction at all. Why this matters is that, in the next commit, I would like to add libopcodes syntax styling support for ARM. The question then is how should the disassembler style the three cases above? As '@' is the actual comment start character then clearly the '@' and anything after it can be styled as a comment. But what about ';' in the second example? Style as text? Style as a comment? And the third example is even harder, what about the 'comment' text? Style as an instruction mnemonic? Style as text? Style as a comment? I think the only sensible answer is to move the disassembler to use '@' consistently as its comment character, and remove all the uses of ';'. Then, in the next commit, it's obvious what to do. There's obviously a *lot* of tests that get updated by this commit, the only actual code changes are in opcodes/arm-dis.c.
2022-10-31Updated Romainain translation for the binutils sub-directory and Swedish ↵Nick Clifton1-2180/+2911
translations for the ld and opcodes sub-directories.
2022-10-31ld: Add publics stream to PDB filesMark Harmstone6-8/+559
2022-10-31ld: Add section header stream to PDB filesMark Harmstone2-3/+189
2022-10-31ld: Use %E in einfo in pdb.cMark Harmstone1-10/+9
Resubmission, taking into account https://sourceware.org/pipermail/binutils/2022-October/123948.html.
2022-10-27tests: use canonical option nameMartin Liska1-1/+1
ld/ChangeLog: * testsuite/ld-size/size.exp: Use canonical option name.
2022-10-27Re: ld/testsuite: adjust ld-arm to run shared tests only when supportedAlan Modra1-2/+2
commit 67527cffcd enabled previously disabled tests unresolved-1-dyn, thumb-plt and thumb-plt-got for nacl. The first fails due to trying to link against mixed-lib.so which isn't compiled for nacl. The last two fail with objdump: tmpdir/dump(.rel.plt): relocation 0 has invalid symbol index 14885104 and readelf: Error: bad symbol index: 00e320f0 in reloc Relocation section '.rel.plt' at offset 0x128 contains 1 entry: Offset Info Type Sym. Value Symbol's Name e320f000 e320f000 R_ARM_NONE * testsuite/ld-arm/arm-elf.exp: Disable unresolved-1-dyn, thumb-plt and thumb-plt-got for nacl.
2022-10-24ld/testsuite: adjust ld-arm to run shared tests only when supportedClément Chigot1-159/+166
If a custom arm-elf target is disabling the shared support, a lot of failures are reported by the testsuite. Moreover, some tests try to access libraries which have been explicitly skipped earlier (eg mixed-lib.so). ld/ChangeLog: * testsuite/ld-arm/arm-elf.exp: Separate tests needing shared lib support.
2022-10-24ld/testsuite: skip ld-elf/exclude when -shared is not supportedClément Chigot1-2/+2
ld/ChangeLog: * testsuite/ld-elf/exclude.exp: Call check_shared_lib_support. to skip for all targets without shared lib support.
2022-10-21Add a -w option to the linker to suppress warning and error messages.Nick Clifton7-1/+42
PR 29654 * ld.h (struct ld_config_type): Add no_warnings field. * ldlex.h (enum option_values): Add OPTION_NO_WARNINGS. * lexsup.c (ld_options): Add --no-warnings. (parse_args): Add support for -w and --no-warnings. * ldmisc.c (vfinfo): Return early if the message is a warning and -w has been enabled. * ld.texi (options): Document new command line option. * NEWS: Mention the new feature.
2022-10-20Re: aarch64-pe support for LD, GAS and BFDAlan Modra2-1/+4
Fix dependencies for eaarch64pe.c. Generated files aren't handled fully automatically.
2022-10-20ld: Add minimal pdb generationMark Harmstone8-9/+930
2022-10-20ld: Add --pdb optionMark Harmstone4-9/+147
Second patch incorporates fixes for endian and UB issues in calc_hash, as per https://sourceware.org/pipermail/binutils/2022-October/123514.html.
2022-10-20Regen ld/po/BLD-POTFILES.inAlan Modra1-0/+1
2022-10-19aarch64-pe support for LD, GAS and BFDJedidiah Thompson12-14/+139
Allows aarch64-pe to be targeted natively, not having to use objcopy to convert it from ELF to PE. Based on initial work by Jedidiah Thompson Co-authored-by: Jedidiah Thompson <wej22007@outlook.com> Co-authored-by: Zac Walker <zac.walker@linaro.org>
2022-10-19IBM zSystems: Issue error for *DBL relocs on misaligned symbolsAndreas Krebbel2-0/+17
Relocs like PC32DBL require a right shift of the symbol value. There is no situation where dropping symbol value bits with the right shift is a good thing. Hence we now issue an error to detect such problems.
2022-10-17ld/testsuite: consistently add board_ldflags when linking with GCCClément Chigot2-5/+25
Currently, the functions checking if the compiler is available or if a feature is available add both board_cflags and board_ldflags. However, functions running the tests only retrieve board_cflags. This can lead to unexpected errors when mandaratory flags are defined in board_ldflags and not board_cflags. ld/ChangeLog: * testsuite/ld-unique/unique.exp: Add board_ldflags when linking with GCC. * testsuite/lib/ld-lib.exp: Likewise.
2022-10-13ld: Add --undefined-versionFangrui Song2-0/+6
This cancels a previous --no-undefined-version. gold has had --undefined-version for a long time.
2022-10-11add --enable-default-compressed-debug-sections-algorithm configure optionMartin Liska5-3/+40
ChangeLog: * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. gas/ChangeLog: * NEWS: Document the new option. * as.c (flag_compress_debug): Set default algorithm based on the configure option. * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. * config.in: Likewise. ld/ChangeLog: * NEWS: Document the new option. * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. * config.in: Likewise. * ldmain.c: Set default algorithm based on the configure option.
2022-10-11refactor usage of compressed_debug_section_typeMartin Liska2-21/+9
bfd/ChangeLog: * bfd-in.h (bfd_hash_set_default_size): Add COMPRESS_UNKNOWN enum value. (struct compressed_type_tuple): New. * bfd-in2.h (bfd_hash_set_default_size): Regenerate. (struct compressed_type_tuple): Likewise. * libbfd.c (ARRAY_SIZE): New macro. (bfd_get_compression_algorithm): New function. (bfd_get_compression_algorithm_name): Likewise. gas/ChangeLog: * as.c: Do not special-case, use the new functions. ld/ChangeLog: * emultempl/elf.em: Do not special-case, use the new functions. * lexsup.c (elf_static_list_options): Likewise.
2022-09-30RISC-V: re-arrange opcode table for consistent alias handlingJan Beulich6-9/+9
For disassembly to pick up aliases in favor of underlying insns (helping readability in the common case), the aliases need to come ahead of the "base" insns. Slightly more code movement is needed because of insns with the same name needing to stay next to each other. Note that the "rorw" alias entry also has the missing INSN_ALIAS added here. Clone a few testcases to exercise -Mno-aliases some more, better covering the differences between the default and that disassembly mode.
2022-09-28ld/testsuite: force warnings when dealing with execstack testsClément Chigot1-10/+3
Binutils can be configured to avoid printing the execstack or RWD segment warnings. In this case, the first test of PR ld/29072 will fail. Fix that by always manually forcing the warnings for it. ld/ChangeLog: * testsuite/ld-elf/elf.exp (PR ld/29072): Force execstack and RWD segment warnings.
2022-09-28Re: egrep in binutilsAlan Modra1-3/+1
Multi-line patterns for grep are not supported on some old versions of grep. binutils/ * embedspu.sh: Replace multi-line grep with sed. ld/ * testsuite/ld-elfvers/vers.exp: Replace multi-line grep with sed.
2022-09-28egrep in binutilsAlan Modra1-1/+3
Apparently some distros have a nagging egrep that helpfully tells you egrep is deprecated and to use "grep -E". The nag message causes a ld testsuite failure. What's more the advice isn't that good. The "-E" flag may not be available with older versions of grep. This patch fixes bare invocation of egrep within binutils, replacing it with the autoconf $EGREP or with grep. config/ * lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and invoke $EGREP. (AC_LIB_PROG_LD): Likewise. binutils/ * configure: Regenerate. * embedspu.sh: Replace egrep with grep. gold/ * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Replace egrep with grep. * testsuite/Makefile.in: Regenerate. * testsuite/bnd_ifunc_1.sh: Replace egrep with $EGREP. * testsuite/bnd_ifunc_2.sh: Likewise. * testsuite/bnd_plt_1.sh: Likewise. * testsuite/discard_locals_test.sh: Likewise. * testsuite/gnu_property_test.sh: Likewise. * testsuite/no_version_test.sh: Likewise. * testsuite/pr18689.sh: Likewise. * testsuite/pr26936.sh: Likewise. * testsuite/retain.sh: Likewise. * testsuite/split_i386.sh: Likewise. * testsuite/split_s390.sh: Likewise. * testsuite/split_x32.sh: Likewise. * testsuite/split_x86_64.sh: Likewise. * testsuite/ver_test_pr16504.sh: Likewise. intl/ * configure: Regenerate. ld/ * testsuite/ld-elfvers/vers.exp (test_ar): Replace egrep with grep.
2022-09-26binutils, gdb: support zstd compressed debug sectionsFangrui Song13-141/+324
PR29397 PR29563: Add new configure option --with-zstd which defaults to auto. If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support zstd compressed debug sections for most tools. * bfd: for addr2line, objdump --dwarf, gdb, etc * gas: support --compress-debug-sections=zstd * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd * objcopy: support ELFCOMPRESS_ZSTD input for --decompress-debug-sections and --compress-debug-sections=zstd * gdb: support ELFCOMPRESS_ZSTD input. The bfd change references zstd symbols, so gdb has to link against -lzstd in this patch. If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error. We can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this is too heavyweight, so don't do it for now. ``` % ld/ld-new a.o ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support ... % ld/ld-new a.o --compress-debug-sections=zstd ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support % binutils/objcopy --compress-debug-sections=zstd a.o b.o binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with zstd support % binutils/objcopy b.o --decompress-debug-sections binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support ... ```
2022-09-27PR29617, ld segfaults when bfd_close failsAlan Modra1-1/+1
PR 29617 * ldmain.c (main): Don't access output_bfd after bfd_close.
2022-09-26PKG_CHECK_MODULES for msgpack and janssonAlan Modra2-30/+10
Using AS_IF rather than shell "if" is recommended for conditionals that contain non-trivial autoconf macros, because autoconf will emit any AC_REQUIREd autoconf macro expansions outside of the conditional. This makes them available elsewhere in the configure script. binutils/ * configure.ac (msgpack): Use "AS_IF" rather than "if". * configure: Regenerate. ld/ * configure.ac (jansson): Use "AS_IF" rather than "if". * configure: Regenerate.
2022-09-22ld/testsuite: allow to force another directory for gcc linkerClément Chigot1-8/+15
Add a new variable "ld_testsuite_tmpdir" to enable manual configuration of the -B flag added to gcc calls. This flag ensure that gcc is invoking the linker and the assembler we want to test. When launching the testsuite outside of the build tree, the links made by the testsuite in tmpdir/ld will point to nothing. Thus, even with the PATH correctly setup towards the linker directory, gcc might end up falling back to its default linker. Hence this variable to ensure that gcc, whatever happens, is using the linker we want. ld/ChangeLog: * testsuite/config/default.exp: Allow to change -B flag with ld_testsuite_bindir variable.
2022-09-22ld/testsuite: skip bootstrap.exp when OFILES are missingClément Chigot1-0/+6
OFILES are normally provided through an environment variable set by Makefiles. However, when launching the testsuite directly through runtest outside the build tree, it can be hard to retrieve them. Thus, they can be missing. Instead of letting tcl raise an error when trying to access this OFILES variable, skip bootstrap.exp if it doesn't exist. ld/ChangeLog: * testsuite/ld-bootstrap/bootstrap.exp: Skip if OFILES is missing
2022-09-21RISC-V: Always generate R_RISCV_CALL_PLT reloc for call in assembler.Nelson Chu1-28/+28
Since we have the same behaviors of CALL and CALL_PLT relocs in linker for now, https://github.com/bminor/binutils-gdb/commit/3b1450b38c644f99aa2e211747b428b9f8d15cca And the psabi already deprecate the CALL reloc, https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 Therefore, we should always generate R_RISCV_CALL_PLT reloc for call, even if it has @plt postfix. I believe LLVM (https://reviews.llvm.org/D132530) already support this, so GNU as should do the same thing. gas/ * config/tc-riscv.c (riscv_ip): Always generate CALL_PLT reloc for call, even if it has @plt postfix. * testsuite/gas/riscv/no-relax-reloc.d: Updated CALL to CALL_PLT. * testsuite/gas/riscv/relax-reloc.d: Likewise. ld/ * testsuite/ld-riscv-elf/variant_cc-r.d: Updated CALL to CALL_PLT.
2022-09-20New Serbian translations for various binutils sub-directories.Nick Clifton1-1800/+1877
2022-09-20LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocsXi Ruoyao3-0/+39
loongarch_elf_finish_dynamic_symbol is called after elf_link_sort_relocs if -z combreloc. elf_link_sort_relocs redistributes the contents of .rela.* sections those would be merged into .rela.dyn, so the slot for R_LARCH_IRELATIVE may be out of relplt->contents now. To make things worse, the boundary check dyn < dyn + relplt->size / sizeof (*dyn) is obviously wrong ("x + 10 < x"? :), causing the issue undetected during the linking process and the resulted executable suddenly crashes at runtime. The issue was found during an attempt to add static-pie support to the toolchain. Fix it by iterating through the inputs of .rela.dyn to find the slot.
2022-09-15bfd, binutils, gas: Remove/mark unused variablesTsukasa OI1-7/+2
Clang generates a warning on unused (technically, written but not read thereafter) variables. By the default configuration (with "-Werror"), it causes a build failure (unless "--disable-werror" is specified). This commit adds ATTRIBUTE_UNUSED attribute to some of them, which means they are *possibly* unused (can be used but no warnings occur when unused) and removes others. bfd/ChangeLog: * elf32-lm32.c (lm32_elf_size_dynamic_sections): Mark unused rgot_count variable. * elf32-nds32.c (elf32_nds32_unify_relax_group): Remove unused count variable. * mmo.c (mmo_scan): Mark unused lineno variable. binutils/ChangeLog: * windmc.c (write_rc): Remove unused i variable. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Remove unused argnum variable. ld/ChangeLog: * pe-dll.c (generate_reloc): Remove unused bi and page_count variables.
2022-09-14bfd: Stop using -Wstack-usage=262144 when built with ClangTsukasa OI1-0/+18
Some components of GNU Binutils will pass "-Wstack-usage=262144" when "GCC >= 5.0" is detected. However, Clang does not support "-Wstack-usage", despite that related configuration part in bfd/warning.m4 handles the latest Clang (15.0.0 as of this writing) as "GCC >= 5.0". The option "-Wstack-usage" was ignored when the first version of Clang is released but even this "ignoring" behavior is removed before Clang 4.0.0. So, if we give Clang "-Wstack-usage=262144", it generates a warning, making the build failure. This commit checks "__clang__" macro to prevent adding the option if the compiler is identified as Clang. bfd/ChangeLog: * warning.m4: Stop appending "-Wstack-usage=262144" option when compiled with Clang. * configure: Regenerate. binutils/ChangeLog: * configure: Regenerate. gas/ChangeLog: * configure: Regenerate. gold/ChangeLog: * configure: Regenerate. gprof/ChangeLog: * configure: Regenerate. ld/ChangeLog: * configure: Regenerate. opcodes/ChangeLog: * configure: Regenerate.
2022-09-14Modify ld-ctf test files to suit ARMAlan Modra12-24/+24
The "@" char starts a comment on ARM. * testsuite/ld-ctf/diag-ctf-version-0.s: Replace @progbits with %progbits. * testsuite/ld-ctf/diag-ctf-version-2-unsupported-feature.s: Likewise. * testsuite/ld-ctf/diag-ctf-version-f.s: Likewise. * testsuite/ld-ctf/diag-cttname-invalid.s: Likewise. * testsuite/ld-ctf/diag-cttname-null.s: Likewise. * testsuite/ld-ctf/diag-cuname.s: Likewise. * testsuite/ld-ctf/diag-decompression-failure.s: Likewise. * testsuite/ld-ctf/diag-parlabel.s: Likewise. * testsuite/ld-ctf/diag-parname.s: Likewise. * testsuite/ld-ctf/diag-strlen-invalid.s: Likewise. * testsuite/ld-ctf/diag-unsupported-flag.s: Likewise. * testsuite/ld-ctf/diag-wrong-magic-number.s: Likewise.
2022-09-12ld: pe: Apply review suggestions on the existing exports/imports arraysMartin Storsjö3-86/+83
Use a separate explicit max_exports/imports field, instead of deducing it from the number of allocated elements. Use a named constant for the incremental growth of the array. Use bool instead of int for boolean values. Remove an unnecessary if statement/scope in the def_file_free function. Add more verbose comments about parameters, and about insertion into an array of structs. Generally use unsigned integers for all array indices and sizes. The num_exports/imports fields are kept as is as signed integers, since changing them to unsigned would require a disproportionate amount of changes ti pe-dll.c to avoid comparisons between signed and unsigned. Simply use xrealloc instead of a check and xmalloc/xrealloc; xrealloc can take NULL as the first parameter (and does a similar check internally). (This wasn't requested in review though, but noticed while working on the code.)
2022-09-12ld: pe: Improve performance of object file exclude symbol directivesMartin Storsjö3-35/+99
Store the list of excluded symbols in a sorted list, speeding up checking for duplicates when inserting new entries. This is done in the same way as is done for exports and imports (while the previous implementation was done with a linked list, based on the implementation for aligncomm). When linking object files with excluded symbols, there can potentially be very large numbers of excluded symbols (just like builds with exports can have a large number of exported symbols). This improves the link performance somewhat, when linking with large numbers of excluded symbols. The later actual use of the excluded symbols within pe-dll.c handles them via an unordered linked list still, though.
2022-09-12RISC-V: PR28509, the default visibility symbol cannot be referenced by ↵Nelson Chu12-29/+83
R_RISCV_JAL. When generating the shared object, the default visibility symbols may bind externally, which means they will be exported to the dynamic symbol table, and are preemptible by default. These symbols cannot be referenced by the non-pic R_RISCV_JAL and R_RISCV_RVC_JUMP. However, consider that linker may relax the R_RISCV_CALL relocations to R_RISCV_JAL or R_RISCV_RVC_JUMP, if these relocations are relocated to the plt entries, then we won't report error for them. Perhaps we also need the similar checks for the R_RISCV_BRANCH and R_RISCV_RVC_BRANCH relocations. After applying this patch, and revert the following glibc patch, riscv: Fix incorrect jal with HIDDEN_JUMPTARGET https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b I get the expected errors as follows, ld: relocation R_RISCV_RVC_JUMP against `__sigsetjmp' which may bind externally can not be used when making a shared object; recompile with -fPIC ld: relocation R_RISCV_JAL against `exit' which may bind externally can not be used when making a shared object; recompile with -fPIC Besides, we also have similar changes for libgcc, RISC-V: jal cannot refer to a default visibility symbol for shared object https://github.com/gcc-mirror/gcc/commit/45116f342057b7facecd3d05c2091ce3a77eda59 bfd/ pr 28509 * elfnn-riscv.c (riscv_elf_relocate_section): Report errors when makeing a shard object, and the referenced symbols of R_RISCV_JAL relocations are default visibility. Besides, we should handle most of the cases here, so don't need the unresolvable check later for R_RISCV_JAL and R_RISCV_RVC_JUMP. ld/ pr 28509 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. * testsuite/ld-riscv-elf/lib-nopic-01a.s: Removed. * testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise. * testsuite/ld-riscv-elf/lib-nopic-01b.s: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-01.d: New testcase. * testsuite/ld-riscv-elf/shared-lib-nopic-01.s: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-02.d: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-02.s: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-03.d: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-03.s: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-04.d: Likewise. * testsuite/ld-riscv-elf/shared-lib-nopic-04.s: Likewise.
2022-09-02xtensa: bfd: fix TLS relocations generated for PIEMax Filippov5-0/+220
When generating TLS dynamic relocations the existing xtensa BFD code treats linking to a PIE exactly as linking to a shared object, resulting in generation of wrong relocations for TLS entries. Fix that and add tests. bfd/ * elf32-xtensa.c (elf_xtensa_check_relocs): Use bfd_link_dll instead of bfd_link_pic. Add elf_xtensa_dynamic_symbol_p test when generating GOT entries. (elf_xtensa_relocate_section): Use bfd_link_dll instead of bfd_link_pic. ld/ * testsuite/ld-xtensa/tlspie.dd: New file. * testsuite/ld-xtensa/tlspie.rd: New file. * testsuite/ld-xtensa/tlspie.sd: New file. * testsuite/ld-xtensa/tlspie.td: New file. * testsuite/ld-xtensa/xtensa-linux.exp (TLS PIE transitions): New test.
2022-09-02xtensa: adjust expected output in ld TLS testsMax Filippov4-63/+63
objdump output for l32r opcode was changed in commit b3ea76397a07 ("opcodes: xtensa: display loaded literal value"), but xtensa linker TLS relaxation tests weren't adjusted accordingly. readelf output was changed in commit 23356397449a ("Adjust readelf's output so that section symbols without a name as shown with their section name."), but xtensa linker TLS relaxation tests weren't adjusted accordingly. Fix expected output changes in xtensa ld TLS relaxation tests. ld/ * testsuite/ld-xtensa/tlsbin.dd: Adjust expected output for l32r opcodes. * testsuite/ld-xtensa/tlsbin.rd: Adjust expected output to allow for named section symbols. * testsuite/ld-xtensa/tlspic.dd: Adjust expected output for l32r opcodes. * testsuite/ld-xtensa/tlspic.rd: Adjust expected output to allow for named section symbols.
2022-08-30ld: pe: Fix linking against Microsoft import libraries with multiple DLLsMartin Storsjö2-108/+32
Initially, since c6c37250e98f113755e0d787f7070e2ac80ce77e (in 1999), in order to fix linking against Microsoft import libraries, ld did internally rename members of such libraries. At that point, the criteria for being considered a Microsoft import library was that every archive member had the same name (no regard for exactly what that name was). This was later amended in 44dbf3639f127af46d569ad96b6242dfbc4c0a89 (in 2003) to allow for Microsoft import libraries with intermixed static object files. At this point, the criteria were extended, so that all members following the first member named *.dll either had the exact same member name, or be named *.obj. (Curiously, this would allow members with any name if it precedes the first one named *.dll.) In practice, Microsoft style import libraries can contain members for linking against more than one DLL (built by merging multiple regular import libraries into one). Instead of trying to do validation of the whole archive before considering it a Microsoft style import library, relax the criteria for doing the member renaming: If an archive member is named *.dll and it contains .idata sections, assume that that member is a Microsoft import file, and apply the renaming scheme. This works for imports for any number of DLLs in the same library, intermixed with other static object files (regardless of their names), and vastly simplifies the code. LLVM generates Microsoft style import libraries, and Rust builds seem to bundle up multiple import libraries together with some Rust specific static objects. This fixes linking directly against them with ld.bfd.
2022-08-30BFD library: Use entry 0 in directory and filename tables of DWARF-5 debug info.Nick Clifton2-1/+6
PR 29529 * dwarf2.c (struct line_info_table): Add new field: use_dir_and_file_0. (concat_filename): Use new field to help select the correct table slot. (read_formatted_entries): Do not skip entry 0. (decode_line_info): Set new field depending upon the version of DWARF being parsed. Initialise filename based upon the setting of the new field.