I am creating a shared object library from two *.a
(static libraries) using GCC. I referred these articles:
- How to force gcc to link an unused static library
- How to include all objects of an archive in a shared object?
and created a command line as:
gcc -shared -o libmain.so main.o -Wl,--whole-archive -lgdiplus -lsqlite3 -Wl,--no-whole-archive
Here main.o
is compiled with -fPIC
option and used for linking to create final output file called libmain.so
. But when I checked my output, it seems to be empty:
$># nm libmain.so
00000000002005d0 a _DYNAMIC
0000000000200788 a _GLOBAL_OFFSET_TABLE_
w _Jv_RegisterClasses
00000000002005a8 d __CTOR_END__
00000000002005a0 d __CTOR_LIST__
00000000002005b8 d __DTOR_END__
00000000002005b0 d __DTOR_LIST__
0000000000000598 r __FRAME_END__
00000000002005c0 d __JCR_END__
00000000002005c0 d __JCR_LIST__
00000000002007a8 A __bss_start
w __cxa_finalize@@GLIBC_2.2.5
0000000000000500 t __do_global_ctors_aux
0000000000000440 t __do_global_dtors_aux
00000000002005c8 d __dso_handle
w __gmon_start__
00000000002007a8 A _edata
00000000002007b8 A _end
0000000000000538 T _fini
00000000000003e0 T _init
0000000000000420 t call_gmon_start
00000000002007b0 b completed.6145
00000000002007a8 b dtor_idx.6147
00000000000004ec T foo
00000000000004c0 t frame_dummy
Ideally this should contain all the symbols from both *.a files
, right?
Can anybody guide what is wrong here? I am using RHEL 5.5 x64 and GCC 4.1.2.
Thanks, Omkar