mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-20 14:22:35 +08:00
* ldwrite.c (split_sections): Don't split the first input section
into a new output section.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Mon Jul 17 13:57:00 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* ldwrite.c (split_sections): Don't split the first input section
|
||||||
|
into a new output section.
|
||||||
|
|
||||||
Sat Jul 15 00:26:35 1995 Michael Meissner <meissner@cygnus.com>
|
Sat Jul 15 00:26:35 1995 Michael Meissner <meissner@cygnus.com>
|
||||||
|
|
||||||
* emulparams/elf32ppc.sh (TEMPLATE_NAME): Define as elf32.
|
* emulparams/elf32ppc.sh (TEMPLATE_NAME): Define as elf32.
|
||||||
|
51
ld/ldwrite.c
51
ld/ldwrite.c
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
@ -218,7 +218,7 @@ clone_section (abfd, s, count)
|
|||||||
#define SSIZE 8
|
#define SSIZE 8
|
||||||
char sname[SSIZE]; /* ?? find the name for this size */
|
char sname[SSIZE]; /* ?? find the name for this size */
|
||||||
asection *n;
|
asection *n;
|
||||||
|
struct bfd_link_hash_entry *h;
|
||||||
/* Invent a section name - use first five
|
/* Invent a section name - use first five
|
||||||
chars of base section name and a digit suffix */
|
chars of base section name and a digit suffix */
|
||||||
do
|
do
|
||||||
@ -234,6 +234,15 @@ clone_section (abfd, s, count)
|
|||||||
|
|
||||||
n = bfd_make_section_anyway (abfd, strdup (sname));
|
n = bfd_make_section_anyway (abfd, strdup (sname));
|
||||||
|
|
||||||
|
/* Create a symbol of the same name */
|
||||||
|
|
||||||
|
h = bfd_link_hash_lookup (link_info.hash,
|
||||||
|
sname, true, true, false);
|
||||||
|
h->type = bfd_link_hash_defined;
|
||||||
|
h->u.def.value = 0;
|
||||||
|
h->u.def.section = n ;
|
||||||
|
|
||||||
|
|
||||||
n->flags = s->flags;
|
n->flags = s->flags;
|
||||||
n->vma = s->vma;
|
n->vma = s->vma;
|
||||||
n->user_set_vma = s->user_set_vma;
|
n->user_set_vma = s->user_set_vma;
|
||||||
@ -244,7 +253,7 @@ clone_section (abfd, s, count)
|
|||||||
n->output_section = n;
|
n->output_section = n;
|
||||||
n->orelocation = 0;
|
n->orelocation = 0;
|
||||||
n->reloc_count = 0;
|
n->reloc_count = 0;
|
||||||
|
n->alignment_power = 1;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,6 +326,7 @@ split_sections (abfd, info)
|
|||||||
original_sec && nsecs;
|
original_sec && nsecs;
|
||||||
original_sec = original_sec->next, nsecs--)
|
original_sec = original_sec->next, nsecs--)
|
||||||
{
|
{
|
||||||
|
boolean first = true;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
int relocs = 0;
|
int relocs = 0;
|
||||||
@ -324,6 +334,7 @@ split_sections (abfd, info)
|
|||||||
bfd_vma vma = original_sec->vma;
|
bfd_vma vma = original_sec->vma;
|
||||||
bfd_vma shift_offset = 0;
|
bfd_vma shift_offset = 0;
|
||||||
asection *cursor = original_sec;
|
asection *cursor = original_sec;
|
||||||
|
|
||||||
/* count up the relocations and line entries to see if
|
/* count up the relocations and line entries to see if
|
||||||
anything would be too big to fit */
|
anything would be too big to fit */
|
||||||
for (pp = &(cursor->link_order_head); *pp; pp = &((*pp)->next))
|
for (pp = &(cursor->link_order_head); *pp; pp = &((*pp)->next))
|
||||||
@ -350,9 +361,10 @@ split_sections (abfd, info)
|
|||||||
|| p->type == bfd_symbol_reloc_link_order))
|
|| p->type == bfd_symbol_reloc_link_order))
|
||||||
thisrelocs++;
|
thisrelocs++;
|
||||||
|
|
||||||
if (thisrelocs + relocs > config.split_by_reloc
|
if (! first
|
||||||
|
&& (thisrelocs + relocs > config.split_by_reloc
|
||||||
|| thislines + lines > config.split_by_reloc
|
|| thislines + lines > config.split_by_reloc
|
||||||
|| config.split_by_file)
|
|| config.split_by_file))
|
||||||
{
|
{
|
||||||
/* create a new section and put this link order and the
|
/* create a new section and put this link order and the
|
||||||
following link orders into it */
|
following link orders into it */
|
||||||
@ -398,6 +410,8 @@ split_sections (abfd, info)
|
|||||||
relocs += thisrelocs;
|
relocs += thisrelocs;
|
||||||
lines += thislines;
|
lines += thislines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sanity_check (abfd);
|
sanity_check (abfd);
|
||||||
@ -406,12 +420,24 @@ split_sections (abfd, info)
|
|||||||
void
|
void
|
||||||
ldwrite ()
|
ldwrite ()
|
||||||
{
|
{
|
||||||
|
/* Reset error indicator, which can typically something like invalid
|
||||||
|
format from openning up the .o files */
|
||||||
|
bfd_set_error (bfd_error_no_error);
|
||||||
lang_for_each_statement (build_link_order);
|
lang_for_each_statement (build_link_order);
|
||||||
|
|
||||||
if (config.split_by_reloc || config.split_by_file)
|
if (config.split_by_reloc || config.split_by_file)
|
||||||
split_sections (output_bfd, &link_info);
|
split_sections (output_bfd, &link_info);
|
||||||
if (!bfd_final_link (output_bfd, &link_info))
|
if (!bfd_final_link (output_bfd, &link_info))
|
||||||
|
{
|
||||||
|
/* If there was an error recorded, print it out. Otherwise assume
|
||||||
|
an appropriate error message like unknown symbol was printed
|
||||||
|
out. */
|
||||||
|
|
||||||
|
if (bfd_get_error () != bfd_error_no_error)
|
||||||
einfo ("%F%P: final link failed: %E\n", output_bfd);
|
einfo ("%F%P: final link failed: %E\n", output_bfd);
|
||||||
|
else
|
||||||
|
xexit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.map_file)
|
if (config.map_file)
|
||||||
{
|
{
|
||||||
@ -453,6 +479,14 @@ print_file_stuff (f)
|
|||||||
s != (asection *) NULL;
|
s != (asection *) NULL;
|
||||||
s = s->next)
|
s = s->next)
|
||||||
{
|
{
|
||||||
|
#ifdef WINDOWS_NT
|
||||||
|
/* Don't include any information that goes into the '.junk'
|
||||||
|
section. This includes the code view .debug$ data and
|
||||||
|
stuff from .drectve sections */
|
||||||
|
if (strcmp (s->name, ".drectve") == 0 ||
|
||||||
|
strncmp (s->name, ".debug$", 7) == 0)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
print_address (s->output_offset);
|
print_address (s->output_offset);
|
||||||
if (s->reloc_done)
|
if (s->reloc_done)
|
||||||
{
|
{
|
||||||
@ -509,13 +543,14 @@ print_symbol (p, ignore)
|
|||||||
print_nl ();
|
print_nl ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bfd_link_hash_weak:
|
case bfd_link_hash_undefweak:
|
||||||
fprintf (config.map_file, "weak ");
|
fprintf (config.map_file, "weak ");
|
||||||
fprintf (config.map_file, "%s ", p->root.string);
|
fprintf (config.map_file, "%s ", p->root.string);
|
||||||
print_nl ();
|
print_nl ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bfd_link_hash_defined:
|
case bfd_link_hash_defined:
|
||||||
|
case bfd_link_hash_defweak:
|
||||||
{
|
{
|
||||||
asection *defsec = p->u.def.section;
|
asection *defsec = p->u.def.section;
|
||||||
|
|
||||||
@ -531,7 +566,9 @@ print_symbol (p, ignore)
|
|||||||
{
|
{
|
||||||
fprintf (config.map_file, " .......");
|
fprintf (config.map_file, " .......");
|
||||||
}
|
}
|
||||||
fprintf (config.map_file, " %s ", p->root.string);
|
fprintf (config.map_file, " %s", p->root.string);
|
||||||
|
if (p->type == bfd_link_hash_defweak)
|
||||||
|
fprintf (config.map_file, " [weak]");
|
||||||
}
|
}
|
||||||
print_nl ();
|
print_nl ();
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user