Skip to content

[RISC-V] Clang behaves differently from gcc when -mcmodel=large and triple is riscv-32 #134537

@amitch1999

Description

@amitch1999

When compiling something with clang and -march=rv32i -mcmodel=large I get an error: "unsupported argument 'large' to option '-mcmodel=' for target 'riscv32-unknown-elf'"
If I do so with gcc, it seems to just go with medlow code model.

Should this behavior be changed in clang? to match gcc? maybe just a warning is enough

I encountered this when trying to compile newlib with clang, some of my multilibs are 32 bit, and some are 64 bit, but I exported CFLAGS_FOR_TARGET=-mcmodel=large because I want the 64 bit libraries to be compiled with large code model. when building like this with gcc it works fine.
Maybe I can configure newlib somehow to have different flags for 32 bit libs vs 64 bit libs? I did not find something like that.
This behavior might limit clang when building newlib with multilibs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:RISC-VclangClang issues not falling into any other categoryquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions