xref: /openbsd-src/gnu/usr.bin/binutils/ld/configure.host (revision 007c2a4539b8b8aaa95c5e73e77620090abe113b)
12159047fSniklas# This is the linker host specific file.  This is invoked by the
22159047fSniklas# autoconf generated configure script.  Putting it in a separate shell
32159047fSniklas# file lets us skip running autoconf when modifying host specific
42159047fSniklas# information.
52159047fSniklas
62159047fSniklas# This file sets the following shell variables:
72159047fSniklas#  HDEFINES		host specific compiler flags
82159047fSniklas#  HOSTING_CRT0		crt0.o file used for bootstrapping
92159047fSniklas#  HOSTING_LIBS		libraries used for bootstrapping
102159047fSniklas
112159047fSniklasHDEFINES=
122159047fSniklasHOSTING_CRT0=/lib/crt0.o
13*007c2a45SmiodHOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo --start-group $libgcc -lc --end-group`'
14c074d1c9Sdrahn
15c074d1c9Sdrahn#
16c074d1c9Sdrahn#	Generic configurations:
17c074d1c9Sdrahn#
182159047fSniklas
192159047fSniklascase "${host}" in
202159047fSniklas
21*007c2a45Smiod*-*-freebsd* | *-*-kfreebsd*-gnu)
22*007c2a45Smiod  HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.1\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
23c074d1c9Sdrahn  HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
242159047fSniklas  ;;
252159047fSniklas
26c074d1c9Sdrahn*-*-linux*aout* | *-*-linux*oldld)
27c074d1c9Sdrahn  HOSTING_CRT0=/usr/lib/crt0.o
28c074d1c9Sdrahn  ;;
29c074d1c9Sdrahn
30c074d1c9Sdrahn*-*-linux*libc1*)
31c074d1c9Sdrahn  HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
32c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
33c074d1c9Sdrahn  ;;
34c074d1c9Sdrahn
35c074d1c9Sdrahn*-*-linux*)
36c074d1c9Sdrahn  HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
37c074d1c9Sdrahn  HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
38c074d1c9Sdrahn  ;;
39c074d1c9Sdrahn
40*007c2a45Smiod*-*-netbsd*)
41*007c2a45Smiod  # Different versions of NetBSD with the ELF object format use different
42*007c2a45Smiod  # sets of start/end files.
43*007c2a45Smiod  HOSTING_CRT0='-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o'
44*007c2a45Smiod  if [ -f `${CC} --print-file-name=crti.o` ]; then
45*007c2a45Smiod    # Support for GCC's crtstuff present.
46*007c2a45Smiod    HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crti.o`"
47*007c2a45Smiod    if [ -f ../gcc/crtbegin.o ]; then
48*007c2a45Smiod      HOSTING_CRT0="$HOSTING_CRT0 ../gcc/crtbegin.o"
49*007c2a45Smiod    else
50*007c2a45Smiod      HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`"
51*007c2a45Smiod    fi
52*007c2a45Smiod  else
53*007c2a45Smiod    # Support for GCC's crtstuff not present.
54*007c2a45Smiod    HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`"
55*007c2a45Smiod  fi
56*007c2a45Smiod  if [ -f `${CC} --print-file-name=crtn.o` ]; then
57*007c2a45Smiod    # Support for GCC's crtstuff present.
58*007c2a45Smiod    if [ -f ../gcc/crtbegin.o ]; then
59*007c2a45Smiod      HOSTING_LIBS="$HOSTING_LIBS ../gcc/crtend.o"
60*007c2a45Smiod    else
61*007c2a45Smiod      HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`"
62*007c2a45Smiod    fi
63*007c2a45Smiod    HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtn.o`"
64*007c2a45Smiod  else
65*007c2a45Smiod    # Support for GCC's crtstuff not present.
66*007c2a45Smiod    HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`"
67*007c2a45Smiod  fi
68*007c2a45Smiod  ;;
69*007c2a45Smiod
70*007c2a45Smiod*-*-openbsd*)
71*007c2a45Smiod  HOSTING_CRT0=/usr/lib/crt0.o
72*007c2a45Smiod  ;;
73*007c2a45Smiod
74c074d1c9Sdrahnesac
75c074d1c9Sdrahn
76c074d1c9Sdrahn#
77c074d1c9Sdrahn# Now more specific configurations
78c074d1c9Sdrahn#
79c074d1c9Sdrahn
80c074d1c9Sdrahncase "${host}" in
81c074d1c9Sdrahn
82c074d1c9Sdrahn*-*-linux*aout* | *-*-linux*oldld | *-*-linux*libc1*)
83c074d1c9Sdrahn  # No further tweaking needed
84c074d1c9Sdrahn  ;;
85c074d1c9Sdrahn
86*007c2a45Smiodam33_2.0-*-linux*)
87*007c2a45Smiod  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
88ce21cbaeStomo  ;;
89ce21cbaeStomo
90b305b0f1Sespiearm*-*-linux-gnu*)
91*007c2a45Smiod  HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
92c074d1c9Sdrahn  ;;
93c074d1c9Sdrahn
94c074d1c9Sdrahnhppa*64*-*-hpux11*)
95c074d1c9Sdrahn  HOSTING_CRT0=/usr/ccs/lib/pa20_64/crt0.o
96c074d1c9Sdrahn  # Even if CC is not gcc, the tests use gcc.
97*007c2a45Smiod  HOSTING_LIBS='--start-group `if [ -f ../gcc/libgcc.a ]; then echo ../gcc/libgcc.a; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc --end-group /usr/lib/pa20_64/milli.a'
98b305b0f1Sespie  ;;
99b305b0f1Sespie
100*007c2a45Smiodi[3-7]86-*-bsd* | i[3-7]86-*-freebsd[12] | i[3-7]86-*-freebsd[12]\.* | i[3-7]86-*-freebsd*aout*)
1012159047fSniklas  HOSTING_CRT0=/usr/lib/crt0.o
1022159047fSniklas  ;;
1032159047fSniklas
104*007c2a45Smiodi[3-7]86-*-sysv4*)
105b305b0f1Sespie  HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
106c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
1072159047fSniklas  ;;
1082159047fSniklas
109*007c2a45Smiodi[3-7]86-sequent-ptx* | i[3-7]86-sequent-sysv*)
110b305b0f1Sespie  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
111c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
1122159047fSniklas  ;;
1132159047fSniklas
114*007c2a45Smiodi[3-7]86-*-sysv*)
1152159047fSniklas  HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`'
116c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
1172159047fSniklas  ;;
1182159047fSniklas
119*007c2a45Smiodi[3-7]86-*-solaris*)
120b305b0f1Sespie  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
121c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
1222159047fSniklas  ;;
1232159047fSniklas
124*007c2a45Smiodi[3-7]86-*-sco* | i[3-7]86-*-isc*)
1250c6d0228Sniklas  # In some configurations gcc does not use crtbegin.o and crtend.o.
1260c6d0228Sniklas  # In that case gcc -print-file-name=crtbegin.o will simply print
1270c6d0228Sniklas  # crtbegin.o.  We create dummy crtbegin.o and crtend.o files to
1280c6d0228Sniklas  # handle this.
1290c6d0228Sniklas  echo "int dummy_crtbegin () { return 0; }" > crtbegin.c
1300c6d0228Sniklas  ${CC} -c crtbegin.c -o crtbegin.o
1310c6d0228Sniklas  rm -f crtbegin.c
1320c6d0228Sniklas  echo "int dummy_crteng () { return 0; }" > crtend.c
1330c6d0228Sniklas  ${CC} -c crtend.c -o crtend.o
1340c6d0228Sniklas  rm -f crtend.c
135b305b0f1Sespie  HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
136c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
137258b3869Sniklas  ;;
138258b3869Sniklas
139*007c2a45Smiodi[3-7]86-*-lynxos*)
1402159047fSniklas  HOSTING_CRT0=/lib/init1.o
141c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o'
142b305b0f1Sespie  ;;
143b305b0f1Sespie
144*007c2a45Smiodi[3-7]86-pc-interix*)
145b305b0f1Sespie  HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
146c074d1c9Sdrahn  HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
1472159047fSniklas  ;;
1482159047fSniklas
149*007c2a45Smiodi[3-7]86-*-cygwin*)
150c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
151b55d4692Sfgsch  ;;
152b55d4692Sfgsch
153b55d4692Sfgschia64-*-linux-gnu*)
154c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux-ia64,g"`
155c074d1c9Sdrahn  ;;
156c074d1c9Sdrahn
157c074d1c9Sdrahnia64-*-aix*)
158c074d1c9Sdrahn  HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ 	][ 	]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
159c074d1c9Sdrahn  HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
160b55d4692Sfgsch  ;;
161b55d4692Sfgsch
162c074d1c9Sdrahnmips*-sgi-irix4* | mips*-sgi-irix5*)
1632159047fSniklas  HOSTING_CRT0=/usr/lib/crt1.o
164c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' /usr/lib/crtn.o'
165258b3869Sniklas  ;;
166258b3869Sniklas
167b305b0f1Sespiemips*-sgi-irix6*)
168b305b0f1Sespie  HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`'
169c074d1c9Sdrahn  HOSTING_LIBS='-L/usr/lib32 '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors'
170b305b0f1Sespie  ;;
171b305b0f1Sespie
172b305b0f1Sespiemips*-*-linux-gnu*)
173c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
174b305b0f1Sespie  ;;
175b305b0f1Sespie
176b305b0f1Sespiem68*-*-linux-gnu*)
177c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
178258b3869Sniklas  ;;
179258b3869Sniklas
1802159047fSniklasm68*-*-lynxos*)
1812159047fSniklas  HOSTING_CRT0=/lib/init1.o
182c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o'
1832159047fSniklas  ;;
1842159047fSniklas
185258b3869Sniklasm68*-motorola-sysv)
186b305b0f1Sespie  HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
187c074d1c9Sdrahn  HOSTING_LIBS=`echo "$HOSTING_LIBS" | sed -e "s,-lc,-lc881,"`
188258b3869Sniklas  ;;
189258b3869Sniklas
1902159047fSniklasm68*-sun-*)
1912159047fSniklas  HOSTING_CRT0='/usr/lib/crt0.o /usr/lib/Fcrt1.o -L/usr/lib/fsoft.o'
1922159047fSniklas  ;;
1932159047fSniklas
1942159047fSniklasm88*-*-dgux*)
1952159047fSniklas  HDEFINES=-D__using_DGUX
1960c6d0228Sniklas  HOSTING_CRT0='/lib/crt0.o -X'
1972159047fSniklas  HOSTING_LIBS=/usr/sde/m88kbcs/lib/libc.a
1982159047fSniklas  ;;
1992159047fSniklas
200258b3869Sniklasm88*-motorola-sysv3)
201b305b0f1Sespie  HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
202c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
203c074d1c9Sdrahn  ;;
204c074d1c9Sdrahn
205c074d1c9Sdrahnpowerpc64*-*-linux-gnu*)
206c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld64.so.1,"`
2072159047fSniklas  ;;
2082159047fSniklas
209b305b0f1Sespiepowerpc*-*-linux-gnu*)
210c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
211c074d1c9Sdrahn  ;;
212c074d1c9Sdrahn
213c074d1c9Sdrahns390x-*-linux-gnu*)
214c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld64.so.1,"`
215c074d1c9Sdrahn  ;;
216c074d1c9Sdrahn
217c074d1c9Sdrahns390-*-linux-gnu*)
218c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
219c8525219Srahnds  ;;
220c8525219Srahnds
221258b3869Sniklassparc*-*-solaris2*)
222b305b0f1Sespie  HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
223c074d1c9Sdrahn  HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
2242159047fSniklas  ;;
2252159047fSniklas
226b305b0f1Sespiesparc-*-linux-gnu*)
227c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld-linux.so.2,"`
228b305b0f1Sespie  ;;
229258b3869Sniklas
230b305b0f1Sespiesparc64-*-linux-gnu*)
231c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux.so.2,"`
232258b3869Sniklas  ;;
233258b3869Sniklas
234c074d1c9Sdrahnx86_64-*-linux-gnu*)
235c074d1c9Sdrahn  HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"`
236c074d1c9Sdrahn  ;;
237b55d4692Sfgsch
238*007c2a45Smiod*-*-freebsd* | *-*-kfreebsd*-gnu)
239c074d1c9Sdrahn  ;;
240c074d1c9Sdrahn
241c074d1c9Sdrahn*-*-linux*)
242c074d1c9Sdrahn  ;;
243c074d1c9Sdrahn
244c074d1c9Sdrahn*-*-netbsd*)
245*007c2a45Smiod  ;;
246*007c2a45Smiod
247*007c2a45Smiod*-*-openbsd*)
248b55d4692Sfgsch  ;;
249b55d4692Sfgsch
250b55d4692Sfgschalpha*-*-*)
251b55d4692Sfgsch  HOSTING_CRT0=/usr/ccs/lib/crt0.o
252b55d4692Sfgsch  ;;
253b55d4692Sfgsch
254258b3869Sniklasesac
255