* ldlang.c (lang_size_sections_1): Move check for conflicting load

addresses and regions from here...
	(lang_get_regions): ...to this new function.
	(lang_leave_output_section_statement): Use lang_get_regions.
	(lang_leave_overlay): Likewise.
	* mri.c (mri_draw_tree): Pass null as last argument to
	lang_leave_output_section_statement.
	* emultempl/elf32.em (gld*_place_orphan): Likewise.
	* emultempl/mmo.em (mmo_place_orphan): Likewise.
	* emultempl/pe.em (gld*_place_orphan): Likewise.
This commit is contained in:
Richard Sandiford 2002-05-27 08:22:08 +00:00
parent 522ba26890
commit ee3cc2e2ee
6 changed files with 64 additions and 33 deletions

View file

@ -1,3 +1,16 @@
2002-05-27 Richard Sandiford <rsandifo@redhat.com>
* ldlang.c (lang_size_sections_1): Move check for conflicting load
addresses and regions from here...
(lang_get_regions): ...to this new function.
(lang_leave_output_section_statement): Use lang_get_regions.
(lang_leave_overlay): Likewise.
* mri.c (mri_draw_tree): Pass null as last argument to
lang_leave_output_section_statement.
* emultempl/elf32.em (gld*_place_orphan): Likewise.
* emultempl/mmo.em (mmo_place_orphan): Likewise.
* emultempl/pe.em (gld*_place_orphan): Likewise.
2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
* configure.tgt: Use ns32k-*-netbsd* instead of ns32k-pc532-netbsd*.

View file

@ -1222,7 +1222,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
lang_leave_output_section_statement
((bfd_vma) 0, "*default*",
(struct lang_output_section_phdr_list *) NULL, "*default*");
(struct lang_output_section_phdr_list *) NULL, NULL);
if (config.build_constructors && *ps == '\0')
{

View file

@ -147,7 +147,7 @@ mmo_place_orphan (file, s)
lang_leave_output_section_statement
((bfd_vma) 0, "*default*",
(struct lang_output_section_phdr_list *) NULL, "*default*");
(struct lang_output_section_phdr_list *) NULL, NULL);
/* Restore the global list pointer. */
stat_ptr = old;

View file

@ -1648,7 +1648,7 @@ gld_${EMULATION_NAME}_place_orphan (file, s)
lang_leave_output_section_statement
((bfd_vma) 0, "*default*",
(struct lang_output_section_phdr_list *) NULL, "*default*");
(struct lang_output_section_phdr_list *) NULL, NULL);
if (config.build_constructors && *ps == '\0')
{

View file

@ -136,6 +136,9 @@ static void lang_set_startof PARAMS ((void));
static void gc_section_callback
PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
lang_input_statement_type *, PTR));
static void lang_get_regions PARAMS ((struct memory_region_struct **,
struct memory_region_struct **,
const char *, const char *, int));
static void lang_record_phdrs PARAMS ((void));
static void lang_gc_wild PARAMS ((lang_wild_statement_type *));
static void lang_gc_sections_1 PARAMS ((lang_statement_union_type *));
@ -3053,26 +3056,14 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
if (os->lma_region == NULL && os->load_base == NULL)
os->lma_region = os->region;
if (os->lma_region != NULL)
if (os->lma_region != NULL && os->lma_region != os->region)
{
if (os->load_base != NULL)
{
einfo (_("%X%P: use an absolute load address or a load memory region, not both\n"));
}
else
{
/* Don't allocate twice. */
if (os->lma_region != os->region)
{
/* Set load_base, which will be handled later. */
os->load_base =
exp_intop (os->lma_region->current);
os->lma_region->current +=
os->bfd_section->_raw_size / opb;
os_region_check (os, os->lma_region, NULL,
os->bfd_section->lma);
}
}
/* Set load_base, which will be handled later. */
os->load_base = exp_intop (os->lma_region->current);
os->lma_region->current +=
os->bfd_section->_raw_size / opb;
os_region_check (os, os->lma_region, NULL,
os->bfd_section->lma);
}
}
}
@ -4517,6 +4508,36 @@ lang_float (maybe)
lang_float_flag = maybe;
}
/* Work out the load- and run-time regions from a script statement, and
store them in *LMA_REGION and *REGION respectively.
MEMSPEC is the name of the run-time region, or "*default*" if the
statement didn't specify one. LMA_MEMSPEC is the name of the
load-time region, or null if the statement didn't specify one.
HAVE_LMA_P is true if the statement had an explicit load address.
It is an error to specify both a load region and a load address. */
static void
lang_get_regions (region, lma_region, memspec, lma_memspec, have_lma_p)
struct memory_region_struct **region, **lma_region;
const char *memspec, *lma_memspec;
int have_lma_p;
{
*lma_region = lang_memory_region_lookup (lma_memspec);
/* If no runtime region has been given, but the load region has
been, use the load region. */
if (lma_memspec != 0 && strcmp (memspec, "*default*") == 0)
*region = *lma_region;
else
*region = lang_memory_region_lookup (memspec);
if (have_lma_p && lma_memspec != 0)
einfo (_("%X%P:%S: section has both a load address and a load region\n"));
}
void
lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
fill_type *fill;
@ -4524,15 +4545,11 @@ lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
struct lang_output_section_phdr_list *phdrs;
const char *lma_memspec;
{
lang_get_regions (&current_section->region,
&current_section->lma_region,
memspec, lma_memspec,
current_section->load_base != 0);
current_section->fill = fill;
current_section->region = lang_memory_region_lookup (memspec);
current_section->lma_region = lang_memory_region_lookup (lma_memspec);
/* If no runtime region has been given, but the load region has
been, use the load region. */
if (current_section->lma_region != 0 && strcmp (memspec, "*default*") == 0)
current_section->region = current_section->lma_region;
current_section->phdrs = phdrs;
stat_ptr = &statement_list;
}
@ -4934,8 +4951,9 @@ lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
struct overlay_list *l;
struct lang_nocrossref *nocrossref;
region = lang_memory_region_lookup (memspec);
lma_region = lang_memory_region_lookup (lma_memspec);
lang_get_regions (&region, &lma_region,
memspec, lma_memspec,
lma_expr != 0);
nocrossref = NULL;

View file

@ -260,7 +260,7 @@ mri_draw_tree ()
lang_leave_output_section_statement
(0, "*default*", (struct lang_output_section_phdr_list *) NULL,
"*default*");
NULL);
p = p->next;
}