Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add regression test for issue #68794 #69168

Merged
merged 1 commit into from
Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Regression test for issue #68794
#
# Verify that no text relocations are accidentally introduced by linking a
# minimal rust staticlib.
#
# The test links a rust static library into a shared library, and checks that
# the linker doesn't have to flag the resulting file as containing TEXTRELs.

-include ../tools.mk

# only-linux

all:
$(RUSTC) foo.rs
$(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void foo();

int main() {
foo();
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![crate_type = "staticlib"]

#[no_mangle]
pub extern "C" fn foo(x: u32) {
// using the println! makes it so that enough code from the standard
// library is included (see issue #68794)
println!("foo: {}", x);
}