This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nm's output for ppc64 elf v1 ABI


On Wed, Nov 16, 2016 at 09:29:46AM -0600, Luis Machado wrote:
> Hi,
> 
> I noticed nm's output for ppc64 elfv1 abi symbols is a bit tricky to read if
> you are not familiar with the ABI.
> 
> Considering we output in bsd format (the default), we seem to get a listing
> of function descriptors with sizes that are actually the sizes of the
> functions those descriptors point to. Most of those descriptors don't
> display the source file information along with the other data.
> 
> 0000000010018460 00000000000000d4 D Card::rank_to_string()
> 0000000010018478 00000000000000d4 D Card::suit_to_string()
> 0000000010018490 00000000000000f4 D Card::adjacent(Card*)
> 0000000010018448 00000000000000cc D Card::operator==(Card)
> 0000000010018508 00000000000000a4 D Deck::swap_cards(Card&, Card&)
> 00000000100184d8 0000000000000314 D Deck::initialize_suit(Suit, int&, int)
> 0000000010018520 0000000000000104 D Deck::shuffle()
> 00000000100184f0 00000000000000d4 D Deck::Deck()
> 00000000100184f0 00000000000000d4 D Deck::Deck()
> 00000000100187d8 0000000000000084 D Stack::first_card()
> 00000000100188c8 0000000000000130 D Stack::add(Card)
> 0000000010018880 00000000000000f8 D Stack::draw()
> 00000000100187c0 0000000000000118 D Stack::lock()
> 0000000010018820 00000000000000a0 D Stack::size()
> 
> 
> If we pass --synthetic to print synthetic symbols, then we get a listing of
> the dot symbols with their entry point values and source file information,
> but we lack size information for these synthetic symbols. nm can't calculate
> their sizes correctly either (--size-sort).
> 
> 0000000010001df0 T .Card::rank_to_string()      /src/card.cpp:12
> 0000000010001ed0 T .Card::suit_to_string()      /src/card.cpp:35
> 0000000010001fb0 T .Card::adjacent(Card*)       /src/card.cpp:49
> 0000000010001d20 T .Card::operator==(Card)      /src/card.cpp:6
> 0000000010002940 T .Deck::swap_cards(Card&, Card&)      /src/deck.cpp:38
> 0000000010002540 T .Deck::initialize_suit(Suit, int&, int) /src/deck.cpp:6
> 00000000100029f0 T .Deck::shuffle()     /src/deck.cpp:48
> 0000000010002860 T .Deck::Deck()        /src/deck.cpp:23
> 0000000010005460 T .Stack::first_card() /src/stack.cpp:69
> 0000000010005bb0 T .Stack::add(Card)    /src/stack.cpp:168
> 0000000010005920 T .Stack::draw()       /src/stack.cpp:126
> 0000000010005340 T .Stack::lock()       /src/stack.cpp:10
> 0000000010005620 T .Stack::size()       /src/stack.cpp:267
> 
> Is this format of output deliberate or historical? Or are we outputting
> things in an inconsistent way and therefore need to fix nm?

nm --size-sort handling of synthetic symbols looks broken to me.
nm.c:sort_symbols_by_size is blindly assuming that all the symbols are
elf_symbol_type when the bfd is ELF, but that isn't true for synthetic
symbols.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]