Trying to build a toolchain for SH4, failed to compile final GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to compile a toolchain for an SH platform.
I'm using the followings :

gcc 4.1.2
glibc 2.7

I can build the bootstrap gcc using the following (extracted from a more
complete project) :

	cd @DIR_bootstrap_gcc@ && \
		CC=$(CC) \
		LD=$(LD) \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		@CONFIGURE_bootstrap_gcc@ \
			--build=$(build) \
			--host=$(build) \
			--target=$(target) \
			--prefix=$(hostprefix) \
			--with-local-prefix=$(hostprefix)/bootstrap/sys-include \
			--enable-symvers=gnu \
			--enable-__cxa_atexit \
			--enable-target-optspace \
			--enable-languages="c" \
			--with-newlib \
			--disable-multilib \
			--disable-shared \
			--disable-threads \
			--disable-nls  && \
		$(MAKE) -j1 all-gcc && \
		$(MAKE) install-gcc

This produce my bootstrap gcc in the required location.

Using it, I can compile the glibc with a couple of small patches depending
on the SH platform and the following :

	cd @DIR_glibc@ && \
		CC=$(target)-gcc \
		AR=$(target)-ar \
		LD=$(target)-ld \
		RANLIB=$(target)-ranlib \
		CFLAGS="$(TARGET_CFLAGS)" \
		LDFLAGS="$(TARGET_LDFLAGS)" \
		libc_cv_forced_unwind=yes \
		libc_cv_c_cleanup=yes \
		@CONFIGURE_glibc@ \
			--build=$(build) \
			--host=$(target) \
			--prefix= \
			--with-headers=$(hostprefix)/bootstrap/sys-include \
			--with-__thread \
			--with-fp \
		   	--without-gd \
		   	--without-cvs \
			--enable-kernel=2.6.0 \
			--disable-profile \
			--disable-debug \
			--enable-shared \
			--enable-add-ons=nptl && \
		$(MAKE) all && \
		@INSTALL_glibc@

Until there, everything seems to be okay but...Now I try to build the final
gcc with the following :

	cd @DIR_gcc@ && \
		CC=$(CC) \
		LD=$(LD) \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		@CONFIGURE_gcc@ \
			--build=$(build) \
			--host=$(build) \
			--target=$(target) \
			--prefix=$(hostprefix) \
			--with-local-prefix=$(hostprefix)/bootstrap/sys-include \
			--enable-symvers=gnu \
			--enable-__cxa_atexit \
			--enable-target-optspace \
			--enable-languages="c,c++" \
			--with-newlib \
			--enable-shared \
			--enable-threads \
			--disable-nls && \
		$(MAKE) all && \
		@INSTALL_gcc@

This last command failed in linking libgcc :

[ /home/sandbox/cdks/test/cdk/build is the gcc build directory 		]
[ /home/sandbox/cdks/test/output/cdk/ is the output for the toolchain	]

/home/sandbox/cdks/test/cdk/build/./gcc/xgcc -B/home/sandbox/cdks/test/cdk/b
uild/./gcc/ -B/home/sandbox/cdks/test/output/cdk/sh4-unknown-linux-gnu/bin/ 
-B/home/sandbox/cdks/test/output/cdk/sh4-unknown-linux-gnu/lib/ -isystem
/home/sandbox/cdks/test/output/cdk/sh4-unknown-linux-gnu/include -isystem
/home/sandbox/cdks/test/output/cdk/sh4-unknown-linux-gnu/sys-include -O2  -g
 -Os -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes
 -Wmissing-prototypes -Wold-style-definition  -isystem
