aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-11-23 14:13:07 +0000
committerNick Clifton <nickc@redhat.com>1999-11-23 14:13:07 +0000
commit33275c22c0eebec8e2658eead8e6dda4fee33a50 (patch)
tree41999a82e746f19b7dfa494e895241212922a4df /ld
parent96ac8957e866a93b5d5df066f480a436a916e68b (diff)
downloadgdb-33275c22c0eebec8e2658eead8e6dda4fee33a50.zip
gdb-33275c22c0eebec8e2658eead8e6dda4fee33a50.tar.gz
gdb-33275c22c0eebec8e2658eead8e6dda4fee33a50.tar.bz2
Do not check sections without a LOAD attribute for overlap
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c85
2 files changed, 50 insertions, 41 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3bc5a89..8a723c9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+1999-11-22 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_check_section_addresses): Fix test to determine
+ if a section should be tested.
+ (IGNORE_SECTION): New macro.
+
Wed Nov 3 23:31:19 1999 Jeffrey A Law (law@cygnus.com)
* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 33dc573..ad890d1 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2608,6 +2608,10 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
return dot;
}
+#define IGNORE_SECTION(bfd, s) \
+ (((bfd_get_section_flags (bfd, s) & (SEC_ALLOC | SEC_LOAD)) == 0) \
+ || bfd_section_size (bfd, s) == 0)
+
/* Check to see if any allocated sections overlap with other allocated
sections. This can happen when the linker script specifically specifies
the output section addresses of the two sections. */
@@ -2618,49 +2622,48 @@ lang_check_section_addresses ()
/* Scan all sections in the output list. */
for (s = output_bfd->sections; s != NULL; s = s->next)
- /* Ignore sections which are not loaded or which have no contents. */
- if ((bfd_get_section_flags (output_bfd, s) & (SEC_ALLOC | SEC_LOAD))
- && bfd_section_size (output_bfd, s) != 0)
- {
- asection * os;
+ {
+ asection * os;
+
+ /* Ignore sections which are not loaded or which have no contents. */
+ if (IGNORE_SECTION (output_bfd, s))
+ continue;
+
+ /* Once we reach section 's' stop our seach. This prevents two
+ warning messages from being produced, one for 'section A overlaps
+ section B' and one for 'section B overlaps section A'. */
+ for (os = output_bfd->sections; os != s; os = os->next)
+ {
+ bfd_vma s_start;
+ bfd_vma s_end;
+ bfd_vma os_start;
+ bfd_vma os_end;
+
+ /* Only consider loadable sections with real contents. */
+ if (IGNORE_SECTION (output_bfd, os))
+ continue;
- /* Once we reach section 's' stop our seach. This prevents two
- warning messages from being produced, one for 'section A overlaps
- section B' and one for 'section B overlaps section A'. */
- for (os = output_bfd->sections; os != s; os = os->next)
- {
- bfd_vma s_start;
- bfd_vma s_end;
- bfd_vma os_start;
- bfd_vma os_end;
-
- /* Only consider loadable sections with real contents. */
- if (((bfd_get_section_flags (output_bfd, os)
- & (SEC_ALLOC | SEC_LOAD)) == 0)
- || bfd_section_size (output_bfd, os) == 0)
- continue;
-
- /* We must check the sections' LMA addresses not their
- VMA addresses because overlay sections can have
- overlapping VMAs but they must have distinct LMAs. */
- s_start = bfd_section_lma (output_bfd, s);
- os_start = bfd_section_lma (output_bfd, os);
- s_end = s_start + bfd_section_size (output_bfd, s) - 1;
- os_end = os_start + bfd_section_size (output_bfd, os) - 1;
-
- /* Look for an overlap. */
- if ((s_end < os_start) || (s_start > os_end))
- continue;
-
- einfo (
+ /* We must check the sections' LMA addresses not their
+ VMA addresses because overlay sections can have
+ overlapping VMAs but they must have distinct LMAs. */
+ s_start = bfd_section_lma (output_bfd, s);
+ os_start = bfd_section_lma (output_bfd, os);
+ s_end = s_start + bfd_section_size (output_bfd, s) - 1;
+ os_end = os_start + bfd_section_size (output_bfd, os) - 1;
+
+ /* Look for an overlap. */
+ if ((s_end < os_start) || (s_start > os_end))
+ continue;
+
+ einfo (
_("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
- s->name, s_start, s_end, os->name, os_start, os_end);
-
- /* Once we have found one overlap for this section,
- stop looking for others. */
- break;
- }
- }
+ s->name, s_start, s_end, os->name, os_start, os_end);
+
+ /* Once we have found one overlap for this section,
+ stop looking for others. */
+ break;
+ }
+ }
}
/* This variable indicates whether bfd_relax_section should be called