Skip to content

Make #[used] statics have external linkage #95348

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

carbotaniuman
Copy link
Contributor

@carbotaniuman carbotaniuman commented Mar 26, 2022

This PR fixes somewhat #47384, by making the #[used] and #[used(compiler]/#[used(linker)] have external linkage.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 26, 2022
@rust-highfive
Copy link
Contributor

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

running 229 tests
..........i.ii....ii................................................................................ 100/229
.................i...................iiiiiii......i...................iii........................... 200/229
Some tests failed in compiletest suite=run-make-fulldeps mode=run-make host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
...........ii..F.............

---- [run-make] run-make-fulldeps/symbol-visibility stdout ----

error: make failed
error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no an_rlib.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_cdylib.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_rust_dylib.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no an_executable.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility  -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib
# Check that a cdylib exports its public #[no_mangle] functions
[ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ]
# Check that a cdylib exports the public #[no_mangle] functions of dependencies
[ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ]
# Check that a cdylib DOES NOT export any public Rust functions
[ "$(nm -D /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/symbol-visibility/symbol-visibility/liba_cdylib.so | grep -v __imp_ | grep -c "_ZN.*h.*E\|_R[a-zA-Z0-9_]+")" -eq "0" ]
--- stderr -------------------------------
--- stderr -------------------------------
make: *** [Makefile:41: all] Error 1



failures:

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants