aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2004-05-25 06:33:51 +0000
committerAlan Modra <amodra@gmail.com>2004-05-25 06:33:51 +0000
commit57ceae9483c03910f7ee7ac66f3cb118c9d7d657 (patch)
treea5653edf9e28f48685a159531cb5d8dc82fedda5 /ld
parent81bb3443544bff4a3cc386acc5d4f1a6339967da (diff)
downloadgdb-57ceae9483c03910f7ee7ac66f3cb118c9d7d657.zip
gdb-57ceae9483c03910f7ee7ac66f3cb118c9d7d657.tar.gz
gdb-57ceae9483c03910f7ee7ac66f3cb118c9d7d657.tar.bz2
bfd/
* elflink.c (elf_link_add_object_symbols): Don't set up merge section data here.. * elf.c (_bfd_elf_merge_sections): .. Do it here instead. * merge.c: Formatting. Remove unnecessary casts. Expand bfd_get_section_alignment macro. (struct sec_merge_sec_info): Rename "first" to "first_str". Update use throughout file. (_bfd_add_merge_section): Rename from _bfd_merge_section. Update comment. Abort on dynamic or non-SEC_MERGE input. Don't test section name to determine sinfo group, instead test output section and alignment. (_bfd_merge_sections): Add struct bfd_link_info param. Call _bfd_strip_section_from_output rather than just twiddling flags. * libbfd-in.h (_bfd_add_merge_section): Rename, update comment. (_bfd_merge_sections): Update prototype. * libbfd.h: Regenerate. ld/ * ldlang.c (lang_process): Call bfd_merge_sections later, and only when not a relocatable link. (print_input_section): Handle SEC_EXCLUDE sections. (size_input_section): Don't update dot on SEC_EXCLUDE sections. (lang_do_assignments_1): Likewise. * ldwrite.c (build_link_order): Ignore SEC_EXCLUDE input sections. * emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise. * emultempl/hppaelf.em (build_section_lists): Likewise. * emultempl/ppc64elf.em (build_toc_list): Likewise. (build_section_lists): Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/emultempl/armelf.em3
-rw-r--r--ld/emultempl/hppaelf.em1
-rw-r--r--ld/emultempl/ppc64elf.em2
-rw-r--r--ld/ldlang.c96
-rw-r--r--ld/ldwrite.c3
6 files changed, 73 insertions, 45 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 266d89a..d923216 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2004-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * ldlang.c (lang_process): Call bfd_merge_sections later, and
+ only when not a relocatable link.
+ (print_input_section): Handle SEC_EXCLUDE sections.
+ (size_input_section): Don't update dot on SEC_EXCLUDE sections.
+ (lang_do_assignments_1): Likewise.
+ * ldwrite.c (build_link_order): Ignore SEC_EXCLUDE input sections.
+ * emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise.
+ * emultempl/hppaelf.em (build_section_lists): Likewise.
+ * emultempl/ppc64elf.em (build_toc_list): Likewise.
+ (build_section_lists): Likewise.
+
2004-05-23 Andreas Schwab <schwab@suse.de>
* ld.texinfo (Options): Fix typo in last change.
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index beeb40c..5505f12 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -67,7 +67,8 @@ static void
arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement)
{
if (statement->header.type == lang_input_section_enum
- && !statement->input_section.ifile->just_syms_flag)
+ && !statement->input_section.ifile->just_syms_flag
+ && (statement->input_section.section->flags & SEC_EXCLUDE) == 0)
{
asection *i = statement->input_section.section;
asection *output_section = i->output_section;
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 93e88ad..edd8e01 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -239,6 +239,7 @@ build_section_lists (lang_statement_union_type *statement)
{
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)
{
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 4f408a9..6a60f0c 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -288,6 +288,7 @@ build_toc_list (lang_statement_union_type *statement)
{
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 == toc_section)
ppc64_elf_next_toc_section (&link_info, statement->input_section.section);
}
@@ -298,6 +299,7 @@ build_section_lists (lang_statement_union_type *statement)
{
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)
{
diff --git a/ld/ldlang.c b/ld/ldlang.c
index a19b46a..7a268c0 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2472,54 +2472,59 @@ print_input_section (lang_input_section_type *in)
init_opb ();
if (size != 0)
{
- print_space ();
+ int len;
+ bfd_vma addr;
+ print_space ();
minfo ("%s", i->name);
- if (i->output_section != NULL)
+ len = 1 + strlen (i->name);
+ if (len >= SECTION_NAME_MAP_LENGTH - 1)
+ {
+ print_nl ();
+ len = 0;
+ }
+ while (len < SECTION_NAME_MAP_LENGTH)
{
- int len;
+ print_space ();
+ ++len;
+ }
- len = 1 + strlen (i->name);
- if (len >= SECTION_NAME_MAP_LENGTH - 1)
- {
- print_nl ();
- len = 0;
- }
- while (len < SECTION_NAME_MAP_LENGTH)
- {
- print_space ();
- ++len;
- }
+ if (i->output_section != NULL && (i->flags & SEC_EXCLUDE) == 0)
+ addr = i->output_section->vma + i->output_offset;
+ else
+ {
+ addr = print_dot;
+ size = 0;
+ }
- minfo ("0x%V %W %B\n",
- i->output_section->vma + i->output_offset, TO_ADDR (size),
- i->owner);
+ minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner);
- if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
- {
- len = SECTION_NAME_MAP_LENGTH + 3;
+ if (size != i->_raw_size)
+ {
+ len = SECTION_NAME_MAP_LENGTH + 3;
#ifdef BFD64
- len += 16;
+ len += 16;
#else
- len += 8;
+ len += 8;
#endif
- while (len > 0)
- {
- print_space ();
- --len;
- }
-
- minfo (_("%W (size before relaxing)\n"), i->_raw_size);
+ while (len > 0)
+ {
+ print_space ();
+ --len;
}
+ minfo (_("%W (size before relaxing)\n"), i->_raw_size);
+ }
+
+ if (i->output_section != NULL && (i->flags & SEC_EXCLUDE) == 0)
+ {
if (command_line.reduce_memory_overheads)
bfd_link_hash_traverse (link_info.hash, print_one_symbol, i);
else
print_all_symbols (i);
- print_dot = (i->output_section->vma + i->output_offset
- + TO_ADDR (size));
+ print_dot = addr + TO_ADDR (size);
}
}
}
@@ -2892,7 +2897,7 @@ size_input_section (lang_statement_union_type **this_ptr,
lang_input_section_type *is = &((*this_ptr)->input_section);
asection *i = is->section;
- if (!is->ifile->just_syms_flag)
+ if (!is->ifile->just_syms_flag && (i->flags & SEC_EXCLUDE) == 0)
{
unsigned int alignment_needed;
asection *o;
@@ -3622,10 +3627,13 @@ lang_do_assignments_1
{
asection *in = s->input_section.section;
- if (in->_cooked_size != 0)
- dot += TO_ADDR (in->_cooked_size);
- else
- dot += TO_ADDR (in->_raw_size);
+ if ((in->flags & SEC_EXCLUDE) == 0)
+ {
+ if (in->_cooked_size != 0)
+ dot += TO_ADDR (in->_cooked_size);
+ else
+ dot += TO_ADDR (in->_raw_size);
+ }
}
break;
@@ -4384,12 +4392,6 @@ lang_process (void)
if (command_line.gc_sections)
lang_gc_sections ();
- /* If there were any SEC_MERGE sections, finish their merging, so that
- section sizes can be computed. This has to be done after GC of sections,
- so that GCed sections are not merged, but before assigning output
- sections, since removing whole input sections is hard then. */
- bfd_merge_sections (output_bfd, &link_info);
-
/* Size up the common data. */
lang_common ();
@@ -4402,8 +4404,16 @@ lang_process (void)
if (! link_info.relocatable)
{
+ asection *found;
+
+ /* Merge SEC_MERGE sections. This has to be done after GC of
+ sections, so that GCed sections are not merged, but before
+ assigning dynamic symbols, since removing whole input sections
+ is hard then. */
+ bfd_merge_sections (output_bfd, &link_info);
+
/* Look for a text section and set the readonly attribute in it. */
- asection *found = bfd_get_section_by_name (output_bfd, ".text");
+ found = bfd_get_section_by_name (output_bfd, ".text");
if (found != NULL)
{
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index e4bec32..47a5806 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -220,7 +220,8 @@ build_link_order (lang_statement_union_type *statement)
case lang_input_section_enum:
/* Create a new link_order in the output section with this
attached */
- if (!statement->input_section.ifile->just_syms_flag)
+ if (!statement->input_section.ifile->just_syms_flag
+ && (statement->input_section.section->flags & SEC_EXCLUDE) == 0)
{
asection *i = statement->input_section.section;
asection *output_section = i->output_section;