Hi Marcus: Let you know reviewing this patch is on my TODO list, and I definitely want this included in GCC 11, but I am working on other urgent work this week, so I might not be able to give any review comment or testing at this moment.
Thanks for your awesome work for big-endian support! On Tue, Jan 26, 2021 at 2:14 AM Marcus Comstedt <mar...@mc.pp.se> wrote: > > Greetings. > > Big endian support for RISC-V was added in binutils 2.36, released > yesterday. This patch set adds support to gcc for exploting this mode. > > Please note that in addition to these patches, an pull of config.sub > from upstreams is needed. > > In adding the big endian support, I had the following goals: > > * Apply default endianness based on triplet > > * Allow endianness override with -mbig-endian / -mlittle-endian > > * Retain compatibility with older binutils for use cases which do not > explicitly invoke new functionality (i.e. specify new command line > options or target a new triplet) > > Based on these goals, this is what I did _not_ do: > > * Implicitly pass default endianness as -mbig-endian / -mlittle-endian > to gas, since older binutils targeting little endian will not understand > -mlittle-endian. Instead assume gas has the same default as gcc. > If -mbig-endian or -mlittle-endian is explicitly given, it is passed > on to gas since this use is under the discretion of the user. > (This means that DRIVER_SELF_SPECS can not be used to set the default.) > > * Configure multilib for big/little endian, since that would require > newest binutils when building for a little endian target, due to the > requirement to build libgcc et al as big endian. > > For ld, I think it would have been ok to pass -EL to older binutils, > but for symmetry reasons I keep the ld commandline identical to before > when default is little endian, and change the '-melf64lriscv' into > '-melf64briscv' when the default is big endian. This has the desired > effect of informing ld what the default endianness is, and still > allows it to be overridden with -EB and -EL (translated from > -mbig-endian and -mlittle-endian). > > > // Marcus > > > gcc/common/config/riscv/riscv-common.c | 5 +++++ > gcc/config.gcc | 15 +++++++++++++++ > gcc/config/riscv/elf.h | 4 +++- > gcc/config/riscv/freebsd.h | 4 +++- > gcc/config/riscv/linux.h | 4 +++- > gcc/config/riscv/riscv.c | 5 +++++ > gcc/config/riscv/riscv.h | 12 ++++++++++-- > gcc/config/riscv/riscv.opt | 8 ++++++++ > 8 files changed, 52 insertions(+), 5 deletions(-) >