aboutsummaryrefslogtreecommitdiff
path: root/include/coff/pe.h
AgeCommit message (Collapse)AuthorFilesLines
12 daysAdd support for IMPORT_NAME_EXPORTAS in ILF (MSVC style) import librariesMartin Storsjö1-0/+1
This import name type is formally yet undocumented, but MSVC produces/supports it, primarily for ARM64EC import libraries. LLVM/LLD also supports this import name type. Since recently, llvm-dlltool also uses this type for certain kinds of renamed imports (that are easy to do in the long style import libraries produced by GNU dlltool, but require this name type in short import libraries). This name type contains a third string, in addition to the symbol name and the DLL name, indicating the actual imported name to reference in the import tables - which now can be distinct different from the symbol name on the object file level. https://github.com/llvm/llvm-project/commit/8f23464a5d957242c89ca6f33d4379c42519cd81 and https://github.com/llvm/llvm-project/commit/7b275aa2438c22604505d618dd37ee60052f2800 show how this import name type was added in LLVM. Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-23Improve objdump's display of PE header information.Pali Roh?r1-2/+2
PR 31953
2024-01-04Update year range in copyright notice of binutils filesAlan Modra1-1/+1
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-12-05Add basic support for RISC-V 64-bit EFI objectsAndreas Schwab1-0/+2
This adds a new PEI target pei-riscv64-little. Only objdump and objcopy are supported. bfd: * .gitignore: Add pe-riscv64igen.c. * Makefile.am (BFD64_BACKENDS): Add pei-riscv64.lo, pe-riscv64igen.lo. (BFD64_BACKENDS_CFILES): Add pei-riscv64.c. (BUILD_CFILES): Add pe-riscv64igen.c. (pe-riscv64igen.c): New rule. * Makefile.in: Regenerate. * bfd.c (bfd_get_sign_extend_vma): Add pei-riscv64-little. * coff-riscv64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags) (coff_write_object_contents): Add riscv64 (riscv64_pei_vec) support. * config.bfd (targ_selvecs): Add riscv64_pei_vec to all riscv* targets. * configure.ac: Handle riscv64_pei_vec. * configure: Regenerate. * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE) (GET_OPTHDR_SIZE_OF_STACK_RESERVE) (PUT_OPTHDR_SIZE_OF_STACK_RESERVE) (GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT) (GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE) (GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT) (GET_PDATA_ENTRY, _bfd_XX_bfd_copy_private_bfd_data_common) (_bfd_XX_bfd_copy_private_section_data) (_bfd_XX_get_symbol_info, _bfd_XX_only_swap_filehdr_out) (_bfd_XX_print_private_bfd_data_common) (_bfd_XXi_final_link_postscript, _bfd_XXi_only_swap_filehdr_out) (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out) (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out) (_bfd_XXi_swap_lineno_in, _bfd_XXi_swap_lineno_out) (_bfd_XXi_swap_scnhdr_out, _bfd_XXi_swap_sym_in) (_bfd_XXi_swap_sym_out, _bfd_XXi_swap_debugdir_in) (_bfd_XXi_swap_debugdir_out, _bfd_XXi_write_codeview_record) (_bfd_XXi_slurp_codeview_record) [COFF_WITH_peRiscV64]: Define. (_bfd_peRiscV64_print_ce_compressed_pdata): Declare. * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out) (_bfd_XXi_swap_scnhdr_out, pe_print_pdata) (_bfd_XX_print_private_bfd_data_common) (_bfd_XX_bfd_copy_private_section_data) (_bfd_XXi_final_link_postscript): Support COFF_WITH_peRiscV64. * pei-riscv64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd) (pe_ILF_object_p): Support COFF_WITH_peRiscV64. (jtab): Add dummy entry that traps. * targets.c (_bfd_target_vector): Add riscv64_pei_vec. binutils: * testsuite/binutils-all/riscv/pei-riscv64.d: New. * testsuite/binutils-all/riscv/pei-riscv64.s: New. include: * coff/riscv64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_RISCV32) (IMAGE_FILE_MACHINE_RISCV64): Define.
2023-08-27PE dos_messageAlan Modra1-1/+1
I was looking at dos_message and wondering why we have H_PUT_32 in _bfd_XXi_only_swap_filehdr_out but no H_GET_32 in pe_bfd_object_p. On a big-endian machine this would result in scrambling the code and strings constained in dos_message. Rather than fix the lack of H_GET_32 in pe_bfd_object_p, I decided it doesn't make sense to store dos_message internally as an array of ints. include/ * coff/internal.h (struct internal_extra_pe_filehdr): Make dos_message a char array. * coff/msdos.h (struct external_DOS_hdr): Flatten dos_message. * coff/pe.h (struct external_PEI_filehdr): Likewise. bfd/ * libcoff-in.h (struct pe_tdata): Make dos_message a char array. * libcoff.h: Regenerate. * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): memcpy dos_message to output. * peicode.h (pe_mkobject): Don't memset already zeroed pe_opthdr. Tidy allocation of tdata.pe_obj_data. Set up dos_message from.. (default_dos_message): ..this. New static array.
2023-05-30Define IMAGE_FILE_MACHINE_ARMNTAlan Modra1-0/+1
Same value as ARMV7PEMAGIC. https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants * coff/pe.h (IMAGE_FILE_MACHINE_ARMNT): Define.
2023-05-26Remove duplicate definitionAndreas Schwab1-2/+1
* coff/pe.h (IMAGE_FILE_MACHINE_AMD64): Remove duplicate definition. Alphabetize.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
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-08-10bfd: Add support for LoongArch64 EFI (efi-*-loongarch64).Youling Tang1-0/+1
This adds support for efi-loongarch64 by virtue of adding a new PEI target pei-loongarch64. This is not a full target and only exists to support EFI at this time. This means that this target does not support relocation processing and is mostly a container format. This format has been added to elf based loongarch64 targets such that efi images can be made natively on Linux. However this target is not valid for use with gas but only with objcopy. We should't limit addresses to 32-bits for 64-bit vma, otherwise there will be "RVA truncated" error when using objcopy on loongarch64. With these changes the resulting file is recognized as an efi image. Any magic number is based on the Microsoft PE specification [1]. The test results are as follows: $ make check-binutils RUNTESTFLAGS='loongarch64.exp' PASS: Check if efi app format is recognized $ objdump -h -f tmpdir/loongarch64copy.o tmpdir/loongarch64copy.o: file format pei-loongarch64 architecture: Loongarch64, flags 0x00000132: EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED start address 0x0000000000000000 Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000003c 00000000200000b0 00000000200000b0 00000200 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format bfd: * .gitignore (pe-loongarch64igen.c): New. * Makefile.am (pei-loongarch64.lo, pe-loongarch64igen.lo, pei-loongarch64.c, pe-loongarch64igen.c): Add support. * Makefile.in: Likewise. * bfd.c (bfd_get_sign_extend_vma): Add pei-loongarch64. * coff-loongarch64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags, coff_write_object_contents) Add loongarch64 (loongarch64_pei_vec) support. * config.bfd: Likewise. * configure: Likewise. * configure.ac: Likewise. * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE, GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE, GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT, GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE, GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT, GET_PDATA_ENTRY, _bfd_peLoongArch64_bfd_copy_private_bfd_data_common, _bfd_peLoongArch64_bfd_copy_private_section_data, _bfd_peLoongArch64_get_symbol_info, _bfd_peLoongArch64_only_swap_filehdr_out, _bfd_peLoongArch64_print_private_bfd_data_common, _bfd_peLoongArch64i_final_link_postscript, _bfd_peLoongArch64i_only_swap_filehdr_out, _bfd_peLoongArch64i_swap_aouthdr_in, _bfd_peLoongArch64i_swap_aouthdr_out, _bfd_peLoongArch64i_swap_aux_in, _bfd_peLoongArch64i_swap_aux_out, _bfd_peLoongArch64i_swap_lineno_in, _bfd_peLoongArch64i_swap_lineno_out, _bfd_peLoongArch64i_swap_scnhdr_out, _bfd_peLoongArch64i_swap_sym_in, _bfd_peLoongArch64i_swap_sym_out, _bfd_peLoongArch64i_swap_debugdir_in, _bfd_peLoongArch64i_swap_debugdir_out, _bfd_peLoongArch64i_write_codeview_record, _bfd_peLoongArch64i_slurp_codeview_record, _bfd_peLoongArch64_print_ce_compressed_pdata): New. * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out, _bfd_XXi_swap_scnhdr_out, pe_print_pdata, _bfd_XX_print_private_bfd_data_common, _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript): Support COFF_WITH_peLoongArch64, * pei-loongarch64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p): Support COFF_WITH_peLoongArch64. (jtab): Add dummy entry that traps. * targets.c (loongarch64_pei_vec): New. binutils * testsuite/binutils-all/loongarch64/loongarch64.exp: New file. * testsuite/binutils-all/loongarch64/pei-loongarch64.d: New test. * testsuite/binutils-all/loongarch64/pei-loongarch64.s: New test. include * coff/loongarch64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_LOONGARCH64): New. Signed-off-by: Youling Tang <tangyouling@loongson.cn>
2022-01-02Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-11-23AArch64: Add support for AArch64 EFI (efi-*-aarch64).Tamar Christina1-0/+1
This adds support for efi-*-aarch64 by virtue of adding a new PEI target pei-aarch64-little. This is not a full target and only exists to support EFI at this time. This means that this target does not support relocation processing and is mostly a container format. This format has been added to elf based aarch64 targets such that efi images can be made natively on Linux. However this target is not valid for use with gas but only with objcopy. With these changes the resulting file is recognized as an efi image by third party tools: > pecli info hello.efi Metadata ================================================================================ MD5: 598c32a778b0f0deebe977fef8578c4e SHA1: 4580121edd5cb4dc40f51b28f171fd15250df84c SHA256: 3154bd7cf42433d1c957f6bf55a17ad8c57ed41b29df2d485703349fd6ff1d5c Imphash: Size: 47561 bytes Type: PE32+ executable (EFI application) (stripped to external PDB), for MS Windows Compile Time: 1970-01-01 00:00:00 (UTC - 0x0 ) Entry point: 0x2000 (section .text) Sections ================================================================================ Name RWX VirtSize VirtAddr RawAddr RawSize Entropy md5 .text R-X 0x5bb0 0x2000 0x400 0x5c00 6.39 551fbc264256a3f387de8a891500ae0d .reloc R-- 0xc 0x8000 0x6000 0x200 0.02 0c45f6d812d079821c1d54c09ab89e1d .data RW- 0x1d88 0x9000 0x6200 0x1e00 4.18 5d1137c09f01289dc62bf754f7290db3 .dynamic RW- 0xf0 0xb000 0x8000 0x200 0.34 5c94ed3206f05a277e6f04fbf131f131 .rela R-- 0xe58 0xc000 0x8200 0x1000 1.87 8b5c6bc30f3acb7ca7bf2e6789d68519 .dynsym R-- 0x138 0xd000 0x9200 0x200 0.96 bdcf5101da51aadc663ca8859f88138c Imports ================================================================================ Any magic number is based on the Microsoft PE specification [1]. [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format bfd/ChangeLog: 2021-10-21 Tamar Christina <tamar.christina@arm.com> PR binutils/26206 * .gitignore (pe-aarch64igen.c): New. * Makefile.am (pei-aarch64.lo, pe-aarch64igen.lo, pei-aarch64.c, pe-aarch64igen.c): Add support. * Makefile.in: Likewise. * bfd.c (bfd_get_sign_extend_vma): Add pei-aarch64-little. * coff-aarch64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags, coff_write_object_contents) Add aarch64 (aarch64_pei_vec) support. * config.bfd: Likewise. * configure: Likewise. * configure.ac: Likewise. * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE, GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE, GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT, GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE, GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT, GET_PDATA_ENTRY, _bfd_peAArch64_bfd_copy_private_bfd_data_common, _bfd_peAArch64_bfd_copy_private_section_data, _bfd_peAArch64_get_symbol_info, _bfd_peAArch64_only_swap_filehdr_out, _bfd_peAArch64_print_private_bfd_data_common, _bfd_peAArch64i_final_link_postscript, _bfd_peAArch64i_only_swap_filehdr_out, _bfd_peAArch64i_swap_aouthdr_in, _bfd_peAArch64i_swap_aouthdr_out, _bfd_peAArch64i_swap_aux_in, _bfd_peAArch64i_swap_aux_out, _bfd_peAArch64i_swap_lineno_in, _bfd_peAArch64i_swap_lineno_out, _bfd_peAArch64i_swap_scnhdr_out, _bfd_peAArch64i_swap_sym_in, _bfd_peAArch64i_swap_sym_out, _bfd_peAArch64i_swap_debugdir_in, _bfd_peAArch64i_swap_debugdir_out, _bfd_peAArch64i_write_codeview_record, _bfd_peAArch64i_slurp_codeview_record, _bfd_peAArch64_print_ce_compressed_pdata): New. * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out, pe_print_pdata, _bfd_XX_print_private_bfd_data_common, _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript): Support COFF_WITH_peAArch64, * pei-aarch64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p): Support COFF_WITH_peAArch64. (jtab): Add dummy entry that traps. * targets.c (aarch64_pei_vec): New. binutils/ChangeLog: 2021-10-21 Tamar Christina <tamar.christina@arm.com> PR binutils/26206 * NEWS: Add new support. * objcopy.c (convert_efi_target): Add efi-*-aarch64 support. * testsuite/binutils-all/aarch64/pei-aarch64-little.d: New test. * testsuite/binutils-all/aarch64/pei-aarch64-little.s: New test. include/ChangeLog: 2021-10-21 Tamar Christina <tamar.christina@arm.com> PR binutils/26206 * coff/aarch64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_ARM64): New.
2021-04-21Extend the description of PE header flags.Eli Zaretskii1-0/+2
PR 27760 include * coff/pe.h (IMAGE_DLLCHARACTERISTICS_APPCONTAINER): Define. (IMAGE_DLLCHARACTERISTICS_GUARD_CF): Define. bfd * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Add display of IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP, IMAGE_FILE_NET_RUN_FROM_SWAP and IMAGE_FILE_UP_SYSTEM_ONLY flags. Decode the contents of the DllCharacteristics field.
2021-04-16PR27567, Linking PE files adds alignment section flags to executablesAlan Modra1-3/+6
So don't set those flags for an executable. In the patch I also test DYNAMIC even though the PE bfd code doesn't appear to set it for dlls. I figure it doesn't hurt to include that flag too. PR 27567 bfd/ * coffcode.h (styp_to_sec_flags): Use an unsigned long styp_flags. (coff_write_object_contents): Pass bfd to COFF_ENCODE_ALIGNMENT, ignore alignment checks when return is false. Formatting. include/ * coff/internal.h (struct internal_scnhdr): Make s_flags unsigned long. * coff/pe.h (COFF_ENCODE_ALIGNMENT): Don't set align flags for an executable and return false. Do so for a relocatable object and evaluate to true. * coff/ti.h (COFF_ENCODE_ALIGNMENT): Add bfd arg and evaluate to true. (COFF_DECODE_ALIGNMENT): Formatting. * coff/z80.h (COFF_ENCODE_ALIGNMENT): Similarly. (COFF_DECODE_ALIGNMENT): Similarly.
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-06-29C++ commentsAlan Modra1-4/+4
binutils isn't c99 (yet). This replaces or removes some C++ style comments. bfd/ * arc-got.h: Use C style comments. * coff-z80.c: Likewise. * elf32-csky.c: Likewise. * peXXigen.c: Likewise. * elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out code. binutils/ * dwarf.c: Use C style comments. * resrc.c: Likewise. gas/ * config/tc-s12z.c: Use C style comments. * config/tc-z80.c: Likewise. * config/tc-xtensa.c (emit_ld_r_n): Remove commented out code. include/ * coff/internal.h: Use C style comments. * coff/pe.h: Likewise. * elf/ppc64.h: Likewise. opcodes/ * arm-dis.c: Use C style comments. * cr16-opc.c: Likewise. * ft32-dis.c: Likewise. * moxie-opc.c: Likewise. * tic54x-dis.c: Likewise. * s12z-opc.c: Remove useless comment. * xgate-dis.c: Likewise.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-03-13Prevent memory access violations when attempting to parse an x86_64 PE ↵Nick Clifton1-0/+1
binary containing corrupt unwind information. PR 22113 incldue * coff/pe.h (struct pex64_unwind_info): Add a rawUnwindCodesEnd field. bfd * pei-x86_64.c (pex64_get_unwind_info): Change to a boolean function. Add an end address parameter. Check access of the data pointer to make sure that they do not extend beyond the end address. Return FALSE if any check fails. Add the end address pointer to the ui structure. (pex64_xdata_print_uwd_codes): Check accesses of the raw unwind codes to make sure that they do not extend beyond the end address pointer. Print an error message and return immediately if any check fails.
2018-02-12Add support for reading msdos MZ executables.Zebediah Figura1-29/+2
See email thread starting here: https://www.sourceware.org/ml/binutils/2018-01/msg00001.html include * coff/msdos.h: New header. * coff/pe.h: Move common defines to msdos.h. * coff/powerpc.h: Likewise. bfd * i386msdos.c (msdos_mkobject); New function. (msdos_object_p): New function. (i386_msdos_vec): Use msdos_object_p as the check_format function. * peicode.h: Rename external_PEI_DOS_hdr, DOSMAGIC, and NT_SIGNATURE to external_DOS_hdr, IMAGE_DOS_SIGNATURE, and IMAGE_NT_SIGNATURE. * peXXigen.c: Likewise. * coff-ia64.c: Likewise.
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-11-13PE: don't corrupt section flags when linking from ELF objectsJan Beulich1-1/+4
Linking EFI executables from ELF object files can result in corrupted COFF section flags if the section's alignment is too high. Issue a diagnostic in that case, erroring out if this is not a final link, and make sure only in-range values get written to the output image. While doing this also make tic80 use the generic alignment macros instead of custom #ifdef-ary. No testsuite regressions for the range of COFF/PE targets that actually cross-build in the first place on x86-64-linux.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-12-21Remove high bit set charactersAlan Modra1-1/+1
gas/ * doc/c-lm32.texi: Fix chars with high bit set. * testsuite/gas/bfin/vector2.s: Likewise. gold/ * arm.cc: Fix comment chars with high bit set. include/ * coff/pe.h: Fix comment chars with high bit set. * opcode/xgate.h: Likewise. ld/ * testsuite/ld-scripts/sysroot-prefix.exp: Fix chars with high bit set.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-08-20Enabling the HIGH_ENTROPY_VA flag allows the operating system to useNick Clifton1-25/+27
addresses outside of the 32-bit range before memory exhaustion. This results in a higher entropy implementation of ASLR when used with the DYNAMIC_BASE flag. * include/coff/pe.h: Add HIGH_ENTROPY_VA flag * ld/emultempl/pep.em: Add --high-entropy-va switch * ld/ld.texinfo: Document the --high-entropy-va switch
2014-04-08Add support for generating and inserting build IDs into COFF binaries.Jon TURNEY1-6/+43
* peXXigen.c (pe_print_debugdata): New function: Displays the contents of the debug directory and decodes codeview entries. (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out) (_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record): Add functions for reading and writing debugdir and codeview records. * libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out) (_bfd_XXi_write_codeview_record): Add prototypes and macros. * libcoff-in.h (pe_tdata): Add build-id data. * libcoff.h: Regenerate. * coffcode.h (coff_write_object_contents): Run build_id after_write_object_contents hook. * pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70) (_CV_INFO_PDB20): Add structures and constants for debug directory and codeview records. * internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO): Add structures and constants for internal representation of debug directory and codeview records. * emultempl/elf32.em (id_note_section_size, read_hex, write_build_id): Move code for parsing build-id option and calculating the build-id to... * ldbuildid.c: New file. * ldbuildid.h: New file. * Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new files. * Makefile.in: Regenerate. * ld.texinfo: Update --build-id description to mention COFF support. * NEWS: Mention support for COFF build ids. * emultempl/pe.em (gld${EMULATION_NAME}_handle_option): (pecoff_checksum_contents, write_build_id, setup_build_id) (gld_${EMULATION_NAME}_after_open): Handle and implement build-id option. * emultempl/pep.em: Likewise.
2014-03-13Add pe/x86_64 bigobj file format.Tristan Gingold1-0/+79
bfd/ * peicode.h (pe_ILF_object_p): Adjust, as the version number has been read. (pe_bfd_object_p): Also read version number to detect ILF. * pe-x86_64.c (COFF_WITH_PE_BIGOBJ): Define. (x86_64pe_bigobj_vec): Define * coffcode.h (bfd_coff_backend_data): Add _bfd_coff_max_nscns field. (bfd_coff_max_nscns): New macro. (coff_compute_section_file_positions): Use unsigned int for target_index. Compare with bfd_coff_max_nscns. (bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table): Set a value for _bfd_coff_max_nscns. (header_bigobj_classid): New constant. (coff_bigobj_swap_filehdr_in, coff_bigobj_swap_filehdr_out) (coff_bigobj_swap_sym_in, coff_bigobj_swap_sym_out) (coff_bigobj_swap_aux_in, coff_bigobj_swap_aux_out): New functions. (bigobj_swap_table): New table. * libcoff.h: Regenerate. * coff-sh.c (bfd_coff_small_swap_table): Likewise. * coff-alpha.c (alpha_ecoff_backend_data): Add value for _bfd_coff_max_nscns. * coff-mips.c (mips_ecoff_backend_data): Likewise. * coff-rs6000.c (bfd_xcoff_backend_data) (bfd_pmac_xcoff_backend_data): Likewise. * coff64-rs6000.c (bfd_xcoff_backend_data) (bfd_xcoff_aix5_backend_data): Likewise. * targets.c (x86_64pe_bigobj_vec): Declare. * configure.in (x86_64pe_bigobj_vec): New vector. * configure: Regenerate. * config.bfd: Add bigobj object format for Windows targets. gas/ * config/tc-i386.c (use_big_obj): Declare. (OPTION_MBIG_OBJ): Define. (md_longopts): Add -mbig-obj option. (md_parse_option): Handle it. (md_show_usage): Display help for this option. (i386_target_format): Use bigobj for x86-64 if -mbig-obj. * doc/c-i386.texi: Document the option. gas/testsuite/ * gas/pe/big-obj.d, gas/pe/big-obj.s: Add test. * gas/pe/pe.exp: Add test. include/coff/ * pe.h (struct external_ANON_OBJECT_HEADER_BIGOBJ): Declare. (FILHSZ_BIGOBJ): Define. (struct external_SYMBOL_EX): Declare. (SYMENT_BIGOBJ, SYMESZ_BIGOBJ): Define. (union external_AUX_SYMBOL_EX): Declare. (AUXENT_BIGOBJ, AUXESZ_BIGOBJ): Define. * internal.h (struct internal_filehdr): Change type of f_nscns.
2014-03-05Update copyright yearsAlan Modra1-2/+1
2013-12-06Add epilog unwind for x86_64 pe/coffTristan Gingold1-2/+4
include/coff/ 2013-12-06 Tristan Gingold <gingold@adacore.com> * pe.h (UWOP_EPILOG, UWOP_PARE): Define. bfd/ 2013-12-06 Tristan Gingold <gingold@adacore.com> * pei-x86_64.c (pex64_xdata_print_uwd_codes): Add argument rf. Display epilog opcode. (pex64_dump_xdata): Add argument rf; make addr a local variable. Adjust call to pex64_xdata_print_uwd_codes. (pex64_bfd_print_pdata): Display code range, adjust call to pex64_dump_xdata.
2013-11-27Improve dump of xdata/pdata on x86_64.Tristan Gingold1-11/+6
bfd/ 2013-11-27 Tristan Gingold <gingold@adacore.com> * pei-x86_64.c (pex_regs): Make it const. Add comments. (pex64_get_runtime_function): Do not split UnwindData. (pex64_get_unwind_info): Extract the chain and the handler. (pex64_xdata_print_uwd_codes): Rewritten: do not reverse print the opcode, handle version 2, add consistency check, make the code host neutral. (pex64_dump_xdata): Change arguments to pass the section and its content. Handle version 2, change output. (pex64_bfd_print_pdata): Add comments, load section for xdata. Avoid duplicate outputs. include/coff 2013-11-27 Tristan Gingold <gingold@adacore.com> * pe.h (struct pex64_runtime_function): Remove isChained. (UWOP_SAVE_XMM): Add comment. (struct pex64_unwind_info): Remove extra fields.
2010-04-15Upgrade header files to use GPLv3Nick Clifton1-2/+2
2009-09-02update copyright datesAlan Modra1-1/+2
2009-04-21bfd/ChangeLogDave Korn1-0/+150
2009-04-21 Kai Tietz <kai.tietz@onevision.com> * coff-x86_64.c (PEI_HEADERS): Protect includes. (bfd_pe_print_pdata): Remove #ifdef PE variation. * pei-x86_64.c (PEI_HEADERS): Define to prevent double include in coff-x86_64.c of headers. (PDATA_ROW_SIZE): New define. (pex_regs[]): New static array. (pex64_get_runtime_function): New static function. (pex64_get_unwind_info): Likewise. (pex64_get_scope_entry): Likewise. (pex64_xdata_print_uwd_codes): Likewise. (pep_get_section_by_rva): Likewise. (pex64_dump_xdata): Likewise. (pex64_bfd_print_pdata): Likewise. (bfd_pe_print_pdata): Define as pex64_bfd_print_pdata. * peXXigen.c (_bfd_pex64_print_pdata): Removed implementation. * libpei.h (_bfd_pex64_print_pdata): Removed declaration. include/ChangeLog 2009-04-21 Kai Tietz <kai.tietz@onevision.com> * coff/pe.h (pex64_runtime_function): New structure. (external_pex64_runtime_function): Likewise. (pex64_unwind_code): Likewise. (external_pex64_unwind_code): Likewise. (pex64_unwind_info): Likewise. (external_pex64_unwind_info): Likewise. (external_pex64_scope): Likewise. (pex64_scope): Likewise. (pex64_scope_entry): Likewise. (external_pex64_scope_entry): Likewise. (PEX64_IS_RUNTIME_FUNCTION_CHAINED): New macro. (PEX64_GET_UNWINDDATA_UNIFIED_RVA): Likewise. (PEX64_UNWCODE_CODE): Likewise. (PEX64_UNWCODE_INFO): Likewise. (UWOP_...): Add defines for unwind code. (UNW_FLAG_...): Add defined for unwind info flags. (PEX64_SCOPE_ENTRY_SIZE): New macro. (PEX64_UWI_VERSION): Likewise. (PEX64_UWI_FLAGS): Likewise. (PEX64_UWI_FRAMEREG): Likewise. (PEX64_UWI_FRAMEOFF): Likewise. (PEX64_UWI_SIZEOF_UWCODE_ARRAY): Likewise. (PEX64_OFFSET_TO_UNWIND_CODE): Likewise. (PEX64_OFFSET_TO_HANDLER_RVA): Likewise. (PEX64_OFFSET_TO_SCOPE_COUNT): Likewise. (PEX64_SCOPE_ENTRY): Likewise.
2009-04-17bfd/H.J. Lu1-1/+1
2009-04-17 H.J. Lu <hongjiu.lu@intel.com> * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Replace IMAGE_SUBSYSTEM_EFI_ROM with IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER. binutils/ 2009-04-17 H.J. Lu <hongjiu.lu@intel.com> * objcopy.c (set_pe_subsystem): Replace efi-rom with sal-rtd. * doc/binutils.texi: Likewise. include/coff/ 2009-04-17 H.J. Lu <hongjiu.lu@intel.com> * pe.h (IMAGE_SUBSYSTEM_EFI_ROM): Renamed to ... (IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER): This.
2009-03-14include/ChangeLogDave Korn1-0/+11
2009-03-12 Dave Korn <dave.korn.cygwin@gmail.com> * coff/internal.h (struct internal_extra_pe_aouthdr): Correct type of DllCharacteristics flags field to unsigned. * coff/pe.h (IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLLCHARACTERISTICS_NO_ISOLATION, IMAGE_DLLCHARACTERISTICS_NO_SEH, IMAGE_DLLCHARACTERISTICS_NO_BIND, IMAGE_DLLCHARACTERISTICS_WDM_DRIVER, IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE): New macros to define flag bit values for DllCharacteristics field of PEAOUTHDR, PEPAOUTHDR. ld/ChangeLog 2009-03-12 Dave Korn <dave.korn.cygwin@gmail.com> Danny Smith <dannysmith@users.sourceforge.net> * emultmpl/pe.em (pe_dll_characteristics): New variable. (OPTION_DYNAMIC_BASE, OPTION_FORCE_INTEGRITY, OPTION_NX_COMPAT, OPTION_NO_ISOLATION. OPTION_NO_SEH, OPTION_NO_BIND, OPTION_WDM_DRIVER, OPTION_TERMINAL_SERVER_AWARE): New macros for options to set DllCharacteristics flag bits. (gld${EMULATION_NAME}_add_options): Add dynamicbase, forceinteg, nxcompat, no-isolation, no-seh, no-bind, wdmdriver, tsaware options. (init): Add DllCharacteristics field. (gld_${EMULATION_NAME}_list_options): List new options. (gld${EMULATION_NAME}_handle_option): Handle new options. * emultmpl/pep.em (pe_dll_characteristics): New variable. (OPTION_DYNAMIC_BASE, OPTION_FORCE_INTEGRITY, OPTION_NX_COMPAT, OPTION_NO_ISOLATION. OPTION_NO_SEH, OPTION_NO_BIND, OPTION_WDM_DRIVER, OPTION_TERMINAL_SERVER_AWARE): New macros for options to set DllCharacteristics flags. (gld${EMULATION_NAME}_add_options): Add dynamicbase, forceinteg, nxcompat,no-isolation, no-seh, no-bind, wdmdriver, tsaware options. (init): Add DllCharacteristics field. (gld_${EMULATION_NAME}_list_options): List new options. (gld${EMULATION_NAME}_handle_option): Handle new options. * ldtexinfo : Document dynamicbase, forceinteg, nxcompat, no-isolation, no-seh, no-bind, wdmdriver, tsaware options.
2007-11-04includeDanny Smith1-0/+4
* coff/pe.h (COFF_ENCODE_ALIGNMENT) Define. gas * read.c (ALIGN_LIMIT): Rename to ... (TC_ALIGN_LIMIT): Guard against prior definition. * config/tc-i386.h (TC_ALIGN_LIMIT)[TE_PE]: Define. bfd * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Let .data, .text and .bss section use the default. * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise. ld/testsuite * ld-scripts/align.exp: Enable for PECOFF. * ld-scripts/alignof.exp: Likewise.
2007-08-02bfd/H.J. Lu1-7/+23
2007-08-02 H.J. Lu <hongjiu.lu@intel.com> * coffcode.h (ALIGN_SET): Removed. (ELIFALIGN_SET): Likewise. (coff_set_alignment_hook): Handle IMAGE_SCN_ALIGN_128BYTES, IMAGE_SCN_ALIGN_256BYTES, IMAGE_SCN_ALIGN_512BYTES, IMAGE_SCN_ALIGN_1024BYTES, IMAGE_SCN_ALIGN_2048BYTES, IMAGE_SCN_ALIGN_4096BYTES and IMAGE_SCN_ALIGN_8192BYTES. include/coff/ 2007-08-02 H.J. Lu <hongjiu.lu@intel.com> * pe.h (IMAGE_SCN_ALIGN_POWER_BIT_POS): New. (IMAGE_SCN_ALIGN_POWER_BIT_MASK): Likewise. (IMAGE_SCN_ALIGN_POWER_NUM): Likewise. (IMAGE_SCN_ALIGN_POWER_CONST): Likewise. (IMAGE_SCN_ALIGN_128BYTES): Likewise. (IMAGE_SCN_ALIGN_256BYTES): Likewise. (IMAGE_SCN_ALIGN_512BYTES): Likewise. (IMAGE_SCN_ALIGN_1024BYTES): Likewise. (IMAGE_SCN_ALIGN_2048BYTES): Likewise. (IMAGE_SCN_ALIGN_4096BYTES): Likewise. (IMAGE_SCN_ALIGN_8192BYTES): Likewise. (IMAGE_SCN_ALIGN_1BYTES): Redefined with IMAGE_SCN_ALIGN_POWER_CONST. (IMAGE_SCN_ALIGN_2BYTES): Likewise. (IMAGE_SCN_ALIGN_4BYTES): Likewise. (IMAGE_SCN_ALIGN_8BYTES): Likewise. (IMAGE_SCN_ALIGN_16BYTES): Likewise. (IMAGE_SCN_ALIGN_32BYTES): Likewise. (IMAGE_SCN_ALIGN_64BYTES): Likewise.
2006-11-14* peXXigen.c: Updates for PE/COFF V8.0, and clarificationNick Clifton1-0/+2
(dir_names): Added CLR Runtime Header to dir_names[]. (_bfd_XX_print_private_bfd_data_common): Added EFI_ROM and XBOX subsystem names (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out) (pe_print_idata, pe_print_edata) (_bfd_XX_bfd_copy_private_bfd_data_common) (_bfd_XXi_final_link_postscript): Use #DEFINEs for index into DataDirectory. * pe.h: Added defines for IMAGE_SUBSYSTEM_EFI_ROM and IMAGE_SUBSYSTEM_XBOX. * internal.h: Added defines for PE directory entry types. NB: in internal.h because IMAGE_NUMBEROF_DIRECTORY_ENTRYIES is in pe.h
2006-09-20Add x86_64-mingw64 targetNick Clifton1-2/+12
2005-05-10Update the address and phone number of the FSF organizationNick Clifton1-1/+1
2005-03-03update copyright datesAlan Modra1-1/+1
2004-11-08Fix support for PECOFF weak symbolsNick Clifton1-1/+6
2003-07-17 (IMAGE_FILE_NET_RUN_FROM_SWAP): Define.Nick Clifton1-19/+33
(IMAGE_FILE_MACHINE_WCEMIPSV2): Define. (IMAGE_FILE_MACHINE_SH3DSP): Define. (IMAGE_FILE_MACHINE_SH3E): Define. (IMAGE_FILE_MACHINE_SH5): Define. (IMAGE_FILE_MACHINE_AM33): Define. (IMAGE_FILE_MACHINE_POWERPCFP): Define. (IMAGE_FILE_MACHINE_AXP64): Define. (IMAGE_FILE_MACHINE_TRICORE): Define. (IMAGE_FILE_MACHINE_CEF): Define. (IMAGE_FILE_MACHINE_EBC): Define. (IMAGE_FILE_MACHINE_AMD64): Define. (IMAGE_FILE_MACHINE_M32R): Define. (IMAGE_FILE_MACHINE_CEE): Define.
2001-03-14Fix typos in ChangeLogs; add coff/external.h; fix copyright datesNick Clifton1-1/+1
2001-02-13* include/coff/pe.h: Rename PEP64AOUTHDR to PEPAOUTHDR. RenameDJ Delorie1-2/+2
PEP64AOUTSZ to PEPAOUTSZ.
2001-02-062001-01-23 H.J. Lu <hjl@gnu.org>H.J. Lu1-0/+39
* include/coff/pe.h (struct external_PEI_DOS_hdr): New. (struct external_PEI_IMAGE_hdr): New.
2000-09-03Fix formatting, add copyright noticeNick Clifton1-46/+62
2000-06-30* peicode.h (coff_swap_filehdr_in): can't use e_magic because weDJ Delorie1-2/+6
can't assume the PE header is at 0x80. * coff/pe.h: clarify a comment
2000-04-17Initial patches for IA-64 EFI (64-bit PE) support.Jim Wilson1-6/+48
* pe.h (PEP64AOUTHDR): New header for PE+. (PEP64AOUTSZ): New macro. (IMAGE_SUBSYSTEM_UNKNOWN): New macro. (IMAGE_SUBSYSTEM_NATIVE): Ditto. (IMAGE_SUBSYSTEM_WINDOWS_GUI): Ditto. (IMAGE_SUBSYSTEM_WINDOWS_CUI): Ditto. (IMAGE_SUBSYSTEM_POSIX_CUI): Ditto. (IMAGE_SUBSYSTEM_WINDOWS_CE_GUI): Ditto. (IMAGE_SUBSYSTEM_EFI_APPLICATION): Ditto. (IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER): Ditto. (IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER): Ditto. * internal.h (PE_DEF_FILE_ALIGNMENT): Define only if not defined already. * ia64.h: New file.