1999-05-03 09:29:11 +02:00
|
|
|
/* BFD back-end for oasys objects.
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 13:34:08 +01:00
|
|
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
|
2007-03-26 14:23:03 +02:00
|
|
|
2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02:00
|
|
|
Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
|
|
|
|
|
2001-08-28 11:35:16 +02:00
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2001-08-28 11:35:16 +02:00
|
|
|
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.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2001-08-28 11:35:16 +02:00
|
|
|
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.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2001-08-28 11:35:16 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-04 17:53:43 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#define UNDERSCORE_HACK 1
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "sysdep.h"
|
2001-09-19 07:33:36 +02:00
|
|
|
#include "safe-ctype.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
#include "libbfd.h"
|
|
|
|
#include "oasys.h"
|
|
|
|
#include "liboasys.h"
|
|
|
|
|
2001-08-28 11:35:16 +02:00
|
|
|
/* Read in all the section data and relocation stuff too. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_read_record (bfd *abfd, oasys_record_union_type *record)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt = sizeof (record->header);
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
if (bfd_bread ((void *) record, amt, abfd) != amt)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt = record->header.length - sizeof (record->header);
|
|
|
|
if ((long) amt <= 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
2005-04-11 10:23:05 +02:00
|
|
|
if (bfd_bread ((void *) ((char *) record + sizeof (record->header)), amt, abfd)
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
!= amt)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
static size_t
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_string_length (oasys_record_union_type *record)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
return record->header.length
|
|
|
|
- ((char *) record->symbol.name - (char *) record);
|
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Slurp the symbol table by reading in all the records at the start file
|
|
|
|
till we get to the first section record.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
We'll sort the symbolss into two lists, defined and undefined. The
|
|
|
|
undefined symbols will be placed into the table according to their
|
|
|
|
refno.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
We do this by placing all undefined symbols at the front of the table
|
|
|
|
moving in, and the defined symbols at the end of the table moving back. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_slurp_symbol_table (bfd *const abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_record_union_type record;
|
|
|
|
oasys_data_type *data = OASYS_DATA (abfd);
|
2002-11-30 09:39:46 +01:00
|
|
|
bfd_boolean loop = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
asymbol *dest_defined;
|
|
|
|
asymbol *dest;
|
|
|
|
char *string_ptr;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
if (data->symbols != NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* Buy enough memory for all the symbols and all the names. */
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt = abfd->symcount;
|
|
|
|
amt *= sizeof (asymbol);
|
2005-04-11 10:23:05 +02:00
|
|
|
data->symbols = bfd_alloc (abfd, amt);
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
|
|
|
amt = data->symbol_string_length;
|
1999-05-03 09:29:11 +02:00
|
|
|
#ifdef UNDERSCORE_HACK
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Buy 1 more char for each symbol to keep the underscore in. */
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt += abfd->symcount;
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
data->strings = bfd_alloc (abfd, amt);
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!data->symbols || !data->strings)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
dest_defined = data->symbols + abfd->symcount - 1;
|
|
|
|
|
|
|
|
string_ptr = data->strings;
|
|
|
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
while (loop)
|
|
|
|
{
|
|
|
|
if (! oasys_read_record (abfd, &record))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
switch (record.header.type)
|
|
|
|
{
|
|
|
|
case oasys_record_is_header_enum:
|
|
|
|
break;
|
|
|
|
case oasys_record_is_local_enum:
|
|
|
|
case oasys_record_is_symbol_enum:
|
|
|
|
{
|
|
|
|
int flag = record.header.type == (int) oasys_record_is_local_enum ?
|
|
|
|
(BSF_LOCAL) : (BSF_GLOBAL | BSF_EXPORT);
|
|
|
|
|
|
|
|
size_t length = oasys_string_length (&record);
|
|
|
|
switch (record.symbol.relb & RELOCATION_TYPE_BITS)
|
|
|
|
{
|
|
|
|
case RELOCATION_TYPE_ABS:
|
|
|
|
dest = dest_defined--;
|
|
|
|
dest->section = bfd_abs_section_ptr;
|
|
|
|
dest->flags = 0;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RELOCATION_TYPE_REL:
|
|
|
|
dest = dest_defined--;
|
|
|
|
dest->section =
|
|
|
|
OASYS_DATA (abfd)->sections[record.symbol.relb &
|
|
|
|
RELOCATION_SECT_BITS];
|
|
|
|
if (record.header.type == (int) oasys_record_is_local_enum)
|
|
|
|
{
|
|
|
|
dest->flags = BSF_LOCAL;
|
|
|
|
if (dest->section == (asection *) (~0))
|
|
|
|
{
|
|
|
|
/* It seems that sometimes internal symbols are tied up, but
|
|
|
|
still get output, even though there is no
|
|
|
|
section */
|
|
|
|
dest->section = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2005-04-11 10:23:05 +02:00
|
|
|
dest->flags = flag;
|
1999-05-03 09:29:11 +02:00
|
|
|
break;
|
|
|
|
case RELOCATION_TYPE_UND:
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
dest = data->symbols + H_GET_16 (abfd, record.symbol.refno);
|
1999-05-03 09:29:11 +02:00
|
|
|
dest->section = bfd_und_section_ptr;
|
|
|
|
break;
|
|
|
|
case RELOCATION_TYPE_COM:
|
|
|
|
dest = dest_defined--;
|
|
|
|
dest->name = string_ptr;
|
|
|
|
dest->the_bfd = abfd;
|
|
|
|
dest->section = bfd_com_section_ptr;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dest = dest_defined--;
|
2005-04-11 10:23:05 +02:00
|
|
|
BFD_ASSERT (FALSE);
|
1999-05-03 09:29:11 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
dest->name = string_ptr;
|
|
|
|
dest->the_bfd = abfd;
|
2005-04-11 10:23:05 +02:00
|
|
|
dest->udata.p = NULL;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
dest->value = H_GET_32 (abfd, record.symbol.value);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#ifdef UNDERSCORE_HACK
|
|
|
|
if (record.symbol.name[0] != '_')
|
|
|
|
{
|
|
|
|
string_ptr[0] = '_';
|
|
|
|
string_ptr++;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
memcpy (string_ptr, record.symbol.name, length);
|
|
|
|
|
|
|
|
string_ptr[length] = 0;
|
|
|
|
string_ptr += length + 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2002-11-30 09:39:46 +01:00
|
|
|
loop = FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
}
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static long
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_get_symtab_upper_bound (bfd *const abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (! oasys_slurp_symbol_table (abfd))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return (abfd->symcount + 1) * (sizeof (oasys_symbol_type *));
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const bfd_target oasys_vec;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
static long
|
|
|
|
oasys_canonicalize_symtab (bfd *abfd, asymbol **location)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
asymbol *symbase;
|
|
|
|
unsigned int counter;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
2002-06-25 08:21:54 +02:00
|
|
|
if (! oasys_slurp_symbol_table (abfd))
|
2005-04-11 10:23:05 +02:00
|
|
|
return -1;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
symbase = OASYS_DATA (abfd)->symbols;
|
|
|
|
for (counter = 0; counter < abfd->symcount; counter++)
|
2005-04-11 10:23:05 +02:00
|
|
|
*(location++) = symbase++;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
*location = 0;
|
|
|
|
return abfd->symcount;
|
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Archive stuff. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
static const bfd_target *
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_archive_p (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_archive_header_type header;
|
|
|
|
oasys_extarchive_header_type header_ext;
|
|
|
|
unsigned int i;
|
|
|
|
file_ptr filepos;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt = sizeof (header_ext);
|
|
|
|
if (bfd_seek (abfd, (file_ptr) 0, 0) != 0
|
2005-04-11 10:23:05 +02:00
|
|
|
|| bfd_bread ((void *) &header_ext, amt, abfd) != amt)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (bfd_get_error () != bfd_error_system_call)
|
|
|
|
bfd_set_error (bfd_error_wrong_format);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
header.version = H_GET_32 (abfd, header_ext.version);
|
|
|
|
header.mod_count = H_GET_32 (abfd, header_ext.mod_count);
|
|
|
|
header.mod_tbl_offset = H_GET_32 (abfd, header_ext.mod_tbl_offset);
|
|
|
|
header.sym_tbl_size = H_GET_32 (abfd, header_ext.sym_tbl_size);
|
|
|
|
header.sym_count = H_GET_32 (abfd, header_ext.sym_count);
|
|
|
|
header.sym_tbl_offset = H_GET_32 (abfd, header_ext.sym_tbl_offset);
|
|
|
|
header.xref_count = H_GET_32 (abfd, header_ext.xref_count);
|
|
|
|
header.xref_lst_offset = H_GET_32 (abfd, header_ext.xref_lst_offset);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* There isn't a magic number in an Oasys archive, so the best we
|
|
|
|
can do to verify reasonableness is to make sure that the values in
|
|
|
|
the header are too weird. */
|
|
|
|
|
|
|
|
if (header.version > 10000
|
|
|
|
|| header.mod_count > 10000
|
|
|
|
|| header.sym_count > 100000
|
|
|
|
|| header.xref_count > 100000)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* That all worked, let's buy the space for the header and read in
|
|
|
|
the headers. */
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
oasys_ar_data_type *ar;
|
|
|
|
oasys_module_info_type *module;
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_module_table_type record;
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt = sizeof (oasys_ar_data_type);
|
2005-04-11 10:23:05 +02:00
|
|
|
ar = bfd_alloc (abfd, amt);
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
|
|
|
amt = header.mod_count;
|
|
|
|
amt *= sizeof (oasys_module_info_type);
|
2005-04-11 10:23:05 +02:00
|
|
|
module = bfd_alloc (abfd, amt);
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!ar || !module)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
abfd->tdata.oasys_ar_data = ar;
|
|
|
|
ar->module = module;
|
|
|
|
ar->module_count = header.mod_count;
|
|
|
|
|
|
|
|
filepos = header.mod_tbl_offset;
|
|
|
|
for (i = 0; i < header.mod_count; i++)
|
|
|
|
{
|
|
|
|
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
|
|
|
|
return NULL;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* There are two ways of specifying the archive header. */
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_extmodule_table_type_b_type record_ext;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
|
|
|
amt = sizeof (record_ext);
|
2005-04-11 10:23:05 +02:00
|
|
|
if (bfd_bread ((void *) &record_ext, amt, abfd) != amt)
|
1999-05-03 09:29:11 +02:00
|
|
|
return NULL;
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
record.mod_size = H_GET_32 (abfd, record_ext.mod_size);
|
|
|
|
record.file_offset = H_GET_32 (abfd, record_ext.file_offset);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
record.dep_count = H_GET_32 (abfd, record_ext.dep_count);
|
|
|
|
record.depee_count = H_GET_32 (abfd, record_ext.depee_count);
|
|
|
|
record.sect_count = H_GET_32 (abfd, record_ext.sect_count);
|
|
|
|
record.module_name_size = H_GET_32 (abfd,
|
|
|
|
record_ext.mod_name_length);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
amt = record.module_name_size;
|
|
|
|
module[i].name = bfd_alloc (abfd, amt + 1);
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!module[i].name)
|
|
|
|
return NULL;
|
2005-04-11 10:23:05 +02:00
|
|
|
if (bfd_bread ((void *) module[i].name, amt, abfd) != amt)
|
1999-05-03 09:29:11 +02:00
|
|
|
return NULL;
|
|
|
|
module[i].name[record.module_name_size] = 0;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
filepos += (sizeof (record_ext)
|
|
|
|
+ record.dep_count * 4
|
|
|
|
+ record.module_name_size + 1);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module[i].size = record.mod_size;
|
|
|
|
module[i].pos = record.file_offset;
|
|
|
|
module[i].abfd = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return abfd->xvec;
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_mkobject (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt = sizeof (oasys_data_type);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
abfd->tdata.oasys_obj_data = bfd_alloc (abfd, amt);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
return abfd->tdata.oasys_obj_data != NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* The howto table is build using the top two bits of a reloc byte to
|
|
|
|
index into it. The bits are PCREL,WORD/LONG. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
static reloc_howto_type howto_table[] =
|
|
|
|
{
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
HOWTO (0, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
|
|
|
|
HOWTO (0, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "abs32", TRUE, 0xffffffff, 0xffffffff, FALSE),
|
|
|
|
HOWTO (0, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "pcrel16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
|
|
|
|
HOWTO (0, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "pcrel32", TRUE, 0xffffffff, 0xffffffff, FALSE)
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Read in all the section data and relocation stuff too. */
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_slurp_section_data (bfd *const abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_record_union_type record;
|
|
|
|
oasys_data_type *data = OASYS_DATA (abfd);
|
2002-11-30 09:39:46 +01:00
|
|
|
bfd_boolean loop = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_per_section_type *per;
|
|
|
|
asection *s;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* See if the data has been slurped already. */
|
|
|
|
for (s = abfd->sections; s != NULL; s = s->next)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
per = oasys_per_section (s);
|
2002-06-25 08:21:54 +02:00
|
|
|
if (per->initialized)
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data->first_data_record == 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (bfd_seek (abfd, data->first_data_record, SEEK_SET) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
while (loop)
|
|
|
|
{
|
|
|
|
if (! oasys_read_record (abfd, &record))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
switch (record.header.type)
|
|
|
|
{
|
|
|
|
case oasys_record_is_header_enum:
|
|
|
|
break;
|
|
|
|
case oasys_record_is_data_enum:
|
|
|
|
{
|
|
|
|
bfd_byte *src = record.data.data;
|
|
|
|
bfd_byte *end_src = ((bfd_byte *) & record) + record.header.length;
|
|
|
|
bfd_byte *dst_ptr;
|
|
|
|
bfd_byte *dst_base_ptr;
|
|
|
|
unsigned int relbit;
|
|
|
|
unsigned int count;
|
|
|
|
asection *section =
|
|
|
|
data->sections[record.data.relb & RELOCATION_SECT_BITS];
|
|
|
|
bfd_vma dst_offset;
|
|
|
|
|
|
|
|
per = oasys_per_section (section);
|
|
|
|
|
2002-06-25 08:21:54 +02:00
|
|
|
if (! per->initialized)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2005-10-06 21:21:14 +02:00
|
|
|
arelent **relpp;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
per->data = bfd_zalloc (abfd, section->size);
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!per->data)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
2005-10-06 21:21:14 +02:00
|
|
|
relpp = §ion->relocation;
|
|
|
|
per->reloc_tail_ptr = (oasys_reloc_type **) relpp;
|
2002-11-30 09:39:46 +01:00
|
|
|
per->had_vma = FALSE;
|
|
|
|
per->initialized = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
section->reloc_count = 0;
|
|
|
|
section->flags = SEC_ALLOC;
|
|
|
|
}
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
dst_offset = H_GET_32 (abfd, record.data.addr);
|
2002-06-25 08:21:54 +02:00
|
|
|
if (! per->had_vma)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Take the first vma we see as the base. */
|
1999-05-03 09:29:11 +02:00
|
|
|
section->vma = dst_offset;
|
2002-11-30 09:39:46 +01:00
|
|
|
per->had_vma = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dst_offset -= section->vma;
|
|
|
|
|
|
|
|
dst_base_ptr = oasys_per_section (section)->data;
|
|
|
|
dst_ptr = oasys_per_section (section)->data +
|
|
|
|
dst_offset;
|
|
|
|
|
|
|
|
if (src < end_src)
|
2005-04-11 10:23:05 +02:00
|
|
|
section->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
while (src < end_src)
|
|
|
|
{
|
|
|
|
unsigned char mod_byte = *src++;
|
|
|
|
size_t gap = end_src - src;
|
|
|
|
|
|
|
|
count = 8;
|
|
|
|
if (mod_byte == 0 && gap >= 8)
|
|
|
|
{
|
|
|
|
dst_ptr[0] = src[0];
|
|
|
|
dst_ptr[1] = src[1];
|
|
|
|
dst_ptr[2] = src[2];
|
|
|
|
dst_ptr[3] = src[3];
|
|
|
|
dst_ptr[4] = src[4];
|
|
|
|
dst_ptr[5] = src[5];
|
|
|
|
dst_ptr[6] = src[6];
|
|
|
|
dst_ptr[7] = src[7];
|
|
|
|
dst_ptr += 8;
|
|
|
|
src += 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (relbit = 1; count-- != 0 && src < end_src; relbit <<= 1)
|
|
|
|
{
|
|
|
|
if (relbit & mod_byte)
|
|
|
|
{
|
|
|
|
unsigned char reloc = *src;
|
2005-04-11 10:23:05 +02:00
|
|
|
/* This item needs to be relocated. */
|
1999-05-03 09:29:11 +02:00
|
|
|
switch (reloc & RELOCATION_TYPE_BITS)
|
|
|
|
{
|
|
|
|
case RELOCATION_TYPE_ABS:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RELOCATION_TYPE_REL:
|
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Relocate the item relative to the section. */
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
oasys_reloc_type *r;
|
|
|
|
|
|
|
|
amt = sizeof (oasys_reloc_type);
|
2005-04-11 10:23:05 +02:00
|
|
|
r = bfd_alloc (abfd, amt);
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!r)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
*(per->reloc_tail_ptr) = r;
|
|
|
|
per->reloc_tail_ptr = &r->next;
|
2005-04-11 10:23:05 +02:00
|
|
|
r->next = NULL;
|
|
|
|
/* Reference to undefined symbol. */
|
1999-05-03 09:29:11 +02:00
|
|
|
src++;
|
2005-04-11 10:23:05 +02:00
|
|
|
/* There is no symbol. */
|
1999-05-03 09:29:11 +02:00
|
|
|
r->symbol = 0;
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Work out the howto. */
|
1999-05-03 09:29:11 +02:00
|
|
|
abort ();
|
|
|
|
r->relent.address = dst_ptr - dst_base_ptr;
|
|
|
|
r->relent.howto = &howto_table[reloc >> 6];
|
2005-04-11 10:23:05 +02:00
|
|
|
r->relent.sym_ptr_ptr = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
section->reloc_count++;
|
|
|
|
|
2002-06-25 08:21:54 +02:00
|
|
|
/* Fake up the data to look like
|
|
|
|
it's got the -ve pc in it, this
|
|
|
|
makes it much easier to convert
|
|
|
|
into other formats. This is done
|
|
|
|
by hitting the addend. */
|
|
|
|
if (r->relent.howto->pc_relative)
|
|
|
|
r->relent.addend -= dst_ptr - dst_base_ptr;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RELOCATION_TYPE_UND:
|
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
oasys_reloc_type *r;
|
|
|
|
|
|
|
|
amt = sizeof (oasys_reloc_type);
|
2005-04-11 10:23:05 +02:00
|
|
|
r = bfd_alloc (abfd, amt);
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!r)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
*(per->reloc_tail_ptr) = r;
|
|
|
|
per->reloc_tail_ptr = &r->next;
|
2005-04-11 10:23:05 +02:00
|
|
|
r->next = NULL;
|
|
|
|
/* Reference to undefined symbol. */
|
1999-05-03 09:29:11 +02:00
|
|
|
src++;
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Get symbol number. */
|
1999-05-03 09:29:11 +02:00
|
|
|
r->symbol = (src[0] << 8) | src[1];
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Work out the howto. */
|
1999-05-03 09:29:11 +02:00
|
|
|
abort ();
|
|
|
|
|
|
|
|
r->relent.addend = 0;
|
|
|
|
r->relent.address = dst_ptr - dst_base_ptr;
|
|
|
|
r->relent.howto = &howto_table[reloc >> 6];
|
2005-04-11 10:23:05 +02:00
|
|
|
r->relent.sym_ptr_ptr = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
section->reloc_count++;
|
|
|
|
|
|
|
|
src += 2;
|
2002-06-25 08:21:54 +02:00
|
|
|
/* Fake up the data to look like
|
|
|
|
it's got the -ve pc in it, this
|
|
|
|
makes it much easier to convert
|
|
|
|
into other formats. This is done
|
|
|
|
by hitting the addend. */
|
|
|
|
if (r->relent.howto->pc_relative)
|
|
|
|
r->relent.addend -= dst_ptr - dst_base_ptr;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RELOCATION_TYPE_COM:
|
|
|
|
BFD_FAIL ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*dst_ptr++ = *src++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case oasys_record_is_local_enum:
|
|
|
|
case oasys_record_is_symbol_enum:
|
|
|
|
case oasys_record_is_section_enum:
|
|
|
|
break;
|
|
|
|
default:
|
2002-11-30 09:39:46 +01:00
|
|
|
loop = FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
#define MAX_SECS 16
|
|
|
|
|
|
|
|
static const bfd_target *
|
|
|
|
oasys_object_p (bfd *abfd)
|
|
|
|
{
|
|
|
|
oasys_data_type *oasys;
|
|
|
|
oasys_data_type *save = OASYS_DATA (abfd);
|
|
|
|
bfd_boolean loop = TRUE;
|
|
|
|
bfd_boolean had_usefull = FALSE;
|
|
|
|
|
|
|
|
abfd->tdata.oasys_obj_data = 0;
|
|
|
|
oasys_mkobject (abfd);
|
|
|
|
oasys = OASYS_DATA (abfd);
|
|
|
|
memset ((void *) oasys->sections, 0xff, sizeof (oasys->sections));
|
|
|
|
|
|
|
|
/* Point to the start of the file. */
|
|
|
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
|
|
|
|
goto fail;
|
|
|
|
oasys->symbol_string_length = 0;
|
|
|
|
|
|
|
|
/* Inspect the records, but only keep the section info -
|
|
|
|
remember the size of the symbols. */
|
|
|
|
oasys->first_data_record = 0;
|
|
|
|
while (loop)
|
|
|
|
{
|
|
|
|
oasys_record_union_type record;
|
|
|
|
if (! oasys_read_record (abfd, &record))
|
|
|
|
goto fail;
|
|
|
|
if ((size_t) record.header.length < (size_t) sizeof (record.header))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
switch ((oasys_record_enum_type) (record.header.type))
|
|
|
|
{
|
|
|
|
case oasys_record_is_header_enum:
|
|
|
|
had_usefull = TRUE;
|
|
|
|
break;
|
|
|
|
case oasys_record_is_symbol_enum:
|
|
|
|
case oasys_record_is_local_enum:
|
|
|
|
/* Count symbols and remember their size for a future malloc. */
|
|
|
|
abfd->symcount++;
|
|
|
|
oasys->symbol_string_length += 1 + oasys_string_length (&record);
|
|
|
|
had_usefull = TRUE;
|
|
|
|
break;
|
|
|
|
case oasys_record_is_section_enum:
|
|
|
|
{
|
|
|
|
asection *s;
|
|
|
|
char *buffer;
|
|
|
|
unsigned int section_number;
|
|
|
|
|
|
|
|
if (record.section.header.length != sizeof (record.section))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
buffer = bfd_alloc (abfd, (bfd_size_type) 3);
|
|
|
|
if (!buffer)
|
|
|
|
goto fail;
|
|
|
|
section_number = record.section.relb & RELOCATION_SECT_BITS;
|
|
|
|
sprintf (buffer, "%u", section_number);
|
|
|
|
s = bfd_make_section (abfd, buffer);
|
|
|
|
oasys->sections[section_number] = s;
|
|
|
|
switch (record.section.relb & RELOCATION_TYPE_BITS)
|
|
|
|
{
|
|
|
|
case RELOCATION_TYPE_ABS:
|
|
|
|
case RELOCATION_TYPE_REL:
|
|
|
|
break;
|
|
|
|
case RELOCATION_TYPE_UND:
|
|
|
|
case RELOCATION_TYPE_COM:
|
|
|
|
BFD_FAIL ();
|
|
|
|
}
|
|
|
|
|
|
|
|
s->size = H_GET_32 (abfd, record.section.value);
|
|
|
|
s->vma = H_GET_32 (abfd, record.section.vma);
|
|
|
|
s->flags = 0;
|
|
|
|
had_usefull = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case oasys_record_is_data_enum:
|
|
|
|
oasys->first_data_record = bfd_tell (abfd) - record.header.length;
|
|
|
|
case oasys_record_is_debug_enum:
|
|
|
|
case oasys_record_is_module_enum:
|
|
|
|
case oasys_record_is_named_section_enum:
|
|
|
|
case oasys_record_is_end_enum:
|
|
|
|
if (! had_usefull)
|
|
|
|
goto fail;
|
|
|
|
loop = FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oasys->symbols = NULL;
|
|
|
|
|
|
|
|
/* Oasys support several architectures, but I can't see a simple way
|
|
|
|
to discover which one is in a particular file - we'll guess. */
|
|
|
|
bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0);
|
|
|
|
if (abfd->symcount != 0)
|
|
|
|
abfd->flags |= HAS_SYMS;
|
|
|
|
|
|
|
|
/* We don't know if a section has data until we've read it. */
|
|
|
|
oasys_slurp_section_data (abfd);
|
|
|
|
|
|
|
|
return abfd->xvec;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
(void) bfd_release (abfd, oasys);
|
|
|
|
abfd->tdata.oasys_obj_data = save;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
oasys_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
|
|
|
|
asymbol *symbol,
|
|
|
|
symbol_info *ret)
|
|
|
|
{
|
|
|
|
bfd_symbol_info (symbol, ret);
|
|
|
|
|
|
|
|
if (!symbol->section)
|
|
|
|
ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
oasys_print_symbol (bfd *abfd, void * afile, asymbol *symbol, bfd_print_symbol_type how)
|
|
|
|
{
|
|
|
|
FILE *file = (FILE *) afile;
|
|
|
|
|
|
|
|
switch (how)
|
|
|
|
{
|
|
|
|
case bfd_print_symbol_name:
|
|
|
|
case bfd_print_symbol_more:
|
|
|
|
fprintf (file, "%s", symbol->name);
|
|
|
|
break;
|
|
|
|
case bfd_print_symbol_all:
|
|
|
|
{
|
|
|
|
const char *section_name = symbol->section == NULL ?
|
|
|
|
(const char *) "*abs" : symbol->section->name;
|
|
|
|
|
|
|
|
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
|
|
|
|
|
|
|
|
fprintf (file, " %-5s %s",
|
|
|
|
section_name,
|
|
|
|
symbol->name);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_new_section_hook (bfd *abfd, asection *newsect)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (!newsect->used_by_bfd)
|
2006-05-03 16:26:41 +02:00
|
|
|
{
|
|
|
|
newsect->used_by_bfd
|
|
|
|
= bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type));
|
|
|
|
if (!newsect->used_by_bfd)
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_per_section (newsect)->data = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_per_section (newsect)->section = newsect;
|
|
|
|
oasys_per_section (newsect)->offset = 0;
|
2002-11-30 09:39:46 +01:00
|
|
|
oasys_per_section (newsect)->initialized = FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
newsect->alignment_power = 1;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Turn the section string into an index. */
|
1999-05-03 09:29:11 +02:00
|
|
|
sscanf (newsect->name, "%u", &newsect->target_index);
|
|
|
|
|
2006-05-03 16:26:41 +02:00
|
|
|
return _bfd_generic_new_section_hook (abfd, newsect);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static long
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (! oasys_slurp_section_data (abfd))
|
|
|
|
return -1;
|
|
|
|
return (asect->reloc_count + 1) * sizeof (arelent *);
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_get_section_contents (bfd *abfd,
|
|
|
|
sec_ptr section,
|
|
|
|
void * location,
|
|
|
|
file_ptr offset,
|
|
|
|
bfd_size_type count)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 13:34:08 +01:00
|
|
|
oasys_per_section_type *p = oasys_per_section (section);
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_slurp_section_data (abfd);
|
2005-04-11 10:23:05 +02:00
|
|
|
|
2002-06-25 08:21:54 +02:00
|
|
|
if (! p->initialized)
|
2005-04-11 10:23:05 +02:00
|
|
|
(void) memset (location, 0, (size_t) count);
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
2005-04-11 10:23:05 +02:00
|
|
|
(void) memcpy (location, (void *) (p->data + offset), (size_t) count);
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
static long
|
|
|
|
oasys_canonicalize_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED,
|
|
|
|
sec_ptr section,
|
|
|
|
arelent **relptr,
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
unsigned int reloc_count = 0;
|
|
|
|
oasys_reloc_type *src = (oasys_reloc_type *) (section->relocation);
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
if (src != NULL)
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
*relptr = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
return section->reloc_count = reloc_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Writing. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Calculate the checksum and write one record. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_record (bfd *abfd,
|
|
|
|
oasys_record_enum_type type,
|
|
|
|
oasys_record_union_type *record,
|
|
|
|
size_t size)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
int checksum;
|
|
|
|
size_t i;
|
|
|
|
unsigned char *ptr;
|
|
|
|
|
|
|
|
record->header.length = size;
|
|
|
|
record->header.type = (int) type;
|
|
|
|
record->header.check_sum = 0;
|
|
|
|
record->header.fill = 0;
|
|
|
|
ptr = (unsigned char *) &record->pad[0];
|
|
|
|
checksum = 0;
|
|
|
|
for (i = 0; i < size; i++)
|
2005-04-11 10:23:05 +02:00
|
|
|
checksum += *ptr++;
|
1999-05-03 09:29:11 +02:00
|
|
|
record->header.check_sum = 0xff & (-checksum);
|
2005-04-11 10:23:05 +02:00
|
|
|
if (bfd_bwrite ((void *) record, (bfd_size_type) size, abfd) != size)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Write out all the symbols. */
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_syms (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
unsigned int count;
|
|
|
|
asymbol **generic = bfd_get_outsymbols (abfd);
|
|
|
|
unsigned int index = 0;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
for (count = 0; count < bfd_get_symcount (abfd); count++)
|
|
|
|
{
|
|
|
|
oasys_symbol_record_type symbol;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
asymbol *const g = generic[count];
|
|
|
|
const char *src = g->name;
|
1999-05-03 09:29:11 +02:00
|
|
|
char *dst = symbol.name;
|
|
|
|
unsigned int l = 0;
|
|
|
|
|
|
|
|
if (bfd_is_com_section (g->section))
|
|
|
|
{
|
|
|
|
symbol.relb = RELOCATION_TYPE_COM;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_16 (abfd, index, symbol.refno);
|
1999-05-03 09:29:11 +02:00
|
|
|
index++;
|
|
|
|
}
|
|
|
|
else if (bfd_is_abs_section (g->section))
|
|
|
|
{
|
|
|
|
symbol.relb = RELOCATION_TYPE_ABS;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_16 (abfd, 0, symbol.refno);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
else if (bfd_is_und_section (g->section))
|
|
|
|
{
|
|
|
|
symbol.relb = RELOCATION_TYPE_UND;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_16 (abfd, index, symbol.refno);
|
1999-05-03 09:29:11 +02:00
|
|
|
/* Overload the value field with the output index number */
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
else if (g->flags & BSF_DEBUGGING)
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Throw it away. */
|
|
|
|
continue;
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
if (g->section == NULL)
|
|
|
|
/* Sometime, the oasys tools give out a symbol with illegal
|
|
|
|
bits in it, we'll output it in the same broken way. */
|
|
|
|
symbol.relb = RELOCATION_TYPE_REL | 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
2005-04-11 10:23:05 +02:00
|
|
|
symbol.relb = RELOCATION_TYPE_REL | g->section->output_section->target_index;
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_16 (abfd, 0, symbol.refno);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
#ifdef UNDERSCORE_HACK
|
|
|
|
if (src[l] == '_')
|
|
|
|
dst[l++] = '.';
|
|
|
|
#endif
|
|
|
|
while (src[l])
|
|
|
|
{
|
|
|
|
dst[l] = src[l];
|
|
|
|
l++;
|
|
|
|
}
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_32 (abfd, g->value, symbol.value);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (g->flags & BSF_LOCAL)
|
|
|
|
{
|
|
|
|
if (! oasys_write_record (abfd,
|
|
|
|
oasys_record_is_local_enum,
|
|
|
|
(oasys_record_union_type *) & symbol,
|
|
|
|
offsetof (oasys_symbol_record_type,
|
|
|
|
name[0]) + l))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (! oasys_write_record (abfd,
|
|
|
|
oasys_record_is_symbol_enum,
|
|
|
|
(oasys_record_union_type *) & symbol,
|
|
|
|
offsetof (oasys_symbol_record_type,
|
|
|
|
name[0]) + l))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
g->value = index - 1;
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Write a section header for each section. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_sections (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
asection *s;
|
|
|
|
static oasys_section_record_type out;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
for (s = abfd->sections; s != NULL; s = s->next)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2001-09-19 07:33:36 +02:00
|
|
|
if (!ISDIGIT (s->name[0]))
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
(*_bfd_error_handler)
|
|
|
|
(_("%s: can not represent section `%s' in oasys"),
|
|
|
|
bfd_get_filename (abfd), s->name);
|
|
|
|
bfd_set_error (bfd_error_nonrepresentable_section);
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
out.relb = RELOCATION_TYPE_REL | s->target_index;
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 06:46:28 +02:00
|
|
|
H_PUT_32 (abfd, s->size, out.value);
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_32 (abfd, s->vma, out.vma);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (! oasys_write_record (abfd,
|
|
|
|
oasys_record_is_section_enum,
|
|
|
|
(oasys_record_union_type *) & out,
|
|
|
|
sizeof (out)))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_header (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Create and write the header. */
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_header_record_type r;
|
|
|
|
size_t length = strlen (abfd->filename);
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (length > (size_t) sizeof (r.module_name))
|
2005-04-11 10:23:05 +02:00
|
|
|
length = sizeof (r.module_name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
(void) memcpy (r.module_name, abfd->filename, length);
|
|
|
|
(void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
r.version_number = OASYS_VERSION_NUMBER;
|
|
|
|
r.rev_number = OASYS_REV_NUMBER;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
return oasys_write_record (abfd, oasys_record_is_header_enum,
|
|
|
|
(oasys_record_union_type *) & r,
|
|
|
|
offsetof (oasys_header_record_type,
|
|
|
|
description[0]));
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_end (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_end_record_type end;
|
|
|
|
unsigned char null = 0;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
end.relb = RELOCATION_TYPE_ABS;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_32 (abfd, abfd->start_address, end.entry);
|
|
|
|
H_PUT_16 (abfd, 0, end.fill);
|
1999-05-03 09:29:11 +02:00
|
|
|
end.zero = 0;
|
|
|
|
if (! oasys_write_record (abfd,
|
|
|
|
oasys_record_is_end_enum,
|
|
|
|
(oasys_record_union_type *) & end,
|
|
|
|
sizeof (end)))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
return bfd_bwrite ((void *) &null, (bfd_size_type) 1, abfd) == 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-04-11 10:23:05 +02:00
|
|
|
comp (const void * ap, const void * bp)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
arelent *a = *((arelent **) ap);
|
|
|
|
arelent *b = *((arelent **) bp);
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
return a->address - b->address;
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_data (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
asection *s;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
for (s = abfd->sections; s != NULL; s = s->next)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (s->flags & SEC_LOAD)
|
|
|
|
{
|
|
|
|
bfd_byte *raw_data = oasys_per_section (s)->data;
|
|
|
|
oasys_data_record_type processed_data;
|
|
|
|
bfd_size_type current_byte_index = 0;
|
|
|
|
unsigned int relocs_to_go = s->reloc_count;
|
|
|
|
arelent **p = s->orelocation;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (s->reloc_count != 0)
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Sort the reloc records so it's easy to insert the relocs into the
|
|
|
|
data. */
|
|
|
|
qsort (s->orelocation, s->reloc_count, sizeof (arelent **), comp);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
current_byte_index = 0;
|
|
|
|
processed_data.relb = s->target_index | RELOCATION_TYPE_REL;
|
|
|
|
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 06:46:28 +02:00
|
|
|
while (current_byte_index < s->size)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
/* Scan forwards by eight bytes or however much is left and see if
|
2005-04-11 10:23:05 +02:00
|
|
|
there are any relocations going on. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_byte *mod = &processed_data.data[0];
|
|
|
|
bfd_byte *dst = &processed_data.data[1];
|
|
|
|
|
|
|
|
unsigned int i = 0;
|
|
|
|
*mod = 0;
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
H_PUT_32 (abfd, s->vma + current_byte_index,
|
|
|
|
processed_data.addr);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* Don't start a relocation unless you're sure you can finish it
|
2005-04-11 10:23:05 +02:00
|
|
|
within the same data record. The worst case relocation is a
|
|
|
|
4-byte relocatable value which is split across two modification
|
|
|
|
bytes (1 relocation byte + 2 symbol reference bytes + 2 data +
|
|
|
|
1 modification byte + 2 data = 8 bytes total). That's where
|
|
|
|
the magic number 8 comes from. */
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 06:46:28 +02:00
|
|
|
while (current_byte_index < s->size && dst <=
|
2005-04-11 10:23:05 +02:00
|
|
|
& processed_data.data[sizeof (processed_data.data) - 8])
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (relocs_to_go != 0)
|
|
|
|
{
|
|
|
|
arelent *r = *p;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* There is a relocation, is it for this byte ? */
|
|
|
|
if (r->address == current_byte_index)
|
|
|
|
abort ();
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* If this is coming from an unloadable section then copy
|
2005-04-11 10:23:05 +02:00
|
|
|
zeros. */
|
1999-05-03 09:29:11 +02:00
|
|
|
if (raw_data == NULL)
|
2005-04-11 10:23:05 +02:00
|
|
|
*dst++ = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
2005-04-11 10:23:05 +02:00
|
|
|
*dst++ = *raw_data++;
|
|
|
|
|
|
|
|
if (++i >= 8)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
i = 0;
|
|
|
|
mod = dst++;
|
|
|
|
*mod = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
current_byte_index++;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Don't write a useless null modification byte. */
|
1999-05-03 09:29:11 +02:00
|
|
|
if (dst == mod + 1)
|
2005-04-11 10:23:05 +02:00
|
|
|
--dst;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
if (! (oasys_write_record
|
|
|
|
(abfd, oasys_record_is_data_enum,
|
|
|
|
((oasys_record_union_type *) &processed_data),
|
|
|
|
(size_t) (dst - (bfd_byte *) &processed_data))))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_write_object_contents (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (! oasys_write_header (abfd))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (! oasys_write_syms (abfd))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (! oasys_write_sections (abfd))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (! oasys_write_data (abfd))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (! oasys_write_end (abfd))
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Set section contents is complicated with OASYS since the format is
|
|
|
|
not a byte image, but a record stream. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_set_section_contents (bfd *abfd,
|
|
|
|
sec_ptr section,
|
|
|
|
const void * location,
|
|
|
|
file_ptr offset,
|
|
|
|
bfd_size_type count)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (count != 0)
|
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
if (oasys_per_section (section)->data == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_per_section (section)->data = bfd_alloc (abfd, section->size);
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!oasys_per_section (section)->data)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
(void) memcpy ((void *) (oasys_per_section (section)->data + offset),
|
|
|
|
location, (size_t) count);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Native-level interface to symbols. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* We read the symbols into a buffer, which is discarded when this
|
2005-04-11 10:23:05 +02:00
|
|
|
function exits. We read the strings into a buffer large enough to
|
|
|
|
hold them all plus all the cached symbol entries. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
static asymbol *
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_make_empty_symbol (bfd *abfd)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
bfd_size_type amt = sizeof (oasys_symbol_type);
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_symbol_type *new = bfd_zalloc (abfd, amt);
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!new)
|
|
|
|
return NULL;
|
|
|
|
new->symbol.the_bfd = abfd;
|
|
|
|
return &new->symbol;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* User should have checked the file flags; perhaps we should return
|
2005-04-11 10:23:05 +02:00
|
|
|
BFD_NO_MORE_SYMBOLS if there are none? */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
static bfd *
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_openr_next_archived_file (bfd *arch, bfd *prev)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_ar_data_type *ar = OASYS_AR_DATA (arch);
|
|
|
|
oasys_module_info_type *p;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
/* Take the next one from the arch state, or reset. */
|
|
|
|
if (prev == NULL)
|
|
|
|
/* Reset the index - the first two entries are bogus. */
|
|
|
|
ar->module_index = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
p = ar->module + ar->module_index;
|
|
|
|
ar->module_index++;
|
|
|
|
|
|
|
|
if (ar->module_index <= ar->module_count)
|
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
if (p->abfd == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
p->abfd = _bfd_create_empty_archive_element_shell (arch);
|
|
|
|
p->abfd->origin = p->pos;
|
|
|
|
p->abfd->filename = p->name;
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
/* Fixup a pointer to this element for the member. */
|
|
|
|
p->abfd->arelt_data = (void *) p;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
return p->abfd;
|
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
bfd_set_error (bfd_error_no_more_archived_files);
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
asection *section ATTRIBUTE_UNUSED,
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED,
|
|
|
|
bfd_vma offset ATTRIBUTE_UNUSED,
|
|
|
|
const char **filename_ptr ATTRIBUTE_UNUSED,
|
|
|
|
const char **functionname_ptr ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int *line_ptr ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2005-05-23 19:44:55 +02:00
|
|
|
static bfd_boolean
|
|
|
|
oasys_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
const char **filename_ptr ATTRIBUTE_UNUSED,
|
|
|
|
const char **functionname_ptr ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int *line_ptr ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
static int
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
oasys_module_info_type *mod = (oasys_module_info_type *) abfd->arelt_data;
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
if (mod == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-04-11 10:23:05 +02:00
|
|
|
|
|
|
|
buf->st_size = mod->size;
|
|
|
|
buf->st_mode = 0666;
|
|
|
|
return 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-06-19 15:17:44 +02:00
|
|
|
oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
#define oasys_close_and_cleanup _bfd_generic_close_and_cleanup
|
|
|
|
#define oasys_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
|
|
|
#define oasys_slurp_armap bfd_true
|
|
|
|
#define oasys_slurp_extended_name_table bfd_true
|
|
|
|
#define oasys_construct_extended_name_table ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_true)
|
|
|
|
#define oasys_truncate_arname bfd_dont_truncate_arname
|
|
|
|
#define oasys_write_armap ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) bfd_true)
|
|
|
|
#define oasys_read_ar_hdr bfd_nullvoidptr
|
|
|
|
#define oasys_get_elt_at_index _bfd_generic_get_elt_at_index
|
|
|
|
#define oasys_update_armap_timestamp bfd_true
|
|
|
|
#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
|
|
|
|
#define oasys_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
|
|
|
#define oasys_get_lineno _bfd_nosymbols_get_lineno
|
|
|
|
#define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
|
|
|
#define oasys_read_minisymbols _bfd_generic_read_minisymbols
|
|
|
|
#define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
|
|
|
#define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
2007-03-26 14:23:03 +02:00
|
|
|
#define oasys_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
|
2005-04-11 10:23:05 +02:00
|
|
|
#define oasys_set_arch_mach bfd_default_set_arch_mach
|
|
|
|
#define oasys_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
|
|
|
#define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
|
|
|
#define oasys_bfd_relax_section bfd_generic_relax_section
|
|
|
|
#define oasys_bfd_gc_sections bfd_generic_gc_sections
|
|
|
|
#define oasys_bfd_merge_sections bfd_generic_merge_sections
|
|
|
|
#define oasys_bfd_is_group_section bfd_generic_is_group_section
|
|
|
|
#define oasys_bfd_discard_group bfd_generic_discard_group
|
|
|
|
#define oasys_section_already_linked _bfd_generic_section_already_linked
|
|
|
|
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
|
|
|
#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
|
|
|
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
|
|
|
#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms
|
|
|
|
#define oasys_bfd_final_link _bfd_generic_final_link
|
|
|
|
#define oasys_bfd_link_split_section _bfd_generic_link_split_section
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
const bfd_target oasys_vec =
|
|
|
|
{
|
2005-04-11 10:23:05 +02:00
|
|
|
"oasys", /* Name. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_target_oasys_flavour,
|
2005-04-11 10:23:05 +02:00
|
|
|
BFD_ENDIAN_BIG, /* Target byte order. */
|
|
|
|
BFD_ENDIAN_BIG, /* Target headers byte order. */
|
|
|
|
(HAS_RELOC | EXEC_P | /* Object flags. */
|
1999-05-03 09:29:11 +02:00
|
|
|
HAS_LINENO | HAS_DEBUG |
|
|
|
|
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
|
|
|
(SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
|
2005-04-11 10:23:05 +02:00
|
|
|
| SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
|
|
|
0, /* Leading underscore. */
|
|
|
|
' ', /* AR_pad_char. */
|
|
|
|
16, /* AR_max_namelen. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
2005-04-11 10:23:05 +02:00
|
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
2005-04-11 10:23:05 +02:00
|
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
{_bfd_dummy_target,
|
2005-04-11 10:23:05 +02:00
|
|
|
oasys_object_p, /* bfd_check_format. */
|
1999-05-03 09:29:11 +02:00
|
|
|
oasys_archive_p,
|
|
|
|
_bfd_dummy_target,
|
|
|
|
},
|
2005-04-11 10:23:05 +02:00
|
|
|
{ /* bfd_set_format. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_false,
|
|
|
|
oasys_mkobject,
|
|
|
|
_bfd_generic_mkarchive,
|
|
|
|
bfd_false
|
|
|
|
},
|
2005-04-11 10:23:05 +02:00
|
|
|
{ /* bfd_write_contents. */
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_false,
|
|
|
|
oasys_write_object_contents,
|
|
|
|
_bfd_write_archive_contents,
|
|
|
|
bfd_false,
|
|
|
|
},
|
|
|
|
|
|
|
|
BFD_JUMP_TABLE_GENERIC (oasys),
|
|
|
|
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
|
|
|
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
|
|
|
BFD_JUMP_TABLE_ARCHIVE (oasys),
|
|
|
|
BFD_JUMP_TABLE_SYMBOLS (oasys),
|
|
|
|
BFD_JUMP_TABLE_RELOCS (oasys),
|
|
|
|
BFD_JUMP_TABLE_WRITE (oasys),
|
|
|
|
BFD_JUMP_TABLE_LINK (oasys),
|
|
|
|
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
|
|
|
|
1999-07-19 16:55:16 +02:00
|
|
|
NULL,
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
2005-04-11 10:23:05 +02:00
|
|
|
NULL
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|