aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2022-11-22 21:10:31 -0500
committerMarek Polacek <polacek@redhat.com>2022-11-22 21:10:31 -0500
commit04711f5189a72c2fcaeed520d65582704adca042 (patch)
treef0eb61aee9cb51bf6ff14bfef4429b1f77e99d26 /gcc
parent30f399ee9318bcb44e3e2debde086303157a347d (diff)
downloadgcc-04711f5189a72c2fcaeed520d65582704adca042.zip
gcc-04711f5189a72c2fcaeed520d65582704adca042.tar.gz
gcc-04711f5189a72c2fcaeed520d65582704adca042.tar.bz2
Revert "configure: Implement --enable-host-pie"
This reverts commit 251c72a68af3a8b0638705b73ef120ffdf0053eb.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/Makefile.in29
-rwxr-xr-xgcc/configure47
-rw-r--r--gcc/configure.ac36
-rw-r--r--gcc/d/Make-lang.in2
-rw-r--r--gcc/doc/install.texi16
5 files changed, 39 insertions, 91 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 5a78c74..5ad638f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -158,9 +158,6 @@ LDFLAGS = @LDFLAGS@
# Should we build position-independent host code?
PICFLAG = @PICFLAG@
-# The linker flag for the above.
-LD_PICFLAG = @LD_PICFLAG@
-
# Flags to determine code coverage. When coverage is disabled, this will
# contain the optimization flags, as you normally want code coverage
# without optimization.
@@ -269,17 +266,18 @@ LINKER = $(CC)
LINKER_FLAGS = $(CFLAGS)
endif
-enable_host_pie = @enable_host_pie@
-
# Enable Intel CET on Intel CET enabled host if needed.
CET_HOST_FLAGS = @CET_HOST_FLAGS@
COMPILER += $(CET_HOST_FLAGS)
-# Maybe compile the compilers with -fPIE or -fPIC.
-COMPILER += $(PICFLAG)
+NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
+NO_PIE_FLAG = @NO_PIE_FLAG@
+
+# We don't want to compile the compilers with -fPIE, it make PCH fail.
+COMPILER += $(NO_PIE_CFLAGS)
-# Link with -pie, or -no-pie, depending on the above.
-LINKER += $(LD_PICFLAG)
+# Link with -no-pie since we compile the compiler with -fno-PIE.
+LINKER += $(NO_PIE_FLAG)
# Like LINKER, but use a mutex for serializing front end links.
ifeq (@DO_LINK_MUTEX@,true)
@@ -1062,21 +1060,18 @@ ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
# This is the variable to use when using $(LINKER).
-ALL_LINKERFLAGS = $(ALL_CXXFLAGS) $(LD_PICFLAG)
+ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
# Build and host support libraries.
-# Use the "pic" build of libiberty if --enable-host-shared or --enable-host-pie,
-# unless we are building for mingw.
+# Use the "pic" build of libiberty if --enable-host-shared, unless we are
+# building for mingw.
LIBIBERTY_PICDIR=$(if $(findstring mingw,$(target)),,pic)
-ifneq ($(enable_host_shared)$(enable_host_pie),)
-LIBIBERTY = ../libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
-else
-LIBIBERTY = ../libiberty/libiberty.a
-endif
ifeq ($(enable_host_shared),yes)
+LIBIBERTY = ../libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
else
+LIBIBERTY = ../libiberty/libiberty.a
BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
endif
diff --git a/gcc/configure b/gcc/configure
index f631830..aa09609 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -632,10 +632,10 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
CET_HOST_FLAGS
-LD_PICFLAG
-PICFLAG
+NO_PIE_FLAG
+NO_PIE_CFLAGS
enable_default_pie
-enable_host_pie
+PICFLAG
enable_host_shared
enable_plugin
pluginlibs
@@ -1025,7 +1025,6 @@ enable_link_serialization
enable_version_specific_runtime_libs
enable_plugin
enable_host_shared
-enable_host_pie
enable_libquadmath_support
with_linker_hash_style
with_diagnostics_color
@@ -1788,7 +1787,6 @@ Optional Features:
in a compiler-specific directory
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
- --enable-host-pie build host code as PIE
--disable-libquadmath-support
disable libquadmath support for Fortran
--enable-default-pie enable Position Independent Executable as default
@@ -19712,7 +19710,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19727 "configure"
+#line 19713 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19818,7 +19816,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19833 "configure"
+#line 19819 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -31947,17 +31945,13 @@ fi
# Enable --enable-host-shared
# Check whether --enable-host-shared was given.
if test "${enable_host_shared+set}" = set; then :
- enableval=$enable_host_shared;
+ enableval=$enable_host_shared; PICFLAG=-fPIC
+else
+ PICFLAG=
fi
-# Enable --enable-host-pie
-# Check whether --enable-host-pie was given.
-if test "${enable_host_pie+set}" = set; then :
- enableval=$enable_host_pie;
-fi
-
# Check whether --enable-libquadmath-support was given.
@@ -32111,6 +32105,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5
$as_echo "$gcc_cv_c_no_fpie" >&6; }
+if test "$gcc_cv_c_no_fpie" = "yes"; then
+ NO_PIE_CFLAGS="-fno-PIE"
+fi
+
# Check if -no-pie works.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
@@ -32135,28 +32133,11 @@ rm -f core conftest.err conftest.$ac_objext \
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
$as_echo "$gcc_cv_no_pie" >&6; }
-
-if test x$enable_host_shared = xyes; then
- PICFLAG=-fPIC
-elif test x$enable_host_pie = xyes; then
- PICFLAG=-fPIE
-elif test x$gcc_cv_c_no_fpie = xyes; then
- PICFLAG=-fno-PIE
-else
- PICFLAG=
-fi
-
-if test x$enable_host_pie = xyes; then
- LD_PICFLAG=-pie
-elif test x$gcc_cv_no_pie = xyes; then
- LD_PICFLAG=-no-pie
-else
- LD_PICFLAG=
+if test "$gcc_cv_no_pie" = "yes"; then
+ NO_PIE_FLAG="-no-pie"
fi
-
-
# Enable Intel CET on Intel CET enabled host if jit is enabled.
# Check whether --enable-cet was given.
if test "${enable_cet+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index f5b23b9..7c55bff 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7364,14 +7364,11 @@ fi
# Enable --enable-host-shared
AC_ARG_ENABLE(host-shared,
[AS_HELP_STRING([--enable-host-shared],
- [build host code as shared libraries])])
+ [build host code as shared libraries])],
+[PICFLAG=-fPIC], [PICFLAG=])
AC_SUBST(enable_host_shared)
+AC_SUBST(PICFLAG)
-# Enable --enable-host-pie
-AC_ARG_ENABLE(host-pie,
-[AS_HELP_STRING([--enable-host-pie],
- [build host code as PIE])])
-AC_SUBST(enable_host_pie)
AC_ARG_ENABLE(libquadmath-support,
[AS_HELP_STRING([--disable-libquadmath-support],
@@ -7493,6 +7490,10 @@ AC_CACHE_CHECK([for -fno-PIE option],
[gcc_cv_c_no_fpie=yes],
[gcc_cv_c_no_fpie=no])
CXXFLAGS="$saved_CXXFLAGS"])
+if test "$gcc_cv_c_no_fpie" = "yes"; then
+ NO_PIE_CFLAGS="-fno-PIE"
+fi
+AC_SUBST([NO_PIE_CFLAGS])
# Check if -no-pie works.
AC_CACHE_CHECK([for -no-pie option],
@@ -7503,27 +7504,10 @@ AC_CACHE_CHECK([for -no-pie option],
[gcc_cv_no_pie=yes],
[gcc_cv_no_pie=no])
LDFLAGS="$saved_LDFLAGS"])
-
-if test x$enable_host_shared = xyes; then
- PICFLAG=-fPIC
-elif test x$enable_host_pie = xyes; then
- PICFLAG=-fPIE
-elif test x$gcc_cv_c_no_fpie = xyes; then
- PICFLAG=-fno-PIE
-else
- PICFLAG=
+if test "$gcc_cv_no_pie" = "yes"; then
+ NO_PIE_FLAG="-no-pie"
fi
-
-if test x$enable_host_pie = xyes; then
- LD_PICFLAG=-pie
-elif test x$gcc_cv_no_pie = xyes; then
- LD_PICFLAG=-no-pie
-else
- LD_PICFLAG=
-fi
-
-AC_SUBST([PICFLAG])
-AC_SUBST([LD_PICFLAG])
+AC_SUBST([NO_PIE_FLAG])
# Enable Intel CET on Intel CET enabled host if jit is enabled.
GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in
index dff0649..6f9b2e5 100644
--- a/gcc/d/Make-lang.in
+++ b/gcc/d/Make-lang.in
@@ -64,7 +64,7 @@ ALL_DFLAGS = $(DFLAGS-$@) $(GDCFLAGS) -fversion=IN_GCC $(CHECKING_DFLAGS) \
$(PICFLAG) $(ALIASING_FLAGS) $(NOEXCEPTION_DFLAGS) $(COVERAGE_FLAGS) \
$(WARN_DFLAGS)
-DCOMPILE.base = $(GDC) -c $(ALL_DFLAGS) -o $@
+DCOMPILE.base = $(GDC) $(NO_PIE_CFLAGS) -c $(ALL_DFLAGS) -o $@
DCOMPILE = $(DCOMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo
DPOSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po
DLINKER = $(GDC) $(NO_PIE_FLAG) -lstdc++
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index b91fbe0..589c649 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1026,26 +1026,14 @@ code.
@item --enable-host-shared
Specify that the @emph{host} code should be built into position-independent
-machine code (with @option{-fPIC}), allowing it to be used within shared
-libraries, but yielding a slightly slower compiler.
+machine code (with -fPIC), allowing it to be used within shared libraries,
+but yielding a slightly slower compiler.
This option is required when building the libgccjit.so library.
Contrast with @option{--enable-shared}, which affects @emph{target}
libraries.
-@item --enable-host-pie
-Specify that the @emph{host} executables should be built into
-position-independent executables (with @option{-fPIE} and @option{-pie}),
-yielding a slightly slower compiler (but faster than
-@option{--enable-host-shared}). Position-independent executables are loaded
-at random addresses each time they are executed, therefore provide additional
-protection against Return Oriented Programming (ROP) attacks.
-
-@option{--enable-host-pie}) may be used with @option{--enable-host-shared}),
-in which case @option{-fPIC} is used when compiling, and @option{-pie} when
-linking.
-
@item @anchor{with-gnu-as}--with-gnu-as
Specify that the compiler should assume that the
assembler it finds is the GNU assembler. However, this does not modify