This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC crosscompilation broken
- From: Bo Thorsen <bo at sonofthor dot dk>
- To: gcc at gcc dot gnu dot org, bugs at x86-64 dot org
- Date: Thu, 20 Dec 2001 12:24:30 +0100
- Subject: GCC crosscompilation broken
- Organization: SuSE Labs
This patch:
2001-12-15 Jakub Jelinek <jakub@redhat.com>
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
breaks crosscompilation since it includes <stdlib.h> and others in
unwind-dw2-fde-glibc.c. When compiling for the first time, these are not
present (you need a gcc to compile and install glibc). Afaics this "only"
happens when crosscompiling to a linux system.
I have so far been unable to come up with a workaround that didn't involve
reverting this patch.
To test this problem, try something like this (uses x86-64 since ia64
crosscompilation didn't even get to this point):
binutils-build> ../binutils/configure --prefix=/opt/x86-64 \
--target=x86_64-unknown-linux; make; make install
gcc-builc> ../gcc/configure --prefix=/opt/x86-64 \
--target=x86_64-unknown-linux --disable-shared --languages=c; make; make \
install
This produces the following error (-v added for info):
bo@pluto ~/Work/gcc-build/gcc> /home/bo/Work/gcc-build/gcc/xgcc
-B/home/bo/Work/gcc-build/gcc/ -B/opt/x86-64/x86_64-unknown-linux/bin/
-B/opt/x86-64/x86_64-unknown-linux/lib/ -isystem
/opt/x86-64/x86_64-unknown-linux/include -O2 -DIN_GCC -DCROSS_COMPILE -W
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem
./include -fPIC -g1 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I.
-I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/config
-I../../gcc/gcc/../include -fexceptions -c
../../gcc/gcc/unwind-dw2-fde-glibc.c -o libgcc/./unwind-dw2-fde-glibc.o -v
Reading specs from /home/bo/Work/gcc-build/gcc/specs
Configured with: ../gcc/configure --prefix=/opt/x86-64
--target=x86_64-unknown-linux --disable-shared --enable-languages=c
Thread model: single
gcc version 3.1 20011219 (experimental)
/home/bo/Work/gcc-build/gcc/cc1 -lang-c -v -I. -I. -I../../gcc/gcc
-I../../gcc/gcc/. -I../../gcc/gcc/config -I../../gcc/gcc/../include -iprefix
/home/bo/Work/gcc-build/gcc/../lib/gcc-lib/x86_64-unknown-linux/3.1/ -isystem
/home/bo/Work/gcc-build/gcc/include -isystem
/opt/x86-64/x86_64-unknown-linux/bin/include -isystem
/opt/x86-64/x86_64-unknown-linux/lib/include -D__GNUC__=3 -D__GNUC_MINOR__=1
-D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -D__OPTIMIZE__
-D__STDC_HOSTED__=1 -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Acpu=x86_64 -Amachine=x86_64 -D__x86_64 -D__x86_64__
-D__SIZE_TYPE__=unsigned long int -D__PTRDIFF_TYPE__=long int
-D__tune_athlon__ -D__tune_athlon_sse__ -D__PIC__ -D__pic__
-D__LONG_MAX__=9223372036854775807L -DIN_GCC -DCROSS_COMPILE -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -isystem
/opt/x86-64/x86_64-unknown-linux/include -isystem ./include
../../gcc/gcc/unwind-dw2-fde-glibc.c -quiet -dumpbase unwind-dw2-fde-glibc.c
-g1 -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-version -fPIC -fexceptions -o /tmp/ccMxKz2F.s
ignoring nonexistent directory "/opt/x86-64/x86_64-unknown-linux/bin/include"
ignoring nonexistent directory "/opt/x86-64/x86_64-unknown-linux/lib/include"
ignoring nonexistent directory "/opt/x86-64/x86_64-unknown-linux/include"
GNU CPP version 3.1 20011219 (experimental) (cpplib) (x86-64 Linux/ELF)
GNU C version 3.1 20011219 (experimental) (x86_64-unknown-linux)
compiled by GNU C version 2.95.3 20010315 (SuSE).
ignoring nonexistent directory
"/home/bo/Work/gcc-build/lib/gcc-lib/x86_64-unknown-linux/3.1/include"
ignoring nonexistent directory
"/home/bo/Work/gcc-build/lib/gcc-lib/x86_64-unknown-linux/3.1/../../../../x86_64-unknown-linux/sys-include"
ignoring nonexistent directory
"/home/bo/Work/gcc-build/lib/gcc-lib/x86_64-unknown-linux/3.1/../../../../x86_64-unknown-linux/include"
ignoring nonexistent directory
"/opt/x86-64/lib/gcc-lib/x86_64-unknown-linux/3.1/include"
ignoring nonexistent directory
"/opt/x86-64/lib/gcc-lib/x86_64-unknown-linux/3.1/../../../../x86_64-unknown-linux/sys-include"
ignoring nonexistent directory
"/opt/x86-64/lib/gcc-lib/x86_64-unknown-linux/3.1/../../../../x86_64-unknown-linux/include"
ignoring duplicate directory "."
ignoring duplicate directory "../../gcc/gcc"
ignoring duplicate directory "include"
#include "..." search starts here:
#include <...> search starts here:
.
../../gcc/gcc
../../gcc/gcc/config
../../gcc/include
/home/bo/Work/gcc-build/gcc/include
/opt/x86-64/include
End of search list.
../../gcc/gcc/unwind-dw2-fde-glibc.c:35:20: stdlib.h: Ingen s?dan fil eller
filkatalog
../../gcc/gcc/unwind-dw2-fde-glibc.c:36:18: link.h: Ingen s?dan fil eller
filkatalog
In file included from ../../gcc/gcc/unwind-dw2-fde-glibc.c:41:
../../gcc/gcc/unwind-pe.h: In function `size_of_encoded_value':
../../gcc/gcc/unwind-pe.h:76: warning: implicit declaration of function
`abort'
In file included from ../../gcc/gcc/unwind-dw2-fde-glibc.c:292:
../../gcc/gcc/unwind-dw2-fde.c: In function `get_cie_encoding':
../../gcc/gcc/unwind-dw2-fde.c:271: warning: implicit declaration of function
`strlen'
Bo.
--
Bo Thorsen | Praestevejen 4
Free software developer | 5290 Marslev
SuSE Labs | Denmark