aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-elf.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2015-12-08 10:11:58 +0100
committerJan Beulich <jbeulich@suse.com>2015-12-08 10:11:58 +0100
commitfbdf9406b0589e9b8bbfbbed606f3fff2d060b3c (patch)
treee3755dd2ed9ecd024559e87127a1d9590a021dfe /gas/config/obj-elf.c
parent3685b09fb85dc279762e19df310dc2f30e64b044 (diff)
downloadgdb-fbdf9406b0589e9b8bbfbbed606f3fff2d060b3c.zip
gdb-fbdf9406b0589e9b8bbfbbed606f3fff2d060b3c.tar.gz
gdb-fbdf9406b0589e9b8bbfbbed606f3fff2d060b3c.tar.bz2
ELF: don't re-order SHF_FILE symbols
.file directives may be used to identify the scope of local symbols, the purpose of which gets subverted when re-ordering them. Only allow the first of them to be moved to the first position.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r--gas/config/obj-elf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 031fafb..f930dc6 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -282,14 +282,17 @@ elf_file_symbol (const char *s, int appfile)
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
- if (symbol_rootP != sym)
+ if (symbol_rootP != sym
+ && (symbol_rootP->bsym == NULL
+ || !(symbol_rootP->bsym->flags & BSF_FILE)))
{
symbol_remove (sym, &symbol_rootP, &symbol_lastP);
symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
+ }
+
#ifdef DEBUG
- verify_symbol_chain (symbol_rootP, symbol_lastP);
+ verify_symbol_chain (symbol_rootP, symbol_lastP);
#endif
- }
}
#ifdef NEED_ECOFF_DEBUG