- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using uClinux-dist with MMU and the gcc 4.1.2 binary toolchain, and I am having a problem with g++ when building a shared library.
A test:#include <stdio.h>
int main(void)
{
printf("hello world\n");
}
gcc build works: $ /data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/nios2-linux-gnu-gcc -DEMBED -mhw-mul -mno-hw-mulx -mno-hw-div -shared -o hello.c.o -c /data/nios/hello.c
$ /data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/nios2-linux-gnu-gcc -mhw-mul -mno-hw-mulx -mno-hw-div -shared -Wl,-soname,libhelloworldc.so -o libhelloworldc.so hello.c.o
Same thing, with g++: $ /data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/nios2-linux-gnu-g++ -DEMBED -mhw-mul -mno-hw-mulx -mno-hw-div -shared -o hello.c.o -c /data/nios/hello.c
$ /data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/nios2-linux-gnu-g++ -mhw-mul -mno-hw-mulx -mno-hw-div -shared -Wl,-soname,libhelloworldc.so -o libhelloworldc.so hello.c.o
/data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-linux-gnu/4.1.2/../../../../nios2-linux-gnu/bin/ld: fde encoding in hello.c.o(.eh_frame) prevents .eh_frame_hdr table being created.
The library actually gets created, but a program using a C++ library built like this gives a SEGV on start. If I build a C++ helloworld executable using g++ and make sure not to use the "-shared" option, then it works. Ideas?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Would you please give me some information by setting
echo 1 > /proc/sys/kernel/print-fatal-signals
. And please try the switch '-fPIC', if possible. Kazu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like the problem I am running into is not because of this warning. helloworld works with -fPIC although I still get the linker warnings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I accidentally covered this up before, but I think this is my real problem in addition to the .eh_frame_hdr table warnings. I can't reproduce this with helloworld, but when I build my executable that uses two C++ shared libraries, I get:
/data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-linux-gnu/4.1.2/../../../../nios2-linux-gnu/bin/ld: testserver: hidden symbol `__divsi3_table' in /data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-linux-gnu/4.1.2/libgcc.a(lib2-divtable.o) is referenced by DSO
/data/nios/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-linux-gnu/4.1.2/../../../../nios2-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
UPDATE: The .eh_frame_hdr warnings seem to be hiding actual link errors. Adding -lgcc -lc to my libraries got me past that error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
About the error 'hidden symbol...', please visit the next site http://www.xastir.org/wiki/index.php/howto:ubuntu_6.10 and refer the 'Work around a bug in libeotiff's configure script' term. Kazu
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page