2011-08-22 16:54:02 +00:00
|
|
|
# _GCC_PICFLAG(FLAG, DISPATCH)
|
|
|
|
# ----------------------------
|
|
|
|
# Store PIC flag corresponding to DISPATCH triplet in FLAG.
|
|
|
|
# Explit use of -fpic in CFLAGS corresponding to FLAG overrides default.
|
|
|
|
AC_DEFUN([_GCC_PICFLAG], [
|
|
|
|
|
|
|
|
case "${$2}" in
|
|
|
|
# PIC is the default on some targets or must not be used.
|
|
|
|
*-*-darwin*)
|
2015-04-10 06:43:52 +00:00
|
|
|
# For darwin, common symbols are not allowed in MH_DYLIB files
|
|
|
|
case "${CFLAGS}" in
|
|
|
|
# If we are using a compiler supporting mdynamic-no-pic
|
|
|
|
# and the option has been tested as safe to add, then cancel
|
|
|
|
# it here, since the code generated is incompatible with shared
|
2017-01-04 08:29:34 +00:00
|
|
|
# libs.
|
2015-04-10 06:43:52 +00:00
|
|
|
*-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
|
|
|
|
*) $1=-fno-common ;;
|
|
|
|
esac
|
2011-08-22 16:54:02 +00:00
|
|
|
;;
|
|
|
|
alpha*-dec-osf5*)
|
|
|
|
# PIC is the default.
|
|
|
|
;;
|
|
|
|
hppa*64*-*-hpux*)
|
|
|
|
# PIC is the default for 64-bit PA HP-UX.
|
|
|
|
;;
|
2013-03-27 21:53:32 +00:00
|
|
|
i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
|
|
|
|
;;
|
|
|
|
i[[34567]]86-*-mingw* | x86_64-*-mingw*)
|
2011-08-22 16:54:02 +00:00
|
|
|
;;
|
2016-12-07 23:16:03 +00:00
|
|
|
i[[34567]]86-*-interix[[3-9]]*)
|
|
|
|
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
|
|
|
|
# Instead, we relocate shared libraries at runtime.
|
|
|
|
;;
|
2011-08-22 16:54:02 +00:00
|
|
|
i[[34567]]86-*-nto-qnx*)
|
|
|
|
# QNX uses GNU C++, but need to define -shared option too, otherwise
|
|
|
|
# it will coredump.
|
|
|
|
$1='-fPIC -shared'
|
|
|
|
;;
|
|
|
|
i[[34567]]86-pc-msdosdjgpp*)
|
|
|
|
# DJGPP does not support shared libraries at all.
|
|
|
|
;;
|
|
|
|
ia64*-*-hpux*)
|
|
|
|
# On IA64 HP-UX, PIC is the default but the pic flag
|
|
|
|
# sets the default TLS model and affects inlining.
|
|
|
|
$1=-fPIC
|
|
|
|
;;
|
2021-11-27 07:09:11 +00:00
|
|
|
loongarch*-*-*)
|
|
|
|
$1=-fpic
|
|
|
|
;;
|
2011-08-22 16:54:02 +00:00
|
|
|
mips-sgi-irix6*)
|
|
|
|
# PIC is the default.
|
|
|
|
;;
|
|
|
|
rs6000-ibm-aix* | powerpc-ibm-aix*)
|
|
|
|
# All AIX code is PIC.
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Some targets support both -fPIC and -fpic, but prefer the latter.
|
|
|
|
# FIXME: Why?
|
|
|
|
i[[34567]]86-*-* | x86_64-*-*)
|
|
|
|
$1=-fpic
|
|
|
|
;;
|
|
|
|
# FIXME: Override -fPIC default in libgcc only?
|
|
|
|
sh-*-linux* | sh[[2346lbe]]*-*-linux*)
|
|
|
|
$1=-fpic
|
|
|
|
;;
|
Deprecate a.out support for NetBSD targets.
As discussed previously, a.out support is now quite deprecated, and in
some cases removed, in both Binutils itself and NetBSD, so this legacy
default makes little sense. `netbsdelf*` and `netbsdaout*` still work
allowing the user to be explicit about there choice. Additionally, the
configure script warns about the change as Nick Clifton requested.
One possible concern was the status of NetBSD on NS32K, where only a.out
was supported. But per [1] NetBSD has removed support, and if it were to
come back, it would be with ELF. The binutils implementation is
therefore marked obsolete, per the instructions in the last message.
With that patch and this one applied, I have confirmed the following:
--target=i686-unknown-netbsd
--target=i686-unknown-netbsdelf
builds completely
--target=i686-unknown-netbsdaout
properly fails because target is deprecated.
--target=vax-unknown-netbsdaout builds completely except for gas, where
the target is deprecated.
[1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html
config/ChangeLog:
* picflag.m4: Simplify SHmedia NetBSD match by presuming ELF.
gcc/ChangeLog:
* configure: Regenerate.
libada/ChangeLog:
* configure: Regenerate.
libgcc/ChangeLog:
* configure: Regenerate.
libiberty/ChangeLog:
* configure: Regenerate.
2021-08-11 12:17:54 +00:00
|
|
|
sh*-*-netbsd*)
|
2011-08-22 16:54:02 +00:00
|
|
|
$1=-fpic
|
|
|
|
;;
|
|
|
|
# Default to -fPIC unless specified otherwise.
|
|
|
|
*)
|
|
|
|
$1=-fPIC
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If the user explicitly uses -fpic/-fPIC, keep that.
|
|
|
|
case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
|
|
|
|
*-fpic*)
|
|
|
|
$1=-fpic
|
|
|
|
;;
|
|
|
|
*-fPIC*)
|
|
|
|
$1=-fPIC
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
# GCC_PICFLAG
|
|
|
|
# -----------
|
|
|
|
# Store host PIC flag in PICFLAG.
|
|
|
|
AC_DEFUN([GCC_PICFLAG], [
|
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
|
|
_GCC_PICFLAG([PICFLAG], [host])])
|
|
|
|
|
|
|
|
# GCC_PICFLAG_FOR_TARGET
|
|
|
|
# ----------------------
|
|
|
|
# Store target PIC flag in PICFLAG_FOR_TARGET.
|
|
|
|
AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
|
|
|
|
AC_REQUIRE([AC_CANONICAL_TARGET])
|
|
|
|
_GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])
|