aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-03-31 21:05:21 +0000
committerIan Lance Taylor <ian@airs.com>1994-03-31 21:05:21 +0000
commit492d52cc58814b4d490db041f41ad1140b7aea5b (patch)
tree7f52b8107518260578ca21f5eb1d48947a143fa9 /bfd/coffcode.h
parent1788b1bd01d0a7cf52f609fbf48e040428274f4a (diff)
downloadgdb-492d52cc58814b4d490db041f41ad1140b7aea5b.zip
gdb-492d52cc58814b4d490db041f41ad1140b7aea5b.tar.gz
gdb-492d52cc58814b4d490db041f41ad1140b7aea5b.tar.bz2
* coffcode.h (CALC_ADDEND): Change to fetch original symbol value
from original BFD, rather than using value of current BFD symbol. Needed for new linker. * coff-sparc.c (CALC_ADDEND): Likewise.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 10cf9ff..66e5ce5 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2266,16 +2266,23 @@ SUBSUBSECTION
*/
#ifndef CALC_ADDEND
-#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
- if (ptr && bfd_asymbol_bfd(ptr) == abfd \
- && !bfd_is_com_section(ptr->section) \
- && !(ptr->flags & BSF_OLD_COMMON)) \
- { \
- cache_ptr->addend = -(ptr->section->vma + ptr->value); \
- } \
- else { \
- cache_ptr->addend = 0; \
- }
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
+ { \
+ coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
+ coffsym = (obj_symbols (abfd) \
+ + (cache_ptr->sym_ptr_ptr - symbols)); \
+ else if (ptr) \
+ coffsym = coff_symbol_from (abfd, ptr); \
+ if (coffsym != (coff_symbol_type *) NULL \
+ && coffsym->native->u.syment.n_scnum == 0) \
+ cache_ptr->addend = 0; \
+ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
+ && ptr->section != (asection *) NULL) \
+ cache_ptr->addend = - (ptr->section->vma + ptr->value); \
+ else \
+ cache_ptr->addend = 0; \
+ }
#endif
static boolean