Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-include ../tools.mk | ||
|
||
# Make sure we don't ICE if the linker prints a non-UTF-8 error message. | ||
|
||
ifdef IS_WINDOWS | ||
# ignore windows | ||
|
||
# This does not work in its current form on windows, possibly due to | ||
# gcc bugs or something about valid Windows paths. See issue #29151 | ||
# for more information. | ||
all: | ||
|
||
else | ||
|
||
# The zzz it to allow humans to tab complete or glob this thing. | ||
bad_dir := $(TMPDIR)/zzz$$'\xff' | ||
|
||
all: | ||
$(RUSTC) library.rs | ||
mkdir $(bad_dir) | ||
mv $(TMPDIR)/liblibrary.a $(bad_dir) | ||
LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2015 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. | ||
|
||
#[link(name="library")] | ||
extern "C" { | ||
fn foo(); | ||
} | ||
|
||
fn main() { unsafe { foo(); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2015 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 = "staticlib"] | ||
|
||
extern "C" { | ||
fn this_symbol_not_defined(); | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn foo() { | ||
unsafe { this_symbol_not_defined(); } | ||
} |