* ldlang.h (lang_input_section_type): Remove "ifile" field.

(lang_insert_orphan, lang_add_section): Update prototypes.
	* ldlang.c (lang_insert_orphan): Remove "file" param.
	(lang_add_section): Likewise.  Update all callers.
	(wild_sort): Get an input section's bfd via "section->owner".
	(size_input_section): Access just_syms_flag via bfd usrdata.
	(lang_place_orphans): Update ldemul_place_orphan call.
	* ldemul.h (ldemul_place_orphan): Remove input_statement param.
	(struct ld_emulation_xfer_struct <place_orphan>): Likewise.
	* ldemul.c (ldemul_place_orphan): Likewise.
	* ldwrite.c (build_link_order): Access just_syms_flag via bfd usrdata.
	* emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise.
	* emultempl/beos.em (sort_by_file_name): Access bfd by section->owner.
	(sort_sections): Likewise.
	(place_orphan): Remove "file" param.  Adjust lang_add_section call.
	* emultempl/elf32.em (place_orphan): Remove "file" param.  Adjust
	lang_add_section and lang_insert_orphan calls.
	* emultempl/hppaelf.em (hppaelf_add_stub_section): Adjust
	lang_add_section call.
	(build_section_lists): Access just_syms_flag via bfd usrdata.
	* emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Adjust
	lang_add_section call.
	* emultempl/mmo.em (mmo_place_orphan): Remove "file" param.  Adjust
	lang_add_section and lang_insert_orphan calls.
	* emultempl/pe.em (place_orphan): Likewise.  Access bfd via section
	owner.
	* emultempl/ppc64elf.em (ppc_add_stub_section): Adjust
	lang_add_section call.
	(build_toc_list): Access just_syms_flag via bfd usrdata.
	(build_section_lists): Likewise.
	* emultempl/xtensaelf.em (elf_xtensa_place_orphan): Remove "file"
	param.  Adjust place_orphan call.
	(ld_build_required_section_dependence): Access bfd via section owner.
This commit is contained in:
Alan Modra 2005-11-17 00:10:05 +00:00
parent a0fef31c45
commit 7b986e992e
15 changed files with 169 additions and 127 deletions

View file

@ -1,3 +1,39 @@
2005-11-17 Alan Modra <amodra@bigpond.net.au>
* ldlang.h (lang_input_section_type): Remove "ifile" field.
(lang_insert_orphan, lang_add_section): Update prototypes.
* ldlang.c (lang_insert_orphan): Remove "file" param.
(lang_add_section): Likewise. Update all callers.
(wild_sort): Get an input section's bfd via "section->owner".
(size_input_section): Access just_syms_flag via bfd usrdata.
(lang_place_orphans): Update ldemul_place_orphan call.
* ldemul.h (ldemul_place_orphan): Remove input_statement param.
(struct ld_emulation_xfer_struct <place_orphan>): Likewise.
* ldemul.c (ldemul_place_orphan): Likewise.
* ldwrite.c (build_link_order): Access just_syms_flag via bfd usrdata.
* emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise.
* emultempl/beos.em (sort_by_file_name): Access bfd by section->owner.
(sort_sections): Likewise.
(place_orphan): Remove "file" param. Adjust lang_add_section call.
* emultempl/elf32.em (place_orphan): Remove "file" param. Adjust
lang_add_section and lang_insert_orphan calls.
* emultempl/hppaelf.em (hppaelf_add_stub_section): Adjust
lang_add_section call.
(build_section_lists): Access just_syms_flag via bfd usrdata.
* emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Adjust
lang_add_section call.
* emultempl/mmo.em (mmo_place_orphan): Remove "file" param. Adjust
lang_add_section and lang_insert_orphan calls.
* emultempl/pe.em (place_orphan): Likewise. Access bfd via section
owner.
* emultempl/ppc64elf.em (ppc_add_stub_section): Adjust
lang_add_section call.
(build_toc_list): Access just_syms_flag via bfd usrdata.
(build_section_lists): Likewise.
* emultempl/xtensaelf.em (elf_xtensa_place_orphan): Remove "file"
param. Adjust place_orphan call.
(ld_build_required_section_dependence): Access bfd via section owner.
2005-11-16 Alan Modra <amodra@bigpond.net.au> 2005-11-16 Alan Modra <amodra@bigpond.net.au>
* ldlang.h (lang_output_section_statement_type): Add prev. * ldlang.h (lang_output_section_statement_type): Add prev.

