Hi,
--- Quote Start ---
And is there another possible solution than building the libnano-X dynamically?
--- Quote End ---
This problem is caused by the incomplete implementation of 'tool chains' and there is no way of work-around except to implement those correctly.
And moreover, there is a problem that the size of GOT(Global Offset Table) is limited within 32Kbytes. This fact is not documented at all, but last week I had finally trodden on the tiger's tail.
nios2-wrs-linux-gnu-gcc -I/mnt/usr/include -Wl,-rpath /mnt/usr/lib -g -shared .libs/gtkquery.o .libs/gtksearchengine.o .libs/gtksearchenginesimple.o .libs/fnmatch.o .libs/gtkaboutdialog.o .libs/gtkaccelgroup.o .libs/gtkaccellabel.o .libs/gtkaccelmap.o .libs/gtkaccessible.o .libs/gtkaction.o .libs/gtkactiongroup.o .libs/gtkadjustment.o .libs/gtkalignment.o .libs/gtkarrow.o .libs/gtkaspectframe.o
...............
.-Wl,--whole-archive xdgmime/.libs/libxdgmime.a -Wl,--no-whole-archive -Wl,--rpath -Wl,/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gdk-pixbuf/.libs -Wl,--rpath -Wl,/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gdk/.libs -Wl,--rpath -Wl,/mnt/usr//lib -Wl,--rpath -Wl,/home/hamada/nios2-linux/uClinux-dist/staging/usr/lib -Wl,--rpath -Wl,/mnt/usr/lib -Wl,--rpath -Wl,/mnt/usr/lib -Wl,--rpath -Wl,/mnt/usr//lib -Wl,--rpath -Wl,/home/hamada/nios2-linux/uClinux-dist/staging/usr/lib -L/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gdk-pixbuf/.libs -L/mnt/usr/lib/ ../gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so -L/mnt/usr/lib ../gdk/.libs/libgdk-x11-2.0.so -L/mnt/usr//lib -L/home/hamada/nios2-linux/uClinux-dist/staging/usr/lib/ -L/home/hamada/nios2-linux/uClinux-dist/staging/usr/lib /mnt/usr//lib/libpangocairo-1.0.so /mnt/usr//lib/libpango-1.0.so /home/hamada/nios2-linux/uClinux-dist/staging/usr/lib/libX11.so /mnt/usr//lib/libXcomposite.so /mnt/usr//lib/libXdamage.so /mnt/usr//lib/libXfixes.so /mnt/usr//lib/libatk-1.0.so /mnt/usr/lib/libgobject-2.0.so /mnt/usr/lib/libgmodule-2.0.so /mnt/usr/lib/libglib-2.0.so /mnt/usr//lib/libcairo.so -lm -Wl,-rpath -Wl,-soname -Wl,-version-script -Wl,.libs/libgtk-x11-2.0.ver -o .libs/libgtk-x11-2.0.so.0.1200.12
/home/hamada/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-wrs-linux-gnu/4.1.2/crtbeginS.o: In function `__do_global_dtors_aux':
crtstuff.c:(.text+0x2c): relocation truncated to fit: R_NIOS2_GOT16 against `__cxa_finalize@@GLIBC_2.10'
crtstuff.c:(.text+0x34): relocation truncated to fit: R_NIOS2_GOT16 against `__dso_handle'
crtstuff.c:(.text+0x3c): relocation truncated to fit: R_NIOS2_CALL16 against `__cxa_finalize@@GLIBC_2.10'
/home/hamada/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-wrs-linux-gnu/4.1.2/crtbeginS.o: In function `frame_dummy':
crtstuff.c:(.text+0xdc): relocation truncated to fit: R_NIOS2_GOT16 against `_Jv_RegisterClasses'
/home/hamada/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-wrs-linux-gnu/4.1.2/crtendS.o: In function `__do_global_ctors_aux':
crtstuff.c:(.text+0x18): relocation truncated to fit: R_NIOS2_GOT16 against `__CTOR_END__'
/home/hamada/nios2-linux/toolchain-mmu/x86-linux2/bin/../lib/gcc/nios2-wrs-linux-gnu/4.1.2/crtendS.o:(.init+0x0): relocation truncated to fit: R_NIOS2_CALL16 against `__do_global_ctors_aux'
.libs/gtkquery.o: In function `finalize':
/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gtk/gtkquery.c:44: relocation truncated to fit: R_NIOS2_CALL16 against `g_free'
.libs/gtkquery.o: In function `_gtk_query_init':
/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gtk/gtkquery.c:63: relocation truncated to fit: R_NIOS2_CALL16 against `_gtk_query_get_type'
.libs/gtkquery.o: In function `_gtk_query_new':
/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gtk/gtkquery.c:69: relocation truncated to fit: R_NIOS2_CALL16 against `_gtk_query_get_type'
.libs/gtkquery.o: In function `_gtk_query_set_text':
/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gtk/gtkquery.c:83: relocation truncated to fit: R_NIOS2_CALL16 against `g_free'
.libs/gtkquery.o: In function `_gtk_query_set_location':
/home/hamada/nios2-linux/uClinux-dist/lib/gtk+-2.12.12/gtk/gtkquery.c:97: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
Of course, All sources are compiled with '-fPIC', but nios2's compiler generates the code for dynamic linking like
g_free (query->priv->text);
1ac: e0bffe17 ldw r2,-8(fp)
1b0: 10800317 ldw r2,12(r2)
1b4: 11000017 ldw r4,0(r2)
1b8: b0800017 ldw r2,0(r22)
1bc: 103ee83a callr r2
and the relocation information is like
00000198 0000181a R_NIOS2_PCREL_LO 00000000 _GLOBAL_OFFSET_TABLE_ + 4
000001b8 00001f17 R_NIOS2_CALL16 00000000 g_free + 0
000001c0 00000916 R_NIOS2_GOT16 00000000 _gtk_query_parent_clas + 0
.
So we can't have a GTO which size is more than 32Kbyte and this is caused by the incomplete compiler implementations for code generations.
---nios2.md---
;; FIXME:these uses look unnecessary.
(define_insn "pic_load_addr"
UNSPEC_PIC_SYM))
(use (match_dup 1))]
"flag_pic"
"ldw\\t%0, %%got(%2)(%1)")
(define_insn "pic_load_call_addr"
UNSPEC_PIC_CALL_SYM))
(use (match_dup 1))]
"flag_pic"
"ldw\\t%0, %%call(%2)(%1)")
;; TLS support
But who will repair those?
Kazu