Support for xcoff64
This commit is contained in:
parent
3dd657b1d0
commit
beb1bf64d0
15 changed files with 5090 additions and 2464 deletions
|
@ -1,3 +1,52 @@
|
|||
2001-05-24 Tom Rix <trix@redhat.com>
|
||||
|
||||
* Makefile.am coff-pmac bfd now defined in coff-rs6000.c
|
||||
xcoff-target.h not used to define rs6000 or ppc bfd.
|
||||
* Makefile.in same
|
||||
|
||||
* bfd-in.h : (struct lineno_cache_entry) promote element "offset"
|
||||
to 64 bit.
|
||||
|
||||
* coff-rs6000.c : Many changes for 64 bit support. Move common
|
||||
32/64 code to xcofflink.c. Explictly define the rs6000coff_vec
|
||||
and pmac_xcoff_vec
|
||||
|
||||
* coff64-rs6000.c : Many changes for 64 bit support. 64 bit
|
||||
linker now supported. Explictly define the rs6000coff64_vec.
|
||||
|
||||
* coffcode.h : (coff_set_arch_mach_hook) xcoff 64 bit support
|
||||
(coff_print_aux) same
|
||||
(coff_write_object_contents) same
|
||||
(coff_slurp_line_table) same
|
||||
|
||||
* coffgen.c : (coff_fix_symbol_name) formatting
|
||||
(coff_mangle_symbols) xcoff 64 bit support
|
||||
(coff_write_symbol) same
|
||||
(coff_write_alien_symbol) same
|
||||
(coff_write_native_symbol) same
|
||||
(coff_write_symbols) same
|
||||
(coff_get_symbol_info) same
|
||||
(bfd_coff_get_syment) same
|
||||
(coff_print_symbol) same
|
||||
|
||||
* config.bfd : add powerpc64-*-aix* target
|
||||
|
||||
* libcoff-in.h : formatting
|
||||
|
||||
* libcoff.h : move xcoff extern declarations to libxcoff.h
|
||||
|
||||
* libxcoff.h : New file
|
||||
|
||||
* xcofflink.c : Many changes for xcoff64 support. Move common
|
||||
structures to include/coff/xcoff.h. Move specific structure to
|
||||
backends coff-rs6000.c and coff64-rs6000.c. Use new backend
|
||||
functions, defined in libxcoff.h, to isolate 32/64 dependencies.
|
||||
|
||||
(bfd_xcoff_size_dynamic_sections) : special __rtinit symbol for
|
||||
aix4.2+ -binitfini.
|
||||
|
||||
(xcoff_build_ldsyms) : handle special __rtinit symbol.
|
||||
|
||||
2001-05-23 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* elf64-sparc.c (sparc64_elf_slurp_reloc_table): Fix typo
|
||||
|
|
|
@ -501,7 +501,7 @@ SOURCE_HFILES = \
|
|||
elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
|
||||
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
|
||||
libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
|
||||
nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
|
||||
nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h xcoff.h
|
||||
|
||||
## ... and all .h files which are in the build tree.
|
||||
BUILD_HFILES = \
|
||||
|
@ -914,9 +914,12 @@ coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
|||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h libcoff.h \
|
||||
libecoff.h coffswap.h ecoffswap.h
|
||||
coff-pmac.lo: coff-pmac.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \
|
||||
xcoff-target.h coffcode.h coffswap.h
|
||||
coff-rs6000.lo: coff64-rs6000.c coff-rs6000.c xcofflink.c \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
|
||||
$(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h coffswap.h
|
||||
coff64-rs6000.lo: coff64-rs6000.c coff-rs6000.c xcofflink.c \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
|
||||
$(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h coffswap.h
|
||||
coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
|
||||
|
|
|
@ -537,7 +537,6 @@ BFD32_BACKENDS_CFILES = \
|
|||
vms-tir.c \
|
||||
xcofflink.c
|
||||
|
||||
|
||||
# The .o files needed by all of the 64 bit vectors that are configured into
|
||||
# target_vector in targets.c if configured with --enable-targets=all
|
||||
# and --enable-64-bit-bfd.
|
||||
|
@ -631,8 +630,7 @@ SOURCE_HFILES = \
|
|||
elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
|
||||
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
|
||||
libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
|
||||
nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
|
||||
|
||||
nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff.h libxcoff.h
|
||||
|
||||
BUILD_HFILES = \
|
||||
elf32-target.h elf64-target.h targmatch.h
|
||||
|
@ -1452,12 +1450,12 @@ coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
|||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h libcoff.h \
|
||||
libecoff.h coffswap.h ecoffswap.h
|
||||
coff-pmac.lo: coff-pmac.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \
|
||||
xcoff-target.h coffcode.h coffswap.h
|
||||
coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
|
||||
coff-rs6000.lo: coff64-rs6000.c coff-rs6000.c xcofflink.c \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
|
||||
$(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h coffswap.h
|
||||
coff64-rs6000.lo: coff64-rs6000.c coff-rs6000.c xcofflink.c \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
|
||||
$(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h coffswap.h
|
||||
coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h libcoff.h \
|
||||
coffcode.h coffswap.h
|
||||
|
|
|
@ -298,7 +298,7 @@ typedef struct lineno_cache_entry {
|
|||
unsigned int line_number; /* Linenumber from start of function*/
|
||||
union {
|
||||
struct symbol_cache_entry *sym; /* Function name */
|
||||
unsigned long offset; /* Offset into section */
|
||||
bfd_vma offset; /* Offset into section */
|
||||
} u;
|
||||
} alent;
|
||||
|
||||
|
|
1500
bfd/coff-rs6000.c
1500
bfd/coff-rs6000.c
File diff suppressed because it is too large
Load diff
2036
bfd/coff64-rs6000.c
2036
bfd/coff64-rs6000.c
File diff suppressed because it is too large
Load diff
|
@ -2053,21 +2053,8 @@ coff_set_arch_mach_hook (abfd, filehdr)
|
|||
{
|
||||
default:
|
||||
case 0:
|
||||
#ifdef POWERMAC
|
||||
/* PowerPC Macs use the same magic numbers as RS/6000
|
||||
(because that's how they were bootstrapped originally),
|
||||
but they are always PowerPC architecture. */
|
||||
arch = bfd_arch_powerpc;
|
||||
machine = bfd_mach_ppc;
|
||||
#else
|
||||
#ifdef XCOFF64
|
||||
arch = bfd_arch_powerpc;
|
||||
machine = bfd_mach_ppc_620;
|
||||
#else
|
||||
arch = bfd_arch_rs6000;
|
||||
machine = bfd_mach_rs6k;
|
||||
#endif
|
||||
#endif /* POWERMAC */
|
||||
arch = bfd_xcoff_architecture (abfd);
|
||||
machine = bfd_xcoff_machine (abfd);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -2338,13 +2325,21 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
|
|||
if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD)
|
||||
{
|
||||
BFD_ASSERT (! aux->fix_scnlen);
|
||||
fprintf (file, "val %5ld", aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#ifdef XCOFF64
|
||||
fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#else
|
||||
fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (file, "indx ");
|
||||
if (! aux->fix_scnlen)
|
||||
fprintf (file, "%4ld", aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#ifdef XCOFF64
|
||||
fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#else
|
||||
fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
|
||||
#endif
|
||||
else
|
||||
fprintf (file, "%4ld",
|
||||
(long) (aux->u.auxent.x_csect.x_scnlen.p - table_base));
|
||||
|
@ -3370,10 +3365,12 @@ coff_write_object_contents (abfd)
|
|||
{
|
||||
scn_base = bfd_coff_filhsz (abfd);
|
||||
#ifdef RS6000COFF_C
|
||||
#ifndef XCOFF64
|
||||
if (xcoff_data (abfd)->full_aouthdr)
|
||||
scn_base += bfd_coff_aoutsz (abfd);
|
||||
else
|
||||
scn_base += SMALL_AOUTSZ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3625,6 +3622,7 @@ coff_write_object_contents (abfd)
|
|||
}
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
#ifndef XCOFF64
|
||||
/* XCOFF handles overflows in the reloc and line number count fields
|
||||
by creating a new section header to hold the correct values. */
|
||||
for (current = abfd->sections; current != NULL; current = current->next)
|
||||
|
@ -3651,6 +3649,7 @@ coff_write_object_contents (abfd)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* OK, now set up the filehdr... */
|
||||
|
@ -3673,10 +3672,12 @@ coff_write_object_contents (abfd)
|
|||
{
|
||||
internal_f.f_opthdr = 0;
|
||||
#ifdef RS6000COFF_C
|
||||
#ifndef XCOFF64
|
||||
if (xcoff_data (abfd)->full_aouthdr)
|
||||
internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
|
||||
else
|
||||
internal_f.f_opthdr = SMALL_AOUTSZ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4239,13 +4240,13 @@ coff_slurp_line_table (abfd, asect)
|
|||
if (cache_ptr->line_number == 0)
|
||||
{
|
||||
boolean warned;
|
||||
long symndx;
|
||||
bfd_signed_vma symndx;
|
||||
coff_symbol_type *sym;
|
||||
|
||||
warned = false;
|
||||
symndx = dst.l_addr.l_symndx;
|
||||
if (symndx < 0
|
||||
|| (unsigned long) symndx >= obj_raw_syment_count (abfd))
|
||||
|| (bfd_vma) symndx >= obj_raw_syment_count (abfd))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: warning: illegal symbol index %ld in line numbers"),
|
||||
|
|
|
@ -47,13 +47,13 @@ static void coff_fix_symbol_name
|
|||
PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *,
|
||||
asection **, bfd_size_type *));
|
||||
static boolean coff_write_symbol
|
||||
PARAMS ((bfd *, asymbol *, combined_entry_type *, unsigned int *,
|
||||
PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *,
|
||||
bfd_size_type *, asection **, bfd_size_type *));
|
||||
static boolean coff_write_alien_symbol
|
||||
PARAMS ((bfd *, asymbol *, unsigned int *, bfd_size_type *,
|
||||
PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *,
|
||||
asection **, bfd_size_type *));
|
||||
static boolean coff_write_native_symbol
|
||||
PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *,
|
||||
PARAMS ((bfd *, coff_symbol_type *, bfd_vma *, bfd_size_type *,
|
||||
asection **, bfd_size_type *));
|
||||
static void coff_pointerize_aux
|
||||
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
|
||||
|
@ -750,7 +750,8 @@ coff_mangle_symbols (bfd_ptr)
|
|||
{
|
||||
/* FIXME: We should use a union here. */
|
||||
s->u.syment.n_value =
|
||||
((combined_entry_type *) s->u.syment.n_value)->offset;
|
||||
(bfd_vma)((combined_entry_type *)
|
||||
((unsigned long) s->u.syment.n_value))->offset;
|
||||
s->fix_value = 0;
|
||||
}
|
||||
if (s->fix_line)
|
||||
|
@ -921,7 +922,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
|
|||
bfd *abfd;
|
||||
asymbol *symbol;
|
||||
combined_entry_type *native;
|
||||
unsigned int *written;
|
||||
bfd_vma *written;
|
||||
bfd_size_type *string_size_p;
|
||||
asection **debug_string_section_p;
|
||||
bfd_size_type *debug_string_size_p;
|
||||
|
@ -1006,7 +1007,7 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
|
|||
debug_string_section_p, debug_string_size_p)
|
||||
bfd *abfd;
|
||||
asymbol *symbol;
|
||||
unsigned int *written;
|
||||
bfd_vma *written;
|
||||
bfd_size_type *string_size_p;
|
||||
asection **debug_string_section_p;
|
||||
bfd_size_type *debug_string_size_p;
|
||||
|
@ -1074,7 +1075,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
|
|||
debug_string_section_p, debug_string_size_p)
|
||||
bfd *abfd;
|
||||
coff_symbol_type *symbol;
|
||||
unsigned int *written;
|
||||
bfd_vma *written;
|
||||
bfd_size_type *string_size_p;
|
||||
asection **debug_string_section_p;
|
||||
bfd_size_type *debug_string_size_p;
|
||||
|
@ -1147,7 +1148,7 @@ coff_write_symbols (abfd)
|
|||
bfd_size_type debug_string_size;
|
||||
unsigned int i;
|
||||
unsigned int limit = bfd_get_symcount (abfd);
|
||||
unsigned int written = 0;
|
||||
bfd_signed_vma written = 0;
|
||||
asymbol **p;
|
||||
|
||||
string_size = 0;
|
||||
|
@ -1917,11 +1918,8 @@ coff_get_symbol_info (abfd, symbol, ret)
|
|||
if (coffsymbol (symbol)->native != NULL
|
||||
&& coffsymbol (symbol)->native->fix_value)
|
||||
{
|
||||
combined_entry_type *psym;
|
||||
|
||||
psym = ((combined_entry_type *)
|
||||
coffsymbol (symbol)->native->u.syment.n_value);
|
||||
ret->value = (bfd_vma) (psym - obj_raw_syments (abfd));
|
||||
ret->value = coffsymbol (symbol)->native->u.syment.n_value -
|
||||
(unsigned long) obj_raw_syments (abfd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1945,8 +1943,8 @@ bfd_coff_get_syment (abfd, symbol, psyment)
|
|||
*psyment = csym->native->u.syment;
|
||||
|
||||
if (csym->native->fix_value)
|
||||
psyment->n_value = ((combined_entry_type *) psyment->n_value
|
||||
- obj_raw_syments (abfd));
|
||||
psyment->n_value = psyment->n_value -
|
||||
(unsigned long) obj_raw_syments (abfd);
|
||||
|
||||
/* FIXME: We should handle fix_line here. */
|
||||
|
||||
|
@ -2023,7 +2021,7 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
case bfd_print_symbol_all:
|
||||
if (coffsymbol (symbol)->native)
|
||||
{
|
||||
unsigned long val;
|
||||
bfd_vma val;
|
||||
unsigned int aux;
|
||||
combined_entry_type *combined = coffsymbol (symbol)->native;
|
||||
combined_entry_type *root = obj_raw_syments (abfd);
|
||||
|
@ -2032,12 +2030,11 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
fprintf (file, "[%3ld]", (long) (combined - root));
|
||||
|
||||
if (! combined->fix_value)
|
||||
val = (unsigned long) combined->u.syment.n_value;
|
||||
val = (bfd_vma) combined->u.syment.n_value;
|
||||
else
|
||||
val = ((unsigned long)
|
||||
((combined_entry_type *) combined->u.syment.n_value
|
||||
- root));
|
||||
val = combined->u.syment.n_value - (unsigned long) root;
|
||||
|
||||
#ifndef XCOFF64
|
||||
fprintf (file,
|
||||
"(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s",
|
||||
combined->u.syment.n_scnum,
|
||||
|
@ -2045,8 +2042,20 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
combined->u.syment.n_type,
|
||||
combined->u.syment.n_sclass,
|
||||
combined->u.syment.n_numaux,
|
||||
(unsigned long) val,
|
||||
symbol->name);
|
||||
#else
|
||||
/* Print out the wide, 64 bit, symbol value */
|
||||
fprintf (file,
|
||||
"(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%016llx %s",
|
||||
combined->u.syment.n_scnum,
|
||||
combined->u.syment.n_flags,
|
||||
combined->u.syment.n_type,
|
||||
combined->u.syment.n_sclass,
|
||||
combined->u.syment.n_numaux,
|
||||
val,
|
||||
symbol->name);
|
||||
#endif
|
||||
|
||||
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
|
||||
{
|
||||
|
|
|
@ -286,6 +286,7 @@ coff_swap_filehdr_in (abfd, src, dst)
|
|||
{
|
||||
FILHDR *filehdr_src = (FILHDR *) src;
|
||||
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
|
||||
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
|
||||
#endif
|
||||
|
|
|
@ -725,6 +725,10 @@ case "${targ}" in
|
|||
targ_defvec=rs6000coff_vec
|
||||
targ_selvecs="rs6000coff64_vec"
|
||||
;;
|
||||
powerpc64-*-aix*)
|
||||
targ_defvec=rs6000coff64_vec
|
||||
targ_selvecs="rs6000coff_vec"
|
||||
;;
|
||||
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
|
||||
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
|
||||
powerpc-*-chorus* | powerpc-*-vxworks*)
|
||||
|
|
|
@ -232,6 +232,7 @@ real_read (where, a,b, file)
|
|||
if (a == 0 || b == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
#if defined (__VAX) && defined (VMS)
|
||||
/* Apparently fread on Vax VMS does not keep the record length
|
||||
information. */
|
||||
|
@ -747,7 +748,6 @@ bfd_seek (abfd, position, direction)
|
|||
file_position += abfd->origin;
|
||||
|
||||
result = fseek (f, file_position, direction);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
int hold_errno = errno;
|
||||
|
|
|
@ -163,10 +163,10 @@ struct xcoff_tdata
|
|||
short cputype;
|
||||
|
||||
/* maxdata from optional header. */
|
||||
bfd_size_type maxdata;
|
||||
bfd_vma maxdata;
|
||||
|
||||
/* maxstack from optional header. */
|
||||
bfd_size_type maxstack;
|
||||
bfd_vma maxstack;
|
||||
|
||||
/* Used by the XCOFF backend linker. */
|
||||
asection **csects;
|
||||
|
|
|
@ -557,24 +557,6 @@ extern boolean _bfd_coff_reloc_link_order
|
|||
#define coff_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
/* Functions in xcofflink.c. */
|
||||
|
||||
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_canonicalize_dynamic_symtab
|
||||
PARAMS ((bfd *, asymbol **));
|
||||
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_canonicalize_dynamic_reloc
|
||||
PARAMS ((bfd *, arelent **, asymbol **));
|
||||
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_xcoff_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_xcoff_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_ppc_xcoff_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
|
||||
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
|
||||
linker, and so should start with bfd and be declared in bfd.h. */
|
||||
|
||||
|
|
266
bfd/libxcoff.h
Normal file
266
bfd/libxcoff.h
Normal file
|
@ -0,0 +1,266 @@
|
|||
/* BFD XCOFF object file private structure.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Written by Tom Rix, Redhat.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef LIBXCOFF_H
|
||||
#define LIBXCOFF_H
|
||||
|
||||
/* This is the backend information kept for XCOFF files. This
|
||||
structure is constant for a particular backend. The first element
|
||||
is the COFF backend data structure, so that XCOFF targets can use
|
||||
the generic COFF code. */
|
||||
|
||||
struct xcoff_backend_data_rec
|
||||
{
|
||||
/*
|
||||
* COFF backend information. Must be the first field.
|
||||
* This is where the std coff swap table goes
|
||||
*/
|
||||
bfd_coff_backend_data coff;
|
||||
|
||||
/* Magic number */
|
||||
unsigned short _xcoff_magic_number;
|
||||
|
||||
/* Architecture and machine for coff_set_arch_mach_hook */
|
||||
enum bfd_architecture _xcoff_architecture;
|
||||
long _xcoff_machine;
|
||||
|
||||
/* function pointers to xcoff specific swap routines */
|
||||
void (* _xcoff_swap_ldhdr_in)(bfd *, PTR, struct internal_ldhdr *);
|
||||
void (* _xcoff_swap_ldhdr_out)(bfd *, struct internal_ldhdr *, PTR);
|
||||
void (* _xcoff_swap_ldsym_in)(bfd *, PTR, struct internal_ldsym *);
|
||||
void (* _xcoff_swap_ldsym_out)(bfd *, struct internal_ldsym *, PTR);
|
||||
void (* _xcoff_swap_ldrel_in)(bfd *, PTR, struct internal_ldrel *);
|
||||
void (* _xcoff_swap_ldrel_out)(bfd *, struct internal_ldrel *, PTR);
|
||||
|
||||
/* size of the the external struct */
|
||||
unsigned int _xcoff_ldhdrsz;
|
||||
unsigned int _xcoff_ldsymsz;
|
||||
unsigned int _xcoff_ldrelsz;
|
||||
|
||||
/* size an entry in a descriptor section */
|
||||
unsigned int _xcoff_function_descriptor_size;
|
||||
|
||||
/* size of the small aout file header */
|
||||
unsigned int _xcoff_small_aout_header_size;
|
||||
|
||||
/*
|
||||
* version
|
||||
* loader version
|
||||
* 1 : xcoff32
|
||||
* 2 : xcoff64
|
||||
*/
|
||||
unsigned long _xcoff_ldhdr_version;
|
||||
|
||||
boolean (* _xcoff_put_symbol_name)(bfd *, struct bfd_strtab_hash *,
|
||||
struct internal_syment *,
|
||||
const char *);
|
||||
|
||||
boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *,
|
||||
struct internal_ldsym *,
|
||||
const char *);
|
||||
|
||||
reloc_howto_type *_xcoff_dynamic_reloc;
|
||||
|
||||
asection * (* _xcoff_create_csect_from_smclas) (bfd *, union internal_auxent *, const char *);
|
||||
|
||||
/*
|
||||
* line_no and reloc overflow
|
||||
* 32 overflows to another section when the line_no or reloc count go
|
||||
* over 0xffff. 64 does not overflow.
|
||||
*/
|
||||
boolean (*_xcoff_is_lineno_count_overflow)(bfd *, bfd_vma);
|
||||
boolean (*_xcoff_is_reloc_count_overflow)(bfd *, bfd_vma);
|
||||
|
||||
/*
|
||||
* .loader symbol table offset
|
||||
* 32 is after the .loader header
|
||||
* 64 is offset in .loader header
|
||||
*
|
||||
* Similar for the reloc table
|
||||
*/
|
||||
bfd_vma (*_xcoff_loader_symbol_offset)(bfd *, struct internal_ldhdr *);
|
||||
bfd_vma (*_xcoff_loader_reloc_offset)(bfd *, struct internal_ldhdr *);
|
||||
|
||||
|
||||
/*
|
||||
* Global linkage
|
||||
*
|
||||
* The first word of global linkage code must be be modified by
|
||||
* filling in the correct TOC offset.
|
||||
*/
|
||||
unsigned long *_xcoff_glink_code;
|
||||
|
||||
/*
|
||||
* Size of the global link code in bytes of the xcoff_glink_code table
|
||||
*/
|
||||
unsigned long _xcoff_glink_size;
|
||||
|
||||
};
|
||||
|
||||
/* Look up an entry in an XCOFF link hash table. */
|
||||
|
||||
#define xcoff_link_hash_lookup(table, string, create, copy, follow) \
|
||||
((struct xcoff_link_hash_entry *) \
|
||||
bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\
|
||||
(follow)))
|
||||
|
||||
/* Traverse an XCOFF link hash table. */
|
||||
|
||||
#define xcoff_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the XCOFF link hash table from the info structure. This is
|
||||
just a cast. */
|
||||
|
||||
#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash))
|
||||
|
||||
|
||||
#define xcoff_backend(abfd) \
|
||||
((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data)
|
||||
|
||||
#define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number))
|
||||
#define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture))
|
||||
#define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine))
|
||||
|
||||
#define bfd_xcoff_swap_ldhdr_in(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_swap_ldhdr_out(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_swap_ldsym_in(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_swap_ldsym_out(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_swap_ldrel_in(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_swap_ldrel_out(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c)))
|
||||
|
||||
#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz))
|
||||
#define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz))
|
||||
#define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz))
|
||||
#define bfd_xcoff_function_descriptor_size(a) \
|
||||
((xcoff_backend(a)->_xcoff_function_descriptor_size))
|
||||
#define bfd_xcoff_small_aout_header_size(a) \
|
||||
((xcoff_backend(a)->_xcoff_small_aout_header_size))
|
||||
|
||||
#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version))
|
||||
|
||||
#define bfd_xcoff_put_symbol_name(a, b, c, d) \
|
||||
((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
|
||||
|
||||
#define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
|
||||
((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
|
||||
|
||||
/* Get the XCOFF hash table entries for a BFD. */
|
||||
#define obj_xcoff_sym_hashes(bfd) \
|
||||
((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
|
||||
|
||||
#define bfd_xcoff_dynamic_reloc_howto(a) \
|
||||
((xcoff_backend(a)->_xcoff_dynamic_reloc))
|
||||
|
||||
#define bfd_xcoff_create_csect_from_smclas(a, b, c) \
|
||||
((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c))))
|
||||
|
||||
#define bfd_xcoff_is_lineno_count_overflow(a, b) \
|
||||
((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b))))
|
||||
|
||||
#define bfd_xcoff_is_reloc_count_overflow(a, b) \
|
||||
((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b))))
|
||||
|
||||
#define bfd_xcoff_loader_symbol_offset(a, b) \
|
||||
((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b))))
|
||||
|
||||
#define bfd_xcoff_loader_reloc_offset(a, b) \
|
||||
((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b))))
|
||||
|
||||
#define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)]))
|
||||
#define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size))
|
||||
|
||||
#define bfd_xcoff_is_xcoff64(a) (0x01EF == (bfd_xcoff_magic_number(a)))
|
||||
#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a)))
|
||||
|
||||
/* Functions in xcofflink.c. */
|
||||
|
||||
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_canonicalize_dynamic_symtab
|
||||
PARAMS ((bfd *, asymbol **));
|
||||
extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_canonicalize_dynamic_reloc
|
||||
PARAMS ((bfd *, arelent **, asymbol **));
|
||||
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_xcoff_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_xcoff_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_xcoff_slurp_symbol_table
|
||||
PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_get_symbol_table
|
||||
PARAMS ((bfd *, asymbol **));
|
||||
extern asymbol *_bfd_xcoff_make_empty_symbol
|
||||
PARAMS ((bfd *));
|
||||
extern long _bfd_xcoff_get_symbol_table_upper_bound
|
||||
PARAMS ((bfd *));
|
||||
extern void _bfd_xcoff_print_symbol
|
||||
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
extern void _bfd_xcoff_get_symbol_info
|
||||
PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
extern long _bfd_xcoff_canonicalize_reloc
|
||||
PARAMS((bfd *, sec_ptr, arelent **, asymbol **));
|
||||
extern reloc_howto_type *_bfd_xcoff_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
bfd_vma *));
|
||||
extern boolean _bfd_xcoff_set_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
boolean _bfd_xcoff_write_object_contents PARAMS ((bfd *));
|
||||
|
||||
|
||||
/* XCOFF support routines for the linker. */
|
||||
|
||||
extern boolean bfd_xcoff_link_record_set
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
bfd_size_type));
|
||||
extern boolean bfd_xcoff_import_symbol
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
bfd_vma, const char *, const char *, const char *));
|
||||
extern boolean bfd_xcoff_export_symbol
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
boolean));
|
||||
extern boolean bfd_xcoff_link_count_reloc
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
||||
extern boolean bfd_xcoff_record_link_assignment
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
||||
extern boolean bfd_xcoff_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
|
||||
unsigned long, unsigned long, unsigned long, boolean,
|
||||
int, boolean, boolean, struct sec **));
|
||||
extern boolean xcoff_slurp_reloc_table
|
||||
PARAMS ((bfd *, asection *, asymbol **));
|
||||
|
||||
#endif /* LIBXCOFF_H */
|
1993
bfd/xcofflink.c
1993
bfd/xcofflink.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue