From 1308f14c9723e587a736812b15fa1421675bc534 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 30 Oct 2000 20:26:42 +0000 Subject: [PATCH] * config/tc-sh.c (md_apply_fix): For ELF, do not "adjust back" VAL for weak symbols. --- gas/ChangeLog | 3 +++ gas/config/tc-sh.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 7bf1d207bda..efe6c4908b2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -4,6 +4,9 @@ * as.c (parse_args) : Add comment about the need to check OPTION_MD_BASE in as.h. + * config/tc-sh.c (md_apply_fix): For ELF, do not "adjust back" VAL + for weak symbols. + 2000-10-27 Nick Clifton * configure.in (emulations): Add m68hc12. diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 65ae5517043..645397e8b23 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -2767,8 +2767,17 @@ md_apply_fix (fixP, val) /* The function adjust_reloc_syms won't convert a reloc against a weak symbol into a reloc against a section, but bfd_install_relocation will screw up if the symbol is defined, so we have to adjust val here - to avoid the screw up later. */ - if (fixP->fx_addsy != NULL + to avoid the screw up later. + + For ordinary relocs, this does not happen for ELF, since for ELF, + bfd_install_relocation uses the "special function" field of the + howto, and does not execute the code that needs to be undone, as long + as the special function does not return bfd_reloc_continue. + It can happen for GOT- and PLT-type relocs the way they are + described in elf32-sh.c as they use bfd_elf_generic_reloc, but it + doesn't matter here since those relocs don't use VAL; see below. */ + if (OUTPUT_FLAVOR != bfd_target_elf_flavour + && fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy)) val -= S_GET_VALUE (fixP->fx_addsy); #endif -- 2.30.2