Zero start address of orphan ~(SEC_LOAD | SEC_ALLOC) sections.

This commit is contained in:
Alan Modra
2000-04-14 01:58:29 +00:00
parent 4ab10e93d6
commit 01cc8ff856
4 changed files with 51 additions and 48 deletions

View File

@ -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> 2000-04-13 Geoff Keating <geoffk@cygnus.com>
* scripttempl/elf.sc: Add support for .sbss2 and .sdata2 sections. * 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. * ldgram.y: Handle LMA region syntax.
* ld.texinfo (Output Section Description): Describe LMA region usage. * ld.texinfo (Output Section Description): Describe LMA region usage.
* emultempl/armelf.em (gld$place_orphan): Add default value for * 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 * 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 * 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> 2000-02-04 Timothy Wall <twall@redhat.com>

View File

@ -813,9 +813,6 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *outsecname; const char *outsecname;
lang_output_section_statement_type *os; 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. */ /* Look through the script to see where to place this section. */
hold_section = s; hold_section = s;
hold_use = NULL; hold_use = NULL;
@ -869,7 +866,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
&& hold_text.os != NULL) && hold_text.os != NULL)
place = &hold_text; place = &hold_text;
else else
return false; place = NULL;
/* Choose a unique name for the section. This will be needed if the /* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different same section name appears in the input file with different
@ -901,7 +898,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
if (snew == NULL) if (snew == NULL)
einfo ("%P%F: output format %s cannot represent section called %s\n", einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, outsecname); output_bfd->xvec->name, outsecname);
if (place->os->bfd_section != NULL) if (place != NULL && place->os->bfd_section != NULL)
{ {
/* Unlink it first. */ /* Unlink it first. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
@ -936,10 +933,10 @@ gld${EMULATION_NAME}_place_orphan (file, s)
<< s->alignment_power)))); << s->alignment_power))));
} }
if (! link_info.relocateable) if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = NULL;
else
address = exp_intop ((bfd_vma) 0); address = exp_intop ((bfd_vma) 0);
else
address = NULL;
lang_enter_output_section_statement (outsecname, address, 0, lang_enter_output_section_statement (outsecname, address, 0,
(bfd_vma) 0, (bfd_vma) 0,
@ -965,20 +962,22 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, "."))); exp_nameop (NAME, ".")));
} }
if (! place->stmt) if (place != NULL)
{ {
/* Put the new statement list right at the head. */ if (! place->stmt)
*add.tail = place->os->header.next; {
place->os->header.next = add.head; /* 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. */
} }
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. */
stat_ptr = old; stat_ptr = old;
return true; return true;

View File

@ -895,9 +895,6 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *outsecname; const char *outsecname;
lang_output_section_statement_type *os; 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. */ /* Look through the script to see where to place this section. */
hold_section = s; hold_section = s;
hold_use = NULL; hold_use = NULL;
@ -951,7 +948,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
&& hold_text.os != NULL) && hold_text.os != NULL)
place = &hold_text; place = &hold_text;
else else
return false; place = NULL;
/* Choose a unique name for the section. This will be needed if the /* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different same section name appears in the input file with different
@ -983,7 +980,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
if (snew == NULL) if (snew == NULL)
einfo ("%P%F: output format %s cannot represent section called %s\n", einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, outsecname); output_bfd->xvec->name, outsecname);
if (place->os->bfd_section != NULL) if (place != NULL && place->os->bfd_section != NULL)
{ {
/* Unlink it first. */ /* Unlink it first. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
@ -1018,10 +1015,10 @@ gld${EMULATION_NAME}_place_orphan (file, s)
<< s->alignment_power)))); << s->alignment_power))));
} }
if (! link_info.relocateable) if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = NULL;
else
address = exp_intop ((bfd_vma) 0); address = exp_intop ((bfd_vma) 0);
else
address = NULL;
lang_enter_output_section_statement (outsecname, address, 0, lang_enter_output_section_statement (outsecname, address, 0,
(bfd_vma) 0, (bfd_vma) 0,
@ -1047,20 +1044,22 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, "."))); exp_nameop (NAME, ".")));
} }
if (! place->stmt) if (place != NULL)
{ {
/* Put the new statement list right at the head. */ if (! place->stmt)
*add.tail = place->os->header.next; {
place->os->header.next = add.head; /* 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. */
} }
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. */
stat_ptr = old; stat_ptr = old;
return true; return true;

View File

@ -1100,9 +1100,6 @@ gld_${EMULATION_NAME}_place_orphan (file, s)
const char *secname; const char *secname;
char *dollar = NULL; char *dollar = NULL;
if ((s->flags & SEC_ALLOC) == 0)
return false;
secname = bfd_get_section_name (s->owner, s); secname = bfd_get_section_name (s->owner, s);
/* Look through the script to see where to place this section. */ /* 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; stat_ptr = &add;
lang_list_init (stat_ptr); lang_list_init (stat_ptr);
if (link_info.relocateable) if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = NULL; address = exp_intop ((bfd_vma) 0);
else else
{ {
/* All sections in an executable must be aligned to a page /* All sections in an executable must be aligned to a page