]>
Commit | Line | Data |
---|---|---|
be8fff81 | 1 | # The -mdynamic-no-pic ensures that the compiler executable is built without |
54258e22 IS |
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. | |
c5b7af24 | 6 | |
54258e22 IS |
7 | # We use Werror, since some versions of clang report unknown command line flags |
8 | # as a warning only. | |
cacf1f59 | 9 | |
54258e22 IS |
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. | |
23b740db | 13 | |
d39367fa IS |
14 | # We cannot use mdynamic-no-pic when building shared host resources. |
15 | ||
16 | ifeq (${host_shared},no) | |
54258e22 IS |
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) | |
d39367fa IS |
20 | else |
21 | BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false | |
22 | endif | |
cacf1f59 | 23 | |
54258e22 IS |
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 | |
d39367fa | 30 | ifeq (${host_shared},no) |
54258e22 IS |
31 | # Add -mdynamic-no-pic to later stages when we know it is built with GCC. |
32 | BOOT_CFLAGS += -mdynamic-no-pic | |
d39367fa | 33 | endif |
54258e22 IS |
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 |