Re: [PATCH 2/7] RISC-V: arch/riscv Makefile and Kconfigs

From: Palmer Dabbelt
Date: Tue May 23 2017 - 11:29:31 EST


On Mon, 22 May 2017 22:23:17 PDT (-0700), olof@xxxxxxxxx wrote:
> (new top-level subthread here since this is a separate topic):
>
> On Mon, May 22, 2017 at 5:41 PM, Palmer Dabbelt <palmer@xxxxxxxxxxx> wrote:
>
>> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
>> new file mode 100644
>> index 000000000000..07ef200e0675
>> --- /dev/null
>> +++ b/arch/riscv/Makefile
>> @@ -0,0 +1,64 @@
>> +# This file is included by the global makefile so that you can add your own
>> +# architecture-specific flags and dependencies. Remember to do have actions
>> +# for "archclean" and "archdep" for cleaning up and making dependencies for
>> +# this architecture
>> +#
>> +# This file is subject to the terms and conditions of the GNU General Public
>> +# License. See the file "COPYING" in the main directory of this archive
>> +# for more details.
>> +#
>> +
>> +LDFLAGS :=
>> +OBJCOPYFLAGS := -O binary
>> +LDFLAGS_vmlinux :=
>> +KBUILD_AFLAGS_MODULE += -fPIC
>> +KBUILD_CFLAGS_MODULE += -fPIC
>> +
>> +ifeq ($(ARCH),riscv)
>> + KBUILD_DEFCONFIG = riscv64_spike
>> +else
>> + KBUILD_DEFCONFIG = $(ARCH)_spike
>> +endif
>> +
>> +export BITS
>> +ifeq ($(CONFIG_64BIT),y)
>> + BITS := 64
>> + UTS_MACHINE := riscv64
>> +
>> + KBUILD_CFLAGS += -mabi=lp64
>> + KBUILD_AFLAGS += -mabi=lp64
>> + KBUILD_MARCH = rv64im
>> + LDFLAGS += -melf64lriscv
>> +else
>> + BITS := 32
>> + UTS_MACHINE := riscv32
>> +
>> + KBUILD_CFLAGS += -mabi=ilp32
>> + KBUILD_AFLAGS += -mabi=ilp32
>> + KBUILD_MARCH = rv32im
>> + LDFLAGS += -melf32lriscv
>> +endif
>> +
>> +ifeq ($(CONFIG_RV_ATOMIC),y)
>> + KBUILD_RV_ATOMIC = a
>> +endif
>> +
>> +KBUILD_CFLAGS += -Wall
>> +
>> +ifeq ($(CONFIG_RVC),y)
>> + KBUILD_RVC = c
>> +endif
>> +
>> +KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_RV_ATOMIC)fd$(KBUILD_RVC)
>> +
>> +KBUILD_CFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_RV_ATOMIC)$(KBUILD_RVC)
>> +KBUILD_CFLAGS += -mno-save-restore
>> +KBUILD_CFLAGS += -mstrict-align
>
> I built a vanilla gcc-7.1.0 here, with 'riscv64-linux' as target, and I get:
>
> riscv64-linux-gcc: error: unrecognized command line option
> '-mstrict-align'; did you mean '-Wstrict-aliasing'?
>
>
> The suggestion seems completely bogus, but the error is real. Looking
> at the gcc sources, I only see strict-align plumbed up on rs6000,
> aarch64, m68k(!) and v850. Or am I missing something here?

We didn't get the "-mstrict-align" patch for RISC-V into the 7.1.0 release.
The boot loader install machine-mode unaligned access handlers, so in theory
you shouldn't need this at all -- it snuck its way in as a debugging attempt
because the Radeon driver was exhibiting some weird behavior.

I'll drop this from the next patch set.