aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2005-06-01 04:04:19 +0000
committerZack Weinberg <zackw@panix.com>2005-06-01 04:04:19 +0000
commita359509ed39f8affc5f3e995b57d7611edfbb59d (patch)
treecea3b01c4597471699599bfb337a20439ee2071b /ld
parent7b8f476a17b961ff3d26cf02c8ea0d1da26ff5e6 (diff)
downloadgdb-a359509ed39f8affc5f3e995b57d7611edfbb59d.zip
gdb-a359509ed39f8affc5f3e995b57d7611edfbb59d.tar.gz
gdb-a359509ed39f8affc5f3e995b57d7611edfbb59d.tar.bz2
ld:
* 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/emultempl/beos.em19
-rw-r--r--ld/emultempl/pe.em8
-rw-r--r--ld/ldlang.c17
-rw-r--r--ld/ldlang.h2
-rw-r--r--ld/testsuite/ChangeLog13
-rw-r--r--ld/testsuite/ld-scripts/align.exp6
-rw-r--r--ld/testsuite/ld-scripts/data.exp7
-rw-r--r--ld/testsuite/ld-scripts/provide.exp15
-rw-r--r--ld/testsuite/ld-scripts/size.exp19
10 files changed, 75 insertions, 40 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 32362d5..e6f8abd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2005-05-31 Zack Weinberg <zack@codesourcery.com>
+
+ * 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.
+
2005-05-29 Richard Henderson <rth@redhat.com>
* emulparams/elf64alpha.sh (PLT): New.
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 24d4c44..4e06372 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -216,23 +216,8 @@ set_pe_subsystem (void)
set_pe_name ("__subsystem__", v[i].value);
/* If the subsystem is windows, we use a different entry
- point. We also register the entry point as an undefined
- symbol. from lang_add_entry() The reason we do
- this is so that the user
- doesn't have to because they would have to use the -u
- switch if they were specifying an entry point other than
- _mainCRTStartup. Specifically, if creating a windows
- application, entry point _WinMainCRTStartup must be
- specified. What I have found for non console
- applications (entry not _mainCRTStartup) is that the .obj
- that contains mainCRTStartup is brought in since it is
- the first encountered in libc.lib and it has other
- symbols in it which will be pulled in by the link
- process. To avoid this, adding -u with the entry point
- name specified forces the correct .obj to be used. We
- can avoid making the user do this by always adding the
- entry point name as an undefined symbol. */
- lang_add_entry (v[i].entry, 1);
+ point. */
+ lang_default_entry (v[i].entry);
return;
}
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 1336a31..bd6f191 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -139,9 +139,9 @@ gld_${EMULATION_NAME}_before_parse (void)
#if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
- lang_add_entry ("WinMainCRTStartup", FALSE);
+ lang_default_entry ("WinMainCRTStartup");
#else
- lang_add_entry ("_WinMainCRTStartup", FALSE);
+ lang_default_entry ("_WinMainCRTStartup");
#endif
#endif
#endif
@@ -457,7 +457,7 @@ set_pe_subsystem (void)
{
char *alc_entry;
- /* lang_add_entry expects its argument to be permanently
+ /* lang_default_entry expects its argument to be permanently
allocated, so we don't free this string. */
alc_entry = xmalloc (strlen (initial_symbol_char)
+ strlen (entry)
@@ -467,7 +467,7 @@ set_pe_subsystem (void)
entry = alc_entry;
}
- lang_add_entry (entry, FALSE);
+ lang_default_entry (entry);
return;
}
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 835c93a..25374cc 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -91,6 +91,7 @@ lang_statement_list_type lang_output_section_statement;
lang_statement_list_type *stat_ptr = &statement_list;
lang_statement_list_type file_chain = { NULL, NULL };
struct bfd_sym_chain entry_symbol = { NULL, NULL };
+static const char *entry_symbol_default = "start";
const char *entry_section = ".text";
bfd_boolean entry_from_cmdline;
bfd_boolean lang_has_input_file = FALSE;
@@ -4743,9 +4744,9 @@ lang_finish (void)
if (entry_symbol.name == NULL)
{
- /* No entry has been specified. Look for start, but don't warn
- if we don't find it. */
- entry_symbol.name = "start";
+ /* No entry has been specified. Look for the default entry, but
+ don't warn if we don't find it. */
+ entry_symbol.name = entry_symbol_default;
warn = FALSE;
}
@@ -5582,6 +5583,16 @@ lang_add_entry (const char *name, bfd_boolean cmdline)
}
}
+/* Set the default start symbol to NAME. .em files should use this,
+ not lang_add_entry, to override the use of "start" if neither the
+ linker script nor the command line specifies an entry point. NAME
+ must be permanently allocated. */
+void
+lang_default_entry (const char *name)
+{
+ entry_symbol_default = name;
+}
+
void
lang_add_target (const char *name)
{
diff --git a/ld/ldlang.h b/ld/ldlang.h
index eb4fc5e..7b88647 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -474,6 +474,8 @@ extern void lang_section_start
(const char *, union etree_union *, const segment_type *);
extern void lang_add_entry
(const char *, bfd_boolean);
+extern void lang_default_entry
+ (const char *);
extern void lang_add_target
(const char *);
extern void lang_add_wild
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 00e4d27..9894408 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,10 +1,17 @@
+2005-05-31 Zack Weinberg <zack@codesourcery.com>
+
+ * 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.
+
2005-05-27 Mark Mitchell <mark@codesourcery.com>
* config/default.exp (CC): Use find_gcc.
(CFLAGS): Define, if no definition has been provided by the user.
(CXX): Likewise.
(CXXFLAGS): Likewise.
-
+
2005-05-24 H.J. Lu <hongjiu.lu@intel.com>
* ld-mmix/bpo-6.d: Updated.
@@ -130,7 +137,7 @@
ld-sparc/tlssunpic64.dd, ld-sparc/tlssunpic64.rd,
ld-sparc/tlssunpic64.sd, ld-sparc/tlssunpic64.td): Update now
that sparc64 ELF does support TLS.
-
+
2005-04-13 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/empty.d: New file.
@@ -168,7 +175,7 @@
* config/default.exp: Do not load libpath.exp if it does not
exist.
(CC): Provide fallback definition.
-
+
2005-03-24 Eric Christopher <echristo@redhat.com>
* ld-mips-elf/rel32-n32.d: Revert changes.
diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp
index 6f3a9de..8bcd222 100644
--- a/ld/testsuite/ld-scripts/align.exp
+++ b/ld/testsuite/ld-scripts/align.exp
@@ -29,6 +29,12 @@ if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
return
}
+# Doesn't work on PECOFF, appears to be a genuine bug
+if [is_pecoff_format] {
+ global target_triplet
+ setup_xfail $target_triplet
+}
+
if ![ld_simple_link $ld tmpdir/align "-T $srcdir/$subdir/align.t tmpdir/align.o"] {
fail $testname
} else {
diff --git a/ld/testsuite/ld-scripts/data.exp b/ld/testsuite/ld-scripts/data.exp
index 7f63110..8dd173a 100644
--- a/ld/testsuite/ld-scripts/data.exp
+++ b/ld/testsuite/ld-scripts/data.exp
@@ -17,4 +17,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+# An a.out "objdump -s -j .text" has the file header visible inside the
+# text segment, confusing run_dump_test.
+if {[is_aout_format]} {
+ unsupported data
+ return
+}
+
run_dump_test data
diff --git a/ld/testsuite/ld-scripts/provide.exp b/ld/testsuite/ld-scripts/provide.exp
index 6589e17..7e2c0e7 100644
--- a/ld/testsuite/ld-scripts/provide.exp
+++ b/ld/testsuite/ld-scripts/provide.exp
@@ -15,15 +15,20 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+# USA.
-if [istarget "rs6000-*-aix*"] {
- # Target maps .text and .data to other sections.
+# AIX maps .text and .data to other sections.
+# a.out objdump displays the file header inside the text segment,
+# confusing run_dump_test.
+
+if {[istarget "rs6000-*-aix*"] || [is_aout_format]} {
+ unsupported provide-1
+ unsupported provide-2
+ unsupported provide-3
return
}
-set testname "provide"
-
run_dump_test provide-1
run_dump_test provide-2
setup_xfail *-*-*
diff --git a/ld/testsuite/ld-scripts/size.exp b/ld/testsuite/ld-scripts/size.exp
index ba08fe2..49405cb 100644
--- a/ld/testsuite/ld-scripts/size.exp
+++ b/ld/testsuite/ld-scripts/size.exp
@@ -16,19 +16,22 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#
-if [istarget "rs6000-*-aix*"] {
- # Target maps .text and .data to other sections.
+# AIX maps .text and .data to other sections.
+# a.out objdump displays the file header inside the text segment,
+# confusing run_dump_test.
+
+if {[istarget "rs6000-*-aix*"] || [is_aout_format]} {
+ unsupported size-1
+ unsupported size-2
return
}
run_dump_test size-1
-if ![is_elf_format] {
- return
-}
-
-if [istarget "mips*-*-*"] {
- # MIPS inserts a REGINFO PHDR
+# size-2 only works on ELF targets.
+# MIPS inserts a REGINFO PHDR
+if {![is_elf_format] || [istarget "mips*-*-*"]} {
+ unsupported size-2
return
}