gcc/config/mh-darwin
Iain Sandoe 54258e22b0 Darwin, config: Revise host config fragment.
There were two uses for the Darwin host config fragment:

The first is to arrange for targets that support mdynamic-no-pic
to be built with that enabled (since it makes a significant
difference to the compiler performance).  We can be more specific
in the application of this, since it only applies to 32b hosts
plus powerpc64-darwin9.

The second was to work around a tool bug where -fno-PIE was not
propagated to the link stage.  This second use is redundant,
since the buggy toolchain cannot bootstrap current GCC sources
anyway.

This makes the host fragment more specific and reduces the number
of toolchains for which it is included which reduces clutter in
configure lines.

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

config/ChangeLog:

	* mh-darwin: Make this specific to handling the
	mdynamic-no-pic case.

ChangeLog:

	* configure: Regenerate.
	* configure.ac: Adjust cases for which it is necessary to
	include the Darwin host config fragment.
2021-07-09 17:35:57 +01:00

39 lines
1.3 KiB
Plaintext
Raw 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.
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)
@if gcc-bootstrap
ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true)
STAGE1_CFLAGS += -mdynamic-no-pic
else
STAGE1_CFLAGS += -fPIC
endif
# Add -mdynamic-no-pic to later stages when we know it is built with GCC.
BOOT_CFLAGS += -mdynamic-no-pic
@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