summaryrefslogtreecommitdiff
path: root/ld/testsuite
Commit message (Collapse)AuthorAgeFilesLines
* ld: Use correct types for crc64 calculationsNick Clifton2023-03-082-2/+2
|
* 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.
* DIGEST: testsuiteUlf Samuelsson2023-03-0757-0/+1411
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* ld: Sort section contributions in PDB filesMark Harmstone2023-02-281-3/+3
| | | | | | Microsoft's DIA library, and thus also MSVC and WinDbg, expects section contributions to be ordered by section number and offset, otherwise it's unable to resolve line numbers.
* testsuite: prune DOS drive letter in test outputsClément Chigot2023-02-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | On DOS systems, absolute paths start with the drive letter. This can trigger failures in the regexp from dump tests, especially for those checking for warnings or errors. They are usually skipping everything before the first ":" as it has to be the file path. | [^:]*: warning: ... In order to avoid modifying many regexps to allow such drive letters, prune them from all the outputs if they are found at the beginning of a line. binutils/ChangeLog: * testsuite/lib/binutils-common.exp (prune_dump_output): New (run_dump_test): Use it. ld/ChangeLog: * testsuite/ld-elf/noinit-sections-2.l: Remove DOS drive letter handler.
* RISC-V: Add --[no-]relax-gp to ldFangrui Song2023-02-234-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | --relax enables all relaxations. --no-relax-gp disables GP relaxation to allow measuring its effect. The option can test effectiveness of GP relaxation and support some ABI variants that use GP for other purposes. Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/298 bfd/ * elfnn-riscv.c (struct riscv_elf_link_hash_table): Add params. (riscv_elfNN_set_options): New. (riscv_info_to_howto_rela): Check relax_gp. (_bfd_riscv_relax_section): Likewise. * elfxx-riscv.h (struct riscv_elf_params): New. (riscv_elf32_set_options): New. (riscv_elf64_set_options): New. ld/ * emultempl/riscvelf.em: Add option parsing. * testsuite/ld-riscv-elf/code-model-relax-medlow-01-norelaxgp.d: New. * testsuite/ld-riscv-elf/pcgp-relax-01-norelaxgp.d: New. * testsuite/ld-riscv-elf/pcgp-relax-02.d: Test --relax --relax-gp can be used together.
* bfd: xtensa: fix __stop_SECTION literal dropAlexey Lapshin2023-02-234-0/+30
|
* ld/testsuite: don't output to /dev/nullClément Chigot2023-02-211-1/+3
| | | | | | | | | | | | Mingw doesn't have /dev/null and thus "-o /dev/null" will fail. Currently, all the options are checked using this "-o /dev/null", resulting in them being disabled on mingw hosts. Fix that by outputting to a real file for all targets. ld/ChangeLog: * testsuite/config/default.exp: Replace "-o /dev/null" by a file.
* Both FAIL and PASS "check sections 2"?Alan Modra2023-02-211-9/+10
| | | | | * testsuite/ld-checks/checks.exp (check sections 2): Don't continue on with rest of test past first fail.
* ld-libs test on alpha-vmsAlan Modra2023-02-211-0/+5
| | | | * testsuite/ld-libs/libs.exp: Don't run for alpha-vms.
* alpha-*-vms missing librariesAlan Modra2023-02-211-1/+1
| | | | | | | | | | | | | | | | For this: ./ld-new: cannot find -limagelib: No such file or directory ./ld-new: cannot find -lstarlet: No such file or directory ./ld-new: cannot find -lsys$public_vectors: No such file or directory the logs showed creating dummy tmpdir/libimagelib: creating dummy No creating dummy such etc. So rubbish instead of tmpdir/libimagelib.a and the other required libs. * testsuite/config/default.exp: Correct regex detecting missing libraries automatically searched by alpha-dec-vms-ld.
* ld/testsuite: handle Windows drive letter in a noinit testClément Chigot2023-02-201-2/+2
| | | | | | | | | | | The regexp in "noinit sections (ld -r)" is skipping the file path before the first ":". However, on Windows, a path can start with "C:". Adjust the regexp to allow such cases. ld/ChangeLog: * testsuite/ld-elf/noinit-sections-2.l: Allow Windows paths (starting with C:).
* ld/testsuite: adjust to Windows path separator.Clément Chigot2023-02-207-7/+7
| | | | | | | | | | | | | | | | In some tests, the path reported on Windows will have a \ instead of a /. This occurs when a file is concatened with the search path in ldfile.c.: "ld -Ltmpdir -ltext" will result into "tmpdir\libtext.a". ld/ChangeLog: * testsuite/ld-elf/retain5.map: Allow \ path separator. * testsuite/ld-plugin/plugin-10.d: Likewise. * testsuite/ld-plugin/plugin-11.d: Likewise. * testsuite/ld-plugin/plugin-18.d: Likewise. * testsuite/ld-plugin/plugin-19.d: Likewise. * testsuite/ld-plugin/plugin-20.d: Likewise. * testsuite/ld-plugin/plugin-22.d: Likewise.
* ld test asciz and ascii failsAlan Modra2023-02-172-5/+5
| | | | | | | | | | | | | | | | | | | Fix these fails: alpha-dec-vms +FAIL: ld-scripts/asciz alpha-dec-vms +FAIL: ld-scripts/ascii i386-go32 +FAIL: ld-scripts/asciz sh-coff +FAIL: ld-scripts/asciz It's better to positively select targets for .section support than to try to exclude all targets that don't. Make a new is_coff_format so we can easily select such. binutils/ * testsuite/lib/binutils-common.exp (is_coff_format): New. ld/ * testsuite/ld-scripts/ascii.d: Use is_elf_format and is_coff_format to select targets, exclude ti coff. * testsuite/ld-scripts/asciz.d: Likewise. Accept trailing zeros.
* Add support for the ASCII directive inside linker scripts.Nick Clifton2023-02-166-26/+91
| | | | | | | | | | | | | | | * ldlex.l: Add ASCII token. * ldgram.y: Add parsing of the ASCII command. * ldlang.c (lang_add_string): Add maximum size parameter. Move escape character handling code into separate function. * ldlang.h (lang_add_string): Update prototype. * NEWS: Mention the new feature. * ld.texi (Output Section Data): Document the new directives. * testsuite/ld-scripts/asciz.t: Adjust to work on more architectures and to test more aspects of the ASCIZ directive. * testsuite/ld-scripts/asciz.d: Adjust to match the changes to the test linker script. * testsuite/ld-scripts/ascii.d: New test driver. * testsuite/ld-scripts/ascii.s: New test assembler source. * testsuite/ld-scripts/ascii.t: New test script. * testsuite/ld-scripts/script.exp: Run the new test.
* Fix the linker's merge4 test for the HPPA architecture.Nick Clifton2023-02-151-5/+5
| | | | PR 30078 * testsuite/ld-elf/merge4b.s: Use .asciz instead of .string in order to avoid the special behaviour of the .string directive on HPPA architectures.
* ASCIZ Command for output sectionUlf Samuelsson2023-02-144-0/+49
| | | | | Adds a new directive to the linker script syntax: ASCIZ. This inserts a zero-terminated string into the output at the place where it is used.
* objdump -D of bss sections and -s with -jAlan Modra2023-02-1113-56/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is some inconsistency between the behaviour of objdump -D and objdump -s, both supposedly operating on all sections by default. objdump -s ignores bss sections, while objdump -D dissassembles the zeros. Fix this by making objdump -D ignore bss sections too. Furthermore, "objdump -s -j .bss" doesn't dump .bss as it should, since the user is specifically asking to look at all those zeros. This change does find some tests that used objdump -D with expected output in bss-style sections. I've updated all the msp430 tests that just wanted to find a non-empty section to look at section headers instead, making the tests slightly more stringent. The ppc xcoff and spu tests are fixed by adding -j options to objdump, which makes the tests somewhat more lenient. binutils/ * objdump.c (disassemble_section): Ignore sections without contents, unless overridden by -j. (dump_section): Allow -j to override the default of not displaying sections without contents. * doc/binutils.texi (objdump options): Update -D, -s and -j description. gas/ * testsuite/gas/ppc/xcoff-tls-32.d: Select wanted objdump sections with -j. * testsuite/gas/ppc/xcoff-tls-64.d: Likewise. ld/ * testsuite/ld-msp430-elf/main-bss-lower.d, * testsuite/ld-msp430-elf/main-bss-upper.d, * testsuite/ld-msp430-elf/main-const-lower.d, * testsuite/ld-msp430-elf/main-const-upper.d, * testsuite/ld-msp430-elf/main-text-lower.d, * testsuite/ld-msp430-elf/main-text-upper.d, * testsuite/ld-msp430-elf/main-var-lower.d, * testsuite/ld-msp430-elf/main-var-upper.d: Expect -wh output. * testsuite/ld-msp430-elf/msp430-elf.exp: Use objdump -wh rather than objdump -D or objdump -d with tests checking for non-empty given sections. * testsuite/ld-spu/ear.d, * testsuite/ld-spu/icache1.d, * testsuite/ld-spu/ovl.d, * testsuite/ld-spu/ovl2.d: Select wanted objdump sections.
* ppc32 and "LOAD segment with RWX permissions"Alan Modra2023-02-061-0/+8
| | | | | | | | | | | | | | | | | | | | | When using a bss-plt we'll always trigger the RWX warning, which disturbs gcc test results. On the other hand, there may be reason to want the warning when gcc is configured with --enable-secureplt. So turning off the warning entirely for powerpc might not be the best solution. Instead, we'll turn off the warning whenever a bss-plt is generated, unless the user explicitly asked for the warning. bfd/ * elf32-ppc.c (ppc_elf_select_plt_layout): Set no_warn_rwx_segments on generating a bss plt, unless explicity enabled by the user. Also show the bss-plt warning when --warn-rwx-segments is given without --bss-plt. include/ * bfdlink.h (struct bfd_link_info): Add user_warn_rwx_segments. ld/ * lexsup.c (parse_args): Set user_warn_rwx_segments. * testsuite/ld-elf/elf.exp: Pass --secure-plt for powerpc to the rwx tests.
* [PR 30082] Pass $JANSSON_LIBS and $ZSTD_LIBS to ld-bootstrap/bootrap.expRomain Geissler2023-02-061-2/+2
|
* ld: pru: Merge the bss input sections into dataDimitar Dimitrov2023-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The popular method to load PRU firmware is through the remoteproc Linux kernel driver. In order to save a few bytes from the firmware, the PRU CRT0 is spared from calling memset for the bss segment [1]. Instead the host loader is supposed to zero out the bss segment. This is important for PRU, which typically has only 8KB for instruction memory. The legacy non-mainline PRU host driver relied on the default behaviour of the kernel core remoteproc [2]. That default is to zero out the loadable memory regions not backed by file storage (i.e. the bss sections). This worked for the libgloss' CRT0. But the PRU loader merged in mainline Linux explicitly changes the default behaviour [3]. It no longer is zeroing out memory regions. Hence the bss sections are not initialized - neither by CRT0, nor by the host loader. This patch fixes the issue by aligning the GNU LD default linker script with the mainline Linux kernel expectation. Since the mainline kernel driver is submitted by the PRU manufacturer itself (Text Instruments), we can consider that as defining the ABI. This change has been tested on Beaglebone AI-64 [4]. Static counter variables in the firmware are now always starting from zero, as expected. There was only one new toolchain test failure in orphan3.d, due to reordering of the output sections. I believe this is a harmless issue. I could not rewrite the PASS criteria to ignore the output section ordering, so I have disabled that test case for PRU. [1] https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/pru/crt0.S;h=b3f0d53a93acc372f461007553e7688ca77753c9;hb=HEAD#l40 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/remoteproc_elf_loader.c?h=v6.1#n228 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/pru_rproc.c?h=v6.1#n641 [4] https://beagleboard.org/ai-64 ld/ChangeLog: * scripttempl/pru.sc (.data): Merge .bss input sections into the .data output section. * testsuite/ld-elf/orphan3.d: Disable for PRU. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
* ld-elf/merge test updateAlan Modra2023-02-027-35/+27
| | | | | | | | The merge test fais on numerous targets because they don't support the necessary pc-relative relocs. This patch removes that part of the merge test, and makes references to the merged strings from .data rather than .text to better support targets that relax text by default.
* testsuite XPASSesAlan Modra2023-01-315-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adjusts the testsuite to get rid of a number of XPASSes that have appeared. Someone might like to look into a better patch for the s390 change. aarch64-pe XPASS: weak symbols arm-nacl XPASS: rgn-over8 mcore-pe XPASS: ld-scripts/provide-8 mips64-linux-gnuabi64 XPASS: vers4 mips64-linux-gnuabi64 XPASS: vers4b mips-linux-gnu XPASS: vers4 mips-linux-gnu XPASS: vers4b s390-linux-gnu XPASS: undefined line sh4-linux-gnu XPASS: --gc-sections with __start_SECTIONNAME sh-coff XPASS: objcopy object (simple copy) sh-coff XPASS: objcopy executable (pr25662) binutils/ * testsuite/binutils-all/objcopy.exp: Don't xfail "simple copy" and "pr25662" on sh-*-coff. Remove all non-ELF xfails on "ELF unknown section type" test. ld/ * testsuite/ld-elfvers/vers.exp (vers4, vers4b): Don't xfail all mips, just xfail mips irix. * testsuite/ld-gc/pr19161.d: Don't xfail sh. * testsuite/ld-scripts/rgn-over8-ok.d: Don't xfail nacl. * testsuite/ld-scripts/weak.exp: Don't xfail aarch64-pe. * testsuite/ld-undefined/undefined.exp: Conditionally xfail "undefined line" depending on gcc version for s390.
* ld/testsuite: Add missing targets to PDB testsMark Harmstone2023-01-251-1/+7
|
* ld: Add pdb support to aarch64-w64-mingw32Mark Harmstone2023-01-2512-887/+888
| | | | | | | | | This extends PDB support to the aarch64 PE targets. The changes to the test files are just to make it so they can be assembled as either x86, x86_64, or aarch64, mainly by changing the comment style. The only actual code change here is in adding the architecture constants to pdb.c.
* i386: Pass -Wl,--no-as-needed to compiler as neededH.J. Lu2023-01-251-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.
* Add support for secidx relocations to aarch64-w64-mingw32Mark Harmstone2023-01-232-0/+29
| | | | | | | | | | | | | This patch adds support for the .secidx directive and its corresponding relocation to aarch64-w64-mingw32. As with x86, this is a two-byte LE integer which gets filled in with the 1-based index of the output section that a symbol ends up in. This is needed for PDBs, which represent addresses as a .secrel32, .secidx pair. The test is substantially the same as for amd64, but with changes made for padding and alignment.
* Add testcase ld-elf/merge4Michael Matz2023-01-204-0/+55
| | | | | | | | to check a situation that once failed with the new section merging when it mishandled offsets pointing into alignment padding in mergable string sections (i.e. pointing to zeros). It made bootstrap.exp fail but that depends on many factors to actually go wrong so this is a more explicit variant of it.
* arm32: Fix rodata-merge-mapMichael Matz2023-01-202-4/+4
| | | | | | | | | | | | the test expects a second, but useless, $d mapping symbol for the partially merged section, and specifically disallows one for the completely merged section. The new merging algorithm makes it so that also the partially merged sections are conceptually SEC_EXCLUDED, except the first merge section (e.g. as if the very first object file already contains all strings). So that second mapping symbol is now missing. It never was needed anyway. So, adjust the test.
* Correct ld-pe/aarch64.d test outputAlan Modra2023-01-161-12/+12
| | | | | | | "foo" is at 0x2010. This corrects the expected output for .long and .word referencing foo, showing a problem with relocation handling. * testsuite/ld-pe/aarch64.d: Correct expected output.
* ld/testsuite: Adjust for ELF_MAXPAGESIZE 0x1000Hans-Peter Nilsson2023-01-127-29/+32
| | | | | | | | | | | | | | | | | | | Many tests reflect a setting of ELF_MAXPAGESIZE to 64 KiB. With ELF_MAXPAGESIZE changed to 4 KiB, layout is sometimes different and symbols end up in other places. Avoid churn and regexpification of old test patterns by passing the max-page-size setting active at the time. ld/testsuite: * testsuite/ld-arm/arm-elf.exp, testsuite/ld-arm/non-contiguous-arm2.d, testsuite/ld-arm/non-contiguous-arm3.d, testsuite/ld-arm/non-contiguous-arm5.d, testsuite/ld-arm/non-contiguous-arm6.d, testsuite/ld-arm/thumb-plt-got.d, testsuite/ld-arm/thumb-plt.d: Pass -z max-page-size=0x10000 explicitly to test that rely on that value in output-matching patterns.
* Fix XPASS weak symbols on x86_64-mingw32Alan Modra2023-01-111-10/+11
| | | | | | | Fixes commit 16fea92ccd99. * testsuite/ld-scripts/weak.exp: Don't xfail x86_64 PE targets. Do xfail other PE OS triplets by moving code setting xfails.
* Add aarch64-w64-mingw32 targetMark Harmstone2023-01-103-3/+13
| | | | | | | This adds a mingw target for aarch64, including windres and dlltool. Note that the old value of jmp_aarch64_bytes was wrong, and this does the same thing as MSVC does.
* Add .secrel32 for pe-aarch64Mark Harmstone2023-01-101-0/+2
| | | | Adds the .secrel32 pseudo-directive and its corresponding relocation.
* Add pe-aarch64 relocationsMark Harmstone2023-01-104-2/+333
| | | | | | | This adds the remaining pe-aarch64 relocations, and gets them working. It also brings in the constant directives from ELF, as otherwise .word would be 2 rather than 4 bytes, and .xword and .dword wouldn't be defined.
* IBM zSystems: Fix offset relative to static TLSStefan Schulze Frielinghaus2023-01-102-0/+20
| | | | | | | | | | | | | | | | | For local exec TLS relocations of the form foo@NTPOFF+x the addend was ignored. bfd/ChangeLog: * elf32-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE32. * elf64-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE64. ld/ChangeLog: * testsuite/ld-s390/reloctlsle-1.d: New test. * testsuite/ld-s390/reloctlsle-1.s: New test.
* Skip ld/pr23169 test on arm.Christophe Lyon2023-01-091-3/+4
| | | | | | | The test is already skipped on several targets (including AArch64) because it's invalid. * testsuite/ld-ifunc/ifunc.exp: Skip pr23169 on arm.
* Fix PR18841 ifunc relocation orderingChristophe Lyon2023-01-093-39/+39
| | | | | | | | | | | | | | | | | | | | | In order to get the ifunc relocs properly sorted the correct class needs to be returned. The code mimics what has been done for AArch64. Fixes: FAIL: Run pr18841 with libpr18841b.so FAIL: Run pr18841 with libpr18841c.so FAIL: Run pr18841 with libpr18841bn.so (-z now) FAIL: Run pr18841 with libpr18841cn.so (-z now) bfd/ PR ld/18841 * elf32-arm.c (elf32_arm_reloc_type_class): Return reloc_class_ifunc for ifunc symbols. ld/testsuite/ * ld-arm/ifunc-12.rd: Update relocations order. * ld-arm/ifunc-3.rd: Likewise. * ld-arm/ifunc-4.rd: Likewise.
* Un xfail the PR19719 test for the AArch64 architectureAndreas K. Huettel2023-01-051-1/+1
|
* Re: Avoid unaligned pointer reads in PEP .idata sectionAlan Modra2023-01-043-50/+50
| | | | | | | | Fix testsuite fallout. * testsuite/ld-pe/cfi.d: Adjust for changed .idata padding. * testsuite/ld-pe/secidx_64.d: Likewise. * testsuite/ld-pe/secrel_64.d: Likewise.
* Fix AArch64 linker testsuite failures trigeered by differences in build ↵Andreas K. Huettel2023-01-042-5/+5
| | | | | | | | | environments. PR 29843 * testsuite/ld-aarch64/bti-plt-5.d: Relax regxps slightly to allow for differences in build environments. * testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: Likewise.
* obsolete target tidyAlan Modra2023-01-029-16/+6
| | | | | | | Delete a few files only used for obsolete targets, and tidy config, xfails and other pieces of support specific to those targets. And since I was editing target triplets in test files, fix the nm alpha-linuxecoff fails.
* Update year range in copyright notice of binutils filesAlan Modra2023-01-01170-322/+322
| | | | | | 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.
* ld/testsuite: Don't add index to sizes in pdb.expMark Harmstone2022-12-311-3/+3
|
* ld: Handle LF_VFTABLE types in PDBsMark Harmstone2022-12-314-4/+40
|
* ld: Handle extended-length data structures in PDB typesMark Harmstone2022-12-314-4/+139
| | | | | | | | | | | | | | | | | A few fixes to minor issues I've discovered in my PDB patches. * If sizes or offsets are greater than 0x8000, they get encoded as extended values in the same way as for enum values - e.g. a LF_ULONG .short followed by a .long. * I've managed to coax MSVC to produce another type, LF_VFTABLE, which is seen when dealing with COM. I don't think LLVM emits this. Note that we can't just implement everything in Microsoft's header files, as most of it is obsolete. * Fixes a stupid bug in the test program, where I was adding an index to a size. The index was hard-coded to 0, so this didn't cause any actual issues.
* x86-64: Allocate input section memory if neededH.J. Lu2022-12-271-0/+17
| | | | | | | | | | | | | | | | When --no-keep-memory is used, the input section memory may not be cached. Allocate input section memory for -z pack-relative-relocs if needed. bfd/ PR ld/29939 * elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Allocate input section memory if needed. ld/ PR ld/29939 * testsuite/ld-elf/dt-relr-2i.d: New test.
* ld: Write linker symbols in PDBMark Harmstone2022-12-231-0/+77
|
* ld: Copy other symbols into PDB fileMark Harmstone2022-12-233-0/+535
|
* ld: Write globals stream in PDBMark Harmstone2022-12-237-0/+1193
|