mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-15 05:01:13 +08:00
Add new style linker support to COFF backend. a29k only for now.
* cofflink.c: New file. * libcoff-in.h: Include bfdlink.h. (obj_coff_external_syms, obj_coff_strings): Define accessor macro. (obj_coff_sym_hashes): Define accessor macro. (struct coff_tdata): Add fields external_syms, strings, and sym_hashes. (struct coff_link_hash_entry): Define. (struct coff_link_hash_table): Define. (coff_link_hash_lookup, coff_link_hash_traverse): Define. (coff_hash_table): Define. (_bfd_coff_link_hash_table_create): Declare. (_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare. * coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz, _bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global, _bfd_coff_compute_section_file_positions, _bfd_coff_relocate_section. (bfd_coff_relsz, bfd_coff_swap_reloc_in): Define. (bfd_coff_sym_is_global): Define. (bfd_coff_compute_section_file_positions): Define. (bfd_coff_relocate_section): Define. (coff_mkobject_hook): Initialize obj_raw_syment_count and obj_conv_table_size. (coff_compute_section_file_positions): Set target_index of all sections. Set output_has_begun field. (coff_write_object_contents): Don't set target_index; now done by coff_compute_section_file_positions. Remove obsolete handling of scn_base and data_base. Don't bother to check that target_index is positive, since it always is. Remove use of pad, which is always zero. Check obj_raw_syment_count, not bfd_get_symcount, for the number of symbols, but only write them out if bfd_get_symcount is non-zero. (coff_slurp_symbol_table): Use obj_raw_syment_count, not bfd_get_symcount for the number of symbols. Don't set obj_conv_table_size. (coff_sym_is_global): New static function or macro. (coff_slurp_reloc_table): Call coff_swap_reloc_in, not bfd_swap_reloc_in. (coff_bfd_link_hash_table_create): If coff_relocate_section is defined, define as _bfd_coff_link_hash_table_create. (coff_bfd_link_add_symbols): Similar change. (coff_bfd_final_link): Similar change. (coff_relocate_section): Define as NULL if not defined. (bfd_coff_std_swap_table): Initialize new fields. * coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count and obj_conv_table_size here. (coff_count_linenumbers): Reindent. If bfd_get_symcount is zero, add up the line numbers from the sections. (coff_write_symbols): Don't set bfd_get_symcount. (coff_pointerize_aux): Don't pointerize a nonpositive x_endndx field. (coff_get_normalized_symtab): Use obj_raw_syment_count, not bfd_get_symcount. (coff_print_symbol): If auxp->fix_end, print x_endndx value. * coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in. Reindent. Change argument type to PTR. * coff-a29k.c (coff_a29k_relocate_section): New static function. (coff_relocate_section): Define. * configure.in (a29kcoff_big_vec): Compile cofflink.o. * coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields. * coff-mips.c (mips_ecoff_backend_data): Likewise. * libcoff.h: Rebuilt. * Makefile.in: Rebuilt dependencies. (BFD32_BACKENDS): Add cofflink.o. (CFILES): Add cofflink.c.
This commit is contained in:
@ -78,6 +78,7 @@ coff-we32k.c
|
|||||||
coff-z8k.c
|
coff-z8k.c
|
||||||
coffcode.h
|
coffcode.h
|
||||||
coffgen.c
|
coffgen.c
|
||||||
|
cofflink.c
|
||||||
coffswap.h
|
coffswap.h
|
||||||
config
|
config
|
||||||
config.bfd
|
config.bfd
|
||||||
|
@ -1,3 +1,71 @@
|
|||||||
|
Tue Sep 6 14:51:11 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||||
|
|
||||||
|
Add new style linker support to COFF backend. a29k only for now.
|
||||||
|
* cofflink.c: New file.
|
||||||
|
* libcoff-in.h: Include bfdlink.h.
|
||||||
|
(obj_coff_external_syms, obj_coff_strings): Define accessor macro.
|
||||||
|
(obj_coff_sym_hashes): Define accessor macro.
|
||||||
|
(struct coff_tdata): Add fields external_syms, strings, and
|
||||||
|
sym_hashes.
|
||||||
|
(struct coff_link_hash_entry): Define.
|
||||||
|
(struct coff_link_hash_table): Define.
|
||||||
|
(coff_link_hash_lookup, coff_link_hash_traverse): Define.
|
||||||
|
(coff_hash_table): Define.
|
||||||
|
(_bfd_coff_link_hash_table_create): Declare.
|
||||||
|
(_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare.
|
||||||
|
* coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz,
|
||||||
|
_bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global,
|
||||||
|
_bfd_coff_compute_section_file_positions,
|
||||||
|
_bfd_coff_relocate_section.
|
||||||
|
(bfd_coff_relsz, bfd_coff_swap_reloc_in): Define.
|
||||||
|
(bfd_coff_sym_is_global): Define.
|
||||||
|
(bfd_coff_compute_section_file_positions): Define.
|
||||||
|
(bfd_coff_relocate_section): Define.
|
||||||
|
(coff_mkobject_hook): Initialize obj_raw_syment_count and
|
||||||
|
obj_conv_table_size.
|
||||||
|
(coff_compute_section_file_positions): Set target_index of all
|
||||||
|
sections. Set output_has_begun field.
|
||||||
|
(coff_write_object_contents): Don't set target_index; now done by
|
||||||
|
coff_compute_section_file_positions. Remove obsolete handling of
|
||||||
|
scn_base and data_base. Don't bother to check that target_index
|
||||||
|
is positive, since it always is. Remove use of pad, which is
|
||||||
|
always zero. Check obj_raw_syment_count, not bfd_get_symcount,
|
||||||
|
for the number of symbols, but only write them out if
|
||||||
|
bfd_get_symcount is non-zero.
|
||||||
|
(coff_slurp_symbol_table): Use obj_raw_syment_count, not
|
||||||
|
bfd_get_symcount for the number of symbols. Don't set
|
||||||
|
obj_conv_table_size.
|
||||||
|
(coff_sym_is_global): New static function or macro.
|
||||||
|
(coff_slurp_reloc_table): Call coff_swap_reloc_in, not
|
||||||
|
bfd_swap_reloc_in.
|
||||||
|
(coff_bfd_link_hash_table_create): If coff_relocate_section is
|
||||||
|
defined, define as _bfd_coff_link_hash_table_create.
|
||||||
|
(coff_bfd_link_add_symbols): Similar change.
|
||||||
|
(coff_bfd_final_link): Similar change.
|
||||||
|
(coff_relocate_section): Define as NULL if not defined.
|
||||||
|
(bfd_coff_std_swap_table): Initialize new fields.
|
||||||
|
* coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count
|
||||||
|
and obj_conv_table_size here.
|
||||||
|
(coff_count_linenumbers): Reindent. If bfd_get_symcount is zero,
|
||||||
|
add up the line numbers from the sections.
|
||||||
|
(coff_write_symbols): Don't set bfd_get_symcount.
|
||||||
|
(coff_pointerize_aux): Don't pointerize a nonpositive x_endndx
|
||||||
|
field.
|
||||||
|
(coff_get_normalized_symtab): Use obj_raw_syment_count, not
|
||||||
|
bfd_get_symcount.
|
||||||
|
(coff_print_symbol): If auxp->fix_end, print x_endndx value.
|
||||||
|
* coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in.
|
||||||
|
Reindent. Change argument type to PTR.
|
||||||
|
* coff-a29k.c (coff_a29k_relocate_section): New static function.
|
||||||
|
(coff_relocate_section): Define.
|
||||||
|
* configure.in (a29kcoff_big_vec): Compile cofflink.o.
|
||||||
|
* coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields.
|
||||||
|
* coff-mips.c (mips_ecoff_backend_data): Likewise.
|
||||||
|
* libcoff.h: Rebuilt.
|
||||||
|
* Makefile.in: Rebuilt dependencies.
|
||||||
|
(BFD32_BACKENDS): Add cofflink.o.
|
||||||
|
(CFILES): Add cofflink.c.
|
||||||
|
|
||||||
Tue Sep 6 14:00:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
Tue Sep 6 14:00:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||||
|
|
||||||
* coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check
|
* coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check
|
||||||
|
221
bfd/coff-a29k.c
221
bfd/coff-a29k.c
@ -31,6 +31,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
static long get_symbol_value PARAMS ((asymbol *));
|
static long get_symbol_value PARAMS ((asymbol *));
|
||||||
static bfd_reloc_status_type a29k_reloc
|
static bfd_reloc_status_type a29k_reloc
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||||
|
static boolean coff_a29k_relocate_section
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||||
|
struct internal_reloc *, struct internal_syment *, asection **));
|
||||||
|
|
||||||
#define INSERT_HWORD(WORD,HWORD) \
|
#define INSERT_HWORD(WORD,HWORD) \
|
||||||
(((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
|
(((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
|
||||||
@ -303,6 +306,224 @@ reloc_processing (relent,reloc, symbols, abfd, section)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The reloc processing routine for the optimized COFF linker. */
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||||
|
contents, relocs, syms, sections)
|
||||||
|
bfd *output_bfd;
|
||||||
|
struct bfd_link_info *info;
|
||||||
|
bfd *input_bfd;
|
||||||
|
asection *input_section;
|
||||||
|
bfd_byte *contents;
|
||||||
|
struct internal_reloc *relocs;
|
||||||
|
struct internal_syment *syms;
|
||||||
|
asection **sections;
|
||||||
|
{
|
||||||
|
struct internal_reloc *rel;
|
||||||
|
struct internal_reloc *relend;
|
||||||
|
boolean hihalf;
|
||||||
|
bfd_vma hihalf_val;
|
||||||
|
|
||||||
|
/* If we are performing a relocateable link, we don't need to do a
|
||||||
|
thing. The caller will take care of adjusting the reloc
|
||||||
|
addresses and symbol indices. */
|
||||||
|
if (info->relocateable)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
hihalf = false;
|
||||||
|
hihalf_val = 0;
|
||||||
|
|
||||||
|
rel = relocs;
|
||||||
|
relend = rel + input_section->reloc_count;
|
||||||
|
for (; rel < relend; rel++)
|
||||||
|
{
|
||||||
|
long symndx;
|
||||||
|
bfd_byte *loc;
|
||||||
|
struct coff_link_hash_entry *h;
|
||||||
|
struct internal_syment *sym;
|
||||||
|
asection *sec;
|
||||||
|
bfd_vma val;
|
||||||
|
boolean overflow;
|
||||||
|
unsigned long insn;
|
||||||
|
long signed_value;
|
||||||
|
unsigned long unsigned_value;
|
||||||
|
bfd_reloc_status_type rstat;
|
||||||
|
|
||||||
|
symndx = rel->r_symndx;
|
||||||
|
loc = contents + rel->r_vaddr - input_section->vma;
|
||||||
|
|
||||||
|
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||||
|
|
||||||
|
sym = NULL;
|
||||||
|
sec = NULL;
|
||||||
|
val = 0;
|
||||||
|
|
||||||
|
/* An R_IHCONST reloc does not have a symbol. Instead, the
|
||||||
|
symbol index is an addend. R_IHCONST is always used in
|
||||||
|
conjunction with R_IHHALF. */
|
||||||
|
if (rel->r_type != R_IHCONST)
|
||||||
|
{
|
||||||
|
if (h == NULL)
|
||||||
|
{
|
||||||
|
sym = syms + symndx;
|
||||||
|
sec = sections[symndx];
|
||||||
|
val = (sec->output_section->vma
|
||||||
|
+ sec->output_offset
|
||||||
|
+ sym->n_value
|
||||||
|
- sec->vma);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (h->root.type == bfd_link_hash_defined)
|
||||||
|
{
|
||||||
|
sec = h->root.u.def.section;
|
||||||
|
val = (h->root.u.def.value
|
||||||
|
+ sec->output_section->vma
|
||||||
|
+ sec->output_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! ((*info->callbacks->undefined_symbol)
|
||||||
|
(info, h->root.root.string, input_bfd, input_section,
|
||||||
|
rel->r_vaddr - input_section->vma)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hihalf)
|
||||||
|
{
|
||||||
|
if (! ((*info->callbacks->reloc_dangerous)
|
||||||
|
(info, "missing IHCONST reloc", input_bfd,
|
||||||
|
input_section, rel->r_vaddr - input_section->vma)))
|
||||||
|
return false;
|
||||||
|
hihalf = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
overflow = false;
|
||||||
|
|
||||||
|
switch (rel->r_type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
bfd_set_error (bfd_error_bad_value);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case R_IREL:
|
||||||
|
insn = bfd_get_32 (input_bfd, loc);
|
||||||
|
|
||||||
|
/* Extract the addend. */
|
||||||
|
signed_value = EXTRACT_HWORD (insn);
|
||||||
|
signed_value = SIGN_EXTEND_HWORD (signed_value);
|
||||||
|
signed_value <<= 2;
|
||||||
|
|
||||||
|
/* Determine the destination of the jump. */
|
||||||
|
signed_value += val + rel->r_vaddr - input_section->vma;
|
||||||
|
|
||||||
|
if ((signed_value & ~0x3ffff) == 0)
|
||||||
|
{
|
||||||
|
/* We can use an absolute jump. */
|
||||||
|
insn |= (1 << 24);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Make the destination PC relative. */
|
||||||
|
signed_value -= (input_section->output_section->vma
|
||||||
|
+ input_section->output_offset
|
||||||
|
+ (rel->r_vaddr - input_section->vma));
|
||||||
|
if (signed_value > 0x1ffff || signed_value < - 0x20000)
|
||||||
|
{
|
||||||
|
overflow = true;
|
||||||
|
signed_value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Put the adjusted value back into the instruction. */
|
||||||
|
signed_value >>= 2;
|
||||||
|
insn = INSERT_HWORD (insn, signed_value);
|
||||||
|
|
||||||
|
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_ILOHALF:
|
||||||
|
insn = bfd_get_32 (input_bfd, loc);
|
||||||
|
unsigned_value = EXTRACT_HWORD (insn);
|
||||||
|
unsigned_value += val;
|
||||||
|
insn = INSERT_HWORD (insn, unsigned_value);
|
||||||
|
bfd_put_32 (input_bfd, insn, loc);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_IHIHALF:
|
||||||
|
/* Save the value for the R_IHCONST reloc. */
|
||||||
|
hihalf = true;
|
||||||
|
hihalf_val = val;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_IHCONST:
|
||||||
|
if (! hihalf)
|
||||||
|
{
|
||||||
|
if (! ((*info->callbacks->reloc_dangerous)
|
||||||
|
(info, "missing IHIHALF reloc", input_bfd,
|
||||||
|
input_section, rel->r_vaddr - input_section->vma)))
|
||||||
|
return false;
|
||||||
|
hihalf_val = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
insn = bfd_get_32 (input_bfd, loc);
|
||||||
|
unsigned_value = rel->r_symndx + hihalf_val;
|
||||||
|
unsigned_value >>= 16;
|
||||||
|
insn = INSERT_HWORD (insn, unsigned_value);
|
||||||
|
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||||
|
|
||||||
|
hihalf = false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_BYTE:
|
||||||
|
case R_HWORD:
|
||||||
|
case R_WORD:
|
||||||
|
rstat = _bfd_relocate_contents (howto_table + rel->r_type,
|
||||||
|
input_bfd, val, loc);
|
||||||
|
if (rstat == bfd_reloc_overflow)
|
||||||
|
overflow = true;
|
||||||
|
else if (rstat != bfd_reloc_ok)
|
||||||
|
abort ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overflow)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
char buf[SYMNMLEN + 1];
|
||||||
|
|
||||||
|
if (h != NULL)
|
||||||
|
name = h->root.root.string;
|
||||||
|
else if (sym == NULL)
|
||||||
|
name = "*unknown*";
|
||||||
|
else if (sym->_n._n_n._n_zeroes == 0
|
||||||
|
&& sym->_n._n_n._n_offset != 0)
|
||||||
|
name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy (buf, sym->_n._n_name, SYMNMLEN);
|
||||||
|
buf[SYMNMLEN] = '\0';
|
||||||
|
name = buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! ((*info->callbacks->reloc_overflow)
|
||||||
|
(info, name, howto_table[rel->r_type].name, (bfd_vma) 0,
|
||||||
|
input_bfd, input_section,
|
||||||
|
rel->r_vaddr - input_section->vma)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define coff_relocate_section coff_a29k_relocate_section
|
||||||
|
|
||||||
#include "coffcode.h"
|
#include "coffcode.h"
|
||||||
|
|
||||||
const bfd_target a29kcoff_big_vec =
|
const bfd_target a29kcoff_big_vec =
|
||||||
|
@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
|
static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
|
||||||
static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
|
static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
|
||||||
|
static PTR alpha_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
|
||||||
static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
|
static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
|
||||||
struct internal_reloc *));
|
struct internal_reloc *));
|
||||||
static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,
|
static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,
|
||||||
@ -472,6 +473,40 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a hook called by coff_real_object_p to create any backend
|
||||||
|
specific information. */
|
||||||
|
|
||||||
|
static PTR
|
||||||
|
alpha_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
|
||||||
|
bfd *abfd;
|
||||||
|
PTR filehdr;
|
||||||
|
PTR aouthdr;
|
||||||
|
{
|
||||||
|
PTR ecoff;
|
||||||
|
|
||||||
|
ecoff = _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr);
|
||||||
|
|
||||||
|
if (ecoff != NULL)
|
||||||
|
{
|
||||||
|
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
|
||||||
|
|
||||||
|
/* Set additional BFD flags according to the object type from the
|
||||||
|
machine specific file header flags. */
|
||||||
|
switch (internal_f->f_flags & F_ALPHA_OBJECT_TYPE_MASK)
|
||||||
|
{
|
||||||
|
case F_ALPHA_SHARABLE:
|
||||||
|
abfd->flags |= DYNAMIC;
|
||||||
|
break;
|
||||||
|
case F_ALPHA_CALL_SHARED:
|
||||||
|
/* Always executable if using shared libraries as the run time
|
||||||
|
loader might resolve undefined references. */
|
||||||
|
abfd->flags |= (DYNAMIC | EXEC_P);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ecoff;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reloc handling. */
|
/* Reloc handling. */
|
||||||
|
|
||||||
@ -641,7 +676,7 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
|
|||||||
some reason the address of this reloc type is not adjusted by
|
some reason the address of this reloc type is not adjusted by
|
||||||
the section vma. We record the gp value for this object file
|
the section vma. We record the gp value for this object file
|
||||||
here, for convenience when doing the GPDISP relocation. */
|
here, for convenience when doing the GPDISP relocation. */
|
||||||
rptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
rptr->address = intern->r_vaddr;
|
rptr->address = intern->r_vaddr;
|
||||||
rptr->addend = ecoff_data (abfd)->gp;
|
rptr->addend = ecoff_data (abfd)->gp;
|
||||||
break;
|
break;
|
||||||
@ -954,7 +989,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
|||||||
/* Figure out the relocation of this symbol. */
|
/* Figure out the relocation of this symbol. */
|
||||||
symbol = *rel->sym_ptr_ptr;
|
symbol = *rel->sym_ptr_ptr;
|
||||||
|
|
||||||
if (symbol->section == &bfd_und_section)
|
if (bfd_is_und_section (symbol->section))
|
||||||
r = bfd_reloc_undefined;
|
r = bfd_reloc_undefined;
|
||||||
|
|
||||||
if (bfd_is_com_section (symbol->section))
|
if (bfd_is_com_section (symbol->section))
|
||||||
@ -1014,7 +1049,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
|||||||
/* Figure out the relocation of this symbol. */
|
/* Figure out the relocation of this symbol. */
|
||||||
symbol = *rel->sym_ptr_ptr;
|
symbol = *rel->sym_ptr_ptr;
|
||||||
|
|
||||||
if (symbol->section == &bfd_und_section)
|
if (bfd_is_und_section (symbol->section))
|
||||||
r = bfd_reloc_undefined;
|
r = bfd_reloc_undefined;
|
||||||
|
|
||||||
if (bfd_is_com_section (symbol->section))
|
if (bfd_is_com_section (symbol->section))
|
||||||
@ -1047,7 +1082,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
|||||||
/* Figure out the relocation of this symbol. */
|
/* Figure out the relocation of this symbol. */
|
||||||
symbol = *rel->sym_ptr_ptr;
|
symbol = *rel->sym_ptr_ptr;
|
||||||
|
|
||||||
if (symbol->section == &bfd_und_section)
|
if (bfd_is_und_section (symbol->section))
|
||||||
r = bfd_reloc_undefined;
|
r = bfd_reloc_undefined;
|
||||||
|
|
||||||
if (bfd_is_com_section (symbol->section))
|
if (bfd_is_com_section (symbol->section))
|
||||||
@ -1382,7 +1417,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
bfd_get_section_by_name (input_bfd, ".fini");
|
bfd_get_section_by_name (input_bfd, ".fini");
|
||||||
symndx_to_section[RELOC_SECTION_LITA] =
|
symndx_to_section[RELOC_SECTION_LITA] =
|
||||||
bfd_get_section_by_name (input_bfd, ".lita");
|
bfd_get_section_by_name (input_bfd, ".lita");
|
||||||
symndx_to_section[RELOC_SECTION_ABS] = &bfd_abs_section;
|
symndx_to_section[RELOC_SECTION_ABS] = bfd_abs_section_ptr;
|
||||||
|
|
||||||
ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
|
ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
|
||||||
}
|
}
|
||||||
@ -1911,13 +1946,14 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
|
|||||||
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
|
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
|
||||||
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
|
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
|
||||||
alpha_ecoff_swap_scnhdr_out,
|
alpha_ecoff_swap_scnhdr_out,
|
||||||
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, true,
|
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true,
|
||||||
alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
|
alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
|
||||||
alpha_ecoff_swap_scnhdr_in, alpha_ecoff_bad_format_hook,
|
alpha_ecoff_swap_scnhdr_in, NULL,
|
||||||
_bfd_ecoff_set_arch_mach_hook, _bfd_ecoff_mkobject_hook,
|
alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
|
||||||
_bfd_ecoff_styp_to_sec_flags, _bfd_ecoff_make_section_hook,
|
alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
||||||
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
_bfd_ecoff_make_section_hook, _bfd_ecoff_set_alignment_hook,
|
||||||
NULL, NULL
|
_bfd_ecoff_slurp_symbol_table,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL
|
||||||
},
|
},
|
||||||
/* Supported architecture. */
|
/* Supported architecture. */
|
||||||
bfd_arch_alpha,
|
bfd_arch_alpha,
|
||||||
@ -2004,7 +2040,7 @@ const bfd_target ecoffalpha_little_vec =
|
|||||||
|
|
||||||
(HAS_RELOC | EXEC_P | /* object flags */
|
(HAS_RELOC | EXEC_P | /* object flags */
|
||||||
HAS_LINENO | HAS_DEBUG |
|
HAS_LINENO | HAS_DEBUG |
|
||||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||||
|
|
||||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
|
||||||
flags */
|
flags */
|
||||||
|
@ -542,7 +542,7 @@ mips_adjust_reloc_in (abfd, intern, rptr)
|
|||||||
/* If the type is MIPS_R_IGNORE, make sure this is a reference to
|
/* If the type is MIPS_R_IGNORE, make sure this is a reference to
|
||||||
the absolute section so that the reloc is ignored. */
|
the absolute section so that the reloc is ignored. */
|
||||||
if (intern->r_type == MIPS_R_IGNORE)
|
if (intern->r_type == MIPS_R_IGNORE)
|
||||||
rptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
|
rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
|
|
||||||
/* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or
|
/* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or
|
||||||
MIPS_R_RELLO reloc, we want the addend field of the BFD relocto
|
MIPS_R_RELLO reloc, we want the addend field of the BFD relocto
|
||||||
@ -657,7 +657,7 @@ mips_refhi_reloc (abfd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = bfd_reloc_ok;
|
ret = bfd_reloc_ok;
|
||||||
if (symbol->section == &bfd_und_section
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& output_bfd == (bfd *) NULL)
|
&& output_bfd == (bfd *) NULL)
|
||||||
ret = bfd_reloc_undefined;
|
ret = bfd_reloc_undefined;
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ mips_gprel_reloc (abfd,
|
|||||||
output_bfd = symbol->section->output_section->owner;
|
output_bfd = symbol->section->output_section->owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol->section == &bfd_und_section
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& relocateable == false)
|
&& relocateable == false)
|
||||||
return bfd_reloc_undefined;
|
return bfd_reloc_undefined;
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ mips_relhi_reloc (abfd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = bfd_reloc_ok;
|
ret = bfd_reloc_ok;
|
||||||
if (symbol->section == &bfd_und_section
|
if (bfd_is_und_section (symbol->section)
|
||||||
&& output_bfd == (bfd *) NULL)
|
&& output_bfd == (bfd *) NULL)
|
||||||
ret = bfd_reloc_undefined;
|
ret = bfd_reloc_undefined;
|
||||||
|
|
||||||
@ -990,7 +990,7 @@ mips_rello_reloc (abfd,
|
|||||||
symbol is not defined we don't want to do this, because we
|
symbol is not defined we don't want to do this, because we
|
||||||
don't want the value in the object file to incorporate the
|
don't want the value in the object file to incorporate the
|
||||||
address of the reloc. */
|
address of the reloc. */
|
||||||
if (bfd_get_section (symbol) != &bfd_und_section
|
if (! bfd_is_und_section (bfd_get_section (symbol))
|
||||||
&& ! bfd_is_com_section (bfd_get_section (symbol)))
|
&& ! bfd_is_com_section (bfd_get_section (symbol)))
|
||||||
val -= (input_section->output_section->vma
|
val -= (input_section->output_section->vma
|
||||||
+ input_section->output_offset
|
+ input_section->output_offset
|
||||||
@ -2275,13 +2275,14 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
|
|||||||
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
|
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
|
||||||
mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
|
mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
|
||||||
mips_ecoff_swap_scnhdr_out,
|
mips_ecoff_swap_scnhdr_out,
|
||||||
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, true,
|
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, true,
|
||||||
mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
|
mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
|
||||||
mips_ecoff_swap_scnhdr_in, mips_ecoff_bad_format_hook,
|
mips_ecoff_swap_scnhdr_in, NULL,
|
||||||
_bfd_ecoff_set_arch_mach_hook, _bfd_ecoff_mkobject_hook,
|
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
|
||||||
_bfd_ecoff_styp_to_sec_flags, _bfd_ecoff_make_section_hook,
|
_bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
||||||
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
_bfd_ecoff_make_section_hook, _bfd_ecoff_set_alignment_hook,
|
||||||
NULL, NULL
|
_bfd_ecoff_slurp_symbol_table,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL
|
||||||
},
|
},
|
||||||
/* Supported architecture. */
|
/* Supported architecture. */
|
||||||
bfd_arch_mips,
|
bfd_arch_mips,
|
||||||
|
345
bfd/coffcode.h
345
bfd/coffcode.h
@ -608,6 +608,7 @@ dependent COFF routines:
|
|||||||
. unsigned int _bfd_scnhsz;
|
. unsigned int _bfd_scnhsz;
|
||||||
. unsigned int _bfd_symesz;
|
. unsigned int _bfd_symesz;
|
||||||
. unsigned int _bfd_auxesz;
|
. unsigned int _bfd_auxesz;
|
||||||
|
. unsigned int _bfd_relsz;
|
||||||
. unsigned int _bfd_linesz;
|
. unsigned int _bfd_linesz;
|
||||||
. boolean _bfd_coff_long_filenames;
|
. boolean _bfd_coff_long_filenames;
|
||||||
. void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
. void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||||
@ -622,6 +623,10 @@ dependent COFF routines:
|
|||||||
. bfd *abfd,
|
. bfd *abfd,
|
||||||
. PTR ext,
|
. PTR ext,
|
||||||
. PTR in));
|
. PTR in));
|
||||||
|
. void (*_bfd_coff_swap_reloc_in) PARAMS ((
|
||||||
|
. bfd *abfd,
|
||||||
|
. PTR ext,
|
||||||
|
. PTR in));
|
||||||
. boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
. boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
||||||
. bfd *abfd,
|
. bfd *abfd,
|
||||||
. PTR internal_filehdr));
|
. PTR internal_filehdr));
|
||||||
@ -662,6 +667,20 @@ dependent COFF routines:
|
|||||||
. arelent *r,
|
. arelent *r,
|
||||||
. unsigned int shrink,
|
. unsigned int shrink,
|
||||||
. struct bfd_link_info *link_info));
|
. struct bfd_link_info *link_info));
|
||||||
|
. boolean (*_bfd_coff_sym_is_global) PARAMS ((
|
||||||
|
. bfd *abfd,
|
||||||
|
. struct internal_syment *));
|
||||||
|
. void (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||||
|
. bfd *abfd));
|
||||||
|
. boolean (*_bfd_coff_relocate_section) PARAMS ((
|
||||||
|
. bfd *output_bfd,
|
||||||
|
. struct bfd_link_info *info,
|
||||||
|
. bfd *input_bfd,
|
||||||
|
. asection *input_section,
|
||||||
|
. bfd_byte *contents,
|
||||||
|
. struct internal_reloc *relocs,
|
||||||
|
. struct internal_syment *syms,
|
||||||
|
. asection **sections));
|
||||||
.
|
.
|
||||||
.} bfd_coff_backend_data;
|
.} bfd_coff_backend_data;
|
||||||
.
|
.
|
||||||
@ -702,6 +721,7 @@ dependent COFF routines:
|
|||||||
.#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
.#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
||||||
.#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
.#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
||||||
.#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
.#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||||
|
.#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||||
.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||||
.#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
.#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||||
.#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
.#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||||
@ -713,6 +733,9 @@ dependent COFF routines:
|
|||||||
.#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
.#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
||||||
. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
||||||
.
|
.
|
||||||
|
.#define bfd_coff_swap_reloc_in(abfd, i, o) \
|
||||||
|
. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
|
||||||
|
.
|
||||||
.#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
.#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
||||||
. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
||||||
.
|
.
|
||||||
@ -744,6 +767,18 @@ dependent COFF routines:
|
|||||||
. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||||
. (abfd, section, reloc, shrink, link_info))
|
. (abfd, section, reloc, shrink, link_info))
|
||||||
.
|
.
|
||||||
|
.#define bfd_coff_sym_is_global(abfd, sym)\
|
||||||
|
. ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
|
||||||
|
. (abfd, sym))
|
||||||
|
.
|
||||||
|
.#define bfd_coff_compute_section_file_positions(abfd)\
|
||||||
|
. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
|
||||||
|
. (abfd))
|
||||||
|
.
|
||||||
|
.#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
|
||||||
|
. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
|
||||||
|
. (obfd, info, ibfd, o, con, rel, isyms, secs))
|
||||||
|
.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* See whether the magic number matches. */
|
/* See whether the magic number matches. */
|
||||||
@ -863,7 +898,6 @@ coff_mkobject (abfd)
|
|||||||
coff->symbols = (coff_symbol_type *) NULL;
|
coff->symbols = (coff_symbol_type *) NULL;
|
||||||
coff->conversion_table = (unsigned int *) NULL;
|
coff->conversion_table = (unsigned int *) NULL;
|
||||||
coff->raw_syments = (struct coff_ptr_struct *) NULL;
|
coff->raw_syments = (struct coff_ptr_struct *) NULL;
|
||||||
coff->raw_linenos = (struct lineno *) NULL;
|
|
||||||
coff->relocbase = 0;
|
coff->relocbase = 0;
|
||||||
/* make_abs_section(abfd);*/
|
/* make_abs_section(abfd);*/
|
||||||
return true;
|
return true;
|
||||||
@ -886,7 +920,6 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
|
|||||||
coff = coff_data (abfd);
|
coff = coff_data (abfd);
|
||||||
|
|
||||||
coff->sym_filepos = internal_f->f_symptr;
|
coff->sym_filepos = internal_f->f_symptr;
|
||||||
coff->flags = internal_f->f_flags;
|
|
||||||
|
|
||||||
/* These members communicate important constants about the symbol
|
/* These members communicate important constants about the symbol
|
||||||
table to GDB's symbol-reading code. These `constants'
|
table to GDB's symbol-reading code. These `constants'
|
||||||
@ -899,6 +932,10 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
|
|||||||
coff->local_auxesz = AUXESZ;
|
coff->local_auxesz = AUXESZ;
|
||||||
coff->local_linesz = LINESZ;
|
coff->local_linesz = LINESZ;
|
||||||
|
|
||||||
|
obj_raw_syment_count (abfd) =
|
||||||
|
obj_conv_table_size (abfd) =
|
||||||
|
internal_f->f_nsyms;
|
||||||
|
|
||||||
return (PTR) coff;
|
return (PTR) coff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1386,6 +1423,8 @@ coff_compute_section_file_positions (abfd)
|
|||||||
#ifndef I960
|
#ifndef I960
|
||||||
file_ptr old_sofar;
|
file_ptr old_sofar;
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
if (bfd_get_start_address (abfd))
|
if (bfd_get_start_address (abfd))
|
||||||
{
|
{
|
||||||
/* A start address may have been added to the original file. In this
|
/* A start address may have been added to the original file. In this
|
||||||
@ -1397,10 +1436,11 @@ coff_compute_section_file_positions (abfd)
|
|||||||
sofar += AOUTSZ;
|
sofar += AOUTSZ;
|
||||||
|
|
||||||
sofar += abfd->section_count * SCNHSZ;
|
sofar += abfd->section_count * SCNHSZ;
|
||||||
for (current = abfd->sections;
|
for (current = abfd->sections, count = 1;
|
||||||
current != (asection *) NULL;
|
current != (asection *) NULL;
|
||||||
current = current->next)
|
current = current->next, ++count)
|
||||||
{
|
{
|
||||||
|
current->target_index = count;
|
||||||
|
|
||||||
/* Only deal with sections which have contents */
|
/* Only deal with sections which have contents */
|
||||||
if (!(current->flags & SEC_HAS_CONTENTS))
|
if (!(current->flags & SEC_HAS_CONTENTS))
|
||||||
@ -1454,6 +1494,7 @@ coff_compute_section_file_positions (abfd)
|
|||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
obj_relocbase (abfd) = sofar;
|
obj_relocbase (abfd) = sofar;
|
||||||
|
abfd->output_has_begun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RS6000COFF_C
|
#ifndef RS6000COFF_C
|
||||||
@ -1538,15 +1579,11 @@ coff_write_object_contents (abfd)
|
|||||||
bfd * abfd;
|
bfd * abfd;
|
||||||
{
|
{
|
||||||
asection *current;
|
asection *current;
|
||||||
unsigned int count;
|
|
||||||
|
|
||||||
boolean hasrelocs = false;
|
boolean hasrelocs = false;
|
||||||
boolean haslinno = false;
|
boolean haslinno = false;
|
||||||
file_ptr reloc_base;
|
file_ptr reloc_base;
|
||||||
file_ptr lineno_base;
|
file_ptr lineno_base;
|
||||||
file_ptr sym_base;
|
file_ptr sym_base;
|
||||||
file_ptr scn_base;
|
|
||||||
file_ptr data_base;
|
|
||||||
unsigned long reloc_size = 0;
|
unsigned long reloc_size = 0;
|
||||||
unsigned long lnno_size = 0;
|
unsigned long lnno_size = 0;
|
||||||
asection *text_sec = NULL;
|
asection *text_sec = NULL;
|
||||||
@ -1558,55 +1595,22 @@ coff_write_object_contents (abfd)
|
|||||||
|
|
||||||
|
|
||||||
bfd_set_error (bfd_error_system_call);
|
bfd_set_error (bfd_error_system_call);
|
||||||
/* Number the output sections, starting from one on the first section
|
|
||||||
with a name which doesn't start with a *.
|
|
||||||
@@ The code doesn't make this check. Is it supposed to be done,
|
|
||||||
or isn't it?? */
|
|
||||||
count = 1;
|
|
||||||
for (current = abfd->sections; current != (asection *) NULL;
|
|
||||||
current = current->next)
|
|
||||||
{
|
|
||||||
current->target_index = count;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abfd->output_has_begun == false)
|
if (abfd->output_has_begun == false)
|
||||||
{
|
coff_compute_section_file_positions (abfd);
|
||||||
coff_compute_section_file_positions (abfd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abfd->sections != (asection *) NULL)
|
|
||||||
{
|
|
||||||
scn_base = abfd->sections->filepos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scn_base = 0;
|
|
||||||
}
|
|
||||||
if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
|
|
||||||
return false;
|
|
||||||
reloc_base = obj_relocbase (abfd);
|
reloc_base = obj_relocbase (abfd);
|
||||||
|
|
||||||
/* Make a pass through the symbol table to count line number entries and
|
/* Make a pass through the symbol table to count line number entries and
|
||||||
put them into the correct asections */
|
put them into the correct asections */
|
||||||
|
|
||||||
lnno_size = coff_count_linenumbers (abfd) * LINESZ;
|
lnno_size = coff_count_linenumbers (abfd) * LINESZ;
|
||||||
data_base = scn_base;
|
|
||||||
|
|
||||||
/* Work out the size of the reloc and linno areas */
|
/* Work out the size of the reloc and linno areas */
|
||||||
|
|
||||||
for (current = abfd->sections; current != NULL; current =
|
for (current = abfd->sections; current != NULL; current =
|
||||||
current->next)
|
current->next)
|
||||||
{
|
reloc_size += current->reloc_count * RELSZ;
|
||||||
/* We give section headers to +ve indexes */
|
|
||||||
if (current->target_index > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
reloc_size += current->reloc_count * RELSZ;
|
|
||||||
data_base += SCNHSZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
lineno_base = reloc_base + reloc_size;
|
lineno_base = reloc_base + reloc_size;
|
||||||
sym_base = lineno_base + lnno_size;
|
sym_base = lineno_base + lnno_size;
|
||||||
@ -1615,33 +1619,27 @@ coff_write_object_contents (abfd)
|
|||||||
for (current = abfd->sections; current != NULL; current =
|
for (current = abfd->sections; current != NULL; current =
|
||||||
current->next)
|
current->next)
|
||||||
{
|
{
|
||||||
if (current->target_index > 0)
|
if (current->lineno_count)
|
||||||
{
|
{
|
||||||
|
current->line_filepos = lineno_base;
|
||||||
if (current->lineno_count)
|
current->moving_line_filepos = lineno_base;
|
||||||
{
|
lineno_base += current->lineno_count * LINESZ;
|
||||||
current->line_filepos = lineno_base;
|
}
|
||||||
current->moving_line_filepos = lineno_base;
|
else
|
||||||
lineno_base += current->lineno_count * LINESZ;
|
{
|
||||||
}
|
current->line_filepos = 0;
|
||||||
else
|
}
|
||||||
{
|
if (current->reloc_count)
|
||||||
current->line_filepos = 0;
|
{
|
||||||
}
|
current->rel_filepos = reloc_base;
|
||||||
if (current->reloc_count)
|
reloc_base += current->reloc_count * RELSZ;
|
||||||
{
|
}
|
||||||
current->rel_filepos = reloc_base;
|
else
|
||||||
reloc_base += current->reloc_count * RELSZ;
|
{
|
||||||
}
|
current->rel_filepos = 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
current->rel_filepos = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Write section headers to the file. */
|
/* Write section headers to the file. */
|
||||||
internal_f.f_nscns = 0;
|
internal_f.f_nscns = 0;
|
||||||
if (bfd_seek (abfd,
|
if (bfd_seek (abfd,
|
||||||
@ -1652,90 +1650,81 @@ coff_write_object_contents (abfd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
unsigned int pad = abfd->flags & D_PAGED ? data_base : 0;
|
|
||||||
#endif
|
|
||||||
unsigned int pad = 0;
|
|
||||||
|
|
||||||
for (current = abfd->sections;
|
for (current = abfd->sections;
|
||||||
current != NULL;
|
current != NULL;
|
||||||
current = current->next)
|
current = current->next)
|
||||||
{
|
{
|
||||||
struct internal_scnhdr section;
|
struct internal_scnhdr section;
|
||||||
if (current->target_index > 0)
|
|
||||||
{
|
internal_f.f_nscns++;
|
||||||
internal_f.f_nscns++;
|
strncpy (&(section.s_name[0]), current->name, 8);
|
||||||
strncpy (&(section.s_name[0]), current->name, 8);
|
|
||||||
#ifdef _LIB
|
#ifdef _LIB
|
||||||
/* Always set s_vaddr of .lib to 0. This is right for SVR3.2
|
/* Always set s_vaddr of .lib to 0. This is right for SVR3.2
|
||||||
Ian Taylor <ian@cygnus.com>. */
|
Ian Taylor <ian@cygnus.com>. */
|
||||||
if (strcmp (current->name, _LIB) == 0)
|
if (strcmp (current->name, _LIB) == 0)
|
||||||
section.s_vaddr = 0;
|
section.s_vaddr = 0;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
section.s_vaddr = current->lma + pad;
|
section.s_vaddr = current->lma;
|
||||||
section.s_paddr = current->lma + pad;
|
section.s_paddr = current->lma;
|
||||||
section.s_size = current->_raw_size - pad;
|
section.s_size = current->_raw_size;
|
||||||
/*
|
/*
|
||||||
If this section has no size or is unloadable then the scnptr
|
If this section has no size or is unloadable then the scnptr
|
||||||
will be 0 too
|
will be 0 too
|
||||||
*/
|
*/
|
||||||
if (current->_raw_size - pad == 0 ||
|
if (current->_raw_size == 0 ||
|
||||||
(current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
|
(current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
|
||||||
{
|
{
|
||||||
section.s_scnptr = 0;
|
section.s_scnptr = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
section.s_scnptr = current->filepos;
|
section.s_scnptr = current->filepos;
|
||||||
}
|
}
|
||||||
section.s_relptr = current->rel_filepos;
|
section.s_relptr = current->rel_filepos;
|
||||||
section.s_lnnoptr = current->line_filepos;
|
section.s_lnnoptr = current->line_filepos;
|
||||||
section.s_nreloc = current->reloc_count;
|
section.s_nreloc = current->reloc_count;
|
||||||
section.s_nlnno = current->lineno_count;
|
section.s_nlnno = current->lineno_count;
|
||||||
if (current->reloc_count != 0)
|
if (current->reloc_count != 0)
|
||||||
hasrelocs = true;
|
hasrelocs = true;
|
||||||
if (current->lineno_count != 0)
|
if (current->lineno_count != 0)
|
||||||
haslinno = true;
|
haslinno = true;
|
||||||
|
|
||||||
section.s_flags = sec_to_styp_flags (current->name, current->flags);
|
section.s_flags = sec_to_styp_flags (current->name, current->flags);
|
||||||
|
|
||||||
if (!strcmp (current->name, _TEXT))
|
if (!strcmp (current->name, _TEXT))
|
||||||
{
|
{
|
||||||
text_sec = current;
|
text_sec = current;
|
||||||
}
|
}
|
||||||
else if (!strcmp (current->name, _DATA))
|
else if (!strcmp (current->name, _DATA))
|
||||||
{
|
{
|
||||||
data_sec = current;
|
data_sec = current;
|
||||||
#ifdef TWO_DATA_SECS
|
#ifdef TWO_DATA_SECS
|
||||||
}
|
}
|
||||||
else if (!strcmp (current->name, ".data2"))
|
else if (!strcmp (current->name, ".data2"))
|
||||||
{
|
{
|
||||||
data_sec = current;
|
data_sec = current;
|
||||||
#endif /* TWO_DATA_SECS */
|
#endif /* TWO_DATA_SECS */
|
||||||
}
|
}
|
||||||
else if (!strcmp (current->name, _BSS))
|
else if (!strcmp (current->name, _BSS))
|
||||||
{
|
{
|
||||||
bss_sec = current;
|
bss_sec = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I960
|
#ifdef I960
|
||||||
section.s_align = (current->alignment_power
|
section.s_align = (current->alignment_power
|
||||||
? 1 << current->alignment_power
|
? 1 << current->alignment_power
|
||||||
: 0);
|
: 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SCNHDR buff;
|
SCNHDR buff;
|
||||||
|
|
||||||
coff_swap_scnhdr_out (abfd, §ion, &buff);
|
coff_swap_scnhdr_out (abfd, §ion, &buff);
|
||||||
if (bfd_write ((PTR) (&buff), 1, SCNHSZ, abfd) != SCNHSZ)
|
if (bfd_write ((PTR) (&buff), 1, SCNHSZ, abfd) != SCNHSZ)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pad = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,7 +1741,7 @@ coff_write_object_contents (abfd)
|
|||||||
*/
|
*/
|
||||||
internal_f.f_timdat = 0;
|
internal_f.f_timdat = 0;
|
||||||
|
|
||||||
if (bfd_get_symcount (abfd) != 0)
|
if (obj_raw_syment_count (abfd) != 0)
|
||||||
internal_f.f_symptr = sym_base;
|
internal_f.f_symptr = sym_base;
|
||||||
else
|
else
|
||||||
internal_f.f_symptr = 0;
|
internal_f.f_symptr = 0;
|
||||||
@ -1768,7 +1757,7 @@ coff_write_object_contents (abfd)
|
|||||||
internal_f.f_flags |= F_RELFLG;
|
internal_f.f_flags |= F_RELFLG;
|
||||||
if (!haslinno)
|
if (!haslinno)
|
||||||
internal_f.f_flags |= F_LNNO;
|
internal_f.f_flags |= F_LNNO;
|
||||||
if (0 == bfd_get_symcount (abfd))
|
if (obj_raw_syment_count (abfd) == 0)
|
||||||
internal_f.f_flags |= F_LSYMS;
|
internal_f.f_flags |= F_LSYMS;
|
||||||
if (abfd->flags & EXEC_P)
|
if (abfd->flags & EXEC_P)
|
||||||
internal_f.f_flags |= F_EXEC;
|
internal_f.f_flags |= F_EXEC;
|
||||||
@ -1893,7 +1882,7 @@ coff_write_object_contents (abfd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal_a.entry = bfd_get_start_address (abfd);
|
internal_a.entry = bfd_get_start_address (abfd);
|
||||||
internal_f.f_nsyms = bfd_get_symcount (abfd);
|
internal_f.f_nsyms = obj_raw_syment_count (abfd);
|
||||||
|
|
||||||
/* now write them */
|
/* now write them */
|
||||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
||||||
@ -2097,18 +2086,20 @@ coff_slurp_symbol_table (abfd)
|
|||||||
} /* on error */
|
} /* on error */
|
||||||
|
|
||||||
/* Allocate enough room for all the symbols in cached form */
|
/* Allocate enough room for all the symbols in cached form */
|
||||||
cached_area =
|
cached_area = ((coff_symbol_type *)
|
||||||
(coff_symbol_type *)
|
bfd_alloc (abfd,
|
||||||
bfd_alloc (abfd, (size_t) (bfd_get_symcount (abfd) * sizeof (coff_symbol_type)));
|
(obj_raw_syment_count (abfd)
|
||||||
|
* sizeof (coff_symbol_type))));
|
||||||
|
|
||||||
if (cached_area == NULL)
|
if (cached_area == NULL)
|
||||||
{
|
{
|
||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return false;
|
return false;
|
||||||
} /* on error */
|
} /* on error */
|
||||||
table_ptr =
|
table_ptr = ((unsigned int *)
|
||||||
(unsigned int *)
|
bfd_alloc (abfd,
|
||||||
bfd_alloc (abfd, (size_t) (bfd_get_symcount (abfd) * sizeof (unsigned int)));
|
(obj_raw_syment_count (abfd)
|
||||||
|
* sizeof (unsigned int))));
|
||||||
|
|
||||||
if (table_ptr == NULL)
|
if (table_ptr == NULL)
|
||||||
{
|
{
|
||||||
@ -2118,7 +2109,7 @@ coff_slurp_symbol_table (abfd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
coff_symbol_type *dst = cached_area;
|
coff_symbol_type *dst = cached_area;
|
||||||
unsigned int last_native_index = bfd_get_symcount (abfd);
|
unsigned int last_native_index = obj_raw_syment_count (abfd);
|
||||||
unsigned int this_index = 0;
|
unsigned int this_index = 0;
|
||||||
while (this_index < last_native_index)
|
while (this_index < last_native_index)
|
||||||
{
|
{
|
||||||
@ -2324,7 +2315,6 @@ coff_slurp_symbol_table (abfd)
|
|||||||
obj_symbols (abfd) = cached_area;
|
obj_symbols (abfd) = cached_area;
|
||||||
obj_raw_syments (abfd) = native_symbols;
|
obj_raw_syments (abfd) = native_symbols;
|
||||||
|
|
||||||
obj_conv_table_size (abfd) = bfd_get_symcount (abfd);
|
|
||||||
bfd_get_symcount (abfd) = number_of_symbols;
|
bfd_get_symcount (abfd) = number_of_symbols;
|
||||||
obj_convert (abfd) = table_ptr;
|
obj_convert (abfd) = table_ptr;
|
||||||
/* Slurp the line tables for each section too */
|
/* Slurp the line tables for each section too */
|
||||||
@ -2340,6 +2330,43 @@ coff_slurp_symbol_table (abfd)
|
|||||||
return true;
|
return true;
|
||||||
} /* coff_slurp_symbol_table() */
|
} /* coff_slurp_symbol_table() */
|
||||||
|
|
||||||
|
/* Check whether a symbol is globally visible. This is used by the
|
||||||
|
COFF backend linker code in cofflink.c, since a couple of targets
|
||||||
|
have globally visible symbols which are not class C_EXT. This
|
||||||
|
function need not handle the case of n_class == C_EXT. */
|
||||||
|
|
||||||
|
#undef OTHER_GLOBAL_CLASS
|
||||||
|
|
||||||
|
#ifdef I960
|
||||||
|
#define OTHER_GLOBAL_CLASS C_LEAFEXT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RS6000COFF_C
|
||||||
|
#define OTHER_GLOBAL_CLASS C_HIDEXT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OTHER_GLOBAL_CLASS
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
coff_sym_is_global (abfd, syment)
|
||||||
|
bfd *abfd;
|
||||||
|
struct internal_syment *syment;
|
||||||
|
{
|
||||||
|
if (syment->n_sclass == OTHER_GLOBAL_CLASS)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef OTHER_GLOBAL_CLASS
|
||||||
|
|
||||||
|
#else /* ! defined (OTHER_GLOBAL_CLASS) */
|
||||||
|
|
||||||
|
/* sym_is_global should not be defined if it has nothing to do. */
|
||||||
|
|
||||||
|
#define coff_sym_is_global 0
|
||||||
|
|
||||||
|
#endif /* ! defined (OTHER_GLOBAL_CLASS) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SUBSUBSECTION
|
SUBSUBSECTION
|
||||||
Reading relocations
|
Reading relocations
|
||||||
@ -2433,7 +2460,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
|
|||||||
|
|
||||||
cache_ptr = reloc_cache + idx;
|
cache_ptr = reloc_cache + idx;
|
||||||
src = native_relocs + idx;
|
src = native_relocs + idx;
|
||||||
bfd_swap_reloc_in (abfd, src, &dst);
|
coff_swap_reloc_in (abfd, src, &dst);
|
||||||
|
|
||||||
RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect);
|
RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect);
|
||||||
#else
|
#else
|
||||||
@ -2444,7 +2471,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
|
|||||||
cache_ptr = reloc_cache + idx;
|
cache_ptr = reloc_cache + idx;
|
||||||
src = native_relocs + idx;
|
src = native_relocs + idx;
|
||||||
|
|
||||||
bfd_swap_reloc_in (abfd, src, &dst);
|
coff_swap_reloc_in (abfd, src, &dst);
|
||||||
|
|
||||||
|
|
||||||
cache_ptr->address = dst.r_vaddr;
|
cache_ptr->address = dst.r_vaddr;
|
||||||
@ -2572,6 +2599,19 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If coff_relocate_section is defined, we can use the optimized COFF
|
||||||
|
backend linker. Otherwise we must continue to use the old linker. */
|
||||||
|
#ifdef coff_relocate_section
|
||||||
|
#define coff_bfd_link_hash_table_create _bfd_coff_link_hash_table_create
|
||||||
|
#define coff_bfd_link_add_symbols _bfd_coff_link_add_symbols
|
||||||
|
#define coff_bfd_final_link _bfd_coff_final_link
|
||||||
|
#else /* ! defined (coff_relocate_section) */
|
||||||
|
#define coff_relocate_section NULL
|
||||||
|
#define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||||
|
#define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||||
|
#define coff_bfd_final_link _bfd_generic_final_link
|
||||||
|
#endif /* ! defined (coff_relocate_section) */
|
||||||
|
|
||||||
static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
|
static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
|
||||||
{
|
{
|
||||||
coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in,
|
coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in,
|
||||||
@ -2579,17 +2619,19 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
|
|||||||
coff_swap_lineno_out, coff_swap_reloc_out,
|
coff_swap_lineno_out, coff_swap_reloc_out,
|
||||||
coff_swap_filehdr_out, coff_swap_aouthdr_out,
|
coff_swap_filehdr_out, coff_swap_aouthdr_out,
|
||||||
coff_swap_scnhdr_out,
|
coff_swap_scnhdr_out,
|
||||||
FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, LINESZ,
|
FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ,
|
||||||
#ifdef COFF_LONG_FILENAMES
|
#ifdef COFF_LONG_FILENAMES
|
||||||
true,
|
true,
|
||||||
#else
|
#else
|
||||||
false,
|
false,
|
||||||
#endif
|
#endif
|
||||||
coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
|
coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
|
||||||
coff_bad_format_hook, coff_set_arch_mach_hook, coff_mkobject_hook,
|
coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
|
||||||
styp_to_sec_flags, coff_make_section_hook, coff_set_alignment_hook,
|
coff_mkobject_hook, styp_to_sec_flags, coff_make_section_hook,
|
||||||
coff_slurp_symbol_table, symname_in_debug_hook,
|
coff_set_alignment_hook, coff_slurp_symbol_table, symname_in_debug_hook,
|
||||||
coff_reloc16_extra_cases, coff_reloc16_estimate
|
coff_reloc16_extra_cases, coff_reloc16_estimate,
|
||||||
|
coff_sym_is_global, coff_compute_section_file_positions,
|
||||||
|
coff_relocate_section
|
||||||
};
|
};
|
||||||
|
|
||||||
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
|
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||||
@ -2613,6 +2655,3 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
|
|||||||
#define coff_bfd_get_relocated_section_contents \
|
#define coff_bfd_get_relocated_section_contents \
|
||||||
bfd_generic_get_relocated_section_contents
|
bfd_generic_get_relocated_section_contents
|
||||||
#define coff_bfd_relax_section bfd_generic_relax_section
|
#define coff_bfd_relax_section bfd_generic_relax_section
|
||||||
#define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
|
||||||
#define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
|
||||||
#define coff_bfd_final_link _bfd_generic_final_link
|
|
||||||
|
106
bfd/coffgen.c
106
bfd/coffgen.c
@ -180,10 +180,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
|||||||
if ((internal_f->f_flags & F_EXEC) != 0)
|
if ((internal_f->f_flags & F_EXEC) != 0)
|
||||||
abfd->flags |= D_PAGED;
|
abfd->flags |= D_PAGED;
|
||||||
|
|
||||||
obj_raw_syment_count (abfd) =
|
bfd_get_symcount(abfd) = internal_f->f_nsyms;
|
||||||
obj_conv_table_size (abfd) =
|
|
||||||
bfd_get_symcount(abfd) =
|
|
||||||
internal_f->f_nsyms;
|
|
||||||
if (internal_f->f_nsyms)
|
if (internal_f->f_nsyms)
|
||||||
abfd->flags |= HAS_SYMS;
|
abfd->flags |= HAS_SYMS;
|
||||||
|
|
||||||
@ -343,42 +340,53 @@ coff_get_symtab (abfd, alocation)
|
|||||||
|
|
||||||
int
|
int
|
||||||
coff_count_linenumbers (abfd)
|
coff_count_linenumbers (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
unsigned int limit = bfd_get_symcount(abfd);
|
unsigned int limit = bfd_get_symcount(abfd);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
asymbol **p;
|
asymbol **p;
|
||||||
{
|
asection *s;
|
||||||
asection *s = abfd->sections->output_section;
|
|
||||||
while (s) {
|
|
||||||
BFD_ASSERT(s->lineno_count == 0);
|
|
||||||
s = s->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (limit == 0)
|
||||||
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) {
|
{
|
||||||
asymbol *q_maybe = *p;
|
/* This may be from the backend linker, in which case the
|
||||||
if (bfd_asymbol_flavour(q_maybe) == bfd_target_coff_flavour) {
|
lineno_count in the sections is correct. */
|
||||||
coff_symbol_type *q = coffsymbol(q_maybe);
|
for (s = abfd->sections; s != NULL; s = s->next)
|
||||||
if (q->lineno) {
|
total += s->lineno_count;
|
||||||
/*
|
return total;
|
||||||
This symbol has a linenumber, increment the owning
|
|
||||||
section's linenumber count
|
|
||||||
*/
|
|
||||||
alent *l = q->lineno;
|
|
||||||
q->symbol.section->output_section->lineno_count++;
|
|
||||||
total ++;
|
|
||||||
l++;
|
|
||||||
while (l->line_number) {
|
|
||||||
total ++;
|
|
||||||
q->symbol.section->output_section->lineno_count++;
|
|
||||||
l++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
for (s = abfd->sections; s != NULL; s = s->next)
|
||||||
|
BFD_ASSERT (s->lineno_count == 0);
|
||||||
|
|
||||||
|
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++)
|
||||||
|
{
|
||||||
|
asymbol *q_maybe = *p;
|
||||||
|
|
||||||
|
if (bfd_asymbol_flavour (q_maybe) == bfd_target_coff_flavour)
|
||||||
|
{
|
||||||
|
coff_symbol_type *q = coffsymbol (q_maybe);
|
||||||
|
|
||||||
|
if (q->lineno != NULL)
|
||||||
|
{
|
||||||
|
/* This symbol has line numbers. Increment the owning
|
||||||
|
section's linenumber count. */
|
||||||
|
alent *l = q->lineno;
|
||||||
|
|
||||||
|
++q->symbol.section->output_section->lineno_count;
|
||||||
|
++total;
|
||||||
|
++l;
|
||||||
|
while (l->line_number != 0)
|
||||||
|
{
|
||||||
|
++total;
|
||||||
|
++q->symbol.section->output_section->lineno_count;
|
||||||
|
++l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,8 +928,6 @@ coff_write_symbols (abfd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_get_symcount (abfd) = written;
|
|
||||||
|
|
||||||
/* Now write out strings */
|
/* Now write out strings */
|
||||||
|
|
||||||
if (string_size != 0)
|
if (string_size != 0)
|
||||||
@ -1137,9 +1143,12 @@ coff_pointerize_aux (abfd, table_base, type, class, auxent)
|
|||||||
/* Otherwise patch up */
|
/* Otherwise patch up */
|
||||||
#define N_TMASK coff_data (abfd)->local_n_tmask
|
#define N_TMASK coff_data (abfd)->local_n_tmask
|
||||||
#define N_BTSHFT coff_data (abfd)->local_n_btshft
|
#define N_BTSHFT coff_data (abfd)->local_n_btshft
|
||||||
if (ISFCN(type) || ISTAG(class) || class == C_BLOCK) {
|
if ((ISFCN(type) || ISTAG(class) || class == C_BLOCK)
|
||||||
auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = table_base +
|
&& auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
|
||||||
auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
|
{
|
||||||
|
auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
|
||||||
|
(table_base
|
||||||
|
+ auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l);
|
||||||
auxent->fix_end = 1;
|
auxent->fix_end = 1;
|
||||||
}
|
}
|
||||||
/* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
|
/* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
|
||||||
@ -1276,7 +1285,9 @@ coff_get_normalized_symtab (abfd)
|
|||||||
if (obj_raw_syments(abfd) != (combined_entry_type *)NULL) {
|
if (obj_raw_syments(abfd) != (combined_entry_type *)NULL) {
|
||||||
return obj_raw_syments(abfd);
|
return obj_raw_syments(abfd);
|
||||||
}
|
}
|
||||||
if ((size = bfd_get_symcount(abfd) * sizeof(combined_entry_type)) == 0) {
|
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
bfd_set_error (bfd_error_no_symbols);
|
bfd_set_error (bfd_error_no_symbols);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -1287,10 +1298,10 @@ coff_get_normalized_symtab (abfd)
|
|||||||
bfd_set_error (bfd_error_no_memory);
|
bfd_set_error (bfd_error_no_memory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
internal_end = internal + bfd_get_symcount(abfd);
|
internal_end = internal + obj_raw_syment_count (abfd);
|
||||||
|
|
||||||
symesz = bfd_coff_symesz (abfd);
|
symesz = bfd_coff_symesz (abfd);
|
||||||
raw_size = bfd_get_symcount(abfd) * symesz;
|
raw_size = obj_raw_syment_count (abfd) * symesz;
|
||||||
raw = bfd_alloc(abfd,raw_size);
|
raw = bfd_alloc(abfd,raw_size);
|
||||||
if (!raw)
|
if (!raw)
|
||||||
{
|
{
|
||||||
@ -1302,7 +1313,7 @@ coff_get_normalized_symtab (abfd)
|
|||||||
|| bfd_read(raw, raw_size, 1, abfd) != raw_size)
|
|| bfd_read(raw, raw_size, 1, abfd) != raw_size)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
/* mark the end of the symbols */
|
/* mark the end of the symbols */
|
||||||
raw_end = (char *) raw + bfd_get_symcount(abfd) * symesz;
|
raw_end = (char *) raw + obj_raw_syment_count (abfd) * symesz;
|
||||||
/*
|
/*
|
||||||
FIXME SOMEDAY. A string table size of zero is very weird, but
|
FIXME SOMEDAY. A string table size of zero is very weird, but
|
||||||
probably possible. If one shows up, it will probably kill us.
|
probably possible. If one shows up, it will probably kill us.
|
||||||
@ -1575,6 +1586,11 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||||||
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
|
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
|
||||||
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size,
|
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size,
|
||||||
tagndx);
|
tagndx);
|
||||||
|
if (auxp->fix_end)
|
||||||
|
fprintf (file, " endndx %ld",
|
||||||
|
((long)
|
||||||
|
(auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
|
||||||
|
- root)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2006
bfd/cofflink.c
Normal file
2006
bfd/cofflink.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -135,7 +135,7 @@ do
|
|||||||
case "$vec" in
|
case "$vec" in
|
||||||
# This list is alphabetized to make it easy to compare
|
# This list is alphabetized to make it easy to compare
|
||||||
# with the two vector lists in targets.c.
|
# with the two vector lists in targets.c.
|
||||||
a29kcoff_big_vec) tb="$tb coff-a29k.o" ;;
|
a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;;
|
||||||
a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o stab-syms.o" ;;
|
a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o stab-syms.o" ;;
|
||||||
aout0_big_vec) tb="$tb aout0.o aout32.o stab-syms.o" ;;
|
aout0_big_vec) tb="$tb aout0.o aout32.o stab-syms.o" ;;
|
||||||
aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
|
aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
|
||||||
|
@ -18,6 +18,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include "bfdlink.h"
|
||||||
|
|
||||||
/* Object file tdata; access macros */
|
/* Object file tdata; access macros */
|
||||||
|
|
||||||
@ -31,12 +32,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
||||||
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
||||||
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
||||||
#if CFILE_STUFF
|
|
||||||
#define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew)
|
|
||||||
#else
|
|
||||||
#define obj_symbol_slew(bfd) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
|
||||||
|
#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
|
||||||
|
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
|
||||||
|
|
||||||
/* `Tdata' information kept for COFF files. */
|
/* `Tdata' information kept for COFF files. */
|
||||||
|
|
||||||
@ -47,13 +46,8 @@ typedef struct coff_tdata
|
|||||||
int conv_table_size;
|
int conv_table_size;
|
||||||
file_ptr sym_filepos;
|
file_ptr sym_filepos;
|
||||||
|
|
||||||
long symbol_index_slew; /* used during read to mark whether a
|
|
||||||
C_FILE symbol as been added. */
|
|
||||||
|
|
||||||
struct coff_ptr_struct *raw_syments;
|
struct coff_ptr_struct *raw_syments;
|
||||||
struct lineno *raw_linenos;
|
|
||||||
unsigned int raw_syment_count;
|
unsigned int raw_syment_count;
|
||||||
unsigned short flags;
|
|
||||||
|
|
||||||
/* These are only valid once writing has begun */
|
/* These are only valid once writing has begun */
|
||||||
long int relocbase;
|
long int relocbase;
|
||||||
@ -68,14 +62,71 @@ typedef struct coff_tdata
|
|||||||
unsigned local_symesz;
|
unsigned local_symesz;
|
||||||
unsigned local_auxesz;
|
unsigned local_auxesz;
|
||||||
unsigned local_linesz;
|
unsigned local_linesz;
|
||||||
|
|
||||||
|
/* Used by the COFF backend linker. */
|
||||||
|
PTR external_syms;
|
||||||
|
char *strings;
|
||||||
|
struct coff_link_hash_entry **sym_hashes;
|
||||||
} coff_data_type;
|
} coff_data_type;
|
||||||
|
|
||||||
/* We take the address of the first element of a asymbol to ensure that the
|
/* We take the address of the first element of a asymbol to ensure that the
|
||||||
* macro is only ever applied to an asymbol. */
|
* macro is only ever applied to an asymbol. */
|
||||||
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
||||||
|
|
||||||
|
/* COFF linker hash table entries. */
|
||||||
|
|
||||||
|
struct coff_link_hash_entry
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_entry root;
|
||||||
|
|
||||||
|
/* Symbol index in output file. Set to -1 initially. Set to -2 if
|
||||||
|
there is a reloc against this symbol. */
|
||||||
|
long indx;
|
||||||
|
|
||||||
|
/* Symbol type. */
|
||||||
|
unsigned short type;
|
||||||
|
|
||||||
|
/* Symbol class. */
|
||||||
|
unsigned char class;
|
||||||
|
|
||||||
|
/* Number of auxiliary entries. */
|
||||||
|
char numaux;
|
||||||
|
|
||||||
|
/* BFD to take auxiliary entries from. */
|
||||||
|
bfd *auxbfd;
|
||||||
|
|
||||||
|
/* Pointer to array of auxiliary entries, if any. */
|
||||||
|
union internal_auxent *aux;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* COFF linker hash table. */
|
||||||
|
|
||||||
|
struct coff_link_hash_table
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_table root;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Look up an entry in a COFF linker hash table. */
|
||||||
|
|
||||||
|
#define coff_link_hash_lookup(table, string, create, copy, follow) \
|
||||||
|
((struct coff_link_hash_entry *) \
|
||||||
|
bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
||||||
|
(copy), (follow)))
|
||||||
|
|
||||||
|
/* Traverse a COFF linker hash table. */
|
||||||
|
|
||||||
|
#define coff_link_hash_traverse(table, func, info) \
|
||||||
|
(bfd_link_hash_traverse \
|
||||||
|
(&(table)->root, \
|
||||||
|
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||||
|
(info)))
|
||||||
|
|
||||||
|
/* Get the COFF linker hash table from a link_info structure. */
|
||||||
|
|
||||||
|
#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
|
||||||
|
|
||||||
/* Functions in coffgen.c. */
|
/* Functions in coffgen.c. */
|
||||||
extern bfd_target *coff_object_p PARAMS ((bfd *));
|
extern const bfd_target *coff_object_p PARAMS ((bfd *));
|
||||||
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
||||||
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
|
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||||
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
|
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||||
@ -83,7 +134,7 @@ extern int coff_count_linenumbers PARAMS ((bfd *));
|
|||||||
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
|
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
|
||||||
extern boolean coff_renumber_symbols PARAMS ((bfd *));
|
extern boolean coff_renumber_symbols PARAMS ((bfd *));
|
||||||
extern void coff_mangle_symbols PARAMS ((bfd *));
|
extern void coff_mangle_symbols PARAMS ((bfd *));
|
||||||
extern void coff_write_symbols PARAMS ((bfd *));
|
extern boolean coff_write_symbols PARAMS ((bfd *));
|
||||||
extern boolean coff_write_linenumbers PARAMS ((bfd *));
|
extern boolean coff_write_linenumbers PARAMS ((bfd *));
|
||||||
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
|
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
|
||||||
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
|
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
|
||||||
@ -116,5 +167,14 @@ extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
|
|||||||
asection *input_section,
|
asection *input_section,
|
||||||
bfd_vma val));
|
bfd_vma val));
|
||||||
|
|
||||||
|
/* Functions in cofflink.c. */
|
||||||
|
|
||||||
|
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
|
||||||
|
PARAMS ((bfd *));
|
||||||
|
extern boolean _bfd_coff_link_add_symbols
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
extern boolean _bfd_coff_final_link
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
|
||||||
/* And more taken from the source .. */
|
/* And more taken from the source .. */
|
||||||
|
|
||||||
|
115
bfd/libcoff.h
115
bfd/libcoff.h
@ -18,6 +18,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include "bfdlink.h"
|
||||||
|
|
||||||
/* Object file tdata; access macros */
|
/* Object file tdata; access macros */
|
||||||
|
|
||||||
@ -31,12 +32,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
||||||
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
||||||
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
||||||
#if CFILE_STUFF
|
|
||||||
#define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew)
|
|
||||||
#else
|
|
||||||
#define obj_symbol_slew(bfd) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
|
||||||
|
#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
|
||||||
|
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
|
||||||
|
|
||||||
/* `Tdata' information kept for COFF files. */
|
/* `Tdata' information kept for COFF files. */
|
||||||
|
|
||||||
@ -47,13 +46,8 @@ typedef struct coff_tdata
|
|||||||
int conv_table_size;
|
int conv_table_size;
|
||||||
file_ptr sym_filepos;
|
file_ptr sym_filepos;
|
||||||
|
|
||||||
long symbol_index_slew; /* used during read to mark whether a
|
|
||||||
C_FILE symbol as been added. */
|
|
||||||
|
|
||||||
struct coff_ptr_struct *raw_syments;
|
struct coff_ptr_struct *raw_syments;
|
||||||
struct lineno *raw_linenos;
|
|
||||||
unsigned int raw_syment_count;
|
unsigned int raw_syment_count;
|
||||||
unsigned short flags;
|
|
||||||
|
|
||||||
/* These are only valid once writing has begun */
|
/* These are only valid once writing has begun */
|
||||||
long int relocbase;
|
long int relocbase;
|
||||||
@ -68,12 +62,69 @@ typedef struct coff_tdata
|
|||||||
unsigned local_symesz;
|
unsigned local_symesz;
|
||||||
unsigned local_auxesz;
|
unsigned local_auxesz;
|
||||||
unsigned local_linesz;
|
unsigned local_linesz;
|
||||||
|
|
||||||
|
/* Used by the COFF backend linker. */
|
||||||
|
PTR external_syms;
|
||||||
|
char *strings;
|
||||||
|
struct coff_link_hash_entry **sym_hashes;
|
||||||
} coff_data_type;
|
} coff_data_type;
|
||||||
|
|
||||||
/* We take the address of the first element of a asymbol to ensure that the
|
/* We take the address of the first element of a asymbol to ensure that the
|
||||||
* macro is only ever applied to an asymbol. */
|
* macro is only ever applied to an asymbol. */
|
||||||
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
||||||
|
|
||||||
|
/* COFF linker hash table entries. */
|
||||||
|
|
||||||
|
struct coff_link_hash_entry
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_entry root;
|
||||||
|
|
||||||
|
/* Symbol index in output file. Set to -1 initially. Set to -2 if
|
||||||
|
there is a reloc against this symbol. */
|
||||||
|
long indx;
|
||||||
|
|
||||||
|
/* Symbol type. */
|
||||||
|
unsigned short type;
|
||||||
|
|
||||||
|
/* Symbol class. */
|
||||||
|
unsigned char class;
|
||||||
|
|
||||||
|
/* Number of auxiliary entries. */
|
||||||
|
char numaux;
|
||||||
|
|
||||||
|
/* BFD to take auxiliary entries from. */
|
||||||
|
bfd *auxbfd;
|
||||||
|
|
||||||
|
/* Pointer to array of auxiliary entries, if any. */
|
||||||
|
union internal_auxent *aux;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* COFF linker hash table. */
|
||||||
|
|
||||||
|
struct coff_link_hash_table
|
||||||
|
{
|
||||||
|
struct bfd_link_hash_table root;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Look up an entry in a COFF linker hash table. */
|
||||||
|
|
||||||
|
#define coff_link_hash_lookup(table, string, create, copy, follow) \
|
||||||
|
((struct coff_link_hash_entry *) \
|
||||||
|
bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
||||||
|
(copy), (follow)))
|
||||||
|
|
||||||
|
/* Traverse a COFF linker hash table. */
|
||||||
|
|
||||||
|
#define coff_link_hash_traverse(table, func, info) \
|
||||||
|
(bfd_link_hash_traverse \
|
||||||
|
(&(table)->root, \
|
||||||
|
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||||
|
(info)))
|
||||||
|
|
||||||
|
/* Get the COFF linker hash table from a link_info structure. */
|
||||||
|
|
||||||
|
#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
|
||||||
|
|
||||||
/* Functions in coffgen.c. */
|
/* Functions in coffgen.c. */
|
||||||
extern const bfd_target *coff_object_p PARAMS ((bfd *));
|
extern const bfd_target *coff_object_p PARAMS ((bfd *));
|
||||||
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
||||||
@ -116,6 +167,15 @@ extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
|
|||||||
asection *input_section,
|
asection *input_section,
|
||||||
bfd_vma val));
|
bfd_vma val));
|
||||||
|
|
||||||
|
/* Functions in cofflink.c. */
|
||||||
|
|
||||||
|
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
|
||||||
|
PARAMS ((bfd *));
|
||||||
|
extern boolean _bfd_coff_link_add_symbols
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
extern boolean _bfd_coff_final_link
|
||||||
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
|
||||||
/* And more taken from the source .. */
|
/* And more taken from the source .. */
|
||||||
|
|
||||||
typedef struct coff_ptr_struct
|
typedef struct coff_ptr_struct
|
||||||
@ -232,6 +292,7 @@ typedef struct
|
|||||||
unsigned int _bfd_scnhsz;
|
unsigned int _bfd_scnhsz;
|
||||||
unsigned int _bfd_symesz;
|
unsigned int _bfd_symesz;
|
||||||
unsigned int _bfd_auxesz;
|
unsigned int _bfd_auxesz;
|
||||||
|
unsigned int _bfd_relsz;
|
||||||
unsigned int _bfd_linesz;
|
unsigned int _bfd_linesz;
|
||||||
boolean _bfd_coff_long_filenames;
|
boolean _bfd_coff_long_filenames;
|
||||||
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||||
@ -246,6 +307,10 @@ typedef struct
|
|||||||
bfd *abfd,
|
bfd *abfd,
|
||||||
PTR ext,
|
PTR ext,
|
||||||
PTR in));
|
PTR in));
|
||||||
|
void (*_bfd_coff_swap_reloc_in) PARAMS ((
|
||||||
|
bfd *abfd,
|
||||||
|
PTR ext,
|
||||||
|
PTR in));
|
||||||
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
||||||
bfd *abfd,
|
bfd *abfd,
|
||||||
PTR internal_filehdr));
|
PTR internal_filehdr));
|
||||||
@ -286,6 +351,20 @@ typedef struct
|
|||||||
arelent *r,
|
arelent *r,
|
||||||
unsigned int shrink,
|
unsigned int shrink,
|
||||||
struct bfd_link_info *link_info));
|
struct bfd_link_info *link_info));
|
||||||
|
boolean (*_bfd_coff_sym_is_global) PARAMS ((
|
||||||
|
bfd *abfd,
|
||||||
|
struct internal_syment *));
|
||||||
|
void (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||||
|
bfd *abfd));
|
||||||
|
boolean (*_bfd_coff_relocate_section) PARAMS ((
|
||||||
|
bfd *output_bfd,
|
||||||
|
struct bfd_link_info *info,
|
||||||
|
bfd *input_bfd,
|
||||||
|
asection *input_section,
|
||||||
|
bfd_byte *contents,
|
||||||
|
struct internal_reloc *relocs,
|
||||||
|
struct internal_syment *syms,
|
||||||
|
asection **sections));
|
||||||
|
|
||||||
} bfd_coff_backend_data;
|
} bfd_coff_backend_data;
|
||||||
|
|
||||||
@ -326,6 +405,7 @@ typedef struct
|
|||||||
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
||||||
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
||||||
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||||
|
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||||
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||||
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||||
@ -337,6 +417,9 @@ typedef struct
|
|||||||
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
||||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
||||||
|
|
||||||
|
#define bfd_coff_swap_reloc_in(abfd, i, o) \
|
||||||
|
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
|
||||||
|
|
||||||
#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
||||||
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
||||||
|
|
||||||
@ -368,3 +451,15 @@ typedef struct
|
|||||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||||
(abfd, section, reloc, shrink, link_info))
|
(abfd, section, reloc, shrink, link_info))
|
||||||
|
|
||||||
|
#define bfd_coff_sym_is_global(abfd, sym)\
|
||||||
|
((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
|
||||||
|
(abfd, sym))
|
||||||
|
|
||||||
|
#define bfd_coff_compute_section_file_positions(abfd)\
|
||||||
|
((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
|
||||||
|
(abfd))
|
||||||
|
|
||||||
|
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
|
||||||
|
((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
|
||||||
|
(obfd, info, ibfd, o, con, rel, isyms, secs))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user