* pe-dll.c (_nm_-symbols): Use always underscored variant
for symbols.
(__imp_-symbols): Likewise.
(___imp_-symbols): Likewise.
* NEWS: Mention ABI change for x64 PE-COFF.
PS: Sorry, missed this part of approved patch.
* deffile.h (def_file_export): New member its_name.
(def_file_import): Likewise.
(def_file_add_export): Add argument its_name.
(def_file_add_import): Likewise.
* deffilep.y (def_exports): Add argument its_name.
(def_import): Likewise.
(EQUAL): Add new token for '=='.
(opt_equalequal_name): New rule.
(expline): Add rule opt_equalequal_name.
(impline): Likewise.
(def_file_free): Free for exports and imports
the optional member its_name.
(def_lex): Add scan of '==' as EQUAL.
* pe-dll.c (pe_export_sort): Sort for its_name too.
(process_def_file_and_drectve): Adjust calls to
def_file_add_export.
(generate_edata): Take its_name in account.
(make_one): Likewise.
(pe_process_import_defs): Likewise.
(pe_dll_generate_def_file): Add print of new '==' option.
* ld.texinfo: Extend documentation about .def file syntax.
* NEWS: Mention new feature.
(gld${EMULATION_NAME}_add_options): Add new --exclude-all-symbols option
to exclude all symbols from automatic export.
(gld_${EMULATION_NAME}_list_options): Describe it.
(gld${EMULATION_NAME}_handle_option): Handle it.
* emultempl/pep.em: Likewise to all the above.
* pe-dll.c (pe_dll_exclude_all_symbols): New variable.
(process_def_file_and_drectve): Use it.
* pe-dll.h (pe_dll_exclude_all_symbols): Declare.
* pep-dll.c (pep_dll_exclude_all_symbols): Define pep_ alias.
* pep-dll.h (pe_dll_exclude_all_symbols): Declare.
* NEWS: Mention the new feature.
* ld.texinfo: Document the new command line switch.
2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com>
* cofflink.c (process_embedded_commands): Ignore "-aligncomm".
==> gas/ChangeLog <==
2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com>
* NEWS: Mention new feature.
* config/obj-coff.c (obj_coff_common_parse): New function.
(obj_coff_comm): Likewise.
(coff_pseudo_table): Override default ".comm" definition on PE.
* doc/as.texinfo: Document new feature.
==> gas/testsuite/ChangeLog <==
2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com>
* gas/pe/: New directory for PE format-specific tests.
* gas/pe/aligncomm-a.d: New test pattern file.
* gas/pe/aligncomm-a.s: New test source file.
* gas/pe/aligncomm-b.d: New test pattern file.
* gas/pe/aligncomm-b.s: New test source file.
* gas/pe/aligncomm-c.d: New test pattern file.
* gas/pe/aligncomm-c.s: New test source file.
* gas/pe/aligncomm-d.d: New test pattern file.
* gas/pe/aligncomm-d.s: New test source file.
* gas/pe/pe.exp: New test control script.
* lib/gas-defs.exp (is_pecoff_format): New function.
==> ld/ChangeLog <==
2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com>
* NEWS: Mention new feature.
* deffile.h (def_file_aligncomm): Add new struct definition.
(def_file): Add new def_file_aligncomm member.
* deffilep.y (%token): Add new ALIGNCOMM token.
(command): Add production rule for ALIGNCOMM.
(def_file_free): Free any chained def_file_aligncomm structs.
(diropts[]): Add entry for '-aligncomm' .drectve command.
(def_aligncomm): New grammar function.
* ld.texinfo: Document new feature.
* pe-dll.c (process_def_file): Rename from this ...
(process_def_file_and_drectve): ... to this, updating all callers,
and process any aligncomms chained to the def file after scanning
all .drectve sections.
(generate_edata): Updated to match.
(pe_dll_build_sections): Likewise.
==> ld/testsuite/ChangeLog <==
2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com>
* ld-pe/aligncomm-1.c: New test source file.
* ld-pe/aligncomm-2.c: Likewise.
* ld-pe/aligncomm-3.c: Likewise.
* ld-pe/aligncomm-4.c: Likewise.
* ld-pe/aligncomm.d: New test pattern file.
* ld-pe/direct.exp: Deleted, and content moved into ...
* ld-pe/pe-run.exp: ... New common file for all PE run tests.
* ld-pe/vers-script.exp: Deleted, and content merged into ...
* ld-pe/pe-compile.exp: ... New common file for PE tests needing
a compiler, adding aligned common tests.
* ld-pe/pe.exp: Update header comment.
2008-08-07 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>
ld/ChangeLog:
* pe-dll.c (process_def_file): Do not create empty export table.
ld/testsuite/ChangeLog:
* ld-pe/exports.d: New file.
* ld-pe/exports.s: New file.
* ld-pe/pe.exp: New test for empty export table.
* elflink.c (find_version_for_sym): Remove from here, ...
* linker.c (bfd_find_version_for_sym): ... rename, replace
here, make public and update all callers.
* bfd-in2.h: Regenerate.
ld/ChangeLog
* NEWS: Mention new feature.
* ld.texinfo (--version-script): Document extent of PE support.
(WIN32): Mention --version-script. Extend auto-export description.
* pe-dll.c (process_def_file): Use version script info to filter
symbols from auto-export.
* testsuite/ld-pe/vers-script-1.d: New file.
* testsuite/ld-pe/vers-script-2.d: New file.
* testsuite/ld-pe/vers-script-3.d: New file.
* testsuite/ld-pe/vers-script-4.d: New file.
* testsuite/ld-pe/vers-script-1.ver: New file.
* testsuite/ld-pe/vers-script-2.ver: New file.
* testsuite/ld-pe/vers-script-3.ver: New file.
* testsuite/ld-pe/vers-script-4.ver: New file.
* testsuite/ld-pe/vers-script-dll.c: New file.
* testsuite/ld-pe/vers-script.exp: New test script.
* coff-alpha.c (alpha_ecoff_backend_data): Initialise fields which
control long section name handling with ECOFF_NO_LONG_SECTION_NAMES.
* coff-mips.c (mips_ecoff_backend_data): Likewise.
* coff-rs6000.c (bfd_xcoff_backend_data): Initialise fields which
control long section name handling with XCOFF_NO_LONG_SECTION_NAMES.
(bfd_pmac_xcoff_backend_data): Likewise.
* coff64-rs6000.c (bfd_xcoff_backend_data): Likewise.
(bfd_xcoff_aix5_backend_data): Likewise.
(xcoff64_write_object_contents): Delete unused long_section_names
local variable.
* coff-sh.c (bfd_coff_small_swap_table): Initialise long section
name members using COFF_DEFAULT_LONG_SECTION_NAMES and make entire
struct non-const.
* coffcode.h (documentation): Update to describe long section names.
(COFFLONGSECTIONCATHELPER): New helper macro.
(BLANKOR1TOODD): Likewise.
(COFF_ENABLE_LONG_SECTION_NAMES): Likewise.
(COFF_LONG_SECTION_NAMES_SETTER): Likewise.
(COFF_DEFAULT_LONG_SECTION_NAMES): Likewise.
(bfd_coff_set_long_section_names_allowed): New function.
(bfd_coff_set_long_section_names_disallowed): Likewise.
(struct bfd_coff_backend_data): Add new backend hook function
pointer _bfd_coff_set_long_section_names.
(bfd_coff_set_long_section_names): New backend hook.
(coff_write_object_contents): Only generate long section names if
bfd_coff_long_section_names() indicates they are currently enabled.
(bfd_coff_std_swap_table): Make non-const, and initialise long
section name fields using COFF_DEFAULT_LONG_SECTION_NAMES.
(ticoff0_swap_table): Likewise to both.
(ticoff1_swap_table): Again, likewise to both.
* coffgen.c (make_a_section_from_file): Allow long section names
as inputs even if not currently allowed for outputs.
* ecoff.c (_bfd_ecoff_no_long_sections): New function.
* efi-app-ia32.c (COFF_LONG_SECTION_NAMES): Define to 0, not blank.
* efi-app-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-app-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-ia32.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-ia32.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-arm.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-i386.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-mcore.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-mips.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-ppc.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-sh.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* libcoff-in.h: Update copyright year to cause updated copyright
year in generated libcoff.h, and fix typo.
* libcoff.h: Regenerated.
* libecoff.h (ECOFF_NO_LONG_SECTION_NAMES): New macro.
(_bfd_ecoff_no_long_sections): Add prototype.
* libxcoff.h (XCOFF_NO_LONG_SECTION_NAMES): New macro.
* pe-mips.c (COFF_LONG_SECTION_NAMES): Define empty if not already
defined by an including .c file.
* ticoff.h (ticoff0_swap_table): Make non-const, and initialise
long section name fields using COFF_DEFAULT_LONG_SECTION_NAMES.
(ticoff1_swap_table): Likewise to both.
ld/ChangeLog
* ld.texinfo: Update to mention long section name options.
* NEWS: Mention new behaviour and command-line options.
* pe-dll.c (pe_use_coff_long_section_names): New global variable.
(pe_output_file_set_long_section_names): New function.
(pe_dll_build_sections): Call it on output BFDs.
(pe_exe_build_sections): Likewise.
(pe_dll_fill_sections): Likewise.
(pe_exe_fill_sections): Likewise.
* pe-dll.h (pe_use_coff_long_section_names): Declare extern.
(pe_output_file_set_long_section_names): Add prototype.
* pep-dll.c (pe_use_coff_long_section_names): Define pep_ alias.
(pe_output_file_set_long_section_names): Likewise.
* pep-dll.h (pep_use_coff_long_section_names): Declare extern.
(pep_output_file_set_long_section_names): Add prototype.
* pe.em (OPTION_ENABLE_LONG_SECTION_NAMES): New getopt value macro.
(OPTION_DISABLE_LONG_SECTION_NAMES): Likewise.
(gld${EMULATION_NAME}_add_options): Add new options to xtra_long[].
(gld_${EMULATION_NAME}_list_options): Describe them.
(gld${EMULATION_NAME}_handle_option): Set or clear global
pe_use_coff_long_section_names flag when options recognised.
(gld_${EMULATION_NAME}_after_open): En/disable long section names
for main output bfd by calling pe_output_file_set_long_section_names.
* pep.em (enum options): Extend enum with new getopt option values.
(gld${EMULATION_NAME}_add_options): Add new options to xtra_long[].
(gld_${EMULATION_NAME}_list_options): Describe them.
(gld${EMULATION_NAME}_handle_option): Set or clear global
pe_use_coff_long_section_names flag when options recognised.
(gld_${EMULATION_NAME}_after_open): En/disable long section names
for main output bfd by calling pep_output_file_set_long_section_names.
ld/testsuite/ChangeLog
* ld-pe/longsecn-1.d: New test file.
* ld-pe/longsecn-2.d: Likewise.
* ld-pe/longsecn-3.d: Likewise.
* ld-pe/longsecn-4.d: Likewise.
* ld-pe/longsecn-5.d: Likewise.
* ld-pe/longsecn.d: Likewise.
* ld-pe/longsecn.exp: New test control script.
* ld-pe/longsecn.s: New test source file.
* pe-dll.c (tmp_seq2): New static variable.
(make_singleton_name_imp): New.
(make_import_fixup_entry): Use for v2 the _imp_<name> symbol and
avoid duplicate import table generation for same symbol.
(pe_create_runtime_relocator_reference): Make reference for
64-bit 8 bytes.
* pe.em (OPTION_USE_NUL_PREFIXED_IMPORT_TABLES): New.
(gld..._add_options): Add new option
--use-nul-prefixed-import-tables.
(gld..._handle_option): Likewise.
* pep.em: Same as for pe.em.
* ld.texinfo: Add new option documentation for
--use-nul-prefixed-import-tables.
* pe-dll.c (pe_use_nul_prefixed_import_tables): New.
(make_head): Make prefix leading zero prefix element for
idata$4 and idata$5 dependent to new flag.
(make_import_fixup_entry): Remove idata4/5 prefix.
* pe-dll.h (pe_use_nul_prefixed_import_tables): New.
* pep-dll.c (pe_use_nul_prefixed_import_tables): New.
* pep-dll.h (pep_use_nul_prefixed_import_tables): New.
* NEWS: Add new option.
* ld.texinfo: Document new --exclude-modules-for-implib option.
* pe-dll.c (exclude_list_struct): Change type member from int to
new enumeration exclude_type.
(pe_dll_add_excludes): Accept exclude_type instead of int param.
(auto_export): Replace magic constants by exclude_type values and
handle new choice EXCLUDEFORIMPLIB.
(pe_dll_generate_implib): Accept a pointer to the link_info and
iterate all input BFDs looking for EXCLUDEFORIMPLIB modules; re-open
fresh BFDs for any found and link into import lib archive chain.
* pe-dll.h (exclude_type): Add new enumerated type to replace magic
constants previously used for exclude_list_struct type member.
(pe_dll_add_excludes, pe_dll_generate_implib): Update prototypes.
* pep-dll.h (exclude_type, pe_dll_add_excludes,
pe_dll_generate_implib): Likewise to all the above.
* emultempl/pe.em (OPTION_EXCLUDE_MODULES_FOR_IMPLIB): Define new
getopts long option code for new --exclude-modules-for-implib option.
(gld${EMULATION_NAME}_add_options): Add new entry to xtra_long[].
(gld_${EMULATION_NAME}_list_options): List usage for it.
(gld${EMULATION_NAME}_handle_option): Use exclude_type enumerated
values when calling pe_dll_add_excludes, and handle EXCLUDEFORIMPLIB.
(gld_${EMULATION_NAME}_finish): Pass pointer to link_info when
calling pe_dll_generate_implib.
* emultempl/pep.em (options): Define new enumerated value for getopts
long option code for new --exclude-modules-for-implib option.
(gld${EMULATION_NAME}_add_options, gld_${EMULATION_NAME}_list_options,
gld${EMULATION_NAME}_handle_option, gld_${EMULATION_NAME}_finish):
Again, likewise to all the above.
* pe-dll.c (autofilter_liblist): Add entry for shared libgcc.
(libnamencmp): New function.
(auto_export): Use it in place of strncmp when filtering libraries.
Also rolled over ChangeLog to ChangeLog-2008
* common.h (STT_IFUNC): Define.
elfcpp/
* elfcpp.h (enum STT): Add STT_IFUNC.
bfd/
* syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION.
Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE. Renumber flags
to remove gaps.
(bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION.
(bfd_decode_symclass): Likewise.
* elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into
STT_IFUNC.
(elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC.
(_bfd_elf_is_function_type): Likewise.
* elf32-arm.c (arm_elf_find_function): Likewise.
(elf32_arm_adjust_dynamic_symbol): Likewise.
(elf32_arm_swap_symbol_in): Likewise.
(elf32_arm_additional_program_headers): Likewise.
* elf32-i386.c (is_indirect_symbol): New function.
(elf_i386_check_relocs): Also generate dynamic relocs for
relocations against STT_IFUNC symbols.
(allocate_dynrelocs): Likewise.
(elf_i386_relocate_section): Likewise.
* elf64-x86-64.c (is_indirect_symbol): New function.
(elf64_x86_64_check_relocs): Also generate dynamic relocs for
relocations against STT_IFUNC symbols.
(allocate_dynrelocs): Likewise.
(elf64_x86_64_relocate_section): Likewise.
* elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into
BSF_INDIRECT_FUNCTION.
* elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support
for STT_IFUNC symbols.
(get_ifunc_reloc_section_name): New function.
(_bfd_elf_make_ifunc_reloc_section): New function.
* elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field.
* bfd-in2.h: Regenerate.
gas/
* config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type.
* doc/as.texinfo: Document new feature.
* NEWS: Mention new feature.
gas/testsuite/
* gas/elf/type.s: Add test of STT_IFUNC symbol type.
* gas/elf/type.e: Update expected disassembly.
* gas/elf/elf.exp: Update grep of symbol types.
ld/
* NEWS: Mention new feature.
* pe-dll.c (process_def_file): Replace use of redundant
BFD_FORT_COMM_DEFAULT_VALUE with 0.
* scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn
sections.
ld/testsuite/
* ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc
descriptions.
* ld-mips-elf/reloc-1-n64.d: Likewise.
* ld-i386/ifunc.d: New test.
* ld-i386/ifunc.s: Source file for the new test.
* ld-i386/i386.exp: Run the new test.
* emultempl/pep.em (..._before_parse): initialize
pei386_runtime_pseudo_reloc by version 2.
(OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1): New option.
(OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2): New option.
(make_import_fixup): Use relocation size to read addend.
* emultempl/pe.em (..._before_parse): initialize
pei386_runtime_pseudo_reloc by version 1.
(OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1): New option.
(OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2): New option.
* pe-dll.c (pe-dll.h): Remove useless include.
(make_runtime_pseudo_reloc): Change addend to use bfd_vma.
Handle the two variants of pseudo-relocation.
(pe_create_import_fixup): Change addend to type bfd_vma.
Modify for the two pseudo_relocation variants.
(runtime_pseudp_reloc_v2_init): New static variable.
* pe-dll.h (pe_create_import_fixup): Change addend argument type
to bfd_vma.
* pep-dll.h (pep_create_import_fixup): Likewise.
* NEWS: Add comment.
ld/PR6502
* emultempl/pep.em (compute_dll_image_base): Use bfd_vma instead of long
and change return type to bfd_vma.
(definfo): Change type of address from long to bfd_vma.
(set_pep_value): Replace strtoul to strtoull.
(gld_${EMULATION_NAME}_set_symbols): use bfd_vma instead of long..
* pe-dll.c (pe_dll_generate_def_file): Use fprintf_vma to print ImageBase.
(quick_reloc): Change argument address from int to bfd_size_type.
(gld_xxx_recognized_file): Use pep_bfd_is_dll for detection of shared objects.
* pe-dll.c: (autofilter_symbollist_i386): Define set for amd64 mingw target.
* pe-dll.h (pe_bfd_is_dll): Declare.
* emultempl/pe.em (gld_${EMULATION_NAME}_recognized_file): Recognize dlls using
pe_bfd_is_dll instead of using the filename extension.
(autofilter_symbolprefixlist) : Remove __imp_.
(is_import) : New.
(auto-export) : Remove re-import check. Moved to callers.
(process_def_file) : Check is symbol is an import. Always underscore __imp_.
Only skip underscore on underscored targets.
(make_one) : Always underscore __imp_.
(pe_create_runtime_relocator_reference) : Only underscore _pei386_runtime_relocator on underscored targets.
(pe_process_import_defs) : Always underscore __imp_.
* pe.em (U) : New macro.
(set_pe_subsystem) : Remove underscore from _WinMainCRTStartup on wince subsystem case.
(pe_find_data_imports) : Use U on "_head_".
(gld_${EMULATION_NAME}_unrecognized_file) : Use U.
argument and emits the string followed by a comma and then the length of
the string.
(CONST_STRNEQ): New macro. Checks to see if a variable string has a constant
string as its initial characters.
(CONST_STRNCPY): New macro. Copies a constant string to the start of a
variable string.
* bfd-in2.h: Regenerate.
* <remainign files>: Make use of the new macros.
* Makefile.am: Add rules to build pe-arm-wince.lo and pei-arm-wince.lo objects.
* Makefile.in: Regenerate.
* pe-arm-wince.c: New file.
* pei-arm-wince.c: New file.
* pei-arm.c: Remove ARM_WINCE block.
* pe-arm.c: Remove ARM_WINCE block. Rename
bfd_arm_pe_allocate_interworking_sections,
bfd_arm_pe_get_bfd_for_interworking, and
bfd_arm_pe_process_before_allocation to
bfd_armpe_allocate_interworking_sections,
bfd_armpe_get_bfd_for_interworking, and
bfd_armpe_process_before_allocation. Move them before including bfd.h.
* bfd.c: ARM wince bfd format names were renamed. Adjust.
* coff-arm.c [ARM_WINCE]: Adjust so Windows CE doesn't end up with unexpected/conflicting relocs.
* targets.c: The arm-wince-pe target got its own new vector. Adjust.
* config.bfd: Likewise.
* configure.in: Likewise.
* configure: Regenerate.
binutils
* configure.in: Split arm-pe and arm-wince-pe. Build dlltool with -DDLLTOOL_ARM_WINCE for Windows CE case.
* configure: Regenerate.
* dlltool.c: Add support for arm-wince.
gas
* Makefile.am (TARG_ENV_HFILES): Add te-wince-pe.h.
* Makefile.in: Regenerate.
* config/tc-arm.h [TARGET_FORMAT]: ARM wince bfd names were renamed. Adjust.
ld
* Makefile.am: Split arm-wince into its own emulation.
* Makefile.in: Regenerate.
* configure.tgt: Set targ_emul to arm_wince_pe for ARM Windows CE targets.
* pe-dll.c : Define PE_ARCH_arm_wince.
(pe_detail_list): Add PE_ARCH_arm_wince case.
(make_one): Handle PE_ARCH_arm_epoc and PE_ARCH_arm_wince cases.
* emulparams/arm_wince_pe.sh: New file.
* emultempl/pe.em: Handle new TARGET_IS_arm_wince_pe define.
Remap bfd_arm_allocate_interworking_sections, bfd_arm_get_bfd_for_interworking and
bfd_arm_process_before_allocation for arm-pe and arm-wince-pe targets too.
(gld_${EMULATION_NAME}_recognized_file): Handle arm-wince and arm-epoc bfd format names.
(autofilter_symbollist): Split into autofilter_symbollist_generic and
autofilter_symbollist_i386.
(pe_detail_list): Add autofilter_symbollist_i386 to i386 case and
autofilter_symbollist_generic for all the others.
(autofilter_symbolprefixlist): Moved _fmode, _impure_ptr, cygwin_attach_dll,
cygwin_premain0, cygwin_premain1, cygwin_premain2, cygwin_premain3,
environ, into autofilter_symbollist_i386.
(auto_export): Get autofilter_symbollist from pe_details.