aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-09-10 13:53:54 +0000
committerGitHub <noreply@github.com>2021-09-10 13:53:54 +0000
commitc0254d7efe135ca3de755504a1f042010ee45786 (patch)
tree3b38c7d9fb95193caaf2797dc8c4a5d172973bf6 /gcc/rust/backend/rust-compile-expr.h
parentd52030df14a50ed78f388520edc9dd506b59dbee (diff)
parent995bc1c9834f4b881a5d620cf4d707962c3841a7 (diff)
parent0de1b5646cf39bcdef42f2a824521c7427fe4754 (diff)
downloadgcc-c0254d7efe135ca3de755504a1f042010ee45786.zip
gcc-c0254d7efe135ca3de755504a1f042010ee45786.tar.gz
gcc-c0254d7efe135ca3de755504a1f042010ee45786.tar.bz2
Merge #661 #663
661: Add support for choosing other builtin GCC calling conventions r=philberty a=philberty Add support for some other ABI options. I was able to test this with linking against some C code but these options like stdcall seem to be limited to 32 bit mode ```rust extern "stdcall" { pub fn test(a: i32) -> i32; } extern "C" { fn printf(s: *const i8, ...); } fn main() -> i32 { unsafe { let a = 3; let res = test(a); let a = "%i\n\0"; let b = a as *const str; let c = b as *const i8; printf(c, res); } 0 } ``` ```c __attribute__ ((stdcall)) int test(int x) { return x + 3; } ``` Compiling like this: ``` $ gccrs -g -O0 -m32 -c test.rs -o test.o $ gcc -g -O0 -m32 -c lib.c -o lib.o $ gcc -m32 -o test test.o lib.o ``` More testing will be required over time here but this was kind of fun to see that it worked. 663: Move module output test case from compile/ to execute/ r=philberty a=CohenArthur Fixes [this issue](https://github.com/Rust-GCC/gccrs/pull/639#discussion_r705922519) by `@tschwinge` I think this shows that we need to figure out a better way to keep test files and their modules, as pointed out by `@dkm` [here](https://github.com/Rust-GCC/gccrs/pull/639#issuecomment-905457557). Here, the modules/ directory is a straight up duplicate of the other one in compile/ which I'm not a fan of. I have no experience with having a separate .exp in the subdir but I can try and I think that it would be better. Maybe it can also be simpler if the regex to match *.rs files only looks inside one level of subdirectories? But I can think of a few places where this might be an issue Co-authored-by: Philip Herron <philip.herron@embecosm.com> Co-authored-by: CohenArthur <arthur.cohen@epita.fr>