From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com, gdb@sources.redhat.com
Cc: Jan Beulich <JBeulich@novell.com>
Subject: Re: gas rearranging elf file symbols
Date: Wed, 20 Oct 2004 02:29:00 -0000 [thread overview]
Message-ID: <20041020022903.GP23491@bubble.modra.org> (raw)
In-Reply-To: <20041008062929.GN12632@bubble.modra.org>
On Fri, Oct 08, 2004 at 03:59:29PM +0930, Alan Modra wrote:
> STT_FILE
> Conventionally, the symbol's name gives the name of the source file
> associated with the object file. A file symbol has STB_LOCAL
> binding, its section index is SHN_ABS, and it precedes the other
> STB_LOCAL symbols for the file, if it is present.
>
> From that wording you could also infer that there should only be one
> file symbol, that of the main source file.
I'm inclined to implement this. gcc/gas seem to only emit one file
symbol for C source, so I think it reasonable to do the same for
assembly. The difference in number of symbols can be quite significant,
for example glibc/io/write.o on powerpc-linux currently has 38 file
symbols (in a total of 49 symbols).
* config/obj-elf.c (elf_file_symbol): Only emit one file symbol.
Any objections from gdb folks?
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.86
diff -u -p -r1.86 obj-elf.c
--- gas/config/obj-elf.c 8 Sep 2004 20:52:48 -0000 1.86
+++ gas/config/obj-elf.c 20 Oct 2004 02:23:13 -0000
@@ -238,19 +238,24 @@ elf_sec_sym_ok_for_reloc (asection *sec)
void
elf_file_symbol (const char *s)
{
- symbolS *sym;
+ if (symbol_rootP == NULL
+ || symbol_rootP->bsym == NULL
+ || (symbol_rootP->bsym->flags & BSF_FILE) == 0)
+ {
+ symbolS *sym;
- sym = symbol_new (s, absolute_section, 0, NULL);
- symbol_set_frag (sym, &zero_address_frag);
- symbol_get_bfdsym (sym)->flags |= BSF_FILE;
+ sym = symbol_new (s, absolute_section, 0, NULL);
+ symbol_set_frag (sym, &zero_address_frag);
+ symbol_get_bfdsym (sym)->flags |= BSF_FILE;
- if (symbol_rootP != sym)
- {
- symbol_remove (sym, &symbol_rootP, &symbol_lastP);
- symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
+ if (symbol_rootP != sym)
+ {
+ 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
--
Alan Modra
IBM OzLabs - Linux Technology Centre
next prev parent reply other threads:[~2004-10-20 2:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-06 8:31 Jan Beulich
2004-10-08 5:53 ` Alan Modra
2004-10-08 6:29 ` Alan Modra
2004-10-20 2:29 ` Alan Modra [this message]
2004-10-08 7:18 Jan Beulich
2004-10-20 6:41 Jan Beulich
2004-10-20 23:48 ` Alan Modra
2004-11-10 3:24 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041020022903.GP23491@bubble.modra.org \
--to=amodra@bigpond.net.au \
--cc=JBeulich@novell.com \
--cc=binutils@sources.redhat.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).