diff --git a/Makefile.in b/Makefile.in index dbb6bb80..cb43dca7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,8 +44,8 @@ ifeq ($(MULTILIB_NAMES),) MULTILIB_NAMES := $(XLEN) endif -CFLAGS_FOR_TARGET := $(CFLAGS_FOR_TARGET_EXTRA) -ASFLAGS_FOR_TARGET := $(ASFLAGS_FOR_TARGET_EXTRA) +CFLAGS_FOR_TARGET := $(CFLAGS_FOR_TARGET_EXTRA) @cmodel@ +ASFLAGS_FOR_TARGET := $(ASFLAGS_FOR_TARGET_EXTRA) @cmodel@ GLIBC_TARGET_FLAGS := $(GLIBC_TARGET_FLAGS_EXTRA) GLIBC_CC_FOR_TARGET ?= riscv$(XLEN)-unknown-linux-gnu-gcc GLIBC_CXX_FOR_TARGET ?= riscv$(XLEN)-unknown-linux-gnu-g++ diff --git a/configure b/configure index 5b98b5d1..cd0cbe01 100755 --- a/configure +++ b/configure @@ -584,6 +584,7 @@ PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS +cmodel gcc_checking multilib_names multilib_flags @@ -655,6 +656,7 @@ with_arch with_abi enable_multilib enable_gcc_checking +with_cmodel ' ac_precious_vars='build_alias host_alias @@ -1299,6 +1301,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-arch=rv64imafdc Sets the base RISC-V ISA, defaults to rv64imafdc --with-abi=lp64d Sets the base RISC-V ABI, defaults to lp64d + --with-cmodel Select the code model to use when building libc and + libgcc [--with-cmodel=medlow] Some influential environment variables: CC C compiler command @@ -3304,6 +3308,23 @@ else fi + +# Check whether --with-cmodel was given. +if test "${with_cmodel+set}" = set; then : + withval=$with_cmodel; +else + enable_gcc_checking=yes + +fi + +if test "x$with_cmodel" != x; then : + cmodel=-mcmodel=$with_cmodel + +else + cmodel=-mcmodel=medlow + +fi + ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files scripts/wrapper/awk/awk" diff --git a/configure.ac b/configure.ac index 8effb300..90d949f9 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,16 @@ AS_IF([test "x$enable_gcc_checking" != xno], [AC_SUBST(gcc_checking, --enable-checking=yes)], [AC_SUBST(gcc_checking, --enable-checking=release)]) +AC_ARG_WITH(cmodel, + [AS_HELP_STRING([--with-cmodel], + [Select the code model to use when building libc and libgcc @<:@--with-cmodel=medlow@:>@])], + [], + [enable_gcc_checking=yes] + ) +AS_IF([test "x$with_cmodel" != x], + [AC_SUBST(cmodel, -mcmodel=$with_cmodel)], + [AC_SUBST(cmodel, -mcmodel=medlow)]) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([scripts/wrapper/awk/awk], [chmod +x scripts/wrapper/awk]) AC_CONFIG_FILES([scripts/wrapper/sed/sed], [chmod +x scripts/wrapper/sed])