Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
what's problem to build libgcc. binutils, gcc compile smoothly, crt0S.o, crt1S.o and crtnS.o and libc.so also create normally but when build libgcc give following error, by default " ` " in TMPCRT0='tempfile' before and after tempfile but it will give ambiguous error so i change to " ' ", after changing compile crt0S.o, crt1S.o and crtnS.o but give following error , All compilation according to build.sh, which is below
media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/bin/ranlib libgcov.a
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/bin/ranlib libgcc.a
# @multilib_flags@ is still needed because this may use
# /media/g/escape-0.4/crossbuild/i586/gcc/./gcc/xgcc -B/media/g/escape-0.4/crossbuild/i586/gcc/./gcc/ -B/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/bin/ -B/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/ -isystem /media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/include -isystem /media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/sys-include and -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -isystem ./include -fPIC -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED directly.
# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/sh /media/g/escape-0.4/cross/i586/src/gcc/libgcc/../mkinstalldirs .
/media/g/escape-0.4/crossbuild/i586/gcc/./gcc/xgcc -B/media/g/escape-0.4/crossbuild/i586/gcc/./gcc/ -B/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/bin/ -B/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/ -isystem /media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/include -isystem /media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/sys-include -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -isystem ./include -fPIC -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -Wl,-shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_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 && ln -s libgcc_s.so.1 ./libgcc_s.so
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt1S.o: In function `_init':
(.init+0x0): multiple definition of `_init'
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt0S.o:(.init+0x0): first defined here
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt1S.o: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt0S.o:(.fini+0x0): first defined here
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crtnS.o: In function `_init':
(.init+0x0): multiple definition of `_init'
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt0S.o:(.init+0x0): first defined here
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crtnS.o: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/media/g/escape-0.4/cross/i586/../../toolchain/i586/i586-elf-escape/lib/crt0S.o:(.fini+0x0): first defined here
collect2: ld returned 1 exit status
make[1]: *** [libgcc_s.so] Error 1
make[1]: Leaving directory `/media/g/escape-0.4/crossbuild/i586/gcc/i586-elf-escape/libgcc'
make: *** [all-target-libgcc] Error 2
[root@localhost i586]#
if [ "$1" == "--rebuild" ] || [ ! -d $DIST ]; then
REBUILD=1
else
REBUILD=0
fi
# setup
export PREFIX=$DIST
export TARGET=i586-elf-escape
mkdir -p $BUILD/gcc $BUILD/binutils $BUILD/newlib
if [ $REBUILD -eq 1 ]; then
if [ -d $SRC ]; then
if $BUILD_BINUTILS && [ -d $BUILD/binutils ]; then
cd $BUILD/binutils
make distclean
rm -Rf $SRC/binutils
fi
if $BUILD_GCC && [ -d $BUILD/gcc ]; then
cd $BUILD/gcc
make distclean
rm -Rf $SRC/gcc
fi
if $BUILD_CPP && [ -d $BUILD/newlib ]; then
cd $BUILD/newlib
make distclean
rm -Rf $SRC/newlib
fi
cd $ROOT
fi
mkdir -p $SRC
fi
# binutils
if $BUILD_BINUTILS; then
if [ $REBUILD -eq 1 ]; then
cat $BINUTILS_ARCH | bunzip2 | tar -C $SRC -xf -
mv $SRC/binutils-2.20 $SRC/binutils
patch -p0 < binutils.diff
fi
cd $BUILD/binutils
if [ $REBUILD -eq 1 ] || [ ! -f $BUILD/binutils/Makefile ]; then
$SRC/binutils/configure --target=$TARGET --prefix=$PREFIX --disable-nls
if [ $? -ne 0 ]; then
exit 1
fi
fi
make $MAKE_ARGS all && make install
if [ $? -ne 0 ]; then
exit 1
fi
cd $ROOT
fi
# gcc
export PATH=$PATH:$PREFIX/bin
if $BUILD_GCC; then
if [ $REBUILD -eq 1 ]; then
cat $GCCCORE_ARCH | bunzip2 | tar -C $SRC -xf -
cat $GCCGPP_ARCH | bunzip2 | tar -C $SRC -xf -
mv $SRC/gcc-4.4.3 $SRC/gcc
patch -p0 < gcc.diff
fi
cd $BUILD/gcc
if [ $REBUILD -eq 1 ] || [ ! -f $BUILD/gcc/Makefile ]; then
$SRC/gcc/configure --target=$TARGET --prefix=$PREFIX --disable-nls \
--enable-languages=c,c++ --with-headers=$HEADER \
--disable-linker-build-id --with-gxx-include-dir=$HEADER/cpp
if [ $? -ne 0 ]; then
exit 1
fi
fi
make $MAKE_ARGS all-gcc && make install-gcc
if [ $? -ne 0 ]; then
exit 1
fi
ln -sf $DIST/bin/$TARGET-gcc $DIST/bin/$TARGET-cc
# libgcc
# first, generate crt*S.o and libc for libgcc_s. Its not necessary to have a full libc (we'll have
# one later). But at least its necessary to provide the correct startup-files
TMPCRT0='tempfile'
TMPCRT1='tempfile'
TMPCRTN='tempfile'
# crt0 can be empty
echo ".section .init" >> $TMPCRT1
echo ".global _init" >> $TMPCRT
echo "_init:" >> $TMPCRT1
echo " push %ebp" >> $TMPCRT1
echo " mov %esp,%ebp" >> $TMPCRT1
echo ".section .fini" >> $TMPCRT1
echo ".global _fini" >> $TMPCRT1
echo "_fini:" >> $TMPCRT1
echo " push %ebp" >> $TMPCRT1
echo " mov %esp,%ebp" >> $TMPCRT1
# now build libgcc
make $MAKE_ARGS all-target-libgcc && make install-target-libgcc
if [ $? -ne 0 ]; then
exit 1
fi
cd $ROOT
fi
# newlib
if $BUILD_CPP; then
if [ $REBUILD -eq 1 ] || [ ! -d $SRC/newlib ]; then
rm -Rf $SRC/newlib
cat $NEWLIB_ARCH | gunzip | tar -C $SRC -xf -
mv $SRC/newlib-1.15.0 $SRC/newlib
patch -p0 < newlib1.diff
cd $SRC/newlib/newlib/libc/sys
autoconf
cd $ROOT
patch -p0 < newlib2.diff
echo '' > $SRC/newlib/newlib/libc/sys/escape/syscalls.S
cd $SRC/newlib/newlib/libc/sys
autoconf
cd escape
autoreconf
fi
# newlib will create this dir again, so remove it, let newlib put its stuff in there and remove it
# again afterwards & replace it with a symlink to our include
rm -f $DIST/$TARGET/include
cd $BUILD/newlib
if [ $REBUILD -eq 1 ] || [ ! -f Makefile ]; then
rm -Rf $BUILD/newlib/*
$SRC/newlib/configure --target=$TARGET --prefix=$PREFIX
if [ $? -ne 0 ]; then
exit 1
fi
# to prevent problems with makeinfo
echo "MAKEINFO = :" >> $BUILD/newlib/Makefile
fi
make $MAKE_ARGS && make install
if [ $? -ne 0 ]; then
exit 1
fi
# libstdc++
mkdir -p $BUILD/gcc/libstdc++-v3
cd $BUILD/gcc/libstdc++-v3
if [ $REBUILD -eq 1 ] || [ ! -f Makefile ]; then
# pretend that we're using newlib. without it I can't find a way to build libsupc++
CPP=$TARGET-cpp $SRC/gcc/libstdc++-v3/configure --host=$TARGET --prefix=$PREFIX \
--disable-hosted-libstdcxx --disable-nls --with-newlib
if [ $? -ne 0 ]; then
exit 1
fi
fi
cd include
make $MAKE_ARGS && make install
if [ $? -ne 0 ]; then
exit 1
fi
cd ../libsupc++
make $MAKE_ARGS && make install
if [ $? -ne 0 ]; then
exit 1
fi
fi
I can understand, but build escape OS is needed this gcc version, if escape os build by other gcc version then how, otherwise any other site which has related document, if no any then plz guide what changes in crt file then build libgcc smoothly
# libgcc
# first, generate crt*S.o and libc for libgcc_s. Its not necessary to have a full libc (we'll have
# one later). But at least its necessary to provide the correct startup-files
TMPCRT0='tempfile'
TMPCRT1='tempfile'
TMPCRTN='tempfile'
# crt0 can be empty
echo ".section .init" >> $TMPCRT1
echo ".global _init" >> $TMPCRT
echo "_init:" >> $TMPCRT1
echo " push %ebp" >> $TMPCRT1
echo " mov %esp,%ebp" >> $TMPCRT1
echo ".section .fini" >> $TMPCRT1
echo ".global _fini" >> $TMPCRT1
echo "_fini:" >> $TMPCRT1
echo " push %ebp" >> $TMPCRT1
echo " mov %esp,%ebp" >> $TMPCRT1
hitlar wrote:I can understand, but build escape OS is needed this gcc version, if escape os build by other gcc version then how, otherwise any other site which has related document, if no any then plz guide what changes in crt file then build libgcc smoothly
Are you following a tutorial on making an OS? Is 'escape' your OS? Is it somebody elses? If you are building the OS of somebody else, ask them for help because they know their toolchain unlike us.
Unfortunately, I am not experienced with the use of a shared libgcc (only static), so I can't help you much.