* pe.em (DEFAULT_PSEUDO_RELOC_VERSION): New macro.
(gld_XXX_before_parse): Set pseudo-relocation default
version to DEFAULT_PSEUDO_RELOC_VERSION.
(gldXXX_handle_option): Likewise.
(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.
assignment inside output section statement. Ensure only one
set of symbols per output section.
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Add non-
dollar sections before dollar sections. Correct add_child
list insertion.
* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
PR ld/6744
* ld.texinfo (--export-dynamic): Mention --export-all-symbols.
* emultempl/pe.em (gld_${EMULATION_NAME}_after_parse): Issue
warning if --export-dynamic was passed on command-line.
* emultempl/pep.em (gld_${EMULATION_NAME}_after_parse): Likewise.
ld/testsuite/ChangeLog
PR ld/6744
* ld-pe/export_dynamic_warning.d: New test control file.
* ld-pe/export_dynamic_warning.s: New test source file.
* ld-pe/pe.exp: Also run export_dynamic_warning dump test.
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.
(gld_${EMULATION_NAME}_after_open): Use it to iterate all sections
of all input BFDs, looking for debug info. Enable long section names
if any found.
* emultempl/pe.em (debug_section_p): Likewise.
(gld_${EMULATION_NAME}_after_open): Likewise.
* NEWS: Retrospectively adjust news announcement.
* ld.texinfo: Update documentation to mention new behaviour.
* emultempl/pe.em (gld_${EMULATION_NAME}_before_parse): Set
default state of auto-import flag based on $target.
ld/testsuite/ChangeLog
* ld-pe/pe.exp: Disable auto-import when linking on Cygwin.
* 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.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.
* 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.
* emultempl/pep.em (pep_find_data_imports): Issue a warning message if auto importing is triggered without
--enable-auto-import having been specified on the command line.
* emultempl/pe.em (pe_find_data_imports): Likewise.
* genscript.sh: Add support for generating a .xa script for use with the --auto-import option.
* ld.texinfo: Document the new behaviour of the --auto-import option.
* ldint.texinfo: Document new script generation.
* emulparams/i386pe.sh (GENERATE_AUTO_IMPORT): Define.
* emulparams/i386pe_posix.sh (GENERATE_AUTO_IMPORT): Define.
* emulparams/i386pep.sh (GENERATE_AUTO_IMPORT): Define.
* emultemp/pe.em (..._get_script): Support the use of the auto import script.
* scripttempl/pe.sc: Put the .rdata input sections into the .data output section when creating an auto import script.
* scripttempl/pep.sc: Likewise.
* 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.
Add native "%s.lib" format to search list
* ld.texinfo (node WIN32): Update documentation on dynamic lib search order.
Add another reason for using import libs.
* ldlang.c (entry_symbol_default): New file-scope global.
(lang_finish): Use it, not a hardwired "start".
(lang_default_entry): Set it.
* ldlang.h: Declare lang_default_entry.
* emultempl/beos.em, emultempl/pe.em: Use lang_default_entry,
not lang_add_entry, to override default entry point symbol.
ld/testsuite:
* ld-scripts/align.exp: Mark align1 XFAIL on PECOFF targets.
* ld-scripts/data.exp: Mark data UNSUPPORTED on a.out targets.
* ld-scripts/provide.exp, ld-scripts/size.exp: Mark all tests
UNSUPPORTED on a.out targets. Tidy.