* ldlang.c (entry_sym): Likewise.
(ldlang_undef_chain_list_type): Likewise.
(lang_finish): Adjust references to entry_symbol.
(lang_add_entry): Likewise.
(lang_gc_sections): Use link_info.gc_sym_list.
(lang_process): Set link_info.gc_sym_list.
* ldlex.l: Include bfdlink.h.
* ldmain.c (main): Init link_info.gc_sym_list.
* emultempl/aix.em: Adjust references to entry_symbol.
* emultempl/armcoff.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/ppc64elf.em (ppc_after_open): New function.
(LDEMUL_AFTER_OPEN): Define.
* emulparams/elf64ppc.sh: KEEP .opd sections.
+2002-07-01 Alan Modra <amodra@bigpond.net.au>
+
+ * ldlang.h (entry_sym): Make it a struct bfd_sym_chain.
+ * ldlang.c (entry_sym): Likewise.
+ (ldlang_undef_chain_list_type): Likewise.
+ (lang_finish): Adjust references to entry_symbol.
+ (lang_add_entry): Likewise.
+ (lang_gc_sections): Use link_info.gc_sym_list.
+ (lang_process): Set link_info.gc_sym_list.
+ * ldlex.l: Include bfdlink.h.
+ * ldmain.c (main): Init link_info.gc_sym_list.
+ * emultempl/aix.em: Adjust references to entry_symbol.
+ * emultempl/armcoff.em: Likewise.
+ * emultempl/armelf.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/ppc64elf.em (ppc_after_open): New function.
+ (LDEMUL_AFTER_OPEN): Define.
+ * emulparams/elf64ppc.sh: KEEP .opd sections.
+
2002-06-29 Stephane Carrez <stcarrez@nerim.fr>
* emulparams/m68hc12elfb.sh (EEPROM_MEMORY): Define.
.rela.toc ${RELOCATING-0} : { *(.rela.toc) }"
OTHER_READWRITE_SECTIONS="
.toc1 ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc1) }
- .opd ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.opd) }"
+ .opd ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { KEEP (*(.opd)) }"
# Treat a host that matches the target with the possible exception of "64"
# in the name as if it were native.
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ${EMULATION_NAME}
- Copyright 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001
+ Copyright 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
/* Let the XCOFF backend set up the .loader section. */
if (!bfd_xcoff_size_dynamic_sections
- (output_bfd, &link_info, libpath, entry_symbol, file_align,
+ (output_bfd, &link_info, libpath, entry_symbol.name, file_align,
maxstack, maxdata, gc && !unix_ld ? true : false,
modtype, textro ? true : false, unix_ld, special_sections,
rtld ? true : false))
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
sprintf_vma (buffer + 2, val);
- if (entry_symbol != NULL && entry_from_cmdline)
+ if (entry_symbol.name != NULL && entry_from_cmdline)
einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
- thumb_entry_symbol, entry_symbol);
- entry_symbol = buffer;
+ thumb_entry_symbol, entry_symbol.name);
+ entry_symbol.name = buffer;
}
else
einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
sprintf_vma (buffer + 2, val);
- if (entry_symbol != NULL && entry_from_cmdline)
+ if (entry_symbol.name != NULL && entry_from_cmdline)
einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
- thumb_entry_symbol, entry_symbol);
- entry_symbol = buffer;
+ thumb_entry_symbol, entry_symbol.name);
+ entry_symbol.name = buffer;
}
else
einfo (_("%P: warning: connot find thumb start symbol %s\n"),
opened, so registering the symbol as undefined will make a
difference. */
- if (! link_info.relocateable && entry_symbol != NULL)
- ldlang_add_undef (entry_symbol);
+ if (! link_info.relocateable && entry_symbol.name != NULL)
+ ldlang_add_undef (entry_symbol.name);
}
/* pe-dll.c directly accesses pe_data_import_dll,
sprintf_vma (buffer + 2, val);
- if (entry_symbol != NULL && entry_from_cmdline)
+ if (entry_symbol.name != NULL && entry_from_cmdline)
einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
- thumb_entry_symbol, entry_symbol);
- entry_symbol = buffer;
+ thumb_entry_symbol, entry_symbol.name);
+ entry_symbol.name = buffer;
}
else
einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
static int dotsyms = 1;
static void ppc_create_output_section_statements PARAMS ((void));
+static void ppc_after_open PARAMS ((void));
static asection *ppc_add_stub_section PARAMS ((const char *, asection *));
static void ppc_layout_sections_again PARAMS ((void));
static void gld${EMULATION_NAME}_after_allocation PARAMS ((void));
ldlang_add_file (stub_file);
}
+static void
+ppc_after_open ()
+{
+ if (!ppc64_elf_mark_entry_syms (&link_info))
+ {
+ einfo ("%X%P: can not mark entry symbols %E\n");
+ return;
+ }
+
+ gld${EMULATION_NAME}_after_open ();
+}
struct hook_stub_info
{
# Put these extra ppc64elf routines in ld_${EMULATION_NAME}_emulation
#
+LDEMUL_AFTER_OPEN=ppc_after_open
LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=ppc_create_output_section_statements
lang_statement_list_type lang_output_section_statement;
lang_statement_list_type *stat_ptr = &statement_list;
lang_statement_list_type file_chain = { NULL, NULL };
-const char *entry_symbol = NULL;
+struct bfd_sym_chain entry_symbol = { NULL, NULL };
const char *entry_section = ".text";
boolean entry_from_cmdline;
boolean lang_has_input_file = false;
on a list, then, once the output file has been opened, transfer the
name to the symbol table. */
-typedef struct ldlang_undef_chain_list
-{
- struct ldlang_undef_chain_list *next;
- char *name;
-} ldlang_undef_chain_list_type;
+typedef struct bfd_sym_chain ldlang_undef_chain_list_type;
-static ldlang_undef_chain_list_type *ldlang_undef_chain_list_head;
+#define ldlang_undef_chain_list_head entry_symbol.next
void
ldlang_add_undef (name)
else
warn = true;
- if (entry_symbol == (char *) NULL)
+ if (entry_symbol.name == (const char *) NULL)
{
/* No entry has been specified. Look for start, but don't warn
if we don't find it. */
- entry_symbol = "start";
+ entry_symbol.name = "start";
warn = false;
}
- h = bfd_link_hash_lookup (link_info.hash, entry_symbol, false, false, true);
+ h = bfd_link_hash_lookup (link_info.hash, entry_symbol.name,
+ false, false, true);
if (h != (struct bfd_link_hash_entry *) NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak)
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
if (! bfd_set_start_address (output_bfd, val))
- einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
+ einfo (_("%P%F:%s: can't set start address\n"), entry_symbol.name);
}
else
{
/* We couldn't find the entry symbol. Try parsing it as a
number. */
- val = bfd_scan_vma (entry_symbol, &send, 0);
+ val = bfd_scan_vma (entry_symbol.name, &send, 0);
if (*send == '\0')
{
if (! bfd_set_start_address (output_bfd, val))
{
if (warn)
einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
- entry_symbol, bfd_get_section_vma (output_bfd, ts));
+ entry_symbol.name,
+ bfd_get_section_vma (output_bfd, ts));
if (! bfd_set_start_address (output_bfd,
bfd_get_section_vma (output_bfd,
ts)))
{
if (warn)
einfo (_("%P: warning: cannot find entry symbol %s; not setting start address\n"),
- entry_symbol);
+ entry_symbol.name);
}
}
}
lang_gc_sections ()
{
struct bfd_link_hash_entry *h;
- ldlang_undef_chain_list_type *ulist, fake_list_start;
+ ldlang_undef_chain_list_type *ulist;
/* Keep all sections so marked in the link script. */
lang_gc_sections_1 (statement_list.head);
- /* Keep all sections containing symbols undefined on the command-line.
- Handle the entry symbol at the same time. */
-
- if (entry_symbol != NULL)
- {
- fake_list_start.next = ldlang_undef_chain_list_head;
- fake_list_start.name = (char *) entry_symbol;
- ulist = &fake_list_start;
- }
- else
- ulist = ldlang_undef_chain_list_head;
+ /* Keep all sections containing symbols undefined on the command-line,
+ and the section containing the entry symbol. */
- for (; ulist; ulist = ulist->next)
+ for (ulist = link_info.gc_sym_list; ulist; ulist = ulist->next)
{
h = bfd_link_hash_lookup (link_info.hash, ulist->name,
false, false, false);
current_target = default_target;
open_input_bfds (statement_list.head, false);
+ link_info.gc_sym_list = &entry_symbol;
+ if (entry_symbol.name == NULL)
+ link_info.gc_sym_list = ldlang_undef_chain_list_head;
+
ldemul_after_open ();
already_linked_table_free ();
const char *name;
boolean cmdline;
{
- if (entry_symbol == NULL
+ if (entry_symbol.name == NULL
|| cmdline
|| ! entry_from_cmdline)
{
- entry_symbol = name;
+ entry_symbol.name = name;
entry_from_cmdline = cmdline;
}
}
extern lang_statement_list_type *stat_ptr;
extern boolean delete_output_file_on_failure;
-extern const char *entry_symbol;
+extern struct bfd_sym_chain entry_symbol;
extern const char *entry_section;
extern boolean entry_from_cmdline;
extern lang_statement_list_type file_chain;
#include "bfd.h"
#include "sysdep.h"
#include "safe-ctype.h"
+#include "bfdlink.h"
#include "ld.h"
#include "ldmisc.h"
#include "ldexp.h"
link_info.keep_memory = true;
link_info.input_bfds = NULL;
link_info.create_object_symbols_section = NULL;
+ link_info.gc_sym_list = NULL;
link_info.hash = NULL;
link_info.keep_hash = NULL;
link_info.notice_all = false;