How to use custom gcc to build static library

I want to compile rust programs using a custom GCC toolchain
I try to add a new target. But it doesn't seem to be working

An error is returned when compiled

error: data-layout for target `test-15916131297364407962`, `e-m:e-p:32:32-n32-S32`, differs from LLVM target's `riscv32-none-elf-gcc` default layout, `e-m:e-p:32:32-i64:64-n32-S128`

Here is the target json

{
    "arch": "riscv32",
    "cpu": "generic-rv32",
    "crt-objects-fallback": "false",
    "data-layout": "e-m:e-p:32:32-n32-S32",
    "eh-frame-header": false,
    "emit-debug-gdb-scripts": false,
    "features": "+m,+a,+c",
    "linker": "C:\\Program Files (x86)\\RV32-Toolchain\\RV32-V2\\bin\\riscv32-elf-gcc.exe",
    "linker-flavor": "gcc",
    "llvm-target": "riscv32-none-elf-gcc",
    "max-atomic-width": 0,
    "panic-strategy": "abort",
    "relocation-model": "static",
    "target-pointer-width": "32",
    "pre-link-args": {
        "gcc": [
            "-Wall -march=rv32imacxbs1 -ffunction-sections -fdata-sections -msave-restore -mjump-tables-in-text",
            "-Os"
        ]
    }
}

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.