From 86415f23a86b5a44aa000d513500a9d1d0df4bba Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sun, 26 Mar 2017 17:07:27 -0700 Subject: Import subrepo gcc/:gcc at cf1f00bc038a0df769e14bb85480ab9c12eae08d --- gcc/gcc-test/src/NMakefile | 14 ++++++++++++++ gcc/gcc-test/src/bar1.c | 7 +++++++ gcc/gcc-test/src/bar2.c | 6 ++++++ gcc/gcc-test/src/baz.cpp | 9 +++++++++ gcc/gcc-test/src/expand.c | 4 ++++ gcc/gcc-test/src/foo.c | 9 +++++++++ gcc/gcc-test/src/i686.S | 9 +++++++++ gcc/gcc-test/src/i686.asm | 9 +++++++++ gcc/gcc-test/src/include/foo.h | 0 gcc/gcc-test/src/lib.rs | 16 ++++++++++++++++ gcc/gcc-test/src/msvc.c | 7 +++++++ gcc/gcc-test/src/opt_linkage.c | 5 +++++ gcc/gcc-test/src/windows.c | 3 +++ gcc/gcc-test/src/x86_64.S | 9 +++++++++ gcc/gcc-test/src/x86_64.asm | 8 ++++++++ 15 files changed, 115 insertions(+) create mode 100644 gcc/gcc-test/src/NMakefile create mode 100644 gcc/gcc-test/src/bar1.c create mode 100644 gcc/gcc-test/src/bar2.c create mode 100644 gcc/gcc-test/src/baz.cpp create mode 100644 gcc/gcc-test/src/expand.c create mode 100644 gcc/gcc-test/src/foo.c create mode 100644 gcc/gcc-test/src/i686.S create mode 100644 gcc/gcc-test/src/i686.asm create mode 100644 gcc/gcc-test/src/include/foo.h create mode 100644 gcc/gcc-test/src/lib.rs create mode 100644 gcc/gcc-test/src/msvc.c create mode 100644 gcc/gcc-test/src/opt_linkage.c create mode 100644 gcc/gcc-test/src/windows.c create mode 100644 gcc/gcc-test/src/x86_64.S create mode 100644 gcc/gcc-test/src/x86_64.asm (limited to 'gcc/gcc-test/src') diff --git a/gcc/gcc-test/src/NMakefile b/gcc/gcc-test/src/NMakefile new file mode 100644 index 0000000..03c73df --- /dev/null +++ b/gcc/gcc-test/src/NMakefile @@ -0,0 +1,14 @@ +all: $(OUT_DIR)/msvc.lib $(OUT_DIR)/msvc.exe + +$(OUT_DIR)/msvc.lib: $(OUT_DIR)/msvc.o + lib -nologo -out:$(OUT_DIR)/msvc.lib $(OUT_DIR)/msvc.o + rc -h + +$(OUT_DIR)/msvc.o: src/msvc.c + $(CC) -nologo -c -Fo:$@ src/msvc.c -MD + +$(OUT_DIR)/msvc.exe: $(OUT_DIR)/msvc2.o + $(CC) -nologo -Fo:$@ $(OUT_DIR)/msvc2.o + +$(OUT_DIR)/msvc2.o: src/msvc.c + $(CC) -nologo -c -Fo:$@ src/msvc.c -DMAIN -MD diff --git a/gcc/gcc-test/src/bar1.c b/gcc/gcc-test/src/bar1.c new file mode 100644 index 0000000..605be33 --- /dev/null +++ b/gcc/gcc-test/src/bar1.c @@ -0,0 +1,7 @@ +#include +#include "foo.h" + +int32_t bar1() { + return 5; +} + diff --git a/gcc/gcc-test/src/bar2.c b/gcc/gcc-test/src/bar2.c new file mode 100644 index 0000000..9be4291 --- /dev/null +++ b/gcc/gcc-test/src/bar2.c @@ -0,0 +1,6 @@ +#include + +int32_t bar2() { + return 6; +} + diff --git a/gcc/gcc-test/src/baz.cpp b/gcc/gcc-test/src/baz.cpp new file mode 100644 index 0000000..2d4b959 --- /dev/null +++ b/gcc/gcc-test/src/baz.cpp @@ -0,0 +1,9 @@ +#include + +extern "C" int32_t +baz() { + int *a = new int(8); + int b = *a; + delete a; + return b; +} diff --git a/gcc/gcc-test/src/expand.c b/gcc/gcc-test/src/expand.c new file mode 100644 index 0000000..2b492a2 --- /dev/null +++ b/gcc/gcc-test/src/expand.c @@ -0,0 +1,4 @@ +#define HELLO hello +#define WORLD world + +HELLO WORLD diff --git a/gcc/gcc-test/src/foo.c b/gcc/gcc-test/src/foo.c new file mode 100644 index 0000000..541e62c --- /dev/null +++ b/gcc/gcc-test/src/foo.c @@ -0,0 +1,9 @@ +#include + +#ifdef FOO +#if BAR == 1 +int32_t foo() { + return 4; +} +#endif +#endif diff --git a/gcc/gcc-test/src/i686.S b/gcc/gcc-test/src/i686.S new file mode 100644 index 0000000..3ed9e86 --- /dev/null +++ b/gcc/gcc-test/src/i686.S @@ -0,0 +1,9 @@ +.globl asm +asm: + mov $7, %eax + ret + +.globl _asm +_asm: + mov $7, %eax + ret diff --git a/gcc/gcc-test/src/i686.asm b/gcc/gcc-test/src/i686.asm new file mode 100644 index 0000000..6bf9676 --- /dev/null +++ b/gcc/gcc-test/src/i686.asm @@ -0,0 +1,9 @@ +.586 +.MODEL FLAT, C +.CODE + +asm PROC + MOV EAX, 7 + RET +asm ENDP +END diff --git a/gcc/gcc-test/src/include/foo.h b/gcc/gcc-test/src/include/foo.h new file mode 100644 index 0000000..e69de29 diff --git a/gcc/gcc-test/src/lib.rs b/gcc/gcc-test/src/lib.rs new file mode 100644 index 0000000..b42ebf7 --- /dev/null +++ b/gcc/gcc-test/src/lib.rs @@ -0,0 +1,16 @@ +extern "C" { + pub fn foo() -> i32; + + pub fn bar1() -> i32; + pub fn bar2() -> i32; + + pub fn asm() -> i32; + + pub fn baz() -> i32; + + #[cfg(windows)] + pub fn windows(); + + #[cfg(target_env = "msvc")] + pub fn msvc(); +} diff --git a/gcc/gcc-test/src/msvc.c b/gcc/gcc-test/src/msvc.c new file mode 100644 index 0000000..dbbc494 --- /dev/null +++ b/gcc/gcc-test/src/msvc.c @@ -0,0 +1,7 @@ +#include + +void msvc() {} + +#ifdef MAIN +int main() {} +#endif diff --git a/gcc/gcc-test/src/opt_linkage.c b/gcc/gcc-test/src/opt_linkage.c new file mode 100644 index 0000000..a74af8c --- /dev/null +++ b/gcc/gcc-test/src/opt_linkage.c @@ -0,0 +1,5 @@ +#include + +int32_t answer() { + return 42; +} diff --git a/gcc/gcc-test/src/windows.c b/gcc/gcc-test/src/windows.c new file mode 100644 index 0000000..0896aa0 --- /dev/null +++ b/gcc/gcc-test/src/windows.c @@ -0,0 +1,3 @@ +#include + +void windows() {} diff --git a/gcc/gcc-test/src/x86_64.S b/gcc/gcc-test/src/x86_64.S new file mode 100644 index 0000000..3ed9e86 --- /dev/null +++ b/gcc/gcc-test/src/x86_64.S @@ -0,0 +1,9 @@ +.globl asm +asm: + mov $7, %eax + ret + +.globl _asm +_asm: + mov $7, %eax + ret diff --git a/gcc/gcc-test/src/x86_64.asm b/gcc/gcc-test/src/x86_64.asm new file mode 100644 index 0000000..1c03101 --- /dev/null +++ b/gcc/gcc-test/src/x86_64.asm @@ -0,0 +1,8 @@ +_TEXT SEGMENT + +asm PROC + MOV EAX, 7 + RET +asm ENDP + +END -- cgit v1.2.3