-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER Also makes minor docs edits.
- Loading branch information
Showing
12 changed files
with
102 additions
and
31 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
37 changes: 37 additions & 0 deletions
37
src/test/run-make-fulldeps/crate-hash-rustc-version/Makefile
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,37 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# Ensure that crates compiled with different rustc versions cannot | ||
# be dynamically linked. | ||
|
||
FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0 | ||
UNAME := $(shell uname) | ||
ifeq ($(UNAME),Linux) | ||
EXT=".so" | ||
NM_CMD := nm -D | ||
endif | ||
ifeq ($(UNAME),Darwin) | ||
EXT=".dylib" | ||
NM_CMD := nm | ||
endif | ||
|
||
ifndef NM_CMD | ||
all: | ||
exit 0 | ||
else | ||
all: | ||
# a.rs is a dylib | ||
$(RUSTC) a.rs --crate-type=dylib $(FLAGS) | ||
# Write symbols to disk. | ||
$(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore | ||
# b.rs is a binary | ||
$(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS) | ||
$(call RUN,b) | ||
# Now re-compile a.rs with another rustc version | ||
RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS) | ||
# After compiling with a different rustc version, write symbols to disk again. | ||
$(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter | ||
# As a sanity check, test if the symbols changed: | ||
# If the symbols are identical, there's been an error. | ||
if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi | ||
$(call FAIL,b) | ||
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,4 @@ | ||
pub fn foo(mut x: String) -> String { | ||
x.push_str(", world!"); | ||
x | ||
} |
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,8 @@ | ||
extern crate a; | ||
|
||
use a::foo; | ||
|
||
fn main() { | ||
let x = String::from("Hello"); | ||
println!("{}", foo(x)); | ||
} |
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
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
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
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
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
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
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
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