# This shell script emits a C file. -*- C -*-
-# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002
+# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
#
# This file is part of GLD, the Gnu Linker.
#include "ldctor.h"
#include "elf32-hppa.h"
-static void hppaelf_after_parse PARAMS((void));
+static void hppaelf_after_parse PARAMS ((void));
static void hppaelf_create_output_section_statements PARAMS ((void));
static asection *hppaelf_add_stub_section
PARAMS ((const char *, asection *));
{
if (link_info.relocateable)
lang_add_unique (".text");
-#if 0 /* enable this once we split millicode stuff from libgcc */
+#if 0 /* Enable this once we split millicode stuff from libgcc. */
else
lang_add_input_file ("milli",
lang_input_file_is_l_enum,
/* Resize the sections. */
lang_size_sections (stat_ptr->head, abs_output_section,
- &stat_ptr->head, 0, (bfd_vma) 0, NULL);
+ &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
/* Linker command language support.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002
+ 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#include "demangle.h"
#ifndef offsetof
-#define offsetof(TYPE,MEMBER) ((size_t)&(((TYPE*)0)->MEMBER))
+#define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
#endif
-/* FORWARDS */
-static lang_statement_union_type *new_statement
- PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
-
-/* LOCALS */
+/* Locals variables. */
static struct obstack stat_obstack;
#define obstack_chunk_alloc xmalloc
static lang_statement_list_type statement_list;
static struct lang_phdr *lang_phdr_list;
+/* Forward declarations. */
+static lang_statement_union_type *new_statement
+ PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
static void lang_for_each_statement_worker
PARAMS ((void (*) (lang_statement_union_type *),
lang_statement_union_type *));
struct memory_region_struct *, etree_type *, bfd_vma));
static bfd_vma lang_size_sections_1
PARAMS ((lang_statement_union_type *, lang_output_section_statement_type *,
- lang_statement_union_type **, fill_type *, bfd_vma, bfd_boolean *));
+ lang_statement_union_type **, fill_type *, bfd_vma, bfd_boolean *,
+ bfd_boolean));
typedef void (*callback_t)
PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
lang_input_statement_type *, PTR));
static char * get_first_input_target
PARAMS ((void));
-/* EXPORTS */
+/* Exported variables. */
lang_output_section_statement_type *abs_output_section;
lang_statement_list_type lang_output_section_statement;
lang_statement_list_type *stat_ptr = &statement_list;
/* Set the sizes for all the output sections. */
static bfd_vma
-lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
+lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
+ check_regions)
lang_statement_union_type *s;
lang_output_section_statement_type *output_section_statement;
lang_statement_union_type **prev;
fill_type *fill;
bfd_vma dot;
bfd_boolean *relax;
+ bfd_boolean check_regions;
{
unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
ldfile_output_machine);
&& (bfd_get_section_flags (output_bfd, os->bfd_section)
& SEC_NEVER_LOAD) == 0
&& ! link_info.relocateable
+ && check_regions
&& strcmp (os->region->name, "*default*") == 0
&& lang_memory_region_list != NULL
&& (strcmp (lang_memory_region_list->name,
}
lang_size_sections_1 (os->children.head, os, &os->children.head,
- os->fill, dot, relax);
+ os->fill, dot, relax, check_regions);
/* Put the section within the requested block size, or
align at the block boundary. */
{
os->region->current = dot;
- /* Make sure the new address is within the region. */
- os_region_check (os, os->region, os->addr_tree,
- os->bfd_section->vma);
+ if (check_regions)
+ /* Make sure the new address is within the region. */
+ os_region_check (os, os->region, os->addr_tree,
+ os->bfd_section->vma);
/* If there's no load address specified, use the run
region as the load region. */
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);
+ if (check_regions)
+ os_region_check (os, os->lma_region, NULL,
+ os->bfd_section->lma);
}
}
}
dot = lang_size_sections_1 (constructor_list.head,
output_section_statement,
&s->wild_statement.children.head,
- fill, dot, relax);
+ fill, dot, relax, check_regions);
break;
case lang_data_statement_enum:
dot = lang_size_sections_1 (s->wild_statement.children.head,
output_section_statement,
&s->wild_statement.children.head,
- fill, dot, relax);
+ fill, dot, relax, check_regions);
break;
dot = lang_size_sections_1 (s->group_statement.children.head,
output_section_statement,
&s->group_statement.children.head,
- fill, dot, relax);
+ fill, dot, relax, check_regions);
break;
default:
}
bfd_vma
-lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
+lang_size_sections (s, output_section_statement, prev, fill, dot, relax,
+ check_regions)
lang_statement_union_type *s;
lang_output_section_statement_type *output_section_statement;
lang_statement_union_type **prev;
fill_type *fill;
bfd_vma dot;
bfd_boolean *relax;
+ bfd_boolean check_regions;
{
bfd_vma result;
exp_data_seg.phase = exp_dataseg_none;
result = lang_size_sections_1 (s, output_section_statement, prev, fill,
- dot, relax);
+ dot, relax, check_regions);
if (exp_data_seg.phase == exp_dataseg_end_seen)
{
/* If DATA_SEGMENT_ALIGN DATA_SEGMENT_END pair was seen, check whether
{
exp_data_seg.phase = exp_dataseg_adjust;
result = lang_size_sections_1 (s, output_section_statement, prev,
- fill, dot, relax);
+ fill, dot, relax, check_regions);
}
}
/* Size up the sections. */
lang_size_sections (statement_list.head,
abs_output_section,
- &statement_list.head, 0, (bfd_vma) 0, NULL);
+ &statement_list.head, 0, (bfd_vma) 0, NULL,
+ command_line.relax ? FALSE : TRUE);
/* Now run around and relax if we can. */
if (command_line.relax)
lang_size_sections (statement_list.head,
abs_output_section,
&statement_list.head, 0, (bfd_vma) 0,
- &relax_again);
+ &relax_again, FALSE);
}
while (relax_again);
+
+ /* Final extra sizing to report errors. */
+ lang_reset_memory_regions ();
+ lang_do_assignments (statement_list.head,
+ abs_output_section,
+ (fill_type *) 0, (bfd_vma) 0);
+ lang_size_sections (statement_list.head,
+ abs_output_section,
+ & statement_list.head, 0, (bfd_vma) 0,
+ NULL, TRUE);
}
/* See if anything special should be done now we know how big