symbol value for object files and static libraries all zeroes

125 views
Skip to first unread message

Dan

unread,
Jan 7, 2010, 2:17:47 PM1/7/10
to android-ndk
I'm trying to build openssl and am currently debugging a compile time
link error. But when I try use `arm-eabi-nm` to examine the symbol
tables of the intermediate object files and static library, it shows
all text symbols having value=00000000, which can't be right...

To confirm this I wrote a simple test program and compiled it using
`arm-eabi-gcc ${FLAGS} -c`. Analyzing the symbol table with `nm` again
revealed this problem:

arm-eabi-nm *.o
00000000 r .LC0
00000008 r .LC1
U _GLOBAL_OFFSET_TABLE_
U __aeabi_unwind_cpp_pr0
U __aeabi_unwind_cpp_pr1
00000000 T func1
00000000 T func2
00000000 T main
U printf

Strangely though, the program links successfully (`arm-eabi-gcc $
{FLAGS} *.o -o hello`) , and the final executable can run on the
emulator. It also shows a legitimate symbol table. Could someone
please enlighten me what's causing this bhavior?

David Turner

unread,
Jan 7, 2010, 3:02:03 PM1/7/10
to andro...@googlegroups.com
This is normal for object files. The symbols have non zero values for executables and shared libraries which are assigned by the final linker.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




Dan

unread,
Jan 7, 2010, 4:34:41 PM1/7/10
to android-ndk
Is this behavior specific to the ndk? Both the default x86 toolchain
on Ubuntu and codesourcery arm toolchain produce object files with
valid symbol tables.

On Jan 7, 3:02 pm, David Turner <di...@android.com> wrote:
> This is normal for object files. The symbols have non zero values for
> executables and shared libraries which are assigned by the final linker.
>

> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>

David Turner

unread,
Jan 7, 2010, 5:33:17 PM1/7/10
to andro...@googlegroups.com
On Thu, Jan 7, 2010 at 1:34 PM, Dan <danx...@gmail.com> wrote:
Is this behavior specific to the ndk? Both the default x86 toolchain
on Ubuntu and codesourcery arm toolchain produce object files with
valid symbol tables.

I don't know the exact answer to this, but I'll ask the person responsible for our toolchain about that.
Just out of curiousity, why does it matter to you anyway ?
 
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

Dan

unread,
Jan 8, 2010, 10:58:48 AM1/8/10
to android-ndk
I just built libcrypto from openssl library but have ran into
"undefined reference" errors when trying to use its functions. In
these situations one of the first things I do is to check for missing
symbols in the library with `nm`.

On Jan 7, 5:33 pm, David Turner <di...@android.com> wrote:

> > <android-ndk%2Bunsu...@googlegroups.com<android-ndk%252Buns...@googlegroups.com>

Bipin George Mathew

unread,
Jan 8, 2010, 11:18:07 AM1/8/10
to andro...@googlegroups.com, android-ndk
You can find the nm tool under the prebuilt bin folder.
Reply all
Reply to author
Forward
0 new messages