[#7103] undefined reference to `___shared_flat_add_library' when building speed lib into shared flat binary in buildroot

Document created by Aaronwu Employee on Oct 17, 2013
Version 1Show Document
  • View in full screen mode

[#7103] undefined reference to `___shared_flat_add_library' when building speed lib into shared flat binary in buildroot

Submitted By: Sonic Zhang

Open Date

2012-05-11 06:47:42     Close Date

2012-06-06 23:29:08


Medium     Assignee:

Stuart Henderson


N/A     Silicon Revision:


Fixed     Fixed In Release:




Host Operating System:

toolchain rev.:

    kernel rev.:


Closed     Found In Release:


Is this bug repeatable?:


Summary: undefined reference to `___shared_flat_add_library' when building speed lib into shared flat binary in buildroot



When configure buildroot to build share FLAT binary for bf609-ezkit, I get following error. Other libraries pass building without this error, such as zlib.

What could be the root cause?


make[3]: Entering directory `/home/sonic/projects/buildroot/output/build/speex-1.2rc1/src'

/bin/bash ../libtool --mode=link /home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc  -pipe -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__NOMMU__ -D_GNU_SOURCE -mid-shared-library -mshared-library-id=0 -fvisibility=hidden  -Wl,-elf2flt -mid-shared-library -mshared-library-id=0 -o speexenc  speexenc.o wav_io.o skeleton.o ../libspeex/libspeex.la ../libspeex/libspeexdsp.la -L/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib -logg       -lm

/bin/bash ../libtool --mode=link /home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc  -pipe -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__NOMMU__ -D_GNU_SOURCE -mid-shared-library -mshared-library-id=0 -fvisibility=hidden  -Wl,-elf2flt -mid-shared-library -mshared-library-id=0 -o speexdec  speexdec.o wav_io.o ../libspeex/libspeex.la -L/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib -logg   -lm

/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc -pipe -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__NOMMU__ -D_GNU_SOURCE -mid-shared-library -mshared-library-id=0 -fvisibility=hidden -Wl,-elf2flt -mid-shared-library -mshared-library-id=0 -o speexdec speexdec.o wav_io.o  ../libspeex/.libs/libspeex.a -L/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib /home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib/libogg.a -lm

/home/sonic/projects/buildroot/output/host/usr/bin/bfin-uclinux-gcc -pipe -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__NOMMU__ -D_GNU_SOURCE -mid-shared-library -mshared-library-id=0 -fvisibility=hidden -Wl,-elf2flt -mid-shared-library -mshared-library-id=0 -o speexenc speexenc.o wav_io.o skeleton.o  ../libspeex/.libs/libspeex.a ../libspeex/.libs/libspeexdsp.a -L/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib /home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib/libogg.a -lm

/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib/mid-shared-library/crt1.o: In function `__start':

(.text+0x14): undefined reference to `___shared_flat_add_library'

collect2: ld returned 1 exit status

make[3]: *** [speexdec] Error 1

make[3]: *** Waiting for unfinished jobs....

/home/sonic/projects/buildroot/output/host/usr/bfin-unknown-linux-uclibc/sysroot/usr/lib/mid-shared-library/crt1.o: In function `__start':

(.text+0x14): undefined reference to `___shared_flat_add_library'

collect2: ld returned 1 exit status




--- Stuart Henderson                                         2012-05-11 07:49:54

what branches is this on?  2012R1 for both buildroot and kernel?  what settings

are you using to build?


--- Sonic Zhang                                              2012-05-13 23:48:36

Yes, 2012R1 brach. Change the buildroot binary type from FDPIC to Shared FLAT on

top of default bf609-ezkit configuration.


--- Stuart Henderson                                         2012-05-14 07:49:47

thanks sonic.

I'm fully up to date on both buildroot and the kernel, both on branch 2012R1

and i'm getting errors.  first of all alsalib fails to build, then (when i

exclude that from the build), libsdl fails to build.  this i can't exclude from

the build as make menuconfig won't let me.


--- Stuart Henderson                                         2012-05-17 07:38:14

thanks, that works now.


looks like your adding a non-mid-shared-library library path to the command

line for some reason, which is messing everything up:

/home/shender/gnu/buildroot/output/host/usr/bin/bfin-uclinux-gcc -pipe -Os


-D_GNU_SOURCE -mid-shared-library -mshared-library-id=0 -fvisibility=hidden

-Wl,-elf2flt -mid-shared-library -mshared-library-id=0 -o speexdec speexdec.o

wav_io.o  ../libspeex/.libs/libspeex.a








removing this, or pointing it at the mid-shared-lib sub dir should get things

going again.


--- Sonic Zhang                                              2012-06-04 05:44:00

fixed by remove ogg path in speex makefile


--- Mingquan Pan                                             2012-06-07 00:28:27

Yes, building kernel into shared flat ok now.

And shared flat test has passed with log:


readelf -a version.gdb|grep shared^M

00000018  0004300a R_BFIN_PCREL24    000002b0   ___shared_flat_add_lib + 0^M

0000002a  0000f241 R_BFIN_GOT        01026b98   ___shared_flat_init + 0^M

00000030  00053f41 R_BFIN_GOT        01026bf8   ___shared_flat_fini + 0^M

00000334  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

00000352  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

00000048  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

000000b0  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

000000c4  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

00000100  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

000002b8  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

000002bc  00037041 R_BFIN_GOT        0103a378   ___last_shared_lib + 0^M

000002d0  00026241 R_BFIN_GOT        0103a374   ___first_shared_lib + 0^M

000002d6  00037041 R_BFIN_GOT        0103a378   ___last_shared_lib + 0^M

000002f0  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

0000031c  00012e11 R_BFIN_BYTE2_DATA ffffffff   _current_shared_librar + 0^M

   242: 01026b98    96 FUNC    WEAK   DEFAULT  ABS ___shared_flat_init^M

   302: ffffffff     0 NOTYPE  GLOBAL DEFAULT  ABS _current_shared_library_p^M

   610: 0103a374     4 OBJECT  WEAK   DEFAULT  ABS ___first_shared_lib^M

   880: 0103a378     4 OBJECT  WEAK   DEFAULT  ABS ___last_shared_lib^M

  1072: 000002b0    54 FUNC    GLOBAL HIDDEN    1 ___shared_flat_add_librar^M

  1343: 01026bf8    62 FUNC    WEAK   DEFAULT  ABS ___shared_flat_fini^M


Case 3 ...PASS


So close.












File Name     File Type     File Size     Posted By

No Files Were Found