]> git.ipfire.org Git - thirdparty/gcc.git/blame - config/mh-darwin
Handle failure to determine pointer provenance conservatively [PR104069].
[thirdparty/gcc.git] / config / mh-darwin
CommitLineData
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
16ifeq (${host_shared},no)
54258e22
IS
17BOOTSTRAP_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
20else
21BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
22endif
cacf1f59 23
54258e22
IS
24@if gcc-bootstrap
25ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
26STAGE1_CFLAGS += -mdynamic-no-pic
27else
28STAGE1_CFLAGS += -fPIC
29endif
d39367fa 30ifeq (${host_shared},no)
54258e22
IS
31# Add -mdynamic-no-pic to later stages when we know it is built with GCC.
32BOOT_CFLAGS += -mdynamic-no-pic
d39367fa 33endif
54258e22
IS
34@endif gcc-bootstrap
35
36@unless gcc-bootstrap
37ifeq (${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
42else
43CFLAGS += -fPIC
44CXXFLAGS += -fPIC
45endif
46@endunless gcc-bootstrap