summaryrefslogtreecommitdiff
path: root/bfd/elf32-avr.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-avr.c')
-rw-r--r--bfd/elf32-avr.c42
1 files changed, 10 insertions, 32 deletions
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 61f28e6d4e2..42683682ff5 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1,5 +1,5 @@
/* AVR-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -29,7 +29,7 @@ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
static void avr_info_to_howto_rela
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
static asection *elf32_avr_gc_mark_hook
- PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static boolean elf32_avr_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
@@ -46,9 +46,6 @@ static boolean elf32_avr_relocate_section
static void bfd_elf_avr_final_write_processing PARAMS ((bfd *, boolean));
static boolean elf32_avr_object_p PARAMS ((bfd *));
-/* Use RELA instead of REL */
-#undef USE_REL
-
static reloc_howto_type elf_avr_howto_table[] =
{
HOWTO (R_AVR_NONE, /* type */
@@ -399,8 +396,8 @@ avr_info_to_howto_rela (abfd, cache_ptr, dst)
}
static asection *
-elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
- bfd *abfd;
+elf32_avr_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;
@@ -426,9 +423,7 @@ elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
}
}
else
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
@@ -724,6 +719,9 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -740,30 +738,9 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
const char * name = NULL;
int r_type;
+ /* This is a final link. */
r_type = ELF32_R_TYPE (rel->r_info);
r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections [r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
howto = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -954,6 +931,7 @@ elf32_avr_object_p (abfd)
#define elf_backend_gc_sweep_hook elf32_avr_gc_sweep_hook
#define elf_backend_check_relocs elf32_avr_check_relocs
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define elf_backend_final_write_processing \
bfd_elf_avr_final_write_processing
#define elf_backend_object_p elf32_avr_object_p