Re: gas/ELF: don't accumulate .type settings
git commit f2d4ba38f5
caused many failures for mips-sgi-irix targets,
and added a new test that failed for aarch64, nds32, and rl78.
The mips failures are due to BSF_OBJECT being set in many cases for
symbols by the mips .global/.globl directive. This patch removes that
code and instead sets BSF_OBJECT in a target frob_symbol function,
also moving the mips hacks in elf_frob_symbol to the new function.
Note that common symbols are handled fine in elf.c:swap_out_syms
without needing to set BSF_OBJECT, so that old code can disappear.
* config/obj-elf.c (elf_frob_symbol): Remove mips hacks.
* config/tc-mips.h (tc_frob_symbol): Define.
(mips_frob_symbol): Declare.
* config/tc-mips.c (s_mips_globl): Don't set BSF_OBJECT for irix.
(mips_frob_symbol): Fudge symbols for irix here.
* testsuite/gas/elf/type-2.e: Allow random target symbols.
This commit is contained in:
parent
64da05d557
commit
d69cd47e7e
|
@ -1,3 +1,12 @@
|
|||
2019-07-09 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* config/obj-elf.c (elf_frob_symbol): Remove mips hacks.
|
||||
* config/tc-mips.h (tc_frob_symbol): Define.
|
||||
(mips_frob_symbol): Declare.
|
||||
* config/tc-mips.c (s_mips_globl): Don't set BSF_OBJECT for irix.
|
||||
(mips_frob_symbol): Fudge symbols for irix here.
|
||||
* testsuite/gas/elf/type-2.e: Allow random target symbols.
|
||||
|
||||
2019-07-05 Kito Cheng <kito.cheng@sifive.com>
|
||||
|
||||
* doc/c-riscv.texi (Instruction Formats): Add r4 type.
|
||||
|
|
|
@ -2369,23 +2369,6 @@ elf_frob_symbol (symbolS *symp, int *puntp)
|
|||
as_bad (_("symbol `%s' can not be both weak and common"),
|
||||
S_GET_NAME (symp));
|
||||
}
|
||||
|
||||
#ifdef TC_MIPS
|
||||
/* The Irix 5 and 6 assemblers set the type of any common symbol and
|
||||
any undefined non-function symbol to STT_OBJECT. We try to be
|
||||
compatible, since newer Irix 5 and 6 linkers care. However, we
|
||||
only set undefined symbols to be STT_OBJECT if we are on Irix,
|
||||
because that is the only time gcc will generate the necessary
|
||||
.global directives to mark functions. */
|
||||
|
||||
if (S_IS_COMMON (symp))
|
||||
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
|
||||
|
||||
if (strstr (TARGET_OS, "irix") != NULL
|
||||
&& ! S_IS_DEFINED (symp)
|
||||
&& (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0)
|
||||
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct group_list
|
||||
|
|
|
@ -16461,7 +16461,6 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
|
|||
char *name;
|
||||
int c;
|
||||
symbolS *symbolP;
|
||||
flagword flag;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -16472,14 +16471,6 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
|
|||
*input_line_pointer = c;
|
||||
SKIP_WHITESPACE_AFTER_NAME ();
|
||||
|
||||
#ifdef TE_IRIX
|
||||
/* On Irix 5, every global symbol that is not explicitly labelled as
|
||||
being a function is apparently labelled as being an object. */
|
||||
flag = BSF_OBJECT;
|
||||
#else
|
||||
flag = BSF_NO_FLAGS;
|
||||
#endif
|
||||
|
||||
if (!is_end_of_line[(unsigned char) *input_line_pointer]
|
||||
&& (*input_line_pointer != ','))
|
||||
{
|
||||
|
@ -16493,11 +16484,9 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
|
|||
(void) restore_line_pointer (c);
|
||||
|
||||
if (sec != NULL && (sec->flags & SEC_CODE) != 0)
|
||||
flag = BSF_FUNCTION;
|
||||
symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
|
||||
}
|
||||
|
||||
symbol_get_bfdsym (symbolP)->flags |= flag;
|
||||
|
||||
c = *input_line_pointer;
|
||||
if (c == ',')
|
||||
{
|
||||
|
@ -16512,6 +16501,23 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
|
|||
demand_empty_rest_of_line ();
|
||||
}
|
||||
|
||||
#ifdef TE_IRIX
|
||||
/* The Irix 5 and 6 assemblers set the type of any common symbol and
|
||||
any undefined non-function symbol to STT_OBJECT. We try to be
|
||||
compatible, since newer Irix 5 and 6 linkers care. */
|
||||
|
||||
void
|
||||
mips_frob_symbol (symbolS *symp ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* This late in assembly we can set BSF_OBJECT indiscriminately
|
||||
and let elf.c:swap_out_syms sort out the symbol type. */
|
||||
flagword *flags = &symbol_get_bfdsym (symp)->flags;
|
||||
if ((*flags & (BSF_GLOBAL | BSF_WEAK)) != 0
|
||||
|| !S_IS_DEFINED (symp))
|
||||
*flags |= BSF_OBJECT;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
s_option (int x ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
|
|
@ -126,6 +126,11 @@ extern void mips_frob_file (void);
|
|||
extern void mips_frob_file_after_relocs (void);
|
||||
#endif
|
||||
|
||||
#ifdef TE_IRIX
|
||||
#define tc_frob_symbol(sym, punt) mips_frob_symbol (sym)
|
||||
extern void mips_frob_symbol (symbolS *);
|
||||
#endif
|
||||
|
||||
#define tc_fix_adjustable(fixp) mips_fix_adjustable (fixp)
|
||||
extern int mips_fix_adjustable (struct fix *);
|
||||
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
+.+: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND *
|
||||
#...
|
||||
+.+: 0+0 +0 +OBJECT +LOCAL +DEFAULT +. test1
|
||||
#...
|
||||
+.+: 0+1 +0 +FUNC +LOCAL +DEFAULT +. test2
|
||||
#...
|
||||
+.+: 0+2 +0 +NOTYPE +LOCAL +DEFAULT +. test3
|
||||
#...
|
||||
+.+: 0+3 +0 +NOTYPE +LOCAL +DEFAULT +. test4
|
||||
#...
|
||||
+.+: 0+4 +0 +NOTYPE +LOCAL +DEFAULT +. test5
|
||||
#...
|
||||
+.+: 0+5 +0 +NOTYPE +LOCAL +DEFAULT +. test6
|
||||
#...
|
||||
+.+: 0+6 +0 +OBJECT +LOCAL +DEFAULT +. test7
|
||||
#...
|
||||
+.+: 0+7 +0 +TLS +LOCAL +DEFAULT +. test8
|
||||
#...
|
||||
+.+: 0+8 +0 +IFUNC +LOCAL +DEFAULT +. test9
|
||||
#pass
|
||||
|
|
Loading…
Reference in New Issue