This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: cross-compilation, deprecated option and libgcc
On Tue, 27 Jan 2009 09:16:10 +1100, Ben Elliston <bje@au1.ibm.com> wrote:
> On Mon, 2009-01-26 at 14:19 +0100, Vincent R. wrote:
>
>> 1) When I compile bootstrap gcc, I am using make all-gcc and make
>> install-gcc and it seems it doesn't build libgcc anymore.
>
> I think that's correct; make all-gcc just builds gcc these days. To
> build libgcc, you need to run make all-target-libgcc. libgcc is no
> longer built as part of gcc, but like any other of the target libraries.
>
> It's best to do a make all and make install to avoid these hassles. If
> you want to keep the workload down, use --enable-languages to prune the
> set of languages you support in your "bootstrap" compiler. (Is there a
> reason why you can't just build the cross using your system compiler?)
>
>> So my first question is : For a bootstrap gcc do I need to build libgcc
>> and
>> in this case should I use make all and make install instead ?
>
> Yes.
>
> Cheers, Ben
Ok so one last effort and I will stop to annoy everyone ;-)
Here is the situation, I have built binutils, copied headers into my my
sysroot folder (/opt-mingw32ce-4.4.0),
and generate a bootstrap gcc targeting arm-mingw32ce (a wince-pe target
with mingw32).
So far so good, now the problem arises when trying to compile mingw :
arm-mingw32ce-gcc -Wl,--base-file=mingwthrd.base -B./ -mdll
-Wl,--image-base,0x6FBC0000 mthr.o mthr_init.o -Lmingwex -o
mingwthrd_dummy.exe
/opt/mingw32ce-4.4.0/lib/gcc/arm-mingw32ce/4.4.0/libgcc.a(__main.o): In
function `__do_global_ctors':
/home/vincent/projects/cegcc-4.4.0/src/gcc/libgcc/../gcc/libgcc2.c:2162:
undefined reference to `atexit'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libgcc/../gcc/libgcc2.c:2162:
relocation truncated to fit: ARM_26 against undefined symbol `atexit'
/opt/mingw32ce-4.4.0/lib/gcc/arm-mingw32ce/4.4.0/crtend.o:cygming-crtend.c:(.text+0x14):
undefined reference to `atexit'
/opt/mingw32ce-4.4.0/lib/gcc/arm-mingw32ce/4.4.0/crtend.o:cygming-crtend.c:(.text+0x14):
relocation truncated to fit: ARM_26 against undefined symbol `atexit'
./dllcrt3.o: In function `DllMainCRTStartup':
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:128: undefined
reference to `__atexit_first'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:128: relocation
truncated to fit: ARM_26 against undefined symbol `__atexit_first'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: undefined
reference to `__dll_exit'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: relocation
truncated to fit: ARM_26 against undefined symbol `__dll_exit'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:68: undefined
reference to `__atexit_init'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:68: relocation
truncated to fit: ARM_26 against undefined symbol `__atexit_init'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:86: undefined
reference to `_pei386_runtime_relocator'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:86: relocation
truncated to fit: ARM_26 against undefined symbol
`_pei386_runtime_relocator'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: undefined
reference to `__dll_exit'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: relocation
truncated to fit: ARM_26 against undefined symbol `__dll_exit'
As you can see some symbols are missing and when looking for their
definitions I found out that they were compiled just before and put in a
library called libmingw32.a :
arm-mingw32ce-ar rc libmingw32.a CRTglob.o CRTfmode.o CRTinit.o dllmain.o
gccmain.o crtst.o mthr_stub.o pseudo-reloc.o pseudo-reloc-list.o
cpu_features.o winmain_ce.o abort.o atexit.o assert.o
arm-mingw32ce-ranlib libmingw32.a
So I have added -lmingw32 to the mingw Makefile.in and I was able to
compile and install it :
mingw/Makefile.in
DLL_CC_STUFF = -B./ -mdll $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
\
$(DLL_OFILES) \
-Lmingwex -lmingw32
The final step in my toolchain is to generate a full compiler, so now I
solved all this I thought it would work but actually
I get the same kind of error during the compilation of libssp :
checking sys/param.h usability... libtool: link:
/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/./gcc/xgcc
-B/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/./gcc/
-L/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/arm-mingw32ce/winsup/mingw
-L/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/arm-mingw32ce/winsup/w32api/lib
-isystem /home/vincent/projects/cegcc-4.4.0/src/gcc/winsup/mingw/include
-isystem /home/vincent/projects/cegcc-4.4.0/src/gcc/winsup/w32api/include
-B/opt/mingw32ce-4.4.0/arm-mingw32ce/bin/
-B/opt/mingw32ce-4.4.0/arm-mingw32ce/lib/ -isystem
/opt/mingw32ce-4.4.0/arm-mingw32ce/include -isystem
/opt/mingw32ce-4.4.0/arm-mingw32ce/sys-include -shared .libs/ssp.o
.libs/gets-chk.o .libs/memcpy-chk.o .libs/memmove-chk.o .libs/mempcpy-chk.o
.libs/memset-chk.o .libs/snprintf-chk.o .libs/sprintf-chk.o
.libs/stpcpy-chk.o .libs/strcat-chk.o .libs/strcpy-chk.o
.libs/strncat-chk.o .libs/strncpy-chk.o .libs/vsnprintf-chk.o
.libs/vsprintf-chk.o
-L/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/arm-mingw32ce/winsup/mingw
-L/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/arm-mingw32ce/winsup/w32api/lib
-o .libs/libssp-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib
-Xlinker .libs/libssp.dll.a
yes
checking sys/param.h presence... Creating library file:
.libs/libssp.dll.a.libs/ssp.o: In function `fail':
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:104: undefined
reference to `open'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:104: relocation
truncated to fit: ARM_26 against undefined symbol `open'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:129: undefined
reference to `close'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:129: relocation
truncated to fit: ARM_26 against undefined symbol `close'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:149: undefined
reference to `abort'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:149: relocation
truncated to fit: ARM_26 against undefined symbol `abort'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:123: undefined
reference to `write'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:123: relocation
truncated to fit: ARM_26 against undefined symbol `write'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:155: undefined
reference to `_exit'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:155: relocation
truncated to fit: ARM_26 against undefined symbol `_exit'
.libs/ssp.o: In function `__guard_setup':
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:74: undefined
reference to `open'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:74: relocation
truncated to fit: ARM_26 against undefined symbol `open'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:77: undefined
reference to `read'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:77: relocation
truncated to fit: ARM_26 against undefined symbol `read'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:79: undefined
reference to `close'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libssp/ssp.c:79: relocation
truncated to fit: ARM_26 against undefined symbol `close'
/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/./gcc/libgcc.a(__main.o):
In function `__do_global_ctors':
/home/vincent/projects/cegcc-4.4.0/src/gcc/libgcc/../gcc/libgcc2.c:2162:
undefined reference to `atexit'
/home/vincent/projects/cegcc-4.4.0/src/gcc/libgcc/../gcc/libgcc2.c:2162:
relocation truncated to fit: ARM_26 against undefined symbol `atexit'
/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/./gcc/crtend.o:cygming-crtend.c:(.text+0x14):
undefined reference to `atexit'
/home/vincent/projects/cegcc-4.4.0/src/build-mingw32ce/gcc/./gcc/crtend.o:cygming-crtend.c:(.text+0x14):
relocation truncated to fit: ARM_26 against undefined symbol `atexit'
/opt/mingw32ce-4.4.0/arm-mingw32ce/lib/dllcrt3.o: In function
`DllMainCRTStartup':
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:109: undefined
reference to `DllMain'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:109: additional
relocation overflows omitted from the output
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:128: undefined
reference to `__atexit_first'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: undefined
reference to `__dll_exit'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:68: undefined
reference to `__atexit_init'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:86: undefined
reference to `_pei386_runtime_relocator'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:109: undefined
reference to `DllMain'
/home/vincent/projects/cegcc-4.4.0/src/mingw/dllcrt1.c:140: undefined
reference to `__dll_exit'
collect2: ld returned 1 exit status
This time the missing symbols are located in libmingwex and libmingw32.
So of course I could add a -lmingwex -lmingw32 to libssp, but this new
error indicates that maybe I am missing something important.
When I look in src/gcc/gcc/config/arm/mingw32.h (this file is copied from
i386 and adapted to wince plateform) I can see something like that :
/* Include in the mingw32 libraries with libgcc */
#ifdef ENABLE_SHARED_LIBGCC
#define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s}
%{!shared-libgcc:-lgcc_eh}"
#else
#define SHARED_LIBGCC_SPEC /*empty*/
#endif
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
"%{mthreads:-lmingwthrd} -lmingw32 \
"SHARED_LIBGCC_SPEC" \
-lgcc \
-lmoldname -lmingwex -lcoredll"
That sounds good but it doesn't seem to work so if someone could tell me
why.
To sum up I have an issue with libgcc because it imports some symbols
defined in libmingwex and libmingw32
but REAL_LIBGCC_SPEC doesnt' seem to add these arguments.
Thanks