Debian Codegraph @

gcc/configure.ac

raw
1 # configure.ac for GCC
2 # Process this file with autoconf to generate a configuration script.
3
4 # Copyright (C) 1997-2025 Free Software Foundation, Inc.
5
6 #This file is part of GCC.
7
8 #GCC is free software; you can redistribute it and/or modify it under
9 #the terms of the GNU General Public License as published by the Free
10 #Software Foundation; either version 3, or (at your option) any later
11 #version.
12
13 #GCC is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #for more details.
17
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING3. If not see
20 #<http://www.gnu.org/licenses/>.
21
22 # --------------------------------
23 # Initialization and sanity checks
24 # --------------------------------
25
26 AC_INIT
27 AC_CONFIG_SRCDIR(tree.cc)
28 AC_CONFIG_MACRO_DIRS([../config] [..])
29 AC_CONFIG_HEADER(auto-host.h:config.in)
30
31 gcc_version=`cat $srcdir/BASE-VER`
32
33 # Determine the host, build, and target systems
34 AC_CANONICAL_BUILD
35 AC_CANONICAL_HOST
36 AC_CANONICAL_TARGET
37
38 # Determine the noncanonical host name, for Ada.
39 ACX_NONCANONICAL_HOST
40
41 # Determine the noncanonical target name, for directory use.
42 ACX_NONCANONICAL_TARGET
43
44 # Used for constructing correct paths for offload compilers.
45 real_target_noncanonical=${target_noncanonical}
46 accel_dir_suffix=
47
48 # Determine the target- and build-specific subdirectories
49 GCC_TOPLEV_SUBDIRS
50
51 # Set program_transform_name
52 AC_ARG_PROGRAM
53
54 # Check for bogus environment variables.
55 # Test if LIBRARY_PATH contains the notation for the current directory
56 # since this would lead to problems installing/building glibc.
57 # LIBRARY_PATH contains the current directory if one of the following
58 # is true:
59 # - one of the terminals (":" and ";") is the first or last sign
60 # - two terminals occur directly after each other
61 # - the path contains an element with a dot in it
62 AC_MSG_CHECKING(LIBRARY_PATH variable)
63 changequote(,)dnl
64 case ${LIBRARY_PATH} in
65 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
66 library_path_setting="contains current directory"
67 ;;
68 *)
69 library_path_setting="ok"
70 ;;
71 esac
72 changequote([,])dnl
73 AC_MSG_RESULT($library_path_setting)
74 if test "$library_path_setting" != "ok"; then
75 AC_MSG_ERROR([
76 *** LIBRARY_PATH shouldn't contain the current directory when
77 *** building gcc. Please change the environment variable
78 *** and run configure again.])
79 fi
80
81 # Test if GCC_EXEC_PREFIX contains the notation for the current directory
82 # since this would lead to problems installing/building glibc.
83 # GCC_EXEC_PREFIX contains the current directory if one of the following
84 # is true:
85 # - one of the terminals (":" and ";") is the first or last sign
86 # - two terminals occur directly after each other
87 # - the path contains an element with a dot in it
88 AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
89 changequote(,)dnl
90 case ${GCC_EXEC_PREFIX} in
91 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
92 gcc_exec_prefix_setting="contains current directory"
93 ;;
94 *)
95 gcc_exec_prefix_setting="ok"
96 ;;
97 esac
98 changequote([,])dnl
99 AC_MSG_RESULT($gcc_exec_prefix_setting)
100 if test "$gcc_exec_prefix_setting" != "ok"; then
101 AC_MSG_ERROR([
102 *** GCC_EXEC_PREFIX shouldn't contain the current directory when
103 *** building gcc. Please change the environment variable
104 *** and run configure again.])
105 fi
106
107 # -----------
108 # Directories
109 # -----------
110
111 # Specify the local prefix
112 local_prefix=
113 AC_ARG_WITH(local-prefix,
114 [AS_HELP_STRING([--with-local-prefix=DIR],
115 [specifies directory to put local include])],
116 [case "${withval}" in
117 yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
118 no) ;;
119 *) local_prefix=$with_local_prefix ;;
120 esac])
121
122 # Default local prefix if it is empty
123 if test x$local_prefix = x; then
124 local_prefix=/usr/local
125 fi
126
127 AC_ARG_WITH([native-system-header-dir],
128 [ --with-native-system-header-dir=dir
129 use dir as the directory to look for standard
130 system header files in. Defaults to /usr/include.],
131 [
132 case ${with_native_system_header_dir} in
133 yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;;
134 /* | [[A-Za-z]]:[[\\/]]*) ;;
135 *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;;
136 esac
137 configured_native_system_header_dir="${withval}"
138 ], [configured_native_system_header_dir=])
139
140 AC_ARG_WITH(build-sysroot,
141 [AS_HELP_STRING([--with-build-sysroot=sysroot],
142 [use sysroot as the system root during the build])],
143 [if test x"$withval" != x ; then
144 SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
145 fi],
146 [SYSROOT_CFLAGS_FOR_TARGET=])
147 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
148
149 if test "x$prefix" = xNONE; then
150 test_prefix=/usr/local
151 else
152 test_prefix=$prefix
153 fi
154 if test "x$exec_prefix" = xNONE; then
155 test_exec_prefix=$test_prefix
156 else
157 test_exec_prefix=$exec_prefix
158 fi
159
160 AC_ARG_WITH(sysroot,
161 [AS_HELP_STRING([[--with-sysroot[=DIR]]],
162 [search for usr/lib, usr/include, et al, within DIR])],
163 [
164 case ${with_sysroot} in
165 /) ;;
166 */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
167 esac
168 case ${with_sysroot} in
169 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
170 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
171 esac
172
173 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
174 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
175
176 case ${TARGET_SYSTEM_ROOT} in
177 "${test_prefix}"|"${test_prefix}/"*|\
178 "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
179 '${prefix}'|'${prefix}/'*|\
180 '${exec_prefix}'|'${exec_prefix}/'*)
181 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
182 TARGET_SYSTEM_ROOT_DEFINE="$t"
183 ;;
184 esac
185 ], [
186 TARGET_SYSTEM_ROOT=
187 TARGET_SYSTEM_ROOT_DEFINE=
188 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
189 ])
190 AC_SUBST(TARGET_SYSTEM_ROOT)
191 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
192 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
193
194 # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
195 # passed in by the toplevel make and thus we'd get different behavior
196 # depending on where we built the sources.
197 gcc_gxx_include_dir=
198 # Specify the g++ header file directory
199 AC_ARG_WITH(gxx-include-dir,
200 [AS_HELP_STRING([--with-gxx-include-dir=DIR],
201 [specifies directory to put g++ header files])],
202 [case "${withval}" in
203 yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
204 no) ;;
205 *) gcc_gxx_include_dir=$with_gxx_include_dir ;;
206 esac])
207
208 # If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
209 # the former in the latter and, upon success, compute gcc_gxx_include_dir as
210 # relative to the sysroot.
211 gcc_gxx_include_dir_add_sysroot=0
212
213 # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
214 if test x${gcc_gxx_include_dir} = x; then
215 if test x${enable_version_specific_runtime_libs} = xyes; then
216 gcc_gxx_include_dir='${libsubdir}/include/c++'
217 else
218 libstdcxx_incdir='include/c++/$(version)'
219 if test x$host != x$target; then
220 libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
221 fi
222 gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
223 fi
224 elif test "${with_sysroot+set}" = set; then
225 gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
226 if test "${gcc_gxx_without_sysroot}"; then
227 gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
228 gcc_gxx_include_dir_add_sysroot=1
229 fi
230 fi
231
232 # Configuration for an alternate set of C++ headers.
233 gcc_gxx_libcxx_include_dir=
234 # Specify the alternate g++ header file directory
235 AC_ARG_WITH(gxx-libcxx-include-dir,
236 [AS_HELP_STRING([--with-gxx-libcxx-include-dir=DIR],
237 [specifies directory to find libc++ header files])],
238 [case "${withval}" in
239 yes) AC_MSG_ERROR(bad value ${withval} given for libc++ include directory) ;;
240 *) gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir ;;
241 esac])
242
243 # --with-gxx-libcxx-include-dir controls the enabling of the -stdlib option.
244 # if --with-gxx-libcxx-include-dir is 'no' we disable the stdlib option.
245 # if --with-gxx-libcxx-include-dir is unset we enable the stdlib option
246 # based on the platform (to be available on platform versions where it is the
247 # default for the system tools). We also use a default path within the compiler
248 # install tree.
249 # Otherwise, we use the path provided and enable the stdlib option.
250 # If both --with-sysroot and --with-gxx-libcxx-include-dir are passed, we
251 # check to see if the latter starts with the former and, upon success, compute
252 # gcc_gxx_libcxx_include_dir as relative to the sysroot.
253 gcc_gxx_libcxx_include_dir_add_sysroot=0
254 gcc_enable_stdlib_opt=0
255 if test x${gcc_gxx_libcxx_include_dir} != x; then
256 if test x${gcc_gxx_libcxx_include_dir} = xno; then
257 # set defaults for the dir, but the option is disabled anyway.
258 gcc_gxx_libcxx_include_dir=
259 else
260 gcc_enable_stdlib_opt=1
261 fi
262 else
263 case $target in
264 *-darwin1[[1-9]]* | *-darwin2*)
265 # Default this on for Darwin versions which default to libcxx,
266 # and embed the path in the compiler install so that we get a
267 # self-contained toolchain.
268 gcc_enable_stdlib_opt=1
269 ;;
270 *) ;;
271 esac
272 fi
273 AC_DEFINE_UNQUOTED(ENABLE_STDLIB_OPTION, $gcc_enable_stdlib_opt,
274 [Define if the -stdlib= option should be enabled.])
275
276 # Sysroot behaviour as for gxx-include-dir
277 if test x${gcc_gxx_libcxx_include_dir} = x; then
278 # default path,embedded in the compiler tree.
279 libcxx_incdir='include/c++/v1'
280 if test x${enable_version_specific_runtime_libs} = xyes; then
281 gcc_gxx_libcxx_include_dir='${libsubdir}/$libcxx_incdir'
282 else
283 if test x$host != x$target; then
284 libcxx_incdir="$target_alias/$libcxx_incdir"
285 fi
286 gcc_gxx_libcxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libcxx_incdir"
287 fi
288 elif test "${with_sysroot+set}" = set; then
289 gcc_gxx_libcxx_without_sysroot=`expr "${gcc_gxx_libcxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
290 if test "${gcc_gxx_libcxx_without_sysroot}"; then
291 gcc_gxx_libcxx_include_dir="${gcc_gxx_libcxx_without_sysroot}"
292 gcc_gxx_libcxx_include_dir_add_sysroot=1
293 fi
294 fi
295
296 AC_ARG_WITH(cpp_install_dir,
297 [AC_HELP_STRING([--with-cpp-install-dir=DIR],
298 [install the user visible C preprocessor in DIR
299 (relative to PREFIX) as well as PREFIX/bin])],
300 [if test x$withval = xyes; then
301 AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
302 elif test x$withval != xno; then
303 cpp_install_dir=$withval
304 fi])
305
306 # We would like to our source tree to be readonly. However when releases or
307 # pre-releases are generated, the flex/bison generated files as well as the
308 # various formats of manuals need to be included along with the rest of the
309 # sources. Therefore we have --enable-generated-files-in-srcdir to do
310 # just that.
311
312 AC_MSG_CHECKING([whether to place generated files in the source directory])
313 dnl generated-files-in-srcdir is disabled by default
314 AC_ARG_ENABLE(generated-files-in-srcdir,
315 [AS_HELP_STRING([--enable-generated-files-in-srcdir],
316 [put copies of generated files in source dir
317 intended for creating source tarballs for users
318 without texinfo bison or flex])],
319 generated_files_in_srcdir=$enableval,
320 generated_files_in_srcdir=no)
321
322 AC_MSG_RESULT($generated_files_in_srcdir)
323
324 if test "$generated_files_in_srcdir" = "yes"; then
325 GENINSRC=''
326 else
327 GENINSRC='#'
328 fi
329 AC_SUBST(GENINSRC)
330
331 # -------------------
332 # Find default linker
333 # -------------------
334
335 # With GNU ld
336 AC_ARG_WITH(gnu-ld,
337 [AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
338 gnu_ld_flag="$with_gnu_ld",
339 gnu_ld_flag=no)
340
341 case $target in
342 *darwin*)
343 ld64_flag=yes # Darwin can only use a ld64-compatible linker.
344 dsymutil_flag=yes # Darwin uses dsymutil to link debug.
345 ;;
346 *)
347 ld64_flag=no
348 dsymutil_flag=no
349 ;;
350 esac
351
352 # With pre-defined ld
353 AC_ARG_WITH(ld,
354 [AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])],
355 DEFAULT_LINKER="$with_ld")
356 if test x"${DEFAULT_LINKER+set}" = x"set"; then
357 if test ! -x "$DEFAULT_LINKER"; then
358 AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
359 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
360 gnu_ld_flag=yes
361 elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep 'PROJECT:ld\(64\)*-' > /dev/null; then
362 ld64_flag=yes
363 fi
364 AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
365 [Define to enable the use of a default linker.])
366 fi
367
368 AC_MSG_CHECKING([whether a default linker was specified])
369 if test x"${DEFAULT_LINKER+set}" = x"set"; then
370 if test x"$gnu_ld_flag" = x"no"; then
371 AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
372 else
373 AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
374 fi
375 else
376 AC_MSG_RESULT(no)
377 fi
378
379 # With demangler in GNU ld
380 AC_ARG_WITH(demangler-in-ld,
381 [AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])],
382 demangler_in_ld="$with_demangler_in_ld",
383 demangler_in_ld=yes)
384
385 # Allow the user to specify a dsymutil executable (used on Darwin only, so far)
386 AC_ARG_WITH(dsymutil,
387 [AS_HELP_STRING([--with-dsymutil], [arrange to use the specified dsymutil (full pathname)])],
388 DEFAULT_DSYMUTIL="$with_dsymutil")
389
390 dsymutil_vers=
391 if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
392 if test ! -x "$DEFAULT_DSYMUTIL"; then
393 AC_MSG_ERROR([cannot execute: $DEFAULT_DSYMUTIL: check --with-dsymutil or env. var. DEFAULT_DSYMUTIL])
394 else
395 if dsymutil_vers=`$DEFAULT_DSYMUTIL -v /dev/null 2>&1`; then
396 dsymutil_flag=yes
397 fi
398 fi
399 AC_DEFINE_UNQUOTED(DEFAULT_DSYMUTIL,"$DEFAULT_DSYMUTIL",
400 [Define to enable the use of a default debug linker.])
401 fi
402
403 AC_MSG_CHECKING([whether a default dsymutil was specified])
404 if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
405 AC_MSG_RESULT([yes ($DEFAULT_DSYMUTIL)])
406 else
407 AC_MSG_RESULT(no)
408 fi
409
410 # ----------------------
411 # Find default assembler
412 # ----------------------
413
414 # With GNU as
415 AC_ARG_WITH(gnu-as,
416 [AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
417 gas_flag="$with_gnu_as",
418 gas_flag=no)
419
420 AC_ARG_WITH(as,
421 [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])],
422 DEFAULT_ASSEMBLER="$with_as")
423 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
424 if test ! -x "$DEFAULT_ASSEMBLER"; then
425 AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
426 elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
427 gas_flag=yes
428 fi
429 AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
430 [Define to enable the use of a default assembler.])
431 fi
432
433 AC_MSG_CHECKING([whether a default assembler was specified])
434 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
435 if test x"$gas_flag" = x"no"; then
436 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
437 else
438 AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
439 fi
440 else
441 AC_MSG_RESULT(no)
442 fi
443
444 # ---------------
445 # Find C compiler
446 # ---------------
447
448 # If a non-executable a.out is present (e.g. created by GNU as above even if
449 # invoked with -v only), the IRIX 6 native ld just overwrites the existing
450 # file, even when creating an executable, so an execution test fails.
451 # Remove possible default executable files to avoid this.
452 #
453 # FIXME: This really belongs into AC_PROG_CC and can be removed once
454 # Autoconf includes it.
455 rm -f a.out a.exe b.out
456
457 # Find the native compiler
458 AC_PROG_CC
459 AC_PROG_CXX
460 ACX_PROG_GNAT([-I"$srcdir"/ada/libgnat])
461 ACX_PROG_GDC([-I"$srcdir"/d])
462
463 # Do configure tests with the C++ compiler, since that's what we build with.
464 AC_LANG(C++)
465
466 # Remove all -O flags: for historical reasons, unless bootstrapping we prefer
467 # optimizations to be activated explicitly by the toplevel.
468 case "$CC" in
469 */prev-gcc/xgcc*) ;;
470 *)
471 new_CFLAGS=
472 for flag in $CFLAGS; do
473 case $flag in
474 -O*) ;;
475 *) new_CFLAGS="$new_CFLAGS $flag" ;;
476 esac
477 done
478 CFLAGS=$new_CFLAGS
479 new_CXXFLAGS=
480 for flag in $CXXFLAGS; do
481 case $flag in
482 -O*) ;;
483 *) new_CXXFLAGS="$new_CXXFLAGS $flag" ;;
484 esac
485 done
486 CXXFLAGS=$new_CXXFLAGS
487 ;;
488 esac
489 AC_SUBST(CFLAGS)
490 AC_SUBST(CXXFLAGS)
491 AC_SUBST(GDCFLAGS)
492
493 # Determine PICFLAG for target gnatlib.
494 GCC_PICFLAG_FOR_TARGET
495 AC_SUBST(PICFLAG_FOR_TARGET)
496
497 # -------------------------
498 # Check C compiler features
499 # -------------------------
500
501 AC_USE_SYSTEM_EXTENSIONS
502
503 AC_PROG_CPP
504 AC_C_INLINE
505
506 AC_SYS_LARGEFILE
507 AC_CHECK_SIZEOF(ino_t)
508 AC_CHECK_SIZEOF(dev_t)
509
510 # Select the right stat being able to handle 64bit inodes, if needed.
511 if test "$enable_largefile" != no; then
512 case "$host, $build" in
513 *-*-aix*,*|*,*-*-aix*)
514 if test "$ac_cv_sizeof_ino_t" = "4" -a "$ac_cv_sizeof_dev_t" = 4; then
515 AC_DEFINE(HOST_STAT_FOR_64BIT_INODES, stat64x,
516 [Define which stat syscall is able to handle 64bit indodes.])
517 fi;;
518 esac
519 fi
520
521
522 # sizeof(char) is 1 by definition.
523 AC_CHECK_SIZEOF(void *)
524 AC_CHECK_SIZEOF(short)
525 AC_CHECK_SIZEOF(int)
526 AC_CHECK_SIZEOF(long)
527 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
528 GCC_STDINT_TYPES
529 if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
530 AC_MSG_ERROR([uint64_t or int64_t not found])
531 fi
532
533 # check what underlying integer type int64_t uses
534 AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [
535 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
536 #ifdef HAVE_STDINT_H
537 #include <stdint.h>
538 #endif
539 template <typename T> struct X { };
540 template <>
541 struct X<long> { typedef long t; };
542 ]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])])
543 if test "$ac_cv_int64_t_type" = "long"; then
544 AC_DEFINE(INT64_T_IS_LONG, 1,
545 [Define if int64_t uses long as underlying type.])
546 else
547 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
548 #ifdef HAVE_STDINT_H
549 #include <stdint.h>
550 #endif
551 template <typename T> struct X { };
552 template <>
553 struct X<long long> { typedef long long t; };
554 ]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])])
555 fi
556
557 AC_CACHE_CHECK(for std::swap in <utility>, ac_cv_std_swap_in_utility, [
558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
559 #include <utility>
560 ]], [[int a, b; std::swap(a,b);]])],[ac_cv_std_swap_in_utility=yes],[ac_cv_std_swap_in_utility=no])])
561 if test $ac_cv_std_swap_in_utility = yes; then
562 AC_DEFINE(HAVE_SWAP_IN_UTILITY, 1,
563 [Define if <utility> defines std::swap.])
564 fi
565
566 # Check whether compiler is affected by placement new aliasing bug (PR 29286).
567 # If the host compiler is affected by the bug, and we build with optimization
568 # enabled (which happens e.g. when cross-compiling), the pool allocator may
569 # get miscompiled. Use -fno-strict-aliasing to work around this problem.
570 # Since there is no reliable feature check for the presence of this bug,
571 # we simply use a GCC version number check. (This should never trigger for
572 # stages 2 or 3 of a native bootstrap.)
573 aliasing_flags=
574 if test "$GCC" = yes; then
575 saved_CXXFLAGS="$CXXFLAGS"
576
577 # The following test compilation will succeed if and only if $CXX accepts
578 # -fno-strict-aliasing *and* is older than GCC 4.3.
579 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
580 AC_MSG_CHECKING([whether $CXX is affected by placement new aliasing bug])
581 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
582 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
583 #error compiler not affected by placement new aliasing bug
584 #endif
585 ])],
586 [AC_MSG_RESULT([yes]); aliasing_flags='-fno-strict-aliasing'],
587 [AC_MSG_RESULT([no])])
588
589 CXXFLAGS="$saved_CXXFLAGS"
590 fi
591 AC_SUBST(aliasing_flags)
592
593
594
595 # ---------------------
596 # Warnings and checking
597 # ---------------------
598
599 # Check $CC warning features (if it's GCC).
600 # We want to use -pedantic, but we don't want warnings about
601 # * 'long long'
602 # * variadic macros
603 # * overlong strings
604 # So, we only use -pedantic if we can disable those warnings.
605
606 # In stage 1, disable -Wformat warnings from old GCCs about new % codes
607 AC_ARG_ENABLE(build-format-warnings,
608 AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
609 [],[enable_build_format_warnings=yes])
610 AS_IF([test $enable_build_format_warnings = no],
611 [wf_opt=-Wno-format],[wf_opt=])
612 ACX_PROG_CXX_WARNING_OPTS(
613 m4_quote(m4_do([-W -Wall -Wno-error=narrowing -Wwrite-strings ],
614 [-Wcast-qual $wf_opt])),
615 [loose_warn])
616 ACX_PROG_CC_WARNING_OPTS(
617 m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ],
618 [])), [c_loose_warn])
619 ACX_PROG_CXX_WARNING_OPTS(
620 m4_quote(m4_do([-Wmissing-format-attribute ], [-Wconditionally-supported ],
621 [-Woverloaded-virtual])), [strict_warn])
622 ACX_PROG_CC_WARNING_OPTS(
623 m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
624 ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(
625 m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
626 [-Wno-overlength-strings])), [strict_warn])
627 ACX_PROG_CXX_WARNINGS_ARE_ERRORS([manual], [strict_warn])
628
629 # The above macros do nothing if the compiler is not GCC. However, the
630 # Makefile has more goo to add other flags, so these variables are used
631 # to enable warnings only for GCC.
632 warn_cflags=
633 warn_cxxflags=
634 if test "x$GCC" = "xyes"; then
635 warn_cflags='$(GCC_WARN_CFLAGS)'
636 warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
637 fi
638 AC_SUBST(warn_cflags)
639 AC_SUBST(warn_cxxflags)
640
641 # Disable exceptions and RTTI if building with g++
642 ACX_PROG_CC_WARNING_OPTS(
643 m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])),
644 [noexception_flags])
645
646 # Enable expensive internal checks
647 is_release=
648 if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
649 is_release=yes
650 fi
651
652 AC_ARG_ENABLE(checking,
653 [AS_HELP_STRING([[--enable-checking[=LIST]]],
654 [enable expensive run-time checks. With LIST,
655 enable only specific categories of checks.
656 Categories are: yes,no,all,none,release.
657 Flags are: assert,df,extra,fold,gc,gcac,gimple,misc,
658 rtlflag,rtl,runtime,tree,valgrind,types])],
659 [ac_checking_flags="${enableval}"],[
660 # Determine the default checks.
661 if test x$is_release = x ; then
662 ac_checking_flags=yes,extra
663 else
664 ac_checking_flags=release
665 fi])
666 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
667 for check in release $ac_checking_flags
668 do
669 case $check in
670 # these set all the flags to specific states
671 yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
672 ac_fold_checking= ; ac_gc_checking=1 ; ac_extra_checking= ;
673 ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
674 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
675 ac_tree_checking=1 ; ac_valgrind_checking= ;
676 ac_types_checking=1 ;;
677 no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
678 ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
679 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
680 ac_rtlflag_checking= ; ac_runtime_checking= ;
681 ac_tree_checking= ; ac_valgrind_checking= ;
682 ac_types_checking= ;;
683 all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
684 ac_fold_checking=1 ; ac_gc_checking=1 ; ac_extra_checking=1 ;
685 ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
686 ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
687 ac_tree_checking=1 ; ac_valgrind_checking= ;
688 ac_types_checking=1 ;;
689 release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
690 ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
691 ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
692 ac_rtlflag_checking= ; ac_runtime_checking=1 ;
693 ac_tree_checking= ; ac_valgrind_checking= ;
694 ac_types_checking= ;;
695 # these enable particular checks
696 assert) ac_assert_checking=1 ;;
697 df) ac_df_checking=1 ;;
698 extra) ac_extra_checking=1 ;;
699 fold) ac_fold_checking=1 ;;
700 gc) ac_gc_checking=1 ;;
701 gcac) ac_gc_always_collect=1 ;;
702 gimple) ac_gimple_checking=1 ;;
703 misc) ac_checking=1 ;;
704 rtl) ac_rtl_checking=1 ;;
705 rtlflag) ac_rtlflag_checking=1 ;;
706 runtime) ac_runtime_checking=1 ;;
707 tree) ac_tree_checking=1 ;;
708 types) ac_types_checking=1 ;;
709 valgrind) ac_valgrind_checking=1 ;;
710 *) AC_MSG_ERROR(unknown check category $check) ;;
711 esac
712 done
713 IFS="$ac_save_IFS"
714
715 if test x$ac_checking != x ; then
716 AC_DEFINE(CHECKING_P, 1,
717 [Define to 0/1 if you want more run-time sanity checks. This one gets a grab
718 bag of miscellaneous but relatively cheap checks.])
719 else
720 AC_DEFINE(CHECKING_P, 0)
721 fi
722 if test x$ac_extra_checking != x ; then
723 AC_DEFINE(ENABLE_EXTRA_CHECKING, 1,
724 [Define to 0/1 if you want extra run-time checking that might affect code
725 generation.])
726 else
727 AC_DEFINE(ENABLE_EXTRA_CHECKING, 0)
728 fi
729 if test x$ac_df_checking != x ; then
730 AC_DEFINE(ENABLE_DF_CHECKING, 1,
731 [Define if you want more run-time sanity checks for dataflow.])
732 fi
733 if test x$ac_assert_checking != x ; then
734 AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
735 [Define if you want assertions enabled. This is a cheap check.])
736 fi
737 if test x$ac_gimple_checking != x ; then
738 AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1,
739 [Define if you want operations on GIMPLE (the basic data structure of
740 the high-level optimizers) to be checked for dynamic type safety at
741 runtime. This is moderately expensive.])
742 fi
743 GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
744 if test x$ac_runtime_checking != x ; then
745 AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
746 [Define if you want runtime assertions enabled. This is a cheap check.])
747 fi
748 if test x$ac_tree_checking != x ; then
749 AC_DEFINE(ENABLE_TREE_CHECKING, 1,
750 [Define if you want all operations on trees (the basic data
751 structure of the front ends) to be checked for dynamic type safety
752 at runtime. This is moderately expensive.
753 ])
754 TREECHECKING=yes
755 fi
756 if test x$ac_types_checking != x ; then
757 AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
758 [Define if you want all gimple types to be verified after gimplifiation.
759 This is cheap.
760 ])
761 fi
762 AC_SUBST(TREECHECKING)
763 if test x$ac_rtl_checking != x ; then
764 AC_DEFINE(ENABLE_RTL_CHECKING, 1,
765 [Define if you want all operations on RTL (the basic data structure
766 of the optimizer and back end) to be checked for dynamic type safety
767 at runtime. This is quite expensive.])
768 fi
769 if test x$ac_rtlflag_checking != x ; then
770 AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
771 [Define if you want RTL flag accesses to be checked against the RTL
772 codes that are supported for each access macro. This is relatively
773 cheap.])
774 fi
775 if test x$ac_gc_checking != x ; then
776 AC_DEFINE(ENABLE_GC_CHECKING, 1,
777 [Define if you want the garbage collector to do object poisoning and
778 other memory allocation checks. This is quite expensive.])
779 fi
780 if test x$ac_gc_always_collect != x ; then
781 AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
782 [Define if you want the garbage collector to operate in maximally
783 paranoid mode, validating the entire heap and collecting garbage at
784 every opportunity. This is extremely expensive.])
785 fi
786 if test x$ac_fold_checking != x ; then
787 AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
788 [Define if you want fold checked that it never destructs its argument.
789 This is quite expensive.])
790 fi
791 valgrind_path_defines=
792 valgrind_command=
793 if test x$ac_valgrind_checking != x ; then
794 AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
795 [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
796 if test "x$valgrind_path" = "x"; then
797 AC_MSG_ERROR([*** Cannot find valgrind])
798 fi
799 valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
800 valgrind_command="$valgrind_path -q"
801 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
802 [Define if you want to run subprograms and generated programs
803 through valgrind (a memory checker). This is extremely expensive.])
804 fi
805 AC_SUBST(valgrind_path_defines)
806 AC_SUBST(valgrind_command)
807
808 # Enable code coverage collection
809 AC_ARG_ENABLE(coverage,
810 [AS_HELP_STRING([[--enable-coverage[=LEVEL]]],
811 [enable compiler's code coverage collection.
812 Use to measure compiler performance and locate
813 unused parts of the compiler. With LEVEL, specify
814 optimization. Values are opt, noopt,
815 default is noopt])],
816 [case "${enableval}" in
817 yes|noopt)
818 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-static-functions"
819 ;;
820 opt)
821 coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-static-functions"
822 ;;
823 no)
824 # a.k.a. --disable-coverage
825 coverage_flags=""
826 ;;
827 *)
828 AC_MSG_ERROR(unknown coverage setting $enableval)
829 ;;
830 esac],
831 [coverage_flags=""])
832 AC_SUBST(coverage_flags)
833
834 AC_ARG_ENABLE(gather-detailed-mem-stats,
835 [AS_HELP_STRING([--enable-gather-detailed-mem-stats],
836 [enable detailed memory allocation stats gathering])], [],
837 [enable_gather_detailed_mem_stats=no])
838 gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi`
839 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
840 [Define to enable detailed memory allocation stats gathering.])
841
842 AC_ARG_ENABLE(valgrind-annotations,
843 [AS_HELP_STRING([--enable-valgrind-annotations],
844 [enable valgrind runtime interaction])], [],
845 [enable_valgrind_annotations=no])
846 AC_CHECK_HEADER(valgrind/memcheck.h)
847 if test x$enable_valgrind_annotations != xno \
848 || test x$ac_valgrind_checking != x; then
849 if test $ac_cv_header_valgrind_memcheck_h = no; then
850 AC_MSG_ERROR([*** Cannot find valgrind/memcheck.h])
851 fi
852 AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
853 [Define to get calls to the valgrind runtime enabled.])
854 fi
855
856 # -------------------------------
857 # Miscenalleous configure options
858 # -------------------------------
859
860 # Determine whether or not multilibs are enabled.
861 AC_ARG_ENABLE(multilib,
862 [AS_HELP_STRING([--enable-multilib],
863 [enable library support for multiple ABIs])],
864 [], [enable_multilib=yes])
865 AC_SUBST(enable_multilib)
866
867 # Determine whether or not -Os multilibs are enabled.
868 AC_ARG_ENABLE(multilib-space,
869 [AS_HELP_STRING([--enable-multilib-space=yes,no,except],
870 [enable extra -Os variant for every multilib ABI])],
871 [case "$enableval" in
872 yes|no|except) ;;
873 *) AC_MSG_ERROR([bad value $enableval for multilib-space option]) ;;
874 esac],
875 [enable_multilib_space=no])
876 if test x$enable_multilib_space != xno; then
877 AC_DEFINE(ENABLE_MULTILIB_SPACE, 1, [If --enable-multilib-space is used])
878 fi
879
880 # Determine whether or not multiarch is enabled.
881 AC_ARG_ENABLE(multiarch,
882 [AS_HELP_STRING([--enable-multiarch],
883 [enable support for multiarch paths])],
884 [case "${enableval}" in
885 yes|no|auto) enable_multiarch=$enableval;;
886 *) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;;
887 esac], [enable_multiarch=auto])
888 if test x${enable_multiarch} = xauto; then
889 if test x${with_native_system_header_dir} != x; then
890 ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)"
891 enable_multiarch=no
892 fi
893 if test x$host != x$target && test "x$with_sysroot" = x; then
894 ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
895 enable_multiarch=no
896 fi
897 fi
898 if test x${enable_multiarch} = xyes; then
899 AC_DEFINE(ENABLE_MULTIARCH, 1, [If --with-multiarch option is used])
900 fi
901 AC_MSG_CHECKING(for multiarch configuration)
902 AC_SUBST(enable_multiarch)
903 AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
904
905 # needed for setting the multiarch name for soft-float/hard-float ABIs
906 AC_SUBST(with_cpu)
907 AC_SUBST(with_float)
908
909 # default stack clash protection guard size as power of twos in bytes.
910 # Please keep these in sync with params.def.
911 stk_clash_min=12
912 stk_clash_max=30
913
914 # Keep the default value when the option is not used to 0, this allows us to
915 # distinguish between the cases where the user specifially set a value via
916 # configure and when the normal default value is used.
917 AC_ARG_WITH(stack-clash-protection-guard-size,
918 [AS_HELP_STRING([--with-stack-clash-protection-guard-size=size],
919 [Set the default stack clash protection guard size for specific targets as a power of two in bytes.])],
920 [DEFAULT_STK_CLASH_GUARD_SIZE="$with_stack_clash_protection_guard_size"], [DEFAULT_STK_CLASH_GUARD_SIZE=0])
921 if test $DEFAULT_STK_CLASH_GUARD_SIZE -ne 0 \
922 && (test $DEFAULT_STK_CLASH_GUARD_SIZE -lt $stk_clash_min \
923 || test $DEFAULT_STK_CLASH_GUARD_SIZE -gt $stk_clash_max); then
924 AC_MSG_ERROR(m4_normalize([
925 Invalid value $DEFAULT_STK_CLASH_GUARD_SIZE for --with-stack-clash-protection-guard-size. \
926 Must be between $stk_clash_min and $stk_clash_max.]))
927 fi
928
929 AC_DEFINE_UNQUOTED(DEFAULT_STK_CLASH_GUARD_SIZE, $DEFAULT_STK_CLASH_GUARD_SIZE,
930 [Define to larger than zero set the default stack clash protector size.])
931
932 # Specify the number of splits of match.pd to generate.
933 AC_ARG_WITH(matchpd-partitions,
934 [AS_HELP_STRING([--with-matchpd-partitions=num],
935 [Set the number of partitions to make for gimple and generic when splitting match.pd. [default=10]])],
936 [DEFAULT_MATCHPD_PARTITIONS="$with_matchpd_partitions"], [DEFAULT_MATCHPD_PARTITIONS=10])
937 if (test $DEFAULT_MATCHPD_PARTITIONS -lt 1); then
938 AC_MSG_ERROR(m4_normalize([
939 Invalid value $DEFAULT_MATCHPD_PARTITIONS for --with-matchpd-partitions. \
940 Cannot be negative.]))
941 fi
942
943 AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
944
945 # Specify the number of splits of insn-emit.cc and insn-recog.cc to generate.
946 AC_ARG_WITH(insnemit-partitions,
947 [AS_HELP_STRING([--with-insnemit-partitions=num],
948 [Set the number of partitions of insn-emit.cc for genemit and genrecog to create. [default=10]])],
949 [DEFAULT_INSNEMIT_PARTITIONS="$with_insnemit_partitions"], [DEFAULT_INSNEMIT_PARTITIONS=10])
950 if (test $DEFAULT_INSNEMIT_PARTITIONS -lt 1); then
951 AC_MSG_ERROR(m4_normalize([
952 Invalid value $DEFAULT_INSNEMIT_PARTITIONS for --with-insnemit-partitions. \
953 Cannot be negative.]))
954 fi
955
956 AC_SUBST(DEFAULT_INSNEMIT_PARTITIONS)
957
958 # Enable __cxa_atexit for C++.
959 AC_ARG_ENABLE(__cxa_atexit,
960 [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
961 [], [])
962
963 # Enable C extension for decimal float if target supports it.
964 GCC_AC_ENABLE_DECIMAL_FLOAT([$target])
965
966 dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi`
967 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
968 [Define to 1 to enable decimal float extension to C.])
969
970 # Use default_decimal_float for dependency.
971 enable_decimal_float=$default_decimal_float
972
973 bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi`
974 AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
975 [Define to 1 to specify that we are using the BID decimal floating
976 point format instead of DPD])
977
978 # Enable C extension for fixed-point arithmetic.
979 AC_ARG_ENABLE(fixed-point,
980 [AS_HELP_STRING([--enable-fixed-point],
981 [enable fixed-point arithmetic extension to C])],
982 [],
983 [
984 case $target in
985 arm*)
986 enable_fixed_point=yes
987 ;;
988
989 mips*-*-*)
990 enable_fixed_point=yes
991 ;;
992 loongarch*-*-*)
993 enable_fixed_point=yes
994 ;;
995 *)
996 AC_MSG_WARN([fixed-point is not supported for this target, ignored])
997 enable_fixed_point=no
998 ;;
999 esac
1000 ])
1001 AC_SUBST(enable_fixed_point)
1002
1003 fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
1004 AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
1005 [Define to 1 to enable fixed-point arithmetic extension to C.])
1006
1007 # Enable threads
1008 # Pass with no value to take the default
1009 # Pass with a value to specify a thread package
1010 AC_ARG_ENABLE(threads,
1011 [AS_HELP_STRING([[--enable-threads[=LIB]]],
1012 [enable thread usage for target GCC,
1013 using LIB thread package])],,
1014 [enable_threads=''])
1015
1016 AC_ARG_ENABLE(tls,
1017 [AS_HELP_STRING([--enable-tls],
1018 [enable or disable generation of tls code
1019 overriding the assembler check for tls support])],
1020 [
1021 case $enable_tls in
1022 yes | no) ;;
1023 *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
1024 Valid choices are 'yes' and 'no'.]) ;;
1025 esac
1026 ], [enable_tls=''])
1027
1028 AC_ARG_ENABLE(vtable-verify,
1029 [AS_HELP_STRING([--enable-vtable-verify],
1030 [enable vtable verification feature])],,
1031 [enable_vtable_verify=no])
1032 vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi`
1033 AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
1034 [Define 0/1 if vtable verification feature is enabled.])
1035
1036 AC_ARG_ENABLE(analyzer,
1037 [AS_HELP_STRING([--disable-analyzer],
1038 [disable -fanalyzer static analyzer])],
1039 if test x$enable_analyzer = xno; then
1040 analyzer=0
1041 else
1042 analyzer=1
1043 fi,
1044 analyzer=1)
1045 AC_DEFINE_UNQUOTED(ENABLE_ANALYZER, $analyzer,
1046 [Define 0/1 if static analyzer feature is enabled.])
1047
1048 AC_ARG_ENABLE(objc-gc,
1049 [AS_HELP_STRING([--enable-objc-gc],
1050 [enable the use of Boehm's garbage collector with
1051 the GNU Objective-C runtime])],
1052 if test x$enable_objc_gc = xno; then
1053 objc_boehm_gc=''
1054 else
1055 objc_boehm_gc=1
1056 fi,
1057 objc_boehm_gc='')
1058
1059 AC_ARG_WITH(dwarf2,
1060 [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2 (or later)])],
1061 dwarf2="$with_dwarf2",
1062 dwarf2=no)
1063
1064 AC_ARG_ENABLE(shared,
1065 [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])],
1066 [
1067 case $enable_shared in
1068 yes | no) ;;
1069 *)
1070 enable_shared=no
1071 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1072 for pkg in $enableval; do
1073 if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
1074 enable_shared=yes
1075 fi
1076 done
1077 IFS="$ac_save_ifs"
1078 ;;
1079 esac
1080 ], [enable_shared=yes])
1081 AC_SUBST(enable_shared)
1082
1083 AC_ARG_ENABLE(gcov,
1084 [ --disable-gcov don't provide libgcov and related host tools],
1085 [], [case $target in
1086 bpf-*-*)
1087 enable_gcov=no
1088 ;;
1089 *)
1090 enable_gcov=yes
1091 ;;
1092 esac])
1093
1094 AC_SUBST(enable_gcov)
1095
1096 AC_ARG_WITH(specs,
1097 [AS_HELP_STRING([--with-specs=SPECS],
1098 [add SPECS to driver command-line processing])],
1099 [CONFIGURE_SPECS=$withval],
1100 [CONFIGURE_SPECS=]
1101 )
1102 AC_SUBST(CONFIGURE_SPECS)
1103
1104 ACX_PKGVERSION([GCC])
1105 ACX_BUGURL([https://gcc.gnu.org/bugs/])
1106
1107 # Allow overriding the default URL for documentation
1108 AC_ARG_WITH(documentation-root-url,
1109 AS_HELP_STRING([--with-documentation-root-url=URL],
1110 [Root for documentation URLs]),
1111 [case "$withval" in
1112 yes) AC_MSG_ERROR([documentation root URL not specified]) ;;
1113 no) AC_MSG_ERROR([documentation root URL not specified]) ;;
1114 */) DOCUMENTATION_ROOT_URL="$withval" ;;
1115 *) AC_MSG_ERROR([documentation root URL does not end with /]) ;;
1116 esac],[
1117 docroot_url_suffix=
1118 changequote(,)dnl
1119 case "$gcc_version" in
1120 *.[123456].0) docroot_url_suffix="gcc-$gcc_version/";;
1121 *.[123456].1) docroot_url_suffix="gcc-`echo $gcc_version | sed 's/1$/0/'`/";;
1122 esac
1123 changequote([,])dnl
1124 DOCUMENTATION_ROOT_URL="https://gcc.gnu.org/onlinedocs/$docroot_url_suffix"
1125 ])
1126 AC_DEFINE_UNQUOTED(DOCUMENTATION_ROOT_URL,"$DOCUMENTATION_ROOT_URL",
1127 [Define to the root for documentation URLs.])
1128
1129 # Allow overriding the default URL for GCC changes
1130 AC_ARG_WITH(changes-root-url,
1131 AS_HELP_STRING([--with-changes-root-url=URL],
1132 [Root for GCC changes URLs]),
1133 [case "$withval" in
1134 yes) AC_MSG_ERROR([changes root URL not specified]) ;;
1135 no) AC_MSG_ERROR([changes root URL not specified]) ;;
1136 */) CHANGES_ROOT_URL="$withval" ;;
1137 *) AC_MSG_ERROR([changes root URL does not end with /]) ;;
1138 esac],
1139 CHANGES_ROOT_URL="https://gcc.gnu.org/"
1140 )
1141 AC_DEFINE_UNQUOTED(CHANGES_ROOT_URL,"$CHANGES_ROOT_URL",
1142 [Define to the root for URLs about GCC changes.])
1143
1144 # Sanity check enable_languages in case someone does not run the toplevel
1145 # configure # script.
1146 AC_ARG_ENABLE(languages,
1147 [AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])],
1148 [case ,${enable_languages}, in
1149 ,,|,yes,)
1150 # go safe -- we cannot be much sure without the toplevel
1151 # configure's
1152 # analysis of which target libs are present and usable
1153 enable_languages=c
1154 ;;
1155 *,all,*)
1156 AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
1157 ;;
1158 *,c,*)
1159 ;;
1160 *)
1161 enable_languages=c,${enable_languages}
1162 ;;
1163 esac],
1164 [enable_languages=c])
1165
1166 # If top-level libada has been disabled, then wire in install-gnatlib
1167 # invocation with `make install', so that one can build and install
1168 # the library manually with `make -C gcc all gnatlib gnattools install'.
1169 if test x"$enable_libada" = xno; then
1170 gnat_install_lib=gnat-install-lib
1171 else
1172 gnat_install_lib=
1173 fi
1174 AC_SUBST(gnat_install_lib)
1175
1176 if test x"$enable_as_accelerator_for" != x; then
1177 AC_DEFINE(ACCEL_COMPILER, 1,
1178 [Define if this compiler should be built as the offload target compiler.])
1179 enable_as_accelerator=yes
1180 sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
1181 program_transform_name=`echo $program_transform_name | sed $sedscript`
1182 accel_dir_suffix=/accel/${target_noncanonical}
1183 real_target_noncanonical=${enable_as_accelerator_for}
1184 fi
1185 AC_SUBST(enable_as_accelerator)
1186 AC_SUBST(real_target_noncanonical)
1187 AC_SUBST(accel_dir_suffix)
1188
1189 for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
1190 tgt=`echo $tgt | sed 's/=.*//'`
1191
1192 enable_offloading=1
1193 case "$tgt" in
1194 amdgcn*)
1195 omp_device_property=omp-device-properties-gcn
1196 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device"
1197 ;;
1198 nvptx*)
1199 omp_device_property=omp-device-properties-nvptx
1200 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device"
1201 ;;
1202 *)
1203 AC_MSG_ERROR([unknown offload target specified])
1204 ;;
1205 esac
1206 omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}"
1207 omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}"
1208
1209 if test x"$offload_targets" = x; then
1210 offload_targets=$tgt
1211 else
1212 offload_targets="$offload_targets,$tgt"
1213 fi
1214 done
1215 AC_SUBST(omp_device_properties)
1216 AC_SUBST(omp_device_property_deps)
1217
1218 AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
1219 [Define to offload targets, separated by commas.])
1220 if test x"$enable_offloading" != x; then
1221 AC_DEFINE(ENABLE_OFFLOADING, 1,
1222 [Define this to enable support for offloading.])
1223 else
1224 AC_DEFINE(ENABLE_OFFLOADING, 0,
1225 [Define this to enable support for offloading.])
1226 fi
1227
1228 if test "x$enable_offload_defaulted" = xyes; then
1229 AC_DEFINE(OFFLOAD_DEFAULTED, 1,
1230 [Define to 1 to if -foffload is defaulted])
1231 fi
1232
1233 AC_ARG_WITH(multilib-list,
1234 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, ARM, AVR, nvptx, OR1K, RISC-V, SH and x86-64 only)])],
1235 :,
1236 with_multilib_list=default)
1237
1238 AC_ARG_WITH(multilib-generator,
1239 [AS_HELP_STRING([--with-multilib-generator], [Multi-libs configuration string (RISC-V only)])],
1240 :,
1241 with_multilib_generator=default)
1242
1243 AC_ARG_WITH(picolibc,
1244 [AS_HELP_STRING([--with-picolibc], [Support for picolibc, including command line options and spec rules])])
1245
1246 # -------------------------
1247 # Checks for other programs
1248 # -------------------------
1249
1250 AC_PROG_MAKE_SET
1251
1252 # Find some useful tools
1253 AC_PROG_AWK
1254 # We need awk to create options.cc and options.h.
1255 # Bail out if it's missing.
1256 case ${AWK} in
1257 "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
1258 esac
1259
1260 gcc_AC_PROG_LN_S
1261 ACX_PROG_LN($LN_S)
1262 AC_PROG_RANLIB
1263 ranlib_flags=""
1264 AC_SUBST(ranlib_flags)
1265
1266 gcc_AC_PROG_INSTALL
1267
1268 # See if cmp has --ignore-initial.
1269 gcc_AC_PROG_CMP_IGNORE_INITIAL
1270
1271 # See if we have the mktemp command.
1272 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
1273
1274 # See if makeinfo has been installed and is modern enough
1275 # that we can use it.
1276 ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1277 [GNU texinfo.* \([0-9][0-9.]*\)],
1278 [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
1279 if test $gcc_cv_prog_makeinfo_modern = no; then
1280 AC_MSG_WARN([
1281 *** Makeinfo is missing or too old.
1282 *** Info documentation will not be built.])
1283 BUILD_INFO=no-info
1284 else
1285 BUILD_INFO=info
1286 fi
1287 AC_SUBST(BUILD_INFO)
1288
1289 # Determine whether makeinfo supports the CONTENTS_OUTPUT_LOCATION variable.
1290 # If it does, we want to pass it to makeinfo in order to restore the old
1291 # behavior of @{summary,}contents placement.
1292 MAKEINFO_TOC_INLINE_FLAG=
1293 AS_IF([test x"$MAKEINFO" != x], [
1294 AC_CACHE_CHECK([for CONTENTS_OUTPUT_LOCATION support in $MAKEINFO],
1295 [gcc_cv_texi_add_toc_inline_flags], [
1296 # Detect the unknown variable CONTENTS_OUTPUT_LOCATION warning
1297 if "$MAKEINFO" -c CONTENTS_OUTPUT_LOCATION=inline </dev/null 2>&1 \
1298 | grep CONTENTS_OUTPUT_LOCATION >/dev/null; then
1299 gcc_cv_texi_add_toc_inline_flags=no
1300 else
1301 gcc_cv_texi_add_toc_inline_flags=yes
1302 fi
1303 ])
1304 if test x"$gcc_cv_texi_add_toc_inline_flags" = xyes; then
1305 MAKEINFO_TOC_INLINE_FLAG='-c CONTENTS_OUTPUT_LOCATION=inline'
1306 fi
1307 ])
1308 AC_SUBST([MAKEINFO_TOC_INLINE_FLAG])
1309
1310 # Is pod2man recent enough to regenerate manpages?
1311 AC_MSG_CHECKING([for recent Pod::Man])
1312 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
1313 AC_MSG_RESULT(yes)
1314 GENERATED_MANPAGES=generated-manpages
1315 else
1316 AC_MSG_RESULT(no)
1317 GENERATED_MANPAGES=
1318 fi
1319 AC_SUBST(GENERATED_MANPAGES)
1320
1321 MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing"
1322
1323 # How about lex?
1324 dnl Don't use AC_PROG_LEX; we insist on flex.
1325 dnl LEXLIB is not useful in gcc.
1326 AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
1327
1328 # Bison?
1329 AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
1330
1331 # Python3?
1332 ACX_CHECK_PROG_VER(PYTHON, python3, --version,
1333 [Python.* \([0-9][0-9.]*\)],
1334 [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*])
1335 if test $gcc_cv_prog_python3_modern = no; then
1336 AC_MSG_WARN([
1337 *** Python3 is missing.
1338 *** Documentation for modula-2 will not include the target SYSTEM module.])
1339 HAVE_PYTHON=no
1340 else
1341 HAVE_PYTHON=yes
1342 fi
1343 AC_SUBST(HAVE_PYTHON)
1344
1345 # Binutils are not build modules, unlike bison/flex/makeinfo. So we
1346 # check for build == host before using them.
1347
1348 # NM
1349 if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
1350 && test -d ../binutils ; then
1351 NM='../binutils/nm-new'
1352 else
1353 AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
1354 fi
1355
1356 # AR
1357 if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
1358 && test -d ../binutils ; then
1359 AR='../binutils/ar'
1360 else
1361 AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
1362 fi
1363
1364 # The jit documentation looks better if built with sphinx, but can be
1365 # built with texinfo if sphinx is not available.
1366 # Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
1367 AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo)
1368
1369 # --------------------
1370 # Checks for C headers
1371 # --------------------
1372
1373 # Need to reject headers which give warnings, so that the -Werror bootstrap
1374 # works later. *sigh* This needs to come before all header checks.
1375 AC_PROG_CPP_WERROR
1376
1377 AC_HEADER_STDC
1378 AC_HEADER_TIME
1379 ACX_HEADER_STRING
1380 AC_HEADER_SYS_WAIT
1381 AC_HEADER_TIOCGWINSZ
1382 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
1383 fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \
1384 sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \
1385 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h)
1386
1387 # Check for thread headers.
1388 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
1389 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1390
1391 # These tests can't be done till we know if we have limits.h.
1392 gcc_AC_C_CHAR_BIT
1393 AC_C_BIGENDIAN
1394
1395 # ----------------------
1396 # Checks for C++ headers
1397 # ----------------------
1398
1399 dnl Autoconf will give an error in the configure script if there is no
1400 dnl C++ preprocessor. Hack to prevent that.
1401 m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl
1402 AC_PROG_CXXCPP
1403 m4_popdef([AC_MSG_ERROR])[]dnl
1404
1405 AC_CHECK_HEADERS(unordered_map)
1406 AC_CHECK_HEADERS(tr1/unordered_map)
1407 AC_CHECK_HEADERS(ext/hash_map)
1408
1409 # --------
1410 # Dependency checking.
1411 # --------
1412
1413 ZW_CREATE_DEPDIR
1414 AC_CONFIG_COMMANDS([gccdepdir],[
1415 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
1416 for lang in $subdirs c-family common analyzer text-art rtl-ssa sym-exec
1417 do
1418 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
1419 done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
1420
1421 ZW_PROG_COMPILER_DEPENDENCIES([CXX])
1422
1423 # --------
1424 # UNSORTED
1425 # --------
1426
1427
1428 # These libraries may be used by collect2.
1429 # We may need a special search path to get them linked.
1430 AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
1431 [save_LIBS="$LIBS"
1432 for libs in '' -lld -lmld \
1433 '-L/usr/lib/cmplrs/cc2.11 -lmld' \
1434 '-L/usr/lib/cmplrs/cc3.11 -lmld'
1435 do
1436 LIBS="$libs"
1437 AC_TRY_LINK_FUNC(ldopen,
1438 [gcc_cv_collect2_libs="$libs"; break])
1439 done
1440 LIBS="$save_LIBS"
1441 test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
1442 case $gcc_cv_collect2_libs in
1443 "none required") ;;
1444 *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
1445 esac
1446 AC_SUBST(COLLECT2_LIBS)
1447
1448 # When building Ada code on Alpha, we need exc_resume which is usually in
1449 # -lexc. So test for it.
1450 save_LIBS="$LIBS"
1451 LIBS=
1452 AC_SEARCH_LIBS(exc_resume, exc)
1453 GNAT_LIBEXC="$LIBS"
1454 LIBS="$save_LIBS"
1455 AC_SUBST(GNAT_LIBEXC)
1456
1457 # To support -mcpu=native on Solaris/SPARC, we need libkstat.
1458 save_LIBS="$LIBS"
1459 LIBS=
1460 AC_SEARCH_LIBS(kstat_open, kstat)
1461 EXTRA_GCC_LIBS="$LIBS"
1462 LIBS="$save_LIBS"
1463 AC_SUBST(EXTRA_GCC_LIBS)
1464
1465 # Some systems put ldexp and frexp in libm instead of libc; assume
1466 # they're both in the same place. jcf-dump needs them.
1467 save_LIBS="$LIBS"
1468 LIBS=
1469 AC_SEARCH_LIBS(ldexp, m)
1470 LDEXP_LIB="$LIBS"
1471 LIBS="$save_LIBS"
1472 AC_SUBST(LDEXP_LIB)
1473
1474 # Some systems need dlopen
1475 save_LIBS="$LIBS"
1476 LIBS=
1477 AC_SEARCH_LIBS(dlopen, dl)
1478 DL_LIB="$LIBS"
1479 LIBS="$save_LIBS"
1480 AC_SUBST(DL_LIB)
1481
1482 # Use <inttypes.h> only if it exists,
1483 # doesn't clash with <sys/types.h>, declares intmax_t and defines
1484 # PRId64
1485 AC_MSG_CHECKING(for inttypes.h)
1486 AC_CACHE_VAL(gcc_cv_header_inttypes_h,
1487 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1488 [[#define __STDC_FORMAT_MACROS
1489 #include <sys/types.h>
1490 #include <inttypes.h>]],
1491 [[intmax_t i = -1;
1492 #ifndef PRId64
1493 choke me
1494 #endif]])],
1495 [gcc_cv_header_inttypes_h=yes],
1496 [gcc_cv_header_inttypes_h=no])])
1497 AC_MSG_RESULT($gcc_cv_header_inttypes_h)
1498 if test $gcc_cv_header_inttypes_h = yes; then
1499 AC_DEFINE(HAVE_INTTYPES_H, 1,
1500 [Define if you have a working <inttypes.h> header file.])
1501 fi
1502
1503 # Look for the ZSTD package.
1504 ZSTD_INCLUDE=
1505 ZSTD_LIB=
1506 AC_SUBST(ZSTD_INCLUDE)
1507 AC_SUBST(ZSTD_LIB)
1508 ZSTD_CPPFLAGS=
1509 ZSTD_LDFLAGS=
1510 AC_SUBST(ZSTD_CPPFLAGS)
1511 AC_SUBST(ZSTD_LDFLAGS)
1512 AC_ARG_WITH(zstd,
1513 [AS_HELP_STRING([--with-zstd=PATH],
1514 [specify prefix directory for installed zstd library.
1515 Equivalent to --with-zstd-include=PATH/include
1516 plus --with-zstd-lib=PATH/lib])])
1517 AC_ARG_WITH(zstd-include,
1518 [AS_HELP_STRING([--with-zstd-include=PATH],
1519 [specify directory for installed zstd include files])])
1520 AC_ARG_WITH(zstd-lib,
1521 [AS_HELP_STRING([--with-zstd-lib=PATH],
1522 [specify directory for the installed zstd library])])
1523 case "x$with_zstd" in
1524 x) ;;
1525 xno)
1526 ZSTD_INCLUDE=
1527 ZSTD_LIB=
1528 ;;
1529 *) ZSTD_INCLUDE=$with_zstd/include
1530 ZSTD_LIB=$with_zstd/lib
1531 ;;
1532 esac
1533
1534 if test "x$with_zstd" != xno; then
1535 if test "x$with_zstd_include" != x; then
1536 ZSTD_INCLUDE=$with_zstd_include
1537 fi
1538 if test "x$with_zstd_lib" != x; then
1539 ZSTD_LIB=$with_zstd_lib
1540 fi
1541 if test "x$ZSTD_INCLUDE" != x \
1542 && test "x$ZSTD_INCLUDE" != xno; then
1543 ZSTD_CPPFLAGS=-I$ZSTD_INCLUDE
1544 fi
1545 if test "x$ZSTD_LIB" != x \
1546 && test "x$ZSTD_LIB" != xno; then
1547 ZSTD_LDFLAGS=-L$ZSTD_LIB
1548 fi
1549
1550 CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
1551 LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
1552
1553 # LTO can use zstd compression algorithm
1554 save_LIBS="$LIBS"
1555 LIBS=
1556 AC_SEARCH_LIBS(ZSTD_compress, zstd,, gcc_cv_header_zstd_h=no)
1557 ZSTD_LIB="$LIBS"
1558 LIBS="$save_LIBS"
1559 AC_SUBST(ZSTD_LIB)
1560
1561 AC_MSG_CHECKING(for zstd.h)
1562 AC_CACHE_VAL(gcc_cv_header_zstd_h,
1563 # We require version 1.3.0 or later. This is the first version that has
1564 # ZSTD_getFrameContentSize.
1565 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1566 [[#include <zstd.h>
1567 #if ZSTD_VERSION_NUMBER < 10300
1568 #error "need zstd 1.3.0 or better"
1569 #endif]])],
1570 [gcc_cv_header_zstd_h=yes],
1571 [gcc_cv_header_zstd_h=no])])
1572 AC_MSG_RESULT($gcc_cv_header_zstd_h)
1573 if test $gcc_cv_header_zstd_h = yes; then
1574 AC_DEFINE(HAVE_ZSTD_H, 1,
1575 [Define if you have a working <zstd.h> header file.])
1576 elif test "x$with_zstd" != x; then
1577 as_fn_error $? "Unable to find zstd.h. See config.log for details." "$LINENO" 5
1578 fi
1579 fi
1580
1581 dnl Disabled until we have a complete test for buggy enum bitfields.
1582 dnl gcc_AC_C_ENUM_BF_UNSIGNED
1583
1584 define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1585 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1586 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1587 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1588 putchar_unlocked putc_unlocked)
1589 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
1590 popen sysconf strsignal getrusage nl_langinfo \
1591 gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
1592 gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval \
1593 clock_gettime munmap msync get_current_dir_name memrchr)
1594
1595 # At least for glibc, clock_gettime is in librt. But don't pull that
1596 # in if it still doesn't give us the function we want.
1597 if test $ac_cv_func_clock_gettime = no; then
1598 AC_CHECK_LIB(rt, clock_gettime,
1599 [LIBS="-lrt $LIBS"
1600 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
1601 [Define to 1 if you have the `clock_gettime' function.])])
1602 fi
1603
1604 if test x$ac_cv_func_mbstowcs = xyes; then
1605 AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
1606 [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
1607 int main()
1608 {
1609 mbstowcs(0, "", 0);
1610 return 0;
1611 }]])],
1612 [gcc_cv_func_mbstowcs_works=yes],
1613 [gcc_cv_func_mbstowcs_works=no],
1614 [gcc_cv_func_mbstowcs_works=yes])])
1615 if test x$gcc_cv_func_mbstowcs_works = xyes; then
1616 AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1617 [Define this macro if mbstowcs does not crash when its
1618 first argument is NULL.])
1619 fi
1620 fi
1621
1622 AC_CHECK_TYPE(ssize_t, int)
1623 AC_CHECK_TYPE(caddr_t, char *)
1624 AC_CHECK_TYPE(sighander_t,
1625 AC_DEFINE(HAVE_SIGHANDLER_T, 1,
1626 [Define if <sys/signal.h> defines sighandler_t]),
1627 ,signal.h)
1628
1629 GCC_AC_FUNC_MMAP_BLACKLIST
1630
1631 case "${host}" in
1632 *-*-*vms*)
1633 # Under VMS, vfork works very differently than on Unix. The standard test
1634 # won't work, and it isn't easily adaptable. It makes more sense to
1635 # just force it.
1636 ac_cv_func_vfork_works=yes
1637 ;;
1638 esac
1639 AC_FUNC_FORK
1640
1641 AM_ICONV
1642
1643 # Until we have in-tree GNU iconv:
1644 LIBICONV_DEP=
1645 if test -f "$LTLIBICONV"; then
1646 LIBICONV_DEP=$LTLIBICONV
1647 fi
1648 AC_SUBST(LIBICONV_DEP)
1649
1650 AM_LC_MESSAGES
1651
1652 AM_LANGINFO_CODESET
1653
1654 # We will need to find libiberty.h and ansidecl.h
1655 saved_CFLAGS="$CFLAGS"
1656 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1657 saved_CXXFLAGS="$CXXFLAGS"
1658 CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
1659
1660 # gcc_AC_CHECK_DECLS doesn't support overloaded functions, so use the
1661 # normal autoconf function for these. But force definition of
1662 # HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
1663 # basename handling in libiberty.h.
1664 # Match the configure test in libiberty so that we have a consistent result.
1665 AC_CHECK_DECLS([basename(char*)], , ,[
1666 #undef HAVE_DECL_BASENAME
1667 #define HAVE_DECL_BASENAME 1
1668 #if HAVE_LIBGEN_H
1669 # include <libgen.h>
1670 #endif
1671 #include "ansidecl.h"
1672 #include "system.h"])
1673
1674 AC_CHECK_DECLS([strstr(const char*,const char*)], , ,[
1675 #include "ansidecl.h"
1676 #include "system.h"])
1677
1678 gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \
1679 madvise mkstemps stpcpy strnlen strsignal strverscmp \
1680 strtol strtoul strtoll strtoull setenv unsetenv \
1681 errno snprintf vsnprintf vasprintf malloc realloc calloc \
1682 free getopt clock getpagesize ffs fmemopen gcc_UNLOCKED_FUNCS, , ,[
1683 #include "ansidecl.h"
1684 #include "system.h"])
1685
1686 gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
1687 #include "ansidecl.h"
1688 #include "system.h"
1689 #ifdef HAVE_SYS_RESOURCE_H
1690 #include <sys/resource.h>
1691 #endif
1692 ])
1693
1694 gcc_AC_CHECK_DECLS(mallinfo mallinfo2, , ,[
1695 #include "ansidecl.h"
1696 #include "system.h"
1697 #ifdef HAVE_MALLOC_H
1698 #include <malloc.h>
1699 #endif
1700 ])
1701
1702 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1703 #include "ansidecl.h"
1704 #include "system.h"
1705 #ifdef HAVE_SYS_RESOURCE_H
1706 #include <sys/resource.h>
1707 #endif
1708 ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
1709 [Define to `long' if <sys/resource.h> doesn't define.])])
1710
1711 # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
1712 # FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname
1713 # in collect2.cc, <fcntl.h> isn't visible, but the configure test below needs
1714 # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
1715 gcc_AC_CHECK_DECLS(ldgetname, , ,[
1716 #include "ansidecl.h"
1717 #include "system.h"
1718 #ifdef HAVE_LDFCN_H
1719 #undef FREAD
1720 #undef FWRITE
1721 #include <ldfcn.h>
1722 #endif
1723 ])
1724
1725 gcc_AC_CHECK_DECLS(times, , ,[
1726 #include "ansidecl.h"
1727 #include "system.h"
1728 #ifdef HAVE_SYS_TIMES_H
1729 #include <sys/times.h>
1730 #endif
1731 ])
1732
1733 gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1734 #include "ansidecl.h"
1735 #include "system.h"
1736 #include <signal.h>
1737 ])
1738
1739 # More time-related stuff.
1740 AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
1741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1742 #include "ansidecl.h"
1743 #include "system.h"
1744 #ifdef HAVE_SYS_TIMES_H
1745 #include <sys/times.h>
1746 #endif
1747 ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
1748 if test $ac_cv_struct_tms = yes; then
1749 AC_DEFINE(HAVE_STRUCT_TMS, 1,
1750 [Define if <sys/times.h> defines struct tms.])
1751 fi
1752
1753 # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1754 # revisit after autoconf 2.50.
1755 AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
1756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1757 #include "ansidecl.h"
1758 #include "system.h"
1759 ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
1760 if test $gcc_cv_type_clock_t = yes; then
1761 AC_DEFINE(HAVE_CLOCK_T, 1,
1762 [Define if <time.h> defines clock_t.])
1763 fi
1764
1765 # Check if F_SETLKW is supported by fcntl.
1766 AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [
1767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1768 #include <fcntl.h>]], [[
1769 struct flock fl;
1770 fl.l_whence = 0;
1771 fl.l_start = 0;
1772 fl.l_len = 0;
1773 fl.l_pid = 0;
1774 return fcntl (1, F_SETLKW, &fl);]])],
1775 [ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])])
1776 if test $ac_cv_f_setlkw = yes; then
1777 AC_DEFINE(HOST_HAS_F_SETLKW, 1,
1778 [Define if F_SETLKW supported by fcntl.])
1779 fi
1780
1781 # Check if O_CLOEXEC is defined by fcntl
1782 AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
1783 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1784 #include <fcntl.h>]], [[
1785 return open ("/dev/null", O_RDONLY | O_CLOEXEC);]])],
1786 [ac_cv_o_cloexec=yes],[ac_cv_o_cloexec=no])])
1787 if test $ac_cv_o_cloexec = yes; then
1788 AC_DEFINE(HOST_HAS_O_CLOEXEC, 1,
1789 [Define if O_CLOEXEC supported by fcntl.])
1790 fi
1791
1792 # Check if O_NONBLOCK is defined by fcntl
1793 AC_CHECK_HEADERS([fcntl.h])
1794 AC_CHECK_DECL(O_NONBLOCK,,,[#include <fcntl.h>])
1795 if test $ac_cv_have_decl_O_NONBLOCK = yes; then
1796 AC_DEFINE(HOST_HAS_O_NONBLOCK, 1,
1797 [Define if O_NONBLOCK supported by fcntl.])
1798 fi
1799
1800 # Check if personality and ADDR_NO_RANDOMIZE are declared
1801 # in sys/personality.h
1802 AC_CACHE_CHECK(for personality ADDR_NO_RANDOMIZE,
1803 ac_cv_personality_addr_no_randomize, [
1804 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1805 #include <sys/personality.h>]], [[
1806 personality (personality (0xffffffffU) | ADDR_NO_RANDOMIZE);]])],
1807 [ac_cv_personality_addr_no_randomize=yes],
1808 [ac_cv_personality_addr_no_randomize=no])])
1809 if test $ac_cv_personality_addr_no_randomize = yes; then
1810 AC_DEFINE(HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE, 1,
1811 [Define if personality and ADDR_NO_RANDOMIZE are declared in
1812 sys/personality.h.])
1813 fi
1814
1815
1816 # C++ Modules would like some networking features to provide the mapping
1817 # server. You can still use modules without them though.
1818 # The following network-related checks could probably do with some
1819 # Windows and other non-linux defenses and checking.
1820
1821 # Local socket connectivity wants AF_UNIX networking
1822 # Check for AF_UNIX networking
1823 AC_CACHE_CHECK(for AF_UNIX, ac_cv_af_unix, [
1824 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1825 #include <sys/types.h>
1826 #include <sys/socket.h>
1827 #include <sys/un.h>
1828 #include <netinet/in.h>]],[[
1829 sockaddr_un un;
1830 un.sun_family = AF_UNSPEC;
1831 int fd = socket (AF_UNIX, SOCK_STREAM, 0);
1832 connect (fd, (sockaddr *)&un, sizeof (un));]])],
1833 [ac_cv_af_unix=yes],
1834 [ac_cv_af_unix=no])])
1835 if test $ac_cv_af_unix = yes; then
1836 AC_DEFINE(HAVE_AF_UNIX, 1,
1837 [Define if AF_UNIX supported.])
1838 fi
1839
1840 # Remote socket connectivity wants AF_INET6 networking
1841 # Check for AF_INET6 networking
1842 AC_CACHE_CHECK(for AF_INET6, ac_cv_af_inet6, [
1843 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1844 #include <sys/types.h>
1845 #include <sys/socket.h>
1846 #include <netinet/in.h>
1847 #include <netdb.h>]],[[
1848 sockaddr_in6 in6;
1849 in6.sin6_family = AF_UNSPEC;
1850 struct addrinfo *addrs = 0;
1851 struct addrinfo hints;
1852 hints.ai_flags = 0;
1853 hints.ai_family = AF_INET6;
1854 hints.ai_socktype = SOCK_STREAM;
1855 hints.ai_protocol = 0;
1856 hints.ai_canonname = 0;
1857 hints.ai_addr = 0;
1858 hints.ai_next = 0;
1859 int e = getaddrinfo ("localhost", 0, &hints, &addrs);
1860 const char *str = gai_strerror (e);
1861 freeaddrinfo (addrs);
1862 int fd = socket (AF_INET6, SOCK_STREAM, 0);
1863 connect (fd, (sockaddr *)&in6, sizeof (in6));]])],
1864 [ac_cv_af_inet6=yes],
1865 [ac_cv_af_inet6=no])])
1866 if test $ac_cv_af_inet6 = yes; then
1867 AC_DEFINE(HAVE_AF_INET6, 1,
1868 [Define if AF_INET6 supported.])
1869 fi
1870
1871 # Check if _LK_LOCK is supported by _locking
1872 AC_CACHE_CHECK(for _LK_LOCK, ac_cv_lk_lock, [
1873 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1874 #include <io.h>
1875 #include <sys/locking.h>]], [[
1876 int fd;
1877 return _locking (fd, _LK_LOCK, 0);]])],
1878 [ac_cv_lk_lock=yes],[ac_cv_lk_lock=no])])
1879 if test $ac_cv_lk_lock = yes; then
1880 AC_DEFINE(HOST_HAS_LK_LOCK, 1,
1881 [Define if _LK_LOC supported by _locking.])
1882 fi
1883
1884 # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1885 CFLAGS="$saved_CFLAGS"
1886 CXXFLAGS="$saved_CXXFLAGS"
1887
1888 # mkdir takes a single argument on some systems.
1889 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
1890
1891 # File extensions
1892 manext='.1'
1893 objext='.o'
1894 AC_SUBST(manext)
1895 AC_SUBST(objext)
1896
1897 # With Setjmp/Longjmp based exception handling.
1898 AC_ARG_ENABLE(sjlj-exceptions,
1899 [AS_HELP_STRING([--enable-sjlj-exceptions],
1900 [arrange to use setjmp/longjmp exception handling])],
1901 [force_sjlj_exceptions=yes],
1902 [case $target in
1903 lm32*-*-*)
1904 force_sjlj_exceptions=yes
1905 enableval=yes
1906 ;;
1907 *)
1908 force_sjlj_exceptions=no
1909 ;;
1910 esac])
1911 if test $force_sjlj_exceptions = yes; then
1912 sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1913 AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1914 [Define 0/1 to force the choice for exception handling model.])
1915 fi
1916
1917 # Windows32 UTF-8 manifest support for running the driver and compiler
1918 # executables with the UTF-8 active code page on mingw hosts.
1919 # Non-mingw hosts ignore this option.
1920 # The shell variables this sets are picked up from the mingw branches
1921 # of config.host so they have to be set before it gets sourced.
1922 AC_ARG_ENABLE(win32-utf8-manifest,
1923 [AS_HELP_STRING([--disable-win32-utf8-manifest],
1924 [disable embedding a utf8 manifest on mingw hosts])
1925 AS_HELP_STRING([--enable-win32-utf8-manifest],
1926 [enable embedding a utf8 manifest on mingw hosts (default)])],,)
1927
1928 if test "x$enable_win32_utf8_manifest" != xno; then
1929 host_xmake_mingw=i386/x-mingw32-utf8
1930 host_extra_gcc_objs_mingw=utf8rc-mingw32.o
1931 host_extra_objs_mingw=utf8-mingw32.o
1932 fi
1933
1934 # --------------------------------------------------------
1935 # Build, host, and target specific configuration fragments
1936 # --------------------------------------------------------
1937
1938 # Collect build-machine-specific information.
1939 . ${srcdir}/config.build || exit 1
1940
1941 # Collect host-machine-specific information.
1942 . ${srcdir}/config.host || exit 1
1943
1944 target_gtfiles=
1945
1946 # Collect target-machine-specific information.
1947 . ${srcdir}/config.gcc || exit 1
1948
1949 extra_objs="${host_extra_objs} ${extra_objs}"
1950 extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
1951
1952 # Default the target-machine variables that were not explicitly set.
1953 if test x"$tm_file" = x
1954 then tm_file=$cpu_type/$cpu_type.h; fi
1955
1956 if test x"$extra_headers" = x
1957 then extra_headers=; fi
1958
1959 if test x$md_file = x
1960 then md_file=$cpu_type/$cpu_type.md; fi
1961
1962 if test x$out_file = x
1963 then out_file=$cpu_type/$cpu_type.cc; fi
1964
1965 if test x"$tmake_file" = x
1966 then tmake_file=$cpu_type/t-$cpu_type
1967 fi
1968
1969 # Support --enable-initfini-array.
1970 if test x$enable_initfini_array != xno; then
1971 tm_file="${tm_file} initfini-array.h"
1972 fi
1973
1974 if test x"$dwarf2" = xyes
1975 then tm_file="$tm_file tm-dwarf2.h"
1976 fi
1977
1978 # Say what files are being used for the output code and MD file.
1979 echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
1980 echo "Using \`$srcdir/config/$md_file' as machine description file."
1981
1982 # If any of the xm_file variables contain nonexistent files, warn
1983 # about them and drop them.
1984
1985 bx=
1986 for x in $build_xm_file; do
1987 if test -f $srcdir/config/$x
1988 then bx="$bx $x"
1989 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1990 fi
1991 done
1992 build_xm_file="$bx"
1993
1994 hx=
1995 for x in $host_xm_file; do
1996 if test -f $srcdir/config/$x
1997 then hx="$hx $x"
1998 else AC_MSG_WARN($srcdir/config/$x does not exist.)
1999 fi
2000 done
2001 host_xm_file="$hx"
2002
2003 tx=
2004 for x in $xm_file; do
2005 if test -f $srcdir/config/$x
2006 then tx="$tx $x"
2007 else AC_MSG_WARN($srcdir/config/$x does not exist.)
2008 fi
2009 done
2010 xm_file="$tx"
2011
2012 count=a
2013 for f in $tm_file; do
2014 count=${count}x
2015 done
2016 if test $count = ax; then
2017 echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
2018 else
2019 echo "Using the following target machine macro files:"
2020 for f in $tm_file; do
2021 echo " $srcdir/config/$f"
2022 done
2023 fi
2024
2025 if test x$use_long_long_for_widest_fast_int = xyes; then
2026 AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
2027 [Define to 1 if the 'long long' type is wider than 'long' but still
2028 efficiently supported by the host hardware.])
2029 fi
2030
2031 gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
2032 AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
2033
2034 gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
2035 AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
2036
2037 count=a
2038 for f in $host_xm_file; do
2039 count=${count}x
2040 done
2041 if test $count = a; then
2042 :
2043 elif test $count = ax; then
2044 echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
2045 else
2046 echo "Using the following host machine macro files:"
2047 for f in $host_xm_file; do
2048 echo " $srcdir/config/$f"
2049 done
2050 fi
2051 echo "Using ${out_host_hook_obj} for host machine hooks."
2052
2053 if test "$host_xm_file" != "$build_xm_file"; then
2054 count=a
2055 for f in $build_xm_file; do
2056 count=${count}x
2057 done
2058 if test $count = a; then
2059 :
2060 elif test $count = ax; then
2061 echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
2062 else
2063 echo "Using the following build machine macro files:"
2064 for f in $build_xm_file; do
2065 echo " $srcdir/config/$f"
2066 done
2067 fi
2068 fi
2069
2070 if test -n "$configured_native_system_header_dir"; then
2071 native_system_header_dir=$configured_native_system_header_dir
2072 fi
2073 NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir"
2074 AC_SUBST(NATIVE_SYSTEM_HEADER_DIR)
2075
2076 case ${host} in
2077 powerpc*-*-darwin*)
2078 AC_CACHE_CHECK([whether mcontext_t fields have underscores],
2079 gcc_cv_mcontext_underscores,
2080 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2081 #include <sys/cdefs.h>
2082 #include <sys/signal.h>
2083 #include <ucontext.h>
2084 int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
2085 ])],
2086 gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
2087 if test $gcc_cv_mcontext_underscores = yes; then
2088 AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
2089 [mcontext_t fields start with __])
2090 fi
2091 ;;
2092 esac
2093
2094 # ---------
2095 # Threading
2096 # ---------
2097
2098 # Check if a valid thread package
2099 case ${enable_threads} in
2100 "" | no)
2101 # No threads
2102 target_thread_file='single'
2103 ;;
2104 yes)
2105 # default
2106 target_thread_file='single'
2107 ;;
2108 aix | dce | lynx | mipssde | posix | rtems | \
2109 single | tpf | vxworks | win32 | mcf)
2110 target_thread_file=${enable_threads}
2111 ;;
2112 *)
2113 echo "${enable_threads} is an unknown thread package" 1>&2
2114 exit 1
2115 ;;
2116 esac
2117
2118 if test x${thread_file} = x; then
2119 # No thread file set by target-specific clauses in config.gcc,
2120 # so use file chosen by default logic above
2121 thread_file=${target_thread_file}
2122 fi
2123
2124 # --------
2125 # UNSORTED
2126 # --------
2127
2128 use_cxa_atexit=no
2129 if test x$enable___cxa_atexit = xyes || \
2130 test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
2131 if test x$host = x$target; then
2132 case $host in
2133 # mingw32 doesn't have __cxa_atexit but uses atexit registration
2134 # keyed to flag_use_cxa_atexit
2135 *-*-mingw32*)
2136 use_cxa_atexit=yes
2137 ;;
2138 powerpc-ibm-aix*)
2139 use_cxa_atexit=yes
2140 ;;
2141 *)
2142 AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
2143 [echo "__cxa_atexit can't be enabled on this target"])
2144 ;;
2145 esac
2146 else
2147 # We can't check for __cxa_atexit when building a cross, so assume
2148 # it is available
2149 use_cxa_atexit=yes
2150 fi
2151 if test x$use_cxa_atexit = xyes; then
2152 AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
2153 [Define if you want to use __cxa_atexit, rather than atexit, to
2154 register C++ destructors for local statics and global objects.
2155 This is essential for fully standards-compliant handling of
2156 destructors, but requires __cxa_atexit in libc.])
2157 fi
2158 fi
2159
2160 # Look for a file containing extra machine modes.
2161 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
2162 extra_modes_file='$(srcdir)'/config/${extra_modes}
2163 AC_SUBST(extra_modes_file)
2164 AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
2165 [Define to the name of a file containing a list of extra machine modes
2166 for this architecture.])
2167 fi
2168
2169 # Convert extra_options into a form suitable for Makefile use.
2170 extra_opt_files=
2171 all_opt_files=
2172 for f in $extra_options; do
2173 extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
2174 all_opt_files="$all_opt_files $srcdir/config/$f"
2175 done
2176 AC_SUBST(extra_opt_files)
2177
2178 # auto-host.h is the file containing items generated by autoconf and is
2179 # the first file included by config.h.
2180 # If host=build, it is correct to have bconfig include auto-host.h
2181 # as well. If host!=build, we are in error and need to do more
2182 # work to find out the build config parameters.
2183 if test x$host = x$build
2184 then
2185 build_auto=auto-host.h
2186 HAVE_AUTO_BUILD='# '
2187 else
2188 # We create a subdir, then run autoconf in the subdir.
2189 # To prevent recursion we set host and build for the new
2190 # invocation of configure to the build for this invocation
2191 # of configure.
2192 tempdir=build.$$
2193 rm -rf $tempdir
2194 mkdir $tempdir
2195 cd $tempdir
2196 case ${srcdir} in
2197 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
2198 *) realsrcdir=../${srcdir};;
2199 esac
2200 # Clearing GMPINC is necessary to prevent host headers being
2201 # used by the build compiler. Defining GENERATOR_FILE stops
2202 # system.h from including gmp.h.
2203 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
2204 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
2205 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
2206 GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
2207 ${realsrcdir}/configure \
2208 --enable-languages=${enable_languages-all} \
2209 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
2210 ${enable_option_checking+--enable-option-checking="$enable_option_checking"} \
2211 --target=$target_alias --host=$build_alias \
2212 --build=$build_alias || exit # retaining $tempdir
2213
2214 # We just finished tests for the build machine, so rename
2215 # the file auto-build.h in the gcc directory.
2216 mv auto-host.h ../auto-build.h
2217 cd ..
2218 rm -rf $tempdir
2219 build_auto=auto-build.h
2220 HAVE_AUTO_BUILD=
2221 fi
2222 AC_SUBST(build_subdir)
2223 AC_SUBST(HAVE_AUTO_BUILD)
2224
2225 tm_file="${tm_file} defaults.h"
2226 tm_p_file="${tm_p_file} tm-preds.h"
2227 host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
2228 build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
2229 # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
2230 # put this back in temporarily.
2231 xm_file="auto-host.h ansidecl.h ${xm_file}"
2232
2233 # --------
2234 # UNSORTED
2235 # --------
2236
2237 changequote(,)dnl
2238 # Compile in configure arguments.
2239 if test -f configargs.h ; then
2240 # Being re-configured.
2241 gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
2242 gcc_reconf_arguments=`echo "$gcc_config_arguments" | sed -e 's/^.*\( : (reconfigured) .*$\)/\1/'`
2243 if [ "$gcc_reconf_arguments" != " : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" ]; then
2244 gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
2245 fi
2246 else
2247 gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
2248 fi
2249
2250 # Double all backslashes and backslash all quotes to turn
2251 # gcc_config_arguments into a C string.
2252 sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out
2253 $gcc_config_arguments
2254 EOF
2255 gcc_config_arguments_str=`cat conftest.out`
2256 rm -f conftest.out
2257
2258 cat > configargs.h <<EOF
2259 /* Generated automatically. */
2260 static const char configuration_arguments[] = "$gcc_config_arguments_str";
2261 static const char thread_model[] = "$thread_file";
2262
2263 static const struct {
2264 const char *name, *value;
2265 } configure_default_options[] = $configure_default_options;
2266 EOF
2267 changequote([,])dnl
2268
2269 changequote(,)dnl
2270 gcc_BASEVER=`cat $srcdir/BASE-VER`
2271 gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
2272 gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
2273 if test -f $srcdir/REVISION ; then
2274 gcc_REVISION=`cat $srcdir/REVISION`
2275 else
2276 gcc_REVISION=""
2277 fi
2278 cat > plugin-version.h <<EOF
2279 #include "configargs.h"
2280
2281 #define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'`
2282 #define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'`
2283 #define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'`
2284 #define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR)
2285
2286 static char basever[] = "$gcc_BASEVER";
2287 static char datestamp[] = "$gcc_DATESTAMP";
2288 static char devphase[] = "$gcc_DEVPHASE";
2289 static char revision[] = "$gcc_REVISION";
2290
2291 /* FIXME plugins: We should make the version information more precise.
2292 One way to do is to add a checksum. */
2293
2294 static struct plugin_gcc_version gcc_version = {basever, datestamp,
2295 devphase, revision,
2296 configuration_arguments};
2297 EOF
2298 changequote([,])dnl
2299
2300 # Determine what GCC version number to use in filesystem paths.
2301 GCC_BASE_VER
2302
2303 # Internationalization
2304 ZW_GNU_GETTEXT_SISTER_DIR
2305
2306 # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
2307 # -liconv on the link line twice.
2308 case "$LIBINTL" in *$LIBICONV*)
2309 LIBICONV= ;;
2310 esac
2311
2312 AC_ARG_ENABLE(secureplt,
2313 [AS_HELP_STRING([--enable-secureplt],
2314 [enable -msecure-plt by default for PowerPC])],
2315 [], [])
2316
2317 AC_ARG_ENABLE(mingw-wildcard,
2318 [AS_HELP_STRING([--enable-mingw-wildcard],
2319 [Set whether to expand wildcard on command-line.
2320 Default to platform configuration])],
2321 [],[enable_mingw_wildcard=platform])
2322 AS_IF([test x"$enable_mingw_wildcard" != xplatform ],
2323 [AC_DEFINE_UNQUOTED(MINGW_DOWILDCARD,
2324 $(test x"$enable_mingw_wildcard" = xno; echo $?),
2325 [Value to set mingw's _dowildcard to.])])
2326
2327 AC_ARG_ENABLE(large-address-aware,
2328 [AS_HELP_STRING([--enable-large-address-aware],
2329 [Link mingw executables with --large-address-aware])])
2330 AS_IF([test x"$enable_large_address_aware" = xyes],
2331 [AC_DEFINE([MINGW_DEFAULT_LARGE_ADDR_AWARE], 1,
2332 [Define if we should link mingw executables with --large-address-aware])])
2333
2334 AC_ARG_ENABLE(leading-mingw64-underscores,
2335 AS_HELP_STRING([--enable-leading-mingw64-underscores],
2336 [enable leading underscores on 64 bit mingw targets]),
2337 [],[])
2338 AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ],
2339 [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1,
2340 [Define if we should use leading underscore on 64 bit mingw targets])])
2341
2342 AC_ARG_ENABLE(cld,
2343 [AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [],
2344 [enable_cld=no])
2345
2346 AC_ARG_ENABLE(frame-pointer,
2347 [AS_HELP_STRING([--enable-frame-pointer],
2348 [enable -fno-omit-frame-pointer by default for x86])], [],
2349 [
2350 case $target_os in
2351 linux* | gnu* | darwin[[8912]]* | cygwin* | mingw*)
2352 # Enable -fomit-frame-pointer by default for these systems with DWARF2.
2353 enable_frame_pointer=no
2354 ;;
2355 *)
2356 enable_frame_pointer=yes
2357 ;;
2358 esac
2359 ])
2360
2361 case $target in
2362 i[[34567]]86-*-* | x86_64-*-*)
2363 if test "x$enable_cld" = xyes; then
2364 tm_defines="${tm_defines} USE_IX86_CLD=1"
2365 fi
2366 if test "x$enable_frame_pointer" = xyes; then
2367 tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
2368 fi
2369 ;;
2370 esac
2371
2372 # Windows32 Registry support for specifying GCC installation paths.
2373 AC_ARG_ENABLE(win32-registry,
2374 [AS_HELP_STRING([--disable-win32-registry],
2375 [disable lookup of installation paths in the
2376 Registry on Windows hosts])
2377 AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)])
2378 AS_HELP_STRING([--enable-win32-registry=KEY],
2379 [use KEY instead of GCC version as the last portion
2380 of the registry key])],,)
2381
2382 case $host_os in
2383 win32 | pe | cygwin* | mingw32*)
2384 if test "x$enable_win32_registry" != xno; then
2385 AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
2386 fi
2387
2388 if test "x$enable_win32_registry" != xno; then
2389 AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
2390 [Define to 1 if installation paths should be looked up in the Windows
2391 Registry. Ignored on non-Windows hosts.])
2392
2393 if test "x$enable_win32_registry" != xyes \
2394 && test "x$enable_win32_registry" != x; then
2395 AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
2396 [Define to be the last component of the Windows registry key under which
2397 to look for installation paths. The full key used will be
2398 HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
2399 The default is the GCC version number.])
2400 fi
2401 fi
2402 ;;
2403 esac
2404
2405 # Get an absolute path to the GCC top-level source directory
2406 holddir=`${PWDCMD-pwd}`
2407 cd $srcdir
2408 topdir=`${PWDCMD-pwd}`
2409 cd $holddir
2410
2411 # Conditionalize the makefile for this host machine.
2412 xmake_file=
2413 for f in ${host_xmake_file}
2414 do
2415 if test -f ${srcdir}/config/$f
2416 then
2417 xmake_file="${xmake_file} \$(srcdir)/config/$f"
2418 fi
2419 done
2420
2421 # Conditionalize the makefile for this target machine.
2422 tmake_file_=
2423 for f in ${tmake_file}
2424 do
2425 if test -f ${srcdir}/config/$f
2426 then
2427 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
2428 fi
2429 done
2430 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
2431
2432 out_object_file=`basename $out_file .cc`.o
2433 common_out_object_file=`basename $common_out_file .cc`.o
2434
2435 tm_file_list="options.h"
2436 tm_include_list="options.h insn-constants.h"
2437 for f in $tm_file; do
2438 case $f in
2439 ./* )
2440 f=`echo $f | sed 's/^..//'`
2441 tm_file_list="${tm_file_list} $f"
2442 tm_include_list="${tm_include_list} $f"
2443 ;;
2444 defaults.h )
2445 tm_file_list="${tm_file_list} \$(srcdir)/$f"
2446 tm_include_list="${tm_include_list} $f"
2447 ;;
2448 * )
2449 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
2450 tm_include_list="${tm_include_list} config/$f"
2451 ;;
2452 esac
2453 done
2454
2455 tm_p_file_list=
2456 tm_p_include_list=
2457 for f in $tm_p_file; do
2458 case $f in
2459 tm-preds.h )
2460 tm_p_file_list="${tm_p_file_list} $f"
2461 tm_p_include_list="${tm_p_include_list} $f"
2462 ;;
2463 * )
2464 tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
2465 tm_p_include_list="${tm_p_include_list} config/$f"
2466 esac
2467 done
2468
2469 tm_d_file_list=
2470 tm_d_include_list=
2471 for f in $tm_d_file; do
2472 case $f in
2473 * )
2474 tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f"
2475 tm_d_include_list="${tm_d_include_list} config/$f"
2476 ;;
2477 esac
2478 done
2479
2480 tm_rust_file_list=
2481 tm_rust_include_list=
2482 for f in $tm_rust_file; do
2483 case $f in
2484 * )
2485 tm_rust_file_list="${tm_rust_file_list} \$(srcdir)/config/$f"
2486 tm_rust_include_list="${tm_rust_include_list} config/$f"
2487 ;;
2488 esac
2489 done
2490
2491 xm_file_list=
2492 xm_include_list=
2493 for f in $xm_file; do
2494 case $f in
2495 ansidecl.h )
2496 xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
2497 xm_include_list="${xm_include_list} $f"
2498 ;;
2499 auto-host.h )
2500 xm_file_list="${xm_file_list} $f"
2501 xm_include_list="${xm_include_list} $f"
2502 ;;
2503 * )
2504 xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
2505 xm_include_list="${xm_include_list} config/$f"
2506 ;;
2507 esac
2508 done
2509
2510 host_xm_file_list=
2511 host_xm_include_list=
2512 for f in $host_xm_file; do
2513 case $f in
2514 ansidecl.h )
2515 host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
2516 host_xm_include_list="${host_xm_include_list} $f"
2517 ;;
2518 auto-host.h )
2519 host_xm_file_list="${host_xm_file_list} $f"
2520 host_xm_include_list="${host_xm_include_list} $f"
2521 ;;
2522 * )
2523 host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
2524 host_xm_include_list="${host_xm_include_list} config/$f"
2525 ;;
2526 esac
2527 done
2528
2529 build_xm_file_list=
2530 for f in $build_xm_file; do
2531 case $f in
2532 ansidecl.h )
2533 build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
2534 build_xm_include_list="${build_xm_include_list} $f"
2535 ;;
2536 auto-build.h | auto-host.h )
2537 build_xm_file_list="${build_xm_file_list} $f"
2538 build_xm_include_list="${build_xm_include_list} $f"
2539 ;;
2540 * )
2541 build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
2542 build_xm_include_list="${build_xm_include_list} config/$f"
2543 ;;
2544 esac
2545 done
2546
2547 # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a
2548 # cross-compiler which does not use the native headers and libraries.
2549 # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
2550 CROSS= AC_SUBST(CROSS)
2551 ALL=all.internal AC_SUBST(ALL)
2552 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
2553 BUILD_SYSTEM_HEADER_DIR=$SYSTEM_HEADER_DIR AC_SUBST(BUILD_SYSTEM_HEADER_DIR)
2554
2555 if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x ||
2556 test x$build != x$host || test "x$with_build_sysroot" != x; then
2557 if test "x$with_build_sysroot" != x; then
2558 BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
2559 else
2560 BUILD_SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
2561 fi
2562
2563 if test x$host != x$target
2564 then
2565 CROSS="-DCROSS_DIRECTORY_STRUCTURE"
2566 ALL=all.cross
2567 SYSTEM_HEADER_DIR=$BUILD_SYSTEM_HEADER_DIR
2568 elif test "x$TARGET_SYSTEM_ROOT" != x; then
2569 SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
2570 fi
2571
2572 if test "x$with_build_sysroot" != "x"; then
2573 target_header_dir="${with_build_sysroot}${native_system_header_dir}"
2574 elif test "x$with_sysroot" = x; then
2575 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
2576 elif test "x$with_sysroot" = xyes; then
2577 target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
2578 else
2579 target_header_dir="${with_sysroot}${native_system_header_dir}"
2580 fi
2581 else
2582 target_header_dir=${native_system_header_dir}
2583 fi
2584
2585 # If this is a cross-compiler that does not
2586 # have its own set of headers then define
2587 # inhibit_libc
2588
2589 # If this is using newlib, without having the headers available now,
2590 # then define inhibit_libc in LIBGCC2_CFLAGS.
2591 # This prevents libgcc2 from containing any code which requires libc
2592 # support.
2593 : ${inhibit_libc=false}
2594 if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
2595 test x$with_newlib = xyes ; } &&
2596 { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
2597 inhibit_libc=true
2598 fi
2599 AC_SUBST(inhibit_libc)
2600
2601 # When building gcc with a cross-compiler, we need to adjust things so
2602 # that the generator programs are still built with the native compiler.
2603 # Also, we cannot run fixincludes.
2604
2605 # These are the normal (build=host) settings:
2606 CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
2607 CXX_FOR_BUILD='$(CXX)' AC_SUBST(CXX_FOR_BUILD)
2608 BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
2609 BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
2610 BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
2611 STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
2612
2613 # And these apply if build != host, or we are generating coverage data
2614 if test x$build != x$host || test "x$coverage_flags" != x
2615 then
2616 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)'
2617 BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)'
2618 BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
2619 fi
2620
2621
2622 if test x$enable_fixincludes = xno;
2623 then
2624 STMP_FIXINC=''
2625 fi
2626
2627 # Expand extra_headers to include complete path.
2628 # This substitutes for lots of t-* files.
2629 extra_headers_list=
2630 # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
2631 for file in ${extra_headers} ; do
2632 extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
2633 done
2634
2635 # If use_gcc_tgmath is set, append ginclude/tgmath.h.
2636 if test x"$use_gcc_tgmath" = xyes
2637 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
2638 fi
2639
2640 # Define collect2 in Makefile.
2641 case $host_can_use_collect2 in
2642 no) collect2= ;;
2643 *) collect2='collect2$(exeext)' ;;
2644 esac
2645 AC_SUBST([collect2])
2646
2647 # Add a definition of USE_COLLECT2 if system wants one.
2648 case $use_collect2 in
2649 no) use_collect2= ;;
2650 "") ;;
2651 *)
2652 host_xm_defines="${host_xm_defines} USE_COLLECT2"
2653 xm_defines="${xm_defines} USE_COLLECT2"
2654 case $host_can_use_collect2 in
2655 no)
2656 AC_MSG_ERROR([collect2 is required but cannot be built on this system])
2657 ;;
2658 esac
2659 ;;
2660 esac
2661
2662 AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}",
2663 [Define to the name of the LTO plugin DSO that must be
2664 passed to the linker's -plugin=LIB option.])
2665
2666 # ---------------------------
2667 # Assembler & linker features
2668 # ---------------------------
2669
2670 # During stage 2, ld is actually gcc/collect-ld, which is a small script to
2671 # discern between when to use prev-ld/ld-new and when to use ld/ld-new.
2672 # However when ld-new is first executed from the build tree, libtool will
2673 # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers
2674 # to the build tree. While doing this we need to use the previous-stage
2675 # linker, or we have an infinite loop. The presence of a shell script as
2676 # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses
2677 # the gcc/collect-ld script. So we need to know how libtool works, or
2678 # exec-tool will fail.
2679
2680 m4_defun([_LT_CONFIG_COMMANDS], [])
2681 AC_PROG_LIBTOOL
2682 AC_SUBST(objdir)
2683 AC_SUBST(enable_fast_install)
2684
2685 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
2686 DARWIN_DO_EXTRA_RPATH=0
2687 AC_ARG_WITH(darwin-extra-rpath,
2688 [AS_HELP_STRING(
2689 [[--with-darwin-extra-rpath=[ARG]]],
2690 [Specify a runpath directory, additional to those provided by the compiler])],
2691 [if test x"$withval" != x; then
2692 DARWIN_ADD_RPATH="$withval"
2693 DARWIN_DO_EXTRA_RPATH=1
2694 fi])
2695 AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH,
2696 [Should add an extra runpath directory])
2697 AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH",
2698 [Specify a runpath directory, additional to those provided by the compiler])
2699
2700 # Identify the assembler which will work hand-in-glove with the newly
2701 # built GCC, so that we can examine its features. This is the assembler
2702 # which will be driven by the driver program.
2703 #
2704 # If build != host, and we aren't building gas in-tree, we identify a
2705 # build->target assembler and hope that it will have the same features
2706 # as the host->target assembler we'll be using.
2707 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
2708
2709 m4_pattern_allow([AS_FOR_TARGET])dnl
2710 AS_VAR_SET_IF(gcc_cv_as,, [
2711 if test -x "$DEFAULT_ASSEMBLER"; then
2712 gcc_cv_as="$DEFAULT_ASSEMBLER"
2713 elif test -f $gcc_cv_as_gas_srcdir/configure.ac \
2714 && test -f ../gas/Makefile \
2715 && test x$build = x$host; then
2716 gcc_cv_as=../gas/as-new$build_exeext
2717 elif test -x as$build_exeext; then
2718 # Build using assembler in the current directory.
2719 gcc_cv_as=./as$build_exeext
2720 elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then
2721 gcc_cv_as="$AS_FOR_TARGET"
2722 else
2723 AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
2724 fi])
2725
2726 ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
2727 AC_SUBST(ORIGINAL_AS_FOR_TARGET)
2728 case "$ORIGINAL_AS_FOR_TARGET" in
2729 ./as | ./as$build_exeext) ;;
2730 *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
2731 esac
2732
2733 default_ld=
2734 AC_ARG_ENABLE(ld,
2735 [[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]],
2736 [case "${enableval}" in
2737 no)
2738 default_ld=ld.gold
2739 ;;
2740 esac])
2741
2742 install_gold_as_default=no
2743 AC_ARG_ENABLE(gold,
2744 [[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
2745 [case "${enableval}" in
2746 default)
2747 install_gold_as_default=yes
2748 ;;
2749 yes)
2750 if test x${default_ld} != x; then
2751 install_gold_as_default=yes
2752 fi
2753 ;;
2754 no)
2755 ;;
2756 *)
2757 AC_MSG_ERROR([invalid --enable-gold argument])
2758 ;;
2759 esac])
2760
2761 # Identify the linker which will work hand-in-glove with the newly
2762 # built GCC, so that we can examine its features. This is the linker
2763 # which will be driven by the driver program.
2764 #
2765 # If build != host, and we aren't building gas in-tree, we identify a
2766 # build->target linker and hope that it will have the same features
2767 # as the host->target linker we'll be using.
2768 gcc_cv_gld_major_version=
2769 gcc_cv_gld_minor_version=
2770 gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
2771 gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
2772 gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
2773
2774 AS_VAR_SET_IF(gcc_cv_ld,, [
2775 if test -x "$DEFAULT_LINKER"; then
2776 gcc_cv_ld="$DEFAULT_LINKER"
2777 elif test $install_gold_as_default = yes \
2778 && test -f $gcc_cv_ld_gold_srcdir/configure.ac \
2779 && test -f ../gold/Makefile \
2780 && test x$build = x$host; then
2781 gcc_cv_ld=../gold/ld-new$build_exeext
2782 elif test -f $gcc_cv_ld_gld_srcdir/configure.ac \
2783 && test -f ../ld/Makefile \
2784 && test x$build = x$host; then
2785 gcc_cv_ld=../ld/ld-new$build_exeext
2786 elif test -x collect-ld$build_exeext; then
2787 # Build using linker in the current directory.
2788 gcc_cv_ld=./collect-ld$build_exeext
2789 elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then
2790 gcc_cv_ld="$LD_FOR_TARGET"
2791 else
2792 AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
2793 fi])
2794
2795 ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
2796 PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"`
2797 # if the PLUGIN_LD is set ld-new, just have it as ld
2798 # as that is the installed named.
2799 if test x$PLUGIN_LD_SUFFIX = xld-new \
2800 || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then
2801 PLUGIN_LD_SUFFIX=ld
2802 fi
2803 AC_ARG_WITH(plugin-ld,
2804 [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])],
2805 [if test x"$withval" != x; then
2806 ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
2807 PLUGIN_LD_SUFFIX="$withval"
2808 fi])
2809 AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
2810 AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker])
2811
2812 # Check to see if we are using gold instead of ld
2813 AC_MSG_CHECKING(whether we are using gold)
2814 ld_is_gold=no
2815 if test x$gcc_cv_ld != x; then
2816 if $gcc_cv_ld --version 2>/dev/null | sed 1q \
2817 | grep "GNU gold" > /dev/null; then
2818 ld_is_gold=yes
2819 fi
2820 fi
2821 AC_MSG_RESULT($ld_is_gold)
2822
2823 # Check to see if we are using mold instead of ld
2824 AC_MSG_CHECKING(whether we are using mold)
2825 ld_is_mold=no
2826 if test x$gcc_cv_ld != x; then
2827 if $gcc_cv_ld --version 2>/dev/null | sed 1q \
2828 | grep "mold" > /dev/null; then
2829 ld_is_mold=yes
2830 fi
2831 fi
2832 AC_MSG_RESULT($ld_is_mold)
2833
2834
2835 AC_MSG_CHECKING(gold linker with split stack support as non default)
2836 # Check to see if default ld is not gold, but gold is
2837 # available and has support for split stack. If gcc was configured
2838 # with gold then no checking is done.
2839 #
2840 if test x$ld_is_gold = xno && which ${gcc_cv_ld}.gold >/dev/null 2>&1; then
2841
2842 # For platforms other than powerpc64*, enable as appropriate.
2843
2844 gold_non_default=no
2845 ld_gold=`which ${gcc_cv_ld}.gold`
2846 # Make sure this gold has minimal split stack support
2847 if $ld_gold --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
2848 ld_vers=`$ld_gold --version | sed 1q`
2849 gold_vers=`echo $ld_vers | sed -n \
2850 -e 's,^[[^)]]*[[ ]]\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*[[^)]]*\)) .*$,\1,p'`
2851 case $target in
2852 # check that the gold version contains the complete split stack support
2853 # on powerpc64 big and little endian
2854 powerpc64*-*-*)
2855 case "$gold_vers" in
2856 2.25.[[1-9]]*|2.2[[6-9]][[.0-9]]*|2.[[3-9]][[.0-9]]*|[[3-9]].[[.0-9]]*) gold_non_default=yes
2857 ;;
2858 *) gold_non_default=no
2859 ;;
2860 esac
2861 ;;
2862 esac
2863 fi
2864 if test $gold_non_default = yes; then
2865 AC_DEFINE(HAVE_GOLD_NON_DEFAULT_SPLIT_STACK, 1,
2866 [Define if the gold linker supports split stack and is available as a non-default])
2867 fi
2868 fi
2869 AC_MSG_RESULT($gold_non_default)
2870
2871 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
2872 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
2873 case "$ORIGINAL_LD_FOR_TARGET" in
2874 ./collect-ld | ./collect-ld$build_exeext) ;;
2875 *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
2876 esac
2877
2878 AC_MSG_CHECKING(what linker to use)
2879 if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \
2880 || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then
2881 # Single tree build which includes ld. We want to prefer it
2882 # over whatever linker top-level may have detected, since
2883 # we'll use what we're building after installation anyway.
2884 AC_MSG_RESULT(newly built ld)
2885 in_tree_ld=yes
2886 in_tree_ld_is_elf=no
2887 if (grep 'EMUL = .*elf' ../ld/Makefile \
2888 || grep 'EMUL = .*linux' ../ld/Makefile \
2889 || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
2890 in_tree_ld_is_elf=yes
2891 elif test "$ld_is_gold" = yes; then
2892 in_tree_ld_is_elf=yes
2893 fi
2894 for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.ac $gcc_cv_ld_gld_srcdir/Makefile.in
2895 do
2896 changequote(,)dnl
2897 gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f`
2898 if test x$gcc_cv_gld_version != x; then
2899 break
2900 fi
2901 done
2902 case $gcc_cv_gld_version in
2903 VERSION=[0-9]*) ;;
2904 changequote([,])dnl
2905 *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;;
2906 changequote(,)dnl
2907 esac
2908 gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
2909 gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
2910 changequote([,])dnl
2911 ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext
2912 ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext
2913 else
2914 AC_MSG_RESULT($gcc_cv_ld)
2915 in_tree_ld=no
2916 gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext`
2917 ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext
2918 ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext
2919 fi
2920
2921 AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET)
2922 AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET)
2923
2924 # Figure out what nm we will be using.
2925 gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
2926 AS_VAR_SET_IF(gcc_cv_nm,, [
2927 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2928 && test -f ../binutils/Makefile \
2929 && test x$build = x$host; then
2930 gcc_cv_nm=../binutils/nm-new$build_exeext
2931 elif test -x nm$build_exeext; then
2932 gcc_cv_nm=./nm$build_exeext
2933 elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then
2934 gcc_cv_nm="$NM_FOR_TARGET"
2935 else
2936 AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
2937 fi])
2938
2939 AC_MSG_CHECKING(what nm to use)
2940 if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
2941 # Single tree build which includes binutils.
2942 AC_MSG_RESULT(newly built nm)
2943 in_tree_nm=yes
2944 else
2945 AC_MSG_RESULT($gcc_cv_nm)
2946 in_tree_nm=no
2947 fi
2948
2949 ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
2950 AC_SUBST(ORIGINAL_NM_FOR_TARGET)
2951 case "$ORIGINAL_NM_FOR_TARGET" in
2952 ./nm | ./nm$build_exeext) ;;
2953 *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;;
2954 esac
2955
2956
2957 # Figure out what objdump we will be using.
2958 AS_VAR_SET_IF(gcc_cv_objdump,, [
2959 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2960 && test -f ../binutils/Makefile \
2961 && test x$build = x$host; then
2962 # Single tree build which includes binutils.
2963 gcc_cv_objdump=../binutils/objdump$build_exeext
2964 elif test -x objdump$build_exeext; then
2965 gcc_cv_objdump=./objdump$build_exeext
2966 elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
2967 gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
2968 else
2969 AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
2970 fi])
2971
2972 AC_MSG_CHECKING(what objdump to use)
2973 if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2974 # Single tree build which includes binutils.
2975 AC_MSG_RESULT(newly built objdump)
2976 elif test x$gcc_cv_objdump = x; then
2977 AC_MSG_RESULT(not found)
2978 else
2979 AC_MSG_RESULT($gcc_cv_objdump)
2980 fi
2981
2982 # Figure out what readelf we will be using.
2983 AS_VAR_SET_IF(gcc_cv_readelf,, [
2984 if test -f $gcc_cv_binutils_srcdir/configure.ac \
2985 && test -f ../binutils/Makefile \
2986 && test x$build = x$host; then
2987 # Single tree build which includes binutils.
2988 gcc_cv_readelf=../binutils/readelf$build_exeext
2989 elif test -x readelf$build_exeext; then
2990 gcc_cv_readelf=./readelf$build_exeext
2991 elif ( set dummy $READELF_FOR_TARGET; test -x $[2] ); then
2992 gcc_cv_readelf="$READELF_FOR_TARGET"
2993 else
2994 AC_PATH_PROG(gcc_cv_readelf, $READELF_FOR_TARGET)
2995 fi])
2996
2997 AC_MSG_CHECKING(what readelf to use)
2998 if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then
2999 # Single tree build which includes binutils.
3000 AC_MSG_RESULT(newly built readelf)
3001 elif test x$gcc_cv_readelf = x; then
3002 AC_MSG_RESULT(not found)
3003 else
3004 AC_MSG_RESULT($gcc_cv_readelf)
3005 fi
3006
3007 # Figure out what otool we will be using.
3008 AS_VAR_SET_IF(gcc_cv_otool,, [
3009 if test -x otool$build_exeext; then
3010 gcc_cv_otool=./otool$build_exeext
3011 elif ( set dummy $OTOOL_FOR_TARGET; test -x $[2] ); then
3012 gcc_cv_otool="$OTOOL_FOR_TARGET"
3013 else
3014 AC_PATH_PROG(gcc_cv_otool, $OTOOL_FOR_TARGET)
3015 fi])
3016
3017 AC_MSG_CHECKING(what otool to use)
3018 if test x$gcc_cv_otool = x; then
3019 AC_MSG_RESULT(not found)
3020 else
3021 AC_MSG_RESULT($gcc_cv_otool)
3022 fi
3023
3024 # Figure out the dsymutil we will use.
3025 AS_VAR_SET_IF(gcc_cv_dsymutil,, [
3026 if test -x "$DEFAULT_DSYMUTIL"; then
3027 gcc_cv_dsymutil="$DEFAULT_DSYMUTIL"
3028 elif test -x dsymutil$build_exeext; then
3029 gcc_cv_dsymutil=./dsymutil$build_exeext
3030 elif ( set dummy $DSYMUTIL_FOR_TARGET; test -x $[2] ); then
3031 gcc_cv_dsymutil=$DSYMUTIL_FOR_TARGET
3032 elif ( set dummy $DSYMUTIL; test -x $[2] ); then
3033 gcc_cv_dsymutil=$DSYMUTIL
3034 else
3035 AC_PATH_PROG(gcc_cv_dsymutil, $DSYMUTIL_FOR_TARGET)
3036 fi])
3037
3038 ORIGINAL_DSYMUTIL_FOR_TARGET=$gcc_cv_dsymutil
3039 AC_SUBST(ORIGINAL_DSYMUTIL_FOR_TARGET)
3040 case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in
3041 ./dsymutil | ./dsymutil$build_exeext) ;;
3042 *) AC_CONFIG_FILES(dsymutil:exec-tool.in, [chmod +x dsymutil]) ;;
3043 esac
3044
3045 # Figure out what assembler alignment features are present.
3046 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,,
3047 [.balign 4
3048 .p2align 2],,
3049 [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
3050 [Define if your assembler supports .balign and .p2align.])])
3051
3052 gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,,
3053 [.p2align 4,,7],,
3054 [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
3055 [Define if your assembler supports specifying the maximum number
3056 of bytes to skip when using the GAS .p2align command.])])
3057
3058 gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,,
3059 [.literal16],,
3060 [AC_DEFINE(HAVE_GAS_LITERAL16, 1,
3061 [Define if your assembler supports .literal16.])])
3062
3063 gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,,
3064 [conftest_label1: .word 0
3065 .subsection -1
3066 conftest_label2: .word 0
3067 .previous],
3068 [if test x$gcc_cv_nm != x; then
3069 $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
3070 $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
3071 if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
3072 then :
3073 else gcc_cv_as_subsection_m1=yes
3074 fi
3075 rm -f conftest.nm1 conftest.nm2
3076 fi],
3077 [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
3078 [Define if your assembler supports .subsection and .subsection -1 starts
3079 emitting at the beginning of your section.])])
3080
3081 gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,,
3082 [ .weak foobar],,
3083 [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
3084
3085 gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,,
3086 [ .weakref foobar, barfnot],,
3087 [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
3088
3089 gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,,
3090 [ .SPACE $TEXT$
3091 .NSUBSPA $CODE$,COMDAT],,
3092 [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
3093
3094 # .hidden needs to be supported in both the assembler and the linker,
3095 # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
3096 # This is irritatingly difficult to feature test for; we have to check the
3097 # date string after the version number. If we've got an in-tree
3098 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
3099 # to be safe.
3100 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
3101 case "${target}" in
3102 *-*-aix*)
3103 conftest_s=' .globl foobar,hidden'
3104 ;;
3105 *)
3106 conftest_s=' .hidden foobar
3107 foobar:'
3108 ;;
3109 esac
3110 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,, [$conftest_s])
3111 case "${target}" in
3112 *-*-darwin*)
3113 # Darwin as has some visibility support, though with a different syntax.
3114 gcc_cv_as_hidden=yes
3115 ;;
3116 esac
3117
3118 gcc_GAS_CHECK_FEATURE([.base64], gcc_cv_as_base64,,
3119 [ .section .rodata
3120 .base64 "Tm9uIHB1ZG9yIGVzdCBuaWwgc2NpcmUsIHB1ZG9yIG5pbCBkaXNjZXJlIHZlbGxlLgo="],,
3121 [AC_DEFINE(HAVE_GAS_BASE64, 1, [Define if your assembler supports .base64.])])
3122
3123 gcc_GAS_CHECK_FEATURE([.cv_ucomp], gcc_cv_as_cv_ucomp,,[.cv_ucomp 0],,
3124 [AC_DEFINE(HAVE_GAS_CV_UCOMP, 1, [Define if your assembler supports .cv_ucomp.])])
3125
3126 # gnu_indirect_function type is an extension proposed at
3127 # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
3128 # selection of function implementation
3129 AC_ARG_ENABLE(gnu-indirect-function,
3130 [AS_HELP_STRING([--enable-gnu-indirect-function],
3131 [enable the use of the @gnu_indirect_function to glibc systems])],
3132 [case $enable_gnu_indirect_function in
3133 yes | no) ;;
3134 *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function.
3135 Valid choices are 'yes' and 'no'.]) ;;
3136 esac],
3137 [enable_gnu_indirect_function="$default_gnu_indirect_function"])
3138
3139 case "${target}" in
3140 riscv*-*-linux*)
3141 AC_MSG_CHECKING(linker ifunc IRELATIVE support)
3142 cat > conftest.s <<EOF
3143 .text
3144 .type foo_resolver, @function
3145 foo_resolver:
3146 ret
3147 .size foo_resolver, .-foo_resolver
3148
3149 .globl foo
3150 .type foo, %gnu_indirect_function
3151 .set foo, foo_resolver
3152
3153 .globl bar
3154 .type bar, @function
3155 bar:
3156 call foo
3157 ret
3158 .size bar, .-bar
3159 EOF
3160 if test x$gcc_cv_as != x \
3161 && test x$gcc_cv_ld != x \
3162 && test x$gcc_cv_readelf != x \
3163 && $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
3164 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
3165 && $gcc_cv_readelf --relocs --wide conftest \
3166 | grep R_RISCV_IRELATIVE > /dev/null 2>&1; then
3167 enable_gnu_indirect_function=yes
3168 fi
3169 rm -f conftest conftest.o conftest.s
3170 AC_MSG_RESULT($enable_gnu_indirect_function)
3171 ;;
3172 esac
3173
3174 gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi`
3175 AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif,
3176 [Define if your system supports gnu indirect functions.])
3177
3178
3179 changequote(,)dnl
3180 ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
3181 if test $in_tree_ld != yes ; then
3182 if echo "$ld_ver" | grep GNU > /dev/null; then
3183 if test x"$ld_is_gold" = xyes; then
3184 # GNU gold --version looks like this:
3185 #
3186 # GNU gold (GNU Binutils 2.21.51.20110225) 1.11
3187 #
3188 # We extract the binutils version which is more familiar and specific
3189 # than the gold version.
3190 ld_vers=`echo $ld_ver | sed -n \
3191 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
3192 else
3193 # GNU ld --version looks like this:
3194 #
3195 # GNU ld (GNU Binutils) 2.21.51.20110225
3196 ld_vers=`echo $ld_ver | sed -n \
3197 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
3198 fi
3199 ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)\(-*\)\([01][0-9]\)\2\([0-3][0-9]\).*$,\1\3\4,p'`
3200 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3201 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3202 ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
3203 else
3204 case "${target}" in
3205 *-*-solaris2*)
3206 # Solaris 2 ld -V output looks like this for a regular version:
3207 #
3208 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699
3209 #
3210 # but test versions add stuff at the end:
3211 #
3212 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10
3213 #
3214 # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version
3215 # numbers can be used in ld.so.1 feature checks even if a different
3216 # linker is configured.
3217 ld_ver=`$gcc_cv_ld -V 2>&1`
3218 if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
3219 ld_vers=`echo $ld_ver | sed -n \
3220 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
3221 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
3222 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
3223 fi
3224 ;;
3225 esac
3226 fi
3227 fi
3228 changequote([,])dnl
3229
3230 AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
3231 [[if test $in_tree_ld = yes ; then
3232 gcc_cv_ld_hidden=no
3233 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \
3234 && test $in_tree_ld_is_elf = yes; then
3235 gcc_cv_ld_hidden=yes
3236 fi
3237 else
3238 gcc_cv_ld_hidden=yes
3239 if test x"$ld_is_gold" = xyes; then
3240 :
3241 elif test x"$ld_is_mold" = xyes; then
3242 :
3243 elif echo "$ld_ver" | grep GNU > /dev/null; then
3244 if test 0"$ld_date" -lt 20020404; then
3245 if test -n "$ld_date"; then
3246 # If there was date string, but was earlier than 2002-04-04, fail
3247 gcc_cv_ld_hidden=no
3248 elif test -z "$ld_vers"; then
3249 # If there was no date string nor ld version number, something is wrong
3250 gcc_cv_ld_hidden=no
3251 else
3252 test -z "$ld_vers_patch" && ld_vers_patch=0
3253 if test "$ld_vers_major" -lt 2; then
3254 gcc_cv_ld_hidden=no
3255 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
3256 gcc_cv_ld_hidden="no"
3257 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
3258 gcc_cv_ld_hidden=no
3259 fi
3260 fi
3261 fi
3262 else
3263 case "${target}" in
3264 *-*-aix[789]*)
3265 gcc_cv_ld_hidden=yes
3266 ;;
3267 *-*-darwin*)
3268 # Darwin ld has some visibility support.
3269 gcc_cv_ld_hidden=yes
3270 ;;
3271 hppa64*-*-hpux* | ia64*-*-hpux*)
3272 gcc_cv_ld_hidden=yes
3273 ;;
3274 *-*-solaris2*)
3275 # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but
3276 # .symbolic was only added in Solaris 9 12/02.
3277 gcc_cv_ld_hidden=yes
3278 ;;
3279 *)
3280 gcc_cv_ld_hidden=no
3281 ;;
3282 esac
3283 fi
3284 fi]])
3285 libgcc_visibility=no
3286 AC_SUBST(libgcc_visibility)
3287 GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
3288 if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
3289 libgcc_visibility=yes
3290 AC_DEFINE(HAVE_GAS_HIDDEN, 1,
3291 [Define if your assembler and linker support .hidden.])
3292 fi
3293
3294 AC_MSG_CHECKING(linker read-only and read-write section mixing)
3295 gcc_cv_ld_ro_rw_mix=unknown
3296 if test $in_tree_ld = yes ; then
3297 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 \
3298 && test $in_tree_ld_is_elf = yes; then
3299 gcc_cv_ld_ro_rw_mix=read-write
3300 fi
3301 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
3302 echo '.section myfoosect, "a"' > conftest1.s
3303 echo '.section myfoosect, "aw"' > conftest2.s
3304 echo '.byte 1' >> conftest2.s
3305 echo '.section myfoosect, "a"' > conftest3.s
3306 echo '.byte 0' >> conftest3.s
3307 if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
3308 && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
3309 && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1; then
3310 if $gcc_cv_ld -shared -o conftest1.so conftest1.o \
3311 conftest2.o conftest3.o > /dev/null 2>&1 \
3312 || $gcc_cv_ld -r -o conftest1.so conftest1.o \
3313 conftest2.o conftest3.o > /dev/null 2>&1; then
3314 gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
3315 | sed -e '/myfoosect/!d' -e N`
3316 if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
3317 if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
3318 gcc_cv_ld_ro_rw_mix=read-only
3319 else
3320 gcc_cv_ld_ro_rw_mix=read-write
3321 fi
3322 fi
3323 fi
3324 fi
3325 changequote(,)dnl
3326 rm -f conftest.* conftest[123].*
3327 changequote([,])dnl
3328 fi
3329 if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
3330 AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
3331 [Define if your linker links a mix of read-only
3332 and read-write sections into a read-write section.])
3333 fi
3334 AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
3335
3336 gcc_AC_INITFINI_ARRAY
3337
3338 gcc_CHECK_ATTRIBUTE_ALIAS
3339
3340 # Some assemblers (GNU as for LoongArch) generates relocations for
3341 # leb128 symbol arithmetic for relaxation, we need to disable relaxation
3342 # probing leb128 support then.
3343 case $target in
3344 loongarch*-*-*)
3345 gcc_GAS_CHECK_FEATURE([-mno-relax support],
3346 gcc_cv_as_mno_relax,[-mno-relax],[.text],,
3347 [check_leb128_asflags=-mno-relax])
3348 ;;
3349 *)
3350 check_leb128_asflags=
3351 ;;
3352 esac
3353
3354 # Check if we have .[us]leb128, and support symbol arithmetic with it.
3355 # Older versions of GAS and some non-GNU assemblers, have a bugs handling
3356 # these directives, even when they appear to accept them.
3357 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
3358 [$check_leb128_asflags],
3359 [ .data
3360 .uleb128 L2 - L1
3361 L1:
3362 .uleb128 1280
3363 .sleb128 -1010
3364 L2:
3365 .uleb128 0x8000000000000000
3366 ],
3367 [[
3368 if test "x$gcc_cv_objdump" != x; then
3369 if $gcc_cv_objdump -s conftest.o 2>/dev/null \
3370 | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
3371 gcc_cv_as_leb128=yes
3372 fi
3373 elif test "x$gcc_cv_otool" != x; then
3374 if $gcc_cv_otool -d conftest.o 2>/dev/null \
3375 | grep '04 80 0a 8e 78 80 80 80 80 80 80 80 80 80 01' >/dev/null; then
3376 gcc_cv_as_leb128=yes
3377 fi
3378 else
3379 # play safe, assume the assembler is broken.
3380 :
3381 fi
3382 ]],
3383 [AC_DEFINE(HAVE_AS_LEB128, 1,
3384 [Define if your assembler supports .sleb128 and .uleb128.])],
3385 [AC_DEFINE(HAVE_AS_LEB128, 0,
3386 [Define if your assembler supports .sleb128 and .uleb128.])])
3387
3388 # Determine if an .eh_frame section is read-only.
3389 gcc_fn_eh_frame_ro () {
3390 $gcc_cv_as $1 -o conftest.o conftest.s > /dev/null 2>&1 && \
3391 $gcc_cv_objdump -h conftest.o 2>/dev/null | \
3392 sed -e '/.eh_frame/!d' -e N | grep READONLY > /dev/null
3393 }
3394
3395 # Check if we have assembler support for unwind directives.
3396 gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,,
3397 [ .text
3398 .cfi_startproc
3399 .cfi_offset 0, 0
3400 .cfi_same_value 1
3401 .cfi_def_cfa 1, 2
3402 .cfi_escape 1, 2, 3, 4, 5
3403 .cfi_endproc],
3404 [case "$target" in
3405 *-*-solaris*)
3406 # If the linker used on Solaris (like Sun ld) isn't capable of merging
3407 # read-only and read-write sections, we need to make sure that the
3408 # assembler used emits read-write .eh_frame sections.
3409 if test "x$gcc_cv_ld_ro_rw_mix" = xread-write; then
3410 gcc_cv_as_cfi_directive=yes
3411 elif test "x$gcc_cv_objdump" = x; then
3412 # No objdump, err on the side of caution.
3413 gcc_cv_as_cfi_directive=no
3414 else
3415 if test x$gas = xyes; then
3416 as_32_opt="--32"
3417 as_64_opt="--64"
3418 else
3419 as_32_opt="-m32"
3420 as_64_opt="-m64"
3421 fi
3422 case "$target" in
3423 sparc*-*-solaris2.*)
3424 # On Solaris/SPARC, .eh_frame sections should always be read-write.
3425 if gcc_fn_eh_frame_ro $as_32_opt \
3426 || gcc_fn_eh_frame_ro $as_64_opt; then
3427 gcc_cv_as_cfi_directive=no
3428 else
3429 gcc_cv_as_cfi_directive=yes
3430 fi
3431 ;;
3432 i?86-*-solaris2.* | x86_64-*-solaris2.*)
3433 # On Solaris/x86, make sure that GCC and assembler agree on using
3434 # read-only .eh_frame sections for 64-bit.
3435 if gcc_fn_eh_frame_ro $as_32_opt; then
3436 gcc_cv_as_cfi_directive=no
3437 elif gcc_fn_eh_frame_ro $as_64_opt; then
3438 gcc_cv_as_cfi_directive=yes
3439 else
3440 gcc_cv_as_cfi_directive=no
3441 fi
3442 ;;
3443 esac
3444 fi
3445 ;;
3446 *-*-*)
3447 gcc_cv_as_cfi_directive=yes
3448 ;;
3449 esac])
3450 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
3451 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,,
3452 [ .text
3453 .cfi_startproc
3454 .cfi_adjust_cfa_offset 64
3455 .skip 75040, 0
3456 .cfi_adjust_cfa_offset 128
3457 .cfi_endproc],
3458 [[
3459 if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
3460 | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then
3461 gcc_cv_as_cfi_advance_working=yes
3462 fi
3463 ]])
3464 else
3465 # no objdump, err on the side of caution
3466 gcc_cv_as_cfi_advance_working=no
3467 fi
3468 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE)
3469 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
3470 [`if test $gcc_cv_as_cfi_directive = yes \
3471 && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`],
3472 [Define 0/1 if your assembler supports CFI directives.])
3473
3474 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
3475 gcc_GAS_CHECK_FEATURE([cfi personality directive],
3476 gcc_cv_as_cfi_personality_directive,,
3477 [ .text
3478 .cfi_startproc
3479 .cfi_personality 0, symbol
3480 .cfi_endproc])
3481 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
3482 [`if test $gcc_cv_as_cfi_personality_directive = yes; then echo 1; else echo 0; fi`],
3483 [Define 0/1 if your assembler supports .cfi_personality.])
3484
3485 gcc_GAS_CHECK_FEATURE([cfi sections directive],
3486 gcc_cv_as_cfi_sections_directive,,
3487 [ .text
3488 .cfi_sections .debug_frame, .eh_frame
3489 .cfi_startproc
3490 .cfi_endproc],
3491 [case $target_os in
3492 win32 | pe | cygwin* | mingw32*)
3493 # Need to check that we generated the correct relocation for the
3494 # .debug_frame section. This was fixed for binutils 2.21.
3495 gcc_cv_as_cfi_sections_directive=no
3496 if test "x$gcc_cv_objdump" != x; then
3497 if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
3498 grep -i secrel > /dev/null; then
3499 gcc_cv_as_cfi_sections_directive=yes
3500 fi
3501 fi
3502 ;;
3503 *)
3504 gcc_cv_as_cfi_sections_directive=yes
3505 ;;
3506 esac])
3507 GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE)
3508 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
3509 [`if test $gcc_cv_as_cfi_sections_directive = yes; then echo 1; else echo 0; fi`],
3510 [Define 0/1 if your assembler supports .cfi_sections.])
3511
3512 # GAS versions up to and including 2.11.0 may mis-optimize
3513 # .eh_frame data.
3514 gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,,
3515 [ .text
3516 .LFB1:
3517 .4byte 0
3518 .L1:
3519 .4byte 0
3520 .LFE1:
3521 .section .eh_frame,"aw",@progbits
3522 __FRAME_BEGIN__:
3523 .4byte .LECIE1-.LSCIE1
3524 .LSCIE1:
3525 .4byte 0x0
3526 .byte 0x1
3527 .ascii "z\0"
3528 .byte 0x1
3529 .byte 0x78
3530 .byte 0x1a
3531 .byte 0x0
3532 .byte 0x4
3533 .4byte 1
3534 .p2align 1
3535 .LECIE1:
3536 .LSFDE1:
3537 .4byte .LEFDE1-.LASFDE1
3538 .LASFDE1:
3539 .4byte .LASFDE1-__FRAME_BEGIN__
3540 .4byte .LFB1
3541 .4byte .LFE1-.LFB1
3542 .byte 0x4
3543 .4byte .LFE1-.LFB1
3544 .byte 0x4
3545 .4byte .L1-.LFB1
3546 .LEFDE1:],
3547 [ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
3548 cat > conftest.lit <<EOF
3549 0000 10000000 00000000 017a0001 781a0004 .........z..x...
3550 0010 01000000 12000000 18000000 00000000 ................
3551 0020 08000000 04080000 0044 .........D @&t@
3552 EOF
3553 cat > conftest.big <<EOF
3554 0000 00000010 00000000 017a0001 781a0004 .........z..x...
3555 0010 00000001 00000012 00000018 00000000 ................
3556 0020 00000008 04000000 0844 .........D @&t@
3557 EOF
3558 # If the assembler didn't choke, and we can objdump,
3559 # and we got the correct data, then succeed.
3560 # The text in the here-document typically retains its unix-style line
3561 # endings, while the output of objdump will use host line endings.
3562 # Therefore, use diff -b for the comparisons.
3563 if test x$gcc_cv_objdump != x \
3564 && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
3565 | tail -3 > conftest.got \
3566 && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
3567 || diff -b conftest.big conftest.got > /dev/null 2>&1; }
3568 then
3569 gcc_cv_as_eh_frame=yes
3570 elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
3571 gcc_cv_as_eh_frame=buggy
3572 else
3573 # Uh oh, what do we do now?
3574 gcc_cv_as_eh_frame=no
3575 fi])
3576
3577 if test $gcc_cv_as_eh_frame = buggy; then
3578 AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
3579 [Define if your assembler mis-optimizes .eh_frame data.])
3580 fi
3581
3582 # Test if the assembler supports the section flag 'e' or #exclude for
3583 # specifying an excluded section.
3584 gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_e,
3585 [--fatal-warnings],
3586 [.section foo1,"e"
3587 .byte 0,0,0,0])
3588 if test $gcc_cv_as_section_exclude_e = no; then
3589 case "${target}" in
3590 # Solaris as uses #exclude instead.
3591 *-*-solaris2*)
3592 case "${target}" in
3593 sparc*-*-solaris2*)
3594 conftest_s='.section "foo1", #exclude'
3595 ;;
3596 i?86-*-solaris2* | x86_64-*-solaris2*)
3597 conftest_s='.section foo1, #exclude'
3598 ;;
3599 esac
3600 ;;
3601 esac
3602 gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,,
3603 [$conftest_s
3604 .byte 0,0,0,0])
3605 fi
3606 AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
3607 [`if test $gcc_cv_as_section_exclude_e = yes || test $gcc_cv_as_section_exclude_hash = yes; then echo 1; else echo 0; fi`],
3608 [Define if your assembler supports specifying the exclude section flag.])
3609
3610 # Test if the assembler supports the section flag 'R' for specifying
3611 # section with SHF_GNU_RETAIN.
3612 case "${target}" in
3613 # Solaris may use GNU assembler with Solairs ld. Even if GNU
3614 # assembler supports the section flag 'R', it doesn't mean that
3615 # Solairs ld supports it.
3616 *-*-solaris2*)
3617 gcc_cv_as_shf_gnu_retain=no
3618 ;;
3619 *)
3620 gcc_GAS_CHECK_FEATURE([section 'R' flag], gcc_cv_as_shf_gnu_retain,
3621 [--fatal-warnings],
3622 [.section .foo,"awR",%progbits
3623 .byte 0])
3624 ;;
3625 esac
3626 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_GNU_RETAIN,
3627 [`if test $gcc_cv_as_shf_gnu_retain = yes; then echo 1; else echo 0; fi`],
3628 [Define 0/1 if your assembler supports marking sections with SHF_GNU_RETAIN flag.])
3629
3630 # Test if the assembler supports the section flag 'o' for specifying
3631 # section with link-order.
3632 case "${target}" in
3633 # Solaris may use GNU assembler with Solairs ld. Even if GNU
3634 # assembler supports the section flag 'o', it doesn't mean that
3635 # Solairs ld supports it.
3636 *-*-solaris2*)
3637 gcc_cv_as_section_link_order=no
3638 ;;
3639 *)
3640 gcc_GAS_CHECK_FEATURE([section 'o' flag], gcc_cv_as_section_link_order,
3641 [--fatal-warnings],
3642 [.section .foo,"a"
3643 .byte 0
3644 .section __patchable_function_entries,"awo",%progbits,.foo
3645 .byte 0])
3646 ;;
3647 esac
3648 AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_LINK_ORDER,
3649 [`if test $gcc_cv_as_section_link_order = yes; then echo 1; else echo 0; fi`],
3650 [Define 0/1 if your assembler supports 'o' flag in .section directive.])
3651
3652 gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
3653 [--fatal-warnings],
3654 [.section .rodata.str, "aMS", @progbits, 1])
3655 if test $gcc_cv_as_shf_merge = no; then
3656 gcc_GAS_CHECK_FEATURE(section merging support (%progbits),
3657 gcc_cv_as_shf_merge_percent,
3658 [--fatal-warnings],
3659 [.section .rodata.str, "aMS", %progbits, 1])
3660 fi
3661 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
3662 [`if test $gcc_cv_as_shf_merge = yes \
3663 || test $gcc_cv_as_shf_merge_percent = yes; then echo 1; else echo 0; fi`],
3664 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
3665
3666 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)],
3667 gcc_cv_as_comdat_group,
3668 [--fatal-warnings],
3669 [.section .text,"axG",@progbits,.foo,comdat])
3670 if test $gcc_cv_as_comdat_group = yes; then
3671 gcc_cv_as_comdat_group_percent=no
3672 gcc_cv_as_comdat_group_group=no
3673 else
3674 gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)],
3675 gcc_cv_as_comdat_group_percent,
3676 [--fatal-warnings],
3677 [.section .text,"axG",%progbits,.foo,comdat])
3678 if test $gcc_cv_as_comdat_group_percent = yes; then
3679 gcc_cv_as_comdat_group_group=no
3680 else
3681 case "${target}" in
3682 # Sun as uses a completely different syntax.
3683 *-*-solaris2*)
3684 case "${target}" in
3685 sparc*-*-solaris2*)
3686 conftest_s='
3687 .group foo,".text%foo",#comdat
3688 .section ".text%foo", #alloc,#execinstr,#progbits
3689 .globl foo
3690 foo:
3691 '
3692 ;;
3693 i?86-*-solaris2* | x86_64-*-solaris2*)
3694 conftest_s='
3695 .group foo,.text%foo,#comdat
3696 .section .text%foo, "ax", @progbits
3697 .globl foo
3698 foo:
3699 '
3700 ;;
3701 esac
3702 gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)],
3703 gcc_cv_as_comdat_group_group,
3704 , [$conftest_s])
3705 ;;
3706 esac
3707 if test -z "${gcc_cv_as_comdat_group_group+set}"; then
3708 gcc_cv_as_comdat_group_group=no
3709 fi
3710 fi
3711 fi
3712 if test x"$ld_is_gold" = xyes; then
3713 comdat_group=yes
3714 elif test x"$ld_is_mold" = xyes; then
3715 comdat_group=yes
3716 elif test $in_tree_ld = yes ; then
3717 comdat_group=no
3718 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
3719 && test $in_tree_ld_is_elf = yes; then
3720 comdat_group=yes
3721 fi
3722 elif echo "$ld_ver" | grep GNU > /dev/null; then
3723 comdat_group=yes
3724 if test 0"$ld_date" -lt 20050308; then
3725 if test -n "$ld_date"; then
3726 # If there was date string, but was earlier than 2005-03-08, fail
3727 comdat_group=no
3728 elif test "$ld_vers_major" -lt 2; then
3729 comdat_group=no
3730 elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
3731 comdat_group=no
3732 fi
3733 fi
3734 else
3735 changequote(,)dnl
3736 case "${target}" in
3737 *-*-solaris2.1[1-9]*)
3738 comdat_group=no
3739 # Sun ld has COMDAT group support since Solaris 9, but it doesn't
3740 # interoperate with GNU as until Solaris 11 build 130, i.e. ld
3741 # version 1.688.
3742 #
3743 # If using Sun as for COMDAT group as emitted by GCC, one needs at
3744 # least ld version 1.2267.
3745 if test "$ld_vers_major" -gt 1; then
3746 comdat_group=yes
3747 elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
3748 comdat_group=yes
3749 elif test "$ld_vers_minor" -ge 2267; then
3750 comdat_group=yes
3751 fi
3752 ;;
3753 *)
3754 # Assume linkers other than GNU ld don't support COMDAT group.
3755 comdat_group=no
3756 ;;
3757 esac
3758 changequote([,])dnl
3759 fi
3760 # Allow overriding the automatic COMDAT group tests above.
3761 AC_ARG_ENABLE(comdat,
3762 [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])],
3763 [comdat_group="$enable_comdat"])
3764 if test $comdat_group = no; then
3765 gcc_cv_as_comdat_group=no
3766 gcc_cv_as_comdat_group_percent=no
3767 gcc_cv_as_comdat_group_group=no
3768 fi
3769 AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
3770 [`if test $gcc_cv_as_comdat_group = yes \
3771 || test $gcc_cv_as_comdat_group_percent = yes \
3772 || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`],
3773 [Define 0/1 if your assembler and linker support COMDAT groups.])
3774
3775 gcc_GAS_CHECK_FEATURE([line table is_stmt support],
3776 gcc_cv_as_is_stmt,,
3777 [ .text
3778 .file 1 "conf.c"
3779 .loc 1 1 0 is_stmt 1],,
3780 [AC_DEFINE(HAVE_GAS_LOC_STMT, 1,
3781 [Define if your assembler supports the .loc is_stmt sub-directive.])])
3782
3783 gcc_GAS_CHECK_FEATURE([line table discriminator support],
3784 gcc_cv_as_discriminator,,
3785 [ .text
3786 .file 1 "conf.c"
3787 .loc 1 1 0 discriminator 1],,
3788 [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1,
3789 [Define if your assembler supports the .loc discriminator sub-directive.])])
3790
3791 # Catch the newlib flag of the same name so we can gate GCC features on it.
3792 AC_ARG_ENABLE(newlib-nano-formatted-io,
3793 [AS_HELP_STRING([--enable-newlib-nano-formatted-io], [Use nano version
3794 formatted IO])],
3795 [case "${enableval}" in
3796 yes|no)
3797 ;;
3798 *)
3799 AC_MSG_ERROR([unknown newlib-nano-formatted-io setting $enableval])
3800 ;;
3801 esac], [])
3802
3803 # Thread-local storage - the check is heavily parameterized.
3804 conftest_s=
3805 tls_as_opt=
3806 case "$target" in
3807 changequote(,)dnl
3808 alpha*-*-*)
3809 conftest_s='
3810 .section ".tdata","awT",@progbits
3811 foo: .long 25
3812 .text
3813 ldq $27,__tls_get_addr($29) !literal!1
3814 lda $16,foo($29) !tlsgd!1
3815 jsr $26,($27),__tls_get_addr !lituse_tlsgd!1
3816 ldq $27,__tls_get_addr($29) !literal!2
3817 lda $16,foo($29) !tlsldm!2
3818 jsr $26,($27),__tls_get_addr !lituse_tlsldm!2
3819 ldq $1,foo($29) !gotdtprel
3820 ldah $2,foo($29) !dtprelhi
3821 lda $3,foo($2) !dtprello
3822 lda $4,foo($29) !dtprel
3823 ldq $1,foo($29) !gottprel
3824 ldah $2,foo($29) !tprelhi
3825 lda $3,foo($2) !tprello
3826 lda $4,foo($29) !tprel'
3827 tls_as_opt=--fatal-warnings
3828 ;;
3829 arc*-*-*)
3830 conftest_s='
3831 add_s r0,r0, @foo@tpoff'
3832 ;;
3833 cris-*-*|crisv32-*-*)
3834 conftest_s='
3835 .section ".tdata","awT",@progbits
3836 x: .long 25
3837 .text
3838 move.d x:IE,$r10
3839 nop'
3840 tls_as_opt=--fatal-warnings
3841 ;;
3842 frv*-*-*)
3843 conftest_s='
3844 .section ".tdata","awT",@progbits
3845 x: .long 25
3846 .text
3847 call #gettlsoff(x)'
3848 ;;
3849 hppa*-*-linux*)
3850 conftest_s='
3851 t1: .reg %r20
3852 t2: .reg %r21
3853 gp: .reg %r19
3854 .section ".tdata","awT",@progbits
3855 foo: .long 25
3856 .text
3857 .align 4
3858 addil LT%foo-$tls_gdidx$,gp
3859 ldo RT%foo-$tls_gdidx$(%r1),%arg0
3860 b __tls_get_addr
3861 nop
3862 addil LT%foo-$tls_ldidx$,gp
3863 b __tls_get_addr
3864 ldo RT%foo-$tls_ldidx$(%r1),%arg0
3865 addil LR%foo-$tls_dtpoff$,%ret0
3866 ldo RR%foo-$tls_dtpoff$(%r1),%t1
3867 mfctl %cr27,%t1
3868 addil LT%foo-$tls_ieoff$,gp
3869 ldw RT%foo-$tls_ieoff$(%r1),%t2
3870 add %t1,%t2,%t3
3871 mfctl %cr27,%t1
3872 addil LR%foo-$tls_leoff$,%t1
3873 ldo RR%foo-$tls_leoff$(%r1),%t2'
3874 tls_as_opt=--fatal-warnings
3875 ;;
3876 arm*-*-*)
3877 conftest_s='
3878 .section ".tdata","awT",%progbits
3879 foo: .long 25
3880 .text
3881 .word foo(gottpoff)
3882 .word foo(tpoff)
3883 .word foo(tlsgd)
3884 .word foo(tlsldm)
3885 .word foo(tlsldo)'
3886 ;;
3887 i[34567]86-*-* | x86_64-*-*)
3888 case "$target" in
3889 i[34567]86-*-solaris2.* | x86_64-*-solaris2.*)
3890 on_solaris=yes
3891 ;;
3892 *)
3893 on_solaris=no
3894 ;;
3895 esac
3896 if test x$on_solaris = xyes && test x$gas_flag = xno; then
3897 conftest_s='
3898 .section .tdata,"awt",@progbits'
3899 tls_section_flag=t
3900 changequote([,])dnl
3901 AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
3902 [Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
3903 changequote(,)dnl
3904 else
3905 conftest_s='
3906 .section ".tdata","awT",@progbits'
3907 tls_section_flag=T
3908 tls_as_opt="--fatal-warnings"
3909 fi
3910 case "$target" in
3911 i[34567]86-*-*)
3912 if test x$on_solaris = xyes; then
3913 case $gas_flag in
3914 yes) tls_as_opt="$tls_as_opt --32" ;;
3915 esac
3916 fi
3917 conftest_s="$conftest_s
3918 foo: .long 25
3919 .text
3920 movl %gs:0, %eax
3921 leal foo@tlsgd(,%ebx,1), %eax
3922 leal foo@tlsldm(%ebx), %eax
3923 leal foo@dtpoff(%eax), %edx
3924 movl foo@gottpoff(%ebx), %eax
3925 subl foo@gottpoff(%ebx), %eax
3926 addl foo@gotntpoff(%ebx), %eax
3927 movl foo@indntpoff, %eax
3928 movl \$foo@tpoff, %eax
3929 subl \$foo@tpoff, %eax
3930 leal foo@ntpoff(%ecx), %eax"
3931 ;;
3932 x86_64-*-*)
3933 if test x$on_solaris = xyes; then
3934 case $gas_flag in
3935 yes) tls_as_opt="$tls_as_opt --64" ;;
3936 no) tls_as_opt="$tls_as_opt -xarch=amd64" ;;
3937 esac
3938 fi
3939 conftest_s="$conftest_s
3940 foo: .long 25
3941 .text
3942 movq %fs:0, %rax
3943 leaq foo@tlsgd(%rip), %rdi
3944 leaq foo@tlsld(%rip), %rdi
3945 leaq foo@dtpoff(%rax), %rdx
3946 movq foo@gottpoff(%rip), %rax
3947 movq \$foo@tpoff, %rax"
3948 ;;
3949 esac
3950 ;;
3951 ia64-*-*)
3952 conftest_s='
3953 .section ".tdata","awT",@progbits
3954 foo: data8 25
3955 .text
3956 addl r16 = @ltoff(@dtpmod(foo#)), gp
3957 addl r17 = @ltoff(@dtprel(foo#)), gp
3958 addl r18 = @ltoff(@tprel(foo#)), gp
3959 addl r19 = @dtprel(foo#), gp
3960 adds r21 = @dtprel(foo#), r13
3961 movl r23 = @dtprel(foo#)
3962 addl r20 = @tprel(foo#), gp
3963 adds r22 = @tprel(foo#), r13
3964 movl r24 = @tprel(foo#)'
3965 tls_as_opt=--fatal-warnings
3966 ;;
3967 loongarch*-*-*)
3968 conftest_s='
3969 .section .tdata,"awT",@progbits
3970 x: .word 2
3971 .text
3972 la.tls.gd $a0,x
3973 bl __tls_get_addr'
3974 tls_first_major=0
3975 tls_first_minor=0
3976 tls_as_opt='--fatal-warnings'
3977 ;;
3978 microblaze*-*-*)
3979 conftest_s='
3980 .section .tdata,"awT",@progbits
3981 x:
3982 .word 2
3983 .text
3984 addik r5,r20,x@TLSGD
3985 addik r5,r20,x@TLSLDM'
3986 tls_as_opt='--fatal-warnings'
3987 ;;
3988 mips*-*-*)
3989 conftest_s='
3990 .section .tdata,"awT",@progbits
3991 x:
3992 .word 2
3993 .text
3994 addiu $4, $28, %tlsgd(x)
3995 addiu $4, $28, %tlsldm(x)
3996 lui $4, %dtprel_hi(x)
3997 addiu $4, $4, %dtprel_lo(x)
3998 lw $4, %gottprel(x)($28)
3999 lui $4, %tprel_hi(x)
4000 addiu $4, $4, %tprel_lo(x)'
4001 tls_as_opt='-32 --fatal-warnings'
4002 ;;
4003 m68k-*-*)
4004 conftest_s='
4005 .section .tdata,"awT",@progbits
4006 x:
4007 .word 2
4008 .text
4009 foo:
4010 move.l x@TLSGD(%a5),%a0
4011 move.l x@TLSLDM(%a5),%a0
4012 move.l x@TLSLDO(%a5),%a0
4013 move.l x@TLSIE(%a5),%a0
4014 move.l x@TLSLE(%a5),%a0'
4015 tls_as_opt='--fatal-warnings'
4016 ;;
4017 aarch64*-*-*)
4018 conftest_s='
4019 .section ".tdata","awT",%progbits
4020 foo: .long 25
4021 .text
4022 adrp x0, :tlsgd:x
4023 add x0, x0, #:tlsgd_lo12:x
4024 bl __tls_get_addr
4025 nop'
4026 tls_as_opt='--fatal-warnings'
4027 ;;
4028 or1k*-*-*)
4029 conftest_s='
4030 .section ".tdata","awT",@progbits
4031 foo: .long 25
4032 .text
4033 l.movhi r3, tpoffha(foo)
4034 l.add r3, r3, r10
4035 l.lwz r4, tpofflo(foo)(r3)'
4036 tls_as_opt=--fatal-warnings
4037 ;;
4038 powerpc-ibm-aix*)
4039 conftest_s='
4040 .extern __get_tpointer
4041 .toc
4042 LC..1:
4043 .tc a[TC],a[TL]@le
4044 .csect .text[PR]
4045 .tlstest:
4046 lwz 9,LC..1(2)
4047 bla __get_tpointer
4048 lwzx 3,9,3
4049 .globl a
4050 .csect a[TL],4
4051 a:
4052 .space 4'
4053 ;;
4054 powerpc64*-*-*)
4055 conftest_s='
4056 .section ".tdata","awT",@progbits
4057 .align 3
4058 ld0: .space 8
4059 ld1: .space 8
4060 x1: .space 8
4061 x2: .space 8
4062 x3: .space 8
4063 .text
4064 addi 3,2,ld0@got@tlsgd
4065 bl .__tls_get_addr
4066 nop
4067 addi 3,2,ld1@toc
4068 bl .__tls_get_addr
4069 nop
4070 addi 3,2,x1@got@tlsld
4071 bl .__tls_get_addr
4072 nop
4073 addi 9,3,x1@dtprel
4074 bl .__tls_get_addr
4075 nop
4076 addis 9,3,x2@dtprel@ha
4077 addi 9,9,x2@dtprel@l
4078 bl .__tls_get_addr
4079 nop
4080 ld 9,x3@got@dtprel(2)
4081 add 9,9,3
4082 bl .__tls_get_addr
4083 nop'
4084 tls_as_opt="-a64 --fatal-warnings"
4085 ;;
4086 powerpc*-*-*)
4087 conftest_s='
4088 .section ".tdata","awT",@progbits
4089 .align 2
4090 ld0: .space 4
4091 ld1: .space 4
4092 x1: .space 4
4093 x2: .space 4
4094 x3: .space 4
4095 .text
4096 addi 3,31,ld0@got@tlsgd
4097 bl __tls_get_addr
4098 addi 3,31,x1@got@tlsld
4099 bl __tls_get_addr
4100 addi 9,3,x1@dtprel
4101 addis 9,3,x2@dtprel@ha
4102 addi 9,9,x2@dtprel@l
4103 lwz 9,x3@got@tprel(31)
4104 add 9,9,x@tls
4105 addi 9,2,x1@tprel
4106 addis 9,2,x2@tprel@ha
4107 addi 9,9,x2@tprel@l'
4108 tls_as_opt="-a32 --fatal-warnings"
4109 ;;
4110 riscv*-*-*)
4111 conftest_s='
4112 .section .tdata,"awT",@progbits
4113 x: .word 2
4114 .text
4115 la.tls.gd a0,x
4116 call __tls_get_addr'
4117 tls_as_opt='--fatal-warnings'
4118 ;;
4119 s390-*-*)
4120 conftest_s='
4121 .section ".tdata","awT",@progbits
4122 foo: .long 25
4123 .text
4124 .long foo@TLSGD
4125 .long foo@TLSLDM
4126 .long foo@DTPOFF
4127 .long foo@NTPOFF
4128 .long foo@GOTNTPOFF
4129 .long foo@INDNTPOFF
4130 l %r1,foo@GOTNTPOFF(%r12)
4131 l %r1,0(%r1):tls_load:foo
4132 bas %r14,0(%r1,%r13):tls_gdcall:foo
4133 bas %r14,0(%r1,%r13):tls_ldcall:foo'
4134 tls_as_opt="-m31 --fatal-warnings"
4135 ;;
4136 s390x-*-*)
4137 conftest_s='
4138 .section ".tdata","awT",@progbits
4139 foo: .long 25
4140 .text
4141 .quad foo@TLSGD
4142 .quad foo@TLSLDM
4143 .quad foo@DTPOFF
4144 .quad foo@NTPOFF
4145 .quad foo@GOTNTPOFF
4146 lg %r1,foo@GOTNTPOFF(%r12)
4147 larl %r1,foo@INDNTPOFF
4148 brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo
4149 brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo'
4150 tls_as_opt="-m64 -Aesame --fatal-warnings"
4151 ;;
4152 sh-*-* | sh[123456789lbe]*-*-*)
4153 conftest_s='
4154 .section ".tdata","awT",@progbits
4155 foo: .long 25
4156 .text
4157 .long foo@TLSGD
4158 .long foo@TLSLDM
4159 .long foo@DTPOFF
4160 .long foo@GOTTPOFF
4161 .long foo@TPOFF'
4162 tls_as_opt=--fatal-warnings
4163 ;;
4164 sparc*-*-*)
4165 case "$target" in
4166 sparc*-sun-solaris2.*)
4167 on_solaris=yes
4168 ;;
4169 *)
4170 on_solaris=no
4171 ;;
4172 esac
4173 if test x$on_solaris = xyes && test x$gas_flag = xno; then
4174 conftest_s='
4175 .section ".tdata",#alloc,#write,#tls'
4176 else
4177 conftest_s='
4178 .section ".tdata","awT",@progbits'
4179 tls_as_opt="-32 --fatal-warnings"
4180 fi
4181 conftest_s="$conftest_s
4182 foo: .long 25
4183 .text
4184 sethi %tgd_hi22(foo), %o0
4185 add %o0, %tgd_lo10(foo), %o1
4186 add %l7, %o1, %o0, %tgd_add(foo)
4187 call __tls_get_addr, %tgd_call(foo)
4188 sethi %tldm_hi22(foo), %l1
4189 add %l1, %tldm_lo10(foo), %l2
4190 add %l7, %l2, %o0, %tldm_add(foo)
4191 call __tls_get_addr, %tldm_call(foo)
4192 sethi %tldo_hix22(foo), %l3
4193 xor %l3, %tldo_lox10(foo), %l4
4194 add %o0, %l4, %l5, %tldo_add(foo)
4195 sethi %tie_hi22(foo), %o3
4196 add %o3, %tie_lo10(foo), %o3
4197 ld [%l7 + %o3], %o2, %tie_ld(foo)
4198 add %g7, %o2, %o4, %tie_add(foo)
4199 sethi %tle_hix22(foo), %l1
4200 xor %l1, %tle_lox10(foo), %o5
4201 ld [%g7 + %o5], %o1"
4202 ;;
4203 xtensa*-*-*)
4204 conftest_s='
4205 .section ".tdata","awT",@progbits
4206 foo: .long 25
4207 .text
4208 movi a8, foo@TLSFUNC
4209 movi a10, foo@TLSARG
4210 callx8.tls a8, foo@TLSCALL'
4211 ;;
4212 changequote([,])dnl
4213 esac
4214 set_have_as_tls=no
4215 if test "x$enable_tls" = xno ; then
4216 : # TLS explicitly disabled.
4217 elif test "x$enable_tls" = xyes ; then
4218 set_have_as_tls=yes # TLS explicitly enabled.
4219 elif test -z "$conftest_s"; then
4220 : # If we don't have a check, assume no support.
4221 else
4222 gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
4223 [$tls_as_opt], [$conftest_s],,
4224 [set_have_as_tls=yes])
4225 fi
4226 if test $set_have_as_tls = yes ; then
4227 AC_DEFINE(HAVE_AS_TLS, 1,
4228 [Define if your assembler and linker support thread-local storage.])
4229 fi
4230
4231 # Target-specific assembler checks.
4232
4233 AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
4234 gcc_cv_ld_static_dynamic=no
4235 gcc_cv_ld_static_option='-Bstatic'
4236 gcc_cv_ld_dynamic_option='-Bdynamic'
4237 if test $in_tree_ld = yes ; then
4238 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2; then
4239 gcc_cv_ld_static_dynamic=yes
4240 fi
4241 elif test x$gcc_cv_ld != x; then
4242 # Check if linker supports -Bstatic/-Bdynamic option
4243 if $gcc_cv_ld --help 2>&1 | grep -- -Bstatic > /dev/null \
4244 && $gcc_cv_ld --help 2>&1 | grep -- -Bdynamic > /dev/null; then
4245 gcc_cv_ld_static_dynamic=yes
4246 else
4247 case "$target" in
4248 # AIX ld uses -b flags
4249 *-*-aix4.[[23]]* | *-*-aix[[5-9]]*)
4250 gcc_cv_ld_static_dynamic=yes
4251 gcc_cv_ld_static_option="-bstatic"
4252 gcc_cv_ld_dynamic_option="-bdynamic"
4253 ;;
4254 # HP-UX ld uses -a flags to select between shared and archive.
4255 *-*-hpux*)
4256 if test x"$gnu_ld" = xno; then
4257 gcc_cv_ld_static_dynamic=yes
4258 gcc_cv_ld_static_option="-aarchive_shared"
4259 gcc_cv_ld_dynamic_option="-adefault"
4260 fi
4261 ;;
4262 # Solaris 2 ld always supports -Bstatic/-Bdynamic.
4263 *-*-solaris2*)
4264 gcc_cv_ld_static_dynamic=yes
4265 ;;
4266 esac
4267 fi
4268 fi
4269 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
4270 AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
4271 [Define if your linker supports -Bstatic/-Bdynamic or equivalent options.])
4272 AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option",
4273 [Define to the linker option to disable use of shared objects.])
4274 AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option",
4275 [Define to the linker option to enable use of shared objects.])
4276 fi
4277 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
4278
4279 AC_MSG_CHECKING(linker --version-script option)
4280 gcc_cv_ld_version_script=no
4281 ld_version_script_option=''
4282 if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
4283 gcc_cv_ld_version_script=yes
4284 ld_version_script_option='--version-script'
4285 elif test x$gcc_cv_ld != x; then
4286 case "$target" in
4287 # Solaris 2 ld always supports -M. It also supports a subset of
4288 # --version-script since Solaris 11.4, but requires
4289 # -z gnu-version-script-compat to activate.
4290 *-*-solaris2*)
4291 gcc_cv_ld_version_script=yes
4292 ld_version_script_option='-M'
4293 ;;
4294 esac
4295 fi
4296 # Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
4297 AC_MSG_RESULT($gcc_cv_ld_version_script)
4298 AC_SUBST(ld_version_script_option)
4299
4300 AC_MSG_CHECKING(linker soname option)
4301 gcc_cv_ld_soname=no
4302 if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
4303 gcc_cv_ld_soname=yes
4304 ld_soname_option='-soname'
4305 elif test x$gcc_cv_ld != x; then
4306 case "$target" in
4307 *-*-darwin*)
4308 gcc_cv_ld_soname=yes
4309 ld_soname_option='-install_name'
4310 ;;
4311 # Solaris 2 ld always supports -h. It also supports --soname for GNU
4312 # ld compatiblity since some Solaris 10 update.
4313 *-*-solaris2*)
4314 gcc_cv_ld_soname=yes
4315 ld_soname_option='-h'
4316 ;;
4317 esac
4318 fi
4319 # Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
4320 AC_MSG_RESULT($gcc_cv_ld_soname)
4321 AC_SUBST(ld_soname_option)
4322
4323 if test x"$demangler_in_ld" = xyes; then
4324 AC_MSG_CHECKING(linker --demangle support)
4325 gcc_cv_ld_demangle=no
4326 if test $in_tree_ld = yes; then
4327 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 14 -o "$gcc_cv_gld_major_version" -gt 2; then \
4328 gcc_cv_ld_demangle=yes
4329 fi
4330 elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
4331 # Check if the GNU linker supports --demangle option
4332 if $gcc_cv_ld --help 2>&1 | grep no-demangle > /dev/null; then
4333 gcc_cv_ld_demangle=yes
4334 fi
4335 fi
4336 if test x"$gcc_cv_ld_demangle" = xyes; then
4337 AC_DEFINE(HAVE_LD_DEMANGLE, 1,
4338 [Define if your linker supports --demangle option.])
4339 fi
4340 AC_MSG_RESULT($gcc_cv_ld_demangle)
4341 fi
4342
4343 AC_MSG_CHECKING(linker plugin support)
4344 gcc_cv_lto_plugin=0
4345 if test -f liblto_plugin.la; then
4346 save_ld_ver="$ld_ver"
4347 save_ld_vers_major="$ld_vers_major"
4348 save_ld_vers_minor="$ld_vers_minor"
4349 save_ld_is_gold="$ld_is_gold"
4350
4351 ld_is_gold=no
4352
4353 if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
4354 ld_ver="GNU ld"
4355 # FIXME: ld_is_gold?
4356 ld_vers_major="$gcc_cv_gld_major_version"
4357 ld_vers_minor="$gcc_cv_gld_minor_version"
4358 else
4359 # Determine plugin linker version.
4360 # FIXME: Partial duplicate from above, generalize.
4361 changequote(,)dnl
4362 ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
4363 if echo "$ld_ver" | grep GNU > /dev/null; then
4364 if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
4365 ld_is_gold=yes
4366 ld_vers=`echo $ld_ver | sed -n \
4367 -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
4368 else
4369 ld_vers=`echo $ld_ver | sed -n \
4370 -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
4371 fi
4372 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
4373 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
4374 fi
4375 changequote([,])dnl
4376 fi
4377
4378 # Determine plugin support.
4379 if echo "$ld_ver" | grep GNU > /dev/null; then
4380 # Require GNU ld or gold 2.21+ for plugin support by default.
4381 if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
4382 gcc_cv_lto_plugin=2
4383 elif test "$ld_is_mold" = yes; then
4384 gcc_cv_lto_plugin=2
4385 # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20.
4386 elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then
4387 gcc_cv_lto_plugin=1
4388 fi
4389 fi
4390
4391 ld_ver="$save_ld_ver"
4392 ld_vers_major="$save_ld_vers_major"
4393 ld_vers_minor="$save_ld_vers_minor"
4394 ld_is_gold="$save_ld_is_gold"
4395 fi
4396 AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin,
4397 [Define to the level of your linker's plugin support.])
4398 AC_MSG_RESULT($gcc_cv_lto_plugin)
4399
4400 # Target OS-specific assembler checks.
4401
4402 case "$target_os" in
4403 darwin*)
4404 gcc_GAS_CHECK_FEATURE([-mmacosx-version-min option],
4405 gcc_cv_as_mmacosx_version_min,
4406 [-mmacosx-version-min=10.1], [.text],,
4407 [AC_DEFINE(HAVE_AS_MMACOSX_VERSION_MIN_OPTION, 1,
4408 [Define if your macOS assembler supports the -mmacos-version-min option.])])
4409 if test x$gcc_cv_as_mmacosx_version_min = "xyes"; then
4410 gcc_GAS_CHECK_FEATURE([.build_version],
4411 gcc_cv_as_darwin_build_version,
4412 [-mmacosx-version-min=10.14],
4413 [ .build_version macos, 10, 14 sdk_version 10, 14],,
4414 [AC_DEFINE(HAVE_AS_MACOS_BUILD_VERSION, 1,
4415 [Define if your macOS assembler supports .build_version directives])])
4416 fi
4417 ;;
4418 esac
4419
4420 # Target CPU-specific assembler checks.
4421
4422 case "$target" in
4423 aarch64*-*-*)
4424 gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,
4425 [-mabi=lp64], [.text],,,)
4426 if test x$gcc_cv_as_aarch64_mabi = xyes; then
4427 AC_DEFINE(HAVE_AS_MABI_OPTION, 1,
4428 [Define if your assembler supports the -mabi option.])
4429 else
4430 if test x$with_abi = xilp32; then
4431 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
4432 Upgrade the Assembler.])
4433 fi
4434 if test x"$with_multilib_list" = xdefault; then
4435 TM_MULTILIB_CONFIG=lp64
4436 else
4437 aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
4438 for aarch64_multilib in ${aarch64_multilibs}; do
4439 case ${aarch64_multilib} in
4440 ilp32)
4441 AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\
4442 Upgrade the Assembler.])
4443 ;;
4444 *)
4445 ;;
4446 esac
4447 done
4448 fi
4449 fi
4450 # Check if we have binutils support for relocations types needed by -fpic
4451 gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,,
4452 [
4453 .text
4454 ldr x0, [[x2, #:gotpage_lo15:globalsym]]
4455 ],,[AC_DEFINE(HAVE_AS_SMALL_PIC_RELOCS, 1,
4456 [Define if your assembler supports relocs needed by -fpic.])])
4457 # Enable Branch Target Identification Mechanism and Return Address
4458 # Signing by default.
4459 AC_ARG_ENABLE(standard-branch-protection,
4460 [
4461 AS_HELP_STRING([--enable-standard-branch-protection],
4462 [enable Branch Target Identification Mechanism, Return Address Signing, and Guarded Control Stack by default for AArch64])
4463 AS_HELP_STRING([--disable-standard-branch-protection],
4464 [disable Branch Target Identification Mechanism, Return Address Signing, and Guarded Control Stack by default for AArch64])
4465 ],
4466 [
4467 case $enableval in
4468 yes)
4469 tm_defines="${tm_defines} TARGET_ENABLE_BTI=1 TARGET_ENABLE_PAC_RET=1 TARGET_ENABLE_GCS=1"
4470 ;;
4471 no)
4472 ;;
4473 *)
4474 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-standard-branch-protection.\
4475 Valid choices are 'yes' and 'no'.])
4476 ;;
4477 esac
4478 ],
4479 [])
4480 # Enable default workaround for AArch64 Cortex-A53 erratum 835769.
4481 AC_ARG_ENABLE(fix-cortex-a53-835769,
4482 [
4483 AS_HELP_STRING([--enable-fix-cortex-a53-835769],
4484 [enable workaround for AArch64 Cortex-A53 erratum 835769 by default])
4485 AS_HELP_STRING([--disable-fix-cortex-a53-835769],
4486 [disable workaround for AArch64 Cortex-A53 erratum 835769 by default])
4487 ],
4488 [
4489 case $enableval in
4490 yes)
4491 tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1"
4492 ;;
4493 no)
4494 ;;
4495 *)
4496 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\
4497 Valid choices are 'yes' and 'no'.])
4498 ;;
4499
4500 esac
4501 ],
4502 [])
4503 # Enable default workaround for AArch64 Cortex-A53 erratum 843419.
4504 AC_ARG_ENABLE(fix-cortex-a53-843419,
4505 [
4506 AS_HELP_STRING([--enable-fix-cortex-a53-843419],
4507 [enable workaround for AArch64 Cortex-A53 erratum 843419 by default])
4508 AS_HELP_STRING([--disable-fix-cortex-a53-843419],
4509 [disable workaround for AArch64 Cortex-A53 erratum 843419 by default])
4510 ],
4511 [
4512 case $enableval in
4513 yes)
4514 tm_defines="${tm_defines} TARGET_FIX_ERR_A53_843419_DEFAULT=1"
4515 ;;
4516 no)
4517 ;;
4518 *)
4519 AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-843419.\
4520 Valid choices are 'yes' and 'no'.])
4521 ;;
4522
4523 esac
4524 ],
4525 [])
4526 ;;
4527
4528 # All TARGET_ABI_OSF targets.
4529 alpha*-*-linux* | alpha*-*-*bsd*)
4530 gcc_GAS_CHECK_FEATURE([explicit relocation support],
4531 gcc_cv_as_alpha_explicit_relocs,,
4532 [ .set nomacro
4533 .text
4534 extbl $3, $2, $3 !lituse_bytoff!1
4535 ldq $2, a($29) !literal!1
4536 ldq $4, b($29) !literal!2
4537 ldq_u $3, 0($2) !lituse_base!1
4538 ldq $27, f($29) !literal!5
4539 jsr $26, ($27), f !lituse_jsr!5
4540 ldah $29, 0($26) !gpdisp!3
4541 lda $0, c($29) !gprel
4542 ldah $1, d($29) !gprelhigh
4543 lda $1, d($1) !gprellow
4544 lda $29, 0($29) !gpdisp!3],,
4545 [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
4546 [Define if your assembler supports explicit relocations.])])
4547 gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
4548 gcc_cv_as_alpha_jsrdirect_relocs,,
4549 [ .set nomacro
4550 .text
4551 ldq $27, a($29) !literal!1
4552 jsr $26, ($27), a !lituse_jsrdirect!1],,
4553 [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
4554 [Define if your assembler supports the lituse_jsrdirect relocation.])])
4555 ;;
4556
4557 avr-*-*)
4558 gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,
4559 [--mlink-relax], [.text],,
4560 [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1,
4561 [Define if your avr assembler supports --mlink-relax option.])])
4562
4563 gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,
4564 [-mrmw], [.text],,
4565 [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
4566 [Define if your avr assembler supports -mrmw option.])])
4567
4568 gcc_GAS_CHECK_FEATURE([__gcc_isr pseudo instruction],
4569 gcc_cv_as_avr_mgccisr,
4570 [-mgcc-isr], [.text
4571 __gcc_isr 1
4572 __gcc_isr 2
4573 __gcc_isr 0,r24
4574 ],,
4575 [AC_DEFINE(HAVE_AS_AVR_MGCCISR_OPTION, 1,
4576 [Define if your avr assembler supports -mgcc-isr option.])])
4577
4578 avr_ld_ver="`$gcc_cv_ld -v | sed -e 's:^.* ::'`"
4579 # Check how default linker description file implements .rodata for
4580 # avrxmega3 (PR21472). avr-gcc assumes .rodata is *not* loaded to
4581 # RAM so avr-gcc skips __do_copy_data for .rodata objects.
4582 AC_MSG_CHECKING(binutils for avrxmega3 .rodata support)
4583 cat > conftest.s <<EOF
4584 .section .rodata,"a",@progbits
4585 .global xxvaryy
4586 ;; avr-nm should print "... R xxvaryy", not "... D xxvaryy".
4587 xxvaryy:
4588 .word 1
4589 EOF
4590 rm -f conftest.nm
4591 AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega3 conftest.s -o conftest.o])
4592 AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega3 conftest.o -o conftest.elf])
4593 AC_TRY_COMMAND([$gcc_cv_nm conftest.elf > conftest.nm])
4594 if test -s conftest.nm
4595 then
4596 if grep ' R xxvaryy' conftest.nm > /dev/null; then
4597 AC_MSG_RESULT(yes)
4598 AC_DEFINE(HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH, 1,
4599 [Define if your default avr linker script for avrxmega3 leaves .rodata in flash.])
4600 else
4601 AC_MSG_RESULT(no: avrxmega3 .rodata located in RAM)
4602 echo "$as_me: nm output was" >&AS_MESSAGE_LOG_FD
4603 cat conftest.nm >&AS_MESSAGE_LOG_FD
4604 AC_MSG_WARN([[support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)]])
4605 fi
4606 else
4607 AC_MSG_RESULT(test failed)
4608 echo "$as_me: failed program was" >&AS_MESSAGE_LOG_FD
4609 cat conftest.s >&AS_MESSAGE_LOG_FD
4610 AC_MSG_WARN([[see `config.log' for details]])
4611 fi
4612 rm -f conftest.s conftest.o conftest.elf conftest.nm
4613
4614 # Check for emulation avrxmega2_flmap.
4615 AC_MSG_CHECKING(binutils for avrxmega2_flmap support (PR31124))
4616 cat > conftest.s <<EOF
4617 .section .text,"ax",@progbits
4618 ldi r16, __flmap_value_with_lock
4619 EOF
4620 AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega2 conftest.s -o conftest.o])
4621 AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega2_flmap conftest.o -o conftest.elf])
4622 if test -s conftest.elf
4623 then
4624 AC_MSG_RESULT(yes)
4625 AC_DEFINE(HAVE_LD_AVR_AVRXMEGA2_FLMAP, 1,
4626 [Define if your linker supports emulation avrxmega2_flmap.])
4627 else
4628 AC_MSG_RESULT(no)
4629 AC_MSG_WARN([[support for avrxmega2_flmap requires Binutils 2.42 or higher (have $avr_ld_ver)]])
4630 AC_MSG_WARN([[see `config.log' for details]])
4631 fi
4632 rm -f conftest.o conftest.elf
4633
4634 # Check for emulation avrxmega4_flmap.
4635 AC_MSG_CHECKING(binutils for avrxmega4_flmap support (PR31124))
4636 AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega4 conftest.s -o conftest.o])
4637 AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega4_flmap conftest.o -o conftest.elf])
4638 if test -s conftest.elf
4639 then
4640 AC_MSG_RESULT(yes)
4641 AC_DEFINE(HAVE_LD_AVR_AVRXMEGA4_FLMAP, 1,
4642 [Define if your linker supports emulation avrxmega4_flmap.])
4643 else
4644 AC_MSG_RESULT(no)
4645 AC_MSG_WARN([[support for avrxmega4_flmap requires Binutils 2.42 or higher (have $avr_ld_ver)]])
4646 AC_MSG_WARN([[see `config.log' for details]])
4647 fi
4648 rm -f conftest.s conftest.o conftest.elf
4649 ;;
4650
4651 cris-*-*)
4652 gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
4653 gcc_cv_as_cris_no_mul_bug,
4654 [-no-mul-bug-abort], [.text],,
4655 [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
4656 [Define if your assembler supports the -no-mul-bug-abort option.])])
4657 ;;
4658
4659 sparc*-*-*)
4660 gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,
4661 [-relax], [.text],,
4662 [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
4663 [Define if your assembler supports -relax option.])])
4664
4665 gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
4666 gcc_cv_as_sparc_gotdata_op,
4667 [-K PIC],
4668 [.text
4669 .align 4
4670 foo:
4671 nop
4672 bar:
4673 sethi %gdop_hix22(foo), %g1
4674 xor %g1, %gdop_lox10(foo), %g1
4675 ld [[%l7 + %g1]], %g2, %gdop(foo)],
4676 [if test x$gcc_cv_ld != x \
4677 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
4678 if test x$gcc_cv_objdump != x; then
4679 if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
4680 | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
4681 gcc_cv_as_sparc_gotdata_op=no
4682 else
4683 gcc_cv_as_sparc_gotdata_op=yes
4684 fi
4685 fi
4686 fi
4687 rm -f conftest],
4688 [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
4689 [Define if your assembler and linker support GOTDATA_OP relocs.])])
4690
4691 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
4692 gcc_cv_as_sparc_ua_pcrel,
4693 [-K PIC],
4694 [.text
4695 foo:
4696 nop
4697 .data
4698 .align 4
4699 .byte 0
4700 .uaword %r_disp32(foo)],
4701 [if test x$gcc_cv_ld != x \
4702 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
4703 gcc_cv_as_sparc_ua_pcrel=yes
4704 fi
4705 rm -f conftest],
4706 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
4707 [Define if your assembler and linker support unaligned PC relative relocs.])
4708
4709 gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
4710 gcc_cv_as_sparc_ua_pcrel_hidden,
4711 [-K PIC],
4712 [.data
4713 .align 4
4714 .byte 0x31
4715 .uaword %r_disp32(foo)
4716 .byte 0x32, 0x33, 0x34
4717 .global foo
4718 .hidden foo
4719 foo:
4720 .skip 4],
4721 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
4722 && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
4723 && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
4724 | grep ' 31000000 07323334' > /dev/null 2>&1; then
4725 if $gcc_cv_objdump -R conftest 2> /dev/null \
4726 | grep 'DISP32' > /dev/null 2>&1; then
4727 :
4728 else
4729 gcc_cv_as_sparc_ua_pcrel_hidden=yes
4730 fi
4731 fi
4732 rm -f conftest],
4733 [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
4734 [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
4735 ]) # unaligned pcrel relocs
4736
4737 gcc_GAS_CHECK_FEATURE([offsetable %lo()],
4738 gcc_cv_as_sparc_offsetable_lo10,
4739 [-xarch=v9],
4740 [.text
4741 or %g1, %lo(ab) + 12, %g1
4742 or %g1, %lo(ab + 12), %g1],
4743 [if test x$gcc_cv_objdump != x \
4744 && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
4745 | grep ' 82106000 82106000' > /dev/null 2>&1; then
4746 gcc_cv_as_sparc_offsetable_lo10=yes
4747 fi],
4748 [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
4749 [Define if your assembler supports offsetable %lo().])])
4750
4751 gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions],
4752 gcc_cv_as_sparc_fmaf,
4753 [-xarch=v9d],
4754 [.text
4755 .register %g2, #scratch
4756 .register %g3, #scratch
4757 .align 4
4758 fmaddd %f0, %f2, %f4, %f6
4759 addxccc %g1, %g2, %g3
4760 fsrl32 %f2, %f4, %f8
4761 fnaddd %f10, %f12, %f14],,
4762 [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1,
4763 [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])])
4764
4765 gcc_GAS_CHECK_FEATURE([SPARC4 instructions],
4766 gcc_cv_as_sparc_sparc4,
4767 [-xarch=sparc4],
4768 [.text
4769 .register %g2, #scratch
4770 .register %g3, #scratch
4771 .align 4
4772 cxbe %g2, %g3, 1f
4773 1: cwbneg %g2, %g3, 1f
4774 1: sha1
4775 md5
4776 aes_kexpand0 %f4, %f6, %f8
4777 des_round %f38, %f40, %f42, %f44
4778 camellia_f %f54, %f56, %f58, %f60
4779 kasumi_fi_xor %f46, %f48, %f50, %f52],,
4780 [AC_DEFINE(HAVE_AS_SPARC4, 1,
4781 [Define if your assembler supports SPARC4 instructions.])])
4782
4783 gcc_GAS_CHECK_FEATURE([SPARC5 and VIS 4.0 instructions],
4784 gcc_cv_as_sparc_sparc5,
4785 [-xarch=sparc5],
4786 [.text
4787 .register %g2, #scratch
4788 .register %g3, #scratch
4789 .align 4
4790 subxc %g1, %g2, %g3
4791 fpadd8 %f0, %f2, %f4],,
4792 [AC_DEFINE(HAVE_AS_SPARC5_VIS4, 1,
4793 [Define if your assembler supports SPARC5 and VIS 4.0 instructions.])])
4794
4795 gcc_GAS_CHECK_FEATURE([SPARC6 instructions],
4796 gcc_cv_as_sparc_sparc6,
4797 [-xarch=sparc6],
4798 [.text
4799 .register %g2, #scratch
4800 .register %g3, #scratch
4801 .align 4
4802 rd %entropy, %g1
4803 fpsll64x %f0, %f2, %f4],,
4804 [AC_DEFINE(HAVE_AS_SPARC6, 1,
4805 [Define if your assembler supports SPARC6 instructions.])])
4806
4807 gcc_GAS_CHECK_FEATURE([LEON instructions],
4808 gcc_cv_as_sparc_leon,
4809 [-Aleon],
4810 [.text
4811 .register %g2, #scratch
4812 .register %g3, #scratch
4813 .align 4
4814 smac %g2, %g3, %g1
4815 umac %g2, %g3, %g1
4816 casa [[%g2]] 0xb, %g3, %g1],,
4817 [AC_DEFINE(HAVE_AS_LEON, 1,
4818 [Define if your assembler supports LEON instructions.])])
4819 ;;
4820
4821 changequote(,)dnl
4822 i[34567]86-*-* | x86_64-*-*)
4823 changequote([,])dnl
4824 case $target_os in
4825 cygwin*)
4826 # Full C++ conformance when using a shared libstdc++-v3 requires some
4827 # support from the Cygwin DLL, which in more recent versions exports
4828 # wrappers to aid in interposing and redirecting operators new, delete,
4829 # etc., as per n2800 #17.6.4.6 [replacement.functions]. Check if we
4830 # are configuring for a version of Cygwin that exports the wrappers.
4831 if test x$host = x$target && test x$host_cpu = xi686; then
4832 AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
4833 else
4834 # Can't check presence of libc functions during cross-compile, so
4835 # we just have to assume we're building for an up-to-date target.
4836 gcc_ac_cygwin_dll_wrappers=yes
4837 fi
4838 AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
4839 [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
4840 [Define if you want to generate code by default that assumes that the
4841 Cygwin DLL exports wrappers to support libstdc++ function replacement.])
4842 esac
4843 case $target_os in
4844 cygwin* | pe | mingw32*)
4845 # Recent binutils allows the three-operand form of ".comm" on PE. This
4846 # definition is used unconditionally to initialise the default state of
4847 # the target option variable that governs usage of the feature.
4848 gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,,
4849 [.comm foo,1,32])
4850 AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
4851 [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
4852 [Define if your assembler supports specifying the alignment
4853 of objects allocated using the GAS .comm command.])
4854 # Used for DWARF 2 in PE
4855 gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
4856 gcc_cv_as_ix86_pe_secrel32,,
4857 [.text
4858 foo: nop
4859 .data
4860 .secrel32 foo],
4861 [if test x$gcc_cv_ld != x \
4862 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
4863 gcc_cv_as_ix86_pe_secrel32=yes
4864 fi
4865 rm -f conftest],
4866 [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
4867 [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
4868 # Test if the assembler supports the extended form of the .section
4869 # directive that specifies section alignment. LTO support uses this,
4870 # but normally only after installation, so we warn but don't fail the
4871 # configure if LTO is enabled but the assembler does not support it.
4872 gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align,
4873 -fatal-warnings,[.section lto_test,"dr0"])
4874 if test x$gcc_cv_as_section_has_align != xyes; then
4875 case ",$enable_languages," in
4876 *,lto,*)
4877 AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.])
4878 ;;
4879 esac
4880 fi
4881 ;;
4882 esac
4883 case $target_os in
4884 darwin2* | darwin19*)
4885 gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
4886 gcc_cv_as_mllvm_x86_pad_for_align,
4887 [-mllvm -x86-pad-for-align=false], [.text],,
4888 [AC_DEFINE(HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN, 1,
4889 [Define if your macOS assembler supports -mllvm -x86-pad-for-align=false.])])
4890 ;;
4891 esac
4892
4893 gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,
4894 [-xbrace_comment=no], [.text],,
4895 [AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1,
4896 [Define if your assembler supports -xbrace_comment option.])])
4897
4898 gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
4899 gcc_cv_as_ix86_filds,,
4900 [filds (%ebp); fists (%ebp)],,
4901 [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
4902 [Define if your assembler uses filds and fists mnemonics.])])
4903
4904 gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
4905 gcc_cv_as_ix86_fildq,,
4906 [fildq (%ebp); fistpq (%ebp)],,
4907 [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
4908 [Define if your assembler uses fildq and fistq mnemonics.])])
4909
4910 gcc_GAS_CHECK_FEATURE([cmov syntax],
4911 gcc_cv_as_ix86_cmov_sun_syntax,,
4912 [cmovl.l %edx, %eax],,
4913 [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
4914 [Define if your assembler supports the Sun syntax for cmov.])])
4915
4916 gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
4917 gcc_cv_as_ix86_ffreep,,
4918 [ffreep %st(1)],,
4919 [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
4920 [Define if your assembler supports the ffreep mnemonic.])])
4921
4922 gcc_GAS_CHECK_FEATURE([.quad directive],
4923 gcc_cv_as_ix86_quad,,
4924 [.quad 0],,
4925 [AC_DEFINE(HAVE_AS_IX86_QUAD, 1,
4926 [Define if your assembler supports the .quad directive.])])
4927
4928 gcc_GAS_CHECK_FEATURE([sahf mnemonic],
4929 gcc_cv_as_ix86_sahf,,
4930 [.code64
4931 sahf],,
4932 [AC_DEFINE(HAVE_AS_IX86_SAHF, 1,
4933 [Define if your assembler supports the sahf mnemonic in 64bit mode.])])
4934
4935 gcc_GAS_CHECK_FEATURE([interunit movq mnemonic],
4936 gcc_cv_as_ix86_interunit_movq,,
4937 [.code64
4938 movq %mm0, %rax
4939 movq %rax, %xmm0])
4940 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ,
4941 [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`],
4942 [Define if your assembler supports interunit movq mnemonic.])
4943
4944 gcc_GAS_CHECK_FEATURE([hle prefixes],
4945 gcc_cv_as_ix86_hle,,
4946 [lock xacquire cmpxchg %esi, (%ecx)],,
4947 [AC_DEFINE(HAVE_AS_IX86_HLE, 1,
4948 [Define if your assembler supports HLE prefixes.])])
4949
4950 gcc_GAS_CHECK_FEATURE([swap suffix],
4951 gcc_cv_as_ix86_swap,,
4952 [movl.s %esp, %ebp],,
4953 [AC_DEFINE(HAVE_AS_IX86_SWAP, 1,
4954 [Define if your assembler supports the swap suffix.])])
4955
4956 gcc_GAS_CHECK_FEATURE([different section symbol subtraction],
4957 gcc_cv_as_ix86_diff_sect_delta,,
4958 [.section .rodata
4959 .L1:
4960 .long .L2-.L1
4961 .long .L3-.L1
4962 .text
4963 .L3: nop
4964 .L2: nop],,
4965 [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1,
4966 [Define if your assembler supports the subtraction of symbols in different sections.])])
4967
4968 gcc_GAS_CHECK_FEATURE([rep and lock prefix],
4969 gcc_cv_as_ix86_rep_lock_prefix,,
4970 [rep movsl
4971 rep ret
4972 rep nop
4973 rep bsf %ecx, %eax
4974 rep bsr %ecx, %eax
4975 lock addl %edi, (%eax,%esi)
4976 lock orl $0, (%esp)],,
4977 [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1,
4978 [Define if the assembler supports 'rep <insn>, lock <insn>'.])])
4979
4980 gcc_GAS_CHECK_FEATURE([ud2 mnemonic],
4981 gcc_cv_as_ix86_ud2,,
4982 [ud2],,
4983 [AC_DEFINE(HAVE_AS_IX86_UD2, 1,
4984 [Define if your assembler supports the 'ud2' mnemonic.])])
4985
4986 # Enforce 32-bit output with gas and gld.
4987 if test x$gas = xyes; then
4988 as_ix86_gas_32_opt="--32"
4989 fi
4990 if echo "$ld_ver" | grep GNU > /dev/null; then
4991 if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
4992 ld_ix86_gld_32_opt="-melf_i386_sol2"
4993 else
4994 ld_ix86_gld_32_opt="-melf_i386"
4995 fi
4996 fi
4997
4998 gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
4999 gcc_cv_as_ix86_tlsgdplt,
5000 [$as_ix86_gas_32_opt],
5001 [call tls_gd@tlsgdplt],
5002 [if test x$gcc_cv_ld != x \
5003 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
5004 gcc_cv_as_ix86_tlsgdplt=yes
5005 fi
5006 rm -f conftest],
5007 [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1,
5008 [Define if your assembler and linker support @tlsgdplt.])])
5009
5010 conftest_s='
5011 .section .tdata,"aw'$tls_section_flag'",@progbits
5012 tls_ld:
5013 .section .text,"ax",@progbits
5014 call tls_ld@tlsldmplt'
5015
5016 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc],
5017 gcc_cv_as_ix86_tlsldmplt,
5018 [$as_ix86_gas_32_opt],
5019 [$conftest_s],
5020 [if test x$gcc_cv_ld != x \
5021 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
5022 gcc_cv_as_ix86_tlsldmplt=yes
5023 fi
5024 rm -f conftest])
5025 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT,
5026 [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`],
5027 [Define to 1 if your assembler and linker support @tlsldmplt.])
5028
5029 conftest_s='
5030 .section .text,"ax",@progbits
5031 .globl _start
5032 .type _start, @function
5033 _start:
5034 leal value@tlsldm(%ebx), %eax
5035 call ___tls_get_addr@plt
5036
5037 .section .tdata,"aw'$tls_section_flag'",@progbits
5038 .type value, @object
5039 value:'
5040 gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc],
5041 gcc_cv_as_ix86_tlsldm,
5042 [$as_ix86_gas_32_opt],
5043 [$conftest_s],
5044 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
5045 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then
5046 if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \
5047 || dis conftest 2>/dev/null | grep nop > /dev/null; then
5048 gcc_cv_as_ix86_tlsldm=yes
5049 fi
5050 fi
5051 rm -f conftest])
5052 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM,
5053 [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`],
5054 [Define to 1 if your assembler and linker support @tlsldm.])
5055
5056 conftest_s='
5057 .data
5058 bar:
5059 .byte 1
5060 .text
5061 .global _start
5062 _start:
5063 cmpl $0, bar@GOT
5064 jmp *_start@GOT'
5065 gcc_GAS_CHECK_FEATURE([R_386_GOT32X reloc],
5066 gcc_cv_as_ix86_got32x,
5067 [$as_ix86_gas_32_opt],
5068 [$conftest_s],
5069 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
5070 && test x$gcc_cv_readelf != x \
5071 && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
5072 | grep R_386_GOT32X > /dev/null 2>&1 \
5073 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then
5074 if $gcc_cv_objdump -dw conftest 2>&1 \
5075 | grep 0xffffff > /dev/null 2>&1; then
5076 gcc_cv_as_ix86_got32x=no
5077 else
5078 gcc_cv_as_ix86_got32x=yes
5079 fi
5080 fi
5081 rm -f conftest])
5082 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_GOT32X,
5083 [`if test x"$gcc_cv_as_ix86_got32x" = xyes; then echo 1; else echo 0; fi`],
5084 [Define 0/1 if your assembler and linker support @GOT.])
5085
5086 # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15"
5087 # with R_X86_64_CODE_6_GOTTPOFF relocation.
5088 if echo "$ld_ver" | grep GNU > /dev/null; then
5089 if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then
5090 ld_ix86_gld_64_opt="-melf_x86_64_sol2"
5091 else
5092 ld_ix86_gld_64_opt="-melf_x86_64"
5093 fi
5094 fi
5095 # Enforce 64-bit output with gas and gld.
5096 if test x$gas = xyes; then
5097 as_ix86_gas_64_opt="--64"
5098 fi
5099 conftest_s='
5100 .text
5101 .globl _start
5102 .type _start, @function
5103 _start:
5104 addq %r23,foo@GOTTPOFF(%rip), %r15
5105 .section .tdata,"awT",@progbits
5106 .type foo, @object
5107 foo:
5108 .quad 0'
5109 gcc_GAS_CHECK_FEATURE([R_X86_64_CODE_6_GOTTPOFF reloc],
5110 gcc_cv_as_x86_64_code_6_gottpoff,
5111 [$as_ix86_gas_64_opt],
5112 [$conftest_s],
5113 [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
5114 && test x$gcc_cv_readelf != x \
5115 && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
5116 | grep R_X86_64_CODE_6_GOTTPOFF > /dev/null 2>&1 \
5117 && $gcc_cv_ld $ld_ix86_gld_64_opt -o conftest conftest.o > /dev/null 2>&1; then
5118 if $gcc_cv_objdump -dw conftest 2>&1 \
5119 | grep "add \+\$0xf\+8,%r23,%r15" > /dev/null 2>&1; then
5120 gcc_cv_as_x86_64_code_6_gottpoff=yes
5121 else
5122 gcc_cv_as_x86_64_code_6_gottpoff=no
5123 fi
5124 fi
5125 rm -f conftest])
5126 AC_DEFINE_UNQUOTED(HAVE_AS_R_X86_64_CODE_6_GOTTPOFF,
5127 [`if test x"$gcc_cv_as_x86_64_code_6_gottpoff" = xyes; then echo 1; else echo 0; fi`],
5128 [Define 0/1 if your assembler and linker support R_X86_64_CODE_6_GOTTPOFF.])
5129
5130 gcc_GAS_CHECK_FEATURE([GOTOFF in data],
5131 gcc_cv_as_ix86_gotoff_in_data,
5132 [$as_ix86_gas_32_opt],
5133 [ .text
5134 .L0:
5135 nop
5136 .data
5137 .long .L0@GOTOFF])
5138 AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
5139 [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
5140 [Define true if the assembler supports '.long foo@GOTOFF'.])
5141
5142 conftest_s='
5143 .section .text,"ax",@progbits
5144 .globl _start
5145 .type _start, @function
5146 _start:
5147 leal ld@tlsldm(%ecx), %eax
5148 call *___tls_get_addr@GOT(%ecx)
5149 leal gd@tlsgd(%ecx), %eax
5150 call *___tls_get_addr@GOT(%ecx)
5151
5152 .section .tdata,"aw'$tls_section_flag'",@progbits
5153 .type ld, @object
5154 ld:
5155 .byte 0
5156 .globl gd
5157 .type gd, @object
5158 gd:
5159 .byte 0'
5160 gcc_GAS_CHECK_FEATURE([calling ___tls_get_addr via GOT],
5161 gcc_cv_as_ix86_tls_get_addr_via_got,
5162 [$as_ix86_gas_32_opt],
5163 [$conftest_s],
5164 [if test x$gcc_cv_ld != x \
5165 && $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then
5166 gcc_cv_as_ix86_tls_get_addr_via_got=yes
5167 fi
5168 rm -f conftest])
5169 AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLS_GET_ADDR_GOT,
5170 [`if test x"$gcc_cv_as_ix86_tls_get_addr_via_got" = xyes; then echo 1; else echo 0; fi`],
5171 [Define 0/1 if your assembler and linker support calling ___tls_get_addr via GOT.])
5172 ;;
5173
5174 ia64*-*-*)
5175 gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
5176 gcc_cv_as_ia64_ltoffx_ldxmov_relocs,,
5177 [ .text
5178 addl r15 = @ltoffx(x#), gp
5179 ;;
5180 ld8.mov r16 = [[r15]], x#
5181 ],,
5182 [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
5183 [Define if your assembler supports ltoffx and ldxmov relocations.])])
5184
5185 ;;
5186
5187 powerpc*-*-*)
5188
5189 case $target in
5190 *-*-darwin*)
5191 gcc_GAS_CHECK_FEATURE([.machine directive support],
5192 gcc_cv_as_machine_directive,,
5193 [ .machine ppc7400])
5194 if test x$gcc_cv_as_machine_directive != xyes; then
5195 echo "*** This target requires an assembler supporting \".machine\"" >&2
5196 echo you can get it from: https://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
5197 test x$build = x$target && exit 1
5198 fi
5199 ;;
5200 esac
5201
5202 case $target in
5203 *-*-aix*) conftest_s=' .machine "pwr5"
5204 .csect .text[[PR]]
5205 mfcr 3,128';;
5206 *-*-darwin*) conftest_s=' .text
5207 mfcr r3,128';;
5208 *) conftest_s=' .machine power4
5209 .text
5210 mfcr 3,128';;
5211 esac
5212
5213 gcc_GAS_CHECK_FEATURE([mfcr field support],
5214 gcc_cv_as_powerpc_mfcrf,,
5215 [$conftest_s],,
5216 [AC_DEFINE(HAVE_AS_MFCRF, 1,
5217 [Define if your assembler supports mfcr field.])])
5218
5219 case $target in
5220 *-*-aix*) conftest_s=' .machine "pwr10"
5221 .csect .text[[PR]]
5222 tend. 0';;
5223 *-*-darwin*) conftest_s=' .text
5224 tend. 0';;
5225 *) conftest_s=' .machine power10
5226 .text
5227 tend. 0';;
5228 esac
5229
5230 gcc_GAS_CHECK_FEATURE([htm support on Power10],
5231 gcc_cv_as_power10_htm,,
5232 [$conftest_s],,
5233 [AC_DEFINE(HAVE_AS_POWER10_HTM, 1,
5234 [Define if your assembler supports htm insns on power10.])])
5235
5236 case $target in
5237 *-*-aix*) conftest_s=' .csect .text[[PR]]
5238 LCF..0:
5239 addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
5240 *-*-darwin*)
5241 conftest_s=' .text
5242 LCF0:
5243 addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
5244 *) conftest_s=' .text
5245 .LCF0:
5246 addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
5247 esac
5248
5249 gcc_GAS_CHECK_FEATURE([rel16 relocs],
5250 gcc_cv_as_powerpc_rel16, -a32,
5251 [$conftest_s],,
5252 [AC_DEFINE(HAVE_AS_REL16, 1,
5253 [Define if your assembler supports R_PPC_REL16 relocs.])])
5254
5255 case $target in
5256 *-*-aix*) conftest_s=' .machine "pwr7"
5257 .csect .text[[PR]]
5258 lxvd2x 1,2,3';;
5259 *) conftest_s=' .machine power7
5260 .text
5261 lxvd2x 1,2,3';;
5262 esac
5263
5264 gcc_GAS_CHECK_FEATURE([vector-scalar support],
5265 gcc_cv_as_powerpc_vsx, -a32,
5266 [$conftest_s],,
5267 [AC_DEFINE(HAVE_AS_VSX, 1,
5268 [Define if your assembler supports VSX instructions.])])
5269
5270 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5271 gcc_cv_as_powerpc_gnu_attribute,,
5272 [.gnu_attribute 4,1],,
5273 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5274 [Define if your assembler supports .gnu_attribute.])])
5275
5276 gcc_GAS_CHECK_FEATURE([prologue entry point marker support],
5277 gcc_cv_as_powerpc_entry_markers,-a64 --fatal-warnings,
5278 [ .reloc .,R_PPC64_ENTRY; nop],,
5279 [AC_DEFINE(HAVE_AS_ENTRY_MARKERS, 1,
5280 [Define if your assembler supports the R_PPC64_ENTRY relocation.])])
5281
5282 gcc_GAS_CHECK_FEATURE([plt sequence marker support],
5283 gcc_cv_as_powerpc_pltseq_markers,-a32 --fatal-warnings,
5284 [ .reloc .,R_PPC_PLTSEQ; nop],,
5285 [AC_DEFINE(HAVE_AS_PLTSEQ, 1,
5286 [Define if your assembler supports R_PPC*_PLTSEQ relocations.])])
5287
5288 case $target in
5289 *-*-aix*)
5290 gcc_GAS_CHECK_FEATURE([AIX .ref support],
5291 gcc_cv_as_aix_ref,,
5292 [ .csect stuff[[rw]]
5293 stuff:
5294 .long 1
5295 .extern sym
5296 .ref sym
5297 ],,
5298 [AC_DEFINE(HAVE_AS_REF, 1,
5299 [Define if your assembler supports .ref])])
5300
5301 gcc_GAS_CHECK_FEATURE([AIX DWARF location lists section support],
5302 gcc_cv_as_aix_dwloc,,
5303 [ .dwsect 0xA0000
5304 Lframe..0:
5305 .vbyte 4,Lframe..0
5306 ],,
5307 [AC_DEFINE(HAVE_XCOFF_DWARF_EXTRAS, 1,
5308 [Define if your assembler supports AIX debug frame section label reference.])])
5309 ;;
5310 esac
5311 ;;
5312
5313 mips*-*-*)
5314 gcc_GAS_CHECK_FEATURE([explicit relocation support: %pcrel_hi/%pcrel_lo],
5315 gcc_cv_as_mips_explicit_relocs_pcrel,,
5316 [ lui $4,%pcrel_hi(foo)],,
5317 [AC_DEFINE(MIPS_EXPLICIT_RELOCS, MIPS_EXPLICIT_RELOCS_PCREL,
5318 [Define if assembler supports %pcrel_hi/%pcrel_lo.])])
5319
5320 if test x$gcc_cv_as_mips_explicit_relocs_pcrel = xno; then \
5321 gcc_GAS_CHECK_FEATURE([explicit relocation support: %gp_rel],
5322 gcc_cv_as_mips_explicit_relocs,,
5323 [ lw $4,%gp_rel(foo)($4)],,
5324 [AC_DEFINE(MIPS_EXPLICIT_RELOCS, MIPS_EXPLICIT_RELOCS_BASE,
5325 [Define if assembler supports %reloc.])])
5326 else
5327 gcc_cv_as_mips_explicit_relocs=yes
5328 fi
5329
5330 if test x$gcc_cv_as_mips_explicit_relocs = xno; then \
5331 AC_DEFINE(MIPS_EXPLICIT_RELOCS, MIPS_EXPLICIT_RELOCS_NONE,
5332 [Define if assembler supports %reloc.])
5333 fi
5334
5335 gcc_GAS_CHECK_FEATURE([-mno-shared support],
5336 gcc_cv_as_mips_no_shared,[-mno-shared], [nop],,
5337 [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
5338 [Define if the assembler understands -mno-shared.])])
5339
5340 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5341 gcc_cv_as_mips_gnu_attribute,,
5342 [.gnu_attribute 4,1],,
5343 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5344 [Define if your assembler supports .gnu_attribute.])])
5345
5346 gcc_GAS_CHECK_FEATURE([.module support],
5347 gcc_cv_as_mips_dot_module,[-32],
5348 [.module mips2
5349 .module fp=xx],,
5350 [AC_DEFINE(HAVE_AS_DOT_MODULE, 1,
5351 [Define if your assembler supports .module.])])
5352 if test x$gcc_cv_as_mips_dot_module = xno \
5353 && test x$with_fp_32 != x; then
5354 AC_MSG_ERROR(
5355 [Requesting --with-fp-32= requires assembler support for .module.])
5356 fi
5357
5358 gcc_GAS_CHECK_FEATURE([.micromips support],
5359 gcc_cv_as_micromips_support,[--fatal-warnings],
5360 [.set micromips],,
5361 [AC_DEFINE(HAVE_GAS_MICROMIPS, 1,
5362 [Define if your assembler supports the .set micromips directive])])
5363
5364 gcc_GAS_CHECK_FEATURE([.dtprelword support],
5365 gcc_cv_as_mips_dtprelword,,
5366 [.section .tdata,"awT",@progbits
5367 x:
5368 .word 2
5369 .text
5370 .dtprelword x+0x8000],,
5371 [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
5372 [Define if your assembler supports .dtprelword.])])
5373
5374 gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support],
5375 gcc_cv_as_mips_dspr1_mult,,
5376 [ .set mips32r2
5377 .set nodspr2
5378 .set dsp
5379 madd $ac3,$4,$5
5380 maddu $ac3,$4,$5
5381 msub $ac3,$4,$5
5382 msubu $ac3,$4,$5
5383 mult $ac3,$4,$5
5384 multu $ac3,$4,$5],,
5385 [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1,
5386 [Define if your assembler supports DSPR1 mult.])])
5387
5388 AC_MSG_CHECKING(assembler and linker for explicit JALR relocation)
5389 gcc_cv_as_ld_jalr_reloc=no
5390 if test $gcc_cv_as_mips_explicit_relocs = yes; then
5391 if test $in_tree_ld = yes ; then
5392 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 20 -o "$gcc_cv_gld_major_version" -gt 2 \
5393 && test $in_tree_ld_is_elf = yes; then
5394 gcc_cv_as_ld_jalr_reloc=yes
5395 fi
5396 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then
5397 echo ' .ent x' > conftest.s
5398 echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s
5399 echo ' lw $25,%call16(y)($28)' >> conftest.s
5400 echo ' .reloc 1f,R_MIPS_JALR,y' >> conftest.s
5401 echo '1: jalr $25' >> conftest.s
5402 echo ' .reloc 1f,R_MIPS_JALR,x' >> conftest.s
5403 echo '1: jalr $25' >> conftest.s
5404 echo ' .end x' >> conftest.s
5405 if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \
5406 && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then
5407 if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \
5408 && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then
5409 gcc_cv_as_ld_jalr_reloc=yes
5410 fi
5411 fi
5412 rm -f conftest.*
5413 fi
5414 fi
5415 if test $gcc_cv_as_ld_jalr_reloc = yes; then
5416 if test x$target_cpu_default = x; then
5417 target_cpu_default=MASK_RELAX_PIC_CALLS
5418 else
5419 target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
5420 fi
5421 fi
5422 AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
5423
5424 AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
5425 [gcc_cv_ld_mips_personality_relaxation],
5426 [gcc_cv_ld_mips_personality_relaxation=no
5427 if test $in_tree_ld = yes ; then
5428 if test "$gcc_cv_gld_major_version" -eq 2 \
5429 -a "$gcc_cv_gld_minor_version" -ge 21 \
5430 -o "$gcc_cv_gld_major_version" -gt 2; then
5431 gcc_cv_ld_mips_personality_relaxation=yes
5432 fi
5433 elif test x$gcc_cv_as != x \
5434 -a x$gcc_cv_ld != x \
5435 -a x$gcc_cv_readelf != x ; then
5436 cat > conftest.s <<EOF
5437 .cfi_startproc
5438 .cfi_personality 0x80,indirect_ptr
5439 .ent test
5440 test:
5441 nop
5442 .end test
5443 .cfi_endproc
5444
5445 .section .data,"aw",@progbits
5446 indirect_ptr:
5447 .dc.a personality
5448 EOF
5449 if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \
5450 && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then
5451 if $gcc_cv_readelf -d conftest 2>&1 \
5452 | grep TEXTREL > /dev/null 2>&1; then
5453 :
5454 elif $gcc_cv_readelf --relocs conftest 2>&1 \
5455 | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then
5456 :
5457 else
5458 gcc_cv_ld_mips_personality_relaxation=yes
5459 fi
5460 fi
5461 fi
5462 rm -f conftest.s conftest.o conftest])
5463 if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then
5464 AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1,
5465 [Define if your linker can relax absolute .eh_frame personality
5466 pointers into PC-relative form.])
5467 fi
5468
5469 gcc_GAS_CHECK_FEATURE([-mnan= support],
5470 gcc_cv_as_mips_nan,
5471 [-mnan=2008],,,
5472 [AC_DEFINE(HAVE_AS_NAN, 1,
5473 [Define if the assembler understands -mnan=.])])
5474 if test x$gcc_cv_as_mips_nan = xno \
5475 && test x$with_nan != x; then
5476 AC_MSG_ERROR(
5477 [Requesting --with-nan= requires assembler support for -mnan=])
5478 fi
5479 ;;
5480 msp430-*-*)
5481 # Earlier GAS versions generically support .gnu_attribute, but the
5482 # msp430 assembler will not do anything with it.
5483 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5484 gcc_cv_as_msp430_gnu_attribute,,
5485 [.gnu_attribute 4,1],,
5486 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5487 [Define if your assembler supports .gnu_attribute.])])
5488 gcc_GAS_CHECK_FEATURE([.mspabi_attribute support],
5489 gcc_cv_as_msp430_mspabi_attribute,,
5490 [.mspabi_attribute 4,2],,
5491 [AC_DEFINE(HAVE_AS_MSPABI_ATTRIBUTE, 1,
5492 [Define if your assembler supports .mspabi_attribute.])])
5493 if test x$enable_newlib_nano_formatted_io = xyes; then
5494 AC_DEFINE(HAVE_NEWLIB_NANO_FORMATTED_IO, 1, [Define if GCC has been
5495 configured with --enable-newlib-nano-formatted-io.])
5496 fi
5497 ;;
5498 riscv*-*-*)
5499 gcc_GAS_CHECK_FEATURE([.attribute support],
5500 gcc_cv_as_riscv_attribute,,
5501 [.attribute stack_align,4],,
5502 [AC_DEFINE(HAVE_AS_RISCV_ATTRIBUTE, 1,
5503 [Define if your assembler supports .attribute.])])
5504 gcc_GAS_CHECK_FEATURE([-misa-spec= support],
5505 gcc_cv_as_riscv_isa_spec,
5506 [-misa-spec=2.2],,,
5507 [AC_DEFINE(HAVE_AS_MISA_SPEC, 1,
5508 [Define if the assembler understands -misa-spec=.])])
5509 gcc_GAS_CHECK_FEATURE([-march=rv32i_zifencei support],
5510 gcc_cv_as_riscv_march_zifencei,
5511 [-march=rv32i_zifencei2p0],,,
5512 [AC_DEFINE(HAVE_AS_MARCH_ZIFENCEI, 1,
5513 [Define if the assembler understands -march=rv*_zifencei.])])
5514 gcc_GAS_CHECK_FEATURE([-march=rv32i_zaamo_zalrsc support],
5515 gcc_cv_as_riscv_march_zaamo_zalrsc,
5516 [-march=rv32i_zaamo_zalrsc],,,
5517 [AC_DEFINE(HAVE_AS_MARCH_ZAAMO_ZALRSC, 1,
5518 [Define if the assembler understands -march=rv*_zaamo_zalrsc.])])
5519 gcc_GAS_CHECK_FEATURE([-march=rv32i_b support],
5520 gcc_cv_as_riscv_march_b,
5521 [-march=rv32i_b],,,
5522 [AC_DEFINE(HAVE_AS_MARCH_B, 1,
5523 [Define if the assembler understands -march=rv*_b.])])
5524 ;;
5525 loongarch*-*-*)
5526 gcc_GAS_CHECK_FEATURE([.dtprelword support],
5527 gcc_cv_as_loongarch_dtprelword, [2,18,0],,
5528 [.section .tdata,"awT",@progbits
5529 x:
5530 .word 2
5531 .text
5532 .dtprelword x+0x8000],,
5533 [AC_DEFINE(HAVE_AS_DTPRELWORD, 1,
5534 [Define if your assembler supports .dtprelword.])])
5535 gcc_GAS_CHECK_FEATURE([explicit relocation support],
5536 gcc_cv_as_loongarch_explicit_relocs,,
5537 [a:pcalau12i $t0,%pc_hi20(a)],,
5538 [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
5539 [Define if your assembler supports explicit relocation.])])
5540 gcc_GAS_CHECK_FEATURE([call36 relocation support],
5541 gcc_cv_as_loongarch_call36,,
5542 [pcaddu18i $r1, %call36(a)
5543 jirl $r1, $r1, 0],,
5544 [AC_DEFINE(HAVE_AS_SUPPORT_CALL36, 1,
5545 [Define if your assembler supports call36 relocation.])])
5546 gcc_GAS_CHECK_FEATURE([eh_frame pcrel encoding support],
5547 gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support,,
5548 [.cfi_startproc
5549 .cfi_personality 0x9b,a
5550 .cfi_lsda 0x1b,b
5551 .cfi_endproc],,
5552 [AC_DEFINE(HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT, 1,
5553 [Define if your assembler supports eh_frame pcrel encoding.])])
5554 gcc_GAS_CHECK_FEATURE([-mrelax option], gcc_cv_as_loongarch_relax,
5555 [-mrelax], [.text],,
5556 [AC_DEFINE(HAVE_AS_MRELAX_OPTION, 1,
5557 [Define if your assembler supports -mrelax option.])])
5558 gcc_GAS_CHECK_FEATURE([conditional branch relaxation support],
5559 gcc_cv_as_loongarch_cond_branch_relax,
5560 [--fatal-warnings],
5561 [a:
5562 .rept 32769
5563 nop
5564 .endr
5565 beq $a0,$a1,a],,
5566 [AC_DEFINE(HAVE_AS_COND_BRANCH_RELAXATION, 1,
5567 [Define if your assembler supports conditional branch relaxation.])])
5568 gcc_GAS_CHECK_FEATURE([tls le relaxation support],
5569 gcc_cv_as_loongarch_tls_le_relaxation_support,,
5570 [lu12i.w $t0,%le_hi20_r(a)],,
5571 [AC_DEFINE(HAVE_AS_TLS_LE_RELAXATION, 1,
5572 [Define if your assembler supports tls le relocation.])])
5573 ;;
5574 s390*-*-*)
5575 gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
5576 gcc_cv_as_s390_gnu_attribute,,
5577 [.gnu_attribute 8,1],,
5578 [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
5579 [Define if your assembler supports .gnu_attribute.])])
5580 gcc_GAS_CHECK_FEATURE([.machine and .machinemode support],
5581 gcc_cv_as_s390_machine_machinemode,,
5582 [ .machinemode push
5583 .machinemode pop
5584 .machine push
5585 .machine pop],,
5586 [AC_DEFINE(HAVE_AS_MACHINE_MACHINEMODE, 1,
5587 [Define if your assembler supports .machine and .machinemode.])])
5588 gcc_GAS_CHECK_FEATURE([architecture modifiers support],
5589 gcc_cv_as_s390_architecture_modifiers,,
5590 [ .machine z13+vx ],,
5591 [AC_DEFINE(HAVE_AS_ARCHITECTURE_MODIFIERS, 1,
5592 [Define if your assembler supports architecture modifiers.])])
5593 gcc_GAS_CHECK_FEATURE([vector load/store alignment hints],
5594 gcc_cv_as_s390_vector_loadstore_alignment_hints,,
5595 [ vl %v24,0(%r15),3 ],,
5596 [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1,
5597 [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])])
5598 gcc_GAS_CHECK_FEATURE([vector load/store alignment hints on z13],
5599 gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13, [-mzarch -march=z13],
5600 [ vl %v24,0(%r15),3 ],,
5601 [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13, 1,
5602 [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument on z13.])])
5603
5604 ;;
5605 esac
5606
5607 # Mips, LoongArch and HP-UX need the GNU assembler.
5608 # Linux on IA64 might be able to use the Intel assembler.
5609
5610 case "$target" in
5611 mips*-*-* | loongarch*-*-* | *-*-hpux* )
5612 if test x$gas_flag = xyes \
5613 || test x"$host" != x"$build" \
5614 || test ! -x "$gcc_cv_as" \
5615 || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
5616 :
5617 else
5618 echo "*** This configuration requires the GNU assembler" >&2
5619 exit 1
5620 fi
5621 ;;
5622 esac
5623
5624 # AMD GCN needs the LLVM assembler and linker.
5625 # Test that LLVM is at least 13.0.1.
5626 case "$target" in
5627 amdgcn-* | gcn-*)
5628 AC_MSG_CHECKING(llvm assembler version)
5629 gcc_cv_as_version="unknown"
5630 if test x$gcc_cv_as != x; then
5631 gcc_cv_as_version=`$gcc_cv_as --version 2>&1 | sed -ne '/version/s/.* \([[0-9]]\)/\1/p' || echo error`
5632 case "$gcc_cv_as_version" in
5633 13.0.[[1-9]]*) ;; # 13.0.1+
5634 13.[[1-9]]*) ;; # 13.1+
5635 1[[4-9]]*) ;; # 14..19
5636 [[2-9]][[0-9]]*) ;; # 20..99
5637 [[1-9]][[0-9]][[0-9]]*) ;; # 100+
5638 error) AC_MSG_ERROR([cannot determine LLVM version]) ;;
5639 *) AC_MSG_ERROR([LLVM 13.0.1 or later is required (found LLVM $gcc_cv_as_version)]) ;;
5640 esac
5641 fi
5642 AC_MSG_RESULT([$gcc_cv_as_version, ok])
5643 ;;
5644 esac
5645
5646 case "$target" in
5647 arm*)
5648 gcc_GAS_CHECK_FEATURE([assembler for arm accepts context-specific architecture extensions],
5649 gcc_cv_as_arm_option_extensions,
5650 [-march=armv8.1-m.main+mve],
5651 [.text
5652 .thumb
5653 .syntax unified
5654 vmov.f32 s0, s1],,
5655 [AC_DEFINE(HAVE_GAS_ARM_EXTENDED_ARCH, 1,
5656 [Define if your Arm assembler permits context-specific feature extensions.])])
5657 esac
5658
5659 # ??? Not all targets support dwarf2 debug_line, even within a version
5660 # of gas. Moreover, we need to emit a valid instruction to trigger any
5661 # info to the output file. So, as supported targets are added to gas 2.11,
5662 # add some instruction here to (also) show we expect this might work.
5663 # ??? Once 2.11 is released, probably need to add first known working
5664 # version to the per-target configury.
5665 case "$cpu_type" in
5666 aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | loongarch | m32c \
5667 | m68k | microblaze | mips | nds32 | pa | riscv | rs6000 | score | sparc \
5668 | visium | xstormy16 | xtensa | ft32)
5669 insn="nop"
5670 ;;
5671 ia64 | s390)
5672 insn="nop 0"
5673 ;;
5674 mmix)
5675 insn="swym 0"
5676 ;;
5677 esac
5678 if test x"$insn" != x; then
5679 conftest_s="\
5680 .file 1 \"conftest.s\"
5681 .loc 1 3 0
5682 $insn"
5683 gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
5684 gcc_cv_as_dwarf2_debug_line,,
5685 [$conftest_s],
5686 [if test x$gcc_cv_objdump != x \
5687 && $gcc_cv_objdump -h conftest.o 2> /dev/null \
5688 | grep debug_line > /dev/null 2>&1; then
5689 gcc_cv_as_dwarf2_debug_line=yes
5690 elif test x$gcc_cv_otool != x \
5691 && $gcc_cv_otool -l conftest.o 2> /dev/null \
5692 | grep debug_line > /dev/null 2>&1; then
5693 gcc_cv_as_dwarf2_debug_line=yes
5694 fi])
5695
5696 # The .debug_line file table must be in the exact order that
5697 # we specified the files, since these indices are also used
5698 # by DW_AT_decl_file. Approximate this test by testing if
5699 # the assembler bitches if the same index is assigned twice.
5700 gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
5701 gcc_cv_as_dwarf2_file_buggy,,
5702 [ .file 1 "foo.s"
5703 .file 1 "bar.s"])
5704
5705 if test $gcc_cv_as_dwarf2_debug_line = yes \
5706 && test $gcc_cv_as_dwarf2_file_buggy = no; then
5707 AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
5708 [Define if your assembler supports dwarf2 .file/.loc directives,
5709 and preserves file table indices exactly as given.])
5710
5711 if test $gcc_cv_as_leb128 = yes; then
5712 conftest_s="\
5713 .file 1 \"conftest.s\"
5714 .loc 1 3 0 view .LVU1
5715 $insn
5716 .data
5717 .uleb128 .LVU1
5718 .uleb128 .LVU1
5719 "
5720 gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support],
5721 gcc_cv_as_dwarf2_debug_view,,
5722 [$conftest_s],,
5723 [AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1,
5724 [Define if your assembler supports views in dwarf2 .loc directives.])])
5725 fi
5726 fi
5727
5728 gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
5729 gcc_cv_as_gdwarf2_flag,
5730 [--gdwarf2], [$insn],,
5731 [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
5732 [Define if your assembler supports the --gdwarf2 option.])])
5733
5734 gcc_GAS_CHECK_FEATURE([--gdwarf-5 option],
5735 gcc_cv_as_gdwarf_5_flag,
5736 [--gdwarf-5], [$insn],
5737 [if test x$gcc_cv_objdump != x \
5738 && $gcc_cv_objdump -Wi conftest.o 2>&1 \
5739 | grep DW_TAG_compile_unit > /dev/null 2>&1; then
5740 gcc_cv_as_gdwarf_5_flag=yes;
5741 fi],[AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1,
5742 [Define if your assembler supports the --gdwarf-5 option.])])
5743
5744 case $target_os in
5745 win32 | pe | cygwin* | mingw32*)
5746 section_flags=\"dr\"
5747 function_type=".def foo; .scl 2; .type 32; .endef"
5748 function_size="";;
5749 *)
5750 section_flags=\"\",%progbits
5751 function_type=".type foo, %function"
5752 function_size=".size foo, .-foo";;
5753 esac
5754 dwarf4_debug_info_size=0x46
5755 dwarf4_high_pc_form=7
5756 dwarf4_debug_aranges_size=0x2c
5757 dwarf4_line_sz=9
5758 for dwarf4_addr_size in 8 4; do
5759 conftest_s="\
5760 .file \"a.c\"
5761 .text
5762 .Ltext0:
5763 .p2align 4
5764 .globl foo
5765 $function_type
5766 foo:
5767 .LFB0:
5768 .LM1:
5769 $insn
5770 .LM2:
5771 .LFE0:
5772 $function_size
5773 .Letext0:
5774 .section .debug_info,$section_flags
5775 .Ldebug_info0:
5776 .4byte $dwarf4_debug_info_size
5777 .2byte 0x4
5778 .4byte .Ldebug_abbrev0
5779 .byte 0x$dwarf4_addr_size
5780 .byte 0x1
5781 .ascii \"GNU C17\\0\"
5782 .byte 0xc
5783 .ascii \"a.c\\0\"
5784 .ascii \"/\\0\"
5785 .${dwarf4_addr_size}byte .Ltext0
5786 .${dwarf4_addr_size}byte .Letext0-.Ltext0
5787 .4byte .Ldebug_line0
5788 .byte 0x2
5789 .ascii \"foo\\0\"
5790 .byte 0x1
5791 .byte 0x2
5792 .byte 0x1
5793 .${dwarf4_addr_size}byte .LFB0
5794 .${dwarf4_addr_size}byte .LFE0-.LFB0
5795 .byte 0x1
5796 .byte 0x9c
5797 .byte 0
5798 .section .debug_abbrev,$section_flags
5799 .Ldebug_abbrev0:
5800 .byte 0x1
5801 .byte 0x11
5802 .byte 0x1
5803 .byte 0x25
5804 .byte 0x8
5805 .byte 0x13
5806 .byte 0xb
5807 .byte 0x3
5808 .byte 0x8
5809 .byte 0x1b
5810 .byte 0x8
5811 .byte 0x11
5812 .byte 0x1
5813 .byte 0x12
5814 .byte 0x$dwarf4_high_pc_form
5815 .byte 0x10
5816 .byte 0x17
5817 .byte 0
5818 .byte 0
5819 .byte 0x2
5820 .byte 0x2e
5821 .byte 0
5822 .byte 0x3f
5823 .byte 0x19
5824 .byte 0x3
5825 .byte 0x8
5826 .byte 0x3a
5827 .byte 0xb
5828 .byte 0x3b
5829 .byte 0xb
5830 .byte 0x39
5831 .byte 0xb
5832 .byte 0x11
5833 .byte 0x1
5834 .byte 0x12
5835 .byte 0x$dwarf4_high_pc_form
5836 .byte 0x40
5837 .byte 0x18
5838 .byte 0
5839 .byte 0
5840 .byte 0
5841 .section .debug_aranges,$section_flags
5842 .4byte $dwarf4_debug_aranges_size
5843 .2byte 0x2
5844 .4byte .Ldebug_info0
5845 .byte 0x8
5846 .byte 0
5847 .2byte 0
5848 .2byte 0
5849 .${dwarf4_addr_size}byte .Ltext0
5850 .${dwarf4_addr_size}byte .Letext0-.Ltext0
5851 .${dwarf4_addr_size}byte 0
5852 .${dwarf4_addr_size}byte 0
5853 .section .debug_line,$section_flags
5854 .Ldebug_line0:
5855 .4byte .LELT0-.LSLT0
5856 .LSLT0:
5857 .2byte 0x4
5858 .4byte .LELTP0-.LASLTP0
5859 .LASLTP0:
5860 .byte 0x1
5861 .byte 0x1
5862 .byte 0x1
5863 .byte 0xf6
5864 .byte 0xf2
5865 .byte 0xd
5866 .byte 0
5867 .byte 0x1
5868 .byte 0x1
5869 .byte 0x1
5870 .byte 0x1
5871 .byte 0
5872 .byte 0
5873 .byte 0
5874 .byte 0x1
5875 .byte 0
5876 .byte 0
5877 .byte 0x1
5878 .byte 0
5879 .ascii \"a.c\\0\"
5880 .byte 0
5881 .byte 0
5882 .byte 0
5883 .byte 0
5884 .LELTP0:
5885 .byte 0
5886 .byte 0x$dwarf4_line_sz
5887 .byte 0x2
5888 .${dwarf4_addr_size}byte .LM1
5889 .byte 0x18
5890 .byte 0x5
5891 .byte 0x1
5892 .byte 0
5893 .byte 0x$dwarf4_line_sz
5894 .byte 0x2
5895 .${dwarf4_addr_size}byte .LM2
5896 .byte 0x1
5897 .byte 0x5
5898 .byte 0x1
5899 .byte 0
5900 .byte 0x$dwarf4_line_sz
5901 .byte 0x2
5902 .${dwarf4_addr_size}byte .Letext0
5903 .byte 0
5904 .byte 0x1
5905 .byte 0x1
5906 .LELT0:
5907 .section .debug_str,$section_flags
5908 .ident \"GCC\"
5909 "
5910 dwarf4_success=no
5911 if test $dwarf4_addr_size = 4; then
5912 gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line],
5913 gcc_cv_as_debug_line_32_flag,,
5914 [$conftest_s],,
5915 [dwarf4_success=yes])
5916 else
5917 gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line],
5918 gcc_cv_as_debug_line_64_flag,,
5919 [$conftest_s],,
5920 [dwarf4_success=yes])
5921 fi
5922 if test $dwarf4_success = yes; then
5923 dwarf4_success=no
5924 gcc_GAS_CHECK_FEATURE([--gdwarf-4 not refusing compiler generated .debug_line],
5925 gcc_cv_as_dwarf_4_debug_line_flag,
5926 [--gdwarf-4], [$conftest_s],,
5927 [dwarf4_success=yes])
5928 break
5929 fi
5930 dwarf4_debug_info_size=0x36
5931 dwarf4_high_pc_form=6
5932 dwarf4_debug_aranges_size=0x1c
5933 dwarf4_line_sz=5
5934 done
5935
5936 if test $dwarf4_success = yes; then
5937 conftest_s="\
5938 .file \"foo.c\"
5939 .text
5940 bar:
5941 #APP
5942 # 82 \"xxx.h\" 1
5943 $insn
5944 # 0 \"\" 2
5945 #NO_APP
5946 $insn
5947 foo:
5948 .file 1 \"foo.c\"
5949 $insn
5950 .file 2 \"foo.h\"
5951 ret
5952 "
5953 dwarf4_success=no
5954 gcc_GAS_CHECK_FEATURE([--gdwarf-4 with the APP marker],
5955 gcc_cv_as_dwarf_4_app_flag,
5956 [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes])
5957 fi
5958
5959 if test $dwarf4_success = yes; then
5960 conftest_s="\
5961 .text
5962 .globl foo
5963 $function_type
5964 foo:
5965 $insn
5966 $function_size
5967 .file 1 \"foo.c\"
5968 "
5969 gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources],
5970 gcc_cv_as_working_gdwarf_n_flag,
5971 [--gdwarf-4],
5972 [$conftest_s],
5973 [changequote(,)dnl
5974 if test x$gcc_cv_objdump != x \
5975 && $gcc_cv_objdump -W conftest.o 2>&1 \
5976 | grep conftest.s > /dev/null 2>&1; then
5977 gcc_cv_as_working_gdwarf_n_flag=no
5978 else
5979 gcc_cv_as_working_gdwarf_n_flag=yes
5980 fi
5981 changequote([,])dnl])
5982 if test $gcc_cv_as_working_gdwarf_n_flag = yes; then
5983 AC_DEFINE(HAVE_AS_WORKING_DWARF_N_FLAG, 1,
5984 [Define if your assembler supports --gdwarf-4/--gdwarf-5 even with
5985 compiler generated .debug_line.])
5986 fi
5987 fi
5988
5989 gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
5990 gcc_cv_as_debug_prefix_map_flag,
5991 [--debug-prefix-map /a=/b], [$insn],,
5992 [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
5993 [Define if your assembler supports the --debug-prefix-map option.])])
5994 fi
5995
5996 gcc_GAS_CHECK_FEATURE([compressed debug sections],
5997 gcc_cv_as_compress_debug,,,
5998 [# gas compiled without zlib cannot compress debug sections and warns
5999 # about it, but still exits successfully. So check for this, too.
6000 if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null
6001 then
6002 gcc_cv_as_compress_debug=0
6003 elif $gcc_cv_as --compress-debug-sections=zlib -o conftest.o conftest.s > /dev/null 2>&1
6004 then
6005 gcc_cv_as_compress_debug=1
6006 gcc_cv_as_compress_debug_option="--compress-debug-sections"
6007 gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
6008 # Since binutils 2.40, gas supports --compress-debug-sections=zstd.
6009 if $gcc_cv_as --compress-debug-sections=zstd -o conftest.o conftest.s > /dev/null 2>&1
6010 then
6011 gcc_cv_as_compress_debug=2
6012 fi
6013 else
6014 gcc_cv_as_compress_debug=0
6015 fi])
6016 AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug,
6017 [Define to the level of your assembler's compressed debug section support.])
6018 AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option",
6019 [Define to the assembler option to enable compressed debug sections.])
6020 AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option",
6021 [Define to the assembler option to disable compressed debug sections.])
6022
6023 gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,,
6024 [.lcomm bar,4,16],,
6025 [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
6026 [Define if your assembler supports .lcomm with an alignment field.])])
6027
6028 if test x$with_sysroot = x && test x$host = x$target \
6029 && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
6030 && test "$prefix" != "NONE"; then
6031 AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
6032 [Define to PREFIX/include if cpp should also search that directory.])
6033 fi
6034
6035 # Determine the version of glibc, if any, used on the target.
6036 AC_MSG_CHECKING([for target glibc version])
6037 AC_ARG_WITH([glibc-version],
6038 [AS_HELP_STRING([--with-glibc-version=M.N],
6039 [assume GCC used with glibc version M.N or later])], [
6040 if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
6041 glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
6042 glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
6043 else
6044 AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
6045 fi], [
6046 glibc_version_major=0
6047 glibc_version_minor=0
6048 [if test -f $target_header_dir/features.h \
6049 && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \
6050 && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then
6051 glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'`
6052 glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'`
6053 fi]])
6054 AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
6055 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major],
6056 [GNU C Library major version number used on the target, or 0.])
6057 AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor],
6058 [GNU C Library minor version number used on the target, or 0.])
6059
6060 AC_ARG_ENABLE(gnu-unique-object,
6061 [AS_HELP_STRING([--enable-gnu-unique-object],
6062 [enable the use of the @gnu_unique_object ELF extension on glibc systems])],
6063 [case $enable_gnu_unique_object in
6064 yes | no) ;;
6065 *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
6066 Valid choices are 'yes' and 'no'.]) ;;
6067 esac],
6068 [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,,
6069 [.type foo, '$target_type_format_char'gnu_unique_object],,
6070 # We need to unquote above to to use the definition from config.gcc.
6071 # Also check for ld.so support, i.e. glibc 2.11 or higher.
6072 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )]
6073 )])
6074 if test x$enable_gnu_unique_object = xyes; then
6075 AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
6076 [Define if your assembler supports @gnu_unique_object.])
6077 fi
6078
6079 AC_CACHE_CHECK([assembler for tolerance to line number 0],
6080 [gcc_cv_as_line_zero],
6081 [gcc_cv_as_line_zero=no
6082 if test "x$gcc_cv_as" != x; then
6083 { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s
6084 if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) &&
6085 test "x`cat conftest.out`" = x
6086 then
6087 gcc_cv_as_line_zero=yes
6088 else
6089 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
6090 cat conftest.s >&AS_MESSAGE_LOG_FD
6091 echo "configure: error output was" >&AS_MESSAGE_LOG_FD
6092 cat conftest.out >&AS_MESSAGE_LOG_FD
6093 fi
6094 rm -f conftest.o conftest.s conftest.out
6095 fi])
6096 if test "x$gcc_cv_as_line_zero" = xyes; then
6097 AC_DEFINE([HAVE_AS_LINE_ZERO], 1,
6098 [Define if the assembler won't complain about a line such as # 0 "" 2.])
6099 fi
6100
6101 AC_MSG_CHECKING(support for thin archives)
6102 thin_archive_support=no
6103 echo 'int main (void) { return 0; }' > conftest.c
6104 if ($AR --version | sed 1q | grep "GNU ar" \
6105 && $CC $CFLAGS -c conftest.c \
6106 && $AR rcT conftest.a conftest.o \
6107 && $CC $CFLAGS $LDFLAGS -o conftest conftest.a) >/dev/null 2>&1; then
6108 thin_archive_support=yes
6109 fi
6110 rm -f conftest.c conftest.o conftest.a conftest
6111 AC_MSG_RESULT($thin_archive_support)
6112 AC_SUBST(thin_archive_support)
6113
6114 AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
6115 gcc_cv_ld_eh_frame_hdr=no
6116 if test $in_tree_ld = yes ; then
6117 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 \
6118 && test $in_tree_ld_is_elf = yes; then
6119 gcc_cv_ld_eh_frame_hdr=yes
6120 fi
6121 elif test x$gcc_cv_ld != x; then
6122 if echo "$ld_ver" | grep GNU > /dev/null; then
6123 # Check if linker supports --eh-frame-hdr option
6124 if $gcc_cv_ld --help 2>&1 | grep eh-frame-hdr > /dev/null; then
6125 gcc_cv_ld_eh_frame_hdr=yes
6126 fi
6127 else
6128 case "$target" in
6129 *-*-solaris2*)
6130 # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
6131 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
6132 gcc_cv_ld_eh_frame_hdr=yes
6133 fi
6134 ;;
6135 esac
6136 fi
6137 fi
6138 GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
6139 if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
6140 AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
6141 [Define if your linker supports .eh_frame_hdr.])
6142 fi
6143 AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
6144
6145 AC_MSG_CHECKING(linker position independent executable support)
6146 gcc_cv_ld_pie=no
6147 if test $in_tree_ld = yes ; then
6148 case "$target" in
6149 # Full PIE support on Solaris was only introduced in gld 2.26.
6150 *-*-solaris2*) gcc_gld_pie_min_version=26 ;;
6151 *) gcc_gld_pie_min_version=15 ;;
6152 esac
6153 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge "$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \
6154 && test $in_tree_ld_is_elf = yes; then
6155 gcc_cv_ld_pie=yes
6156 fi
6157 elif test x$gcc_cv_ld != x; then
6158 # Check if linker supports -pie option
6159 if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then
6160 gcc_cv_ld_pie=yes
6161 case "$target" in
6162 *-*-solaris2*)
6163 if echo "$ld_ver" | grep GNU > /dev/null \
6164 && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
6165 gcc_cv_ld_pie=no
6166 fi
6167 ;;
6168 esac
6169 else
6170 case "$target" in
6171 *-*-solaris2.1[[1-9]]*)
6172 # Solaris 11.3 added PIE support.
6173 if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
6174 gcc_cv_ld_pie=yes
6175 fi
6176 ;;
6177 esac
6178 fi
6179 fi
6180 if test x"$gcc_cv_ld_pie" = xyes; then
6181 AC_DEFINE(HAVE_LD_PIE, 1,
6182 [Define if your linker supports PIE option.])
6183 fi
6184 AC_MSG_RESULT($gcc_cv_ld_pie)
6185
6186 AC_MSG_CHECKING(linker PIE support with copy reloc)
6187 gcc_cv_ld_pie_copyreloc=no
6188 if test $gcc_cv_ld_pie = yes ; then
6189 if test $in_tree_ld = yes ; then
6190 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
6191 gcc_cv_ld_pie_copyreloc=yes
6192 fi
6193 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6194 # Check if linker supports -pie option with copy reloc
6195 case "$target" in
6196 i?86-*-linux* | x86_64-*-linux*)
6197 cat > conftest1.s <<EOF
6198 .globl a_glob
6199 .data
6200 .type a_glob, @object
6201 .size a_glob, 4
6202 a_glob:
6203 .long 2
6204 EOF
6205 cat > conftest2.s <<EOF
6206 .text
6207 .globl main
6208 .type main, @function
6209 main:
6210 movl %eax, a_glob(%rip)
6211 .size main, .-main
6212 .globl ptr
6213 .section .data.rel,"aw",@progbits
6214 .type ptr, @object
6215 ptr:
6216 .quad a_glob
6217 EOF
6218 if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6219 && $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \
6220 && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
6221 && $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then
6222 gcc_cv_ld_pie_copyreloc=yes
6223 fi
6224 rm -f conftest conftest1.so conftest1.o conftest2.o conftest1.s conftest2.s
6225 ;;
6226 esac
6227 fi
6228 fi
6229 AC_DEFINE_UNQUOTED(HAVE_LD_PIE_COPYRELOC,
6230 [`if test x"$gcc_cv_ld_pie_copyreloc" = xyes; then echo 1; else echo 0; fi`],
6231 [Define 0/1 if your linker supports -pie option with copy reloc.])
6232 AC_MSG_RESULT($gcc_cv_ld_pie_copyreloc)
6233
6234 AC_MSG_CHECKING(linker EH-compatible garbage collection of sections)
6235 gcc_cv_ld_eh_gc_sections=no
6236 if test $in_tree_ld = yes ; then
6237 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 17 -o "$gcc_cv_gld_major_version" -gt 2 \
6238 && test $in_tree_ld_is_elf = yes; then
6239 gcc_cv_ld_eh_gc_sections=yes
6240 fi
6241 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
6242 cat > conftest.s <<EOF
6243 .section .text
6244 .globl _start
6245 .type _start, @function
6246 _start:
6247 .long foo
6248 .size _start, .-_start
6249 .section .text.foo,"ax",@progbits
6250 .type foo, @function
6251 foo:
6252 .long 0
6253 .size foo, .-foo
6254 .section .gcc_except_table.foo,"a",@progbits
6255 .L0:
6256 .long 0
6257 .section .eh_frame,"a",@progbits
6258 .long .L0
6259 EOF
6260 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6261 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6262 | grep "gc-sections option ignored" > /dev/null; then
6263 gcc_cv_ld_eh_gc_sections=no
6264 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6265 | grep gcc_except_table > /dev/null; then
6266 gcc_cv_ld_eh_gc_sections=yes
6267 # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
6268 if test x$gcc_cv_as_comdat_group != xyes; then
6269 gcc_cv_ld_eh_gc_sections=no
6270 cat > conftest.s <<EOF
6271 .section .text
6272 .globl _start
6273 .type _start, @function
6274 _start:
6275 .long foo
6276 .size _start, .-_start
6277 .section .gnu.linkonce.t.foo,"ax",@progbits
6278 .type foo, @function
6279 foo:
6280 .long 0
6281 .size foo, .-foo
6282 .section .gcc_except_table.foo,"a",@progbits
6283 .L0:
6284 .long 0
6285 .section .eh_frame,"a",@progbits
6286 .long .L0
6287 EOF
6288 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6289 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6290 | grep "gc-sections option ignored" > /dev/null; then
6291 gcc_cv_ld_eh_gc_sections=no
6292 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6293 | grep gcc_except_table > /dev/null; then
6294 gcc_cv_ld_eh_gc_sections=yes
6295 fi
6296 fi
6297 fi
6298 fi
6299 fi
6300 rm -f conftest.s conftest.o conftest
6301 fi
6302 case "$target" in
6303 hppa*-*-linux*)
6304 # ??? This apparently exposes a binutils bug with PC-relative relocations.
6305 gcc_cv_ld_eh_gc_sections=no
6306 ;;
6307 esac
6308 if test x$gcc_cv_ld_eh_gc_sections = xyes; then
6309 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1,
6310 [Define if your linker supports garbage collection of
6311 sections in presence of EH frames.])
6312 fi
6313 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections)
6314
6315 AC_MSG_CHECKING(linker EH garbage collection of sections bug)
6316 gcc_cv_ld_eh_gc_sections_bug=no
6317 if test $in_tree_ld = yes ; then
6318 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -lt 19 -o "$gcc_cv_gld_major_version" -lt 2 \
6319 && test $in_tree_ld_is_elf = yes; then
6320 gcc_cv_ld_eh_gc_sections_bug=yes
6321 fi
6322 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x -a x$gcc_cv_as_comdat_group = xyes; then
6323 gcc_cv_ld_eh_gc_sections_bug=yes
6324 cat > conftest.s <<EOF
6325 .section .text
6326 .globl _start
6327 .type _start, @function
6328 _start:
6329 .long foo
6330 .size _start, .-_start
6331 .section .text.startup.foo,"ax",@progbits
6332 .type foo, @function
6333 foo:
6334 .long 0
6335 .size foo, .-foo
6336 .section .gcc_except_table.foo,"a",@progbits
6337 .L0:
6338 .long 0
6339 .section .eh_frame,"a",@progbits
6340 .long .L0
6341 EOF
6342 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
6343 if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
6344 | grep "gc-sections option ignored" > /dev/null; then
6345 :
6346 elif $gcc_cv_objdump -h conftest 2> /dev/null \
6347 | grep gcc_except_table > /dev/null; then
6348 gcc_cv_ld_eh_gc_sections_bug=no
6349 fi
6350 fi
6351 rm -f conftest.s conftest.o conftest
6352 fi
6353 if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then
6354 AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1,
6355 [Define if your linker has buggy garbage collection of
6356 sections support when .text.startup.foo like sections are used.])
6357 fi
6358 AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug)
6359
6360 AC_MSG_CHECKING(linker for compressed debug sections)
6361 # GNU ld/gold support --compressed-debug-sections=zlib since binutils 2.26.
6362 if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zlib-gabi\>' > /dev/null; then
6363 gcc_cv_ld_compress_debug=1
6364 gcc_cv_ld_compress_debug_option="--compress-debug-sections"
6365 # Detect zstd debug section compression support
6366 if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zstd\>' > /dev/null; then
6367 gcc_cv_ld_compress_debug=2
6368 fi
6369 else
6370 changequote(,)dnl
6371 case "${target}" in
6372 *-*-solaris2*)
6373 # Introduced in Solaris 11.2.
6374 if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then
6375 gcc_cv_ld_compress_debug=1
6376 gcc_cv_ld_compress_debug_option="-z compress-sections"
6377 else
6378 gcc_cv_ld_compress_debug=0
6379 fi
6380 ;;
6381 *)
6382 # Assume linkers other than GNU ld don't support compessed debug
6383 # sections.
6384 gcc_cv_ld_compress_debug=0
6385 ;;
6386 esac
6387 changequote([,])dnl
6388 fi
6389 AC_DEFINE_UNQUOTED(HAVE_LD_COMPRESS_DEBUG, $gcc_cv_ld_compress_debug,
6390 [Define to the level of your linker's compressed debug section support.])
6391 AC_DEFINE_UNQUOTED(LD_COMPRESS_DEBUG_OPTION, "$gcc_cv_ld_compress_debug_option",
6392 [Define to the linker option to enable compressed debug sections.])
6393 AC_MSG_RESULT($gcc_cv_ld_compress_debug)
6394
6395 if test x"$ld64_flag" = x"yes"; then
6396
6397 # Set defaults for possibly untestable items.
6398 gcc_cv_ld64_export_dynamic=0
6399 gcc_cv_ld64_platform_version=0
6400 gcc_cv_ld64_macos_version_min=0
6401 gcc_cv_ld64_demangle=0
6402
6403 if test "$build" = "$host"; then
6404 darwin_try_test=1
6405 else
6406 darwin_try_test=0
6407 fi
6408
6409 # On Darwin, because of FAT library support, it is often possible to execute
6410 # exes from compatible archs even when the host differs from the build system.
6411 case "$build","$host" in
6412 x86_64-*-darwin*,i?86-*-darwin* | powerpc64*-*-darwin*,powerpc*-*-darwin*)
6413 darwin_try_test=1;;
6414 *) ;;
6415 esac
6416
6417 # If the configurer specified a minimum ld64 version to be supported, then use
6418 # that to determine feature support.
6419 if test x"${gcc_cv_ld64_version}" != x; then
6420 AC_MSG_CHECKING(ld64 specified version)
6421 gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'`
6422 AC_MSG_RESULT($gcc_cv_ld64_major)
6423 if test "$gcc_cv_ld64_major" -ge 97; then
6424 gcc_cv_ld64_demangle=1
6425 fi
6426 if test "$gcc_cv_ld64_major" -ge 236; then
6427 gcc_cv_ld64_export_dynamic=1
6428 fi
6429 if test "$gcc_cv_ld64_major" -ge 512; then
6430 gcc_cv_ld64_platform_version=1
6431 gcc_cv_ld64_macos_version_min=1
6432 fi
6433 elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
6434 # If the version was not specified, try to find it.
6435 AC_MSG_CHECKING(linker version)
6436 if test x"${gcc_cv_ld64_version}" = x; then
6437 gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld|PROJECT:ld' \
6438 | sed -e 's/.*ld64-//' -e 's/.*dyld-//' -e 's/.*PROJECT:ld-//' \
6439 | awk '{print $1}'`
6440 fi
6441 AC_MSG_RESULT($gcc_cv_ld64_version)
6442
6443 AC_MSG_CHECKING(linker for -demangle support)
6444 gcc_cv_ld64_demangle=1
6445 if $gcc_cv_ld -demangle < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
6446 gcc_cv_ld64_demangle=0
6447 fi
6448 AC_MSG_RESULT($gcc_cv_ld64_demangle)
6449
6450 AC_MSG_CHECKING(linker for -export_dynamic support)
6451 gcc_cv_ld64_export_dynamic=1
6452 if $gcc_cv_ld -export_dynamic < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
6453 gcc_cv_ld64_export_dynamic=0
6454 fi
6455 AC_MSG_RESULT($gcc_cv_ld64_export_dynamic)
6456
6457 AC_MSG_CHECKING(linker for -platform_version support)
6458 gcc_cv_ld64_platform_version=1
6459 if $gcc_cv_ld -platform_version macos 10.5 0.0 < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
6460 gcc_cv_ld64_platform_version=0
6461 fi
6462 AC_MSG_RESULT($gcc_cv_ld64_platform_version)
6463
6464 AC_MSG_CHECKING(linker for -macos_version_min)
6465 gcc_cv_ld64_macos_version_min=1
6466 if $gcc_cv_ld -macos_version_min 10.5 < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
6467 gcc_cv_ld64_macos_version_min=0
6468 fi
6469 AC_MSG_RESULT($gcc_cv_ld64_macos_version_min)
6470 fi
6471
6472 if test x"${gcc_cv_ld64_version}" != x; then
6473 AC_DEFINE_UNQUOTED(LD64_VERSION, "${gcc_cv_ld64_version}",
6474 [Define to ld64 version.])
6475 fi
6476
6477 AC_DEFINE_UNQUOTED(LD64_HAS_DEMANGLE, $gcc_cv_ld64_demangle,
6478 [Define to 1 if ld64 supports '-demangle'.])
6479
6480 AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
6481 [Define to 1 if ld64 supports '-export_dynamic'.])
6482
6483 AC_DEFINE_UNQUOTED(LD64_HAS_PLATFORM_VERSION, $gcc_cv_ld64_platform_version,
6484 [Define to 1 if ld64 supports '-platform_version'.])
6485
6486 AC_DEFINE_UNQUOTED(LD64_HAS_MACOS_VERSION_MIN, $gcc_cv_ld64_macos_version_min,
6487 [Define to 1 if ld64 supports '-macos_version_min'.])
6488 fi
6489
6490 if test x"$dsymutil_flag" = x"yes"; then
6491
6492 # If the user specified a dsymutil path, then we will already have the
6493 # version string, otherwise, pick it up.
6494 if test x"$gcc_cv_dsymutil" = x; then
6495 AC_MSG_WARN([dsymutil is a required tool for this system, but not found])
6496 dsymutil_vers="tool unspecified"
6497 elif test x"$dsymutil_vers" = x; then
6498 dsymutil_vers=`$gcc_cv_dsymutil -v /dev/null 2>&1`
6499 fi
6500
6501 dsymutil_temp=`echo $dsymutil_vers | sed 1q`
6502 AC_MSG_CHECKING(dsymutil version "$dsymutil_temp")
6503 if echo $dsymutil_temp | grep dwarfutils- > /dev/null; then
6504 dsymutil_kind=DWARFUTILS
6505 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*dwarfutils-\([[0-9\.]]*\).*/\1/'`
6506 elif echo $dsymutil_temp | grep clang- > /dev/null; then
6507 dsymutil_kind=CLANG
6508 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*clang-\([[0-9\.]]*\).*/\1/'`
6509 elif echo $dsymutil_temp | grep 'LLVM version ' > /dev/null; then
6510 dsymutil_kind=LLVM
6511 dsymutil_vers=`echo $dsymutil_temp | sed 's/.*LLVM\ version\ \([[0-9\.]]*\).*/\1/'`
6512 else
6513 dsymutil_kind=DET_UNKNOWN
6514 dsymutil_vers="0.0"
6515 fi
6516 dsymutil_major=`expr "$dsymutil_vers" : '\([[0-9]]*\)'`
6517 dsymutil_minor=`expr "$dsymutil_vers" : '[[0-9]]*\.\([[0-9]]*\)'`
6518 dsymutil_tiny=`expr "$dsymutil_vers" : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
6519 if test x"${dsymutil_minor}" = x; then
6520 dsymutil_minor=0
6521 fi
6522 if test x"${dsymutil_tiny}" = x; then
6523 dsymutil_tiny=0
6524 fi
6525 AC_DEFINE_UNQUOTED(DSYMUTIL_VERSION, [$dsymutil_kind,${dsymutil_major},${dsymutil_minor},${dsymutil_tiny}],
6526 [Define to the dsymutil version.])
6527 AC_MSG_RESULT($dsymutil_vers : $dsymutil_kind ${dsymutil_major} ${dsymutil_minor} ${dsymutil_tiny} )
6528 fi
6529
6530 case $target_os in
6531 win32 | pe | cygwin* | mingw32*)
6532 AC_MSG_CHECKING(broken PE linker dwarf5 support)
6533 gcc_cv_ld_broken_pe_dwarf5=yes
6534 if test $in_tree_ld = yes ; then
6535 if grep -q '\.debug_loclists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6536 $gcc_cv_ld_gld_srcdir/scripttempl/pe*.sc \
6537 && grep -q '\.debug_rnglists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6538 $gcc_cv_ld_gld_srcdir/scripttempl/pe*.sc; then
6539 gcc_cv_ld_broken_pe_dwarf5=no
6540 fi
6541 else
6542 if $gcc_cv_ld --verbose 2>&1 | grep -q '\.debug_loclists.*BLOCK.*__section_alignment__.*NOLOAD.*:' \
6543 && $gcc_cv_ld --verbose 2>&1 | grep -q '\.debug_rnglists.*BLOCK.*__section_alignment__.*NOLOAD.*:'; then
6544 gcc_cv_ld_broken_pe_dwarf5=no
6545 fi
6546 fi
6547 if test x$gcc_cv_ld_broken_pe_dwarf5 = xyes; then
6548 AC_DEFINE(HAVE_LD_BROKEN_PE_DWARF5, 1,
6549 [Define if the PE linker has broken DWARF 5 support.])
6550 fi
6551 AC_MSG_RESULT($gcc_cv_ld_broken_pe_dwarf5)
6552
6553 AC_MSG_CHECKING(PE linker --disable-dynamicbase support)
6554 gcc_cv_ld_disable_dynamicbase=no
6555 if test $in_tree_ld = yes; then
6556 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 36 -o "$gcc_cv_gld_major_version" -gt 2; then \
6557 gcc_cv_ld_disable_dynamicbase=yes
6558 fi
6559 else
6560 if $gcc_cv_ld --help 2>&1 | grep -q 'disable\-]dynamicbase' > /dev/null; then
6561 gcc_cv_ld_disable_dynamicbase=yes
6562 fi
6563 fi
6564 if test x"$gcc_cv_ld_disable_dynamicbase" = xyes; then
6565 AC_DEFINE(HAVE_LD_PE_DISABLE_DYNAMICBASE, 1,
6566 [Define if the PE linker supports --disable-dynamicbase option.])
6567 fi
6568 AC_MSG_RESULT($gcc_cv_ld_disable_dynamicbase)
6569 ;;
6570 esac
6571
6572 # --------
6573 # UNSORTED
6574 # --------
6575
6576 AC_CACHE_CHECK(linker --as-needed support,
6577 gcc_cv_ld_as_needed,
6578 [gcc_cv_ld_as_needed=no
6579 gcc_cv_ld_as_needed_option='--as-needed'
6580 gcc_cv_ld_no_as_needed_option='--no-as-needed'
6581 if test $in_tree_ld = yes ; then
6582 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
6583 && test $in_tree_ld_is_elf = yes; then
6584 gcc_cv_ld_as_needed=yes
6585 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 28; then
6586 gcc_cv_ld_as_needed_option='--push-state --as-needed'
6587 gcc_cv_ld_no_as_needed_option='--pop-state'
6588 fi
6589 fi
6590 elif test x$gcc_cv_ld != x; then
6591 # Check if linker supports --as-needed and --no-as-needed options
6592 if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then
6593 gcc_cv_ld_as_needed=yes
6594 if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null \
6595 && $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null \
6596 && echo "$ld_ver" | grep GNU > /dev/null \
6597 && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 28; then
6598 # Use these options only when both ld.bfd and ld.gold support
6599 # --push-state/--pop-state, which unfortunately wasn't added
6600 # at the same time.
6601 gcc_cv_ld_as_needed_option='--push-state --as-needed'
6602 gcc_cv_ld_no_as_needed_option='--pop-state'
6603 fi
6604 fi
6605 case "$target:$gnu_ld" in
6606 *-*-solaris2*:no)
6607 # Solaris 2 ld always supports -z ignore/-z record. Prefer the native
6608 # forms.
6609 gcc_cv_ld_as_needed=yes
6610 gcc_cv_ld_as_needed_option="-z ignore"
6611 gcc_cv_ld_no_as_needed_option="-z record"
6612 ;;
6613 esac
6614 fi
6615 # --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
6616 # dl_iterate_phdr, i.e. since Solaris 11.
6617 case "$target" in
6618 *-*-solaris2.1[[1-9]]*)
6619 case "$target" in
6620 i?86-*-* | x86_64-*-*)
6621 if echo "$ld_ver" | grep GNU > /dev/null; then
6622 # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
6623 gcc_cv_ld_as_needed=no
6624 fi
6625 ;;
6626 esac
6627 ;;
6628 *-*-solaris2*)
6629 gcc_cv_ld_as_needed=no
6630 ;;
6631 esac
6632 ])
6633 if test x"$gcc_cv_ld_as_needed" = xyes; then
6634 AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
6635 [Define if your linker supports --as-needed/--no-as-needed or equivalent options.])
6636 AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option",
6637 [Define to the linker option to ignore unused dependencies.])
6638 AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option",
6639 [Define to the linker option to keep unused dependencies.])
6640 fi
6641
6642 AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities)
6643 saved_LDFLAGS="$LDFLAGS"
6644 for clearcap_map in sol2-clearcapv2.map sol2-clearcap.map; do
6645 LDFLAGS="$saved_LDFLAGS -Wl,-M,${srcdir}/config/$clearcap_map"
6646 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
6647 [gcc_cv_ld_clearcap=yes; break], [gcc_cv_ld_clearcap=no])
6648 done
6649 LDFLAGS="$saved_LDFLAGS"
6650 if test "x$gcc_cv_ld_clearcap" = xyes; then
6651 AC_DEFINE([HAVE_LD_CLEARCAP], 1,
6652 [Define if the linker supports clearing hardware capabilities via mapfile.])
6653 AC_CONFIG_LINKS([clearcap.map:${srcdir}/config/$clearcap_map])
6654 fi
6655 AC_MSG_RESULT($gcc_cv_ld_clearcap)
6656
6657 case "$target" in
6658 powerpc*-*-*)
6659 case "$target" in
6660 *le-*-linux*)
6661 emul_name="-melf32lppc"
6662 ;;
6663 *)
6664 emul_name="-melf32ppc"
6665 ;;
6666 esac
6667 AC_CACHE_CHECK(linker .gnu.attributes long double support,
6668 gcc_cv_ld_ppc_attr,
6669 [gcc_cv_ld_ppc_attr=no
6670 if test x"$ld_is_gold" = xyes; then
6671 gcc_cv_ld_ppc_attr=yes
6672 elif test $in_tree_ld = yes ; then
6673 if test "$gcc_cv_gld_major_version" -eq 2 \
6674 -a "$gcc_cv_gld_minor_version" -ge 28 \
6675 -o "$gcc_cv_gld_major_version" -gt 2; then
6676 gcc_cv_ld_ppc_attr=yes
6677 fi
6678 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6679 # check that merging the long double .gnu_attribute doesn't warn
6680 cat > conftest1.s <<EOF
6681 .gnu_attribute 4,1
6682 EOF
6683 cat > conftest2.s <<EOF
6684 .gnu_attribute 4,9
6685 EOF
6686 if $gcc_cv_as -a32 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6687 && $gcc_cv_as -a32 -o conftest2.o conftest2.s > /dev/null 2>&1 \
6688 && $gcc_cv_ld $emul_name -r -o conftest.o conftest1.o conftest2.o > /dev/null 2> conftest.err \
6689 && test ! -s conftest.err; then
6690 gcc_cv_ld_ppc_attr=yes
6691 fi
6692 rm -f conftest.err conftest.o conftest1.o conftest2.o conftest1.s conftest2.s
6693 fi
6694 ])
6695 if test x$gcc_cv_ld_ppc_attr = xyes; then
6696 AC_DEFINE(HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE, 1,
6697 [Define if your PowerPC linker has .gnu.attributes long double support.])
6698 fi
6699 ;;
6700 esac
6701
6702 case "$target:$tm_file" in
6703 powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
6704 case "$target" in
6705 *le-*-linux*)
6706 emul_name="-melf64lppc"
6707 ;;
6708 *-*-linux*)
6709 emul_name="-melf64ppc"
6710 ;;
6711 *le-*-freebsd*)
6712 emul_name="-melf64lppc_fbsd"
6713 ;;
6714 *-*-freebsd*)
6715 emul_name="-melf64ppc_fbsd"
6716 ;;
6717 esac
6718 AC_CACHE_CHECK(linker support for omitting dot symbols,
6719 gcc_cv_ld_no_dot_syms,
6720 [gcc_cv_ld_no_dot_syms=no
6721 if test x"$ld_is_gold" = xyes; then
6722 gcc_cv_ld_no_dot_syms=yes
6723 elif test $in_tree_ld = yes ; then
6724 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
6725 gcc_cv_ld_no_dot_syms=yes
6726 fi
6727 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6728 cat > conftest1.s <<EOF
6729 .text
6730 bl .foo
6731 EOF
6732 cat > conftest2.s <<EOF
6733 .section ".opd","aw"
6734 .align 3
6735 .globl foo
6736 .type foo,@function
6737 foo:
6738 .quad .LEfoo,.TOC.@tocbase,0
6739 .text
6740 .LEfoo:
6741 blr
6742 .size foo,.-.LEfoo
6743 EOF
6744 if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
6745 && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
6746 && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
6747 gcc_cv_ld_no_dot_syms=yes
6748 fi
6749 rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
6750 fi
6751 ])
6752 if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
6753 AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
6754 [Define if your PowerPC64 linker only needs function descriptor syms.])
6755 fi
6756
6757 AC_CACHE_CHECK(linker large toc support,
6758 gcc_cv_ld_large_toc,
6759 [gcc_cv_ld_large_toc=no
6760 if test x"$ld_is_gold" = xyes; then
6761 gcc_cv_ld_large_toc=yes
6762 elif test $in_tree_ld = yes ; then
6763 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then
6764 gcc_cv_ld_large_toc=yes
6765 fi
6766 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
6767 cat > conftest.s <<EOF
6768 .section ".tbss","awT",@nobits
6769 .align 3
6770 ie0: .space 8
6771 .global _start
6772 .text
6773 _start:
6774 addis 9,13,ie0@got@tprel@ha
6775 ld 9,ie0@got@tprel@l(9)
6776 EOF
6777 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
6778 && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then
6779 gcc_cv_ld_large_toc=yes
6780 fi
6781 rm -f conftest conftest.o conftest.s
6782 fi
6783 ])
6784 if test x"$gcc_cv_ld_large_toc" = xyes; then
6785 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
6786 [Define if your PowerPC64 linker supports a large TOC.])
6787 fi
6788
6789 AC_CACHE_CHECK(linker toc pointer alignment,
6790 gcc_cv_ld_toc_align,
6791 [if test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_nm != x; then
6792 cat > conftest.s <<EOF
6793 .global _start
6794 .text
6795 _start:
6796 addis 9,2,x@got@ha
6797 .section .data.rel.ro,"aw",@progbits
6798 .p2align 16
6799 .space 32768
6800 x: .quad .TOC.
6801 EOF
6802 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \
6803 && $gcc_cv_ld $emul_name -z norelro -o conftest conftest.o > /dev/null 2>&1; then
6804 gcc_cv_ld_toc_align=`$gcc_cv_nm conftest | ${AWK} '/\.TOC\./ { match ($0, "0[[[:xdigit:]]]*", a); print strtonum ("0x" substr(a[[0]], length(a[[0]])-3)) }'`
6805 fi
6806 rm -f conftest conftest.o conftest.s
6807 fi
6808 ])
6809 if test -n "$gcc_cv_ld_toc_align" && test $gcc_cv_ld_toc_align -gt 8; then
6810 AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align,
6811 [Define to .TOC. alignment forced by your linker.])
6812 fi
6813 ;;
6814 esac
6815
6816 case "$target" in
6817 *-*-aix*)
6818 AC_CACHE_CHECK(linker large toc support,
6819 gcc_cv_ld_large_toc,
6820 [gcc_cv_ld_large_toc=no
6821 if test x$gcc_cv_as != x ; then
6822 cat > conftest.s <<EOF
6823 .toc
6824 LC..1:
6825 .tc a[[TC]],a[[RW]]
6826 .extern a[[RW]]
6827 .csect .text[[PR]]
6828 .largetoctest:
6829 addis 9,LC..1@u(2)
6830 ld 3,LC..1@l(9)
6831 EOF
6832 if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then
6833 gcc_cv_ld_large_toc=yes
6834 fi
6835 rm -f conftest conftest.o conftest.s
6836 fi
6837 ])
6838 if test x"$gcc_cv_ld_large_toc" = xyes; then
6839 AC_DEFINE(HAVE_LD_LARGE_TOC, 1,
6840 [Define if your PowerPC64 linker supports a large TOC.])
6841 fi
6842 ;;
6843 esac
6844
6845 AC_CACHE_CHECK(linker --build-id support,
6846 gcc_cv_ld_buildid,
6847 [gcc_cv_ld_buildid=no
6848 if test $in_tree_ld = yes ; then
6849 if test "$gcc_cv_gld_major_version" -eq 2 -a \
6850 "$gcc_cv_gld_minor_version" -ge 18 -o \
6851 "$gcc_cv_gld_major_version" -gt 2 \
6852 && test $in_tree_ld_is_elf = yes; then
6853 gcc_cv_ld_buildid=yes
6854 fi
6855 elif test x$gcc_cv_ld != x; then
6856 if $gcc_cv_ld --help 2>&1 | grep build-id > /dev/null; then
6857 gcc_cv_ld_buildid=yes
6858 fi
6859 fi])
6860 if test x"$gcc_cv_ld_buildid" = xyes; then
6861 AC_DEFINE(HAVE_LD_BUILDID, 1,
6862 [Define if your linker supports --build-id.])
6863 fi
6864
6865 AC_ARG_ENABLE(linker-build-id,
6866 [AS_HELP_STRING([--enable-linker-build-id],
6867 [compiler will always pass --build-id to linker])],
6868 [],
6869 enable_linker_build_id=no)
6870
6871 if test x"$enable_linker_build_id" = xyes; then
6872 if test x"$gcc_cv_ld_buildid" = xyes; then
6873 AC_DEFINE(ENABLE_LD_BUILDID, 1,
6874 [Define if gcc should always pass --build-id to linker.])
6875 else
6876 AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
6877 fi
6878 fi
6879
6880 # In binutils 2.21, GNU ld gained support for new emulations fully
6881 # supporting the Solaris 2 ABI. Detect their presence in the linker used.
6882 AC_CACHE_CHECK(linker *_sol2 emulation support,
6883 gcc_cv_ld_sol2_emulation,
6884 [gcc_cv_ld_sol2_emulation=no
6885 if test $in_tree_ld = yes ; then
6886 if test "$gcc_cv_gld_major_version" -eq 2 -a \
6887 "$gcc_cv_gld_minor_version" -ge 21 -o \
6888 "$gcc_cv_gld_major_version" -gt 2 \
6889 && test $in_tree_ld_is_elf = yes; then
6890 gcc_cv_ld_sol2_emulation=yes
6891 fi
6892 elif test x$gcc_cv_ld != x; then
6893 if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \
6894 grep _sol2 > /dev/null; then
6895 gcc_cv_ld_sol2_emulation=yes
6896 fi
6897 fi])
6898 if test x"$gcc_cv_ld_sol2_emulation" = xyes; then
6899 AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1,
6900 [Define if your linker supports the *_sol2 emulations.])
6901 fi
6902
6903 AC_CACHE_CHECK(linker --sysroot support,
6904 gcc_cv_ld_sysroot,
6905 [gcc_cv_ld_sysroot=no
6906 if test $in_tree_ld = yes ; then
6907 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 ; then
6908 gcc_cv_ld_sysroot=yes
6909 fi
6910 elif test x$gcc_cv_ld != x; then
6911 if $gcc_cv_ld --help 2>&1 | grep sysroot > /dev/null; then
6912 gcc_cv_ld_sysroot=yes
6913 fi
6914 fi])
6915 if test x"$gcc_cv_ld_sysroot" = xyes; then
6916 AC_DEFINE(HAVE_LD_SYSROOT, 1,
6917 [Define if your linker supports --sysroot.])
6918 fi
6919
6920 case $target in
6921 *-*-solaris2*)
6922 # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
6923 AC_CACHE_CHECK([system-provided CRTs on Solaris],
6924 gcc_cv_solaris_crts,
6925 [gcc_cv_solaris_crts=no
6926 if test x$host != x$target; then
6927 if test "x$with_sysroot" = xyes; then
6928 target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
6929 else
6930 target_sysroot="${with_sysroot}"
6931 fi
6932 fi
6933 target_libdir="$target_sysroot/usr/lib"
6934 # At the time they were added, gcrt1.o became a symlink for backwards
6935 # compatibility on x86, while crt1.o was added on sparc, so check for that.
6936 case $target in
6937 i?86-*-solaris2* | x86_64-*-solaris2*)
6938 if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
6939 ;;
6940 sparc*-*-solaris2*)
6941 if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
6942 ;;
6943 esac])
6944 ;;
6945 esac
6946 if test x$gcc_cv_solaris_crts = xyes; then
6947 AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
6948 [Define if the system-provided CRTs are present on Solaris.])
6949 fi
6950
6951 AC_ARG_ENABLE(libssp,
6952 [AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
6953 [case "${enableval}" in
6954 yes|no)
6955 ;;
6956 *)
6957 AC_MSG_ERROR([unknown libssp setting $enableval])
6958 ;;
6959 esac], [])
6960
6961 # Test for stack protector support in target C library.
6962 AC_CACHE_CHECK(__stack_chk_fail in target C library,
6963 gcc_cv_libc_provides_ssp,
6964 [gcc_cv_libc_provides_ssp=no
6965 if test "x$enable_libssp" = "xno"; then
6966 gcc_cv_libc_provides_ssp=yes
6967 elif test "x$enable_libssp" = "xyes"; then
6968 gcc_cv_libc_provides_ssp=no
6969 else
6970 case "$target" in
6971 *-*-musl*)
6972 # All versions of musl provide stack protector
6973 gcc_cv_libc_provides_ssp=yes;;
6974 *-*-linux* | *-*-kfreebsd*-gnu)
6975 # glibc 2.4 and later provides __stack_chk_fail and
6976 # either __stack_chk_guard, or TLS access to stack guard canary.
6977 GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [
6978 [if test -f $target_header_dir/features.h \
6979 && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
6980 $target_header_dir/features.h > /dev/null; then
6981 if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \
6982 $target_header_dir/features.h > /dev/null && \
6983 test -f $target_header_dir/bits/uClibc_config.h && \
6984 $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \
6985 $target_header_dir/bits/uClibc_config.h > /dev/null; then
6986 gcc_cv_libc_provides_ssp=yes
6987 fi
6988 # all versions of Bionic support stack protector
6989 elif test -f $target_header_dir/sys/cdefs.h \
6990 && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \
6991 $target_header_dir/sys/cdefs.h > /dev/null; then
6992 gcc_cv_libc_provides_ssp=yes
6993 fi]])
6994 ;;
6995 *-*-gnu*)
6996 # Avoid complicated tests (see
6997 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
6998 # simply assert that glibc does provide this, which is true for all
6999 # realistically usable GNU/Hurd configurations.
7000 # All supported versions of musl provide it as well
7001 gcc_cv_libc_provides_ssp=yes;;
7002 *-*-darwin* | *-*-freebsd* | *-*-netbsd*)
7003 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
7004 [echo "no __stack_chk_fail on this target"])
7005 ;;
7006 *) gcc_cv_libc_provides_ssp=no ;;
7007 esac
7008 fi])
7009
7010 if test x$gcc_cv_libc_provides_ssp = xyes; then
7011 AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
7012 [Define if your target C library provides stack protector support])
7013 fi
7014
7015 # Check whether --enable-default-ssp was given.
7016 AC_ARG_ENABLE(default-ssp,
7017 [AS_HELP_STRING([--enable-default-ssp],
7018 [enable Stack Smashing Protection as default])],[
7019 if test x$gcc_cv_libc_provides_ssp = xyes; then
7020 case "$target" in
7021 ia64*-*-*) enable_default_ssp=no ;;
7022 *) enable_default_ssp=$enableval ;;
7023 esac
7024 else
7025 enable_default_ssp=no
7026 fi],
7027 enable_default_ssp=no)
7028 if test x$enable_default_ssp = xyes ; then
7029 AC_DEFINE(ENABLE_DEFAULT_SSP, 1,
7030 [Define if your target supports default stack protector and it is enabled.])
7031 fi
7032 AC_SUBST([enable_default_ssp])
7033
7034 # Test for <sys/sdt.h> on the target.
7035 GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
7036 AC_CACHE_CHECK([sys/sdt.h in the target C library], [gcc_cv_sys_sdt_h], [
7037 gcc_cv_sys_sdt_h=no
7038 if test -f $target_header_dir/sys/sdt.h; then
7039 gcc_cv_sys_sdt_h=yes
7040 fi
7041 ])
7042 AS_IF([test x$gcc_cv_sys_sdt_h = xyes], [
7043 AC_DEFINE([HAVE_SYS_SDT_H], [1],
7044 [Define if your target C library provides sys/sdt.h])
7045 ])
7046
7047 # Check if TFmode long double should be used by default or not.
7048 # Some glibc targets used DFmode long double, but with glibc 2.4
7049 # and later they can use TFmode.
7050 case "$target" in
7051 powerpc*-*-linux* | \
7052 sparc*-*-linux* | \
7053 s390*-*-linux* | \
7054 alpha*-*-linux*)
7055 AC_ARG_WITH(long-double-128,
7056 [AS_HELP_STRING([--with-long-double-128],
7057 [use 128-bit long double by default])],
7058 gcc_cv_target_ldbl128="$with_long_double_128", [
7059 case "$target" in
7060 s390*-*-linux-musl*)
7061 gcc_cv_target_ldbl128=yes
7062 ;;
7063 powerpc*-*-linux-musl*)
7064 gcc_cv_target_ldbl128=no
7065 ;;
7066 *)]
7067 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
7068 [gcc_cv_target_ldbl128=no
7069 grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
7070 $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
7071 && gcc_cv_target_ldbl128=yes
7072 ]])]
7073 [
7074 ;;
7075 esac
7076 ])
7077 ;;
7078 esac
7079 if test x$gcc_cv_target_ldbl128 = xyes; then
7080 AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
7081 [Define if TFmode long double should be the default])
7082 fi
7083
7084 # Check if TFmode long double target should use the IBM extended double or IEEE
7085 # 128-bit floating point formats if long doubles are 128-bits long. The long
7086 # double type can only be switched on powerpc64 bit Linux systems where VSX is
7087 # supported. Other PowerPC systems do not build the IEEE 128-bit emulator in
7088 # libgcc.
7089 AC_ARG_WITH([long-double-format],
7090 [AS_HELP_STRING([--with-long-double-format={ieee,ibm}]
7091 [Specify whether PowerPC long double uses IEEE or IBM format])],[
7092 case "$target:$with_long_double_format" in
7093 powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm)
7094 :
7095 ;;
7096 powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm)
7097 # IEEE 128-bit emulation is only built on 64-bit VSX Linux systems
7098 case "$with_cpu" in
7099 power7 | power8 | power9 | power1*)
7100 :
7101 ;;
7102 *)
7103 AC_MSG_ERROR([Configuration option --with-long-double-format is only \
7104 supported if the default cpu is power7 or newer])
7105 with_long_double_format=""
7106 ;;
7107 esac
7108 ;;
7109 powerpc64*-*-linux*:*)
7110 AC_MSG_ERROR([--with-long-double-format argument should be ibm or ieee])
7111 with_long_double_format=""
7112 ;;
7113 *)
7114 AC_MSG_ERROR([Configure option --with-long-double-format is only supported \
7115 on 64-bit PowerPC VSX Linux systems])
7116 with_long_double_format=""
7117 ;;
7118 esac],
7119 [])
7120
7121 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
7122 # values in the TCB. Currently, only GLIBC 2.23 and later support this.
7123 gcc_cv_libc_provides_hwcap_in_tcb=no
7124 case "$target" in
7125 powerpc*-*-linux*)
7126 GCC_GLIBC_VERSION_GTE_IFELSE([2], [23], [gcc_cv_libc_provides_hwcap_in_tcb=yes], )
7127 ;;
7128 esac
7129 if test x$gcc_cv_libc_provides_hwcap_in_tcb = xyes; then
7130 AC_DEFINE(TARGET_LIBC_PROVIDES_HWCAP_IN_TCB, 1,
7131 [Define if your target C Library provides the AT_HWCAP value in the TCB])
7132 fi
7133
7134 # Check if the target LIBC handles PT_GNU_STACK.
7135 gcc_cv_libc_gnustack=unknown
7136 case "$target" in
7137 mips*-*-linux-musl*)
7138 gcc_cv_libc_gnustack=yes
7139 ;;
7140 mips*-*-linux*)
7141 GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
7142 ;;
7143 esac
7144 if test x$gcc_cv_libc_gnustack = xyes; then
7145 AC_DEFINE(TARGET_LIBC_GNUSTACK, 1,
7146 [Define if your target C Library properly handles PT_GNU_STACK])
7147 fi
7148
7149 AC_MSG_CHECKING(dl_iterate_phdr in target C library)
7150 gcc_cv_target_dl_iterate_phdr=unknown
7151 case "$target" in
7152 *-*-solaris2*)
7153 gcc_cv_target_dl_iterate_phdr=yes
7154 ;;
7155 *-*-dragonfly* | *-*-freebsd*)
7156 if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
7157 gcc_cv_target_dl_iterate_phdr=yes
7158 else
7159 gcc_cv_target_dl_iterate_phdr=no
7160 fi
7161 ;;
7162 *-linux-musl*)
7163 gcc_cv_target_dl_iterate_phdr=yes
7164 ;;
7165 esac
7166 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
7167 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
7168 AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1,
7169 [Define if your target C library provides the `dl_iterate_phdr' function.])
7170 fi
7171 AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr)
7172
7173 # We no longer support different GC mechanisms. Emit an error if
7174 # the user configures with --with-gc.
7175 AC_ARG_WITH(gc,
7176 [AS_HELP_STRING([--with-gc={page,zone}],
7177 [this option is not supported anymore. It used to choose
7178 the garbage collection mechanism to use with the compiler])],
7179 [AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])],
7180 [])
7181
7182 # Libraries to use on the host. This will normally be set by the top
7183 # level Makefile. Here we simply capture the value for our Makefile.
7184 if test -z "${HOST_LIBS+set}"; then
7185 HOST_LIBS=
7186 fi
7187 AC_SUBST(HOST_LIBS)
7188
7189 # Use the system's zlib library.
7190 AM_ZLIB
7191
7192 dnl Very limited version of automake's enable-maintainer-mode
7193
7194 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
7195 dnl maintainer-mode is disabled by default
7196 AC_ARG_ENABLE(maintainer-mode,
7197 [AS_HELP_STRING([--enable-maintainer-mode],
7198 [enable make rules and dependencies not useful
7199 (and sometimes confusing) to the casual installer])],
7200 maintainer_mode=$enableval,
7201 maintainer_mode=no)
7202
7203 AC_MSG_RESULT($maintainer_mode)
7204
7205 if test "$maintainer_mode" = "yes"; then
7206 MAINT=''
7207 else
7208 MAINT='#'
7209 fi
7210 AC_SUBST(MAINT)dnl
7211
7212 dnl Variables for tags utilities; copied from automake 1.16.4+'s init.m4
7213 if test -z "$CTAGS"; then
7214 CTAGS=ctags
7215 fi
7216 AC_SUBST([CTAGS])
7217 if test -z "$ETAGS"; then
7218 ETAGS=etags
7219 fi
7220 AC_SUBST([ETAGS])
7221 if test -z "$CSCOPE"; then
7222 CSCOPE=cscope
7223 fi
7224 AC_SUBST([CSCOPE])
7225
7226 dnl Whether to prevent multiple front-ends from linking at the same time
7227
7228 AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once])
7229 AC_ARG_ENABLE(link-mutex,
7230 [AS_HELP_STRING([--enable-link-mutex],
7231 [avoid linking multiple front-ends at once to avoid thrashing
7232 on the build machine])],
7233 do_link_mutex=$enableval,
7234 do_link_mutex=no)
7235 AC_MSG_RESULT($do_link_mutex)
7236
7237 if test "$do_link_mutex" = "yes"; then
7238 DO_LINK_MUTEX=true
7239 AC_MSG_WARN([--enable-link-mutex is deprecated and will be removed in the next release, use --enable-link-serialization instead])
7240 else
7241 DO_LINK_MUTEX=false
7242 fi
7243 AC_SUBST(DO_LINK_MUTEX)
7244
7245 dnl Whether to prevent multiple GCC front-ends from linking at the same time
7246
7247 AC_MSG_CHECKING([whether to serialize linking of multiple front-ends])
7248 AC_ARG_ENABLE(link-serialization,
7249 [AS_HELP_STRING([--enable-link-serialization],
7250 [avoid linking multiple GCC front-ends at once using make
7251 dependencies to avoid thrashing on the build machine])],
7252 do_link_serialization=$enableval,
7253 do_link_serialization=no)
7254 AC_MSG_RESULT($do_link_serialization)
7255
7256 case "$do_link_serialization" in
7257 yes)
7258 DO_LINK_SERIALIZATION=1;;
7259 [[1-9]] | [[1-9]][[0-9]] | [[1-9]][[0-9]][[0-9]])
7260 DO_LINK_SERIALIZATION=$do_link_serialization;;
7261 no)
7262 DO_LINK_SERIALIZATION=;;
7263 *)
7264 AC_MSG_ERROR(bad value ${do_link_serialization} given for --enable-link-serialization) ;;
7265 esac
7266 AC_SUBST(DO_LINK_SERIALIZATION)
7267
7268 # --------------
7269 # Language hooks
7270 # --------------
7271
7272 # Make empty files to contain the specs and options for each language.
7273 # Then add #include lines to for a compiler that has specs and/or options.
7274
7275 subdirs=
7276 lang_opt_files=
7277 lang_specs_files=
7278 lang_tree_files=
7279 # These (without "all_") are set in each config-lang.in.
7280 # `language' must be a single word so is spelled singularly.
7281 all_languages=
7282 all_compilers=
7283 all_outputs='Makefile'
7284 # List of language configure and makefile fragments.
7285 all_lang_configurefrags=
7286 all_lang_makefrags=
7287 # Additional files for gengtype
7288 all_gtfiles="$target_gtfiles"
7289
7290 # These are the languages that are set in --enable-languages,
7291 # and are available in the GCC tree.
7292 all_selected_languages=
7293
7294 # Add the language fragments.
7295 # Languages are added via two mechanisms. Some information must be
7296 # recorded in makefile variables, these are defined in config-lang.in.
7297 # We accumulate them and plug them into the main Makefile.
7298 # The other mechanism is a set of hooks for each of the main targets
7299 # like `clean', `install', etc.
7300
7301 language_hooks="Make-hooks"
7302
7303 for lang in ${srcdir}/*/config-lang.in
7304 do
7305 changequote(,)dnl
7306 test "$lang" = "${srcdir}/*/config-lang.in" && continue
7307
7308 lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang`
7309 if test "x$lang_alias" = x
7310 then
7311 echo "$lang doesn't set \$language." 1>&2
7312 exit 1
7313 fi
7314 subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
7315 subdirs="$subdirs $subdir"
7316
7317 # $gcc_subdir is where the gcc integration files are to be found
7318 # for a language, both for internal compiler purposes (compiler
7319 # sources implementing front-end to GCC tree converters), and for
7320 # build infrastructure purposes (Make-lang.in, etc.)
7321 #
7322 # This will be <subdir> (relative to $srcdir) if a line like
7323 # gcc_subdir="<subdir>" or gcc_subdir=<subdir>
7324 # is found in <langdir>/config-lang.in, and will remain <langdir>
7325 # otherwise.
7326 #
7327 # Except for the language alias (fetched above), the regular
7328 # "config-lang.in" contents are always retrieved from $gcc_subdir,
7329 # so a <langdir>/config-lang.in setting gcc_subdir typically sets
7330 # only this and the language alias.
7331
7332 gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^ ]*\).*$,\1,p' $lang`
7333 if [ "$gcc_subdir" = "" ]; then
7334 gcc_subdir="$subdir"
7335 fi
7336
7337 case ",$enable_languages," in
7338 *,$lang_alias,*)
7339 all_selected_languages="$all_selected_languages $lang_alias"
7340 if test -f $srcdir/$gcc_subdir/lang-specs.h; then
7341 lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h"
7342 fi
7343 ;;
7344 esac
7345 changequote([,])dnl
7346
7347 language=
7348 boot_language=
7349 compilers=
7350 outputs=
7351 gtfiles=
7352 subdir_requires=
7353 . ${srcdir}/$gcc_subdir/config-lang.in
7354 if test "x$language" = x
7355 then
7356 echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2
7357 exit 1
7358 fi
7359
7360 ok=:
7361 case ",$enable_languages," in
7362 *,$lang_alias,*) ;;
7363 *)
7364 for i in $subdir_requires; do
7365 test -f "${srcdir}/$i/config-lang.in" && continue
7366 ok=false
7367 break
7368 done
7369 ;;
7370 esac
7371 $ok || continue
7372
7373 all_lang_configurefrags="$all_lang_configurefrags \$(srcdir)/$gcc_subdir/config-lang.in"
7374 if test "x$language" = xc && test -n "$all_lang_makefrags"; then
7375 # Put c/Make-lang.in fragment first to match serialization languages order.
7376 all_lang_makefrags="\$(srcdir)/$gcc_subdir/Make-lang.in $all_lang_makefrags"
7377 else
7378 all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in"
7379 fi
7380 if test -f $srcdir/$gcc_subdir/lang.opt; then
7381 lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
7382 all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"
7383 fi
7384 if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then
7385 lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def"
7386 fi
7387 all_languages="$all_languages $language"
7388 all_compilers="$all_compilers $compilers"
7389 all_outputs="$all_outputs $outputs"
7390 all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
7391 case ",$enable_languages," in
7392 *,lto,*)
7393 AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.])
7394 enable_lto=yes
7395 AC_SUBST(enable_lto)
7396 ;;
7397 *) ;;
7398 esac
7399 done
7400
7401 check_languages=
7402 for language in $all_selected_languages
7403 do
7404 check_languages="$check_languages check-$language"
7405 done
7406 if test x$enable_libgdiagnostics = xyes; then
7407 check_languages="$check_languages check-libgdiagnostics check-sarif-replay"
7408 fi
7409
7410 selftest_languages=
7411 for language in $all_selected_languages
7412 do
7413 selftest_languages="$selftest_languages selftest-$language"
7414 done
7415
7416 # We link each language in with a set of hooks, reached indirectly via
7417 # lang.${target}. Only do so for selected languages.
7418
7419 rm -f Make-hooks
7420 touch Make-hooks
7421 target_list="all.cross start.encap rest.encap tags \
7422 install-common install-man install-info install-dvi install-pdf \
7423 install-html dvi pdf html uninstall info man srcextra srcman srcinfo \
7424 mostlyclean clean distclean maintainer-clean install-plugin"
7425
7426 for t in $target_list
7427 do
7428 x=
7429 for lang in $all_selected_languages
7430 do
7431 x="$x $lang.$t"
7432 done
7433 echo "lang.$t: $x" >> Make-hooks
7434 done
7435
7436 echo "ifeq (\$(DO_LINK_SERIALIZATION),)" >> Make-hooks
7437 echo "SERIAL_LIST =" >> Make-hooks
7438 echo else >> Make-hooks
7439 lang_cnt=0
7440 lang_list=
7441 prev=c
7442 serialization_languages=c
7443 for lang in $all_selected_languages
7444 do
7445 test $lang = c && continue
7446 if test $lang = lto; then
7447 serialization_languages="$serialization_languages lto1 lto2"
7448 else
7449 serialization_languages="$serialization_languages $lang"
7450 fi
7451 done
7452 for lang in $serialization_languages
7453 do
7454 test $lang = c && continue
7455 lang_cnt=`expr $lang_cnt + 1`
7456 lang_list=" $prev$lang_list"
7457 prev=${lang}
7458 done
7459 echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks
7460 echo endif >> Make-hooks
7461 echo "SERIAL_COUNT = `expr $lang_cnt + 1`" >> Make-hooks
7462 echo "INDEX.c = 0" >> Make-hooks
7463 lang_idx=1
7464 for lang in $serialization_languages
7465 do
7466 test $lang = c && continue
7467 echo "$lang.prev = \$(if \$(word $lang_cnt,\$(SERIAL_LIST)),\$(\$(word $lang_cnt,\$(SERIAL_LIST)).serial))" >> Make-hooks
7468 echo "INDEX.$lang = $lang_idx" >> Make-hooks
7469 lang_cnt=`expr $lang_cnt - 1`
7470 lang_idx=`expr $lang_idx + 1`
7471 done
7472
7473 # --------
7474 # Option include files
7475 # --------
7476
7477 ${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk
7478 option_includes="option-includes.mk"
7479 AC_SUBST_FILE(option_includes)
7480
7481 # --------
7482 # UNSORTED
7483 # --------
7484
7485 # Create .gdbinit.
7486
7487 echo "dir ." > .gdbinit
7488 echo "dir ${srcdir}" >> .gdbinit
7489 if test x$gdb_needs_out_file_path = xyes
7490 then
7491 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
7492 fi
7493 if test "x$subdirs" != x; then
7494 for s in $subdirs
7495 do
7496 echo "dir ${srcdir}/$s" >> .gdbinit
7497 done
7498 fi
7499 echo "source ${srcdir}/gdbinit.in" >> .gdbinit
7500 echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit
7501
7502 # Put a breakpoint on __asan_report_error to help with debugging buffer
7503 # overflow.
7504 case "$CFLAGS" in
7505 *-fsanitize=address*)
7506 echo "source ${srcdir}/gdbasan.in" >> .gdbinit
7507 ;;
7508 esac
7509
7510 gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
7511 AC_SUBST(gcc_tooldir)
7512 AC_SUBST(dollar)
7513
7514 # Find a directory in which to install a shared libgcc.
7515
7516 AC_ARG_ENABLE(version-specific-runtime-libs,
7517 [AS_HELP_STRING([--enable-version-specific-runtime-libs],
7518 [specify that runtime libraries should be
7519 installed in a compiler-specific directory])])
7520
7521 # Substitute configuration variables
7522 AC_SUBST(subdirs)
7523 AC_SUBST(srcdir)
7524 AC_SUBST(all_compilers)
7525 AC_SUBST(all_gtfiles)
7526 AC_SUBST(all_lang_configurefrags)
7527 AC_SUBST(all_lang_makefrags)
7528 AC_SUBST(all_languages)
7529 AC_SUBST(all_selected_languages)
7530 AC_SUBST(build_exeext)
7531 AC_SUBST(build_install_headers_dir)
7532 AC_SUBST(build_xm_file_list)
7533 AC_SUBST(build_xm_include_list)
7534 AC_SUBST(build_xm_defines)
7535 AC_SUBST(build_file_translate)
7536 AC_SUBST(check_languages)
7537 AC_SUBST(selftest_languages)
7538 AC_SUBST(cpp_install_dir)
7539 AC_SUBST(xmake_file)
7540 AC_SUBST(tmake_file)
7541 AC_SUBST(TM_ENDIAN_CONFIG)
7542 AC_SUBST(TM_MULTILIB_CONFIG)
7543 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
7544 AC_SUBST(extra_gcc_objs)
7545 AC_SUBST(user_headers_inc_next_pre)
7546 AC_SUBST(user_headers_inc_next_post)
7547 AC_SUBST(extra_headers_list)
7548 AC_SUBST(extra_objs)
7549 AC_SUBST(extra_programs)
7550 AC_SUBST(float_h_file)
7551 AC_SUBST(gcc_config_arguments)
7552 AC_SUBST(gcc_gxx_include_dir)
7553 AC_SUBST(gcc_gxx_include_dir_add_sysroot)
7554 AC_SUBST(gcc_gxx_libcxx_include_dir)
7555 AC_SUBST(gcc_gxx_libcxx_include_dir_add_sysroot)
7556 AC_SUBST(host_exeext)
7557 AC_SUBST(host_xm_file_list)
7558 AC_SUBST(host_xm_include_list)
7559 AC_SUBST(host_xm_defines)
7560 AC_SUBST(out_host_hook_obj)
7561 AC_SUBST(install)
7562 AC_SUBST(lang_opt_files)
7563 AC_SUBST(lang_specs_files)
7564 AC_SUBST(lang_tree_files)
7565 AC_SUBST(local_prefix)
7566 AC_SUBST(md_file)
7567 AC_SUBST(objc_boehm_gc)
7568 AC_SUBST(out_file)
7569 AC_SUBST(out_object_file)
7570 AC_SUBST(common_out_file)
7571 AC_SUBST(common_out_object_file)
7572 AC_SUBST(tm_file_list)
7573 AC_SUBST(tm_include_list)
7574 AC_SUBST(tm_defines)
7575 AC_SUBST(tm_p_file_list)
7576 AC_SUBST(tm_p_include_list)
7577 AC_SUBST(tm_d_file_list)
7578 AC_SUBST(tm_d_include_list)
7579 AC_SUBST(tm_rust_file_list)
7580 AC_SUBST(tm_rust_include_list)
7581 AC_SUBST(xm_file_list)
7582 AC_SUBST(xm_include_list)
7583 AC_SUBST(xm_defines)
7584 AC_SUBST(use_gcc_stdint)
7585 AC_SUBST(c_target_objs)
7586 AC_SUBST(cxx_target_objs)
7587 AC_SUBST(fortran_target_objs)
7588 AC_SUBST(d_target_objs)
7589 AC_SUBST(rust_target_objs)
7590 AC_SUBST(target_cpu_default)
7591
7592 AC_SUBST_FILE(language_hooks)
7593
7594 # Echo link setup.
7595 if test x${build} = x${host} ; then
7596 if test x${host} = x${target} ; then
7597 echo "Links are now set up to build a native compiler for ${target}." 1>&2
7598 else
7599 echo "Links are now set up to build a cross-compiler" 1>&2
7600 echo " from ${host} to ${target}." 1>&2
7601 fi
7602 else
7603 if test x${host} = x${target} ; then
7604 echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
7605 echo " for ${target}." 1>&2
7606 else
7607 echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
7608 echo " from ${host} to ${target}." 1>&2
7609 fi
7610 fi
7611
7612 AC_ARG_VAR(GMPLIBS,[How to link GMP])
7613 AC_ARG_VAR(GMPINC,[How to find GMP include files])
7614
7615 AC_ARG_VAR(ISLLIBS,[How to link isl])
7616 AC_ARG_VAR(ISLINC,[How to find isl include files])
7617 if test "x${ISLLIBS}" != "x" ; then
7618 AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
7619 fi
7620
7621 GCC_ENABLE_PLUGINS
7622 AC_SUBST(pluginlibs)
7623 AC_SUBST(enable_plugin)
7624 if test x"$enable_plugin" = x"yes"; then
7625 AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
7626 fi
7627
7628
7629 # Enable --enable-host-shared
7630 AC_ARG_ENABLE(host-shared,
7631 [AS_HELP_STRING([--enable-host-shared],
7632 [build host code as shared libraries])])
7633 AC_SUBST(enable_host_shared)
7634
7635 # Enable --enable-host-pie
7636 AC_ARG_ENABLE(host-pie,
7637 [AS_HELP_STRING([--enable-host-pie],
7638 [build host code as PIE])])
7639 AC_SUBST(enable_host_pie)
7640
7641 AC_ARG_ENABLE(libgdiagnostics,
7642 [AS_HELP_STRING([--enable-libgdiagnostics],
7643 [build libgdiagnostics shared library])])
7644 AC_SUBST(enable_libgdiagnostics)
7645
7646 if test "$enable_libgdiagnostics" = "yes"; then
7647 LIBGDIAGNOSTICS='libgdiagnostics sarif-replay'
7648 else
7649 LIBGDIAGNOSTICS=''
7650 fi
7651 AC_SUBST(LIBGDIAGNOSTICS)
7652
7653
7654 # Enable --enable-host-bind-now
7655 AC_ARG_ENABLE(host-bind-now,
7656 [AS_HELP_STRING([--enable-host-bind-now],
7657 [link host code as BIND_NOW])])
7658 AC_SUBST(enable_host_bind_now)
7659
7660 AC_ARG_ENABLE(libquadmath-support,
7661 [AS_HELP_STRING([--disable-libquadmath-support],
7662 [disable libquadmath support for Fortran])],
7663 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
7664 ENABLE_LIBQUADMATH_SUPPORT=yes)
7665 if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then
7666 AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1,
7667 [Define to 1 to enable libquadmath support])
7668 fi
7669
7670
7671 # Specify what hash style to use by default.
7672 AC_ARG_WITH([linker-hash-style],
7673 [AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
7674 [specify the linker hash style])],
7675 [case x"$withval" in
7676 xsysv)
7677 LINKER_HASH_STYLE=sysv
7678 ;;
7679 xgnu)
7680 LINKER_HASH_STYLE=gnu
7681 ;;
7682 xboth)
7683 LINKER_HASH_STYLE=both
7684 ;;
7685 *)
7686 AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
7687 ;;
7688 esac],
7689 [LINKER_HASH_STYLE=''])
7690 if test x"${LINKER_HASH_STYLE}" != x; then
7691 AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
7692 [The linker hash style])
7693 fi
7694
7695 # Specify what should be the default of -fdiagnostics-color option.
7696 AC_ARG_WITH([diagnostics-color],
7697 [AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
7698 [specify the default of -fdiagnostics-color option
7699 auto-if-env stands for -fdiagnostics-color=auto if
7700 GCC_COLOR environment variable is present and
7701 -fdiagnostics-color=never otherwise])],
7702 [case x"$withval" in
7703 xnever)
7704 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO
7705 ;;
7706 xauto)
7707 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
7708 ;;
7709 xauto-if-env)
7710 DIAGNOSTICS_COLOR_DEFAULT=-1
7711 ;;
7712 xalways)
7713 DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES
7714 ;;
7715 *)
7716 AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-color])
7717 ;;
7718 esac],
7719 [DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO])
7720 AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT,
7721 [The default for -fdiagnostics-color option])
7722
7723 # Specify what should be the default of -fdiagnostics-urls option.
7724 AC_ARG_WITH([diagnostics-urls],
7725 [AC_HELP_STRING([--with-diagnostics-urls={never,auto,auto-if-env,always}],
7726 [specify the default of -fdiagnostics-urls option
7727 auto-if-env stands for -fdiagnostics-urls=auto if
7728 GCC_URLS or TERM_URLS environment variable is present and
7729 -fdiagnostics-urls=never otherwise])],
7730 [case x"$withval" in
7731 xnever)
7732 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_NO
7733 ;;
7734 xauto)
7735 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO
7736 ;;
7737 xauto-if-env)
7738 DIAGNOSTICS_URLS_DEFAULT=-1
7739 ;;
7740 xalways)
7741 DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_YES
7742 ;;
7743 *)
7744 AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-urls])
7745 ;;
7746 esac],
7747 [DIAGNOSTICS_URLS_DEFAULT=DIAGNOSTICS_URL_AUTO])
7748 AC_DEFINE_UNQUOTED(DIAGNOSTICS_URLS_DEFAULT, $DIAGNOSTICS_URLS_DEFAULT,
7749 [The default for -fdiagnostics-urls option])
7750
7751 # Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
7752 # of jit/jit-playback.cc.
7753 gcc_driver_version=`eval "${get_gcc_base_ver} $srcdir/BASE-VER"`
7754 echo "gcc_driver_version: ${gcc_driver_version}"
7755 cat > gcc-driver-name.h <<EOF
7756 #define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_driver_version}${exeext}"
7757 EOF
7758
7759 # Check whether --enable-versioned-jit was given.
7760 AC_ARG_ENABLE(versioned-jit,
7761 [AS_HELP_STRING([--enable-versioned-jit],
7762 [enable versioned libgccjit build])],
7763 enable_versioned_jit=$enableval,
7764 enable_versioned_jit=no)
7765 if test x$enable_versioned_jit = xyes ; then
7766 libgccjit_version=$gcc_driver_version
7767 elif test x$enable_versioned_jit = xno ; then
7768 libgccjit_version=0
7769 else
7770 AC_MSG_ERROR(bad value ${enableval} given for --enable-versioned-jit option)
7771 fi
7772 AC_SUBST([libgccjit_version])
7773
7774 # Check whether --enable-default-pie was given.
7775 AC_ARG_ENABLE(default-pie,
7776 [AS_HELP_STRING([--enable-default-pie],
7777 [enable Position Independent Executable as default])],
7778 enable_default_pie=$enableval,
7779 enable_default_pie=no)
7780 if test x$enable_default_pie = xyes ; then
7781 AC_DEFINE(ENABLE_DEFAULT_PIE, 1,
7782 [Define if your target supports default PIE and it is enabled.])
7783 fi
7784 AC_SUBST([enable_default_pie])
7785
7786 # Check if -fno-PIE works.
7787 AC_CACHE_CHECK([for -fno-PIE option],
7788 [gcc_cv_c_no_fpie],
7789 [saved_CXXFLAGS="$CXXFLAGS"
7790 CXXFLAGS="$CXXFLAGS -fno-PIE"
7791 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
7792 [gcc_cv_c_no_fpie=yes],
7793 [gcc_cv_c_no_fpie=no])
7794 CXXFLAGS="$saved_CXXFLAGS"])
7795
7796 # Check if -no-pie works.
7797 AC_CACHE_CHECK([for -no-pie option],
7798 [gcc_cv_no_pie],
7799 [saved_LDFLAGS="$LDFLAGS"
7800 LDFLAGS="$LDFLAGS -no-pie"
7801 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
7802 [gcc_cv_no_pie=yes],
7803 [gcc_cv_no_pie=no])
7804 LDFLAGS="$saved_LDFLAGS"])
7805
7806 if test x$enable_host_shared = xyes; then
7807 PICFLAG=-fPIC
7808 elif test x$enable_host_pie = xyes; then
7809 PICFLAG=-fPIE
7810 elif test x$gcc_cv_c_no_fpie = xyes; then
7811 PICFLAG=-fno-PIE
7812 else
7813 PICFLAG=
7814 fi
7815
7816 AC_SUBST([PICFLAG])
7817
7818 if test x$enable_host_pie = xyes; then
7819 LD_PICFLAG=-pie
7820 elif test x$gcc_cv_no_pie = xyes; then
7821 LD_PICFLAG=-no-pie
7822 else
7823 LD_PICFLAG=
7824 fi
7825
7826 if test x$enable_host_bind_now = xyes; then
7827 LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"
7828 fi
7829
7830 AC_SUBST([LD_PICFLAG])
7831
7832 # Enable Intel CET on Intel CET enabled host if jit is enabled.
7833 GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
7834 case x$enable_languages in
7835 *jit*)
7836 ;;
7837 *)
7838 CET_HOST_FLAGS=
7839 ;;
7840 esac
7841 AC_SUBST(CET_HOST_FLAGS)
7842
7843 # Check linker supports '-z bndplt'
7844 ld_bndplt_support=no
7845 AC_MSG_CHECKING(linker -z bndplt option)
7846 if test x"$ld_is_gold" = xno; then
7847 if test $in_tree_ld = yes ; then
7848 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
7849 ld_bndplt_support=yes
7850 fi
7851 elif test x$gcc_cv_ld != x; then
7852 # Check if linker supports -z bndplt option
7853 if $gcc_cv_ld --help 2>&1 | grep -- '-z bndplt' > /dev/null; then
7854 ld_bndplt_support=yes
7855 fi
7856 fi
7857 fi
7858 if test x"$ld_bndplt_support" = xyes; then
7859 AC_DEFINE(HAVE_LD_BNDPLT_SUPPORT, 1,
7860 [Define if your linker supports -z bndplt])
7861 fi
7862 AC_MSG_RESULT($ld_bndplt_support)
7863
7864 # Check linker supports '--push-state'/'--pop-state'
7865 ld_pushpopstate_support=no
7866 AC_MSG_CHECKING(linker --push-state/--pop-state options)
7867 if test x"$ld_is_gold" = xno; then
7868 if test $in_tree_ld = yes ; then
7869 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
7870 ld_pushpopstate_support=yes
7871 fi
7872 elif test x$gcc_cv_ld != x; then
7873 # Check if linker supports --push-state/--pop-state options
7874 if $gcc_cv_ld --help 2>&1 | grep -- '--push-state' > /dev/null; then
7875 ld_pushpopstate_support=yes
7876 fi
7877 fi
7878 fi
7879 if test x"$ld_pushpopstate_support" = xyes; then
7880 AC_DEFINE(HAVE_LD_PUSHPOPSTATE_SUPPORT, 1,
7881 [Define if your linker supports --push-state/--pop-state])
7882 fi
7883 AC_MSG_RESULT($ld_pushpopstate_support)
7884
7885 # On s390, float_t has historically been statically defined as double for no
7886 # good reason. To comply with the C standard in the light of this definition,
7887 # gcc has evaluated float expressions in double precision when in
7888 # standards-compatible mode or when given -fexcess-precision=standard. To enable
7889 # a smooth transition towards the new model used by most architectures, where
7890 # gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives
7891 # float_t from that, this behavior can be configured with
7892 # --enable-s390-excess-float-precision. When given as enabled, that flag selects
7893 # the old model. When omitted, native builds and cross compiles that have target
7894 # libc headers will detect whether libc clamps float_t to double and in that
7895 # case maintain the old model. Otherwise, they will default to the new model.
7896 AC_ARG_ENABLE(s390-excess-float-precision,
7897 [AS_HELP_STRING([--enable-s390-excess-float-precision],
7898 [on s390 targets, evaluate float with double precision
7899 when in standards-conforming mode])],
7900 [],[enable_s390_excess_float_precision=auto])
7901
7902 case $target in
7903 s390*-linux*)
7904 if test x"$enable_s390_excess_float_precision" = xauto; then
7905 # Can we autodetect the behavior of the target libc?
7906 if test "$target" = "$host" -a "$host" = "$build"; then
7907 enable_s390_excess_float_precision=autodetect
7908 elif test "x$with_headers" != xno; then
7909 # cross build. are target headers available?
7910 # carefully coerce the build-system compiler to use target headers
7911 saved_CXXFLAGS="$CXXFLAGS"
7912 fixed_XGCC_FLAGS_FOR_TARGET=`echo "$XGCC_FLAGS_FOR_TARGET" | sed 's/-B/-idirafter/g'`
7913 CROSS_TEST_CXXFLAGS="-nostdinc $fixed_XGCC_FLAGS_FOR_TARGET"
7914 CXXFLAGS="$CROSS_TEST_CXXFLAGS"
7915 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7916 #include <math.h>
7917 ]])], [enable_s390_excess_float_precision=autodetect], [])
7918 CXXFLAGS="$saved_CXXFLAGS"
7919 fi
7920
7921 if test x"$enable_s390_excess_float_precision" = xautodetect; then
7922 saved_CXXFLAGS="$CXXFLAGS"
7923 if ! test "$target" = "$host" -a "$host" = "$build"; then
7924 CXXFLAGS="$CROSS_TEST_CXXFLAGS"
7925 unset CROSS_TEST_CXXFLAGS
7926 fi
7927 AC_CACHE_CHECK([for glibc clamping float_t to double],
7928 gcc_cv_float_t_clamped_to_double, [
7929 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7930 #define __FLT_EVAL_METHOD__ 0
7931 #include <math.h>
7932 int dummy[sizeof(float_t) == sizeof(double) ? 1 : -1];
7933 ]])],
7934 [gcc_cv_float_t_clamped_to_double=yes],
7935 [gcc_cv_float_t_clamped_to_double=no])])
7936 CXXFLAGS="$saved_CXXFLAGS"
7937 enable_s390_excess_float_precision="$gcc_cv_float_t_clamped_to_double"
7938 else
7939 # no way to detect behavior of target libc, default to new model
7940 enable_s390_excess_float_precision=no
7941 fi
7942 fi
7943
7944 GCC_TARGET_TEMPLATE(ENABLE_S390_EXCESS_FLOAT_PRECISION)
7945 if test x"$enable_s390_excess_float_precision" = xyes; then
7946 AC_DEFINE(ENABLE_S390_EXCESS_FLOAT_PRECISION, 1,
7947 [Define to enable evaluating float expressions with double precision in
7948 standards-compatible mode on s390 targets.])
7949 fi
7950 ;;
7951 esac
7952
7953 # Check if the linker supports '-z now'
7954 ld_now_support=no
7955 AC_MSG_CHECKING(linker -z now option)
7956 if test x"$ld_is_gold" = xyes; then
7957 ld_now_support=yes
7958 elif test $in_tree_ld = yes ; then
7959 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 14 -o "$gcc_cv_gld_major_version" -gt 2; then
7960 ld_now_support=yes
7961 fi
7962 elif test x$gcc_cv_ld != x; then
7963 # Check if linker supports -z now
7964 if $gcc_cv_ld --help 2>&1 | grep -- '-z now' > /dev/null; then
7965 ld_now_support=yes
7966 fi
7967 fi
7968 AC_DEFINE_UNQUOTED(HAVE_LD_NOW_SUPPORT,
7969 [`if test x"$ld_now_support" = xyes; then echo 1; else echo 0; fi`],
7970 [Define 0/1 if your linker supports -z now])
7971 AC_MSG_RESULT($ld_now_support)
7972
7973 # Check if the linker supports '-z relro'
7974 ld_relro_support=no
7975 AC_MSG_CHECKING(linker -z relro option)
7976 if test x"$ld_is_gold" = xyes; then
7977 ld_relro_support=yes
7978 elif test $in_tree_ld = yes ; then
7979 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2; then
7980 ld_relro_support=yes
7981 fi
7982 elif test x$gcc_cv_ld != x; then
7983 # Check if linker supports -z relro
7984 if $gcc_cv_ld --help 2>&1 | grep -- '-z relro' > /dev/null; then
7985 ld_relro_support=yes
7986 fi
7987 fi
7988 AC_DEFINE_UNQUOTED(HAVE_LD_RELRO_SUPPORT,
7989 [`if test x"$ld_relro_support" = xyes; then echo 1; else echo 0; fi`],
7990 [Define 0/1 if your linker supports -z relro])
7991 AC_MSG_RESULT($ld_relro_support)
7992
7993 case $target_os in
7994 linux* | gnu*)
7995 # -fhardened is only supported on GNU/Linux.
7996 fhardened_support=yes
7997 ;;
7998 *)
7999 fhardened_support=no
8000 ;;
8001 esac
8002
8003 AC_DEFINE_UNQUOTED(HAVE_FHARDENED_SUPPORT,
8004 [`if test x"$fhardened_support" = xyes; then echo 1; else echo 0; fi`],
8005 [Define 0/1 if -fhardened is supported])
8006 AC_MSG_RESULT($fhardened_support)
8007
8008 # Configure the subdirectories
8009 # AC_CONFIG_SUBDIRS($subdirs)
8010
8011 # Create the Makefile
8012 # and configure language subdirectories
8013 AC_CONFIG_FILES($all_outputs)
8014
8015 AC_CONFIG_COMMANDS([default],
8016 [
8017 case ${CONFIG_HEADERS} in
8018 *auto-host.h:config.in*)
8019 echo > cstamp-h ;;
8020 esac
8021 # Make sure all the subdirs exist.
8022 for d in $subdirs doc build common c-family
8023 do
8024 test -d $d || mkdir $d
8025 done
8026 ],
8027 [subdirs='$subdirs'])
8028 AC_OUTPUT