aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-pe
AgeCommit message (Collapse)AuthorFilesLines
3 daysld/testsuite: exclude relocs from section contributions PDB testMark Harmstone2-24/+2
A bug in ld meant that we were erroneously generating image relocations for .secrel32 ops, which we then reflected in our PDB section contributions because the linker was adding a .reloc section. This was incidental to what we were testing for, so pass --disable-reloc-section to ld in order to ensure a consistent output.
2024-08-26ld/PDB: handle pointers to membersMark Harmstone3-3/+33
If the CV_PTR_MODE_PMEM or CV_PTR_MODE_PMFUNC flags were set in an LF_POINTER entry's attributes, there's a few extra bytes on the end that we weren't accounting for. Change handle_type so that we remap the containing_class field if it's present, and add a test for this.
2024-08-01ld/PDB: handle empty LF_FIELDLIST typesMark Harmstone3-3/+24
Empty structs in C++ lead to empty LF_FIELDLIST types in the .debug$T section, but we were mistakenly rejecting these as invalid. Allow CodeView types of two bytes, and add a test for this.
2024-07-29Fixes to "PR 31728 testcases"Alan Modra6-23/+55
This brings us down to just these fails for the set of targets I usually test when making testsuite changes. aarch64-pe +FAIL: ld-pe/symbols-ordinals-hints-imports-ld arm-pe +FAIL: ld-pe/symbols-ordinals-hints-exports-dlltool arm-pe +FAIL: ld-pe/symbols-ordinals-hints-imports-dlltool The aarch64 one is likely due to the target missing support somewhere. It is fairly new, I haven't investigated. The arm-pe fails are due to arm-pe being a target that adds underscores to symbol names (see config.bfd) whereas dlltool thinks it does not (see dlltool.c:asm_prefix). arm-wince-pe on the other hand doesn't add underscores. I would guess the right fix for dlltool is to get this symbol info from bfd using bfd_get_target_info. Note I'm not very happy about the creative use of ld_after_inputfile in symbols-ordinals-hints-imports-ld.d, which is likely to break with some future run_dump_test change.
2024-07-29PR 31728 testcasesPali Rohár12-12/+148
2024-07-22Don't trim trailing newline in run_host_cmdAlan Modra21-21/+21
Testcases like ld-elf/pr19719a.c that printf ("PASS\n"); on success ought to see the whole output for "string match". Similarly, the ld-pe/ pdb*.d files shouldn't need to remove the last newline to match. For most of the testsuite it doesn't matter whether the trailing newline is present or not, and there are only a few cases where we need to remove it. * testsuite/lib/ld-lib.exp (run_host_cmd): Don't regsub away output trailing newline. Do string trim for gcc/ld version checks. * testsuite/config/default.exp (plug_so): Do string trim output of run_host_cmd. * testsuite/ld-elf/shared.exp (mix_pic_and_non_pic): Adjust string match to include trailing newline. * testsuite/ld-i386/i386.exp (undefined_weak): Likewise. * testsuite/ld-x86-64/x86-64.exp (undefined_weak): Likewise. * testsuite/ld-plugin/libdep.exp (run_test): Likewise. * testsuite/ld-plugin/lto.exp (PR ld/28138 run): Likewise. * testsuite/ld-pe/pdb-strings.d, * testsuite/ld-pe/pdb-syms1-globals.d, * testsuite/ld-pe/pdb-syms1-records.d, * testsuite/ld-pe/pdb-syms1-symbols1.d, * testsuite/ld-pe/pdb-syms1-symbols2.d, * testsuite/ld-pe/pdb-syms2-symbols1.d, * testsuite/ld-pe/pdb-types1-hashlist.d, * testsuite/ld-pe/pdb-types1-skiplist.d, * testsuite/ld-pe/pdb-types1-typelist.d, * testsuite/ld-pe/pdb-types2-hashlist.d, * testsuite/ld-pe/pdb-types2-skiplist.d, * testsuite/ld-pe/pdb-types2-typelist.d, * testsuite/ld-pe/pdb-types3-hashlist.d, * testsuite/ld-pe/pdb-types3-skiplist.d, * testsuite/ld-pe/pdb-types3-typelist.d, * testsuite/ld-pe/pdb1-publics.d, * testsuite/ld-pe/pdb1-sym-record.d, * testsuite/ld-pe/pdb2-section-contrib.d, * testsuite/ld-pe/pdb3-c13-info1.d, * testsuite/ld-pe/pdb3-c13-info2.d, * testsuite/ld-pe/pdb3-source-info.d: Add trailing newline.
2024-07-20ld/testsuite: add missing definition to PDB testMark Harmstone3-13/+14
The file pdb-syms1a.s was missing a definition for T_VOID, which was causing some types not to be deduplicated. It also meant that the test couldn't be run against LLVM's lld, which throws an error for this. This particular test only tests the symbols stream, not the types stream, which is why the deduplication doesn't result in a change in the file size.
2024-07-20ld/PDB: use correct hashing algorithm in add_globals_refMark Harmstone1-37/+36
add_globals_ref was hashing using CRC32 rather than the hashing algorithm used for symbols, which meant that windbg was unable to put breakpoints against unmangled names.
2024-05-14Improve objdump -p output of PE Import and Export TablesPali Roh?r4-12/+12
PR 31738
2024-01-04Update year range in copyright notice of binutils filesAlan Modra6-6/+6
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-08-02Revert "2.41 Release sources"Sam James1-1/+1
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d. See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-022.41 Release sourcesbinutils-2_41-releaseNick Clifton1-1/+1
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-02-28ld: Sort section contributions in PDB filesMark Harmstone1-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.
2023-01-25ld/testsuite: Add missing targets to PDB testsMark Harmstone1-1/+7
2023-01-25ld: Add pdb support to aarch64-w64-mingw32Mark Harmstone12-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.
2023-01-23Add support for secidx relocations to aarch64-w64-mingw32Mark Harmstone2-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.
2023-01-16Correct ld-pe/aarch64.d test outputAlan Modra1-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.
2023-01-10Add aarch64-w64-mingw32 targetMark Harmstone2-3/+12
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.
2023-01-10Add .secrel32 for pe-aarch64Mark Harmstone1-0/+2
Adds the .secrel32 pseudo-directive and its corresponding relocation.
2023-01-10Add pe-aarch64 relocationsMark Harmstone4-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.
2023-01-04Re: Avoid unaligned pointer reads in PEP .idata sectionAlan Modra3-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.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra6-6/+6
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-12-31ld/testsuite: Don't add index to sizes in pdb.expMark Harmstone1-3/+3
2022-12-31ld: Handle LF_VFTABLE types in PDBsMark Harmstone4-4/+40
2022-12-31ld: Handle extended-length data structures in PDB typesMark Harmstone4-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.
2022-12-23ld: Write linker symbols in PDBMark Harmstone1-0/+77
2022-12-23ld: Copy other symbols into PDB fileMark Harmstone3-0/+535
2022-12-23ld: Write globals stream in PDBMark Harmstone7-0/+1193
2022-12-23ld: Parse LF_UDT_SRC_LINE records when creating PDB fileMark Harmstone6-0/+275
2022-12-23ld: Write types into IPI stream of PDBMark Harmstone6-0/+468
2022-12-23ld: Write types into TPI stream of PDBMark Harmstone6-0/+738
2022-12-23ld: Write DEBUG_S_LINES entries in PDB fileMark Harmstone3-2/+96
2022-12-23ld: Write DEBUG_S_FILECHKSMS entries in PDBsMark Harmstone6-0/+281
2022-12-23ld: Generate PDB string tableMark Harmstone4-0/+170
2022-12-23COFF build-id writes uninitialised data to fileAlan Modra1-1/+1
1) The first write in write_build_id wrote rubbish past the struct external_IMAGE_DEBUG_DIRECTORY, which was later overwritten with correct data. No user visible problem there, except that tools like valgrind complain. 2) The size for the pdb name was incorrectly calculated. * emultempl/pe.em (write_build_id): Write the debug directory, not the entire section contents. (setup_build_id): Add size for the base name of pdb_name, not the full path. * emultempl/pep.em: Likewise. * testsuite/ld-pe/pdb2-section-contrib.d: Update.
2022-11-23ld: Add section contributions substream to PDB filesMark Harmstone4-2/+51
2022-11-10ld: Add module information substream to PDB filesMark Harmstone3-40/+184
2022-10-31ld: Add publics stream to PDB filesMark Harmstone4-2/+171
2022-10-31ld: Add section header stream to PDB filesMark Harmstone1-0/+123
2022-10-20ld: Add minimal pdb generationMark Harmstone1-0/+267
2022-10-20ld: Add --pdb optionMark Harmstone2-0/+58
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-19aarch64-pe support for LD, GAS and BFDJedidiah Thompson3-0/+32
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-08-21Re: Missing linking test case for pe dll using a def fileAlan Modra1-11/+11
Fixes this when cross-compiling from x86_64-linux x86_64-w64-mingw32 +FAIL: compiling shared lib fastcall/stdcall * testsuite/ld-pe/pe-run2-def.exp (test_direct2_link_dll_def): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS.
2022-08-18Missing linking test case for pe dll using a def file.Ralf Habacker1-0/+159
PR 28362 * testsuite/ld-pe/pe-run2-def.exp: New file.
2022-08-01ld: Support the -exclude-symbols option via COFF def files, with the ↵Martin Storsjö6-0/+48
EXCLUDE_SYMBOLS keyword This was requested in review.
2022-08-01ld: Add support for a new option, -exclude-symbols, in COFF object file ↵Martin Storsjö5-0/+53
directives This maps to the same as ld's --exclude-symbols command line option, but allowing specifying the option via directives embedded in the object files instead of passed manually on the command line.
2022-04-07Add support for COFF secidx relocationsMark Harmstone5-0/+163
bfd * coff-i386.c (in_reloc_p): Add R_SECTION. (howto_table): Add R_SECTION. (coff_pe_i386_relocation_section): Add support for R_SECTION. (coff_i386_reloc_type_lookup): Add support for BFD_RELOC_16_SECCIDX. * coff-x86_64.c (in_reloc_p): Add R_SECTION. (howto_table): Add R_SECTION. (coff_pe_amd64_relocation_section): Add support for R_SECTION. (coff_amd64_reloc_type_lookup): Add support for BFD_RELOC_16_SECCIDX. * reloc.c: Add BFD_RELOC_16_SECIDX. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas * config/tc-i386.c (pe_directive_secidx): New function. (md_pseudo_table): Add support for secidx. (x86_cons_fix_new): Likewise. (tc_gen_reloc): Likewise. * expr.c (op_rank): Add O_secidx. * expr.h (operatorT): Likewise. * symbols.c (resolve_symbol_value): Add support for O_secidx. * testsuite/gas/i386/secidx.s: New test source file. * testsuite/gas/i386/secidx.d: New test driver file. * testsuite/gas/i386/i386.exp: Run new test. include * coff/i386.h: Define R_SECTION. * coff/x86_64.h: Likewise. ld * testsuite/ld-pe/secidx1.s: New test source file. * testsuite/ld-pe/secidx2.s: New test source file. * testsuite/ld-pe/secidx.d: New test driver file. * testsuite/ld-pe/secidx_64.d: New test driver file. * testsuite/ld-pe/pe.exp: Add new tests.
2022-01-12gas: add visibility support for XCOFFClément Chigot1-1/+1
XCOFF assembly defines the visibility using an additional argument on several pseudo-ops: .globl, .weak, .extern and .comm. This implies that .globl and .weak syntax is different than the usual GNU syntax. But we want to provide compatibility with AIX assembler, especially because GCC is generating the visibility using this XCOFF syntax. PR 22085 bfd/ChangeLog: * coffcode.h (coff_write_object_contents): Change XCOFF header vstamp field to 2. * coffgen.c (coff_print_symbol): Increase the size for n_type. gas/ChangeLog: * config/tc-ppc.c (ppc_xcoff_get_visibility): New function. (ppc_globl): New function. (ppc_weak): New function. (ppc_comm): Add visibility field support. (ppc_extern): Likewise. * testsuite/gas/all/cofftag.d: Adjust to new n_type size providing by objdump. * testsuite/gas/ppc/test1xcoff32.d: Likewise. * testsuite/gas/ppc/aix.exp: Add new tests. * testsuite/gas/ppc/xcoff-visibility-1-32.d: New test. * testsuite/gas/ppc/xcoff-visibility-1-64.d: New test. * testsuite/gas/ppc/xcoff-visibility-1.s: New test. include/ChangeLog: * coff/internal.h (SYM_V_INTERNAL, SYM_V_HIDDEN, SYM_V_PROTECTED, SYM_V_EXPORTED, SYM_V_MASK): New defines. * coff/xcoff.h (struct xcoff_link_hash_entry): Add visibility field. ld/ChangeLog: * testsuite/ld-pe/pr19803.d: Adjust to new n_type size providing by objdump.
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.