aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-a29k.c
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1991-12-01 07:37:33 +0000
committerSteve Chamberlain <sac@cygnus>1991-12-01 07:37:33 +0000
commit6cba8f4b7832350b97e2d5b4d91a2010435be344 (patch)
tree8725c9b17fac52b7e0b69f89e8033f6a5db447d0 /bfd/coff-a29k.c
parent9b4f91b556ce939e085cfbd61cf6d2cf5466719a (diff)
downloadgdb-6cba8f4b7832350b97e2d5b4d91a2010435be344.zip
gdb-6cba8f4b7832350b97e2d5b4d91a2010435be344.tar.gz
gdb-6cba8f4b7832350b97e2d5b4d91a2010435be344.tar.bz2
* coff-a29k.c: defined RELOC_PROCESSING to take the #ifdef out of
coffcode.h * coffcode.h: use the new macro if available
Diffstat (limited to 'bfd/coff-a29k.c')
-rw-r--r--bfd/coff-a29k.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c
index 0ba2f49..0be7ba4 100644
--- a/bfd/coff-a29k.c
+++ b/bfd/coff-a29k.c
@@ -230,18 +230,45 @@ static reloc_howto_type howto_table[] =
#define BADMAG(x) A29KBADMAG(x)
-/* This macro translates an external r_type field into a pointer to an
- entry in the above table */
-
-
-#define RTYPE2HOWTO(cache_ptr, dst) \
- if (dst.r_type == R_IHCONST) { \
- /* Add in the value which was stored in the symbol index */\
- cache_ptr->addend += dst.r_symndx; \
- /* Throw away the bogus symbol pointer */ \
- cache_ptr->sym_ptr_ptr = 0; \
- } \
- cache_ptr->howto = howto_table + dst.r_type; \
+#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \
+ reloc_processing(relent, reloc, symbols, abfd, section)
+
+void DEFUN(reloc_processing,(relent,reloc, symbols, abfd, section) ,
+ arelent *relent AND
+ struct internal_reloc *reloc AND
+ asymbol **symbols AND
+ bfd *abfd AND
+ asection *section)
+{
+ relent->address = reloc->r_vaddr;
+ relent->howto = howto_table + reloc->r_type;
+ if (reloc->r_type == R_IHCONST)
+ {
+ relent->addend = reloc->r_symndx;
+ relent->sym_ptr_ptr= 0;
+ }
+ else
+ {
+ asymbol *ptr;
+ relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
+
+ ptr = *(relent->sym_ptr_ptr);
+
+ if (ptr
+ && ptr->the_bfd == abfd
+ && ptr->section != (asection *) NULL
+ && ((ptr->flags & BSF_OLD_COMMON)== 0))
+ {
+ relent->addend = -(ptr->section->vma + ptr->value);
+ }
+ else
+ {
+ relent->addend = 0;
+ }
+ relent->address-= section->vma;
+ relent->section = 0;
+ }
+}
#include "coffcode.h"