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>
* 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>

View File

@ -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,6 +962,8 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, ".")));
}
if (place != NULL)
{
if (! place->stmt)
{
/* Put the new statement list right at the head. */
@ -978,7 +977,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
*place->stmt = add.head;
}
place->stmt = add.tail; /* Save the end of this list. */
}
stat_ptr = old;
return true;

View File

@ -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,6 +1044,8 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, ".")));
}
if (place != NULL)
{
if (! place->stmt)
{
/* Put the new statement list right at the head. */
@ -1060,7 +1059,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
*place->stmt = add.head;
}
place->stmt = add.tail; /* Save the end of this list. */
}
stat_ptr = old;
return true;

View File

@ -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