./include  -fpic -DNO_FPSCR_VALUES -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__G
CC_FLOAT_NOT_NEEDED -Dinhibit_libc -shared -nodefaultlibs -Wl,--soname=libgc
c_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o ./libgcc_s.so.1.tmp
libgcc/./_ashiftrt_s.o libgcc/./_ashiftrt_n_s.o libgcc/./_ashiftlt_s.o
libgcc/./_lshiftrt_s.o libgcc/./_movmem_s.o libgcc/./_movmem_i4_s.o
libgcc/./_mulsi3_s.o libgcc/./_sdivsi3_s.o libgcc/./_sdivsi3_i4_s.o
libgcc/./_udivsi3_s.o libgcc/./_udivsi3_i4_s.o libgcc/./_set_fpscr_s.o
libgcc/./_ic_invalidate_s.o libgcc/./_ic_invalidate_array_s.o
libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o
libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o
libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o
libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o
libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o
libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o
libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o
libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o
libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o
libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o
libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o
libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o
libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o
libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o
libgcc/./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o
libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o
libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o
libgcc/./_fixsfdi_s.o libgcc/./_fixunssfdi_s.o libgcc/./_floatdisf_s.o
libgcc/./_fixdfdi_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_floatdidf_s.o
libgcc/./_fixxfdi_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_floatdixf_s.o
libgcc/./_fixtfdi_s.o libgcc/./_fixunstfdi_s.o libgcc/./_floatditf_s.o
libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o
libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o
libgcc/./_pack_sf_s.o libgcc/./_unpack_sf_s.o libgcc/./_addsub_sf_s.o
libgcc/./_mul_sf_s.o libgcc/./_div_sf_s.o libgcc/./_fpcmp_parts_sf_s.o
libgcc/./_compare_sf_s.o libgcc/./_eq_sf_s.o libgcc/./_ne_sf_s.o
libgcc/./_gt_sf_s.o libgcc/./_ge_sf_s.o libgcc/./_lt_sf_s.o
libgcc/./_le_sf_s.o libgcc/./_unord_sf_s.o libgcc/./_si_to_sf_s.o
libgcc/./_sf_to_si_s.o libgcc/./_negate_sf_s.o libgcc/./_make_sf_s.o
libgcc/./_sf_to_df_s.o libgcc/./_thenan_sf_s.o libgcc/./_sf_to_usi_s.o
libgcc/./_usi_to_sf_s.o libgcc/./_pack_df_s.o libgcc/./_unpack_df_s.o
libgcc/./_addsub_df_s.o libgcc/./_mul_df_s.o libgcc/./_div_df_s.o
libgcc/./_fpcmp_parts_df_s.o libgcc/./_compare_df_s.o libgcc/./_eq_df_s.o
libgcc/./_ne_df_s.o libgcc/./_gt_df_s.o libgcc/./_ge_df_s.o
libgcc/./_lt_df_s.o libgcc/./_le_df_s.o libgcc/./_unord_df_s.o
libgcc/./_si_to_df_s.o libgcc/./_df_to_si_s.o libgcc/./_negate_df_s.o
libgcc/./_make_df_s.o libgcc/./_df_to_sf_s.o libgcc/./_thenan_df_s.o
libgcc/./_df_to_usi_s.o libgcc/./_usi_to_df_s.o libgcc/./unwind-dw2_s.o
libgcc/./unwind-dw2-fde-glibc_s.o libgcc/./unwind-sjlj_s.o
libgcc/./gthr-gnat_s.o libgcc/./unwind-c_s.o -lc && rm -f ./libgcc_s.so &&
if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1
./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp
./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared
library, but some functions are only in"; echo "   the static library.  */";
echo "GROUP ( libgcc_s.so.1 libgcc.a )" ) > ./libgcc_s.so
/home/sandbox/cdks/test/output/cdk/bin/sh4-unknown-linux-gnu-ld: skipping
incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/home/sandbox/cdks/test/output/cdk/bin/sh4-unknown-linux-gnu-ld: cannot find
/lib/libc.so.6
collect2: ld returned 1 exit status

I have checked the files required for linking :

[sandbox@localhost cdk]$ ll ../output/cdk/sh4-unknown-linux-gnu/lib/libc*
:
-rwxr-xr-x 1 sandbox sandbox  7546207 mai 16 18:13 libc-2.7.so
-rw-r--r-- 1 sandbox sandbox 14267786 mai 16 18:12 libc.a
-rw-r--r-- 1 sandbox sandbox    51670 mai 16 18:12 libc_nonshared.a
:
:
-rw-rw-r-- 1 sandbox sandbox      238 mai 16 18:12 libc.so
lrwxrwxrwx 1 sandbox sandbox       11 mai 16 18:12 libc.so.6 -> libc-2.7.so
:

When I take a look at these files I have the exepcted result :

[sandbox@localhost lib]$ file libc-2.7.so
libc-2.7.so: ELF 32-bit LSB shared object, Renesas SH, version 1 (SYSV), for
GNU/Linux 2.6.0, not stripped

When I take a look at the object files the linker is trying to link I also
have expected result :

[sandbox@localhost libgcc]$ file unwind-dw2_s.o
unwind-dw2_s.o: ELF 32-bit LSB relocatable, Renesas SH, version 1 (SYSV),
not stripped

Having a deep look in the xgcc command line, I can find the expected
directory in search path (-B options),
so I don't understand why the cross-ld complains about the lack of required
C library.

Thanks in advance for anyone that may help me.

Sébastien GRENIER






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux