aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
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/ldlang.c
parent81bb3443544bff4a3cc386acc5d4f1a6339967da (diff)
downloadbinutils-57ceae9483c03910f7ee7ac66f3cb118c9d7d657.zip
binutils-57ceae9483c03910f7ee7ac66f3cb118c9d7d657.tar.gz
binutils-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/ldlang.c')
-rw-r--r--ld/ldlang.c96
1 files changed, 53 insertions, 43 deletions
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)
{