also consider ABS_COMMON to include an library element

This commit is contained in:
bebbo
2017-12-23 19:36:35 +01:00
parent 268f7957b7
commit f9ae4ed1e2
+194 -198
View File
@@ -279,9 +279,7 @@ static reloc_howto_type howto_table[R__MAX] =
AmigaOS upto 3.9 goofed parsing HUNK_RELRELOC32 within an executable AmigaOS upto 3.9 goofed parsing HUNK_RELRELOC32 within an executable
and reads the hunk data as 16bit words. */ and reads the hunk data as 16bit words. */
static bfd_boolean static bfd_boolean
amiga_reloc_long_p (type, isload) amiga_reloc_long_p (unsigned long type, bfd_boolean isload)
unsigned long type;
bfd_boolean isload;
{ {
if (type == HUNK_RELOC32SHORT if (type == HUNK_RELOC32SHORT
|| (isload && (type == HUNK_DREL32 || type == HUNK_RELRELOC32))) || (isload && (type == HUNK_DREL32 || type == HUNK_RELRELOC32)))
@@ -290,9 +288,7 @@ amiga_reloc_long_p (type, isload)
} }
static reloc_howto_type * static reloc_howto_type *
howto_for_raw_reloc (type, isload) howto_for_raw_reloc (unsigned long type, bfd_boolean isload)
unsigned long type;
bfd_boolean isload;
{ {
switch (type) switch (type)
{ {
@@ -321,8 +317,7 @@ howto_for_raw_reloc (type, isload)
} }
static reloc_howto_type * static reloc_howto_type *
howto_for_reloc (type) howto_for_reloc (unsigned long type)
unsigned long type;
{ {
switch (type) switch (type)
{ {
@@ -377,9 +372,7 @@ extern int amiga_base_relative;
extern int amiga_resident; extern int amiga_resident;
static bfd_boolean static bfd_boolean
get_long (abfd, n) get_long (bfd * abfd, unsigned long *n)
bfd *abfd;
unsigned long *n;
{ {
if (bfd_bread ((PTR) n, 4, abfd) != 4) if (bfd_bread ((PTR) n, 4, abfd) != 4)
return FALSE; return FALSE;
@@ -388,9 +381,7 @@ get_long (abfd, n)
} }
static bfd_boolean static bfd_boolean
get_word (abfd, n) get_word (bfd * abfd, unsigned long *n)
bfd *abfd;
unsigned long *n;
{ {
if (bfd_bread ((PTR) n, 2, abfd) != 2) if (bfd_bread ((PTR) n, 2, abfd) != 2)
return FALSE; return FALSE;
@@ -399,8 +390,7 @@ get_word (abfd, n)
} }
static const struct bfd_target * static const struct bfd_target *
amiga_object_p (abfd) amiga_object_p (bfd * abfd)
bfd *abfd;
{ {
unsigned long x; unsigned long x;
char buf[8]; char buf[8];
@@ -443,8 +433,7 @@ amiga_object_p (abfd)
return abfd->xvec; return abfd->xvec;
} }
static sec_ptr amiga_get_section_by_hunk_number (abfd, hunk_number) static sec_ptr amiga_get_section_by_hunk_number (bfd *abfd, long hunk_number)
bfd *abfd;long hunk_number;
{ {
/* A cache, so we don't have to search the entire list every time. */ /* A cache, so we don't have to search the entire list every time. */
static sec_ptr last_reference; static sec_ptr last_reference;
@@ -467,13 +456,13 @@ static sec_ptr amiga_get_section_by_hunk_number (abfd, hunk_number)
} }
static bfd_boolean static bfd_boolean
amiga_add_reloc (abfd, section, offset, symbol, howto, target_hunk) amiga_add_reloc (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
bfd_size_type offset; bfd_size_type offset,
amiga_symbol_type *symbol; amiga_symbol_type *symbol,
reloc_howto_type *howto; reloc_howto_type *howto,
long target_hunk; long target_hunk)
{ {
amiga_reloc_type *reloc; amiga_reloc_type *reloc;
sec_ptr target_sec; sec_ptr target_sec;
@@ -514,9 +503,9 @@ amiga_add_reloc (abfd, section, offset, symbol, howto, target_hunk)
/* BFD doesn't currently allow multiple sections with the same /* BFD doesn't currently allow multiple sections with the same
name, so we try a little harder to get a unique name. */ name, so we try a little harder to get a unique name. */
static sec_ptr static sec_ptr
amiga_make_unique_section (abfd, name) amiga_make_unique_section (
bfd *abfd; bfd *abfd,
const char *name; const char *name)
{ {
sec_ptr section; sec_ptr section;
@@ -576,13 +565,13 @@ amiga_make_unique_section (abfd, name)
#endif #endif
static bfd_boolean static bfd_boolean
parse_archive_units (abfd, n_units, filesize, one, syms, symcount) parse_archive_units (
bfd *abfd; bfd *abfd,
int *n_units; int *n_units,
unsigned long filesize; unsigned long filesize,
bfd_boolean one; /* parse only the first unit? */ bfd_boolean one, /* parse only the first unit? */
struct arch_syms **syms; struct arch_syms **syms,
symindex *symcount; symindex *symcount)
{ {
struct arch_syms *nsyms, *syms_tail = NULL; struct arch_syms *nsyms, *syms_tail = NULL;
unsigned long unit_offset, defsym_pos = 0; unsigned long unit_offset, defsym_pos = 0;
@@ -774,6 +763,7 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount)
case EXT_SYMB: case EXT_SYMB:
case EXT_DEF: case EXT_DEF:
case EXT_ABS: case EXT_ABS:
case EXT_ABSCOMMON:
/* retain the positions of defined symbols for each object /* retain the positions of defined symbols for each object
in the archive. They'll be used later to build a in the archive. They'll be used later to build a
pseudo-armap, which _bfd_generic_link_add_archive_symbols pseudo-armap, which _bfd_generic_link_add_archive_symbols
@@ -789,9 +779,19 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount)
name[len<<2] = 0; name[len<<2] = 0;
DPRINT(20,("sym: %s\n", name)); DPRINT(20,("sym: %s\n", name));
} }
else if (bfd_seek (abfd, (len + 1) << 2, SEEK_CUR)) else if (bfd_seek (abfd, (len + 1) << 2, SEEK_CUR))
return FALSE; return FALSE;
defsymcount++; defsymcount++;
if (type == EXT_ABSCOMMON)
{
/* skip references */
if (!get_long (abfd, &no))
return FALSE;
if (no && bfd_seek (abfd, no << 2, SEEK_CUR))
return FALSE;
}
break; break;
case EXT_ABSREF32: case EXT_ABSREF32:
@@ -814,7 +814,6 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount)
return FALSE; return FALSE;
break; break;
case EXT_ABSCOMMON:
case EXT_RELCOMMON: case EXT_RELCOMMON:
case EXT_DEXT32COMMON: case EXT_DEXT32COMMON:
case EXT_DEXT16COMMON: case EXT_DEXT16COMMON:
@@ -870,8 +869,8 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount)
return (bfd_tell (abfd) == filesize); return (bfd_tell (abfd) == filesize);
} }
static bfd_boolean amiga_digest_file (abfd) static bfd_boolean amiga_digest_file (
bfd *abfd; bfd *abfd)
{ {
struct stat stat_buffer; struct stat stat_buffer;
unsigned long tmp; unsigned long tmp;
@@ -911,9 +910,9 @@ static bfd_boolean amiga_digest_file (abfd)
/* Read in Unit file */ /* Read in Unit file */
/* file pointer is located after the HUNK_UNIT LW */ /* file pointer is located after the HUNK_UNIT LW */
static bfd_boolean static bfd_boolean
amiga_read_unit (abfd, size) amiga_read_unit (
bfd *abfd; bfd *abfd,
unsigned long size; unsigned long size)
{ {
unsigned long hunk_number = 0, hunk_type, tmp; unsigned long hunk_number = 0, hunk_type, tmp;
@@ -968,8 +967,8 @@ amiga_read_unit (abfd, size)
/* Read a load file */ /* Read a load file */
static bfd_boolean static bfd_boolean
amiga_read_load (abfd) amiga_read_load (
bfd *abfd; bfd *abfd)
{ {
unsigned long *hunk_attributes, *hunk_sizes; unsigned long *hunk_attributes, *hunk_sizes;
unsigned long max_hunk_number, hunk_type, i; unsigned long max_hunk_number, hunk_type, i;
@@ -1085,13 +1084,12 @@ amiga_read_load (abfd)
/* Handle NAME, CODE, DATA, BSS, DEBUG Hunks */ /* Handle NAME, CODE, DATA, BSS, DEBUG Hunks */
static bfd_boolean static bfd_boolean
amiga_handle_cdb_hunk (abfd, hunk_type, hunk_number, hunk_attribute, amiga_handle_cdb_hunk (
hunk_size) bfd *abfd,
bfd *abfd; unsigned long hunk_type,
unsigned long hunk_type; unsigned long hunk_number,
unsigned long hunk_number; unsigned long hunk_attribute,
unsigned long hunk_attribute; unsigned long hunk_size)
unsigned long hunk_size;
/* If hunk_size==-1, then we are digesting a HUNK_UNIT */ /* If hunk_size==-1, then we are digesting a HUNK_UNIT */
{ {
sec_ptr current_section; sec_ptr current_section;
@@ -1293,10 +1291,10 @@ amiga_handle_cdb_hunk (abfd, hunk_type, hunk_number, hunk_attribute,
/* Handle rest of a hunk /* Handle rest of a hunk
I.e.: Relocs, EXT, SYMBOLS... */ I.e.: Relocs, EXT, SYMBOLS... */
static bfd_boolean static bfd_boolean
amiga_handle_rest (abfd, current_section, isload) amiga_handle_rest (
bfd *abfd; bfd *abfd,
sec_ptr current_section; sec_ptr current_section,
bfd_boolean isload; bfd_boolean isload)
{ {
amiga_per_section_type *asect = amiga_per_section(current_section); amiga_per_section_type *asect = amiga_per_section(current_section);
unsigned long hunk_type, hunk_value, relno, type, len, no; unsigned long hunk_type, hunk_value, relno, type, len, no;
@@ -1489,8 +1487,8 @@ amiga_handle_rest (abfd, current_section, isload)
}/* of amiga_handle_rest */ }/* of amiga_handle_rest */
static bfd_boolean static bfd_boolean
amiga_mkobject (abfd) amiga_mkobject (
bfd *abfd; bfd *abfd)
{ {
amiga_data_type *rawptr; amiga_data_type *rawptr;
rawptr = (amiga_data_type *) bfd_zalloc (abfd, sizeof(*rawptr)); rawptr = (amiga_data_type *) bfd_zalloc (abfd, sizeof(*rawptr));
@@ -1499,8 +1497,8 @@ amiga_mkobject (abfd)
} }
static bfd_boolean static bfd_boolean
amiga_mkarchive (abfd) amiga_mkarchive (
bfd *abfd; bfd *abfd)
{ {
amiga_ardata_type *ar; amiga_ardata_type *ar;
ar = (amiga_ardata_type *) bfd_zalloc (abfd, sizeof(*ar)); ar = (amiga_ardata_type *) bfd_zalloc (abfd, sizeof(*ar));
@@ -1510,10 +1508,10 @@ amiga_mkarchive (abfd)
/* write nb long words (possibly swapped out) to the output file */ /* write nb long words (possibly swapped out) to the output file */
static bfd_boolean static bfd_boolean
write_longs (in, nb, abfd) write_longs (
const unsigned long *in; const unsigned long *in,
unsigned long nb; unsigned long nb,
bfd *abfd; bfd *abfd)
{ {
unsigned char out[10 * 4]; unsigned char out[10 * 4];
unsigned long i; unsigned long i;
@@ -1530,10 +1528,10 @@ write_longs (in, nb, abfd)
} }
static bfd_boolean static bfd_boolean
write_words (in, nb, abfd) write_words (
const unsigned long *in; const unsigned long *in,
unsigned long nb; unsigned long nb,
bfd *abfd; bfd *abfd)
{ {
unsigned char out[10 * 2]; unsigned char out[10 * 2];
unsigned long i; unsigned long i;
@@ -1550,9 +1548,9 @@ write_words (in, nb, abfd)
} }
static long static long
determine_datadata_relocs (abfd, section) determine_datadata_relocs (
bfd *abfd ATTRIBUTE_UNUSED; bfd *abfd ATTRIBUTE_UNUSED,
sec_ptr section; sec_ptr section)
{ {
sec_ptr insection; sec_ptr insection;
asymbol *sym_p; asymbol *sym_p;
@@ -1578,9 +1576,9 @@ determine_datadata_relocs (abfd, section)
/* Adjust the indices map when we decide not to output the section <sec> */ /* Adjust the indices map when we decide not to output the section <sec> */
static void static void
remove_section_index (sec, index_map) remove_section_index (
sec_ptr sec; sec_ptr sec,
int *index_map; int *index_map)
{ {
int i = sec->index; int i = sec->index;
for (sec = sec->next, index_map[i++] = -1; sec; sec = sec->next) for (sec = sec->next, index_map[i++] = -1; sec; sec = sec->next)
@@ -1589,8 +1587,8 @@ remove_section_index (sec, index_map)
/* Write out the contents of a bfd */ /* Write out the contents of a bfd */
static bfd_boolean static bfd_boolean
amiga_write_object_contents (abfd) amiga_write_object_contents (
bfd *abfd; bfd *abfd)
{ {
long datadata_relocs = 0, bss_size = 0, idx; long datadata_relocs = 0, bss_size = 0, idx;
int *index_map, max_hunk = -1; int *index_map, max_hunk = -1;
@@ -1934,10 +1932,10 @@ amiga_write_object_contents (abfd)
/* Write a string padded to 4 bytes and preceded by it's length in /* Write a string padded to 4 bytes and preceded by it's length in
long words ORed with <value> */ long words ORed with <value> */
static bfd_boolean static bfd_boolean
write_name (abfd, name, value) write_name (
bfd *abfd; bfd *abfd,
const char *name; const char *name,
unsigned long value; unsigned long value)
{ {
unsigned long n[1]; unsigned long n[1];
size_t l; size_t l;
@@ -1956,8 +1954,8 @@ write_name (abfd, name, value)
} }
static bfd_boolean static bfd_boolean
amiga_write_archive_contents (arch) amiga_write_archive_contents (
bfd *arch; bfd *arch)
{ {
struct stat status; struct stat status;
bfd *object; bfd *object;
@@ -2011,19 +2009,19 @@ amiga_write_archive_contents (arch)
} }
static bfd_boolean static bfd_boolean
amiga_write_armap (arch, elength, map, orl_count, stridx) amiga_write_armap (
bfd *arch ATTRIBUTE_UNUSED; bfd *arch ATTRIBUTE_UNUSED,
unsigned int elength ATTRIBUTE_UNUSED; unsigned int elength ATTRIBUTE_UNUSED,
struct orl *map ATTRIBUTE_UNUSED; struct orl *map ATTRIBUTE_UNUSED,
unsigned int orl_count ATTRIBUTE_UNUSED; unsigned int orl_count ATTRIBUTE_UNUSED,
int stridx ATTRIBUTE_UNUSED; int stridx ATTRIBUTE_UNUSED)
{ {
return TRUE; return TRUE;
} }
static int static int
determine_type (r) determine_type (
arelent *r; arelent *r)
{ {
switch (r->howto->type) switch (r->howto->type)
{ {
@@ -2067,14 +2065,13 @@ static const unsigned long reloc_types[NB_RELOC_TYPES] = {
/* Write out section contents, including relocs */ /* Write out section contents, including relocs */
static bfd_boolean static bfd_boolean
amiga_write_section_contents (abfd, section, data_sec, datadata_relocs, amiga_write_section_contents (
index_map, max_hunk) bfd *abfd,
bfd *abfd; sec_ptr section,
sec_ptr section; sec_ptr data_sec,
sec_ptr data_sec; unsigned long datadata_relocs,
unsigned long datadata_relocs; int *index_map,
int *index_map; int max_hunk)
int max_hunk;
{ {
sec_ptr insection; sec_ptr insection;
asymbol *sym_p; asymbol *sym_p;
@@ -2422,8 +2419,8 @@ amiga_write_section_contents (abfd, section, data_sec, datadata_relocs,
In the case, we were linking base relative, the symbols of the .bss In the case, we were linking base relative, the symbols of the .bss
hunk have been converted already to belong to the .data hunk */ hunk have been converted already to belong to the .data hunk */
static bfd_boolean amiga_write_symbols (abfd, section) static bfd_boolean amiga_write_symbols (
bfd *abfd;sec_ptr section; bfd *abfd, sec_ptr section)
{ {
sec_ptr osection; sec_ptr osection;
asymbol *sym_p; asymbol *sym_p;
@@ -2696,12 +2693,12 @@ static bfd_boolean amiga_write_symbols (abfd, section)
} }
static bfd_boolean static bfd_boolean
amiga_get_section_contents (abfd, section, location, offset, count) amiga_get_section_contents (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
PTR location; PTR location,
file_ptr offset; file_ptr offset,
bfd_size_type count; bfd_size_type count)
{ {
unsigned long disk_size=amiga_per_section(section)->disk_size; unsigned long disk_size=amiga_per_section(section)->disk_size;
@@ -2725,9 +2722,9 @@ bfd_size_type count;
} }
static bfd_boolean static bfd_boolean
amiga_new_section_hook (abfd, newsect) amiga_new_section_hook (
bfd *abfd; bfd *abfd,
sec_ptr newsect; sec_ptr newsect)
{ {
newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof(amiga_per_section_type)); newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof(amiga_per_section_type));
newsect->alignment_power = 2; newsect->alignment_power = 2;
@@ -2739,8 +2736,8 @@ amiga_new_section_hook (abfd, newsect)
} }
static bfd_boolean static bfd_boolean
amiga_slurp_symbol_table (abfd) amiga_slurp_symbol_table (
bfd *abfd; bfd *abfd)
{ {
amiga_data_type *amiga_data = AMIGA_DATA(abfd); amiga_data_type *amiga_data = AMIGA_DATA(abfd);
amiga_symbol_type *asp; amiga_symbol_type *asp;
@@ -2980,16 +2977,16 @@ amiga_slurp_symbol_table (abfd)
} }
/* Get size of symtab */ /* Get size of symtab */
static long amiga_get_symtab_upper_bound (abfd) static long amiga_get_symtab_upper_bound (
bfd *abfd; bfd *abfd)
{ {
if (!amiga_slurp_symbol_table (abfd)) if (!amiga_slurp_symbol_table (abfd))
return -1; return -1;
return (bfd_get_symcount (abfd) + 1) * (sizeof(amiga_symbol_type *)); return (bfd_get_symcount (abfd) + 1) * (sizeof(amiga_symbol_type *));
} }
static long amiga_get_symtab (abfd, location) static long amiga_get_symtab (
bfd *abfd;asymbol **location; bfd *abfd,asymbol **location)
{ {
if (!amiga_slurp_symbol_table (abfd)) if (!amiga_slurp_symbol_table (abfd))
return -1; return -1;
@@ -3006,8 +3003,8 @@ static long amiga_get_symtab (abfd, location)
static asymbol * static asymbol *
amiga_make_empty_symbol (abfd) amiga_make_empty_symbol (
bfd *abfd; bfd *abfd)
{ {
amiga_symbol_type *new = (amiga_symbol_type *) bfd_zalloc (abfd, sizeof(amiga_symbol_type)); amiga_symbol_type *new = (amiga_symbol_type *) bfd_zalloc (abfd, sizeof(amiga_symbol_type));
new->symbol.the_bfd = abfd; new->symbol.the_bfd = abfd;
@@ -3016,10 +3013,10 @@ amiga_make_empty_symbol (abfd)
static void static void
amiga_get_symbol_info (ignore_abfd, symbol, ret) amiga_get_symbol_info (
bfd *ignore_abfd ATTRIBUTE_UNUSED; bfd *ignore_abfd ATTRIBUTE_UNUSED,
asymbol *symbol; asymbol *symbol,
symbol_info *ret; symbol_info *ret)
{ {
bfd_symbol_info (symbol, ret); bfd_symbol_info (symbol, ret);
if (symbol->name[0] == ' ') if (symbol->name[0] == ' ')
@@ -3030,11 +3027,11 @@ amiga_get_symbol_info (ignore_abfd, symbol, ret)
static void static void
amiga_print_symbol (abfd, afile, symbol, how) amiga_print_symbol (
bfd *abfd; bfd *abfd,
PTR afile; PTR afile,
asymbol *symbol; asymbol *symbol,
bfd_print_symbol_type how; bfd_print_symbol_type how)
{ {
FILE *file = (FILE *)afile; FILE *file = (FILE *)afile;
@@ -3068,20 +3065,20 @@ bfd_print_symbol_type how;
static long static long
amiga_get_reloc_upper_bound (abfd, asect) amiga_get_reloc_upper_bound (
bfd *abfd ATTRIBUTE_UNUSED; bfd *abfd ATTRIBUTE_UNUSED,
sec_ptr asect; sec_ptr asect)
{ {
return (asect->reloc_count + 1) * sizeof(arelent *); return (asect->reloc_count + 1) * sizeof(arelent *);
} }
static bfd_boolean static bfd_boolean
read_raw_relocs (abfd, section, d_offset, count) read_raw_relocs (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
unsigned long d_offset; /* offset in the bfd */ unsigned long d_offset, /* offset in the bfd */
unsigned long count; /* number of relocs */ unsigned long count) /* number of relocs */
{ {
unsigned long hunk_number, offset, type, no, j; unsigned long hunk_number, offset, type, no, j;
reloc_howto_type *howto; reloc_howto_type *howto;
@@ -3149,10 +3146,10 @@ read_raw_relocs (abfd, section, d_offset, count)
/* slurp in relocs, amiga_digest_file left various pointers for us */ /* slurp in relocs, amiga_digest_file left various pointers for us */
static bfd_boolean static bfd_boolean
amiga_slurp_relocs (abfd, section, symbols) amiga_slurp_relocs (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
asymbol **symbols ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED)
{ {
amiga_per_section_type *asect = amiga_per_section(section); amiga_per_section_type *asect = amiga_per_section(section);
reloc_howto_type *howto; reloc_howto_type *howto;
@@ -3229,11 +3226,11 @@ amiga_slurp_relocs (abfd, section, symbols)
static long static long
amiga_canonicalize_reloc (abfd, section, relptr, symbols) amiga_canonicalize_reloc (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
arelent **relptr; arelent **relptr,
asymbol **symbols; asymbol **symbols)
{ {
amiga_reloc_type *src; amiga_reloc_type *src;
@@ -3255,12 +3252,12 @@ amiga_canonicalize_reloc (abfd, section, relptr, symbols)
if this has not already been done if this has not already been done
Then we set the memory area to the contents */ Then we set the memory area to the contents */
static bfd_boolean static bfd_boolean
amiga_set_section_contents (abfd, section, location, offset, count) amiga_set_section_contents (
bfd *abfd; bfd *abfd,
sec_ptr section; sec_ptr section,
PTR location; PTR location,
file_ptr offset; file_ptr offset,
bfd_size_type count; bfd_size_type count)
{ {
if ((section->flags&SEC_HAS_CONTENTS)==0) /* BSS */ if ((section->flags&SEC_HAS_CONTENTS)==0) /* BSS */
{ {
@@ -3285,10 +3282,10 @@ bfd_size_type count;
/* FIXME: Is this everything? */ /* FIXME: Is this everything? */
static bfd_boolean static bfd_boolean
amiga_set_arch_mach (abfd, arch, machine) amiga_set_arch_mach (
bfd *abfd; bfd *abfd,
enum bfd_architecture arch; enum bfd_architecture arch,
unsigned long machine; unsigned long machine)
{ {
bfd_default_set_arch_mach (abfd, arch, machine); bfd_default_set_arch_mach (abfd, arch, machine);
if (arch == bfd_arch_m68k) if (arch == bfd_arch_m68k)
@@ -3312,9 +3309,9 @@ amiga_set_arch_mach (abfd, arch, machine)
} }
static int static int
amiga_sizeof_headers (ignore_abfd, ignore) amiga_sizeof_headers (
bfd *ignore_abfd ATTRIBUTE_UNUSED; bfd *ignore_abfd ATTRIBUTE_UNUSED,
bfd_boolean ignore ATTRIBUTE_UNUSED; bfd_boolean ignore ATTRIBUTE_UNUSED)
{ {
/* The amiga hunk format doesn't have headers. */ /* The amiga hunk format doesn't have headers. */
return 0; return 0;
@@ -3324,24 +3321,23 @@ amiga_sizeof_headers (ignore_abfd, ignore)
and return the name of the source file and the line nearest to the and return the name of the source file and the line nearest to the
wanted location. */ wanted location. */
bfd_boolean bfd_boolean
amiga_find_nearest_line (abfd, section, symbols, offset, filename_ptr, amiga_find_nearest_line (
functionname_ptr, line_ptr) bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; sec_ptr section ATTRIBUTE_UNUSED,
sec_ptr section ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED,
bfd_vma offset ATTRIBUTE_UNUSED; const char **filename_ptr ATTRIBUTE_UNUSED,
const char **filename_ptr ATTRIBUTE_UNUSED; const char **functionname_ptr ATTRIBUTE_UNUSED,
const char **functionname_ptr ATTRIBUTE_UNUSED; unsigned int *line_ptr ATTRIBUTE_UNUSED)
unsigned int *line_ptr ATTRIBUTE_UNUSED;
{ {
/* FIXME (see aoutx.h, for example) */ /* FIXME (see aoutx.h, for example) */
return FALSE; return FALSE;
} }
static reloc_howto_type * static reloc_howto_type *
amiga_bfd_reloc_type_lookup (abfd, code) amiga_bfd_reloc_type_lookup (
bfd *abfd ATTRIBUTE_UNUSED; bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code; bfd_reloc_code_real_type code)
{ {
DPRINT(5,("reloc: %s (%d)\n",bfd_get_reloc_code_name(code),code)); DPRINT(5,("reloc: %s (%d)\n",bfd_get_reloc_code_name(code),code));
switch (code) switch (code)
@@ -3362,9 +3358,9 @@ amiga_bfd_reloc_type_lookup (abfd, code)
} }
static bfd_boolean static bfd_boolean
amiga_bfd_copy_private_bfd_data (ibfd, obfd) amiga_bfd_copy_private_bfd_data (
bfd *ibfd; bfd *ibfd,
bfd *obfd; bfd *obfd)
{ {
if (bfd_get_flavour (ibfd) == bfd_target_amiga_flavour if (bfd_get_flavour (ibfd) == bfd_target_amiga_flavour
&& bfd_get_flavour (obfd) == bfd_target_amiga_flavour) { && bfd_get_flavour (obfd) == bfd_target_amiga_flavour) {
@@ -3374,11 +3370,11 @@ amiga_bfd_copy_private_bfd_data (ibfd, obfd)
} }
static bfd_boolean static bfd_boolean
amiga_bfd_copy_private_section_data (ibfd, isec, obfd, osec) amiga_bfd_copy_private_section_data (
bfd *ibfd ATTRIBUTE_UNUSED; bfd *ibfd ATTRIBUTE_UNUSED,
sec_ptr isec; sec_ptr isec,
bfd *obfd ATTRIBUTE_UNUSED; bfd *obfd ATTRIBUTE_UNUSED,
sec_ptr osec; sec_ptr osec)
{ {
if (bfd_get_flavour (osec->owner) == bfd_target_amiga_flavour if (bfd_get_flavour (osec->owner) == bfd_target_amiga_flavour
&& bfd_get_flavour (isec->owner) == bfd_target_amiga_flavour) && bfd_get_flavour (isec->owner) == bfd_target_amiga_flavour)
@@ -3392,8 +3388,8 @@ amiga_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
/* There is no armap in the amiga libraries, so we fill carsym entries /* There is no armap in the amiga libraries, so we fill carsym entries
one by one after having parsed the whole archive. */ one by one after having parsed the whole archive. */
static bfd_boolean static bfd_boolean
amiga_slurp_armap (abfd) amiga_slurp_armap (
bfd *abfd; bfd *abfd)
{ {
struct arch_syms *syms; struct arch_syms *syms;
carsym *defsyms, *csym; carsym *defsyms, *csym;
@@ -3435,16 +3431,16 @@ amiga_slurp_armap (abfd)
symblock += 4; symblock += 4;
len = n & 0xffffff; len = n & 0xffffff;
type = (n >> 24) & 0xff; type = (n >> 24) & 0xff;
len <<= 2;
csym->name = symblock;
csym->name[len] = '\0';
csym->file_offset = syms->unit_offset;
csym++;
switch (type) switch (type)
{ {
case EXT_SYMB: case EXT_SYMB:
case EXT_DEF: case EXT_DEF:
case EXT_ABS: case EXT_ABS:
len <<= 2;
csym->name = symblock;
csym->name[len] = '\0';
csym->file_offset = syms->unit_offset;
csym++;
symblock += len + 4; /* name+value */ symblock += len + 4; /* name+value */
break; break;
case EXT_ABSREF32: case EXT_ABSREF32:
@@ -3457,7 +3453,7 @@ amiga_slurp_armap (abfd)
case EXT_ABSREF16: case EXT_ABSREF16:
case EXT_ABSREF8: case EXT_ABSREF8:
case EXT_RELREF26: case EXT_RELREF26:
symblock += len << 2; symblock += len;
symblock += (1 + GL(symblock)) << 2; symblock += (1 + GL(symblock)) << 2;
break; break;
case EXT_ABSCOMMON: case EXT_ABSCOMMON:
@@ -3465,7 +3461,7 @@ amiga_slurp_armap (abfd)
case EXT_DEXT32COMMON: case EXT_DEXT32COMMON:
case EXT_DEXT16COMMON: case EXT_DEXT16COMMON:
case EXT_DEXT8COMMON: case EXT_DEXT8COMMON:
symblock += (len << 2) + 4; symblock += len + 4;
symblock += (1 + GL(symblock)) << 2; symblock += (1 + GL(symblock)) << 2;
break; break;
default: /* error */ default: /* error */
@@ -3479,16 +3475,16 @@ amiga_slurp_armap (abfd)
} }
static void static void
amiga_truncate_arname (abfd, pathname, arhdr) amiga_truncate_arname (
bfd *abfd ATTRIBUTE_UNUSED; bfd *abfd ATTRIBUTE_UNUSED,
const char *pathname ATTRIBUTE_UNUSED; const char *pathname ATTRIBUTE_UNUSED,
char *arhdr ATTRIBUTE_UNUSED; char *arhdr ATTRIBUTE_UNUSED)
{ {
} }
static const struct bfd_target * static const struct bfd_target *
amiga_archive_p (abfd) amiga_archive_p (
bfd *abfd; bfd *abfd)
{ {
struct arch_syms *symbols = NULL; struct arch_syms *symbols = NULL;
struct stat stat_buffer; struct stat stat_buffer;
@@ -3549,9 +3545,9 @@ amiga_archive_p (abfd)
} }
static bfd * static bfd *
amiga_openr_next_archived_file (archive, last_file) amiga_openr_next_archived_file (
bfd *archive; bfd *archive,
bfd *last_file; bfd *last_file)
{ {
file_ptr filestart; file_ptr filestart;
@@ -3569,8 +3565,8 @@ amiga_openr_next_archived_file (archive, last_file)
} }
static PTR static PTR
amiga_read_ar_hdr (abfd) amiga_read_ar_hdr (
bfd *abfd; bfd *abfd)
{ {
struct areltdata *ared; struct areltdata *ared;
unsigned long start_pos,len; unsigned long start_pos,len;
@@ -3643,9 +3639,9 @@ bfd *abfd;
} }
static int static int
amiga_generic_stat_arch_elt (abfd, buf) amiga_generic_stat_arch_elt (
bfd *abfd; bfd *abfd,
struct stat *buf; struct stat *buf)
{ {
if (abfd->arelt_data == NULL) if (abfd->arelt_data == NULL)
{ {