aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2010-05-11 17:46:22 +0000
committerKai Tietz <kai.tietz@onevision.com>2010-05-11 17:46:22 +0000
commitb804e4aff29e64c1cc5f923570fd6a4973e949b4 (patch)
tree28e9af9817cdcd13d6fd266bb6ac78c2b6aa1883 /ld/emultempl
parent4547cb569c36286f0b5e5d0b5cfd86ce3ba4cbdb (diff)
downloadgdb-b804e4aff29e64c1cc5f923570fd6a4973e949b4.zip
gdb-b804e4aff29e64c1cc5f923570fd6a4973e949b4.tar.gz
gdb-b804e4aff29e64c1cc5f923570fd6a4973e949b4.tar.bz2
2010-05-11 Kai Tietz <kai.tietz@onevision.com>
* emultempl/pe.em (gld_${EMULATION_NAME}_before_parse): Initialize pe(p)_leading_underscore variable. (set_pe_name): Likewise. * emultempl/pep.em: Likewise. Additional change default to non-underscore for pep_leading_underscore equal to -1.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/pe.em44
-rw-r--r--ld/emultempl/pep.em50
2 files changed, 75 insertions, 19 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index ec893b9..a1c5771 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -145,6 +145,17 @@ extern const char *output_filename;
static void
gld_${EMULATION_NAME}_before_parse (void)
{
+ int u;
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pe_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pe_leading_underscore = u;
+
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
output_filename = "${EXECUTABLE_NAME:-a.exe}";
#ifdef DLL_SUPPORT
@@ -463,7 +474,17 @@ gld_${EMULATION_NAME}_list_options (FILE *file)
static void
set_pe_name (char *name, long val)
{
- int i;
+ int i, u;
+
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pe_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pe_leading_underscore = u;
/* Find the name and set it. */
for (i = 0; init[i].ptr; i++)
@@ -530,15 +551,13 @@ set_entry_point (void)
/* Now we check target's default for getting proper symbol_char. */
u = pe_leading_underscore;
- if (u == -1 && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
- if (u == 0)
- initial_symbol_char = "";
- else if (u != -1)
- initial_symbol_char = "_";
- else
+ if (u == -1)
abort ();
+ initial_symbol_char = (u == 1 ? "_" : "");
pe_leading_underscore = u;
if (*initial_symbol_char != '\0')
@@ -896,7 +915,16 @@ gld_${EMULATION_NAME}_set_symbols (void)
{
/* Run through and invent symbols for all the
names and insert the defaults. */
- int j;
+ int j, u;
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pe_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pe_leading_underscore = u;
if (!init[IMAGEBASEOFF].inited)
{
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index a315fd6..a5b6464 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -118,6 +118,17 @@ extern const char *output_filename;
static void
gld_${EMULATION_NAME}_before_parse (void)
{
+ int u;
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pep_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pep_leading_underscore = u;
+
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
output_filename = "${EXECUTABLE_NAME:-a.exe}";
#ifdef DLL_SUPPORT
@@ -286,16 +297,16 @@ typedef struct
#define GET_INIT_SYMBOL_NAME(IDX) \
(init[(IDX)].symbol \
- + ((init[(IDX)].is_c_symbol == FALSE || pep_leading_underscore != 0) ? 0 : 1))
+ + ((init[(IDX)].is_c_symbol == FALSE || pep_leading_underscore == 1) ? 0 : 1))
/* Decorates the C visible symbol by underscore, if target requires. */
#define U(CSTR) \
- (pep_leading_underscore == 0 ? CSTR : "_" CSTR)
+ (pep_leading_underscore != 1 ? CSTR : "_" CSTR)
/* Get size of constant string for a possible underscore prefixed
C visible symbol. */
#define U_SIZE(CSTR) \
- (sizeof (CSTR) + pep_leading_underscore == 0 ? 0 : 1)
+ (sizeof (CSTR) + pep_leading_underscore == 1 ? 0 : 1)
#define D(field,symbol,def,usc) {&pep.field,sizeof(pep.field), def, symbol,0, usc}
@@ -400,7 +411,17 @@ gld_${EMULATION_NAME}_list_options (FILE *file)
static void
set_pep_name (char *name, bfd_vma val)
{
- int i;
+ int i, u;
+
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pep_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pep_leading_underscore = u;
/* Find the name and set it. */
for (i = 0; init[i].ptr; i++)
@@ -462,15 +483,13 @@ set_entry_point (void)
/* Now we check target's default for getting proper symbol_char. */
u = pep_leading_underscore;
- if (u == -1 && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
- if (u == 0)
- initial_symbol_char = "";
- else if (u != -1)
- initial_symbol_char = "_";
- else
+ if (u == -1)
abort ();
+ initial_symbol_char = (u == 1 ? "_" : "");
pep_leading_underscore = u;
if (*initial_symbol_char != '\0')
@@ -821,7 +840,16 @@ gld_${EMULATION_NAME}_set_symbols (void)
{
/* Run through and invent symbols for all the
names and insert the defaults. */
- int j;
+ int j, u;
+ /* Now we check target's default for getting proper symbol_char. */
+ u = pep_leading_underscore;
+ if (u == -1
+ && !bfd_get_target_info ("${OUTPUT_FORMAT}", NULL, NULL, &u, NULL))
+ bfd_get_target_info ("${RELOCATEABLE_OUTPUT_FORMAT}", NULL, NULL, &u, NULL);
+
+ if (u == -1)
+ abort ();
+ pep_leading_underscore = u;
if (!init[IMAGEBASEOFF].inited)
{