Skip to content

Commit

Permalink
Fix cross compiling error & tweaking multilib setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kongou Hikari committed Aug 28, 2019
1 parent 93e794e commit 89e2c05
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
autom4te.cache
build
test
build*
stamps
install*
config.log
config.status
Makefile
Expand Down
19 changes: 17 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ MUSL_CXX_FOR_TARGET ?= $(MUSL_TUPLE)-g++

CONFIGURE_HOST = @configure_host@

#For cross-compiling to Windows

ifdef CONFIGURE_HOST
TARGET_GCC_EXECUTABLE := $(NEWLIB_TUPLE)-gcc
else
TARGET_GCC_EXECUTABLE := $(INSTALL_DIR)/bin/$(NEWLIB_TUPLE)-gcc
endif

all: @default_target@
newlib: stamps/build-gcc-newlib-stage2
linux: stamps/build-gcc-linux-stage2
Expand Down Expand Up @@ -408,7 +416,8 @@ stamps/build-binutils-newlib: $(srcdir)/riscv-binutils
--disable-gdb \
--disable-sim \
--disable-libdecnumber \
--disable-readline
--disable-readline \
--disable-nls
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand All @@ -434,6 +443,10 @@ stamps/build-gdb-newlib: $(srcdir)/riscv-gdb
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

ifdef CONFIGURE_HOST
stamps/build-gcc-newlib-stage1: stamps/build-binutils-newlib
mkdir -p $(dir $@) && touch $@
else
stamps/build-gcc-newlib-stage1: $(srcdir)/riscv-gcc stamps/build-binutils-newlib
if test -f $</contrib/download_prerequisites && test "@NEED_GCC_EXTERNAL_LIBRARIES@" == "true"; then cd $< && ./contrib/download_prerequisites; fi
rm -rf $@ $(notdir $@)
Expand Down Expand Up @@ -466,6 +479,8 @@ stamps/build-gcc-newlib-stage1: $(srcdir)/riscv-gcc stamps/build-binutils-newlib
$(MAKE) -C $(notdir $@) install-gcc
mkdir -p $(dir $@) && touch $@

endif

stamps/build-newlib: $(srcdir)/riscv-newlib stamps/build-gcc-newlib-stage1
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
Expand Down Expand Up @@ -510,7 +525,7 @@ stamps/build-newlib-nano: $(srcdir)/riscv-newlib stamps/build-gcc-newlib-stage1
stamps/merge-newlib-nano: stamps/build-newlib-nano stamps/build-newlib
# Copy nano library files into newlib install dir.
set -e; \
for ml in `$(INSTALL_DIR)/bin/$(NEWLIB_TUPLE)-gcc --print-multi-lib`; \
for ml in `$(TARGET_GCC_EXECUTABLE) --print-multi-lib`; \
do \
mld=`echo $${ml} | sed -e 's/;.*$$//'`; \
cp $(builddir)/install-newlib-nano/$(NEWLIB_TUPLE)/lib/$${mld}/libc.a \
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,7 @@ else
fi
if test "x$enable_multilib" != xno; then :
newlib_multilib_names="rv32i-ilp32 rv32iac-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv64imac-lp64 rv64imafdc-lp64d"
newlib_multilib_names="rv32i-ilp32 rv32iac-ilp32 rv32imc-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv32imafdc-ilp32d rv32e-ilp32e rv32ec-ilp32e rv32emc-ilp32e rv32ema-ilp32e rv32emac-ilp32e"
else
newlib_multilib_names="$with_arch-$with_abi"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ AS_IF([test "x$enable_multilib" != xno],
[AC_SUBST(glibc_multilib_names,"$with_arch-$with_abi")])

AS_IF([test "x$enable_multilib" != xno],
[AC_SUBST(newlib_multilib_names,"rv32i-ilp32 rv32iac-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv64imac-lp64 rv64imafdc-lp64d")],
[AC_SUBST(newlib_multilib_names,"rv32i-ilp32 rv32iac-ilp32 rv32imc-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv32imafdc-ilp32d rv32e-ilp32e rv32ec-ilp32e rv32emc-ilp32e rv32ema-ilp32e rv32emac-ilp32e")],
[AC_SUBST(newlib_multilib_names,"$with_arch-$with_abi")])

AC_ARG_ENABLE(gcc-checking,
Expand Down
2 changes: 1 addition & 1 deletion riscv-gcc

0 comments on commit 89e2c05

Please sign in to comment.