summaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2010-04-05 09:04:08 +0000
committerKai Tietz <kai.tietz@onevision.com>2010-04-05 09:04:08 +0000
commitd9a5a8938af91e1dd9dc6b2ba52bc9d9fee020d8 (patch)
tree8c4e3dea949ad5141465b53ec44c3a11be90dd12 /ld/pe-dll.c
parent92bb6d19a4a4c541d48475e717b827c3ab4902e0 (diff)
downloadbinutils-redhat-d9a5a8938af91e1dd9dc6b2ba52bc9d9fee020d8.tar.gz
2010-04-05 Kai Tietz <kai.tietz@onevision.com>
* emultempl/pep.em (U): Macro modified. (U_SIZE): New helper macro. (GET_INIT_SYMBOL_NAME): Likewise. (enum options): Add OPTION_NO_LEADING_UNDERSCORE and OPTION_LEADING_UNDERSCORE enumerator-values. (gld${EMULATION_NAME}_add_options): Add --(no-)leading-underscore option. (definfo): Add new member is_c_symbol. (D): Add to macro underscore mode parameter. (init): Add definition for is_c_symbol. (gld_${EMULATION_NAME}_list_options): Display new options. (set_pep_name): Adjust underscoring dependent fixed symbol handling. (gld_${EMULATION_NAME}_set_symbols): Likewise. (saw_option): Likewise. (gld_${EMULATION_NAME}_unrecognized_file): Likewise. (set_entry_point): Initial initial_symbol_char dependent to target's default and new option flag pep_leading_underscore. * emultempl/pe.em (U): Macro modified. (U_SIZE): New helper macro. (GET_INIT_SYMBOL_NAME): Likewise. (OPTION_LEADING_UNDERSCORE): Add new option define. (OPTION_NO_LEADING_UNDERSCORE): Likewise. (gld${EMULATION_NAME}_add_options): Add --(no-)leading-underscore option. (definfo): Add new member is_c_symbol. (D): Add to macro underscore mode parameter. (init): Add definition for is_c_symbol. (gld_${EMULATION_NAME}_list_options): Display new options. (set_pep_name): Adjust underscoring dependent fixed symbol handling. (gld_${EMULATION_NAME}_set_symbols): Likewise. (saw_option): Likewise. (gld_${EMULATION_NAME}_unrecognized_file): Likewise. (set_entry_point): Initial initial_symbol_char dependent to target's default and new option flag pep_leading_underscore. * pe-dll.c (pe_leading_underscore): New flag variable. (pe_detail_list): Remove const to allow modify of member underscore. (pe_dll_id_target): Initialize pe_details' underscore variable dependent to target's default and flag pe_leading_underscore. * pe-dll.h (pe_leading_underscore): Add extern declaration of option flag. * pep-dll.c (pe_leading_underscore): Add alias define for pep_leading_underscore. * pep-dll.h (pep_leading_underscore) Add extern declaration of option flag. * ld.texinfo: Add documentation for --(no-)leading-underscore option.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index ad5f82a4f0..21717fc5ce 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -158,6 +158,7 @@ int pe_dll_compat_implib = 0;
int pe_dll_extra_pe_debug = 0;
int pe_use_nul_prefixed_import_tables = 0;
int pe_use_coff_long_section_names = -1;
+int pe_leading_underscore = -1;
/* Static variables and types. */
@@ -244,7 +245,9 @@ static const autofilter_entry_type autofilter_symbollist_i386[] =
#define PE_ARCH_arm_epoc 5
#define PE_ARCH_arm_wince 6
-static const pe_details_type pe_detail_list[] =
+/* Don't make it constant as underscore mode gets possibly overriden
+ by target or -(no-)leading-underscore option. */
+static pe_details_type pe_detail_list[] =
{
{
#ifdef pe_use_x86_64
@@ -410,6 +413,11 @@ pe_dll_id_target (const char *target)
if (strcmp (pe_detail_list[i].target_name, target) == 0
|| strcmp (pe_detail_list[i].object_target, target) == 0)
{
+ int u = pe_leading_underscore; /* Underscoring mode. -1 for use default. */
+ if (u == -1)
+ bfd_get_target_info (target, NULL, NULL, &u, NULL);
+ if (u != -1)
+ pe_detail_list[i].underscored = (u != 0 ? TRUE : FALSE);
pe_details = pe_detail_list + i;
return;
}