typedef unsigned long int insn32;
typedef unsigned short int insn16;
-static bfd_boolean elf32_arm_set_private_flags
- PARAMS ((bfd *, flagword));
-static bfd_boolean elf32_arm_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_merge_private_bfd_data
- PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_print_private_bfd_data
- PARAMS ((bfd *, PTR));
-static int elf32_arm_get_symbol_type
- PARAMS (( Elf_Internal_Sym *, int));
-static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
- PARAMS ((bfd *));
-static bfd_reloc_status_type elf32_arm_final_link_relocate
- PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
- const char *, int, struct elf_link_hash_entry *));
-static insn32 insert_thumb_branch
- PARAMS ((insn32, int));
-static struct elf_link_hash_entry *find_thumb_glue
- PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static struct elf_link_hash_entry *find_arm_glue
- PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static void elf32_arm_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-static int elf32_arm_to_thumb_stub
- PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
- bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static int elf32_thumb_to_arm_stub
- PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
- bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static bfd_boolean elf32_arm_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static asection * elf32_arm_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_find_nearest_line
- PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
- const char **, unsigned int *));
-static bfd_boolean elf32_arm_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean elf32_arm_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_arm_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-#if USE_REL
-static void arm_add_to_rel
- PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
-#endif
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *h, PTR inf));
-static bfd_boolean create_got_section
- PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static bfd_boolean elf32_arm_create_dynamic_sections
- PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static enum elf_reloc_type_class elf32_arm_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_object_p
- PARAMS ((bfd *));
-
-#ifndef ELFARM_NABI_C_INCLUDED
-static void record_arm_to_thumb_glue
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static void record_thumb_to_arm_glue
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-bfd_boolean bfd_elf32_arm_allocate_interworking_sections
- PARAMS ((struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
- PARAMS ((bfd *, struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_process_before_allocation
- PARAMS ((bfd *, struct bfd_link_info *, int, int));
-#endif
-
-
-#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
+/* In leiu of proper flags, assume all EABIv3 objects are interworkable. */
+#define INTERWORK_FLAG(abfd) \
+ (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER3 \
+ || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK))
/* The linker script knows the section names for placement.
The entry_names are used to do simple name mangling on the stubs.
#define elf32_arm_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *))) (func), \
(info)))
/* Get the ARM elf linker hash table from a link_info structure. */
/* Create an entry in an ARM ELF linker hash table. */
static struct bfd_hash_entry *
-elf32_arm_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry * entry;
- struct bfd_hash_table * table;
- const char * string;
+elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
+ struct bfd_hash_table * table,
+ const char * string)
{
struct elf32_arm_link_hash_entry * ret =
(struct elf32_arm_link_hash_entry *) entry;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == (struct elf32_arm_link_hash_entry *) NULL)
- ret = ((struct elf32_arm_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct elf32_arm_link_hash_entry)));
- if (ret == (struct elf32_arm_link_hash_entry *) NULL)
+ ret = bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry));
+ if (ret == NULL)
return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
ret = ((struct elf32_arm_link_hash_entry *)
_bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
table, string));
- if (ret != (struct elf32_arm_link_hash_entry *) NULL)
+ if (ret != NULL)
ret->relocs_copied = NULL;
return (struct bfd_hash_entry *) ret;
shortcuts to them in our hash table. */
static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
{
struct elf32_arm_link_hash_table *htab;
hash table. */
static bfd_boolean
-elf32_arm_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf32_arm_link_hash_table *htab;
/* Create an ARM elf linker hash table. */
static struct bfd_link_hash_table *
-elf32_arm_link_hash_table_create (abfd)
- bfd *abfd;
+elf32_arm_link_hash_table_create (bfd *abfd)
{
struct elf32_arm_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
- ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct elf32_arm_link_hash_table *) NULL)
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
return NULL;
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ if (!_bfd_elf_link_hash_table_init (& ret->root, abfd,
elf32_arm_link_hash_newfunc))
{
free (ret);
/* Locate the Thumb encoded calling stub for NAME. */
static struct elf_link_hash_entry *
-find_thumb_glue (link_info, name, input_bfd)
- struct bfd_link_info *link_info;
- const char *name;
- bfd *input_bfd;
+find_thumb_glue (struct bfd_link_info *link_info,
+ const char *name,
+ bfd *input_bfd)
{
char *tmp_name;
struct elf_link_hash_entry *hash;
/* We need a pointer to the armelf specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+ tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
if (hash == NULL)
/* xgettext:c-format */
- (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
+ (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"),
+ input_bfd, tmp_name, name);
free (tmp_name);
/* Locate the ARM encoded calling stub for NAME. */
static struct elf_link_hash_entry *
-find_arm_glue (link_info, name, input_bfd)
- struct bfd_link_info *link_info;
- const char *name;
- bfd *input_bfd;
+find_arm_glue (struct bfd_link_info *link_info,
+ const char *name,
+ bfd *input_bfd)
{
char *tmp_name;
struct elf_link_hash_entry *myh;
/* We need a pointer to the elfarm specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+ tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
if (myh == NULL)
/* xgettext:c-format */
- (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_archive_filename (input_bfd), tmp_name, name);
+ (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"),
+ input_bfd, tmp_name, name);
free (tmp_name);
#ifndef ELFARM_NABI_C_INCLUDED
bfd_boolean
-bfd_elf32_arm_allocate_interworking_sections (info)
- struct bfd_link_info * info;
+bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info)
{
asection * s;
bfd_byte * foo;
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
- globals->arm_glue_size);
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
- s->_raw_size = s->_cooked_size = globals->arm_glue_size;
+ s->size = globals->arm_glue_size;
s->contents = foo;
}
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
- globals->thumb_glue_size);
+ foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
- s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
+ s->size = globals->thumb_glue_size;
s->contents = foo;
}
}
static void
-record_arm_to_thumb_glue (link_info, h)
- struct bfd_link_info * link_info;
- struct elf_link_hash_entry * h;
+record_arm_to_thumb_glue (struct bfd_link_info * link_info,
+ struct elf_link_hash_entry * h)
{
const char * name = h->root.root.string;
asection * s;
BFD_ASSERT (s != NULL);
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+ tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
return;
}
- /* The only trick here is using hash_table->arm_glue_size as the value. Even
- though the section isn't allocated yet, this is where we will be putting
- it. */
+ /* The only trick here is using hash_table->arm_glue_size as the value.
+ Even though the section isn't allocated yet, this is where we will be
+ putting it. */
bh = NULL;
val = globals->arm_glue_size + 1;
_bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner,
}
static void
-record_thumb_to_arm_glue (link_info, h)
- struct bfd_link_info *link_info;
- struct elf_link_hash_entry *h;
+record_thumb_to_arm_glue (struct bfd_link_info *link_info,
+ struct elf_link_hash_entry *h)
{
const char *name = h->root.root.string;
asection *s;
BFD_ASSERT (s != NULL);
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+ tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
#define BACK_FROM_ARM "__%s_back_from_arm"
/* Allocate another symbol to mark where we switch to Arm mode. */
- tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
- + strlen (CHANGE_TO_ARM) + 1);
+ tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (CHANGE_TO_ARM) + 1);
BFD_ASSERT (tmp_name);
linker scripts in ld/emultempl/{armelf}.em. */
bfd_boolean
-bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
+ struct bfd_link_info *info)
{
flagword flags;
asection *sec;
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY;
sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
{armelf/pe}.em */
bfd_boolean
-bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info)
{
struct elf32_arm_link_hash_table *globals;
}
bfd_boolean
-bfd_elf32_arm_process_before_allocation (abfd, link_info,
- no_pipeline_knowledge,
- byteswap_code)
- bfd *abfd;
- struct bfd_link_info *link_info;
- int no_pipeline_knowledge;
- int byteswap_code;
+bfd_elf32_arm_process_before_allocation (bfd *abfd,
+ struct bfd_link_info *link_info,
+ int no_pipeline_knowledge,
+ int byteswap_code)
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs = NULL;
globals->no_pipeline_knowledge = no_pipeline_knowledge;
if (byteswap_code && !bfd_big_endian (abfd))
{
- _bfd_error_handler (
- _("%s: BE8 images only valid in big-endian mode."),
- bfd_archive_filename (abfd));
+ _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."),
+ abfd);
return FALSE;
}
globals->byteswap_code = byteswap_code;
/* Load the relocs. */
internal_relocs
- = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
+ = _bfd_elf_link_read_relocs (abfd, sec, (void *) NULL,
(Elf_Internal_Rela *) NULL, FALSE);
if (internal_relocs == NULL)
else
{
/* Go get them off disk. */
- contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
- if (contents == NULL)
- goto error_return;
-
- if (!bfd_get_section_contents (abfd, sec, contents,
- (file_ptr) 0, sec->_raw_size))
+ if (! bfd_malloc_and_get_section (abfd, sec, &contents))
goto error_return;
}
}
#define HI_LOW_ORDER 0xF000F800
static insn32
-insert_thumb_branch (br_insn, rel_off)
- insn32 br_insn;
- int rel_off;
+insert_thumb_branch (insn32 br_insn, int rel_off)
{
unsigned int low_bits;
unsigned int high_bits;
br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
else
/* FIXME: abort is probably not the right call. krk@cygnus.com */
- abort (); /* error - not a valid branch instruction form. */
+ abort (); /* Error - not a valid branch instruction form. */
return br_insn;
}
/* Thumb code calling an ARM function. */
static int
-elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, offset, addend, val)
- struct bfd_link_info * info;
- const char * name;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * hit_data;
- asection * sym_sec;
- bfd_vma offset;
- bfd_signed_vma addend;
- bfd_vma val;
+elf32_thumb_to_arm_stub (struct bfd_link_info * info,
+ const char * name,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * input_section,
+ bfd_byte * hit_data,
+ asection * sym_sec,
+ bfd_vma offset,
+ bfd_signed_vma addend,
+ bfd_vma val)
{
asection * s = 0;
bfd_vma my_offset;
&& !INTERWORK_FLAG (sym_sec->owner))
{
(*_bfd_error_handler)
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (sym_sec->owner), name);
- (*_bfd_error_handler)
- (_(" first occurrence: %s: thumb call to arm"),
- bfd_archive_filename (input_bfd));
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: thumb call to arm"),
+ sym_sec->owner, input_bfd, name);
return FALSE;
}
/* Address of destination of the stub. */
((bfd_signed_vma) val)
- ((bfd_signed_vma)
- /* Offset from the start of the current section to the start of the stubs. */
+ /* Offset from the start of the current section
+ to the start of the stubs. */
(s->output_offset
/* Offset of the start of this stub from the start of the stubs. */
+ my_offset
/* Address of where the stub is located. */
(s->output_section->vma + s->output_offset + my_offset)
/* Address of where the BL is located. */
- - (input_section->output_section->vma + input_section->output_offset + offset)
+ - (input_section->output_section->vma + input_section->output_offset
+ + offset)
/* Addend in the relocation. */
- addend
/* Biassing for PC-relative addressing. */
/* Arm code calling a Thumb function. */
static int
-elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, offset, addend, val)
- struct bfd_link_info * info;
- const char * name;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * hit_data;
- asection * sym_sec;
- bfd_vma offset;
- bfd_signed_vma addend;
- bfd_vma val;
+elf32_arm_to_thumb_stub (struct bfd_link_info * info,
+ const char * name,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * input_section,
+ bfd_byte * hit_data,
+ asection * sym_sec,
+ bfd_vma offset,
+ bfd_signed_vma addend,
+ bfd_vma val)
{
unsigned long int tmp;
bfd_vma my_offset;
&& !INTERWORK_FLAG (sym_sec->owner))
{
(*_bfd_error_handler)
- (_("%s(%s): warning: interworking not enabled."),
- bfd_archive_filename (sym_sec->owner), name);
- (*_bfd_error_handler)
- (_(" first occurrence: %s: arm call to thumb"),
- bfd_archive_filename (input_bfd));
+ (_("%B(%s): warning: interworking not enabled.\n"
+ " first occurrence: %B: arm call to thumb"),
+ sym_sec->owner, input_bfd, name);
}
--my_offset;
/* Perform a relocation as part of a final link. */
static bfd_reloc_status_type
-elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
- input_section, contents, rel, value,
- info, sym_sec, sym_name, sym_flags, h)
- reloc_howto_type * howto;
- bfd * input_bfd;
- bfd * output_bfd;
- asection * input_section;
- bfd_byte * contents;
- Elf_Internal_Rela * rel;
- bfd_vma value;
- struct bfd_link_info * info;
- asection * sym_sec;
- const char * sym_name;
- int sym_flags;
- struct elf_link_hash_entry * h;
+elf32_arm_final_link_relocate (reloc_howto_type * howto,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ bfd_vma value,
+ struct bfd_link_info * info,
+ asection * sym_sec,
+ const char * sym_name,
+ int sym_flags,
+ struct elf_link_hash_entry * h)
{
unsigned long r_type = howto->type;
unsigned long r_symndx;
/* FIXME: Should we translate the instruction into a BL
instruction instead ? */
if (sym_flags != STT_ARM_TFUNC)
- (*_bfd_error_handler) (_("\
-%s: Warning: Arm BLX instruction targets Arm function '%s'."),
- bfd_archive_filename (input_bfd),
- h ? h->root.root.string : "(local)");
+ (*_bfd_error_handler)
+ (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."),
+ input_bfd,
+ h ? h->root.root.string : "(local)");
}
else
#endif
/* Check for Arm calling Thumb function. */
if (sym_flags == STT_ARM_TFUNC)
{
- elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd,
- input_section, hit_data, sym_sec, rel->r_offset,
+ elf32_arm_to_thumb_stub (info, sym_name, input_bfd,
+ output_bfd, input_section,
+ hit_data, sym_sec, rel->r_offset,
signed_addend, value);
return bfd_reloc_ok;
}
A is the addend (extracted from the instruction) in bytes.
S is held in 'value'.
- P is the base address of the section containing the instruction
- plus the offset of the reloc into that section, ie:
+ P is the base address of the section containing the
+ instruction plus the offset of the reloc into that
+ section, ie:
(input_section->output_section->vma +
input_section->output_offset +
rel->r_offset).
(signed_addend * 4)
Note: None of these operations have knowledge of the pipeline
- size of the processor, thus it is up to the assembler to encode
- this information into the addend. */
+ size of the processor, thus it is up to the assembler to
+ encode this information into the addend. */
value -= (input_section->output_section->vma
+ input_section->output_offset);
value -= rel->r_offset;
value += (signed_addend << howto->size);
- /* Previous versions of this code also used to add in the pipeline
- offset here. This is wrong because the linker is not supposed
- to know about such things, and one day it might change. In order
- to support old binaries that need the old behaviour however, so
- we attempt to detect which ABI was used to create the reloc. */
+ /* Previous versions of this code also used to add in the
+ pipeline offset here. This is wrong because the linker is
+ not supposed to know about such things, and one day it might
+ change. In order to support old binaries that need the old
+ behaviour however, so we attempt to detect which ABI was
+ used to create the reloc. */
if (! globals->no_pipeline_knowledge)
{
Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */
/* FIXME: Should we translate the instruction into a BL
instruction instead ? */
if (sym_flags == STT_ARM_TFUNC)
- (*_bfd_error_handler) (_("\
-%s: Warning: Thumb BLX instruction targets thumb function '%s'."),
- bfd_archive_filename (input_bfd),
- h ? h->root.root.string : "(local)");
+ (*_bfd_error_handler)
+ (_("%B: Warning: Thumb BLX instruction targets thumb function '%s'."),
+ input_bfd,
+ h ? h->root.root.string : "(local)");
}
else
#endif
#if USE_REL
/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
static void
-arm_add_to_rel (abfd, address, howto, increment)
- bfd * abfd;
- bfd_byte * address;
- reloc_howto_type * howto;
- bfd_signed_vma increment;
+arm_add_to_rel (bfd * abfd,
+ bfd_byte * address,
+ reloc_howto_type * howto,
+ bfd_signed_vma increment)
{
bfd_signed_vma addend;
/* Relocate an ARM ELF section. */
static bfd_boolean
-elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
+elf32_arm_relocate_section (bfd * output_bfd,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * relocs,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
if (howto->rightshift)
{
(*_bfd_error_handler)
- (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
+ (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"),
+ input_bfd, input_section,
(long) rel->r_offset, howto->name);
return FALSE;
}
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned);
-
+
if (unresolved_reloc || relocation != 0)
{
/* In these cases, we don't need the relocation value.
case R_ARM_PC24:
case R_ARM_ABS32:
case R_ARM_THM_PC22:
+ case R_ARM_PLT32:
+
if (info->shared
&& (
(!info->symbolic && h->dynindx != -1)
relocation = 0;
break;
- case R_ARM_PLT32:
- if (h->plt.offset != (bfd_vma)-1)
- relocation = 0;
- break;
-
default:
if (unresolved_reloc)
_bfd_error_handler
- (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"),
- bfd_archive_filename (input_bfd),
+ (_("%B(%A): warning: unresolvable relocation %d against symbol `%s'"),
+ input_bfd, input_section,
r_type,
- h->root.root.string,
- bfd_get_section_name (input_bfd, input_section));
+ h->root.root.string);
break;
}
}
/* Set the right machine number. */
static bfd_boolean
-elf32_arm_object_p (abfd)
- bfd *abfd;
+elf32_arm_object_p (bfd *abfd)
{
unsigned int mach;
-
+
mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
if (mach != bfd_mach_arm_unknown)
/* Function to keep ARM specific flags in the ELF header. */
static bfd_boolean
-elf32_arm_set_private_flags (abfd, flags)
- bfd *abfd;
- flagword flags;
+elf32_arm_set_private_flags (bfd *abfd, flagword flags)
{
if (elf_flags_init (abfd)
&& elf_elfheader (abfd)->e_flags != flags)
if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN)
{
if (flags & EF_ARM_INTERWORK)
- (*_bfd_error_handler) (_("\
-Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"),
- bfd_archive_filename (abfd));
+ (*_bfd_error_handler)
+ (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"),
+ abfd);
else
- _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s due to outside request"),
- bfd_archive_filename (abfd));
+ _bfd_error_handler
+ (_("Warning: Clearing the interworking flag of %B due to outside request"),
+ abfd);
}
}
else
/* Copy backend specific data from one object module to another. */
static bfd_boolean
-elf32_arm_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
+elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
flagword in_flags;
flagword out_flags;
if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
{
if (out_flags & EF_ARM_INTERWORK)
- _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"),
- bfd_get_filename (obfd),
- bfd_archive_filename (ibfd));
+ _bfd_error_handler
+ (_("Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"),
+ obfd, ibfd);
in_flags &= ~EF_ARM_INTERWORK;
}
object file when linking. */
static bfd_boolean
-elf32_arm_merge_private_bfd_data (ibfd, obfd)
- bfd * ibfd;
- bfd * obfd;
+elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
{
flagword out_flags;
flagword in_flags;
/* Complain about various flag mismatches. */
if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
{
- _bfd_error_handler (_("\
-ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"),
- bfd_archive_filename (ibfd),
- (in_flags & EF_ARM_EABIMASK) >> 24,
- bfd_get_filename (obfd),
- (out_flags & EF_ARM_EABIMASK) >> 24);
+ _bfd_error_handler
+ (_("ERROR: %B is compiled for EABI version %d, whereas %B is compiled for version %d"),
+ ibfd, obfd,
+ (in_flags & EF_ARM_EABIMASK) >> 24,
+ (out_flags & EF_ARM_EABIMASK) >> 24);
return FALSE;
}
{
if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
{
- _bfd_error_handler (_("\
-ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"),
- bfd_archive_filename (ibfd),
- in_flags & EF_ARM_APCS_26 ? 26 : 32,
- bfd_get_filename (obfd),
- out_flags & EF_ARM_APCS_26 ? 26 : 32);
+ _bfd_error_handler
+ (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
+ ibfd, obfd,
+ in_flags & EF_ARM_APCS_26 ? 26 : 32,
+ out_flags & EF_ARM_APCS_26 ? 26 : 32);
flags_compatible = FALSE;
}
if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
{
if (in_flags & EF_ARM_APCS_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"),
+ ibfd, obfd);
else
- _bfd_error_handler (_("\
-ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"),
+ ibfd, obfd);
flags_compatible = FALSE;
}
if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
{
if (in_flags & EF_ARM_VFP_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses VFP instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B uses VFP instructions, whereas %B does not"),
+ ibfd, obfd);
else
- _bfd_error_handler (_("\
-ERROR: %s uses FPA instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B uses FPA instructions, whereas %B does not"),
+ ibfd, obfd);
flags_compatible = FALSE;
}
if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
{
if (in_flags & EF_ARM_MAVERICK_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses Maverick instructions, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B uses Maverick instructions, whereas %B does not"),
+ ibfd, obfd);
else
- _bfd_error_handler (_("\
-ERROR: %s does not use Maverick instructions, whereas %s does"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B does not use Maverick instructions, whereas %B does"),
+ ibfd, obfd);
flags_compatible = FALSE;
}
|| (in_flags & EF_ARM_VFP_FLOAT) == 0)
{
if (in_flags & EF_ARM_SOFT_FLOAT)
- _bfd_error_handler (_("\
-ERROR: %s uses software FP, whereas %s uses hardware FP"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B uses software FP, whereas %B uses hardware FP"),
+ ibfd, obfd);
else
- _bfd_error_handler (_("\
-ERROR: %s uses hardware FP, whereas %s uses software FP"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("ERROR: %B uses hardware FP, whereas %B uses software FP"),
+ ibfd, obfd);
flags_compatible = FALSE;
}
{
if (in_flags & EF_ARM_INTERWORK)
{
- _bfd_error_handler (_("\
-Warning: %s supports interworking, whereas %s does not"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("Warning: %B supports interworking, whereas %B does not"),
+ ibfd, obfd);
}
else
{
- _bfd_error_handler (_("\
-Warning: %s does not support interworking, whereas %s does"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ _bfd_error_handler
+ (_("Warning: %B does not support interworking, whereas %B does"),
+ ibfd, obfd);
}
}
}
/* Display the flags field. */
static bfd_boolean
-elf32_arm_print_private_bfd_data (abfd, ptr)
- bfd *abfd;
- PTR ptr;
+elf32_arm_print_private_bfd_data (bfd *abfd, void * ptr)
{
FILE * file = (FILE *) ptr;
unsigned long flags;
}
static int
-elf32_arm_get_symbol_type (elf_sym, type)
- Elf_Internal_Sym * elf_sym;
- int type;
+elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type)
{
switch (ELF_ST_TYPE (elf_sym->st_info))
{
}
static asection *
-elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf32_arm_gc_mark_hook (asection * sec,
+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela * rel,
+ struct elf_link_hash_entry * h,
+ Elf_Internal_Sym * sym)
{
if (h != NULL)
{
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
-elf32_arm_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
+elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
+ asection * sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
/* Look through the relocs for a section during the first phase. */
static bfd_boolean
-elf32_arm_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_size_type size;
size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma) + sizeof(char));
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
+ size *= (sizeof (bfd_signed_vma) + sizeof (char));
+ local_got_refcounts = bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
/* Track dynamic relocs needed for local syms too.
We really need local syms available to do this
easily. Oh well. */
-
+
asection *s;
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (s == NULL)
return FALSE;
-
+
head = ((struct elf32_arm_relocs_copied **)
&elf_section_data (s)->local_dynrel);
}
-
+
p = *head;
if (p == NULL || p->section != sec)
{
bfd_size_type amt = sizeof *p;
+
p = bfd_alloc (htab->root.dynobj, amt);
if (p == NULL)
return FALSE;
p->section = sec;
p->count = 0;
}
-
+
if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32
|| ELF32_R_TYPE (rel->r_info) == R_ARM_REL32)
p->count += 1;
return TRUE;
}
-/* Find the nearest line to a particular section and offset, for error
- reporting. This code is a duplicate of the code in elf.c, except
- that it also accepts STT_ARM_TFUNC as a symbol that names a function. */
-
static bfd_boolean
-elf32_arm_find_nearest_line
- (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
- bfd *abfd;
- asection *section;
- asymbol **symbols;
- bfd_vma offset;
- const char **filename_ptr;
- const char **functionname_ptr;
- unsigned int *line_ptr;
+is_arm_mapping_symbol_name (const char * name)
{
- bfd_boolean found;
- const char *filename;
- asymbol *func;
- bfd_vma low_func;
- asymbol **p;
-
- if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr, 0,
- &elf_tdata (abfd)->dwarf2_find_line_info))
- return TRUE;
-
- if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
- &found, filename_ptr,
- functionname_ptr, line_ptr,
- &elf_tdata (abfd)->line_info))
- return FALSE;
-
- if (found)
- return TRUE;
+ return (name != NULL)
+ && (name[0] == '$')
+ && ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd'))
+ && (name[2] == 0);
+}
- if (symbols == NULL)
- return FALSE;
+/* This is a copy of elf_find_function() from elf.c except that
+ ARM mapping symbols are ignored when looking for function names
+ and STT_ARM_TFUNC is considered to a function type. */
- filename = NULL;
- func = NULL;
- low_func = 0;
+static bfd_boolean
+arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * section,
+ asymbol ** symbols,
+ bfd_vma offset,
+ const char ** filename_ptr,
+ const char ** functionname_ptr)
+{
+ const char * filename = NULL;
+ asymbol * func = NULL;
+ bfd_vma low_func = 0;
+ asymbol ** p;
for (p = symbols; *p != NULL; p++)
{
case STT_FILE:
filename = bfd_asymbol_name (&q->symbol);
break;
- case STT_NOTYPE:
case STT_FUNC:
case STT_ARM_TFUNC:
+ /* Skip $a and $t symbols. */
+ if ((q->symbol.flags & BSF_LOCAL)
+ && is_arm_mapping_symbol_name (q->symbol.name))
+ continue;
+ /* Fall through. */
+ case STT_NOTYPE:
if (q->symbol.section == section
&& q->symbol.value >= low_func
&& q->symbol.value <= offset)
if (func == NULL)
return FALSE;
- *filename_ptr = filename;
- *functionname_ptr = bfd_asymbol_name (func);
- *line_ptr = 0;
+ if (filename_ptr)
+ *filename_ptr = filename;
+ if (functionname_ptr)
+ *functionname_ptr = bfd_asymbol_name (func);
return TRUE;
+}
+
+
+/* Find the nearest line to a particular section and offset, for error
+ reporting. This code is a duplicate of the code in elf.c, except
+ that it uses arm_elf_find_function. */
+
+static bfd_boolean
+elf32_arm_find_nearest_line (bfd * abfd,
+ asection * section,
+ asymbol ** symbols,
+ bfd_vma offset,
+ const char ** filename_ptr,
+ const char ** functionname_ptr,
+ unsigned int * line_ptr)
+{
+ bfd_boolean found = FALSE;
+
+ /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it. */
+
+ if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
+ filename_ptr, functionname_ptr,
+ line_ptr, 0,
+ & elf_tdata (abfd)->dwarf2_find_line_info))
+ {
+ if (!*functionname_ptr)
+ arm_elf_find_function (abfd, section, symbols, offset,
+ *filename_ptr ? NULL : filename_ptr,
+ functionname_ptr);
+
+ return TRUE;
+ }
+
+ if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
+ & found, filename_ptr,
+ functionname_ptr, line_ptr,
+ & elf_tdata (abfd)->line_info))
+ return FALSE;
+
+ if (found && (*functionname_ptr || *line_ptr))
+ return TRUE;
+
+ if (symbols == NULL)
+ return FALSE;
+
+ if (! arm_elf_find_function (abfd, section, symbols, offset,
+ filename_ptr, functionname_ptr))
+ return FALSE;
+
+ *line_ptr = 0;
+ return TRUE;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
understand. */
static bfd_boolean
-elf32_arm_adjust_dynamic_symbol (info, h)
- struct bfd_link_info * info;
- struct elf_link_hash_entry * h;
+elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
+ struct elf_link_hash_entry * h)
{
bfd * dynobj;
asection * s;
srel = bfd_get_section_by_name (dynobj, ".rel.bss");
BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf32_External_Rel);
+ srel->size += sizeof (Elf32_External_Rel);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
}
power_of_two = 3;
/* Apply the required alignment. */
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
+ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
if (power_of_two > bfd_get_section_alignment (dynobj, s))
{
if (! bfd_set_section_alignment (dynobj, s, power_of_two))
/* Define the symbol as being at this point in the section. */
h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
+ h->root.u.def.value = s->size;
/* Increment the section size to make room for the symbol. */
- s->_raw_size += h->size;
+ s->size += h->size;
return TRUE;
}
dynamic relocs. */
static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
{
struct bfd_link_info *info;
struct elf32_arm_link_hash_table *htab;
/* If this is the first .plt entry, make room for the special
first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_HEADER_SIZE;
+ if (s->size == 0)
+ s->size += PLT_HEADER_SIZE;
- h->plt.offset = s->_raw_size;
+ h->plt.offset = s->size;
/* If this symbol is not defined in a regular file, and we are
not generating a shared library, then set the symbol to this
}
/* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
+ s->size += PLT_ENTRY_SIZE;
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->_raw_size += 4;
+ htab->sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
+ htab->srelplt->size += sizeof (Elf32_External_Rel);
}
else
{
}
s = htab->sgot;
- h->got.offset = s->_raw_size;
- s->_raw_size += 4;
+ h->got.offset = s->size;
+ s->size += 4;
dyn = htab->root.dynamic_sections_created;
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
&& (info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ htab->srelgot->size += sizeof (Elf32_External_Rel);
}
else
h->got.offset = (bfd_vma) -1;
for (p = eh->relocs_copied; p != NULL; p = p->next)
{
asection *sreloc = elf_section_data (p->section)->sreloc;
- sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
+ sreloc->size += p->count * sizeof (Elf32_External_Rel);
}
return TRUE;
/* Set the sizes of the dynamic sections. */
static bfd_boolean
-elf32_arm_size_dynamic_sections (output_bfd, info)
- bfd * output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info * info;
+elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info)
{
bfd * dynobj;
asection * s;
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
else if (p->count != 0)
{
srel = elf_section_data (p->section)->sreloc;
- srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
+ srel->size += p->count * sizeof (Elf32_External_Rel);
if ((p->section->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
}
{
if (*local_got > 0)
{
- *local_got = s->_raw_size;
- s->_raw_size += 4;
+ *local_got = s->size;
+ s->size += 4;
if (info->shared)
- srel->_raw_size += sizeof (Elf32_External_Rel);
+ srel->size += sizeof (Elf32_External_Rel);
}
else
*local_got = (bfd_vma) -1;
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
- elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info);
+ elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info);
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
if (strcmp (name, ".plt") == 0)
{
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* Strip this section if we don't need it; see the
comment below. */
}
else if (strncmp (name, ".rel", 4) == 0)
{
- if (s->_raw_size == 0)
+ if (s->size == 0)
{
/* If we don't need this section, strip it from the
output file. This is mostly to handle .rel.bss and
}
/* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL && s->size != 0)
return FALSE;
}
dynamic sections here. */
static bfd_boolean
-elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd * output_bfd;
- struct bfd_link_info * info;
- struct elf_link_hash_entry * h;
- Elf_Internal_Sym * sym;
+elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
+ struct elf_link_hash_entry * h, Elf_Internal_Sym * sym)
{
bfd * dynobj;
(splt->output_section->vma
+ splt->output_offset),
sgot->contents + got_offset);
-
+
/* Fill in the entry in the .rel.plt section. */
rel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
/* Finish up the dynamic sections. */
static bfd_boolean
-elf32_arm_finish_dynamic_sections (output_bfd, info)
- bfd * output_bfd;
- struct bfd_link_info * info;
+elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info)
{
bfd * dynobj;
asection * sgot;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
for (; dyncon < dynconend; dyncon++)
{
case DT_PLTRELSZ:
s = bfd_get_section_by_name (output_bfd, ".rel.plt");
BFD_ASSERT (s != NULL);
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
+ dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
about changing the DT_REL entry. */
s = bfd_get_section_by_name (output_bfd, ".rel.plt");
if (s != NULL)
- {
- if (s->_cooked_size != 0)
- dyn.d_un.d_val -= s->_cooked_size;
- else
- dyn.d_un.d_val -= s->_raw_size;
- }
+ dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
}
/* Fill in the first entry in the procedure linkage table. */
- if (splt->_raw_size > 0)
+ if (splt->size > 0)
{
bfd_vma got_displacement;
}
/* Fill in the first three entries in the global offset table. */
- if (sgot->_raw_size > 0)
+ if (sgot->size > 0)
{
if (sdyn == NULL)
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
}
static void
-elf32_arm_post_process_headers (abfd, link_info)
- bfd * abfd;
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
{
Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
struct elf32_arm_link_hash_table *globals;
}
static enum elf_reloc_type_class
-elf32_arm_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf32_arm_reloc_type_class (const Elf_Internal_Rela *rela)
{
switch ((int) ELF32_R_TYPE (rela->r_info))
{
}
}
-static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, const Elf_Internal_Shdr *));
-static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean elf32_arm_section_flags (flagword *, const Elf_Internal_Shdr *);
+static void elf32_arm_final_write_processing (bfd *, bfd_boolean);
/* Set the right machine number for an Arm ELF file. */
static bfd_boolean
-elf32_arm_section_flags (flags, hdr)
- flagword *flags;
- const Elf_Internal_Shdr *hdr;
+elf32_arm_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
{
if (hdr->sh_type == SHT_NOTE)
*flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;
}
static void
-elf32_arm_final_write_processing (abfd, linker)
- bfd *abfd;
- bfd_boolean linker ATTRIBUTE_UNUSED;
+elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
{
bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
}
return TRUE;
/* We only want mapping symbols. */
- if (name == NULL
- || name[0] != '$'
- || (name[1] != 'a'
- && name[1] != 't'
- && name[1] != 'd'))
+ if (! is_arm_mapping_symbol_name (name))
return TRUE;
mapcount = ++(elf32_arm_section_data (input_sec)->mapcount);
mapping symbols per section. */
map = bfd_realloc (map, mapcount * sizeof (elf32_arm_section_map));
elf32_arm_section_data (input_sec)->map = map;
-
+
map[mapcount - 1].vma = elfsym->st_value;
map[mapcount - 1].type = name[1];
return TRUE;
bfd_vma offset;
bfd_byte tmp;
int i;
-
+
mapcount = elf32_arm_section_data (sec)->mapcount;
map = elf32_arm_section_data (sec)->map;
for (i = 0; i < mapcount; i++)
{
if (i == mapcount - 1)
- end = bfd_section_size (output_bfd, sec);
+ end = sec->size;
else
end = map[i + 1].vma - offset;
-
+
switch (map[i].type)
{
case 'a':
#define elf_backend_got_header_size 12
#include "elf32-target.h"
-