diff options
| author | bors <bors@rust-lang.org> | 2013-12-09 16:11:28 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-09 16:11:28 -0800 |
| commit | 29ca4350c8d64facb39311660e8ee919766f481a (patch) | |
| tree | 89cc0a532846f00be6159ea2eb5b3c8f3d9cf058 /src/test | |
| parent | f817ed3e6f39e6e0b1a8ec968ea0ad3c1bc36ba5 (diff) | |
| parent | fce4a174b9ffff71a66feecd9f4960f17fc9c331 (diff) | |
| download | rust-29ca4350c8d64facb39311660e8ee919766f481a.tar.gz rust-29ca4350c8d64facb39311660e8ee919766f481a.zip | |
auto merge of #10812 : alexcrichton/rust/lto, r=pcwalton
The first commit was approved from another pull request, but I wanted to rebase LTO on top of it. LTO is not turned on by default at all, and it's hidden behind a `-Z` flag. I have added a few small tests for it, however.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-make/lto-smoke-c/Makefile | 11 | ||||
| -rw-r--r-- | src/test/run-make/lto-smoke-c/bar.c | 6 | ||||
| -rw-r--r-- | src/test/run-make/lto-smoke-c/foo.rs | 4 | ||||
| -rw-r--r-- | src/test/run-make/lto-smoke/Makefile | 6 | ||||
| -rw-r--r-- | src/test/run-make/lto-smoke/lib.rs | 1 | ||||
| -rw-r--r-- | src/test/run-make/lto-smoke/main.rs | 3 |
6 files changed, 31 insertions, 0 deletions
diff --git a/src/test/run-make/lto-smoke-c/Makefile b/src/test/run-make/lto-smoke-c/Makefile new file mode 100644 index 00000000000..a491fda7dc2 --- /dev/null +++ b/src/test/run-make/lto-smoke-c/Makefile @@ -0,0 +1,11 @@ +-include ../tools.mk + +ifneq ($(shell uname),Darwin) + EXTRAFLAGS := -lm -lrt -ldl -lpthread +endif + +all: + $(RUSTC) foo.rs -Z gen-crate-map -Z lto + ln -s $(call STATICLIB,foo-*) $(call STATICLIB,foo) + $(CC) bar.c -lfoo -o $(call RUN,bar) $(EXTRAFLAGS) -lstdc++ + $(call RUN,bar) diff --git a/src/test/run-make/lto-smoke-c/bar.c b/src/test/run-make/lto-smoke-c/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/src/test/run-make/lto-smoke-c/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/src/test/run-make/lto-smoke-c/foo.rs b/src/test/run-make/lto-smoke-c/foo.rs new file mode 100644 index 00000000000..3da09eb6bb6 --- /dev/null +++ b/src/test/run-make/lto-smoke-c/foo.rs @@ -0,0 +1,4 @@ +#[crate_type = "staticlib"]; + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/src/test/run-make/lto-smoke/Makefile b/src/test/run-make/lto-smoke/Makefile new file mode 100644 index 00000000000..4652556d344 --- /dev/null +++ b/src/test/run-make/lto-smoke/Makefile @@ -0,0 +1,6 @@ +-include ../tools.mk + +all: + $(RUSTC) lib.rs + $(RUSTC) main.rs -Z lto + $(call RUN,main) diff --git a/src/test/run-make/lto-smoke/lib.rs b/src/test/run-make/lto-smoke/lib.rs new file mode 100644 index 00000000000..3cdacc96ee9 --- /dev/null +++ b/src/test/run-make/lto-smoke/lib.rs @@ -0,0 +1 @@ +#[crate_type = "rlib"]; diff --git a/src/test/run-make/lto-smoke/main.rs b/src/test/run-make/lto-smoke/main.rs new file mode 100644 index 00000000000..a3ed6772926 --- /dev/null +++ b/src/test/run-make/lto-smoke/main.rs @@ -0,0 +1,3 @@ +extern mod lib; + +fn main() {} |
