From f2d830a50def7a00a911620a3e9c7d920e5ef0f0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 27 Apr 2017 12:20:10 +0930 Subject: [PATCH] Tidy S_FORCE_RELOC Separate out symbol flag reasons from section reasons to force a reloc. Yes, this adds another section test to the local symbol case too. * symbols.c (S_FORCE_RELOC): Separate section and symbol tests. --- gas/ChangeLog | 4 ++++ gas/symbols.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6156e1e4296..d88f003a2ca 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2017-04-27 Alan Modra + + * symbols.c (S_FORCE_RELOC): Separate section and symbol tests. + 2017-04-26 Maciej W. Rozycki * config/tc-mips.c (RELAX_ENCODE): Add `PIC' flag. diff --git a/gas/symbols.c b/gas/symbols.c index d4f09fca14b..7146c7d5734 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -2091,16 +2091,20 @@ S_IS_DEFINED (symbolS *s) int S_FORCE_RELOC (symbolS *s, int strict) { + segT sec; if (LOCAL_SYMBOL_CHECK (s)) - return ((struct local_symbol *) s)->lsy_section == undefined_section; - - return ((strict + sec = ((struct local_symbol *) s)->lsy_section; + else + { + if ((strict && ((s->bsym->flags & BSF_WEAK) != 0 || (EXTERN_FORCE_RELOC && (s->bsym->flags & BSF_GLOBAL) != 0))) - || (s->bsym->flags & BSF_GNU_INDIRECT_FUNCTION) != 0 - || s->bsym->section == undefined_section - || bfd_is_com_section (s->bsym->section)); + || (s->bsym->flags & BSF_GNU_INDIRECT_FUNCTION) != 0) + return TRUE; + sec = s->bsym->section; + } + return bfd_is_und_section (sec) || bfd_is_com_section (sec); } int -- 2.30.2