mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 16:53:50 +08:00
Disable region size checking whilst relaxing sections.
This commit is contained in:
17
ld/ChangeLog
17
ld/ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2003-02-21 Bob Wilson <bob.wilson@acm.org>
|
||||||
|
|
||||||
|
* ldlang.c (lang_size_sections_1): Add CHECK_REGIONS argument and only
|
||||||
|
call os_region_check when it is set.
|
||||||
|
(lang_size_sections): Add CHECK_REGIONS argument and pass it through to
|
||||||
|
lang_size_sections_1.
|
||||||
|
(lang_process): Change lang_size_sections calls to set CHECK_REGIONS
|
||||||
|
only for the last call, not on every relaxation iteration.
|
||||||
|
* ldlang.h (lang_size_sections): Update prototype.
|
||||||
|
* pe-dll.c (pe_dll_fill_sections): Set CHECK_REGIONS argument in calls
|
||||||
|
to lang_size_sections.
|
||||||
|
(pe_exe_fill_sections): Likewise.
|
||||||
|
* emultempl/elf32.em (gld${EMULATION_NAME}_finish): Likewise.
|
||||||
|
* emultempl/hppaelf.em (hppaelf_layout_sections_again): Likewise.
|
||||||
|
* emultempl/ppc64elf.em (ppc_before_allocation): Likewise.
|
||||||
|
(ppc_layout_sections_again): Likewise.
|
||||||
|
|
||||||
2003-02-21 Bob Wilson <bob.wilson@acm.org>
|
2003-02-21 Bob Wilson <bob.wilson@acm.org>
|
||||||
|
|
||||||
* gen-doc.texi: Set ARM and HPPA variables.
|
* gen-doc.texi: Set ARM and HPPA variables.
|
||||||
|
@ -1427,7 +1427,7 @@ gld${EMULATION_NAME}_finish ()
|
|||||||
|
|
||||||
/* Resize the sections. */
|
/* Resize the sections. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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. */
|
/* Redo special stuff. */
|
||||||
ldemul_after_allocation ();
|
ldemul_after_allocation ();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# This shell script emits a C file. -*- C -*-
|
# 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.
|
# Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of GLD, the Gnu Linker.
|
# This file is part of GLD, the Gnu Linker.
|
||||||
@ -27,7 +27,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
|
|||||||
#include "ldctor.h"
|
#include "ldctor.h"
|
||||||
#include "elf32-hppa.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 void hppaelf_create_output_section_statements PARAMS ((void));
|
||||||
static asection *hppaelf_add_stub_section
|
static asection *hppaelf_add_stub_section
|
||||||
PARAMS ((const char *, asection *));
|
PARAMS ((const char *, asection *));
|
||||||
@ -60,7 +60,7 @@ hppaelf_after_parse ()
|
|||||||
{
|
{
|
||||||
if (link_info.relocateable)
|
if (link_info.relocateable)
|
||||||
lang_add_unique (".text");
|
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
|
else
|
||||||
lang_add_input_file ("milli",
|
lang_add_input_file ("milli",
|
||||||
lang_input_file_is_l_enum,
|
lang_input_file_is_l_enum,
|
||||||
@ -231,7 +231,7 @@ hppaelf_layout_sections_again ()
|
|||||||
|
|
||||||
/* Resize the sections. */
|
/* Resize the sections. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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. */
|
/* Redo special stuff. */
|
||||||
ldemul_after_allocation ();
|
ldemul_after_allocation ();
|
||||||
|
@ -118,7 +118,7 @@ ppc_before_allocation ()
|
|||||||
/* Size the sections. This is premature, but we want to know the
|
/* Size the sections. This is premature, but we want to know the
|
||||||
TLS segment layout so that certain optimizations can be done. */
|
TLS segment layout so that certain optimizations can be done. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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);
|
||||||
|
|
||||||
if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
|
if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ ppc_layout_sections_again ()
|
|||||||
|
|
||||||
/* Resize the sections. */
|
/* Resize the sections. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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);
|
||||||
|
|
||||||
/* Recalculate TOC base. */
|
/* Recalculate TOC base. */
|
||||||
ldemul_after_allocation ();
|
ldemul_after_allocation ();
|
||||||
|
66
ld/ldlang.c
66
ld/ldlang.c
@ -1,6 +1,6 @@
|
|||||||
/* Linker command language support.
|
/* Linker command language support.
|
||||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2001, 2002
|
2001, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
@ -41,14 +41,10 @@
|
|||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
|
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
#define offsetof(TYPE,MEMBER) ((size_t)&(((TYPE*)0)->MEMBER))
|
#define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FORWARDS */
|
/* Locals variables. */
|
||||||
static lang_statement_union_type *new_statement
|
|
||||||
PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
|
|
||||||
|
|
||||||
/* LOCALS */
|
|
||||||
static struct obstack stat_obstack;
|
static struct obstack stat_obstack;
|
||||||
|
|
||||||
#define obstack_chunk_alloc xmalloc
|
#define obstack_chunk_alloc xmalloc
|
||||||
@ -65,6 +61,9 @@ static const char *output_target;
|
|||||||
static lang_statement_list_type statement_list;
|
static lang_statement_list_type statement_list;
|
||||||
static struct lang_phdr *lang_phdr_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
|
static void lang_for_each_statement_worker
|
||||||
PARAMS ((void (*) (lang_statement_union_type *),
|
PARAMS ((void (*) (lang_statement_union_type *),
|
||||||
lang_statement_union_type *));
|
lang_statement_union_type *));
|
||||||
@ -201,7 +200,8 @@ static void os_region_check
|
|||||||
struct memory_region_struct *, etree_type *, bfd_vma));
|
struct memory_region_struct *, etree_type *, bfd_vma));
|
||||||
static bfd_vma lang_size_sections_1
|
static bfd_vma lang_size_sections_1
|
||||||
PARAMS ((lang_statement_union_type *, lang_output_section_statement_type *,
|
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)
|
typedef void (*callback_t)
|
||||||
PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
|
PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
|
||||||
lang_input_statement_type *, PTR));
|
lang_input_statement_type *, PTR));
|
||||||
@ -226,7 +226,7 @@ static int closest_target_match
|
|||||||
static char * get_first_input_target
|
static char * get_first_input_target
|
||||||
PARAMS ((void));
|
PARAMS ((void));
|
||||||
|
|
||||||
/* EXPORTS */
|
/* Exported variables. */
|
||||||
lang_output_section_statement_type *abs_output_section;
|
lang_output_section_statement_type *abs_output_section;
|
||||||
lang_statement_list_type lang_output_section_statement;
|
lang_statement_list_type lang_output_section_statement;
|
||||||
lang_statement_list_type *stat_ptr = &statement_list;
|
lang_statement_list_type *stat_ptr = &statement_list;
|
||||||
@ -2971,13 +2971,15 @@ os_region_check (os, region, tree, base)
|
|||||||
/* Set the sizes for all the output sections. */
|
/* Set the sizes for all the output sections. */
|
||||||
|
|
||||||
static bfd_vma
|
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_statement_union_type *s;
|
||||||
lang_output_section_statement_type *output_section_statement;
|
lang_output_section_statement_type *output_section_statement;
|
||||||
lang_statement_union_type **prev;
|
lang_statement_union_type **prev;
|
||||||
fill_type *fill;
|
fill_type *fill;
|
||||||
bfd_vma dot;
|
bfd_vma dot;
|
||||||
bfd_boolean *relax;
|
bfd_boolean *relax;
|
||||||
|
bfd_boolean check_regions;
|
||||||
{
|
{
|
||||||
unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
|
unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
|
||||||
ldfile_output_machine);
|
ldfile_output_machine);
|
||||||
@ -3047,6 +3049,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
&& (bfd_get_section_flags (output_bfd, os->bfd_section)
|
&& (bfd_get_section_flags (output_bfd, os->bfd_section)
|
||||||
& SEC_NEVER_LOAD) == 0
|
& SEC_NEVER_LOAD) == 0
|
||||||
&& ! link_info.relocateable
|
&& ! link_info.relocateable
|
||||||
|
&& check_regions
|
||||||
&& strcmp (os->region->name, "*default*") == 0
|
&& strcmp (os->region->name, "*default*") == 0
|
||||||
&& lang_memory_region_list != NULL
|
&& lang_memory_region_list != NULL
|
||||||
&& (strcmp (lang_memory_region_list->name,
|
&& (strcmp (lang_memory_region_list->name,
|
||||||
@ -3098,7 +3101,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lang_size_sections_1 (os->children.head, os, &os->children.head,
|
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
|
/* Put the section within the requested block size, or
|
||||||
align at the block boundary. */
|
align at the block boundary. */
|
||||||
@ -3139,9 +3142,10 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
{
|
{
|
||||||
os->region->current = dot;
|
os->region->current = dot;
|
||||||
|
|
||||||
/* Make sure the new address is within the region. */
|
if (check_regions)
|
||||||
os_region_check (os, os->region, os->addr_tree,
|
/* Make sure the new address is within the region. */
|
||||||
os->bfd_section->vma);
|
os_region_check (os, os->region, os->addr_tree,
|
||||||
|
os->bfd_section->vma);
|
||||||
|
|
||||||
/* If there's no load address specified, use the run
|
/* If there's no load address specified, use the run
|
||||||
region as the load region. */
|
region as the load region. */
|
||||||
@ -3154,8 +3158,9 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
os->load_base = exp_intop (os->lma_region->current);
|
os->load_base = exp_intop (os->lma_region->current);
|
||||||
os->lma_region->current +=
|
os->lma_region->current +=
|
||||||
os->bfd_section->_raw_size / opb;
|
os->bfd_section->_raw_size / opb;
|
||||||
os_region_check (os, os->lma_region, NULL,
|
if (check_regions)
|
||||||
os->bfd_section->lma);
|
os_region_check (os, os->lma_region, NULL,
|
||||||
|
os->bfd_section->lma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3165,7 +3170,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
dot = lang_size_sections_1 (constructor_list.head,
|
dot = lang_size_sections_1 (constructor_list.head,
|
||||||
output_section_statement,
|
output_section_statement,
|
||||||
&s->wild_statement.children.head,
|
&s->wild_statement.children.head,
|
||||||
fill, dot, relax);
|
fill, dot, relax, check_regions);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lang_data_statement_enum:
|
case lang_data_statement_enum:
|
||||||
@ -3229,7 +3234,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
dot = lang_size_sections_1 (s->wild_statement.children.head,
|
dot = lang_size_sections_1 (s->wild_statement.children.head,
|
||||||
output_section_statement,
|
output_section_statement,
|
||||||
&s->wild_statement.children.head,
|
&s->wild_statement.children.head,
|
||||||
fill, dot, relax);
|
fill, dot, relax, check_regions);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3327,7 +3332,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
dot = lang_size_sections_1 (s->group_statement.children.head,
|
dot = lang_size_sections_1 (s->group_statement.children.head,
|
||||||
output_section_statement,
|
output_section_statement,
|
||||||
&s->group_statement.children.head,
|
&s->group_statement.children.head,
|
||||||
fill, dot, relax);
|
fill, dot, relax, check_regions);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -3344,19 +3349,21 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bfd_vma
|
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_statement_union_type *s;
|
||||||
lang_output_section_statement_type *output_section_statement;
|
lang_output_section_statement_type *output_section_statement;
|
||||||
lang_statement_union_type **prev;
|
lang_statement_union_type **prev;
|
||||||
fill_type *fill;
|
fill_type *fill;
|
||||||
bfd_vma dot;
|
bfd_vma dot;
|
||||||
bfd_boolean *relax;
|
bfd_boolean *relax;
|
||||||
|
bfd_boolean check_regions;
|
||||||
{
|
{
|
||||||
bfd_vma result;
|
bfd_vma result;
|
||||||
|
|
||||||
exp_data_seg.phase = exp_dataseg_none;
|
exp_data_seg.phase = exp_dataseg_none;
|
||||||
result = lang_size_sections_1 (s, output_section_statement, prev, fill,
|
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 (exp_data_seg.phase == exp_dataseg_end_seen)
|
||||||
{
|
{
|
||||||
/* If DATA_SEGMENT_ALIGN DATA_SEGMENT_END pair was seen, check whether
|
/* If DATA_SEGMENT_ALIGN DATA_SEGMENT_END pair was seen, check whether
|
||||||
@ -3372,7 +3379,7 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
{
|
{
|
||||||
exp_data_seg.phase = exp_dataseg_adjust;
|
exp_data_seg.phase = exp_dataseg_adjust;
|
||||||
result = lang_size_sections_1 (s, output_section_statement, prev,
|
result = lang_size_sections_1 (s, output_section_statement, prev,
|
||||||
fill, dot, relax);
|
fill, dot, relax, check_regions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4348,7 +4355,8 @@ lang_process ()
|
|||||||
/* Size up the sections. */
|
/* Size up the sections. */
|
||||||
lang_size_sections (statement_list.head,
|
lang_size_sections (statement_list.head,
|
||||||
abs_output_section,
|
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. */
|
/* Now run around and relax if we can. */
|
||||||
if (command_line.relax)
|
if (command_line.relax)
|
||||||
@ -4377,9 +4385,19 @@ lang_process ()
|
|||||||
lang_size_sections (statement_list.head,
|
lang_size_sections (statement_list.head,
|
||||||
abs_output_section,
|
abs_output_section,
|
||||||
&statement_list.head, 0, (bfd_vma) 0,
|
&statement_list.head, 0, (bfd_vma) 0,
|
||||||
&relax_again);
|
&relax_again, FALSE);
|
||||||
}
|
}
|
||||||
while (relax_again);
|
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
|
/* See if anything special should be done now we know how big
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ldlang.h - linker command language support
|
/* ldlang.h - linker command language support
|
||||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2001, 2002
|
2001, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
@ -476,7 +476,7 @@ extern bfd_vma lang_size_sections
|
|||||||
PARAMS ((lang_statement_union_type *s,
|
PARAMS ((lang_statement_union_type *s,
|
||||||
lang_output_section_statement_type *output_section_statement,
|
lang_output_section_statement_type *output_section_statement,
|
||||||
lang_statement_union_type **prev, fill_type *fill,
|
lang_statement_union_type **prev, fill_type *fill,
|
||||||
bfd_vma dot, bfd_boolean *relax));
|
bfd_vma dot, bfd_boolean *relax, bfd_boolean check_regions));
|
||||||
extern void lang_enter_group
|
extern void lang_enter_group
|
||||||
PARAMS ((void));
|
PARAMS ((void));
|
||||||
extern void lang_leave_group
|
extern void lang_leave_group
|
||||||
|
@ -2694,7 +2694,7 @@ pe_dll_fill_sections (abfd, info)
|
|||||||
|
|
||||||
/* Resize the sections. */
|
/* Resize the sections. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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. */
|
/* Redo special stuff. */
|
||||||
ldemul_after_allocation ();
|
ldemul_after_allocation ();
|
||||||
@ -2728,7 +2728,7 @@ pe_exe_fill_sections (abfd, info)
|
|||||||
|
|
||||||
/* Resize the sections. */
|
/* Resize the sections. */
|
||||||
lang_size_sections (stat_ptr->head, abs_output_section,
|
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. */
|
/* Redo special stuff. */
|
||||||
ldemul_after_allocation ();
|
ldemul_after_allocation ();
|
||||||
|
Reference in New Issue
Block a user