undefined reference error while compiling binutils
Posted: Wed Mar 07, 2012 11:46 pm
Hi, I am making my os specific toolchain and the first step is to build binutils. I followed all the steps regarding binutils given in http://wiki.osdev.org/OS_Specific_Toolchain and did a make. Everything goes right but when it comes to making ld the following error pops up:
(btw my os name is AmolOs, target is i586_pc_amolos, emulation name is amolos_i386: from the steps given in the wiki)
make[4]: Entering directory `/usr/src/build-binutils/ld'
/bin/sh ./libtool --tag=CC --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -Wl,--stack,12582912 -o ld-new.exe ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o eamolos_i386.o ../bfd/libbfd.la ../libiberty/libiberty.a -lz
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -Wl,--stack -Wl,12582912 -o .libs/ld-new.exe ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o eamolos_i386.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lz
ldemul.o: In function `ldemul_hll':
/usr/src/build-binutils/ld/../../binutils-2.22/ld/ldemul.c:41: undefined reference to `_ld_amolos_i386_emulation'
collect2: ld returned 1 exit status
Makefile recipe for target `ld-new.exe' failed
make[4]: *** [ld-new.exe] Error 1
make[4]: Leaving directory `/usr/src/build-binutils/ld'
Makefile recipe for target `all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/build-binutils/ld'
Makefile:911: recipe for target `all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/build-binutils/ld'
Makefile:7015: recipe for target `all-ld' failed
make[1]: *** [all-ld] Error 2
make[1]: Leaving directory `/usr/src/build-binutils'
Makefile:842: recipe for target `all' failed
make: *** [all] Error 2
I am pretty sure that I have followed all the steps carefully.
amolos_i386.sh
extract from Makefile.in (of ld directory)
extract from configure.tgt
(btw my os name is AmolOs, target is i586_pc_amolos, emulation name is amolos_i386: from the steps given in the wiki)
make[4]: Entering directory `/usr/src/build-binutils/ld'
/bin/sh ./libtool --tag=CC --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -Wl,--stack,12582912 -o ld-new.exe ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o eamolos_i386.o ../bfd/libbfd.la ../libiberty/libiberty.a -lz
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -Wl,--stack -Wl,12582912 -o .libs/ld-new.exe ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o plugin.o eamolos_i386.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lz
ldemul.o: In function `ldemul_hll':
/usr/src/build-binutils/ld/../../binutils-2.22/ld/ldemul.c:41: undefined reference to `_ld_amolos_i386_emulation'
collect2: ld returned 1 exit status
Makefile recipe for target `ld-new.exe' failed
make[4]: *** [ld-new.exe] Error 1
make[4]: Leaving directory `/usr/src/build-binutils/ld'
Makefile recipe for target `all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/build-binutils/ld'
Makefile:911: recipe for target `all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/build-binutils/ld'
Makefile:7015: recipe for target `all-ld' failed
make[1]: *** [all-ld] Error 2
make[1]: Leaving directory `/usr/src/build-binutils'
Makefile:842: recipe for target `all' failed
make: *** [all] Error 2
I am pretty sure that I have followed all the steps carefully.
amolos_i386.sh
Code: Select all
ARCH=i386
SCRIPT_NAME=pe
OUTPUT_FORMAT="pei-i386"
RELOCATEABLE_OUTPUT_FORMAT="pe-i386"
TEMPLATE_NAME=pe
SUBSYSTEM=PE_DEF_SUBSYSTEM
INITIAL_SYMBOL_CHAR=\"_\"
TARGET_PAGE_SIZE=0x1000
GENERATE_AUTO_IMPORT_SCRIPT=1
Code: Select all
...
eamolos_i386.c: $(srcdir)/emulparams/amolos_i386.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} amolos_i386 "$(tdir_amolos_i386)"
...
Code: Select all
i[3-7]86-*-amolos*) targ_emul=amolos_i386