Skip to content

Commit

Permalink
test that a no_builtins crate is passed to the linker
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Aug 15, 2016
1 parent 35eba85 commit e996405
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/run-make/no-builtins-lto/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-include ../tools.mk

all:
# Compile a `#![no_builtins]` rlib crate
$(RUSTC) no_builtins.rs
# Build an executable that depends on that crate using LTO. The no_builtins crate doesn't
# participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by
# grepping the linker arguments.
$(RUSTC) main.rs -C lto -Z print-link-args | grep 'libno_builtins.rlib'
13 changes: 13 additions & 0 deletions src/test/run-make/no-builtins-lto/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2016 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.

extern crate no_builtins;

fn main() {}
12 changes: 12 additions & 0 deletions src/test/run-make/no-builtins-lto/no_builtins.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2016 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.

#![crate_type = "lib"]
#![no_builtins]

0 comments on commit e996405

Please sign in to comment.