2004-09-01 05:34:59 +02:00
|
|
|
|
# The -mdynamic-no-pic ensures that the compiler executable is built without
|
2021-07-03 16:42:16 +02:00
|
|
|
|
# position-independent-code -- the usual default on Darwin. This speeds compiles
|
|
|
|
|
# by 8-20% (measurements made against GCC-11).
|
|
|
|
|
# However, we cannot add it unless the bootstrap compiler supports
|
|
|
|
|
# -mno-dynamic-no-pic to undo it, since libiberty, at least, needs this.
|
2011-06-16 03:31:38 +02:00
|
|
|
|
|
2021-07-03 16:42:16 +02:00
|
|
|
|
# We use Werror, since some versions of clang report unknown command line flags
|
|
|
|
|
# as a warning only.
|
2015-04-10 08:43:52 +02:00
|
|
|
|
|
2021-07-03 16:42:16 +02:00
|
|
|
|
# We only need to determine this for the host tool used to build stage1 (or a
|
|
|
|
|
# non-bootstrapped compiler), later stages will be built by GCC which supports
|
|
|
|
|
# the required flags.
|
2013-09-29 21:16:45 +02:00
|
|
|
|
|
2021-08-07 15:40:33 +02:00
|
|
|
|
# We cannot use mdynamic-no-pic when building shared host resources.
|
|
|
|
|
|
|
|
|
|
ifeq (${host_shared},no)
|
2021-07-03 16:42:16 +02:00
|
|
|
|
BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := $(shell \
|
|
|
|
|
$(CC) -S -xc /dev/null -o /dev/null -Werror -mno-dynamic-no-pic 2>/dev/null \
|
|
|
|
|
&& echo true)
|
2021-08-07 15:40:33 +02:00
|
|
|
|
else
|
|
|
|
|
BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
|
|
|
|
|
endif
|
2015-04-10 08:43:52 +02:00
|
|
|
|
|
2021-07-03 16:42:16 +02:00
|
|
|
|
@if gcc-bootstrap
|
|
|
|
|
ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
|
|
|
|
|
STAGE1_CFLAGS += -mdynamic-no-pic
|
|
|
|
|
else
|
|
|
|
|
STAGE1_CFLAGS += -fPIC
|
|
|
|
|
endif
|
2021-08-07 15:40:33 +02:00
|
|
|
|
ifeq (${host_shared},no)
|
2021-07-03 16:42:16 +02:00
|
|
|
|
# Add -mdynamic-no-pic to later stages when we know it is built with GCC.
|
|
|
|
|
BOOT_CFLAGS += -mdynamic-no-pic
|
2021-08-07 15:40:33 +02:00
|
|
|
|
endif
|
2021-07-03 16:42:16 +02:00
|
|
|
|
@endif gcc-bootstrap
|
|
|
|
|
|
|
|
|
|
@unless gcc-bootstrap
|
|
|
|
|
ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
|
|
|
|
|
# FIXME: we should also enable this for cross and non-bootstrap builds but
|
|
|
|
|
# that needs amendment to libcc1.
|
|
|
|
|
# CFLAGS += -mdynamic-no-pic
|
|
|
|
|
# CXXFLAGS += -mdynamic-no-pic
|
|
|
|
|
else
|
|
|
|
|
CFLAGS += -fPIC
|
|
|
|
|
CXXFLAGS += -fPIC
|
|
|
|
|
endif
|
|
|
|
|
@endunless gcc-bootstrap
|