problem create shared dll and -shared option
Craig A. Vanderborgh
craigv@voxware.com
Wed Mar 26 14:30:00 GMT 2003
Hello,
We got dll's using GCC compiled with arm-wince-pe working last year.
The main trick is that the "-shared" option does not work correctly for
the arm-wince-pe target. With the help of Kai Ruotto (on crossgcc) we
arrived at the conclusion that a special 5 step linking process is
required to create dll's with the relocations done properly on
arm-wince-pe.
I have attached an example (with an all-important "project.mk") that
shows you how to do the link so that the result will run on wince.
This example creates a "Hello World" type of thing that can function as
a JNI component for java. We hope this helps you.
Also, a fully operational toolchain for arm-wince-pe
(gcc-3.2/binutils2.13) is available "ready-to-run" for x86linux (RedHat
7.1+). Just make sure you have "-march" set for your platform. You can
get the toolchain from this url:
http://www.atomiser.org/open_source_wince/wincegcc031303.tar.bz2
This toolchain will build an operational dll from the sources I've
attached.
regards,
craig vanderborgh
voxware incorporated
On Wed, 2003-03-26 at 01:14, longchuan wrote:
> hello all:
>
> I had built a cross compiler host=mingw32, target=arm-pe and now i have
> a problem of create shared
> dll.(binutils-2.13-20020903-1-src.tar.gz,gcc-3.2-20020817-1.src.tar.gz
> from mingw)
>
> 1.
> test.def
> ------------------------
> LIBRARY test.dll
> EXPORTS
> _TestFunc
> ----------------------------
> building
> dlltool -d test.def -e test.exp -C -D test.dll -l test.lib -f
> -mcpu=arm7dmi -f -march=armv4
> 2.
> test.c
> ------------------------
> int _DllMainCRTStartup(int pPcb, int op, void* arg3) {return 1;}
>
> void TestFunc() {return;}
> ------------------------
> building
> gcc -O0 -c -fno-exceptions -fno-rtti -fms-extensions -w
> -falign-functions=4 -mcpu=arm7dmi -march=armv4 test.c
>
> 3. using ld to create dll
> ld --dll --subsystem console --entry __DllMainCRTStartup -Map
> test.map --image-base 0x10000000 -o test.dll test.exp test.o
>
> But this dll doesn't have relocation table
>
> objdump -x test.dll
> test.dll: file format pei-arm-little
> test.dll
> architecture: armv4, flags 0x00000132:
> EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED
> start address 0x10001000
>
> Characteristics 0x6607
> relocations stripped // no relocations information
> executable
> line numbers stripped
> debugging information removed
> DLL
> [snip]
>
> I could do the same job with mingw32 gcc for win32, just two
> differences:
> a) at step 1,omit the leading underscore for TestFunc in def file;
> b) at step 3, add -shared option for ld.exe
> and this dll has relocation information.
> Document said that -shared option of ld is" Create a shared library.
> This is currently only supported on ELF, XCOFF and SunOS platforms...."
> , i am not sure whether it support arm-pe configuration.
> when give -shared option to my arm-pe gcc, ld reports:
> Cannot export TestFunc: symbol not found
> Cannot export _DllMainCRTStartup: symbol not found
>
> Any ideas about this situation?
> TIA
> wreckor
>
>
> ------
> Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gnuwince-jnidll.tar.bz2
Type: application/x-bzip
Size: 30624 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20030326/bc1cfd37/attachment.bin>
-------------- next part --------------
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list