]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - config/picflag.m4
gdb.base/watchpoint-running.exp: Run sw watch tests even if no hw watch
[thirdparty/binutils-gdb.git] / config / picflag.m4
CommitLineData
9a39e741
RO
1# _GCC_PICFLAG(FLAG, DISPATCH)
2# ----------------------------
3# Store PIC flag corresponding to DISPATCH triplet in FLAG.
4# Explit use of -fpic in CFLAGS corresponding to FLAG overrides default.
5AC_DEFUN([_GCC_PICFLAG], [
6
7case "${$2}" in
8 # PIC is the default on some targets or must not be used.
9 *-*-darwin*)
f91ca6bc
IB
10 # For darwin, common symbols are not allowed in MH_DYLIB files
11 case "${CFLAGS}" in
12 # If we are using a compiler supporting mdynamic-no-pic
13 # and the option has been tested as safe to add, then cancel
14 # it here, since the code generated is incompatible with shared
0913ae5a 15 # libs.
f91ca6bc
IB
16 *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
17 *) $1=-fno-common ;;
18 esac
9a39e741
RO
19 ;;
20 alpha*-dec-osf5*)
21 # PIC is the default.
22 ;;
23 hppa*64*-*-hpux*)
24 # PIC is the default for 64-bit PA HP-UX.
25 ;;
2cc10f5b
JBG
26 i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
27 ;;
28 i[[34567]]86-*-mingw* | x86_64-*-mingw*)
9a39e741 29 ;;
acf89cab 30 i[[34567]]86-*-interix[[3-9]]*)
9a39e741
RO
31 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
32 # Instead, we relocate shared libraries at runtime.
33 ;;
34 i[[34567]]86-*-nto-qnx*)
35 # QNX uses GNU C++, but need to define -shared option too, otherwise
36 # it will coredump.
37 $1='-fPIC -shared'
38 ;;
39 i[[34567]]86-pc-msdosdjgpp*)
40 # DJGPP does not support shared libraries at all.
41 ;;
42 ia64*-*-hpux*)
43 # On IA64 HP-UX, PIC is the default but the pic flag
44 # sets the default TLS model and affects inlining.
45 $1=-fPIC
46 ;;
6f3674d7
AM
47 loongarch*-*-*)
48 $1=-fpic
49 ;;
9a39e741
RO
50 mips-sgi-irix6*)
51 # PIC is the default.
52 ;;
53 rs6000-ibm-aix* | powerpc-ibm-aix*)
54 # All AIX code is PIC.
55 ;;
56
57 # Some targets support both -fPIC and -fpic, but prefer the latter.
58 # FIXME: Why?
59 i[[34567]]86-*-* | x86_64-*-*)
60 $1=-fpic
61 ;;
9a39e741
RO
62 # FIXME: Override -fPIC default in libgcc only?
63 sh-*-linux* | sh[[2346lbe]]*-*-linux*)
64 $1=-fpic
65 ;;
ab4f385b 66 sh*-*-netbsd*)
9a39e741
RO
67 $1=-fpic
68 ;;
69 # Default to -fPIC unless specified otherwise.
70 *)
71 $1=-fPIC
72 ;;
73esac
74
75# If the user explicitly uses -fpic/-fPIC, keep that.
76case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
77 *-fpic*)
78 $1=-fpic
79 ;;
80 *-fPIC*)
81 $1=-fPIC
82 ;;
83esac
84])
85
86# GCC_PICFLAG
87# -----------
88# Store host PIC flag in PICFLAG.
89AC_DEFUN([GCC_PICFLAG], [
90 AC_REQUIRE([AC_CANONICAL_HOST])
91 _GCC_PICFLAG([PICFLAG], [host])])
92
93# GCC_PICFLAG_FOR_TARGET
94# ----------------------
95# Store target PIC flag in PICFLAG_FOR_TARGET.
96AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
97 AC_REQUIRE([AC_CANONICAL_TARGET])
98 _GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])