nm's output for ppc64 elf v1 ABI

Luis Machado lgustavo@codesourcery.com
Wed Nov 16 15:29:00 GMT 2016


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?



More information about the Binutils mailing list