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.
7 # We use Werror, since some versions of clang report unknown command line flags
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
14 # We cannot use mdynamic-no-pic when building shared host resources.
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 \
21 BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
25 ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
26 STAGE1_CFLAGS += -mdynamic-no-pic
28 STAGE1_CFLAGS += -fPIC
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
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
46 @endunless gcc-bootstrap