ld -T

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.
Post Reply
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

ld -T

Post 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?
Srowen
Member
Member
Posts: 60
Joined: Thu Feb 26, 2009 2:31 pm
Location: Genova, ITALY

Re: ld -T

Post by Srowen »

You should use a cross-compiler gcc. This link is what you need.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: ld -T

Post 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.
If a trainstation is where trains stop, what is a workstation ?
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

Re: ld -T

Post 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).
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: ld -T

Post by gerryg400 »

Could you attach your config.log please ?
If a trainstation is where trains stop, what is a workstation ?
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

Re: ld -T

Post 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$ 
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: ld -T

Post 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 ?
If a trainstation is where trains stop, what is a workstation ?
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

Re: ld -T

Post 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).
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: ld -T

Post 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.
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

Re: ld -T

Post 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).
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: ld -T

Post by gerryg400 »

Add --disable-werror to the configure command line
If a trainstation is where trains stop, what is a workstation ?
User avatar
MDM
Member
Member
Posts: 57
Joined: Wed Jul 21, 2010 9:05 pm

Re: ld -T

Post by MDM »

You guys are awesome, thanks for all the help!
Post Reply