Subject: libtool and -export-dynamic
To: None <tech-toolchain@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-toolchain
Date: 02/10/2000 20:50:18
I'm trying to get some code portable which loads object code dynamically
and thus needs the -export-dynamic linker option on ELF systems.
The a.out linker (speaking about i386) doesn't understand this flag,
so I thought it is wise to use libtool for abstraction. On ELF, I get
the following now:

/usr/pkg/bin/pkglibtool-ELF-1.2p2  --mode=link g++ -O -o cint 
./main/G__cppmain.o ./src/G__ci.a main/G__setup.o ./readline/libreadline.a -lm 
-ltermcap -export-dynamic
mkdir .libs
extracting global C symbols from `./main/G__cppmain.o'
extracting global C symbols from `./src/G__ci.a'
extracting global C symbols from `main/G__setup.o'
extracting global C symbols from `./readline/libreadline.a'
creating .libs/cintS.c
(cd .libs && g++ -c -fno-builtin "cintS.c")
g++ -O -o cint ./main/G__cppmain.o ./src/G__ci.a main/G__setup.o 
./readline/libreadline.a -lm -ltermcap .libs/cintS.o -Wl,--export-dynamic
./src/G__ci.a(init.o): In function `G__main':
init.o(.text+0xbe6): warning: tmpnam() possibly used unsafely, use mkstemp() 
or mkdtemp()
.libs/cintS.o(.data+0x14c): undefined reference to `G__DUMMY_Free'
.libs/cintS.o(.data+0x8fc): undefined reference to `G__TEST_Calloc'
.libs/cintS.o(.data+0x904): undefined reference to `G__TEST_Free'
.libs/cintS.o(.data+0x90c): undefined reference to `G__TEST_Malloc'
.libs/cintS.o(.data+0x914): undefined reference to `G__TEST_Realloc'
.libs/cintS.o(.data+0x91c): undefined reference to `G__TEST_fclose'
.libs/cintS.o(.data+0x924): undefined reference to `G__TEST_fopen'
.libs/cintS.o(.data+0x18ac): undefined reference to `G__imem'
.libs/cintS.o(.data+0x1c7c): undefined reference to `G__mem'
.libs/cintS.o(.data+0x1c84): undefined reference to `G__memanalysis'
.libs/cintS.o(.data+0x1cb4): undefined reference to `G__memhist'
.libs/cintS.o(.data+0x1cbc): undefined reference to `G__memresult'
collect2: ld returned 1 exit status
*** Error code 1

Imho, libtool doesn't need to play dirty tricks with the symbol
table, so it is perhaps set up the wrong way?

best regards
Matthias