Page 1 of 1
ld -T
Posted: Wed Aug 25, 2010 2:02 pm
by MDM
Hey, I'm on OS X 10.6, and it appears that ld doesn't have support for linker scripts. Whenever I run ld -T I get "ld: unknown option: -T". Doing man ld, I'm not finding anything about script support. Was anyone on OS X able to figure out how to get around this?
Re: ld -T
Posted: Wed Aug 25, 2010 2:07 pm
by Srowen
You should use a cross-compiler gcc. This
link is what you need.
Re: ld -T
Posted: Wed Aug 25, 2010 2:18 pm
by gerryg400
I think the LD with macosx is heavily modified. It doesn't support many of the normal binutils command line options. Fortunately it is quite simple to build your own binutils and gcc on macosx.
Re: ld -T
Posted: Wed Aug 25, 2010 5:26 pm
by MDM
Thanks for the help, and the link. I'm getting an error with the configure script stating that a host hasn't been specified, as well as I am unable to find documentation on how to fix it (I'm providing a target, and prefix as directed by the tutorial on the wiki).
Re: ld -T
Posted: Wed Aug 25, 2010 5:36 pm
by gerryg400
Could you attach your config.log please ?
Re: ld -T
Posted: Wed Aug 25, 2010 6:08 pm
by MDM
Code: Select all
Daniel:~ daniel$ cd /Volumes/Macintosh\ HD\ 2/Users/daniel/Library/src/binutils-2.9/
Daniel:binutils-2.9 daniel$ sh configure --target=x86_64-elf --prefix=/usr/src --disable-nls
Config.guess failed to determine the host type. You need to specify one.
Usage: configure [OPTIONS] [HOST]
Options: [defaults in brackets]
--prefix=MYDIR install into MYDIR [/usr/local]
--exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]
--help print this message [normal config]
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [determined via config.guess]
--norecursion configure this directory only [recurse]
--program-prefix=FOO prepend FOO to installed program names [""]
--program-suffix=FOO append FOO to installed program names [""]
--program-transform-name=P transform installed names by sed pattern P [""]
--site=SITE configure with site-specific makefile for SITE
--srcdir=DIR find the sources in DIR [. or ..]
--target=TARGET configure for TARGET [TARGET=HOST]
--tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]
--nfp configure for software floating point [hard float]
--with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)
--without-FOO package FOO is NOT available
--enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)
--disable-FOO do not include feature FOO
Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.
Daniel:binutils-2.9 daniel$
Re: ld -T
Posted: Wed Aug 25, 2010 6:28 pm
by gerryg400
Try running config.guess from the command line. It's in the top binutils directory. That might tell you what's wrong. The main reason I have seen config.guess fail is that there is not a symlink from /usr/bin/cc to /usr/bin/gcc.
BTW, you're not building binutils in the source directory are you ?
Re: ld -T
Posted: Wed Aug 25, 2010 6:35 pm
by MDM
No output or noticeable change from config.gues.
I'm running all commands dirrectly from the binutils directory (which is in ~/Library/src which where I keep uncompiled/uninstalled source code).
Re: ld -T
Posted: Wed Aug 25, 2010 6:59 pm
by quok
binutils 2.9 is VERY VERY old. Try building at least binutils 2.17, but I'd recommend 2.19 or 2.20. I'm running 2.20.1 on OS X 10.5.8, I'll guarantee it works.
Also, you should actually follow the installation instructions for building binutils and the wiki link you were provided earlier; both of them explicitly state that building binutils in the unpacked source directory (and by extension, running the configure script there) is a big no-no.
Re: ld -T
Posted: Wed Aug 25, 2010 7:32 pm
by MDM
Hmm, I guess I didn't read the link good enough. Reread the link, downloaded 2.19, followed the instructions to the letter. The configure worked fine, however make is failing now.
../binutils-2.19.1/configure --target=$TARGET --prefix=$PREFIX --with-libiconv-prefix=/usr/local --disable-nls
Works fine, then I do make, then after a number of files compile, I get
Code: Select all
arlex.c:1841: warning: no previous prototype for ‘yyget_in’
arlex.c:1849: warning: no previous prototype for ‘yyget_out’
arlex.c:1857: warning: no previous prototype for ‘yyget_leng’
arlex.c:1866: warning: no previous prototype for ‘yyget_text’
arlex.c:1877: warning: no previous prototype for ‘yyset_in’
arlex.c:1882: warning: no previous prototype for ‘yyset_out’
arlex.c:1887: warning: no previous prototype for ‘yyget_debug’
arlex.c:1892: warning: no previous prototype for ‘yyset_debug’
arlex.c:1898: warning: no previous prototype for ‘yylex_destroy’
arlex.c:1349: warning: ‘yyunput’ defined but not used
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/ar.c
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/not-ranlib.c
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/arsup.c
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/rename.c
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/binemul.c
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/emul_vanilla.c
/bin/sh ./libtool --tag=CC --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl -lz
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lfl -lz
gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/binutils -I. -I. -I../../binutils-2.19.1/binutils -I../bfd -I../../binutils-2.19.1/binutils/../bfd -I../../binutils-2.19.1/binutils/../include -DLOCALEDIR="\"/usr/local/cross/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../binutils-2.19.1/binutils/strings.c
cc1: warnings being treated as errors
../../binutils-2.19.1/binutils/strings.c: In function ‘strings_file’:
../../binutils-2.19.1/binutils/strings.c:407: warning: ‘stat64’ is deprecated (declared at /usr/include/sys/stat.h:465)
make[4]: *** [strings.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-binutils] Error 2
make: *** [all] Error 2
(This is a partial log since the full log is extremely long).
Re: ld -T
Posted: Wed Aug 25, 2010 7:34 pm
by gerryg400
Add --disable-werror to the configure command line
Re: ld -T
Posted: Wed Aug 25, 2010 8:12 pm
by MDM
You guys are awesome, thanks for all the help!