public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Elf .file symbols in reverse order
@ 2010-11-22 11:55 Paulo J. Matos
  2010-11-22 21:57 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-22 11:55 UTC (permalink / raw)
  To: binutils

Hello,

I am using 2.18 and I have noticed a quite counterintuitive situation
with .file elf directives.

If I have an asm file starting with:
,----
|         .file "/home/pm18/bugs/b89833/test.asm"
|         .file "/home/pm18/bugs/b89833/test.c"
`----

Once the file is assembled and I use objdump -t, the symbol table shows
them in reverse order:
,----
| SYMBOL TABLE:
| 00000000 l    df *ABS*  00000000 /home/pm18/bugs/b89833/test.c
| 00000000 l    df *ABS*  00000000 /home/pm18/bugs/b89833/test.asm
`----

I am wondering what is doing this to the symbols. 
The interesting thing, and the reason why I noticed it, is that the dwarf
information is being set to assume that the file is test.c which is the
last directive, however, when elf_find_symbol searches for a symbol it
will return test.asm, due to the order in which the file symbols are
sorted in the symbol table. 

Any ideas?

Cheers,

-- 
PMatos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Elf .file symbols in reverse order
  2010-11-22 11:55 Elf .file symbols in reverse order Paulo J. Matos
@ 2010-11-22 21:57 ` Alan Modra
  2010-11-23 14:04   ` Paulo J. Matos
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2010-11-22 21:57 UTC (permalink / raw)
  To: Paulo J. Matos; +Cc: binutils

Reversing file symbol order may just be an accident, caused by
inserting a new file symbol at the head of the symbol list.  gas has
done this since rev 1.1 of the FSF sources.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Elf .file symbols in reverse order
  2010-11-22 21:57 ` Alan Modra
@ 2010-11-23 14:04   ` Paulo J. Matos
  2010-11-24  0:00     ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-23 14:04 UTC (permalink / raw)
  To: binutils

On Tue, 23 Nov 2010 08:27:39 +1030, Alan Modra wrote:

> Reversing file symbol order may just be an accident, caused by inserting
> a new file symbol at the head of the symbol list.  gas has done this
> since rev 1.1 of the FSF sources.

Hummm, I see. I guess you're talking about symbol_rootP from symbols.h. 
Do you see any immediate problem with doing the reverse... inserting at 
the end, instead of the beginning to maintain the order of the definition?

-- 
PMatos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Elf .file symbols in reverse order
  2010-11-23 14:04   ` Paulo J. Matos
@ 2010-11-24  0:00     ` Alan Modra
  2010-11-26 17:47       ` Paulo J. Matos
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2010-11-24  0:00 UTC (permalink / raw)
  To: Paulo J. Matos; +Cc: binutils

On Tue, Nov 23, 2010 at 02:03:36PM +0000, Paulo J. Matos wrote:
> On Tue, 23 Nov 2010 08:27:39 +1030, Alan Modra wrote:
> 
> > Reversing file symbol order may just be an accident, caused by inserting
> > a new file symbol at the head of the symbol list.  gas has done this
> > since rev 1.1 of the FSF sources.
> 
> Hummm, I see. I guess you're talking about symbol_rootP from symbols.h. 

Yes.

> Do you see any immediate problem with doing the reverse... inserting at 
> the end, instead of the beginning to maintain the order of the definition?

I have a vague recollection of trying a patch that put file symbols in
order by scanning forward until a non-file symbol was found then
inserting.  I can't remember why that failed.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Elf .file symbols in reverse order
  2010-11-24  0:00     ` Alan Modra
@ 2010-11-26 17:47       ` Paulo J. Matos
  0 siblings, 0 replies; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-26 17:47 UTC (permalink / raw)
  To: binutils

On Wed, 24 Nov 2010 10:30:29 +1030, Alan Modra wrote:

> 
> I have a vague recollection of trying a patch that put file symbols in
> order by scanning forward until a non-file symbol was found then
> inserting.  I can't remember why that failed.

Hi Alan, Sorry for the delay in my reply. I did manage to patch it but 
probably faced less issues than you since I am only worried about elf.

Now my fork is blissfully working! :)

Cheers,
-- 
PMatos





-- 
PMatos

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-26 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-22 11:55 Elf .file symbols in reverse order Paulo J. Matos
2010-11-22 21:57 ` Alan Modra
2010-11-23 14:04   ` Paulo J. Matos
2010-11-24  0:00     ` Alan Modra
2010-11-26 17:47       ` Paulo J. Matos

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).