From c801568a3aea2906c9134468c7389acab7f54763 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 22 May 2001 09:01:55 +0000 Subject: [PATCH] * config/tc-m68k.c (relaxable_symbol): Only treat external symbols as relaxable if embedded system, make weak syms non-relaxable. Move definition.. (tc_m68k_fix_adjustable): ..so it can be used here. (md_apply_fix_2): Sign extend without conditional. --- gas/ChangeLog | 6 ++++++ gas/config/tc-m68k.c | 44 +++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index f408109203..593852447e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ 2001-05-22 Alan Modra + * config/tc-m68k.c (relaxable_symbol): Only treat external symbols + as relaxable if embedded system, make weak syms non-relaxable. + Move definition.. + (tc_m68k_fix_adjustable): ..so it can be used here. + (md_apply_fix_2): Sign extend without conditional. + * config/tc-v850.c: Update copyright. 2001-05-16 Jeff Johnston diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 8451c2f6b4..842510f957 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -714,6 +714,19 @@ tc_coff_fix2rtype (fixP) #ifdef OBJ_ELF +/* Return zero if the reference to SYMBOL from within the same segment may + be relaxed. */ + +/* On an ELF system, we can't relax an externally visible symbol, + because it may be overridden by a shared library. However, if + TARGET_OS is "elf", then we presume that we are assembling for an + embedded system, in which case we don't have to worry about shared + libraries, and we can relax any external sym. */ + +#define relaxable_symbol(symbol) \ + (!((S_IS_EXTERNAL (symbol) && strcmp (TARGET_OS, "elf") != 0) \ + || S_IS_WEAK (symbol))) + /* Compute the relocation code for a fixup of SIZE bytes, using pc relative relocation if PCREL is non-zero. PIC says whether a special pic relocation was requested. */ @@ -832,8 +845,7 @@ tc_m68k_fix_adjustable (fixP) fixS *fixP; { /* Prevent all adjustments to global symbols. */ - if (S_IS_EXTERNAL (fixP->fx_addsy) - || S_IS_WEAK (fixP->fx_addsy)) + if (! relaxable_symbol (fixP->fx_addsy)) return 0; /* adjust_reloc_syms doesn't know about the GOT */ @@ -866,6 +878,8 @@ tc_m68k_fix_adjustable (fixP) #define get_reloc_code(SIZE,PCREL,OTHER) NO_RELOC +#define relaxable_symbol(symbol) 1 + #endif /* OBJ_ELF */ #ifdef BFD_ASSEMBLER @@ -983,27 +997,6 @@ tc_gen_reloc (section, fixp) #endif /* BFD_ASSEMBLER */ -/* Return zero if the reference to SYMBOL from within the same segment may - be relaxed. */ -#ifdef OBJ_ELF - -/* On an ELF system, we can't relax an externally visible symbol, - because it may be overridden by a shared library. However, if - TARGET_OS is "elf", then we presume that we are assembling for an - embedded system, in which case we don't have to worry about shared - libraries, and we can relax anything. */ - -#define relaxable_symbol(symbol) \ - (strcmp (TARGET_OS, "elf") == 0 \ - || (! S_IS_EXTERNAL (symbol) \ - && ! S_IS_WEAK (symbol))) - -#else - -#define relaxable_symbol(symbol) 1 - -#endif - /* Handle of the OPCODE hash table. NULL means any use before m68k_ip_begin() will crash. */ static struct hash_control *op_hash; @@ -4226,10 +4219,7 @@ md_apply_fix_2 (fixP, val) buf += fixP->fx_where; /* end ibm compiler workaround */ - if (val & 0x80000000) - val |= ~(addressT)0x7fffffff; - else - val &= 0x7fffffff; + val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; #ifdef OBJ_ELF if (fixP->fx_addsy)