View file

@ -71,24 +71,27 @@ arm_elf_after_open (void)
static void static void
arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement) arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement)
{ {
if (statement->header.type == lang_input_section_enum if (statement->header.type == lang_input_section_enum)
&& !statement->input_section.ifile->just_syms_flag
&& (statement->input_section.section->flags & SEC_EXCLUDE) == 0)
{ {
asection *i = statement->input_section.section; asection *i = statement->input_section.section;
asection *output_section = i->output_section;
ASSERT (output_section->owner == output_bfd); if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0)
/* Don't attach the interworking stubs to a dynamic object, to
an empty section, etc. */
if ((output_section->flags & SEC_HAS_CONTENTS) != 0
&& (i->flags & SEC_NEVER_LOAD) == 0
&& ! (i->owner->flags & DYNAMIC)
&& ! i->owner->output_has_begun)
{ {
bfd_for_interwork = i->owner; asection *output_section = i->output_section;
bfd_for_interwork->output_has_begun = TRUE;
ASSERT (output_section->owner == output_bfd);
/* Don't attach the interworking stubs to a dynamic object, to
an empty section, etc. */
if ((output_section->flags & SEC_HAS_CONTENTS) != 0
&& (i->flags & SEC_NEVER_LOAD) == 0
&& ! (i->owner->flags & DYNAMIC)
&& ! i->owner->output_has_begun)
{
bfd_for_interwork = i->owner;
bfd_for_interwork->output_has_begun = TRUE;
}
} }
} }
} }

View file

