about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-06 07:06:36 -0700
committerbors <bors@rust-lang.org>2014-04-06 07:06:36 -0700
commit02c81fe2b5308bccbc90baae9e7ccdb8b915fe7d (patch)
treeb89e9ef106da6d234d791838b4a690e51fefd653 /src/test
parent4af69f204e2365da0dc9f32bbd0eb3201dc9a9e0 (diff)
parentb78ac5b74a62e7b2772d322004a6bb04967f8437 (diff)
downloadrust-02c81fe2b5308bccbc90baae9e7ccdb8b915fe7d.tar.gz
rust-02c81fe2b5308bccbc90baae9e7ccdb8b915fe7d.zip
auto merge of #13340 : FlaPer87/rust/code-model, r=cmr
Rust currently defaults to `RelocPIC` regardless. This patch adds a new
codegen option that allows choosing different relocation-model. The
available models are:

    - default (Use the target-specific default model)
    - static
    - pic
    - no-pic

For a more detailed information use `llc --help`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make/relocation-model/Makefile15
-rw-r--r--src/test/run-make/relocation-model/foo.rs11
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/run-make/relocation-model/Makefile b/src/test/run-make/relocation-model/Makefile
new file mode 100644
index 00000000000..2fcdd32bfcb
--- /dev/null
+++ b/src/test/run-make/relocation-model/Makefile
@@ -0,0 +1,15 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
+	$(call RUN,foo)
+
+	$(RUSTC) -C relocation-model=default foo.rs
+	$(call RUN,foo)
+
+	$(RUSTC) -C relocation-model=static foo.rs
+	$(call RUN,foo)
+
+	$(RUSTC) -C relocation-model=default --crate-type=dylib foo.rs
+	$(RUSTC) -C relocation-model=static --crate-type=dylib foo.rs
+	$(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs
diff --git a/src/test/run-make/relocation-model/foo.rs b/src/test/run-make/relocation-model/foo.rs
new file mode 100644
index 00000000000..e06d81cd60b
--- /dev/null
+++ b/src/test/run-make/relocation-model/foo.rs
@@ -0,0 +1,11 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {}