From f70c0dcba4d9878723d4c65b6fef6cc0d1641924 Mon Sep 17 00:00:00 2001 From: Darius Rad Date: Sun, 8 Feb 2015 16:43:59 -0500 Subject: [PATCH 1/2] glibc: Combine wordsize.h for 32 and 64 bit. This allows for sharing headers between RV32 and RV64 compilers, which in turn supports a combined toolchain for both targets, with appropriate duplicate builds of glibc. --- .../sysdeps/riscv/{rv64 => }/bits/wordsize.h | 4 ++++ glibc/sysdeps/riscv/rv32/bits/wordsize.h | 19 ------------------- 2 files changed, 4 insertions(+), 19 deletions(-) rename glibc/sysdeps/riscv/{rv64 => }/bits/wordsize.h (94%) delete mode 100644 glibc/sysdeps/riscv/rv32/bits/wordsize.h diff --git a/glibc/sysdeps/riscv/rv64/bits/wordsize.h b/glibc/sysdeps/riscv/bits/wordsize.h similarity index 94% rename from glibc/sysdeps/riscv/rv64/bits/wordsize.h rename to glibc/sysdeps/riscv/bits/wordsize.h index 1f643137..67bb48f5 100644 --- a/glibc/sysdeps/riscv/rv64/bits/wordsize.h +++ b/glibc/sysdeps/riscv/bits/wordsize.h @@ -16,5 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#if defined __riscv64 #define __WORDSIZE 64 #define __WORDSIZE_TIME64_COMPAT32 1 +#else +#define __WORDSIZE 32 +#endif diff --git a/glibc/sysdeps/riscv/rv32/bits/wordsize.h b/glibc/sysdeps/riscv/rv32/bits/wordsize.h deleted file mode 100644 index 184080c5..00000000 --- a/glibc/sysdeps/riscv/rv32/bits/wordsize.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define __WORDSIZE 32 From ca9c71c460dae5747dcbf353eb84b16d2d96d6fb Mon Sep 17 00:00:00 2001 From: Darius Rad Date: Sun, 8 Feb 2015 16:50:27 -0500 Subject: [PATCH 2/2] glibc: Allow the prefix riscv- as an alias for riscv64-. This permits avoiding a misleading architecture prefix when building a toolchain that support both RV32 and RV64. This makes glibc consistent with binutils and gcc with respect to the riscv- target. The target riscv- is identical to riscv64-, i.e., RV64 is the default. --- glibc/sysdeps/riscv/preconfigure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glibc/sysdeps/riscv/preconfigure b/glibc/sysdeps/riscv/preconfigure index 4e8364ab..5863d2dc 100644 --- a/glibc/sysdeps/riscv/preconfigure +++ b/glibc/sysdeps/riscv/preconfigure @@ -1,5 +1,8 @@ case "$machine" in -riscv64*) +riscv32*) base_machine=riscv machine=riscv/rv32 + machine=$machine/$config_machine + ;; +riscv*) case "$CC $CFLAGS $CPPFLAGS " in *" -m32 "*) riscv_cc_abi=32 ;; *" -m64 "*) riscv_cc_abi=64 ;; @@ -22,7 +25,4 @@ riscv64*) CPPFLAGS="$CPPFLAGS -m$riscv_config_abi" fi ;; -riscv*) base_machine=riscv machine=riscv/rv32 - machine=$machine/$config_machine - ;; esac