@ -397,13 +397,13 @@ sort_by_file_name (const void *a, const void *b)
const lang_statement_union_type *const *rb = b; const lang_statement_union_type *const *rb = b;
int i, a_sec, b_sec; int i, a_sec, b_sec;
i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename, i = strcmp ((*ra)->input_section.section->owner->my_archive->filename,
(*rb)->input_section.ifile->the_bfd->my_archive->filename); (*rb)->input_section.section->owner->my_archive->filename);
if (i != 0) if (i != 0)
return i; return i;
i = strcmp ((*ra)->input_section.ifile->filename, i = strcmp ((*ra)->input_section.section->owner->filename,
(*rb)->input_section.ifile->filename); (*rb)->input_section.section->owner->filename);
if (i != 0) if (i != 0)
return i; return i;
/* the tail idata4/5 are the only ones without relocs to an /* the tail idata4/5 are the only ones without relocs to an
@ -427,15 +427,15 @@ sort_by_file_name (const void *a, const void *b)
if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) ) if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) )
return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */ return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */
if (! bfd_get_section_contents ((*ra)->input_section.ifile->the_bfd, if (! bfd_get_section_contents ((*ra)->input_section.section->owner,
(*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec))) (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec)))
einfo ("%F%B: Can't read contents of section .idata: %E\n", einfo ("%F%B: Can't read contents of section .idata: %E\n",
(*ra)->input_section.ifile->the_bfd); (*ra)->input_section.section->owner);
if (! bfd_get_section_contents ((*rb)->input_section.ifile->the_bfd, if (! bfd_get_section_contents ((*rb)->input_section.section->owner,
(*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) )) (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) ))
einfo ("%F%B: Can't read contents of section .idata: %E\n", einfo ("%F%B: Can't read contents of section .idata: %E\n",
(*rb)->input_section.ifile->the_bfd); (*rb)->input_section.section->owner);
i = ((a_sec < b_sec) ? -1 : 0); i = ((a_sec < b_sec) ? -1 : 0);
if ( i != 0) if ( i != 0)
@ -547,7 +547,7 @@ sort_sections (lang_statement_union_type *s)
{ {
lang_statement_union_type *start = *p; lang_statement_union_type *start = *p;
if (start->header.type != lang_input_section_enum if (start->header.type != lang_input_section_enum
|| !start->input_section.ifile->the_bfd->my_archive) || !start->input_section.section->owner->my_archive)
p = &(start->header.next); p = &(start->header.next);
else else
{ {
@ -662,7 +662,7 @@ gld_${EMULATION_NAME}_before_allocation (void)
which are not mentioned in the linker script. */ which are not mentioned in the linker script. */
static bfd_boolean static bfd_boolean
gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) gld${EMULATION_NAME}_place_orphan (asection *s)
{ {
const char *secname; const char *secname;
char *output_secname, *ps; char *output_secname, *ps;
@ -722,7 +722,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
The sections still have to be sorted, but that has to wait until The sections still have to be sorted, but that has to wait until
all such sections have been processed by us. The sorting is done by all such sections have been processed by us. The sorting is done by
sort_sections. */ sort_sections. */
lang_add_section (&l->wild_statement.children, s, os, file); lang_add_section (&l->wild_statement.children, s, os);
return TRUE; return TRUE;
} }

View file

@ -59,8 +59,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
static void gld${EMULATION_NAME}_before_parse (void); static void gld${EMULATION_NAME}_before_parse (void);
static void gld${EMULATION_NAME}_after_open (void); static void gld${EMULATION_NAME}_after_open (void);
static void gld${EMULATION_NAME}_before_allocation (void); static void gld${EMULATION_NAME}_before_allocation (void);
static bfd_boolean gld${EMULATION_NAME}_place_orphan static bfd_boolean gld${EMULATION_NAME}_place_orphan (asection *s);
(lang_input_statement_type *file, asection *s);
static void gld${EMULATION_NAME}_layout_sections_again (void); static void gld${EMULATION_NAME}_layout_sections_again (void);
static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED; static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED;
@ -1283,7 +1282,7 @@ output_rel_find (asection *sec, int isdyn)
sections in the right segment. */ sections in the right segment. */
static bfd_boolean static bfd_boolean
gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) gld${EMULATION_NAME}_place_orphan (asection *s)
{ {
static struct orphan_save hold[] = static struct orphan_save hold[] =
{ {
@ -1374,7 +1373,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
If the section already exists but does not have any flags If the section already exists but does not have any flags
set, then it has been created by the linker, probably as a set, then it has been created by the linker, probably as a
result of a --section-start command line switch. */ result of a --section-start command line switch. */
lang_add_section (&os->children, s, os, file); lang_add_section (&os->children, s, os);
return TRUE; return TRUE;
} }
} }
@ -1400,7 +1399,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
&& hold[orphan_text].os != NULL) && hold[orphan_text].os != NULL)
{ {
lang_add_section (&hold[orphan_text].os->children, s, lang_add_section (&hold[orphan_text].os->children, s,
hold[orphan_text].os, file); hold[orphan_text].os);
return TRUE; return TRUE;
} }
@ -1461,7 +1460,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
einfo ("%F%P: place_orphan failed: %E\n"); einfo ("%F%P: place_orphan failed: %E\n");
} }
lang_insert_orphan (file, s, secname, after, place, NULL, NULL); lang_insert_orphan (s, secname, after, place, NULL, NULL);
return TRUE; return TRUE;
} }

View file

@ -198,7 +198,7 @@ hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section)
info.input_section = input_section; info.input_section = input_section;
lang_list_init (&info.add); lang_list_init (&info.add);
lang_add_section (&info.add, stub_sec, os, stub_file); lang_add_section (&info.add, stub_sec, os);
if (info.add.head == NULL) if (info.add.head == NULL)
goto err_ret; goto err_ret;
@ -229,14 +229,17 @@ hppaelf_layout_sections_again (void)
static void static void
build_section_lists (lang_statement_union_type *statement) build_section_lists (lang_statement_union_type *statement)
{ {
if (statement->header.type == lang_input_section_enum if (statement->header.type == lang_input_section_enum)
&& !statement->input_section.ifile->just_syms_flag
&& (statement->input_section.section->flags & SEC_EXCLUDE) == 0
&& statement->input_section.section->output_section != NULL
&& statement->input_section.section->output_section->owner == output_bfd)
{ {
elf32_hppa_next_input_section (&link_info, asection *i = statement->input_section.section;
statement->input_section.section);
if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == output_bfd)
{
elf32_hppa_next_input_section (&link_info, i);
}
} }
} }

View file

@ -272,7 +272,7 @@ m68hc11elf_add_stub_section (const char *stub_sec_name,
at the correct place. */ at the correct place. */
info.input_section = tramp_section; info.input_section = tramp_section;
lang_list_init (&info.add); lang_list_init (&info.add);
lang_add_section (&info.add, stub_sec, os, stub_file); lang_add_section (&info.add, stub_sec, os);
if (info.add.head == NULL) if (info.add.head == NULL)
goto err_ret; goto err_ret;

View file

@ -37,7 +37,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
from elf32.em. */ from elf32.em. */
static bfd_boolean static bfd_boolean
mmo_place_orphan (lang_input_statement_type *file, asection *s) mmo_place_orphan (asection *s)
{ {
static struct orphan_save hold_text = static struct orphan_save hold_text =
{ {
@ -63,7 +63,7 @@ mmo_place_orphan (lang_input_statement_type *file, asection *s)
(regardless of whether the linker script lists it as input). */ (regardless of whether the linker script lists it as input). */
if (os != NULL) if (os != NULL)
{ {
lang_add_section (&os->children, s, os, file); lang_add_section (&os->children, s, os);
return TRUE; return TRUE;
} }
@ -83,7 +83,7 @@ mmo_place_orphan (lang_input_statement_type *file, asection *s)
/* If there's an output section by this name, we'll use it, regardless /* If there's an output section by this name, we'll use it, regardless
of section flags, in contrast to what's done in elf32.em. */ of section flags, in contrast to what's done in elf32.em. */
os = lang_insert_orphan (file, s, secname, after, place, NULL, NULL); os = lang_insert_orphan (s, secname, after, place, NULL, NULL);
/* We need an output section for .text as a root, so if there was none /* We need an output section for .text as a root, so if there was none
(might happen with a peculiar linker script such as in "map (might happen with a peculiar linker script such as in "map

View file

@ -1518,7 +1518,7 @@ gld_${EMULATION_NAME}_finish (void)
sort_sections. */ sort_sections. */
static bfd_boolean static bfd_boolean
gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) gld_${EMULATION_NAME}_place_orphan (asection *s)
{ {
const char *secname; const char *secname;
const char *orig_secname; const char *orig_secname;
@ -1555,7 +1555,7 @@ gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s
If the section already exists but does not have any flags set, If the section already exists but does not have any flags set,
then it has been created by the linker, probably as a result of then it has been created by the linker, probably as a result of
a --section-start command line switch. */ a --section-start command line switch. */
lang_add_section (&add_child, s, os, file); lang_add_section (&add_child, s, os);
} }
else else
{ {
@ -1641,8 +1641,7 @@ gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s
/* All sections in an executable must be aligned to a page boundary. */ /* All sections in an executable must be aligned to a page boundary. */
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__")); address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (file, s, secname, after, place, address, os = lang_insert_orphan (s, secname, after, place, address, &add_child);
&add_child);
} }
{ {
@ -1665,7 +1664,7 @@ gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s
ls = &(*pl)->input_section; ls = &(*pl)->input_section;
lname = bfd_get_section_name (ls->ifile->the_bfd, ls->section); lname = bfd_get_section_name (ls->section->owner, ls->section);
if (strchr (lname, '$') == NULL) if (strchr (lname, '$') == NULL)
{ {
if (found_dollar) if (found_dollar)

View file

@ -235,7 +235,7 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section)
info.input_section = input_section; info.input_section = input_section;
lang_list_init (&info.add); lang_list_init (&info.add);
lang_add_section (&info.add, stub_sec, os, stub_file); lang_add_section (&info.add, stub_sec, os);
if (info.add.head == NULL) if (info.add.head == NULL)
goto err_ret; goto err_ret;
@ -277,26 +277,33 @@ gld${EMULATION_NAME}_after_allocation (void)
static void static void
build_toc_list (lang_statement_union_type *statement) build_toc_list (lang_statement_union_type *statement)
{ {
if (statement->header.type == lang_input_section_enum if (statement->header.type == lang_input_section_enum)
&& !statement->input_section.ifile->just_syms_flag {
&& (statement->input_section.section->flags & SEC_EXCLUDE) == 0 asection *i = statement->input_section.section;
&& statement->input_section.section->output_section == toc_section)
ppc64_elf_next_toc_section (&link_info, statement->input_section.section); if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section == toc_section)
ppc64_elf_next_toc_section (&link_info, i);
}
} }
static void static void
build_section_lists (lang_statement_union_type *statement) build_section_lists (lang_statement_union_type *statement)
{ {
if (statement->header.type == lang_input_section_enum if (statement->header.type == lang_input_section_enum)
&& !statement->input_section.ifile->just_syms_flag
&& (statement->input_section.section->flags & SEC_EXCLUDE) == 0
&& statement->input_section.section->output_section != NULL
&& statement->input_section.section->output_section->owner == output_bfd)
{ {
if (!ppc64_elf_next_input_section (&link_info, asection *i = statement->input_section.section;
statement->input_section.section))
einfo ("%X%P: can not size stub section: %E\n"); if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == output_bfd)
{
if (!ppc64_elf_next_input_section (&link_info, i))
einfo ("%X%P: can not size stub section: %E\n");
}
} }
} }

View file

@ -59,13 +59,13 @@ elf_xtensa_choose_target (int argc ATTRIBUTE_UNUSED,
static bfd_boolean static bfd_boolean
elf_xtensa_place_orphan (lang_input_statement_type *file, asection *s) elf_xtensa_place_orphan (asection *s)
{ {
/* Early exit for relocatable links. */ /* Early exit for relocatable links. */
if (link_info.relocatable) if (link_info.relocatable)
return FALSE; return FALSE;
return gld${EMULATION_NAME}_place_orphan (file, s); return gld${EMULATION_NAME}_place_orphan (s);
} }
@ -1137,7 +1137,7 @@ ld_build_required_section_dependence (lang_statement_union_type *s)
{ {
lang_input_section_type *input; lang_input_section_type *input;
input = &l->input_section; input = &l->input_section;
xtensa_callback_required_dependence (input->ifile->the_bfd, xtensa_callback_required_dependence (input->section->owner,
input->section, input->section,
&link_info, &link_info,
/* Use the same closure. */ /* Use the same closure. */

View file

@ -121,10 +121,10 @@ ldemul_open_dynamic_archive (const char *arch, search_dirs_type *search,
} }
bfd_boolean bfd_boolean
ldemul_place_orphan (lang_input_statement_type *file, asection *s) ldemul_place_orphan (asection *s)
{ {
if (ld_emulation->place_orphan) if (ld_emulation->place_orphan)
return (*ld_emulation->place_orphan) (file, s); return (*ld_emulation->place_orphan) (s);
return FALSE; return FALSE;
} }

View file

@ -54,7 +54,7 @@ extern void ldemul_set_symbols
extern void ldemul_create_output_section_statements extern void ldemul_create_output_section_statements
(void); (void);
extern bfd_boolean ldemul_place_orphan extern bfd_boolean ldemul_place_orphan
(struct lang_input_statement_struct *, asection *); (asection *);
extern bfd_boolean ldemul_parse_args extern bfd_boolean ldemul_parse_args
(int, char **); (int, char **);
extern void ldemul_add_options extern void ldemul_add_options
@ -147,7 +147,7 @@ typedef struct ld_emulation_xfer_struct {
the default action should be taken. This field may be NULL, in the default action should be taken. This field may be NULL, in
which case the default action will always be taken. */ which case the default action will always be taken. */
bfd_boolean (*place_orphan) bfd_boolean (*place_orphan)
(struct lang_input_statement_struct *, asection *); (asection *);
/* Run after assigning parsing with the args, but before /* Run after assigning parsing with the args, but before
reading the script. Used to initialize symbols used in the script. */ reading the script. Used to initialize symbols used in the script. */

View file

@ -1313,8 +1313,7 @@ output_prev_sec_find (lang_output_section_statement_type *os)
} }
lang_output_section_statement_type * lang_output_section_statement_type *
lang_insert_orphan (lang_input_statement_type *file, lang_insert_orphan (asection *s,
asection *s,
const char *secname, const char *secname,
lang_output_section_statement_type *after, lang_output_section_statement_type *after,
struct orphan_save *place, struct orphan_save *place,
@ -1385,7 +1384,7 @@ lang_insert_orphan (lang_input_statement_type *file,
if (add_child == NULL) if (add_child == NULL)
add_child = &os->children; add_child = &os->children;
lang_add_section (add_child, s, os, file); lang_add_section (add_child, s, os);
lang_leave_output_section_statement (0, "*default*", NULL, NULL); lang_leave_output_section_statement (0, "*default*", NULL, NULL);
@ -1811,8 +1810,7 @@ section_already_linked (bfd *abfd, asection *sec, void *data)
void void
lang_add_section (lang_statement_list_type *ptr, lang_add_section (lang_statement_list_type *ptr,
asection *section, asection *section,
lang_output_section_statement_type *output, lang_output_section_statement_type *output)
lang_input_statement_type *file)
{ {
flagword flags = section->flags; flagword flags = section->flags;
bfd_boolean discard; bfd_boolean discard;
@ -1870,7 +1868,6 @@ lang_add_section (lang_statement_list_type *ptr,
new = new_stat (lang_input_section, ptr); new = new_stat (lang_input_section, ptr);
new->section = section; new->section = section;
new->ifile = file;
section->output_section = output->bfd_section; section->output_section = output->bfd_section;
flags = section->flags; flags = section->flags;
@ -2046,15 +2043,14 @@ wild_sort (lang_wild_statement_type *wild,
fa = FALSE; fa = FALSE;
} }
if (ls->ifile->the_bfd != NULL if (bfd_my_archive (ls->section->owner) != NULL)
&& bfd_my_archive (ls->ifile->the_bfd) != NULL)
{ {
ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd)); ln = bfd_get_filename (bfd_my_archive (ls->section->owner));
la = TRUE; la = TRUE;
} }
else else
{ {
ln = ls->ifile->filename; ln = ls->section->owner->filename;
la = FALSE; la = FALSE;
} }
@ -2069,7 +2065,7 @@ wild_sort (lang_wild_statement_type *wild,
if (fa) if (fa)
fn = file->filename; fn = file->filename;
if (la) if (la)
ln = ls->ifile->filename; ln = ls->section->owner->filename;
i = strcmp (fn, ln); i = strcmp (fn, ln);
if (i > 0) if (i > 0)
@ -2115,8 +2111,7 @@ output_section_callback (lang_wild_statement_type *ptr,
if (before == NULL) if (before == NULL)
lang_add_section (&ptr->children, section, lang_add_section (&ptr->children, section,
(lang_output_section_statement_type *) output, (lang_output_section_statement_type *) output);
file);
else else
{ {
lang_statement_list_type list; lang_statement_list_type list;
@ -2124,8 +2119,7 @@ output_section_callback (lang_wild_statement_type *ptr,
lang_list_init (&list); lang_list_init (&list);
lang_add_section (&list, section, lang_add_section (&list, section,
(lang_output_section_statement_type *) output, (lang_output_section_statement_type *) output);
file);
/* If we are discarding the section, LIST.HEAD will /* If we are discarding the section, LIST.HEAD will
be NULL. */ be NULL. */
@ -3903,7 +3897,8 @@ size_input_section
lang_input_section_type *is = &((*this_ptr)->input_section); lang_input_section_type *is = &((*this_ptr)->input_section);
asection *i = is->section; asection *i = is->section;
if (!is->ifile->just_syms_flag && (i->flags & SEC_EXCLUDE) == 0) if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0)
{ {
unsigned int alignment_needed; unsigned int alignment_needed;
asection *o; asection *o;
@ -5061,17 +5056,17 @@ lang_place_orphans (void)
} }
lang_add_section (&default_common_section->children, s, lang_add_section (&default_common_section->children, s,
default_common_section, file); default_common_section);
} }
} }
else if (ldemul_place_orphan (file, s)) else if (ldemul_place_orphan (s))
; ;
else else
{ {
lang_output_section_statement_type *os; lang_output_section_statement_type *os;
os = lang_output_section_statement_lookup (s->name); os = lang_output_section_statement_lookup (s->name);
lang_add_section (&os->children, s, os, file); lang_add_section (&os->children, s, os);
} }
} }
} }

View file

@ -285,8 +285,6 @@ typedef struct
{ {
lang_statement_header_type header; lang_statement_header_type header;
asection *section; asection *section;
lang_input_statement_type *ifile;
} lang_input_section_type; } lang_input_section_type;
typedef struct typedef struct
@ -525,9 +523,8 @@ extern lang_output_section_statement_type *lang_output_section_find
extern lang_output_section_statement_type *lang_output_section_find_by_flags extern lang_output_section_statement_type *lang_output_section_find_by_flags
(const asection *, lang_output_section_statement_type **exact); (const asection *, lang_output_section_statement_type **exact);
extern lang_output_section_statement_type *lang_insert_orphan extern lang_output_section_statement_type *lang_insert_orphan
(lang_input_statement_type *, asection *, const char *, (asection *, const char *, lang_output_section_statement_type *,
lang_output_section_statement_type *, struct orphan_save *, struct orphan_save *, etree_type *, lang_statement_list_type *);
etree_type *, lang_statement_list_type *);
extern lang_input_statement_type *lang_add_input_file extern lang_input_statement_type *lang_add_input_file
(const char *, lang_input_file_enum_type, const char *); (const char *, lang_input_file_enum_type, const char *);
extern void lang_add_keepsyms_file extern void lang_add_keepsyms_file
@ -564,7 +561,7 @@ extern void lang_leave_group
(void); (void);
extern void lang_add_section extern void lang_add_section
(lang_statement_list_type *, asection *, (lang_statement_list_type *, asection *,
lang_output_section_statement_type *, lang_input_statement_type *); lang_output_section_statement_type *);
extern void lang_new_phdr extern void lang_new_phdr
(const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *, (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
etree_type *); etree_type *);

View file

@ -218,43 +218,46 @@ build_link_order (lang_statement_union_type *statement)
break; break;
case lang_input_section_enum: case lang_input_section_enum:
/* Create a new link_order in the output section with this {
attached */ /* Create a new link_order in the output section with this
if (!statement->input_section.ifile->just_syms_flag attached */
&& (statement->input_section.section->flags & SEC_EXCLUDE) == 0) asection *i = statement->input_section.section;
{
asection *i = statement->input_section.section;
asection *output_section = i->output_section;
ASSERT (output_section->owner == output_bfd); if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0)
{
asection *output_section = i->output_section;
if ((output_section->flags & SEC_HAS_CONTENTS) != 0 ASSERT (output_section->owner == output_bfd);
|| ((output_section->flags & SEC_LOAD) != 0
&& (output_section->flags & SEC_THREAD_LOCAL)))
{
struct bfd_link_order *link_order;
link_order = bfd_new_link_order (output_bfd, output_section); if ((output_section->flags & SEC_HAS_CONTENTS) != 0
|| ((output_section->flags & SEC_LOAD) != 0
&& (output_section->flags & SEC_THREAD_LOCAL)))
{
struct bfd_link_order *link_order;
if (i->flags & SEC_NEVER_LOAD) link_order = bfd_new_link_order (output_bfd, output_section);
{
/* We've got a never load section inside one which if (i->flags & SEC_NEVER_LOAD)
is going to be output, we'll change it into a {
fill. */ /* We've got a never load section inside one which
link_order->type = bfd_data_link_order; is going to be output, we'll change it into a
link_order->u.data.contents = (unsigned char *) ""; fill. */
link_order->u.data.size = 1; link_order->type = bfd_data_link_order;
} link_order->u.data.contents = (unsigned char *) "";
else link_order->u.data.size = 1;
{ }
link_order->type = bfd_indirect_link_order; else
link_order->u.indirect.section = i; {
ASSERT (i->output_section == output_section); link_order->type = bfd_indirect_link_order;
} link_order->u.indirect.section = i;
link_order->size = i->size; ASSERT (i->output_section == output_section);
link_order->offset = i->output_offset; }
} link_order->size = i->size;
} link_order->offset = i->output_offset;
}
}
}
break; break;
case lang_padding_statement_enum: case lang_padding_statement_enum: