]> git.ipfire.org Git - thirdparty/gcc.git/blob - config/mh-darwin
fortran: Rename TRUE/FALSE to true/false in *.cc files
[thirdparty/gcc.git] / config / mh-darwin
1 # The -mdynamic-no-pic ensures that the compiler executable is built without
2 # position-independent-code -- the usual default on Darwin. This speeds compiles
3 # by 8-20% (measurements made against GCC-11).
4 # However, we cannot add it unless the bootstrap compiler supports
5 # -mno-dynamic-no-pic to undo it, since libiberty, at least, needs this.
6
7 # We use Werror, since some versions of clang report unknown command line flags
8 # as a warning only.
9
10 # We only need to determine this for the host tool used to build stage1 (or a
11 # non-bootstrapped compiler), later stages will be built by GCC which supports
12 # the required flags.
13
14 # We cannot use mdynamic-no-pic when building shared host resources.
15
16 ifeq (${host_shared},no)
17 BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := $(shell \
18 $(CC) -S -xc /dev/null -o /dev/null -Werror -mno-dynamic-no-pic 2>/dev/null \
19 && echo true)
20 else
21 BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
22 endif
23
24 @if gcc-bootstrap
25 ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
26 STAGE1_CFLAGS += -mdynamic-no-pic
27 else
28 STAGE1_CFLAGS += -fPIC
29 endif
30 ifeq (${host_shared},no)
31 # Add -mdynamic-no-pic to later stages when we know it is built with GCC.
32 BOOT_CFLAGS += -mdynamic-no-pic
33 endif
34 @endif gcc-bootstrap
35
36 @unless gcc-bootstrap
37 ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
38 # FIXME: we should also enable this for cross and non-bootstrap builds but
39 # that needs amendment to libcc1.
40 # CFLAGS += -mdynamic-no-pic
41 # CXXFLAGS += -mdynamic-no-pic
42 else
43 CFLAGS += -fPIC
44 CXXFLAGS += -fPIC
45 endif
46 @endunless gcc-bootstrap