aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-07-08 21:38:59 +0000
committerIan Lance Taylor <ian@airs.com>1996-07-08 21:38:59 +0000
commitdab457340993ec75e8f9efd3f7aa9fcb724bb103 (patch)
tree59b3fc04577691a5daf5a6c69f451af6bb84e42e
parent56b4cbaac3ecb3fbdbc63dca6875b23f029fbd3d (diff)
downloadgdb-dab457340993ec75e8f9efd3f7aa9fcb724bb103.zip
gdb-dab457340993ec75e8f9efd3f7aa9fcb724bb103.tar.gz
gdb-dab457340993ec75e8f9efd3f7aa9fcb724bb103.tar.bz2
* elf32-ppc.c (ppc_elf_howto_raw): For R_PPC_ADDR16_HA, use
ppc_elf_addr16_ha_reloc. (ppc_elf_addr16_ha_reloc): New static function. PR 10036.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf32-ppc.c44
2 files changed, 46 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 21fe6df..0c895f6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
Mon Jul 8 16:18:03 1996 Ian Lance Taylor <ian@cygnus.com>
+ * elf32-ppc.c (ppc_elf_howto_raw): For R_PPC_ADDR16_HA, use
+ ppc_elf_addr16_ha_reloc.
+ (ppc_elf_addr16_ha_reloc): New static function.
+
* coff-mips.c (struct mips_hi): Define.
(mips_refhi_list): New static variable.
(mips_refhi_addr, mips_refhi_addend): Remove.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index abe5a05..d0a432a 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -104,6 +104,8 @@ static reloc_howto_type *ppc_elf_reloc_type_lookup
static void ppc_elf_info_to_howto
PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
static void ppc_elf_howto_init PARAMS ((void));
+static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
static boolean ppc_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
@@ -276,7 +278,7 @@ static reloc_howto_type ppc_elf_howto_raw[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ ppc_elf_addr16_ha_reloc, /* special_function */
"R_PPC_ADDR16_HA", /* name */
false, /* partial_inplace */
0, /* src_mask */
@@ -1052,6 +1054,44 @@ ppc_elf_info_to_howto (abfd, cache_ptr, dst)
cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
}
+/* Handle the R_PPC_ADDR16_HA reloc. */
+
+static bfd_reloc_status_type
+ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ bfd_vma relocation;
+
+ if (output_bfd != NULL)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+ relocation += reloc_entry->addend;
+
+ reloc_entry->addend += (relocation & 0x8000) << 1;
+
+ return bfd_reloc_continue;
+}
+
/* Function to set whether a module needs the -mrelocatable bit set. */
static boolean
@@ -1479,7 +1519,7 @@ ppc_elf_adjust_dynamic_symbol (info, h)
/* If the symbol is currently defined in the .bss section of the
dynamic object, then it is OK to simply initialize it to zero.
If the symbol is in some other section, we must generate a
- R_386_COPY reloc to tell the dynamic linker to copy the initial
+ R_PPC_COPY reloc to tell the dynamic linker to copy the initial
value out of the dynamic object and into the runtime process
image. We need to remember the offset into the .rela.bss section
we are going to use. */