gcc/config/mh-darwin
Iain Sandoe d39367fa82 configure: Allow host fragments to react to --enable-host-shared.
This makes the host_shared value available to host makefile
fragments.

It uses this to adjust Darwin's mdynamic-no-pic in the case that
shared host resources are required.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

ChangeLog:

	* Makefile.in: Regenerate.
	* Makefile.tpl: Make the state of the configured host
	shared flag available to makefile fragements.

config/ChangeLog:

	* mh-darwin: Require a non-shared host configuration to
	enable  mdynamic-no-pic where that is supported.
2021-08-18 19:46:32 +01:00

47 lines
1.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# The -mdynamic-no-pic ensures that the compiler executable is built without
# 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.
# We use Werror, since some versions of clang report unknown command line flags
# as a warning only.
# 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.
# We cannot use mdynamic-no-pic when building shared host resources.
ifeq (${host_shared},no)
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)
else
BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false
endif
@if gcc-bootstrap
ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
STAGE1_CFLAGS += -mdynamic-no-pic
else
STAGE1_CFLAGS += -fPIC
endif
ifeq (${host_shared},no)
# Add -mdynamic-no-pic to later stages when we know it is built with GCC.
BOOT_CFLAGS += -mdynamic-no-pic
endif
@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