rust: find json file using CARGO_TRIPLE

This commit is contained in:
occheung 2021-11-08 12:57:13 +08:00 committed by Sébastien Bourdeauducq
parent 0898e101e2
commit b3e315e24a
6 changed files with 74 additions and 35 deletions

View File

@ -11,7 +11,7 @@ all:: bootloader.bin
$(RUSTOUT)/libbootloader.a: $(RUSTOUT)/libbootloader.a:
$(cargo) --target-dir ./cargo \ $(cargo) --target-dir ./cargo \
--manifest-path $(BOOTLOADER_DIRECTORY)/Cargo.toml \ --manifest-path $(BOOTLOADER_DIRECTORY)/Cargo.toml \
--target $(BOOTLOADER_DIRECTORY)/../riscv32ima-unknown-none-elf.json --target $(BOOTLOADER_DIRECTORY)/../$(CARGO_TRIPLE).json
bootloader.elf: $(RUSTOUT)/libbootloader.a bootloader.elf: $(RUSTOUT)/libbootloader.a
$(link) -T $(BOOTLOADER_DIRECTORY)/bootloader.ld $(link) -T $(BOOTLOADER_DIRECTORY)/bootloader.ld

View File

@ -22,7 +22,7 @@ all:: ksupport.elf
$(RUSTOUT)/libksupport.a: $(RUSTOUT)/libksupport.a:
$(cargo) --target-dir ./cargo \ $(cargo) --target-dir ./cargo \
--manifest-path $(KSUPPORT_DIRECTORY)/Cargo.toml \ --manifest-path $(KSUPPORT_DIRECTORY)/Cargo.toml \
--target $(KSUPPORT_DIRECTORY)/../riscv32ima-unknown-none-elf.json --target $(KSUPPORT_DIRECTORY)/../$(CARGO_TRIPLE).json
ksupport.elf: $(RUSTOUT)/libksupport.a glue.o ksupport.elf: $(RUSTOUT)/libksupport.a glue.o
$(link) -T $(KSUPPORT_DIRECTORY)/ksupport.ld \ $(link) -T $(KSUPPORT_DIRECTORY)/ksupport.ld \

View File

@ -0,0 +1,40 @@
{
"arch": "riscv32",
"code-model": "medium",
"cpu": "generic-rv32",
"crt-static-respected": true,
"data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"dynamic-linking": true,
"executables": true,
"features": "+m,+a,+f,+d",
"has-elf-tls": true,
"has-rpath": true,
"llvm-abiname": "ilp32d",
"llvm-target": "riscv32-unknown-linux",
"max-atomic-width": 32,
"position-independent-executables": true,
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"relro-level": "full",
"target-family": "unix",
"target-pointer-width": "32",
"unsupported-abis": [
"cdecl",
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"aapcs",
"win64",
"sysv64",
"ptx-kernel",
"msp430-interrupt",
"x86-interrupt",
"amdgpu-kernel"
]
}

View File

@ -1,32 +1,31 @@
{ {
"arch": "riscv32", "arch": "riscv32",
"cpu": "generic-rv32", "cpu": "generic-rv32",
"data-layout": "e-m:e-p:32:32-i64:64-n32-S128", "data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"eh-frame-header": false, "eh-frame-header": false,
"emit-debug-gdb-scripts": false, "emit-debug-gdb-scripts": false,
"executables": true, "executables": true,
"features": "+m,+a,-c", "features": "+m,+a,-c",
"is-builtin": false, "is-builtin": false,
"linker": "rust-lld", "linker": "rust-lld",
"linker-flavor": "ld.lld", "linker-flavor": "ld.lld",
"llvm-target": "riscv32", "llvm-target": "riscv32",
"max-atomic-width": 32, "max-atomic-width": 32,
"panic-strategy": "unwind", "panic-strategy": "unwind",
"relocation-model": "static", "relocation-model": "static",
"target-pointer-width": "32", "target-pointer-width": "32",
"unsupported-abis": [ "unsupported-abis": [
"cdecl", "cdecl",
"stdcall", "stdcall",
"fastcall", "fastcall",
"vectorcall", "vectorcall",
"thiscall", "thiscall",
"aapcs", "aapcs",
"win64", "win64",
"sysv64", "sysv64",
"ptx-kernel", "ptx-kernel",
"msp430-interrupt", "msp430-interrupt",
"x86-interrupt", "x86-interrupt",
"amdgpu-kernel" "amdgpu-kernel"
] ]
} }

View File

@ -18,7 +18,7 @@ all:: runtime.bin runtime.fbi
$(RUSTOUT)/libruntime.a: $(RUSTOUT)/libruntime.a:
$(cargo) --target-dir ./cargo \ $(cargo) --target-dir ./cargo \
--manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml \ --manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml \
--target $(RUNTIME_DIRECTORY)/../riscv32ima-unknown-none-elf.json --target $(RUNTIME_DIRECTORY)/../$(CARGO_TRIPLE).json
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \ $(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \

View File

@ -13,7 +13,7 @@ all:: satman.bin satman.fbi
$(RUSTOUT)/libsatman.a: $(RUSTOUT)/libsatman.a:
$(cargo) --target-dir ./cargo \ $(cargo) --target-dir ./cargo \
--manifest-path $(SATMAN_DIRECTORY)/Cargo.toml \ --manifest-path $(SATMAN_DIRECTORY)/Cargo.toml \
--target $(SATMAN_DIRECTORY)/../riscv32ima-unknown-none-elf.json --target $(SATMAN_DIRECTORY)/../$(CARGO_TRIPLE).json
satman.elf: $(RUSTOUT)/libsatman.a satman.elf: $(RUSTOUT)/libsatman.a
$(link) -T $(SATMAN_DIRECTORY)/satman.ld $(link) -T $(SATMAN_DIRECTORY)/satman.ld