summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/config/picflag.m4
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-06-13 12:38:00 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2014-06-13 12:38:00 -0700
commit54f1b3cf509cd889905287cb8ce6c5ae33911a21 (patch)
treee39b1a7fa04db86a8215b7f9d4656d74e394aec0 /binutils-2.25/config/picflag.m4
parent2a6558a8ecfb81d75215b4ec7dc61113e12cfd5f (diff)
downloadtoolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.gz
toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.bz2
toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.zip
Add upstream binutils-2.25 snapshot 4/4 2014
For MIPS -mmsa support Change-Id: I08c4f002fa7b33dec85ed75956e6ab551bb03c96
Diffstat (limited to 'binutils-2.25/config/picflag.m4')
-rw-r--r--binutils-2.25/config/picflag.m494
1 files changed, 94 insertions, 0 deletions
diff --git a/binutils-2.25/config/picflag.m4 b/binutils-2.25/config/picflag.m4
new file mode 100644
index 00000000..2ee5cd07
--- /dev/null
+++ b/binutils-2.25/config/picflag.m4
@@ -0,0 +1,94 @@
+# _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*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ $1=-fno-common
+ ;;
+ alpha*-dec-osf5*)
+ # PIC is the default.
+ ;;
+ hppa*64*-*-hpux*)
+ # PIC is the default for 64-bit PA HP-UX.
+ ;;
+ i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
+ ;;
+ i[[34567]]86-*-mingw* | x86_64-*-mingw*)
+ ;;
+ i[[34567]]86-*-interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ 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
+ ;;
+ 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
+ ;;
+ m68k-*-*)
+ $1=-fpic
+ ;;
+ # FIXME: Override -fPIC default in libgcc only?
+ sh-*-linux* | sh[[2346lbe]]*-*-linux*)
+ $1=-fpic
+ ;;
+ # FIXME: Simplify to sh*-*-netbsd*?
+ sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+ sh64-*-netbsd* | sh64l*-*-netbsd*)
+ $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])])