|
| 1 | +From eb64d6b593a51f2cf2a6e8b043b90e555c8f6c62 Mon Sep 17 00:00:00 2001 |
| 2 | +From: wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> |
| 3 | +Date: Wed, 9 May 2018 21:17:14 +0000 |
| 4 | +Subject: [PATCH 03/22] RISC-V: Add with-multilib-list support. |
| 5 | + |
| 6 | + gcc/ |
| 7 | + PR target/84797 |
| 8 | + * config.gcc (riscv*-*-*): Handle --with-multilib-list. |
| 9 | + * config/riscv/t-withmultilib: New. |
| 10 | + * config/riscv/withmultilib.h: New. |
| 11 | + * doc/install.texi: Document RISC-V --with-multilib-list support. |
| 12 | + |
| 13 | +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260096 138bc75d-0d04-0410-961f-82ee72b054a4 |
| 14 | +--- |
| 15 | + gcc/ChangeLog | 8 +++++ |
| 16 | + gcc/config.gcc | 52 +++++++++++++++++++++++++++++++++ |
| 17 | + gcc/config/riscv/t-withmultilib | 6 ++++ |
| 18 | + gcc/config/riscv/withmultilib.h | 51 ++++++++++++++++++++++++++++++++ |
| 19 | + gcc/doc/install.texi | 11 +++++-- |
| 20 | + 5 files changed, 126 insertions(+), 2 deletions(-) |
| 21 | + create mode 100644 gcc/config/riscv/t-withmultilib |
| 22 | + create mode 100644 gcc/config/riscv/withmultilib.h |
| 23 | + |
| 24 | +diff --git a/gcc/ChangeLog b/gcc/ChangeLog |
| 25 | +index 1083f9ee4e8..98bd7ce0e07 100644 |
| 26 | +--- a/gcc/ChangeLog |
| 27 | ++++ b/gcc/ChangeLog |
| 28 | +@@ -1,3 +1,11 @@ |
| 29 | ++2018-05-09 Jim Wilson <[email protected]> |
| 30 | ++ |
| 31 | ++ PR target/84797 |
| 32 | ++ * config.gcc (riscv*-*-*): Handle --with-multilib-list. |
| 33 | ++ * config/riscv/t-withmultilib: New. |
| 34 | ++ * config/riscv/withmultilib.h: New. |
| 35 | ++ * doc/install.texi: Document RISC-V --with-multilib-list support. |
| 36 | ++ |
| 37 | + 2018-05-08 Jim Wilson < [email protected]> |
| 38 | + |
| 39 | + * config/riscv/linux.h (MUSL_ABI_SUFFIX): Delete unnecessary backslash. |
| 40 | +diff --git a/gcc/config.gcc b/gcc/config.gcc |
| 41 | +index 532c33f4c2b..fd5d154e8f6 100644 |
| 42 | +--- a/gcc/config.gcc |
| 43 | ++++ b/gcc/config.gcc |
| 44 | +@@ -4131,6 +4131,58 @@ case "${target}" in |
| 45 | + exit 1 |
| 46 | + ;; |
| 47 | + esac |
| 48 | ++ |
| 49 | ++ # Handle --with-multilib-list. |
| 50 | ++ if test "x${with_multilib_list}" != xdefault; then |
| 51 | ++ tm_file="${tm_file} riscv/withmultilib.h" |
| 52 | ++ tmake_file="${tmake_file} riscv/t-withmultilib" |
| 53 | ++ |
| 54 | ++ case ${with_multilib_list} in |
| 55 | ++ ilp32 | ilp32f | ilp32d \ |
| 56 | ++ | lp64 | lp64f | lp64d ) |
| 57 | ++ TM_MULTILIB_CONFIG="${with_arch},${with_multilib_list}" |
| 58 | ++ ;; |
| 59 | ++ *) |
| 60 | ++ echo "--with-multilib-list=${with_multilib_list} not supported." |
| 61 | ++ exit 1 |
| 62 | ++ esac |
| 63 | ++ |
| 64 | ++ # Define macros to select the default multilib. |
| 65 | ++ case ${with_arch} in |
| 66 | ++ rv32gc) |
| 67 | ++ tm_defines="${tm_defines} TARGET_MLIB_ARCH=1" |
| 68 | ++ ;; |
| 69 | ++ rv64gc) |
| 70 | ++ tm_defines="${tm_defines} TARGET_MLIB_ARCH=2" |
| 71 | ++ ;; |
| 72 | ++ *) |
| 73 | ++ echo "unsupported --with-arch for --with-multilib-list" |
| 74 | ++ exit 1 |
| 75 | ++ esac |
| 76 | ++ case ${with_abi} in |
| 77 | ++ ilp32) |
| 78 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=1" |
| 79 | ++ ;; |
| 80 | ++ ilp32f) |
| 81 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=2" |
| 82 | ++ ;; |
| 83 | ++ ilp32d) |
| 84 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=3" |
| 85 | ++ ;; |
| 86 | ++ lp64) |
| 87 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=4" |
| 88 | ++ ;; |
| 89 | ++ lp64f) |
| 90 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=5" |
| 91 | ++ ;; |
| 92 | ++ lp64d) |
| 93 | ++ tm_defines="${tm_defines} TARGET_MLIB_ABI=6" |
| 94 | ++ ;; |
| 95 | ++ *) |
| 96 | ++ echo "unsupported --with-abi for --with-multilib" |
| 97 | ++ exit 1 |
| 98 | ++ esac |
| 99 | ++ fi |
| 100 | + ;; |
| 101 | + |
| 102 | + mips*-*-*) |
| 103 | +diff --git a/gcc/config/riscv/t-withmultilib b/gcc/config/riscv/t-withmultilib |
| 104 | +new file mode 100644 |
| 105 | +index 00000000000..bcd0845b448 |
| 106 | +--- /dev/null |
| 107 | ++++ b/gcc/config/riscv/t-withmultilib |
| 108 | +@@ -0,0 +1,6 @@ |
| 109 | ++comma=, |
| 110 | ++MULTILIB_OPTIONS = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma), ,$(TM_MULTILIB_CONFIG))))) |
| 111 | ++MULTILIB_DIRNAMES = $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(subst $(comma), ,$(TM_MULTILIB_CONFIG)))) |
| 112 | ++MULTILIB_OSDIRNAMES = $(subst lib,../lib,$(MULTILIB_DIRNAMES)) |
| 113 | ++MULTILIB_REQUIRED = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma),/,$(TM_MULTILIB_CONFIG))))) |
| 114 | ++MULTILIB_REUSE = |
| 115 | +diff --git a/gcc/config/riscv/withmultilib.h b/gcc/config/riscv/withmultilib.h |
| 116 | +new file mode 100644 |
| 117 | +index 00000000000..d703147fa64 |
| 118 | +--- /dev/null |
| 119 | ++++ b/gcc/config/riscv/withmultilib.h |
| 120 | +@@ -0,0 +1,51 @@ |
| 121 | ++/* MULTILIB_DEFAULTS definitions for --with-multilib-list. |
| 122 | ++ Copyright (C) 2018 Free Software Foundation, Inc. |
| 123 | ++ |
| 124 | ++ This file is part of GCC. |
| 125 | ++ |
| 126 | ++ GCC is free software; you can redistribute it and/or modify it |
| 127 | ++ under the terms of the GNU General Public License as published |
| 128 | ++ by the Free Software Foundation; either version 3, or (at your |
| 129 | ++ option) any later version. |
| 130 | ++ |
| 131 | ++ GCC is distributed in the hope that it will be useful, but WITHOUT |
| 132 | ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 133 | ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 134 | ++ License for more details. |
| 135 | ++ |
| 136 | ++ Under Section 7 of GPL version 3, you are granted additional |
| 137 | ++ permissions described in the GCC Runtime Library Exception, version |
| 138 | ++ 3.1, as published by the Free Software Foundation. |
| 139 | ++ |
| 140 | ++ You should have received a copy of the GNU General Public License and |
| 141 | ++ a copy of the GCC Runtime Library Exception along with this program; |
| 142 | ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 143 | ++ <http://www.gnu.org/licenses/>. */ |
| 144 | ++ |
| 145 | ++#if TARGET_MLIB_ARCH == 1 |
| 146 | ++ |
| 147 | ++# if TARGET_MLIB_ABI == 1 |
| 148 | ++# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32" } |
| 149 | ++# elif TARGET_MLIB_ABI == 2 |
| 150 | ++# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32f" } |
| 151 | ++# elif TARGET_MLIB_ABI == 3 |
| 152 | ++# define MULTILIB_DEFAULTS {"march=rv32gc", "mabi=ilp32d" } |
| 153 | ++# else |
| 154 | ++# error "unsupported TARGET_MLIB_ABI value for rv32gc" |
| 155 | ++# endif |
| 156 | ++ |
| 157 | ++#elif TARGET_MLIB_ARCH == 2 |
| 158 | ++ |
| 159 | ++# if TARGET_MLIB_ABI == 4 |
| 160 | ++# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64" } |
| 161 | ++# elif TARGET_MLIB_ABI == 5 |
| 162 | ++# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64f" } |
| 163 | ++# elif TARGET_MLIB_ABI == 6 |
| 164 | ++# define MULTILIB_DEFAULTS {"march=rv64gc", "mabi=lp64d" } |
| 165 | ++# else |
| 166 | ++# error "unsupported TARGET_MLIB_ABI value for rv64gc" |
| 167 | ++# endif |
| 168 | ++ |
| 169 | ++#else |
| 170 | ++# error "unsupported TARGET_MLIB_ARCH value" |
| 171 | ++#endif |
| 172 | +diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi |
| 173 | +index ec20fd26685..7c5cdc762d3 100644 |
| 174 | +--- a/gcc/doc/install.texi |
| 175 | ++++ b/gcc/doc/install.texi |
| 176 | +@@ -1072,8 +1072,8 @@ sysv, aix. |
| 177 | + @itemx --without-multilib-list |
| 178 | + Specify what multilibs to build. @var{list} is a comma separated list of |
| 179 | + values, possibly consisting of a single value. Currently only implemented |
| 180 | +-for arm*-*-*, sh*-*-* and x86-64-*-linux*. The accepted values and meaning |
| 181 | +-for each target is given below. |
| 182 | ++for arm*-*-*, riscv*-*-*, sh*-*-* and x86-64-*-linux*. The accepted |
| 183 | ++values and meaning for each target is given below. |
| 184 | + |
| 185 | + @table @code |
| 186 | + @item arm*-*-* |
| 187 | +@@ -1128,6 +1128,13 @@ and @code{rmprofile}. |
| 188 | + @code{-mfloat-abi=hard} |
| 189 | + @end multitable |
| 190 | + |
| 191 | ++@item riscv*-*-* |
| 192 | ++@var{list} is a single ABI name. The target architecture must be either |
| 193 | ++@code{rv32gc} or @code{rv64gc}. This will build a single multilib for the |
| 194 | ++specified architecture and ABI pair. If @code{--with-multilib-list} is not |
| 195 | ++given, then a default set of multilibs is selected based on the value of |
| 196 | ++@option{--target}. This is usually a large set of multilibs. |
| 197 | ++ |
| 198 | + @item sh*-*-* |
| 199 | + @var{list} is a comma separated list of CPU names. These must be of the |
| 200 | + form @code{sh*} or @code{m*} (in which case they match the compiler option |
| 201 | +-- |
| 202 | +2.20.1 |
| 203 | + |
0 commit comments