aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in5
-rw-r--r--README.md3
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac12
4 files changed, 42 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index 3544fcb..bb47aab 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,6 +15,7 @@ PK_SRCDIR := @with_pk_src@
LLVM_SRCDIR := @with_llvm_src@
DEJAGNU_SRCDIR := @with_dejagnu_src@
DEBUG_INFO := @debug_info@
+ENABLE_DEFAULT_PIE := @enable_default_pie@
DEJAGNU_SRCDIR := @with_dejagnu_src@
SIM ?= @WITH_SIM@
@@ -470,6 +471,7 @@ stamps/build-gcc-linux-stage1: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-binutil
--disable-nls \
--disable-bootstrap \
--src=$(gccsrcdir) \
+ $(ENABLE_DEFAULT_PIE) \
$(GCC_CHECKING_FLAGS) \
$(MULTILIB_FLAGS) \
$(WITH_ABI) \
@@ -506,6 +508,7 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b
--disable-nls \
--disable-bootstrap \
--src=$(gccsrcdir) \
+ $(ENABLE_DEFAULT_PIE) \
$(GCC_CHECKING_FLAGS) \
$(MULTILIB_FLAGS) \
$(WITH_ABI) \
@@ -814,6 +817,7 @@ stamps/build-gcc-musl-stage1: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-binutils
--disable-nls \
--disable-bootstrap \
--src=$(gccsrcdir) \
+ $(ENABLE_DEFAULT_PIE) \
$(GCC_CHECKING_FLAGS) \
--disable-multilib \
$(WITH_ABI) \
@@ -883,6 +887,7 @@ stamps/build-gcc-musl-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) stamps/build-musl-lin
--disable-nls \
--disable-bootstrap \
--src=$(gccsrcdir) \
+ $(ENABLE_DEFAULT_PIE) \
$(GCC_CHECKING_FLAGS) \
--disable-multilib \
$(WITH_ABI) \
diff --git a/README.md b/README.md
index ba09608..d9a8205 100644
--- a/README.md
+++ b/README.md
@@ -105,6 +105,9 @@ The musl compiler (riscv64-unknown-linux-musl-) will only be able to target
The `--enable-multilib` flag therefore does not actually enable multilib support
for musl libc.
+Linux toolchain has an additional option `--enable-default-pie` to control the
+default PIE enablement for GCC, which is disable by default.
+
### Troubleshooting Build Problems
Builds work best if installing into an empty directory. If you build a
diff --git a/configure b/configure
index 36e3e20..3cc9b8c 100755
--- a/configure
+++ b/configure
@@ -619,6 +619,7 @@ WITH_ISA_SPEC
WITH_TUNE
WITH_ABI
WITH_ARCH
+enable_default_pie
debug_info
default_target
FETCHER
@@ -681,6 +682,7 @@ ac_user_opts='
enable_option_checking
enable_linux
enable_debug_info
+enable_default_pie
with_arch
with_abi
with_tune
@@ -1335,6 +1337,8 @@ Optional Features:
[--disable-linux]
--enable-debug-info build glibc/musl/newlibc/libgcc with debug
information
+ --enable-default-pie build linux toolchain with default PIE
+ [--enable-default-pie]
--enable-multilib build both RV32 and RV64 runtime libraries (only
RV64 for musl libc) [--disable-multilib]
--enable-gcc-checking Enable gcc internal checking, it will make gcc very
@@ -3330,6 +3334,24 @@ else
fi
+# Check whether --enable-default-pie was given.
+if test "${enable_default_pie+set}" = set; then :
+ enableval=$enable_default_pie;
+else
+ enable_default_pie=no
+
+fi
+
+
+if test "x$enable_default_pie" != xyes; then :
+ enable_default_pie="--disable-default-pie"
+
+else
+ enable_default_pie="--enable-default-pie"
+
+fi
+
+
# Check whether --with-arch was given.
if test "${with_arch+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 7527eaef..a59ddfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,18 @@ AS_IF([test "x$enable_debug_info" != xyes],
[AC_SUBST(debug_info, "")],
[AC_SUBST(debug_info, "-g")])
+AC_ARG_ENABLE(default-pie,
+ [AS_HELP_STRING([--enable-default-pie],
+ [build linux toolchain with default PIE @<:@--enable-default-pie@:>@])],
+ [],
+ [enable_default_pie=no]
+ )
+
+AS_IF([test "x$enable_default_pie" != xyes],
+ [AC_SUBST(enable_default_pie, "--disable-default-pie")],
+ [AC_SUBST(enable_default_pie, "--enable-default-pie")])
+
+
AC_ARG_WITH(arch,
[AS_HELP_STRING([--with-arch=rv64imafdc],
[Sets the base RISC-V ISA, defaults to rv64imafdc])],