aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2010-09-22 14:20:24 +0000
committerKai Tietz <kai.tietz@onevision.com>2010-09-22 14:20:24 +0000
commite4b0fe2fa7c4fae156f5d0bc3e14fcc9c397614f (patch)
tree2ef39e52fb0583f4b4a03f00f715e540e36ebf62 /ld
parent72e4db75e816964c7533b8522a59ec05b7439691 (diff)
downloadfsf-binutils-gdb-e4b0fe2fa7c4fae156f5d0bc3e14fcc9c397614f.zip
fsf-binutils-gdb-e4b0fe2fa7c4fae156f5d0bc3e14fcc9c397614f.tar.gz
fsf-binutils-gdb-e4b0fe2fa7c4fae156f5d0bc3e14fcc9c397614f.tar.bz2
2010-09-22 Kai Tietz <kai.tietz@onevision.com>
* ldlang.c (lang_add_section): Allow for debugging section to be marked as noload but to keep content. (IGNORE_SECTION): Likewise. (lang_check_section_addresses): Likewise. * ldwrite.c (build_link_order): Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c17
-rw-r--r--ld/ldwrite.c3
3 files changed, 22 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c7169e0..0f4fa43 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
2010-09-22 Kai Tietz <kai.tietz@onevision.com>
+ * ldlang.c (lang_add_section): Allow for debugging
+ section to be marked as noload but to keep content.
+ (IGNORE_SECTION): Likewise.
+ (lang_check_section_addresses): Likewise.
+ * ldwrite.c (build_link_order): Likewise.
+
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Add
idata to orphan set.
* emultempl/pep.em: Likewise.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 75fa25c..1c38618 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2245,7 +2245,15 @@ lang_add_section (lang_statement_list_type *ptr,
case noload_section:
flags &= ~SEC_LOAD;
flags |= SEC_NEVER_LOAD;
- if ((flags & SEC_COFF_SHARED_LIBRARY) == 0)
+ if (((bfd_get_flavour (section->owner)
+ == bfd_target_ecoff_flavour)
+ || (bfd_get_flavour (section->owner)
+ == bfd_target_coff_flavour)))
+ {
+ if ((flags & (SEC_COFF_SHARED_LIBRARY | SEC_DEBUGGING)) == 0)
+ flags &= ~SEC_HAS_CONTENTS;
+ }
+ else
flags &= ~SEC_HAS_CONTENTS;
break;
}
@@ -4555,8 +4563,11 @@ sort_sections_by_lma (const void *arg1, const void *arg2)
return 0;
}
+/* On ELF, a debugging section must never set SEC_NEVER_LOAD, as no output
+ would be written for it. So the combination of debugging and never-load
+ is something which can only happen for pe-coff and must not be ignored. */
#define IGNORE_SECTION(s) \
- ((s->flags & SEC_NEVER_LOAD) != 0 \
+ ((s->flags & (SEC_NEVER_LOAD | SEC_DEBUGGING)) == SEC_NEVER_LOAD \
|| (s->flags & SEC_ALLOC) == 0 \
|| ((s->flags & SEC_THREAD_LOCAL) != 0 \
&& (s->flags & SEC_LOAD) == 0))
@@ -4590,7 +4601,7 @@ lang_check_section_addresses (void)
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
{
/* Only consider loadable sections with real contents. */
- if ((s->flags & SEC_NEVER_LOAD)
+ if ((s->flags & (SEC_NEVER_LOAD | SEC_DEBUGGING)) == SEC_NEVER_LOAD
|| !(s->flags & SEC_LOAD)
|| !(s->flags & SEC_ALLOC)
|| s->size == 0)
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index 6b8423b..d0616fc 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -245,7 +245,8 @@ build_link_order (lang_statement_union_type *statement)
link_order = bfd_new_link_order (link_info.output_bfd,
output_section);
- if (i->flags & SEC_NEVER_LOAD)
+ if ((i->flags & SEC_NEVER_LOAD) != 0
+ && (i->flags & SEC_DEBUGGING) == 0)
{
/* We've got a never load section inside one which
is going to be output, we'll change it into a