diff options
author | Alan Modra <amodra@gmail.com> | 2019-07-09 12:27:55 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-07-09 14:30:00 +0930 |
commit | d69cd47e7e9884f7b3a319936f70b8d93347e9e0 (patch) | |
tree | 0f20c0314732be1cc380e0701b207e3176d6304b /gas/config/tc-mips.c | |
parent | 64da05d557f59814151e908a34f36996a027d127 (diff) | |
download | gdb-d69cd47e7e9884f7b3a319936f70b8d93347e9e0.zip gdb-d69cd47e7e9884f7b3a319936f70b8d93347e9e0.tar.gz gdb-d69cd47e7e9884f7b3a319936f70b8d93347e9e0.tar.bz2 |
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.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 671d74a..b7b4b69 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -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) { |