-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set target-abi module flag for RISC-V targets
Fixes cross-language LTO on RISC-V targets (Fixes #121924)
- Loading branch information
Showing
9 changed files
with
102 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# needs-matching-clang | ||
|
||
# This test makes sure that cross-language LTO works on riscv targets | ||
|
||
include ../tools.mk | ||
|
||
all: riscv64gc-unknown-linux-gnu riscv32imac-unknown-none-elf riscv32gc-unknown-linux-gnu | ||
|
||
define check-target = | ||
@echo "Testing target $(1)" | ||
$(RUSTC) --target $(1) -Clinker-plugin-lto=on -Cpanic=abort --crate-type=rlib -o $(TMPDIR)/libriscv-xlto.a ./riscv-xlto.rs | ||
$(CLANG) -target $(2) -march=$(3) -mabi=$(4) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lriscv-xlto $(5) -nostdlib -o $(TMPDIR)/riscv-xlto ./clib.c | ||
file $(TMPDIR)/riscv-xlto | $(CGREP) "$(6)" | ||
endef | ||
|
||
|
||
riscv64gc-unknown-linux-gnu: | ||
@$(call check-target,$@,riscv64-linux-gnu,rv64gc,lp64d,-shared,double-float ABI) | ||
|
||
riscv32imac-unknown-none-elf: | ||
@$(call check-target,$@,riscv32-unknown-elf,rv32imac,ilp32,-DEXECUTABLE,soft-float ABI) | ||
|
||
riscv32gc-unknown-linux-gnu: | ||
@$(call check-target,$@,riscv32-linux-gnu,rv32gc,ilp32d,-shared,double-float ABI) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extern void hello(); | ||
|
||
int test () { | ||
hello(); | ||
return 0; | ||
} | ||
|
||
#ifdef EXECUTABLE | ||
void _start() { | ||
test(); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![allow(internal_features)] | ||
#![feature(no_core)] | ||
#![feature(lang_items)] | ||
#![no_std] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[no_mangle] | ||
pub fn hello() {} |