summaryrefslogtreecommitdiffstats
path: root/c++tools
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-23 04:50:00 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-23 04:50:00 -0800
commit544f477536010f055c26bc959b18fccf67902750 (patch)
tree3fd179013a8e62c479043edb1252d04787b2bd3f /c++tools
parentDaily bump. (diff)
downloadgcc-544f477536010f055c26bc959b18fccf67902750.tar.gz
gcc-544f477536010f055c26bc959b18fccf67902750.tar.bz2
gcc-544f477536010f055c26bc959b18fccf67902750.tar.xz
c++tools: Fix PIE [PR 98324]
This adds --enable-default-pie support to c++tools, so that the sample server is build -fPIE if requested. PR bootstrap/98324 c++tools/ * Makefile.in: Add FLAGPIE. * configure.ac: Add --enable-default-pie support. * configure: Rebuilt.
Diffstat (limited to 'c++tools')
-rw-r--r--c++tools/Makefile.in6
-rwxr-xr-xc++tools/configure13
-rw-r--r--c++tools/configure.ac7
3 files changed, 24 insertions, 2 deletions
diff --git a/c++tools/Makefile.in b/c++tools/Makefile.in
index 7dc67ad9e06..590a856af90 100644
--- a/c++tools/Makefile.in
+++ b/c++tools/Makefile.in
@@ -28,7 +28,9 @@ AUTOCONF := @AUTOCONF@
28AUTOHEADER := @AUTOHEADER@ 28AUTOHEADER := @AUTOHEADER@
29CXX := @CXX@ 29CXX := @CXX@
30CXXFLAGS := @CXXFLAGS@ 30CXXFLAGS := @CXXFLAGS@
31CXXOPTS := $(CXXFLAGS) -fno-exceptions -fno-rtti 31PIEFLAG := @PIEFLAG@
32CXXOPTS := $(CXXFLAGS) $(PIEFLAG) -fno-exceptions -fno-rtti
33LDFLAGS := @LDFLAGS@
32exeext := @EXEEXT@ 34exeext := @EXEEXT@
33LIBIBERTY := ../libiberty/libiberty.a 35LIBIBERTY := ../libiberty/libiberty.a
34VERSION.O := ../gcc/version.o 36VERSION.O := ../gcc/version.o
@@ -88,7 +90,7 @@ MAPPER.O := server.o resolver.o
88CODYLIB = ../libcody/libcody.a 90CODYLIB = ../libcody/libcody.a
89CXXINC += -I$(srcdir)/../libcody -I$(srcdir)/../include -I$(srcdir)/../gcc -I. 91CXXINC += -I$(srcdir)/../libcody -I$(srcdir)/../include -I$(srcdir)/../gcc -I.
90g++-mapper-server$(exeext): $(MAPPER.O) $(CODYLIB) 92g++-mapper-server$(exeext): $(MAPPER.O) $(CODYLIB)
91 +$(CXX) $(LDFLAGS) -o $@ $^ $(VERSION.O) $(LIBIBERTY) 93 +$(CXX) $(LDFLAGS) $(PIEFLAG) -o $@ $^ $(VERSION.O) $(LIBIBERTY)
92 94
93# copy to gcc dir so tests there can run 95# copy to gcc dir so tests there can run
94all::../gcc/g++-mapper-server$(exeext) 96all::../gcc/g++-mapper-server$(exeext)
diff --git a/c++tools/configure b/c++tools/configure
index e32558e936a..89441f50d1d 100755
--- a/c++tools/configure
+++ b/c++tools/configure
@@ -629,6 +629,7 @@ CPP
629ac_ct_CC 629ac_ct_CC
630CFLAGS 630CFLAGS
631CC 631CC
632PIEFLAG
632MAINTAINER 633MAINTAINER
633CXX_AUX_TOOLS 634CXX_AUX_TOOLS
634AUTOHEADER 635AUTOHEADER
@@ -699,6 +700,7 @@ ac_user_opts='
699enable_option_checking 700enable_option_checking
700enable_c___tools 701enable_c___tools
701enable_maintainer_mode 702enable_maintainer_mode
703enable_default_pie
702with_gcc_major_version_only 704with_gcc_major_version_only
703' 705'
704 ac_precious_vars='build_alias 706 ac_precious_vars='build_alias
@@ -1329,6 +1331,7 @@ Optional Features:
1329 --enable-maintainer-mode 1331 --enable-maintainer-mode
1330 enable maintainer mode. Add rules to rebuild 1332 enable maintainer mode. Add rules to rebuild
1331 configurey bits 1333 configurey bits
1334 --enable-default-pie enable Position Independent Executable as default
1332 1335
1333Optional Packages: 1336Optional Packages:
1334 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] 1337 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -2939,6 +2942,16 @@ $as_echo "$maintainer_mode" >&6; }
2939test "$maintainer_mode" = yes && MAINTAINER=yes 2942test "$maintainer_mode" = yes && MAINTAINER=yes
2940 2943
2941 2944
2945# Check whether --enable-default-pie was given.
2946# Check whether --enable-default-pie was given.
2947if test "${enable_default_pie+set}" = set; then :
2948 enableval=$enable_default_pie; PIEFLAG=-fPIE
2949else
2950 PIEFLAG=
2951fi
2952
2953
2954
2942# Check if O_CLOEXEC is defined by fcntl 2955# Check if O_CLOEXEC is defined by fcntl
2943ac_ext=c 2956ac_ext=c
2944ac_cpp='$CPP $CPPFLAGS' 2957ac_cpp='$CPP $CPPFLAGS'
diff --git a/c++tools/configure.ac b/c++tools/configure.ac
index 21b3a0668e6..1100dc24cd1 100644
--- a/c++tools/configure.ac
+++ b/c++tools/configure.ac
@@ -66,6 +66,13 @@ AC_MSG_RESULT([$maintainer_mode])
66test "$maintainer_mode" = yes && MAINTAINER=yes 66test "$maintainer_mode" = yes && MAINTAINER=yes
67AC_SUBST(MAINTAINER) 67AC_SUBST(MAINTAINER)
68 68
69# Check whether --enable-default-pie was given.
70AC_ARG_ENABLE(default-pie,
71[AS_HELP_STRING([--enable-default-pie],
72 [enable Position Independent Executable as default])],
73[PIEFLAG=-fPIE], [PIEFLAG=])
74AC_SUBST([PIEFLAG])
75
69# Check if O_CLOEXEC is defined by fcntl 76# Check if O_CLOEXEC is defined by fcntl
70AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [ 77AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
71AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 78AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[