aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-04-14 01:58:29 +0000
committerAlan Modra <amodra@gmail.com>2000-04-14 01:58:29 +0000
commit01cc8ff856f0530ce7333a7bdac283c51b0e4f5e (patch)
tree5c7ff64ebfc68b057933fd51bdc46028bbacb3b1
parent4ab10e93d6f65abac0857f26c8b1431cc5f7f5f9 (diff)
downloadfsf-binutils-gdb-01cc8ff856f0530ce7333a7bdac283c51b0e4f5e.zip
fsf-binutils-gdb-01cc8ff856f0530ce7333a7bdac283c51b0e4f5e.tar.gz
fsf-binutils-gdb-01cc8ff856f0530ce7333a7bdac283c51b0e4f5e.tar.bz2
Zero start address of orphan ~(SEC_LOAD | SEC_ALLOC) sections.
-rw-r--r--ld/ChangeLog14
-rw-r--r--ld/emultempl/armelf.em39
-rw-r--r--ld/emultempl/elf32.em39
-rw-r--r--ld/emultempl/pe.em7
4 files changed, 51 insertions, 48 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2db8014..6c2939e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2000-04-14 Alan Modra <alan@linuxcare.com.au>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_place_section): Process
+ ~SEC_ALLOC sections too. Init start address of debug sections.
+ * emultempl/armelf.em (gld${EMULATION_NAME}_place_section): Ditto.
+ * emultempl/pe.em (gld${EMULATION_NAME}_place_section): Ditto.
+ Also set all relocateable section start addresses.
+
2000-04-13 Geoff Keating <geoffk@cygnus.com>
* scripttempl/elf.sc: Add support for .sbss2 and .sdata2 sections.
@@ -216,11 +224,11 @@ Fri Apr 7 15:56:57 2000 Andrew Cagney <cagney@b1.cygnus.com>
* ldgram.y: Handle LMA region syntax.
* ld.texinfo (Output Section Description): Describe LMA region usage.
* emultempl/armelf.em (gld$place_orphan): Add default value for
- lma region in call to lang_leave_output_statement.
+ lma region in call to lang_leave_output_section_statement.
* emultempl/elf32.em (gld$place_orphan): Add default value for
- lma region in call to lang_leave_output_statement.
+ lma region in call to lang_leave_output_section_statement.
* emultempl/pe.em (gld$place_orphan): Add default value for
- lma region in call to lang_leave_output_statement.
+ lma region in call to lang_leave_output_section_statement.
2000-02-04 Timothy Wall <twall@redhat.com>
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index c66d43f..e5f1514 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -813,9 +813,6 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *outsecname;
lang_output_section_statement_type *os;
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
/* Look through the script to see where to place this section. */
hold_section = s;
hold_use = NULL;
@@ -869,7 +866,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
&& hold_text.os != NULL)
place = &hold_text;
else
- return false;
+ place = NULL;
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
@@ -901,7 +898,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
if (snew == NULL)
einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, outsecname);
- if (place->os->bfd_section != NULL)
+ if (place != NULL && place->os->bfd_section != NULL)
{
/* Unlink it first. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
@@ -936,10 +933,10 @@ gld${EMULATION_NAME}_place_orphan (file, s)
<< s->alignment_power))));
}
- if (! link_info.relocateable)
- address = NULL;
- else
+ if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop ((bfd_vma) 0);
+ else
+ address = NULL;
lang_enter_output_section_statement (outsecname, address, 0,
(bfd_vma) 0,
@@ -965,20 +962,22 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, ".")));
}
- if (! place->stmt)
- {
- /* Put the new statement list right at the head. */
- *add.tail = place->os->header.next;
- place->os->header.next = add.head;
- }
- else
+ if (place != NULL)
{
- /* Put it after the last orphan statement we added. */
- *add.tail = *place->stmt;
- *place->stmt = add.head;
+ if (! place->stmt)
+ {
+ /* Put the new statement list right at the head. */
+ *add.tail = place->os->header.next;
+ place->os->header.next = add.head;
+ }
+ else
+ {
+ /* Put it after the last orphan statement we added. */
+ *add.tail = *place->stmt;
+ *place->stmt = add.head;
+ }
+ place->stmt = add.tail; /* Save the end of this list. */
}
- place->stmt = add.tail; /* Save the end of this list. */
-
stat_ptr = old;
return true;
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index a25f211..2489779 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -895,9 +895,6 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *outsecname;
lang_output_section_statement_type *os;
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
/* Look through the script to see where to place this section. */
hold_section = s;
hold_use = NULL;
@@ -951,7 +948,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
&& hold_text.os != NULL)
place = &hold_text;
else
- return false;
+ place = NULL;
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
@@ -983,7 +980,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
if (snew == NULL)
einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, outsecname);
- if (place->os->bfd_section != NULL)
+ if (place != NULL && place->os->bfd_section != NULL)
{
/* Unlink it first. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
@@ -1018,10 +1015,10 @@ gld${EMULATION_NAME}_place_orphan (file, s)
<< s->alignment_power))));
}
- if (! link_info.relocateable)
- address = NULL;
- else
+ if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop ((bfd_vma) 0);
+ else
+ address = NULL;
lang_enter_output_section_statement (outsecname, address, 0,
(bfd_vma) 0,
@@ -1047,20 +1044,22 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, ".")));
}
- if (! place->stmt)
- {
- /* Put the new statement list right at the head. */
- *add.tail = place->os->header.next;
- place->os->header.next = add.head;
- }
- else
+ if (place != NULL)
{
- /* Put it after the last orphan statement we added. */
- *add.tail = *place->stmt;
- *place->stmt = add.head;
+ if (! place->stmt)
+ {
+ /* Put the new statement list right at the head. */
+ *add.tail = place->os->header.next;
+ place->os->header.next = add.head;
+ }
+ else
+ {
+ /* Put it after the last orphan statement we added. */
+ *add.tail = *place->stmt;
+ *place->stmt = add.head;
+ }
+ place->stmt = add.tail; /* Save the end of this list. */
}
- place->stmt = add.tail; /* Save the end of this list. */
-
stat_ptr = old;
return true;
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 02ebd57..0a94f58 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1100,9 +1100,6 @@ gld_${EMULATION_NAME}_place_orphan (file, s)
const char *secname;
char *dollar = NULL;
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
secname = bfd_get_section_name (s->owner, s);
/* Look through the script to see where to place this section. */
@@ -1199,8 +1196,8 @@ gld_${EMULATION_NAME}_place_orphan (file, s)
stat_ptr = &add;
lang_list_init (stat_ptr);
- if (link_info.relocateable)
- address = NULL;
+ if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
+ address = exp_intop ((bfd_vma) 0);
else
{
/* All sections in an executable must be aligned to a page