PR binutils/13121
Rename 'finfo' to 'flaginfo' to avoid conflicts with AIX system headers.
This commit is contained in:
parent
fd8205284b
commit
57402f1e31
10 changed files with 910 additions and 891 deletions
|
@ -1,3 +1,16 @@
|
|||
2012-05-01 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/13121
|
||||
* aoutx.h: Rename 'finfo' to 'flaginfo' to avoid conflicts with
|
||||
AIX system headers.
|
||||
* coff-ppc.c: Likewise.
|
||||
* cofflink.c: Likewise.
|
||||
* elf32-arm.c: Likewise.
|
||||
* elf64-sparc.c: Likewise.
|
||||
* elflink.c: Likewise.
|
||||
* pdp11.c: Likewise.
|
||||
* rescoff.c: Likewise.
|
||||
|
||||
2012-04-26 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* dwarf2.c (scan_unit_for_symbols): Account for DW_AT_high_pc
|
||||
|
|
224
bfd/aoutx.h
224
bfd/aoutx.h
|
@ -3554,7 +3554,7 @@ static bfd_boolean
|
|||
aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
||||
{
|
||||
struct aout_link_hash_entry *h = (struct aout_link_hash_entry *) bh;
|
||||
struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
|
||||
struct aout_final_link_info *flaginfo = (struct aout_final_link_info *) data;
|
||||
bfd *output_bfd;
|
||||
int type;
|
||||
bfd_vma val;
|
||||
|
@ -3569,12 +3569,12 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
|
||||
if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
|
||||
{
|
||||
if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol)
|
||||
(output_bfd, finfo->info, h)))
|
||||
(output_bfd, flaginfo->info, h)))
|
||||
{
|
||||
/* FIXME: No way to handle errors. */
|
||||
abort ();
|
||||
|
@ -3588,9 +3588,9 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
|
||||
/* An indx of -2 means the symbol must be written. */
|
||||
if (h->indx != -2
|
||||
&& (finfo->info->strip == strip_all
|
||||
|| (finfo->info->strip == strip_some
|
||||
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
|
||||
&& (flaginfo->info->strip == strip_all
|
||||
|| (flaginfo->info->strip == strip_some
|
||||
&& bfd_hash_lookup (flaginfo->info->keep_hash, h->root.root.string,
|
||||
FALSE, FALSE) == NULL)))
|
||||
return TRUE;
|
||||
|
||||
|
@ -3648,7 +3648,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
H_PUT_8 (output_bfd, type, outsym.e_type);
|
||||
H_PUT_8 (output_bfd, 0, outsym.e_other);
|
||||
H_PUT_16 (output_bfd, 0, outsym.e_desc);
|
||||
indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
|
||||
indx = add_to_stringtab (output_bfd, flaginfo->strtab, h->root.root.string,
|
||||
FALSE);
|
||||
if (indx == - (bfd_size_type) 1)
|
||||
/* FIXME: No way to handle errors. */
|
||||
|
@ -3658,12 +3658,12 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
PUT_WORD (output_bfd, val, outsym.e_value);
|
||||
|
||||
amt = EXTERNAL_NLIST_SIZE;
|
||||
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0
|
||||
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
|
||||
|| bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
|
||||
/* FIXME: No way to handle errors. */
|
||||
abort ();
|
||||
|
||||
finfo->symoff += EXTERNAL_NLIST_SIZE;
|
||||
flaginfo->symoff += EXTERNAL_NLIST_SIZE;
|
||||
h->indx = obj_aout_external_sym_count (output_bfd);
|
||||
++obj_aout_external_sym_count (output_bfd);
|
||||
|
||||
|
@ -3673,7 +3673,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
/* Handle a link order which is supposed to generate a reloc. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
||||
aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
|
||||
asection *o,
|
||||
struct bfd_link_order *p)
|
||||
{
|
||||
|
@ -3696,7 +3696,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
r_index = N_ABS | N_EXT;
|
||||
else
|
||||
{
|
||||
BFD_ASSERT (pr->u.section->owner == finfo->output_bfd);
|
||||
BFD_ASSERT (pr->u.section->owner == flaginfo->output_bfd);
|
||||
r_index = pr->u.section->target_index;
|
||||
}
|
||||
}
|
||||
|
@ -3707,7 +3707,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
BFD_ASSERT (p->type == bfd_symbol_reloc_link_order);
|
||||
r_extern = 1;
|
||||
h = ((struct aout_link_hash_entry *)
|
||||
bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info,
|
||||
bfd_wrapped_link_hash_lookup (flaginfo->output_bfd, flaginfo->info,
|
||||
pr->u.name, FALSE, FALSE, TRUE));
|
||||
if (h != NULL
|
||||
&& h->indx >= 0)
|
||||
|
@ -3720,37 +3720,37 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
symbol. */
|
||||
h->indx = -2;
|
||||
h->written = FALSE;
|
||||
if (!aout_link_write_other_symbol (&h->root.root, finfo))
|
||||
if (!aout_link_write_other_symbol (&h->root.root, flaginfo))
|
||||
return FALSE;
|
||||
r_index = h->indx;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||
(finfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
|
||||
if (! ((*flaginfo->info->callbacks->unattached_reloc)
|
||||
(flaginfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
|
||||
return FALSE;
|
||||
r_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
|
||||
howto = bfd_reloc_type_lookup (flaginfo->output_bfd, pr->reloc);
|
||||
if (howto == 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (o == obj_textsec (finfo->output_bfd))
|
||||
reloff_ptr = &finfo->treloff;
|
||||
else if (o == obj_datasec (finfo->output_bfd))
|
||||
reloff_ptr = &finfo->dreloff;
|
||||
if (o == obj_textsec (flaginfo->output_bfd))
|
||||
reloff_ptr = &flaginfo->treloff;
|
||||
else if (o == obj_datasec (flaginfo->output_bfd))
|
||||
reloff_ptr = &flaginfo->dreloff;
|
||||
else
|
||||
abort ();
|
||||
|
||||
if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE)
|
||||
if (obj_reloc_entry_size (flaginfo->output_bfd) == RELOC_STD_SIZE)
|
||||
{
|
||||
#ifdef MY_put_reloc
|
||||
MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto,
|
||||
MY_put_reloc (flaginfo->output_bfd, r_extern, r_index, p->offset, howto,
|
||||
&srel);
|
||||
#else
|
||||
{
|
||||
|
@ -3766,8 +3766,8 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
r_relative = (howto->type & 32) != 0;
|
||||
r_length = howto->size;
|
||||
|
||||
PUT_WORD (finfo->output_bfd, p->offset, srel.r_address);
|
||||
if (bfd_header_big_endian (finfo->output_bfd))
|
||||
PUT_WORD (flaginfo->output_bfd, p->offset, srel.r_address);
|
||||
if (bfd_header_big_endian (flaginfo->output_bfd))
|
||||
{
|
||||
srel.r_index[0] = r_index >> 16;
|
||||
srel.r_index[1] = r_index >> 8;
|
||||
|
@ -3813,7 +3813,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||
if (buf == NULL)
|
||||
return FALSE;
|
||||
r = MY_relocate_contents (howto, finfo->output_bfd,
|
||||
r = MY_relocate_contents (howto, flaginfo->output_bfd,
|
||||
(bfd_vma) pr->addend, buf);
|
||||
switch (r)
|
||||
{
|
||||
|
@ -3823,10 +3823,10 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
case bfd_reloc_outofrange:
|
||||
abort ();
|
||||
case bfd_reloc_overflow:
|
||||
if (! ((*finfo->info->callbacks->reloc_overflow)
|
||||
(finfo->info, NULL,
|
||||
if (! ((*flaginfo->info->callbacks->reloc_overflow)
|
||||
(flaginfo->info, NULL,
|
||||
(p->type == bfd_section_reloc_link_order
|
||||
? bfd_section_name (finfo->output_bfd,
|
||||
? bfd_section_name (flaginfo->output_bfd,
|
||||
pr->u.section)
|
||||
: pr->u.name),
|
||||
howto->name, pr->addend, NULL, NULL, (bfd_vma) 0)))
|
||||
|
@ -3836,7 +3836,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
}
|
||||
break;
|
||||
}
|
||||
ok = bfd_set_section_contents (finfo->output_bfd, o, (void *) buf,
|
||||
ok = bfd_set_section_contents (flaginfo->output_bfd, o, (void *) buf,
|
||||
(file_ptr) p->offset, size);
|
||||
free (buf);
|
||||
if (! ok)
|
||||
|
@ -3846,12 +3846,12 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
else
|
||||
{
|
||||
#ifdef MY_put_ext_reloc
|
||||
MY_put_ext_reloc (finfo->output_bfd, r_extern, r_index, p->offset,
|
||||
MY_put_ext_reloc (flaginfo->output_bfd, r_extern, r_index, p->offset,
|
||||
howto, &erel, pr->addend);
|
||||
#else
|
||||
PUT_WORD (finfo->output_bfd, p->offset, erel.r_address);
|
||||
PUT_WORD (flaginfo->output_bfd, p->offset, erel.r_address);
|
||||
|
||||
if (bfd_header_big_endian (finfo->output_bfd))
|
||||
if (bfd_header_big_endian (flaginfo->output_bfd))
|
||||
{
|
||||
erel.r_index[0] = r_index >> 16;
|
||||
erel.r_index[1] = r_index >> 8;
|
||||
|
@ -3870,25 +3870,25 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
| (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
|
||||
}
|
||||
|
||||
PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend);
|
||||
PUT_WORD (flaginfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend);
|
||||
#endif /* MY_put_ext_reloc */
|
||||
|
||||
rel_ptr = (void *) &erel;
|
||||
}
|
||||
|
||||
amt = obj_reloc_entry_size (finfo->output_bfd);
|
||||
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
|
||||
|| bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt)
|
||||
amt = obj_reloc_entry_size (flaginfo->output_bfd);
|
||||
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
|
||||
|| bfd_bwrite (rel_ptr, amt, flaginfo->output_bfd) != amt)
|
||||
return FALSE;
|
||||
|
||||
*reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
|
||||
*reloff_ptr += obj_reloc_entry_size (flaginfo->output_bfd);
|
||||
|
||||
/* Assert that the relocs have not run into the symbols, and that n
|
||||
the text relocs have not run into the data relocs. */
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
|
||||
&& (reloff_ptr != &finfo->treloff
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
|
||||
&& (reloff_ptr != &flaginfo->treloff
|
||||
|| (*reloff_ptr
|
||||
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
|
||||
<= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3913,7 +3913,7 @@ aout_reloc_index_to_section (bfd *abfd, int indx)
|
|||
/* Relocate an a.out section using standard a.out relocs. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_section_std (struct aout_final_link_info *finfo,
|
||||
aout_link_input_section_std (struct aout_final_link_info *flaginfo,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
struct reloc_std_external *relocs,
|
||||
|
@ -3934,18 +3934,18 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
struct reloc_std_external *rel;
|
||||
struct reloc_std_external *rel_end;
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
|
||||
|
||||
BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE);
|
||||
BFD_ASSERT (input_bfd->xvec->header_byteorder
|
||||
== output_bfd->xvec->header_byteorder);
|
||||
|
||||
relocatable = finfo->info->relocatable;
|
||||
relocatable = flaginfo->info->relocatable;
|
||||
syms = obj_aout_external_syms (input_bfd);
|
||||
strings = obj_aout_external_strings (input_bfd);
|
||||
sym_hashes = obj_aout_sym_hashes (input_bfd);
|
||||
symbol_map = finfo->symbol_map;
|
||||
symbol_map = flaginfo->symbol_map;
|
||||
|
||||
reloc_count = rel_size / RELOC_STD_SIZE;
|
||||
rel = relocs;
|
||||
|
@ -4014,7 +4014,7 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
|
||||
if (howto == NULL)
|
||||
{
|
||||
(*finfo->info->callbacks->einfo)
|
||||
(*flaginfo->info->callbacks->einfo)
|
||||
(_("%P: %B: unexpected relocation type\n"), input_bfd);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
|
@ -4079,7 +4079,7 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
h->indx = -2;
|
||||
h->written = FALSE;
|
||||
if (!aout_link_write_other_symbol (&h->root.root,
|
||||
finfo))
|
||||
flaginfo))
|
||||
return FALSE;
|
||||
}
|
||||
r_index = h->indx;
|
||||
|
@ -4090,8 +4090,8 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
|
||||
name = strings + GET_WORD (input_bfd,
|
||||
syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->unattached_reloc)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr)))
|
||||
return FALSE;
|
||||
r_index = 0;
|
||||
|
@ -4197,7 +4197,7 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
bfd_boolean skip;
|
||||
|
||||
if (! ((*check_dynamic_reloc)
|
||||
(finfo->info, input_bfd, input_section, h,
|
||||
(flaginfo->info, input_bfd, input_section, h,
|
||||
(void *) rel, contents, &skip, &relocation)))
|
||||
return FALSE;
|
||||
if (skip)
|
||||
|
@ -4207,7 +4207,7 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
/* Now warn if a global symbol is undefined. We could not
|
||||
do this earlier, because check_dynamic_reloc might want
|
||||
to skip this reloc. */
|
||||
if (hundef && ! finfo->info->shared && ! r_baserel)
|
||||
if (hundef && ! flaginfo->info->shared && ! r_baserel)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -4215,8 +4215,8 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
name = h->root.root.string;
|
||||
else
|
||||
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->undefined_symbol)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->undefined_symbol)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr, TRUE)))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -4250,8 +4250,8 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
s = aout_reloc_index_to_section (input_bfd, r_index);
|
||||
name = bfd_section_name (input_bfd, s);
|
||||
}
|
||||
if (! ((*finfo->info->callbacks->reloc_overflow)
|
||||
(finfo->info, (h ? &h->root : NULL), name,
|
||||
if (! ((*flaginfo->info->callbacks->reloc_overflow)
|
||||
(flaginfo->info, (h ? &h->root : NULL), name,
|
||||
howto->name, (bfd_vma) 0, input_bfd,
|
||||
input_section, r_addr)))
|
||||
return FALSE;
|
||||
|
@ -4267,7 +4267,7 @@ aout_link_input_section_std (struct aout_final_link_info *finfo,
|
|||
/* Relocate an a.out section using extended a.out relocs. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
||||
aout_link_input_section_ext (struct aout_final_link_info *flaginfo,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
struct reloc_ext_external *relocs,
|
||||
|
@ -4288,18 +4288,18 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
struct reloc_ext_external *rel;
|
||||
struct reloc_ext_external *rel_end;
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
|
||||
|
||||
BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_EXT_SIZE);
|
||||
BFD_ASSERT (input_bfd->xvec->header_byteorder
|
||||
== output_bfd->xvec->header_byteorder);
|
||||
|
||||
relocatable = finfo->info->relocatable;
|
||||
relocatable = flaginfo->info->relocatable;
|
||||
syms = obj_aout_external_syms (input_bfd);
|
||||
strings = obj_aout_external_strings (input_bfd);
|
||||
sym_hashes = obj_aout_sym_hashes (input_bfd);
|
||||
symbol_map = finfo->symbol_map;
|
||||
symbol_map = flaginfo->symbol_map;
|
||||
|
||||
reloc_count = rel_size / RELOC_EXT_SIZE;
|
||||
rel = relocs;
|
||||
|
@ -4340,7 +4340,7 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
|
||||
if (r_type >= TABLE_SIZE (howto_table_ext))
|
||||
{
|
||||
(*finfo->info->callbacks->einfo)
|
||||
(*flaginfo->info->callbacks->einfo)
|
||||
(_("%P: %B: unexpected relocation type\n"), input_bfd);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
|
@ -4421,7 +4421,7 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
h->indx = -2;
|
||||
h->written = FALSE;
|
||||
if (!aout_link_write_other_symbol (&h->root.root,
|
||||
finfo))
|
||||
flaginfo))
|
||||
return FALSE;
|
||||
}
|
||||
r_index = h->indx;
|
||||
|
@ -4432,8 +4432,8 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
|
||||
name = strings + GET_WORD (input_bfd,
|
||||
syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->unattached_reloc)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr)))
|
||||
return FALSE;
|
||||
r_index = 0;
|
||||
|
@ -4600,7 +4600,7 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
bfd_boolean skip;
|
||||
|
||||
if (! ((*check_dynamic_reloc)
|
||||
(finfo->info, input_bfd, input_section, h,
|
||||
(flaginfo->info, input_bfd, input_section, h,
|
||||
(void *) rel, contents, &skip, &relocation)))
|
||||
return FALSE;
|
||||
if (skip)
|
||||
|
@ -4611,7 +4611,7 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
do this earlier, because check_dynamic_reloc might want
|
||||
to skip this reloc. */
|
||||
if (hundef
|
||||
&& ! finfo->info->shared
|
||||
&& ! flaginfo->info->shared
|
||||
&& r_type != (unsigned int) RELOC_BASE10
|
||||
&& r_type != (unsigned int) RELOC_BASE13
|
||||
&& r_type != (unsigned int) RELOC_BASE22)
|
||||
|
@ -4622,8 +4622,8 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
name = h->root.root.string;
|
||||
else
|
||||
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->undefined_symbol)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->undefined_symbol)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr, TRUE)))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -4669,8 +4669,8 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
s = aout_reloc_index_to_section (input_bfd, r_index);
|
||||
name = bfd_section_name (input_bfd, s);
|
||||
}
|
||||
if (! ((*finfo->info->callbacks->reloc_overflow)
|
||||
(finfo->info, (h ? &h->root : NULL), name,
|
||||
if (! ((*flaginfo->info->callbacks->reloc_overflow)
|
||||
(flaginfo->info, (h ? &h->root : NULL), name,
|
||||
howto_table_ext[r_type].name,
|
||||
r_addend, input_bfd, input_section, r_addr)))
|
||||
return FALSE;
|
||||
|
@ -4687,7 +4687,7 @@ aout_link_input_section_ext (struct aout_final_link_info *finfo,
|
|||
/* Link an a.out section into the output file. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_section (struct aout_final_link_info *finfo,
|
||||
aout_link_input_section (struct aout_final_link_info *flaginfo,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
file_ptr *reloff_ptr,
|
||||
|
@ -4699,7 +4699,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Get the section contents. */
|
||||
input_size = input_section->size;
|
||||
if (! bfd_get_section_contents (input_bfd, input_section,
|
||||
(void *) finfo->contents,
|
||||
(void *) flaginfo->contents,
|
||||
(file_ptr) 0, input_size))
|
||||
return FALSE;
|
||||
|
||||
|
@ -4709,7 +4709,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
relocs = aout_section_data (input_section)->relocs;
|
||||
else
|
||||
{
|
||||
relocs = finfo->relocs;
|
||||
relocs = flaginfo->relocs;
|
||||
if (rel_size > 0)
|
||||
{
|
||||
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
|
||||
|
@ -4721,44 +4721,44 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Relocate the section contents. */
|
||||
if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE)
|
||||
{
|
||||
if (! aout_link_input_section_std (finfo, input_bfd, input_section,
|
||||
if (! aout_link_input_section_std (flaginfo, input_bfd, input_section,
|
||||
(struct reloc_std_external *) relocs,
|
||||
rel_size, finfo->contents))
|
||||
rel_size, flaginfo->contents))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! aout_link_input_section_ext (finfo, input_bfd, input_section,
|
||||
if (! aout_link_input_section_ext (flaginfo, input_bfd, input_section,
|
||||
(struct reloc_ext_external *) relocs,
|
||||
rel_size, finfo->contents))
|
||||
rel_size, flaginfo->contents))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Write out the section contents. */
|
||||
if (! bfd_set_section_contents (finfo->output_bfd,
|
||||
if (! bfd_set_section_contents (flaginfo->output_bfd,
|
||||
input_section->output_section,
|
||||
(void *) finfo->contents,
|
||||
(void *) flaginfo->contents,
|
||||
(file_ptr) input_section->output_offset,
|
||||
input_size))
|
||||
return FALSE;
|
||||
|
||||
/* If we are producing relocatable output, the relocs were
|
||||
modified, and we now write them out. */
|
||||
if (finfo->info->relocatable && rel_size > 0)
|
||||
if (flaginfo->info->relocatable && rel_size > 0)
|
||||
{
|
||||
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
|
||||
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
|
||||
return FALSE;
|
||||
if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
|
||||
if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
|
||||
return FALSE;
|
||||
*reloff_ptr += rel_size;
|
||||
|
||||
/* Assert that the relocs have not run into the symbols, and
|
||||
that if these are the text relocs they have not run into the
|
||||
data relocs. */
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
|
||||
&& (reloff_ptr != &finfo->treloff
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
|
||||
&& (reloff_ptr != &flaginfo->treloff
|
||||
|| (*reloff_ptr
|
||||
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
|
||||
<= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -4768,7 +4768,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
symbol indices into a symbol_map. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
||||
aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
|
||||
{
|
||||
bfd *output_bfd;
|
||||
bfd_size_type sym_count;
|
||||
|
@ -4784,25 +4784,25 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
bfd_boolean pass;
|
||||
bfd_boolean skip_next;
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
sym_count = obj_aout_external_sym_count (input_bfd);
|
||||
strings = obj_aout_external_strings (input_bfd);
|
||||
strip = finfo->info->strip;
|
||||
discard = finfo->info->discard;
|
||||
outsym = finfo->output_syms;
|
||||
strip = flaginfo->info->strip;
|
||||
discard = flaginfo->info->discard;
|
||||
outsym = flaginfo->output_syms;
|
||||
|
||||
/* First write out a symbol for this object file, unless we are
|
||||
discarding such symbols. */
|
||||
if (strip != strip_all
|
||||
&& (strip != strip_some
|
||||
|| bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
|
||||
|| bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
|
||||
FALSE, FALSE) != NULL)
|
||||
&& discard != discard_all)
|
||||
{
|
||||
H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
|
||||
H_PUT_8 (output_bfd, 0, outsym->e_other);
|
||||
H_PUT_16 (output_bfd, 0, outsym->e_desc);
|
||||
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
|
||||
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
|
||||
input_bfd->filename, FALSE);
|
||||
if (strtab_index == (bfd_size_type) -1)
|
||||
return FALSE;
|
||||
|
@ -4821,7 +4821,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
sym = obj_aout_external_syms (input_bfd);
|
||||
sym_end = sym + sym_count;
|
||||
sym_hash = obj_aout_sym_hashes (input_bfd);
|
||||
symbol_map = finfo->symbol_map;
|
||||
symbol_map = flaginfo->symbol_map;
|
||||
memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map);
|
||||
for (; sym < sym_end; sym++, sym_hash++, symbol_map++)
|
||||
{
|
||||
|
@ -4920,7 +4920,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
skip = TRUE;
|
||||
break;
|
||||
case strip_some:
|
||||
if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
|
||||
if (bfd_hash_lookup (flaginfo->info->keep_hash, name, FALSE, FALSE)
|
||||
== NULL)
|
||||
skip = TRUE;
|
||||
break;
|
||||
|
@ -5148,8 +5148,8 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* If we have already included a header file with the
|
||||
same value, then replace this one with an N_EXCL
|
||||
symbol. */
|
||||
copy = (bfd_boolean) (! finfo->info->keep_memory);
|
||||
incl_entry = aout_link_includes_lookup (&finfo->includes,
|
||||
copy = (bfd_boolean) (! flaginfo->info->keep_memory);
|
||||
incl_entry = aout_link_includes_lookup (&flaginfo->includes,
|
||||
name, TRUE, copy);
|
||||
if (incl_entry == NULL)
|
||||
return FALSE;
|
||||
|
@ -5161,7 +5161,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* This is the first time we have seen this header
|
||||
file with this set of stabs strings. */
|
||||
t = (struct aout_link_includes_totals *)
|
||||
bfd_hash_allocate (&finfo->includes.root,
|
||||
bfd_hash_allocate (&flaginfo->includes.root,
|
||||
sizeof *t);
|
||||
if (t == NULL)
|
||||
return FALSE;
|
||||
|
@ -5210,7 +5210,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
H_PUT_8 (output_bfd, H_GET_8 (input_bfd, sym->e_other), outsym->e_other);
|
||||
H_PUT_16 (output_bfd, H_GET_16 (input_bfd, sym->e_desc), outsym->e_desc);
|
||||
copy = FALSE;
|
||||
if (! finfo->info->keep_memory)
|
||||
if (! flaginfo->info->keep_memory)
|
||||
{
|
||||
/* name points into a string table which we are going to
|
||||
free. If there is a hash table entry, use that string.
|
||||
|
@ -5220,7 +5220,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
else
|
||||
copy = TRUE;
|
||||
}
|
||||
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
|
||||
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
|
||||
name, copy);
|
||||
if (strtab_index == (bfd_size_type) -1)
|
||||
return FALSE;
|
||||
|
@ -5232,18 +5232,18 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
}
|
||||
|
||||
/* Write out the output symbols we have just constructed. */
|
||||
if (outsym > finfo->output_syms)
|
||||
if (outsym > flaginfo->output_syms)
|
||||
{
|
||||
bfd_size_type outsym_size;
|
||||
|
||||
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
|
||||
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0)
|
||||
return FALSE;
|
||||
outsym_size = outsym - finfo->output_syms;
|
||||
outsym_size = outsym - flaginfo->output_syms;
|
||||
outsym_size *= EXTERNAL_NLIST_SIZE;
|
||||
if (bfd_bwrite ((void *) finfo->output_syms, outsym_size, output_bfd)
|
||||
if (bfd_bwrite ((void *) flaginfo->output_syms, outsym_size, output_bfd)
|
||||
!= outsym_size)
|
||||
return FALSE;
|
||||
finfo->symoff += outsym_size;
|
||||
flaginfo->symoff += outsym_size;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -5252,7 +5252,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* Link an a.out input BFD into the output file. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
||||
aout_link_input_bfd (struct aout_final_link_info *flaginfo, bfd *input_bfd)
|
||||
{
|
||||
BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
|
||||
|
||||
|
@ -5260,16 +5260,16 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
if ((input_bfd->flags & DYNAMIC) != 0
|
||||
&& aout_backend_info (input_bfd)->link_dynamic_object != NULL)
|
||||
return ((*aout_backend_info (input_bfd)->link_dynamic_object)
|
||||
(finfo->info, input_bfd));
|
||||
(flaginfo->info, input_bfd));
|
||||
|
||||
/* Get the symbols. We probably have them already, unless
|
||||
finfo->info->keep_memory is FALSE. */
|
||||
flaginfo->info->keep_memory is FALSE. */
|
||||
if (! aout_get_external_symbols (input_bfd))
|
||||
return FALSE;
|
||||
|
||||
/* Write out the symbols and get a map of the new indices. The map
|
||||
is placed into finfo->symbol_map. */
|
||||
if (! aout_link_write_symbols (finfo, input_bfd))
|
||||
is placed into flaginfo->symbol_map. */
|
||||
if (! aout_link_write_symbols (flaginfo, input_bfd))
|
||||
return FALSE;
|
||||
|
||||
/* Relocate and write out the sections. These functions use the
|
||||
|
@ -5278,17 +5278,17 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
link, which will normally be the case. */
|
||||
if (obj_textsec (input_bfd)->linker_mark)
|
||||
{
|
||||
if (! aout_link_input_section (finfo, input_bfd,
|
||||
if (! aout_link_input_section (flaginfo, input_bfd,
|
||||
obj_textsec (input_bfd),
|
||||
&finfo->treloff,
|
||||
&flaginfo->treloff,
|
||||
exec_hdr (input_bfd)->a_trsize))
|
||||
return FALSE;
|
||||
}
|
||||
if (obj_datasec (input_bfd)->linker_mark)
|
||||
{
|
||||
if (! aout_link_input_section (finfo, input_bfd,
|
||||
if (! aout_link_input_section (flaginfo, input_bfd,
|
||||
obj_datasec (input_bfd),
|
||||
&finfo->dreloff,
|
||||
&flaginfo->dreloff,
|
||||
exec_hdr (input_bfd)->a_drsize))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -5296,7 +5296,7 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* If we are not keeping memory, we don't need the symbols any
|
||||
longer. We still need them if we are keeping memory, because the
|
||||
strings in the hash table point into them. */
|
||||
if (! finfo->info->keep_memory)
|
||||
if (! flaginfo->info->keep_memory)
|
||||
{
|
||||
if (! aout_link_free_symbols (input_bfd))
|
||||
return FALSE;
|
||||
|
|
234
bfd/coff-ppc.c
234
bfd/coff-ppc.c
|
@ -2050,7 +2050,7 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
struct bfd_link_info *info;
|
||||
{
|
||||
bfd_size_type symesz;
|
||||
struct coff_final_link_info finfo;
|
||||
struct coff_final_link_info flaginfo;
|
||||
bfd_boolean debug_merge_allocated;
|
||||
asection *o;
|
||||
struct bfd_link_order *p;
|
||||
|
@ -2070,29 +2070,29 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
|
||||
symesz = bfd_coff_symesz (abfd);
|
||||
|
||||
finfo.info = info;
|
||||
finfo.output_bfd = abfd;
|
||||
finfo.strtab = NULL;
|
||||
finfo.section_info = NULL;
|
||||
finfo.last_file_index = -1;
|
||||
finfo.last_bf_index = -1;
|
||||
finfo.internal_syms = NULL;
|
||||
finfo.sec_ptrs = NULL;
|
||||
finfo.sym_indices = NULL;
|
||||
finfo.outsyms = NULL;
|
||||
finfo.linenos = NULL;
|
||||
finfo.contents = NULL;
|
||||
finfo.external_relocs = NULL;
|
||||
finfo.internal_relocs = NULL;
|
||||
flaginfo.info = info;
|
||||
flaginfo.output_bfd = abfd;
|
||||
flaginfo.strtab = NULL;
|
||||
flaginfo.section_info = NULL;
|
||||
flaginfo.last_file_index = -1;
|
||||
flaginfo.last_bf_index = -1;
|
||||
flaginfo.internal_syms = NULL;
|
||||
flaginfo.sec_ptrs = NULL;
|
||||
flaginfo.sym_indices = NULL;
|
||||
flaginfo.outsyms = NULL;
|
||||
flaginfo.linenos = NULL;
|
||||
flaginfo.contents = NULL;
|
||||
flaginfo.external_relocs = NULL;
|
||||
flaginfo.internal_relocs = NULL;
|
||||
debug_merge_allocated = FALSE;
|
||||
|
||||
coff_data (abfd)->link_info = info;
|
||||
|
||||
finfo.strtab = _bfd_stringtab_init ();
|
||||
if (finfo.strtab == NULL)
|
||||
flaginfo.strtab = _bfd_stringtab_init ();
|
||||
if (flaginfo.strtab == NULL)
|
||||
goto error_return;
|
||||
|
||||
if (! coff_debug_merge_hash_table_init (&finfo.debug_merge))
|
||||
if (! coff_debug_merge_hash_table_init (&flaginfo.debug_merge))
|
||||
goto error_return;
|
||||
debug_merge_allocated = TRUE;
|
||||
|
||||
|
@ -2171,15 +2171,15 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
the target_index fields are 1 based. */
|
||||
amt = abfd->section_count + 1;
|
||||
amt *= sizeof (struct coff_link_section_info);
|
||||
finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
|
||||
flaginfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
|
||||
|
||||
if (finfo.section_info == NULL)
|
||||
if (flaginfo.section_info == NULL)
|
||||
goto error_return;
|
||||
|
||||
for (i = 0; i <= abfd->section_count; i++)
|
||||
{
|
||||
finfo.section_info[i].relocs = NULL;
|
||||
finfo.section_info[i].rel_hashes = NULL;
|
||||
flaginfo.section_info[i].relocs = NULL;
|
||||
flaginfo.section_info[i].rel_hashes = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2217,14 +2217,14 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
BFD_ASSERT (info->relocatable);
|
||||
amt = o->reloc_count;
|
||||
amt *= sizeof (struct internal_reloc);
|
||||
finfo.section_info[o->target_index].relocs =
|
||||
flaginfo.section_info[o->target_index].relocs =
|
||||
(struct internal_reloc *) bfd_malloc (amt);
|
||||
amt = o->reloc_count;
|
||||
amt *= sizeof (struct coff_link_hash_entry *);
|
||||
finfo.section_info[o->target_index].rel_hashes =
|
||||
flaginfo.section_info[o->target_index].rel_hashes =
|
||||
(struct coff_link_hash_entry **) bfd_malloc (amt);
|
||||
if (finfo.section_info[o->target_index].relocs == NULL
|
||||
|| finfo.section_info[o->target_index].rel_hashes == NULL)
|
||||
if (flaginfo.section_info[o->target_index].relocs == NULL
|
||||
|| flaginfo.section_info[o->target_index].rel_hashes == NULL)
|
||||
goto error_return;
|
||||
|
||||
if (o->reloc_count > max_output_reloc_count)
|
||||
|
@ -2255,31 +2255,31 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
|
||||
/* Allocate some buffers used while linking. */
|
||||
amt = max_sym_count * sizeof (struct internal_syment);
|
||||
finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
|
||||
flaginfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
|
||||
amt = max_sym_count * sizeof (asection *);
|
||||
finfo.sec_ptrs = (asection **) bfd_malloc (amt);
|
||||
flaginfo.sec_ptrs = (asection **) bfd_malloc (amt);
|
||||
amt = max_sym_count * sizeof (long);
|
||||
finfo.sym_indices = (long *) bfd_malloc (amt);
|
||||
flaginfo.sym_indices = (long *) bfd_malloc (amt);
|
||||
amt = (max_sym_count + 1) * symesz;
|
||||
finfo.outsyms = (bfd_byte *) bfd_malloc (amt);
|
||||
flaginfo.outsyms = (bfd_byte *) bfd_malloc (amt);
|
||||
amt = max_lineno_count * bfd_coff_linesz (abfd);
|
||||
finfo.linenos = (bfd_byte *) bfd_malloc (amt);
|
||||
finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
|
||||
finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
|
||||
flaginfo.linenos = (bfd_byte *) bfd_malloc (amt);
|
||||
flaginfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
|
||||
flaginfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
|
||||
if (! info->relocatable)
|
||||
{
|
||||
amt = max_reloc_count * sizeof (struct internal_reloc);
|
||||
finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
|
||||
flaginfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
|
||||
}
|
||||
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|
||||
|| (finfo.sec_ptrs == NULL && max_sym_count > 0)
|
||||
|| (finfo.sym_indices == NULL && max_sym_count > 0)
|
||||
|| finfo.outsyms == NULL
|
||||
|| (finfo.linenos == NULL && max_lineno_count > 0)
|
||||
|| (finfo.contents == NULL && max_contents_size > 0)
|
||||
|| (finfo.external_relocs == NULL && max_reloc_count > 0)
|
||||
if ((flaginfo.internal_syms == NULL && max_sym_count > 0)
|
||||
|| (flaginfo.sec_ptrs == NULL && max_sym_count > 0)
|
||||
|| (flaginfo.sym_indices == NULL && max_sym_count > 0)
|
||||
|| flaginfo.outsyms == NULL
|
||||
|| (flaginfo.linenos == NULL && max_lineno_count > 0)
|
||||
|| (flaginfo.contents == NULL && max_contents_size > 0)
|
||||
|| (flaginfo.external_relocs == NULL && max_reloc_count > 0)
|
||||
|| (! info->relocatable
|
||||
&& finfo.internal_relocs == NULL
|
||||
&& flaginfo.internal_relocs == NULL
|
||||
&& max_reloc_count > 0))
|
||||
goto error_return;
|
||||
|
||||
|
@ -2311,7 +2311,7 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
if (! sub->output_has_begun)
|
||||
#endif
|
||||
{
|
||||
if (! _bfd_coff_link_input_bfd (&finfo, sub))
|
||||
if (! _bfd_coff_link_input_bfd (&flaginfo, sub))
|
||||
goto error_return;
|
||||
sub->output_has_begun = TRUE;
|
||||
}
|
||||
|
@ -2319,7 +2319,7 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
else if (p->type == bfd_section_reloc_link_order
|
||||
|| p->type == bfd_symbol_reloc_link_order)
|
||||
{
|
||||
if (! _bfd_coff_reloc_link_order (abfd, &finfo, o, p))
|
||||
if (! _bfd_coff_reloc_link_order (abfd, &flaginfo, o, p))
|
||||
goto error_return;
|
||||
}
|
||||
else
|
||||
|
@ -2335,7 +2335,7 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
bfd* last_one = ppc_get_last();
|
||||
if (last_one)
|
||||
{
|
||||
if (! _bfd_coff_link_input_bfd (&finfo, last_one))
|
||||
if (! _bfd_coff_link_input_bfd (&flaginfo, last_one))
|
||||
goto error_return;
|
||||
}
|
||||
last_one->output_has_begun = TRUE;
|
||||
|
@ -2343,73 +2343,73 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
#endif
|
||||
|
||||
/* Free up the buffers used by _bfd_coff_link_input_bfd. */
|
||||
coff_debug_merge_hash_table_free (&finfo.debug_merge);
|
||||
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
|
||||
debug_merge_allocated = FALSE;
|
||||
|
||||
if (finfo.internal_syms != NULL)
|
||||
if (flaginfo.internal_syms != NULL)
|
||||
{
|
||||
free (finfo.internal_syms);
|
||||
finfo.internal_syms = NULL;
|
||||
free (flaginfo.internal_syms);
|
||||
flaginfo.internal_syms = NULL;
|
||||
}
|
||||
if (finfo.sec_ptrs != NULL)
|
||||
if (flaginfo.sec_ptrs != NULL)
|
||||
{
|
||||
free (finfo.sec_ptrs);
|
||||
finfo.sec_ptrs = NULL;
|
||||
free (flaginfo.sec_ptrs);
|
||||
flaginfo.sec_ptrs = NULL;
|
||||
}
|
||||
if (finfo.sym_indices != NULL)
|
||||
if (flaginfo.sym_indices != NULL)
|
||||
{
|
||||
free (finfo.sym_indices);
|
||||
finfo.sym_indices = NULL;
|
||||
free (flaginfo.sym_indices);
|
||||
flaginfo.sym_indices = NULL;
|
||||
}
|
||||
if (finfo.linenos != NULL)
|
||||
if (flaginfo.linenos != NULL)
|
||||
{
|
||||
free (finfo.linenos);
|
||||
finfo.linenos = NULL;
|
||||
free (flaginfo.linenos);
|
||||
flaginfo.linenos = NULL;
|
||||
}
|
||||
if (finfo.contents != NULL)
|
||||
if (flaginfo.contents != NULL)
|
||||
{
|
||||
free (finfo.contents);
|
||||
finfo.contents = NULL;
|
||||
free (flaginfo.contents);
|
||||
flaginfo.contents = NULL;
|
||||
}
|
||||
if (finfo.external_relocs != NULL)
|
||||
if (flaginfo.external_relocs != NULL)
|
||||
{
|
||||
free (finfo.external_relocs);
|
||||
finfo.external_relocs = NULL;
|
||||
free (flaginfo.external_relocs);
|
||||
flaginfo.external_relocs = NULL;
|
||||
}
|
||||
if (finfo.internal_relocs != NULL)
|
||||
if (flaginfo.internal_relocs != NULL)
|
||||
{
|
||||
free (finfo.internal_relocs);
|
||||
finfo.internal_relocs = NULL;
|
||||
free (flaginfo.internal_relocs);
|
||||
flaginfo.internal_relocs = NULL;
|
||||
}
|
||||
|
||||
/* The value of the last C_FILE symbol is supposed to be the symbol
|
||||
index of the first external symbol. Write it out again if
|
||||
necessary. */
|
||||
if (finfo.last_file_index != -1
|
||||
&& (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd))
|
||||
if (flaginfo.last_file_index != -1
|
||||
&& (unsigned int) flaginfo.last_file.n_value != obj_raw_syment_count (abfd))
|
||||
{
|
||||
file_ptr pos;
|
||||
|
||||
finfo.last_file.n_value = obj_raw_syment_count (abfd);
|
||||
bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
|
||||
(PTR) finfo.outsyms);
|
||||
pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
|
||||
flaginfo.last_file.n_value = obj_raw_syment_count (abfd);
|
||||
bfd_coff_swap_sym_out (abfd, (PTR) &flaginfo.last_file,
|
||||
(PTR) flaginfo.outsyms);
|
||||
pos = obj_sym_filepos (abfd) + flaginfo.last_file_index * symesz;
|
||||
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|
||||
|| bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
|
||||
|| bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Write out the global symbols. */
|
||||
finfo.failed = FALSE;
|
||||
bfd_hash_traverse (&info->hash->table, _bfd_coff_write_global_sym, &finfo);
|
||||
if (finfo.failed)
|
||||
flaginfo.failed = FALSE;
|
||||
bfd_hash_traverse (&info->hash->table, _bfd_coff_write_global_sym, &flaginfo);
|
||||
if (flaginfo.failed)
|
||||
goto error_return;
|
||||
|
||||
/* The outsyms buffer is used by _bfd_coff_write_global_sym. */
|
||||
if (finfo.outsyms != NULL)
|
||||
if (flaginfo.outsyms != NULL)
|
||||
{
|
||||
free (finfo.outsyms);
|
||||
finfo.outsyms = NULL;
|
||||
free (flaginfo.outsyms);
|
||||
flaginfo.outsyms = NULL;
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
|
@ -2432,9 +2432,9 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
if (o->reloc_count == 0)
|
||||
continue;
|
||||
|
||||
irel = finfo.section_info[o->target_index].relocs;
|
||||
irel = flaginfo.section_info[o->target_index].relocs;
|
||||
irelend = irel + o->reloc_count;
|
||||
rel_hash = finfo.section_info[o->target_index].rel_hashes;
|
||||
rel_hash = flaginfo.section_info[o->target_index].rel_hashes;
|
||||
erel = external_relocs;
|
||||
for (; irel < irelend; irel++, rel_hash++, erel += relsz)
|
||||
{
|
||||
|
@ -2457,19 +2457,19 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
}
|
||||
|
||||
/* Free up the section information. */
|
||||
if (finfo.section_info != NULL)
|
||||
if (flaginfo.section_info != NULL)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < abfd->section_count; i++)
|
||||
{
|
||||
if (finfo.section_info[i].relocs != NULL)
|
||||
free (finfo.section_info[i].relocs);
|
||||
if (finfo.section_info[i].rel_hashes != NULL)
|
||||
free (finfo.section_info[i].rel_hashes);
|
||||
if (flaginfo.section_info[i].relocs != NULL)
|
||||
free (flaginfo.section_info[i].relocs);
|
||||
if (flaginfo.section_info[i].rel_hashes != NULL)
|
||||
free (flaginfo.section_info[i].rel_hashes);
|
||||
}
|
||||
free (finfo.section_info);
|
||||
finfo.section_info = NULL;
|
||||
free (flaginfo.section_info);
|
||||
flaginfo.section_info = NULL;
|
||||
}
|
||||
|
||||
/* If we have optimized stabs strings, output them. */
|
||||
|
@ -2490,7 +2490,7 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
|
||||
#if STRING_SIZE_SIZE == 4
|
||||
H_PUT_32 (abfd,
|
||||
_bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
|
||||
_bfd_stringtab_size (flaginfo.strtab) + STRING_SIZE_SIZE,
|
||||
strbuf);
|
||||
#else
|
||||
#error Change H_PUT_32 above
|
||||
|
@ -2500,11 +2500,11 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
!= STRING_SIZE_SIZE)
|
||||
return FALSE;
|
||||
|
||||
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
|
||||
if (! _bfd_stringtab_emit (abfd, flaginfo.strtab))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_bfd_stringtab_free (finfo.strtab);
|
||||
_bfd_stringtab_free (flaginfo.strtab);
|
||||
|
||||
/* Setting bfd_get_symcount to 0 will cause write_object_contents to
|
||||
not try to write out the symbols. */
|
||||
|
@ -2514,38 +2514,38 @@ ppc_bfd_coff_final_link (abfd, info)
|
|||
|
||||
error_return:
|
||||
if (debug_merge_allocated)
|
||||
coff_debug_merge_hash_table_free (&finfo.debug_merge);
|
||||
if (finfo.strtab != NULL)
|
||||
_bfd_stringtab_free (finfo.strtab);
|
||||
if (finfo.section_info != NULL)
|
||||
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
|
||||
if (flaginfo.strtab != NULL)
|
||||
_bfd_stringtab_free (flaginfo.strtab);
|
||||
if (flaginfo.section_info != NULL)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < abfd->section_count; i++)
|
||||
{
|
||||
if (finfo.section_info[i].relocs != NULL)
|
||||
free (finfo.section_info[i].relocs);
|
||||
if (finfo.section_info[i].rel_hashes != NULL)
|
||||
free (finfo.section_info[i].rel_hashes);
|
||||
if (flaginfo.section_info[i].relocs != NULL)
|
||||
free (flaginfo.section_info[i].relocs);
|
||||
if (flaginfo.section_info[i].rel_hashes != NULL)
|
||||
free (flaginfo.section_info[i].rel_hashes);
|
||||
}
|
||||
free (finfo.section_info);
|
||||
free (flaginfo.section_info);
|
||||
}
|
||||
if (finfo.internal_syms != NULL)
|
||||
free (finfo.internal_syms);
|
||||
if (finfo.sec_ptrs != NULL)
|
||||
free (finfo.sec_ptrs);
|
||||
if (finfo.sym_indices != NULL)
|
||||
free (finfo.sym_indices);
|
||||
if (finfo.outsyms != NULL)
|
||||
free (finfo.outsyms);
|
||||
if (finfo.linenos != NULL)
|
||||
free (finfo.linenos);
|
||||
if (finfo.contents != NULL)
|
||||
free (finfo.contents);
|
||||
if (finfo.external_relocs != NULL)
|
||||
free (finfo.external_relocs);
|
||||
if (finfo.internal_relocs != NULL)
|
||||
free (finfo.internal_relocs);
|
||||
if (flaginfo.internal_syms != NULL)
|
||||
free (flaginfo.internal_syms);
|
||||
if (flaginfo.sec_ptrs != NULL)
|
||||
free (flaginfo.sec_ptrs);
|
||||
if (flaginfo.sym_indices != NULL)
|
||||
free (flaginfo.sym_indices);
|
||||
if (flaginfo.outsyms != NULL)
|
||||
free (flaginfo.outsyms);
|
||||
if (flaginfo.linenos != NULL)
|
||||
free (flaginfo.linenos);
|
||||
if (flaginfo.contents != NULL)
|
||||
free (flaginfo.contents);
|
||||
if (flaginfo.external_relocs != NULL)
|
||||
free (flaginfo.external_relocs);
|
||||
if (flaginfo.internal_relocs != NULL)
|
||||
free (flaginfo.internal_relocs);
|
||||
if (external_relocs != NULL)
|
||||
free (external_relocs);
|
||||
return FALSE;
|
||||
|
|
556
bfd/cofflink.c
556
bfd/cofflink.c
File diff suppressed because it is too large
Load diff
|
@ -14440,7 +14440,7 @@ get_arm_elf_section_data (asection * sec)
|
|||
|
||||
typedef struct
|
||||
{
|
||||
void *finfo;
|
||||
void *flaginfo;
|
||||
struct bfd_link_info *info;
|
||||
asection *sec;
|
||||
int sec_shndx;
|
||||
|
@ -14475,7 +14475,7 @@ elf32_arm_output_map_sym (output_arch_syminfo *osi,
|
|||
sym.st_shndx = osi->sec_shndx;
|
||||
sym.st_target_internal = 0;
|
||||
elf32_arm_section_map_add (osi->sec, names[type][1], offset);
|
||||
return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
|
||||
return osi->func (osi->flaginfo, names[type], &sym, osi->sec, NULL) == 1;
|
||||
}
|
||||
|
||||
/* Output mapping symbols for the PLT entry described by ROOT_PLT and ARM_PLT.
|
||||
|
@ -14602,7 +14602,7 @@ elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
|
|||
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
|
||||
sym.st_shndx = osi->sec_shndx;
|
||||
sym.st_target_internal = 0;
|
||||
return osi->func (osi->finfo, name, &sym, osi->sec, NULL) == 1;
|
||||
return osi->func (osi->flaginfo, name, &sym, osi->sec, NULL) == 1;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
@ -14714,7 +14714,7 @@ arm_map_one_stub (struct bfd_hash_entry * gen_entry,
|
|||
static bfd_boolean
|
||||
elf32_arm_output_arch_local_syms (bfd *output_bfd,
|
||||
struct bfd_link_info *info,
|
||||
void *finfo,
|
||||
void *flaginfo,
|
||||
int (*func) (void *, const char *,
|
||||
Elf_Internal_Sym *,
|
||||
asection *,
|
||||
|
@ -14732,7 +14732,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
|
|||
|
||||
check_use_blx (htab);
|
||||
|
||||
osi.finfo = finfo;
|
||||
osi.flaginfo = flaginfo;
|
||||
osi.info = info;
|
||||
osi.func = func;
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
|||
static bfd_boolean
|
||||
elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
struct bfd_link_info *info,
|
||||
PTR finfo,
|
||||
PTR flaginfo,
|
||||
int (*func) (PTR, const char *,
|
||||
Elf_Internal_Sym *,
|
||||
asection *,
|
||||
|
@ -594,7 +594,7 @@ elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||
sym.st_info = ELF_ST_INFO (app_regs [reg].bind, STT_REGISTER);
|
||||
sym.st_shndx = app_regs [reg].shndx;
|
||||
sym.st_target_internal = 0;
|
||||
if ((*func) (finfo, app_regs [reg].name, &sym,
|
||||
if ((*func) (flaginfo, app_regs [reg].name, &sym,
|
||||
sym.st_shndx == SHN_ABS
|
||||
? bfd_abs_section_ptr : bfd_und_section_ptr,
|
||||
NULL) != 1)
|
||||
|
|
498
bfd/elflink.c
498
bfd/elflink.c
File diff suppressed because it is too large
Load diff
178
bfd/pdp11.c
178
bfd/pdp11.c
|
@ -2895,7 +2895,7 @@ static bfd_boolean
|
|||
aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
||||
{
|
||||
struct aout_link_hash_entry *h = (struct aout_link_hash_entry *) bh;
|
||||
struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
|
||||
struct aout_final_link_info *flaginfo = (struct aout_final_link_info *) data;
|
||||
bfd *output_bfd;
|
||||
int type;
|
||||
bfd_vma val;
|
||||
|
@ -2910,12 +2910,12 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
|
||||
if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
|
||||
{
|
||||
if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol)
|
||||
(output_bfd, finfo->info, h)))
|
||||
(output_bfd, flaginfo->info, h)))
|
||||
{
|
||||
/* FIXME: No way to handle errors. */
|
||||
abort ();
|
||||
|
@ -2929,9 +2929,9 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
|
||||
/* An indx of -2 means the symbol must be written. */
|
||||
if (h->indx != -2
|
||||
&& (finfo->info->strip == strip_all
|
||||
|| (finfo->info->strip == strip_some
|
||||
&& bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
|
||||
&& (flaginfo->info->strip == strip_all
|
||||
|| (flaginfo->info->strip == strip_some
|
||||
&& bfd_hash_lookup (flaginfo->info->keep_hash, h->root.root.string,
|
||||
FALSE, FALSE) == NULL)))
|
||||
return TRUE;
|
||||
|
||||
|
@ -2986,7 +2986,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
}
|
||||
|
||||
H_PUT_8 (output_bfd, type, outsym.e_type);
|
||||
indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
|
||||
indx = add_to_stringtab (output_bfd, flaginfo->strtab, h->root.root.string,
|
||||
FALSE);
|
||||
if (indx == (bfd_size_type) -1)
|
||||
/* FIXME: No way to handle errors. */
|
||||
|
@ -2996,12 +2996,12 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
PUT_WORD (output_bfd, val, outsym.e_value);
|
||||
|
||||
amt = EXTERNAL_NLIST_SIZE;
|
||||
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0
|
||||
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
|
||||
|| bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
|
||||
/* FIXME: No way to handle errors. */
|
||||
abort ();
|
||||
|
||||
finfo->symoff += amt;
|
||||
flaginfo->symoff += amt;
|
||||
h->indx = obj_aout_external_sym_count (output_bfd);
|
||||
++obj_aout_external_sym_count (output_bfd);
|
||||
|
||||
|
@ -3011,7 +3011,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
|
|||
/* Handle a link order which is supposed to generate a reloc. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
||||
aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
|
||||
asection *o,
|
||||
struct bfd_link_order *p)
|
||||
{
|
||||
|
@ -3033,7 +3033,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
r_index = N_ABS | N_EXT;
|
||||
else
|
||||
{
|
||||
BFD_ASSERT (pr->u.section->owner == finfo->output_bfd);
|
||||
BFD_ASSERT (pr->u.section->owner == flaginfo->output_bfd);
|
||||
r_index = pr->u.section->target_index;
|
||||
}
|
||||
}
|
||||
|
@ -3044,7 +3044,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
BFD_ASSERT (p->type == bfd_symbol_reloc_link_order);
|
||||
r_extern = 1;
|
||||
h = ((struct aout_link_hash_entry *)
|
||||
bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info,
|
||||
bfd_wrapped_link_hash_lookup (flaginfo->output_bfd, flaginfo->info,
|
||||
pr->u.name, FALSE, FALSE, TRUE));
|
||||
if (h != NULL
|
||||
&& h->indx >= 0)
|
||||
|
@ -3057,35 +3057,35 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
symbol. */
|
||||
h->indx = -2;
|
||||
h->written = FALSE;
|
||||
if (!aout_link_write_other_symbol (&h->root.root, finfo))
|
||||
if (!aout_link_write_other_symbol (&h->root.root, flaginfo))
|
||||
return FALSE;
|
||||
r_index = h->indx;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||
(finfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
|
||||
if (! ((*flaginfo->info->callbacks->unattached_reloc)
|
||||
(flaginfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0)))
|
||||
return FALSE;
|
||||
r_index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc);
|
||||
howto = bfd_reloc_type_lookup (flaginfo->output_bfd, pr->reloc);
|
||||
if (howto == 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (o == obj_textsec (finfo->output_bfd))
|
||||
reloff_ptr = &finfo->treloff;
|
||||
else if (o == obj_datasec (finfo->output_bfd))
|
||||
reloff_ptr = &finfo->dreloff;
|
||||
if (o == obj_textsec (flaginfo->output_bfd))
|
||||
reloff_ptr = &flaginfo->treloff;
|
||||
else if (o == obj_datasec (flaginfo->output_bfd))
|
||||
reloff_ptr = &flaginfo->dreloff;
|
||||
else
|
||||
abort ();
|
||||
|
||||
#ifdef MY_put_reloc
|
||||
MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto,
|
||||
MY_put_reloc(flaginfo->output_bfd, r_extern, r_index, p->offset, howto,
|
||||
&srel);
|
||||
#else
|
||||
{
|
||||
|
@ -3103,8 +3103,8 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
r_relative = (howto->type & 32) != 0;
|
||||
r_length = howto->size;
|
||||
|
||||
PUT_WORD (finfo->output_bfd, p->offset, srel.r_address);
|
||||
if (bfd_header_big_endian (finfo->output_bfd))
|
||||
PUT_WORD (flaginfo->output_bfd, p->offset, srel.r_address);
|
||||
if (bfd_header_big_endian (flaginfo->output_bfd))
|
||||
{
|
||||
srel.r_index[0] = r_index >> 16;
|
||||
srel.r_index[1] = r_index >> 8;
|
||||
|
@ -3150,7 +3150,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
buf = bfd_zmalloc (size);
|
||||
if (buf == NULL)
|
||||
return FALSE;
|
||||
r = MY_relocate_contents (howto, finfo->output_bfd,
|
||||
r = MY_relocate_contents (howto, flaginfo->output_bfd,
|
||||
pr->addend, buf);
|
||||
switch (r)
|
||||
{
|
||||
|
@ -3160,10 +3160,10 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
case bfd_reloc_outofrange:
|
||||
abort ();
|
||||
case bfd_reloc_overflow:
|
||||
if (! ((*finfo->info->callbacks->reloc_overflow)
|
||||
(finfo->info, NULL,
|
||||
if (! ((*flaginfo->info->callbacks->reloc_overflow)
|
||||
(flaginfo->info, NULL,
|
||||
(p->type == bfd_section_reloc_link_order
|
||||
? bfd_section_name (finfo->output_bfd,
|
||||
? bfd_section_name (flaginfo->output_bfd,
|
||||
pr->u.section)
|
||||
: pr->u.name),
|
||||
howto->name, pr->addend, NULL,
|
||||
|
@ -3174,7 +3174,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
}
|
||||
break;
|
||||
}
|
||||
ok = bfd_set_section_contents (finfo->output_bfd, o,
|
||||
ok = bfd_set_section_contents (flaginfo->output_bfd, o,
|
||||
(void *) buf,
|
||||
(file_ptr) p->offset,
|
||||
size);
|
||||
|
@ -3183,19 +3183,19 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
rel_size = obj_reloc_entry_size (finfo->output_bfd);
|
||||
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
|
||||
|| bfd_bwrite (rel_ptr, rel_size, finfo->output_bfd) != rel_size)
|
||||
rel_size = obj_reloc_entry_size (flaginfo->output_bfd);
|
||||
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
|
||||
|| bfd_bwrite (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size)
|
||||
return FALSE;
|
||||
|
||||
*reloff_ptr += rel_size;
|
||||
|
||||
/* Assert that the relocs have not run into the symbols, and that n
|
||||
the text relocs have not run into the data relocs. */
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
|
||||
&& (reloff_ptr != &finfo->treloff
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
|
||||
&& (reloff_ptr != &flaginfo->treloff
|
||||
|| (*reloff_ptr
|
||||
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
|
||||
<= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3217,7 +3217,7 @@ aout_reloc_type_to_section (bfd *abfd, int type)
|
|||
}
|
||||
|
||||
static bfd_boolean
|
||||
pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
||||
pdp11_aout_link_input_section (struct aout_final_link_info *flaginfo,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
bfd_byte *relocs,
|
||||
|
@ -3237,18 +3237,18 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
bfd_byte *rel;
|
||||
bfd_byte *rel_end;
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc;
|
||||
|
||||
BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_SIZE);
|
||||
BFD_ASSERT (input_bfd->xvec->header_byteorder
|
||||
== output_bfd->xvec->header_byteorder);
|
||||
|
||||
relocatable = finfo->info->relocatable;
|
||||
relocatable = flaginfo->info->relocatable;
|
||||
syms = obj_aout_external_syms (input_bfd);
|
||||
strings = obj_aout_external_strings (input_bfd);
|
||||
sym_hashes = obj_aout_sym_hashes (input_bfd);
|
||||
symbol_map = finfo->symbol_map;
|
||||
symbol_map = flaginfo->symbol_map;
|
||||
|
||||
rel = relocs;
|
||||
rel_end = rel + rel_size;
|
||||
|
@ -3337,7 +3337,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
h->indx = -2;
|
||||
h->written = FALSE;
|
||||
if (!aout_link_write_other_symbol (&h->root.root,
|
||||
finfo))
|
||||
flaginfo))
|
||||
return FALSE;
|
||||
}
|
||||
r_index = h->indx;
|
||||
|
@ -3348,8 +3348,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
|
||||
name = strings + GET_WORD (input_bfd,
|
||||
syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->unattached_reloc)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->unattached_reloc)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr)))
|
||||
return FALSE;
|
||||
r_index = 0;
|
||||
|
@ -3444,7 +3444,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
bfd_boolean skip;
|
||||
|
||||
if (! ((*check_dynamic_reloc)
|
||||
(finfo->info, input_bfd, input_section, h,
|
||||
(flaginfo->info, input_bfd, input_section, h,
|
||||
(void *) rel, contents, &skip, &relocation)))
|
||||
return FALSE;
|
||||
if (skip)
|
||||
|
@ -3454,7 +3454,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Now warn if a global symbol is undefined. We could not
|
||||
do this earlier, because check_dynamic_reloc might want
|
||||
to skip this reloc. */
|
||||
if (hundef && ! finfo->info->shared)
|
||||
if (hundef && ! flaginfo->info->shared)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -3462,8 +3462,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
name = h->root.root.string;
|
||||
else
|
||||
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->undefined_symbol)
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
if (! ((*flaginfo->info->callbacks->undefined_symbol)
|
||||
(flaginfo->info, name, input_bfd, input_section,
|
||||
r_addr, TRUE)))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3497,8 +3497,8 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
s = aout_reloc_type_to_section (input_bfd, r_type);
|
||||
name = bfd_section_name (input_bfd, s);
|
||||
}
|
||||
if (! ((*finfo->info->callbacks->reloc_overflow)
|
||||
(finfo->info, (h ? &h->root : NULL), name,
|
||||
if (! ((*flaginfo->info->callbacks->reloc_overflow)
|
||||
(flaginfo->info, (h ? &h->root : NULL), name,
|
||||
howto->name, (bfd_vma) 0, input_bfd,
|
||||
input_section, r_addr)))
|
||||
return FALSE;
|
||||
|
@ -3514,7 +3514,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Link an a.out section into the output file. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_section (struct aout_final_link_info *finfo,
|
||||
aout_link_input_section (struct aout_final_link_info *flaginfo,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
file_ptr *reloff_ptr,
|
||||
|
@ -3526,7 +3526,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Get the section contents. */
|
||||
input_size = input_section->size;
|
||||
if (! bfd_get_section_contents (input_bfd, input_section,
|
||||
(void *) finfo->contents,
|
||||
(void *) flaginfo->contents,
|
||||
(file_ptr) 0, input_size))
|
||||
return FALSE;
|
||||
|
||||
|
@ -3536,7 +3536,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
relocs = aout_section_data (input_section)->relocs;
|
||||
else
|
||||
{
|
||||
relocs = finfo->relocs;
|
||||
relocs = flaginfo->relocs;
|
||||
if (rel_size > 0)
|
||||
{
|
||||
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
|
||||
|
@ -3546,36 +3546,36 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
}
|
||||
|
||||
/* Relocate the section contents. */
|
||||
if (! pdp11_aout_link_input_section (finfo, input_bfd, input_section,
|
||||
if (! pdp11_aout_link_input_section (flaginfo, input_bfd, input_section,
|
||||
(bfd_byte *) relocs,
|
||||
rel_size, finfo->contents))
|
||||
rel_size, flaginfo->contents))
|
||||
return FALSE;
|
||||
|
||||
/* Write out the section contents. */
|
||||
if (! bfd_set_section_contents (finfo->output_bfd,
|
||||
if (! bfd_set_section_contents (flaginfo->output_bfd,
|
||||
input_section->output_section,
|
||||
(void *) finfo->contents,
|
||||
(void *) flaginfo->contents,
|
||||
(file_ptr) input_section->output_offset,
|
||||
input_size))
|
||||
return FALSE;
|
||||
|
||||
/* If we are producing relocatable output, the relocs were
|
||||
modified, and we now write them out. */
|
||||
if (finfo->info->relocatable && rel_size > 0)
|
||||
if (flaginfo->info->relocatable && rel_size > 0)
|
||||
{
|
||||
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
|
||||
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
|
||||
return FALSE;
|
||||
if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
|
||||
if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
|
||||
return FALSE;
|
||||
*reloff_ptr += rel_size;
|
||||
|
||||
/* Assert that the relocs have not run into the symbols, and
|
||||
that if these are the text relocs they have not run into the
|
||||
data relocs. */
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd)
|
||||
&& (reloff_ptr != &finfo->treloff
|
||||
BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (flaginfo->output_bfd)
|
||||
&& (reloff_ptr != &flaginfo->treloff
|
||||
|| (*reloff_ptr
|
||||
<= obj_datasec (finfo->output_bfd)->rel_filepos)));
|
||||
<= obj_datasec (flaginfo->output_bfd)->rel_filepos)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -3584,7 +3584,7 @@ aout_link_input_section (struct aout_final_link_info *finfo,
|
|||
/* Link an a.out input BFD into the output file. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
||||
aout_link_input_bfd (struct aout_final_link_info *flaginfo, bfd *input_bfd)
|
||||
{
|
||||
BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
|
||||
|
||||
|
@ -3592,16 +3592,16 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
if ((input_bfd->flags & DYNAMIC) != 0
|
||||
&& aout_backend_info (input_bfd)->link_dynamic_object != NULL)
|
||||
return ((*aout_backend_info (input_bfd)->link_dynamic_object)
|
||||
(finfo->info, input_bfd));
|
||||
(flaginfo->info, input_bfd));
|
||||
|
||||
/* Get the symbols. We probably have them already, unless
|
||||
finfo->info->keep_memory is FALSE. */
|
||||
flaginfo->info->keep_memory is FALSE. */
|
||||
if (! aout_get_external_symbols (input_bfd))
|
||||
return FALSE;
|
||||
|
||||
/* Write out the symbols and get a map of the new indices. The map
|
||||
is placed into finfo->symbol_map. */
|
||||
if (! aout_link_write_symbols (finfo, input_bfd))
|
||||
is placed into flaginfo->symbol_map. */
|
||||
if (! aout_link_write_symbols (flaginfo, input_bfd))
|
||||
return FALSE;
|
||||
|
||||
/* Relocate and write out the sections. These functions use the
|
||||
|
@ -3610,17 +3610,17 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
link, which will normally be the case. */
|
||||
if (obj_textsec (input_bfd)->linker_mark)
|
||||
{
|
||||
if (! aout_link_input_section (finfo, input_bfd,
|
||||
if (! aout_link_input_section (flaginfo, input_bfd,
|
||||
obj_textsec (input_bfd),
|
||||
&finfo->treloff,
|
||||
&flaginfo->treloff,
|
||||
exec_hdr (input_bfd)->a_trsize))
|
||||
return FALSE;
|
||||
}
|
||||
if (obj_datasec (input_bfd)->linker_mark)
|
||||
{
|
||||
if (! aout_link_input_section (finfo, input_bfd,
|
||||
if (! aout_link_input_section (flaginfo, input_bfd,
|
||||
obj_datasec (input_bfd),
|
||||
&finfo->dreloff,
|
||||
&flaginfo->dreloff,
|
||||
exec_hdr (input_bfd)->a_drsize))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3628,7 +3628,7 @@ aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* If we are not keeping memory, we don't need the symbols any
|
||||
longer. We still need them if we are keeping memory, because the
|
||||
strings in the hash table point into them. */
|
||||
if (! finfo->info->keep_memory)
|
||||
if (! flaginfo->info->keep_memory)
|
||||
{
|
||||
if (! aout_link_free_symbols (input_bfd))
|
||||
return FALSE;
|
||||
|
@ -3982,7 +3982,7 @@ NAME (aout, final_link) (bfd *abfd,
|
|||
symbol indices into a symbol_map. */
|
||||
|
||||
static bfd_boolean
|
||||
aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
||||
aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
|
||||
{
|
||||
bfd *output_bfd;
|
||||
bfd_size_type sym_count;
|
||||
|
@ -3998,23 +3998,23 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
bfd_boolean pass;
|
||||
bfd_boolean skip_next;
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
output_bfd = flaginfo->output_bfd;
|
||||
sym_count = obj_aout_external_sym_count (input_bfd);
|
||||
strings = obj_aout_external_strings (input_bfd);
|
||||
strip = finfo->info->strip;
|
||||
discard = finfo->info->discard;
|
||||
outsym = finfo->output_syms;
|
||||
strip = flaginfo->info->strip;
|
||||
discard = flaginfo->info->discard;
|
||||
outsym = flaginfo->output_syms;
|
||||
|
||||
/* First write out a symbol for this object file, unless we are
|
||||
discarding such symbols. */
|
||||
if (strip != strip_all
|
||||
&& (strip != strip_some
|
||||
|| bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
|
||||
|| bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
|
||||
FALSE, FALSE) != NULL)
|
||||
&& discard != discard_all)
|
||||
{
|
||||
H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
|
||||
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
|
||||
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
|
||||
input_bfd->filename, FALSE);
|
||||
if (strtab_index == (bfd_size_type) -1)
|
||||
return FALSE;
|
||||
|
@ -4033,7 +4033,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
sym = obj_aout_external_syms (input_bfd);
|
||||
sym_end = sym + sym_count;
|
||||
sym_hash = obj_aout_sym_hashes (input_bfd);
|
||||
symbol_map = finfo->symbol_map;
|
||||
symbol_map = flaginfo->symbol_map;
|
||||
memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map);
|
||||
for (; sym < sym_end; sym++, sym_hash++, symbol_map++)
|
||||
{
|
||||
|
@ -4132,7 +4132,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
skip = TRUE;
|
||||
break;
|
||||
case strip_some:
|
||||
if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
|
||||
if (bfd_hash_lookup (flaginfo->info->keep_hash, name, FALSE, FALSE)
|
||||
== NULL)
|
||||
skip = TRUE;
|
||||
break;
|
||||
|
@ -4360,8 +4360,8 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
/* If we have already included a header file with the
|
||||
same value, then replace this one with an N_EXCL
|
||||
symbol. */
|
||||
copy = ! finfo->info->keep_memory;
|
||||
incl_entry = aout_link_includes_lookup (&finfo->includes,
|
||||
copy = ! flaginfo->info->keep_memory;
|
||||
incl_entry = aout_link_includes_lookup (&flaginfo->includes,
|
||||
name, TRUE, copy);
|
||||
if (incl_entry == NULL)
|
||||
return FALSE;
|
||||
|
@ -4372,7 +4372,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
{
|
||||
/* This is the first time we have seen this header
|
||||
file with this set of stabs strings. */
|
||||
t = bfd_hash_allocate (&finfo->includes.root,
|
||||
t = bfd_hash_allocate (&flaginfo->includes.root,
|
||||
sizeof *t);
|
||||
if (t == NULL)
|
||||
return FALSE;
|
||||
|
@ -4419,7 +4419,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
write out. */
|
||||
H_PUT_8 (output_bfd, type, outsym->e_type);
|
||||
copy = FALSE;
|
||||
if (! finfo->info->keep_memory)
|
||||
if (! flaginfo->info->keep_memory)
|
||||
{
|
||||
/* name points into a string table which we are going to
|
||||
free. If there is a hash table entry, use that string.
|
||||
|
@ -4429,7 +4429,7 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
else
|
||||
copy = TRUE;
|
||||
}
|
||||
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
|
||||
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
|
||||
name, copy);
|
||||
if (strtab_index == (bfd_size_type) -1)
|
||||
return FALSE;
|
||||
|
@ -4441,17 +4441,17 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd)
|
|||
}
|
||||
|
||||
/* Write out the output symbols we have just constructed. */
|
||||
if (outsym > finfo->output_syms)
|
||||
if (outsym > flaginfo->output_syms)
|
||||
{
|
||||
bfd_size_type size;
|
||||
|
||||
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
|
||||
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0)
|
||||
return FALSE;
|
||||
size = outsym - finfo->output_syms;
|
||||
size = outsym - flaginfo->output_syms;
|
||||
size *= EXTERNAL_NLIST_SIZE;
|
||||
if (bfd_bwrite ((void *) finfo->output_syms, size, output_bfd) != size)
|
||||
if (bfd_bwrite ((void *) flaginfo->output_syms, size, output_bfd) != size)
|
||||
return FALSE;
|
||||
finfo->symoff += size;
|
||||
flaginfo->symoff += size;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2012-05-01 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/13121
|
||||
* rescoff.c: Rename 'finfo' to 'flaginfo' to avoid conflicts with
|
||||
AIX system headers.
|
||||
|
||||
2012-04-25 Cary Coutant <ccoutant@google.com>
|
||||
|
||||
* doc/binutils.texi: Add -D/--enable-deterministic-archives option
|
||||
|
|
|
@ -118,7 +118,7 @@ read_coff_rsrc (const char *filename, const char *target)
|
|||
asection *sec;
|
||||
bfd_size_type size;
|
||||
bfd_byte *data;
|
||||
struct coff_file_info finfo;
|
||||
struct coff_file_info flaginfo;
|
||||
|
||||
if (filename == NULL)
|
||||
fatal (_("filename required for COFF input"));
|
||||
|
@ -147,10 +147,10 @@ read_coff_rsrc (const char *filename, const char *target)
|
|||
|
||||
get_windres_bfd_content (&wrbfd, data, 0, size);
|
||||
|
||||
finfo.filename = filename;
|
||||
finfo.data = data;
|
||||
finfo.data_end = data + size;
|
||||
finfo.secaddr = (bfd_get_section_vma (abfd, sec)
|
||||
flaginfo.filename = filename;
|
||||
flaginfo.data = data;
|
||||
flaginfo.data_end = data + size;
|
||||
flaginfo.secaddr = (bfd_get_section_vma (abfd, sec)
|
||||
- pe_data (abfd)->pe_opthdr.ImageBase);
|
||||
|
||||
/* Now just read in the top level resource directory. Note that we
|
||||
|
@ -158,7 +158,7 @@ read_coff_rsrc (const char *filename, const char *target)
|
|||
it. If we ever want to free up the resource information we read,
|
||||
this will have to be cleaned up. */
|
||||
|
||||
ret = read_coff_res_dir (&wrbfd, data, &finfo, (const rc_res_id *) NULL, 0);
|
||||
ret = read_coff_res_dir (&wrbfd, data, &flaginfo, (const rc_res_id *) NULL, 0);
|
||||
|
||||
bfd_close (abfd);
|
||||
|
||||
|
@ -168,16 +168,16 @@ read_coff_rsrc (const char *filename, const char *target)
|
|||
/* Give an error if we are out of bounds. */
|
||||
|
||||
static void
|
||||
overrun (const struct coff_file_info *finfo, const char *msg)
|
||||
overrun (const struct coff_file_info *flaginfo, const char *msg)
|
||||
{
|
||||
fatal (_("%s: %s: address out of bounds"), finfo->filename, msg);
|
||||
fatal (_("%s: %s: address out of bounds"), flaginfo->filename, msg);
|
||||
}
|
||||
|
||||
/* Read a resource directory. */
|
||||
|
||||
static rc_res_directory *
|
||||
read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
||||
const struct coff_file_info *finfo,
|
||||
const struct coff_file_info *flaginfo,
|
||||
const rc_res_id *type, int level)
|
||||
{
|
||||
const struct extern_res_directory *erd;
|
||||
|
@ -186,8 +186,8 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
rc_res_entry **pp;
|
||||
const struct extern_res_entry *ere;
|
||||
|
||||
if ((size_t) (finfo->data_end - data) < sizeof (struct extern_res_directory))
|
||||
overrun (finfo, _("directory"));
|
||||
if ((size_t) (flaginfo->data_end - data) < sizeof (struct extern_res_directory))
|
||||
overrun (flaginfo, _("directory"));
|
||||
|
||||
erd = (const struct extern_res_directory *) data;
|
||||
|
||||
|
@ -214,8 +214,8 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
const bfd_byte *ers;
|
||||
int length, j;
|
||||
|
||||
if ((const bfd_byte *) ere >= finfo->data_end)
|
||||
overrun (finfo, _("named directory entry"));
|
||||
if ((const bfd_byte *) ere >= flaginfo->data_end)
|
||||
overrun (flaginfo, _("named directory entry"));
|
||||
|
||||
name = windres_get_32 (wrbfd, ere->name, 4);
|
||||
rva = windres_get_32 (wrbfd, ere->rva, 4);
|
||||
|
@ -223,10 +223,10 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
/* For some reason the high bit in NAME is set. */
|
||||
name &=~ 0x80000000;
|
||||
|
||||
if (name > (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("directory entry name"));
|
||||
if (name > (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("directory entry name"));
|
||||
|
||||
ers = finfo->data + name;
|
||||
ers = flaginfo->data + name;
|
||||
|
||||
re = (rc_res_entry *) res_alloc (sizeof *re);
|
||||
re->next = NULL;
|
||||
|
@ -243,18 +243,18 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
if ((rva & 0x80000000) != 0)
|
||||
{
|
||||
rva &=~ 0x80000000;
|
||||
if (rva >= (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("named subdirectory"));
|
||||
if (rva >= (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("named subdirectory"));
|
||||
re->subdir = 1;
|
||||
re->u.dir = read_coff_res_dir (wrbfd, finfo->data + rva, finfo, type,
|
||||
re->u.dir = read_coff_res_dir (wrbfd, flaginfo->data + rva, flaginfo, type,
|
||||
level + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rva >= (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("named resource"));
|
||||
if (rva >= (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("named resource"));
|
||||
re->subdir = 0;
|
||||
re->u.res = read_coff_data_entry (wrbfd, finfo->data + rva, finfo, type);
|
||||
re->u.res = read_coff_data_entry (wrbfd, flaginfo->data + rva, flaginfo, type);
|
||||
}
|
||||
|
||||
*pp = re;
|
||||
|
@ -266,8 +266,8 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
unsigned long name, rva;
|
||||
rc_res_entry *re;
|
||||
|
||||
if ((const bfd_byte *) ere >= finfo->data_end)
|
||||
overrun (finfo, _("ID directory entry"));
|
||||
if ((const bfd_byte *) ere >= flaginfo->data_end)
|
||||
overrun (flaginfo, _("ID directory entry"));
|
||||
|
||||
name = windres_get_32 (wrbfd, ere->name, 4);
|
||||
rva = windres_get_32 (wrbfd, ere->rva, 4);
|
||||
|
@ -283,18 +283,18 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
if ((rva & 0x80000000) != 0)
|
||||
{
|
||||
rva &=~ 0x80000000;
|
||||
if (rva >= (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("ID subdirectory"));
|
||||
if (rva >= (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("ID subdirectory"));
|
||||
re->subdir = 1;
|
||||
re->u.dir = read_coff_res_dir (wrbfd, finfo->data + rva, finfo, type,
|
||||
re->u.dir = read_coff_res_dir (wrbfd, flaginfo->data + rva, flaginfo, type,
|
||||
level + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rva >= (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("ID resource"));
|
||||
if (rva >= (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("ID resource"));
|
||||
re->subdir = 0;
|
||||
re->u.res = read_coff_data_entry (wrbfd, finfo->data + rva, finfo, type);
|
||||
re->u.res = read_coff_data_entry (wrbfd, flaginfo->data + rva, flaginfo, type);
|
||||
}
|
||||
|
||||
*pp = re;
|
||||
|
@ -308,7 +308,7 @@ read_coff_res_dir (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
|
||||
static rc_res_resource *
|
||||
read_coff_data_entry (windres_bfd *wrbfd, const bfd_byte *data,
|
||||
const struct coff_file_info *finfo,
|
||||
const struct coff_file_info *flaginfo,
|
||||
const rc_res_id *type)
|
||||
{
|
||||
const struct extern_res_data *erd;
|
||||
|
@ -319,21 +319,21 @@ read_coff_data_entry (windres_bfd *wrbfd, const bfd_byte *data,
|
|||
if (type == NULL)
|
||||
fatal (_("resource type unknown"));
|
||||
|
||||
if ((size_t) (finfo->data_end - data) < sizeof (struct extern_res_data))
|
||||
overrun (finfo, _("data entry"));
|
||||
if ((size_t) (flaginfo->data_end - data) < sizeof (struct extern_res_data))
|
||||
overrun (flaginfo, _("data entry"));
|
||||
|
||||
erd = (const struct extern_res_data *) data;
|
||||
|
||||
size = windres_get_32 (wrbfd, erd->size, 4);
|
||||
rva = windres_get_32 (wrbfd, erd->rva, 4);
|
||||
if (rva < finfo->secaddr
|
||||
|| rva - finfo->secaddr >= (rc_uint_type) (finfo->data_end - finfo->data))
|
||||
overrun (finfo, _("resource data"));
|
||||
if (rva < flaginfo->secaddr
|
||||
|| rva - flaginfo->secaddr >= (rc_uint_type) (flaginfo->data_end - flaginfo->data))
|
||||
overrun (flaginfo, _("resource data"));
|
||||
|
||||
resdata = finfo->data + (rva - finfo->secaddr);
|
||||
resdata = flaginfo->data + (rva - flaginfo->secaddr);
|
||||
|
||||
if (size > (rc_uint_type) (finfo->data_end - resdata))
|
||||
overrun (finfo, _("resource data size"));
|
||||
if (size > (rc_uint_type) (flaginfo->data_end - resdata))
|
||||
overrun (flaginfo, _("resource data size"));
|
||||
|
||||
r = bin_to_res (wrbfd, *type, resdata, size);
|
||||
|
||||
|
|
Loading…
Reference in a new issue