* Makefile.am: Add elf32-arm.c.

* Makefile.in:  Rebuild.
        * elf-bfd.h:  Add elf_backend_get_symbol_type.
        * elf.c (swap_out_syms):  If defined, call
        elf_backend_get_symbol_type.
        * elf32-arm.c: Define elf_backend_get_symbol_type.
        (elf32_arm_get_symbol-type):  New routine.
        (record_thumb_to_arm_glue):  Change to use STT_ARM_TFUNC.
        (bfd_elf32_arm_process_before_allocation):  Change to
        check for STT_ARM_TFUNC.
        (elf32_arm_final_link_relocate):  Likewise.
        * elfxx-target.h:  Add elf_backend_get_symbol_type.
This commit is contained in:
Catherine Moore 1998-08-31 15:50:04 +00:00
parent 4ff5d55a08
commit bb3b4377a4
4 changed files with 48 additions and 35 deletions

View File

@ -1,3 +1,18 @@
Mon Aug 31 10:23:40 1998 Catherine Moore <clm@cygnus.com>
* Makefile.am: Add elf32-arm.c.
* Makefile.in: Rebuild.
* elf-bfd.h: Add elf_backend_get_symbol_type.
* elf.c (swap_out_syms): If defined, call
elf_backend_get_symbol_type.
* elf32-arm.c: Define elf_backend_get_symbol_type.
(elf32_arm_get_symbol-type): New routine.
(record_thumb_to_arm_glue): Change to use STT_ARM_TFUNC.
(bfd_elf32_arm_process_before_allocation): Change to
check for STT_ARM_TFUNC.
(elf32_arm_final_link_relocate): Likewise.
* elfxx-target.h: Add elf_backend_get_symbol_type.
Fri Aug 28 19:44:07 1998 Richard Henderson <rth@cygnus.com>
* archures.c (bfd_mach_alpha_ev[456]): New.

View File

@ -313,6 +313,10 @@ struct elf_backend_data
elf_symbol_type *,
unsigned int));
/* A function to set the type of the info field. Processor-specific
types should be handled here. */
int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *));
/* A function to do additional processing on the ELF section header
just before writing it out. This is used to set the flags and
type fields for some sections, or to actually write out data for

View File

@ -4001,6 +4001,10 @@ swap_out_syms (abfd, sttp, relocatable_p)
else
type = STT_NOTYPE;
/* Processor-specific types */
if (bed->elf_backend_get_symbol_type)
type = (*bed->elf_backend_get_symbol_type) (&type_ptr->internal_elf_sym);
if (bfd_is_com_section (syms[idx]->section))
sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
else if (bfd_is_und_section (syms[idx]->section))

View File

@ -1,4 +1,3 @@
/* start-sanitize-armelf */
/* 32-bit ELF support for ARM
Copyright 1993, 1995, 1998 Free Software Foundation, Inc.
@ -40,6 +39,8 @@ static boolean elf32_arm_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static boolean elf32_arm_print_private_bfd_data
PARAMS ((bfd *, PTR));
static int elf32_arm_get_symbol_type
PARAMS (( Elf_Internal_Sym *));
static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
PARAMS ((bfd *));
@ -344,6 +345,7 @@ record_thumb_to_arm_glue (link_info, h)
char *tmp_name;
struct elf_link_hash_entry *myh;
struct elf32_arm_link_hash_table *hash_table;
char bind;
hash_table = elf32_arm_hash_table (link_info);
@ -376,7 +378,8 @@ record_thumb_to_arm_glue (link_info, h)
(struct bfd_link_hash_entry **) &myh);
/* If we mark it 'thumb', the disassembler will do a better job. */
myh->other = C_THUMBEXTFUNC;
bind = ELF_ST_BIND (myh->type);
myh->type = ELF_ST_INFO (bind, STT_ARM_TFUNC);
free (tmp_name);
@ -487,8 +490,6 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info)
/* Here we have a bfd that is to be included on the link. We have a hook
to do reloc rummaging, before section sizes are nailed down. */
/* _bfd_coff_get_external_symbols (abfd); */
globals = elf32_arm_hash_table (link_info);
BFD_ASSERT (globals != NULL);
@ -502,8 +503,6 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info)
for (; sec != NULL; sec = sec->next)
{
struct internal_reloc *i;
struct internal_reloc *rel;
if (sec->reloc_count == 0)
continue;
@ -514,7 +513,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info)
irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
(Elf_Internal_Rela *) NULL, false));
BFD_ASSERT (i != 0);
BFD_ASSERT (irel != 0);
irelend = irel + sec->reloc_count;
for (; irel < irelend; irel++)
@ -599,30 +598,18 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info)
the target of the call. If it is a thumb target, we
insert glue. */
if (h->other == C_THUMBEXTFUNC)
if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
record_arm_to_thumb_glue (link_info, h);
break;
case R_ARM_THM_PC22:
/* This one is a call from thumb code. We used to look
for ARM_THUMB9 and ARM_THUMB12 as well. We need to look
up the target of the call. If it is an arm target, we
insert glue. If the symbol does not exist it will be
given a class of C_EXT and so we will generate a stub
for it. This is not really a problem, since the link
is doomed anyway. */
/* This one is a call from thumb code. We look
up the target of the call. If it is not a thumb
target, we insert glue. */
switch (h->other)
{
case C_EXT:
case C_STAT:
case C_LABEL:
record_thumb_to_arm_glue (link_info, h);
break;
default:
;
}
if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC)
record_thumb_to_arm_glue (link_info, h);
break;
default:
@ -1225,8 +1212,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* Arm B/BL instruction */
/* check for arm calling thumb function */
if (sym_flags == C_THUMBSTATFUNC
|| sym_flags == C_THUMBEXTFUNC)
if (sym_flags == STT_ARM_TFUNC)
{
elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd,
input_section, hit_data, sym_sec, offset, addend, value);
@ -1246,8 +1232,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
case R_ARM_ABS32:
value += addend;
if (sym_flags == C_THUMBSTATFUNC
|| sym_flags == C_THUMBEXTFUNC)
if (sym_flags == STT_ARM_TFUNC)
value |= 1;
bfd_put_32 (input_bfd, value, hit_data);
return bfd_reloc_ok;
@ -1316,9 +1301,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
bfd_vma add;
bfd_signed_vma signed_add;
if (sym_flags == C_EXT
|| sym_flags == C_STAT
|| sym_flags == C_LABEL)
/* If it's not a call to thumb, assume call to arm */
if (sym_flags != STT_ARM_TFUNC)
{
elf32_thumb_to_arm_stub (info, sym_name, input_bfd, output_bfd, input_section,
hit_data, sym_sec, offset, addend, value);
@ -1526,7 +1510,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend,
info, sec, name,
(h ? h->other : sym->st_other));
(h ? ELF_ST_TYPE (h->type) : ELF_ST_TYPE (sym->st_info)));
if (r != bfd_reloc_ok)
@ -1785,6 +1769,13 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
return true;
}
static int
elf32_arm_get_symbol_type (elf_sym)
Elf_Internal_Sym *elf_sym;
{
return ELF_ST_TYPE(elf_sym->st_info);
}
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
#define TARGET_LITTLE_NAME "elf32-littlearm"
@ -1802,8 +1793,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
#define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data
#define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create
#define elf_backend_get_symbol_type elf32_arm_get_symbol_type
#define elf_symbol_leading_char '_'
#include "elf32-target.h"
/* end-sanitize-armelf */