Thread (1 message) 1 message, 1 author, 2008-10-17

Re: [Fwd: finding fuction names]

From: Alan Modra <hidden>
Date: 2008-10-17 21:59:31

On Fri, Oct 17, 2008 at 01:06:29PM -0500, Steven Munroe wrote:
Alan can you respond to this. This XLC but I suspect it is common with
GCC and the PPC64 ABI.
Indeed, this is due to the ABI.

Content-Description: Forwarded message - finding fuction names
To: linuxppc-dev@ozlabs.org
Subject: finding fuction names
From: Tom.Bucken@sybase.com
Date: Fri, 17 Oct 2008 11:07:11 -0400
Cc: vicknair@us.ibm.com

/*

Hi,

   We have code in our product that produces stacktraces.  Part of the
implementation of this code runs nm to find all of the entry points in 
our libraries.

   Using the 7.0 version of this compiler to compile the simple code below

xlC_r -c -q64 tt.cxx 
 nm -C tt.o
                 U __IBMCPlusPlusExceptionV1
0000000000000000 D test()
0000000000000000 T .test()

   Using the 8.0 version of this compiler to compile the simple code below

xlC_r -c -q64 tt.cxx 
nm -C tt.o
                 U __IBMCPlusPlusExceptionV2
0000000000000000 D test()


    We grep the nm output for text symbols which are labeled with 'T'.
Not all function names are not labeled as text in objects compiled with 
8.0.
Is there another way to find all of the fuction names in a library or
a compiler switch that will put all fuctions into the text segment ?
The PowerPC64 ABI uses function descriptors, stored in the .opd
section, a data section.  The address of a function is that of its
descriptor, which nm correctly shows as a 'D' type symbol.  A symbol
marking the start of the function code is unnecessary since you can
find that from the descriptor, so later compilers omit the "dot"
symbol.

nm --synthetic will look up the descriptor for you and display fake
"dot" symbols marking the start of each function's code.

-- 
Alan Modra
Australia Development Lab, IBM
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help