forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#95818 - petrochenkov:stabundle, r=wesleywiser
Stabilize the `bundle` native library modifier And remove the legacy `static-nobundle` linking kind. Stabilization report - rust-lang#95818 (comment). cc rust-lang#81490 Closes rust-lang#37403
- Loading branch information
Showing
35 changed files
with
88 additions
and
196 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
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
19 changes: 0 additions & 19 deletions
19
src/doc/unstable-book/src/language-features/native-link-modifiers-bundle.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
all: $(call NATIVE_STATICLIB,native-staticlib) | ||
# Build a staticlib and a rlib, the `native_func` symbol will be bundled into them | ||
$(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func" | ||
|
||
# Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it | ||
$(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func" | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func" | ||
|
||
# Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously | ||
# The cdylib will contain the `native_func` symbol in the end | ||
$(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib|native-staticlib\.lib' | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func" | ||
|
||
# Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously | ||
# The cdylib will contain the `native_func` symbol in the end | ||
$(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib|native-staticlib\.lib' | ||
"$(LLVM_BIN_DIR)/llvm-nm" $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func" |
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,11 @@ | ||
#[link(name = "native-staticlib", kind = "static", modifiers = "+bundle")] | ||
extern "C" { | ||
pub fn native_func(); | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn wrapped_func() { | ||
unsafe { | ||
native_func(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs
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 @@ | ||
extern crate bundled; |
1 change: 1 addition & 0 deletions
1
src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs
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 @@ | ||
extern crate non_bundled; |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
src/test/run-make/native-link-modifier-bundle/non-bundled.rs
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,11 @@ | ||
#[link(name = "native-staticlib", kind = "static", modifiers = "-bundle")] | ||
extern "C" { | ||
pub fn native_func(); | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn wrapped_func() { | ||
unsafe { | ||
native_func(); | ||
} | ||
} |
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
2 changes: 0 additions & 2 deletions
2
src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![feature(native_link_modifiers_bundle)] | ||
|
||
use std::io::Write; | ||
|
||
#[link(name = "c_static_lib_with_constructor", | ||
|
9 changes: 0 additions & 9 deletions
9
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.