2004-09-11 01:49:29 +08:00
|
|
|
|
# The -mdynamic-no-pic ensures that the compiler executable is built without
|
2023-08-07 19:07:23 +08: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.
|
2012-05-29 23:58:15 +08:00
|
|
|
|
|
2023-08-07 19:07:23 +08:00
|
|
|
|
# We use Werror, since some versions of clang report unknown command line flags
|
|
|
|
|
# as a warning only.
|
2015-06-25 03:43:02 +08:00
|
|
|
|
|
2023-08-07 19:07:23 +08: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-10-17 04:45:20 +08:00
|
|
|
|
|
2023-08-07 19:07:24 +08:00
|
|
|
|
# We cannot use mdynamic-no-pic when building shared host resources.
|
|
|
|
|
|
|
|
|
|
ifeq (${host_shared},no)
|
2023-08-07 19:07:23 +08: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)
|
2023-08-07 19:07:24 +08:00
|
|
|
|
else
|
|
|
|
|
BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
|
|
|
|
|
endif
|
2015-06-25 03:43:02 +08:00
|
|
|
|
|
2023-08-07 19:07:23 +08:00
|
|
|
|
@if gcc-bootstrap
|
|
|
|
|
ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
|
|
|
|
|
STAGE1_CFLAGS += -mdynamic-no-pic
|
|
|
|
|
else
|
|
|
|
|
STAGE1_CFLAGS += -fPIC
|
|
|
|
|
endif
|
2023-08-07 19:07:24 +08:00
|
|
|
|
ifeq (${host_shared},no)
|
2023-08-07 19:07:23 +08:00
|
|
|
|
# Add -mdynamic-no-pic to later stages when we know it is built with GCC.
|
|
|
|
|
BOOT_CFLAGS += -mdynamic-no-pic
|
2023-08-07 19:07:24 +08:00
|
|
|
|
endif
|
2023-08-07 19:07:23 +08: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
|