Linker problems with arm-wince, need help/info
Chad J
gamerChad at _spamIsBad_gmail.com
Sat Jun 17 00:09:48 PDT 2006
pedro alves wrote:
> Hi Chad and all,
>
> Yes, it seems that wrong target underscoring is the problem here. I have
> seen this problem too when moving Mamaich's toolchain into gcc4.
>
> You should check cegcc's (http://cegcc.berlios.de) start files. They are
> similar, but not the same.
>
> There are other problems that I fixed for c++ and for binutils related
> to underscoring. I have fixes (some are already in binutils mainline),
> to enable the generation of correct dlls.
>
> You will find patches for that at cegcc's file section.
> I don't know if d is debuggable with gdb, but I have also improved on
> gdb for
> arm-wince-pe. For that you will need to get gdb from cegcc's svn.
>
> That being said, are can try adding a
> -fno-leading-underscore to TARGET_LIBGCC2_CFLAGS in
> gcc/config/arm/t-wince-pe
>
> Cheers,
> Pedro Alves
Note that I cannot use cegcc's gcc, since it is based off of 4.1.x gcc
which is not compatible with gdc.
Also, -fno-leading-underscore is used by the specfile I am using in this
compiler. So it's been in use, how much so I am unsure of though. In
fact, I'll attach my specfile since that may help things.
First thing I did was download and install the cegcc binutils. I got
them from the file downloads on the berliOS site. I then
recompiled/reinstalled arm-wince-pe-gdc with the new binutils, and with
-fno-leading-underscore inserted in TARGET_LIBGCC2_CFLAGS.
Using my old crt0.o file in this configuration led to the same old errors.
Using a crt0.o I grabbed off of the cegcc-0.0.2 cygwin binaries yielded
these errors:
/tmp/cc7BG4tk.o:main.d:(.text+0x44): undefined reference to
`_D3std4file5writeFAaAvZv'
/tmp/cc7BG4tk.o:main.d:(.text+0x8c): undefined reference to `_Dmodule_ref'
/tmp/cc7BG4tk.o:main.d:(.data+0x40): undefined reference to
`_ModuleInfo_3std4file'
/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/crt0.o:/cygdrive/d/gcc/gcc-trunk/newlib/libc/sys/wince/crt0.S:43:
undefined reference to `main2'
Then I noticed where the crt0.S file that made that crt0.o file came
from, and I found that in the cegcc-0.0.3 sources and tried to assemble
that, but the assembler gave me an error:
crt0.S: Assembler messages:
crt0.S:24: Error: bad instruction `func_start __EH_HANDLER__'
hmmm, so I changed that line to what it was in my startfile. Then it
assembled fine, but when I used this new startfile I get the following
errors:
/tmp/ccCPaYXV.o:main.d:(.text+0x44): undefined reference to
`_D3std4file5writeFAaAvZv'
/tmp/ccCPaYXV.o:main.d:(.text+0x8c): undefined reference to `_Dmodule_ref'
/tmp/ccCPaYXV.o:main.d:(.data+0x40): undefined reference to
`_ModuleInfo_3std4file'
/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/crt0.o::
undefined reference to `__set_runtime_thread_mode'
/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/crt0.o::
undefined reference to `main'
Since the spec file seems to override the builtin stuff, I tried
removing -fno-leading-underscore from my specfile to see what would
happen, and it gives many more errors on compilation. I'm guessing the
-fno-leading-underscore is fairly essential, or the resultant programs
wouldn't be able to do essential things like talk to the WinCE OS/API,
whose name manglings would have different underscoring.
Concerning a somewhat unrelated problem, I wonder if there is a way to
make something happen without an external specfile, that is, build it
into the compiler: I want it to include fixincl.h, but only for C and C
plus plus compilation. I tried putting this in TARGET_LIBGCC2_CFLAGS,
but that messes up assembly :)
The reason I ask is this would save a nasty hack I have to do. As it
is, the make of gcc/gdc will fail when it gets to phobos because it
tries to compile C files for arm-wince, but since it lacks the correct
include info it fails. So I made a dummy compiler that calls the real
compiler and tells it to include fixincl.h. Once make fails at phobos,
I have to repeatedly replace xgcc with my own xgcc until the thing works
(some motor skills and not-too-fast computer required!).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: specs
Url: http://lists.puremagic.com/pipermail/d.gnu/attachments/20060617/42dbc580/attachment.diff
More information about the D.gnu
mailing list