* 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.
This commit is contained in:
Zack Weinberg 2005-06-01 04:04:19 +00:00
parent 7b8f476a17
commit a359509ed3
10 changed files with 75 additions and 40 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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

View File

@ -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.

View File

@ -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 {

View File

@ -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

View File

@ -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 *-*-*

View File

@ -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
}