-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: Crawl static initializers for reachability
This ensures that private functions exported through static initializers will actually end up being public in the object file (so other objects can continue to reference the function). Closes #13620
- Loading branch information
1 parent
b5d6b07
commit 18ac265
Showing
4 changed files
with
52 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2012-2014 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. | ||
|
||
pub struct Foo { | ||
pub foo: extern fn() | ||
} | ||
|
||
extern fn the_foo() {} | ||
|
||
pub static FOO: Foo = Foo { | ||
foo: the_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,13 @@ | ||
// Copyright 2012-2014 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. | ||
|
||
extern crate crate1 = "issue-13620-1"; | ||
|
||
pub static FOO2: crate1::Foo = crate1::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,18 @@ | ||
// Copyright 2012-2014 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. | ||
|
||
// aux-build:issue-13620-1.rs | ||
// aux-build:issue-13620-2.rs | ||
|
||
extern crate crate2 = "issue-13620-2"; | ||
|
||
fn main() { | ||
(crate2::FOO2.foo)(); | ||
} |
18ac265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from luqmana
at alexcrichton@18ac265
18ac265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-13620 = 18ac265 into auto
18ac265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-13620 = 18ac265 merged ok, testing candidate = afed55b
18ac265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/5569
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/5565
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/4658
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4671
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5667
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/4755
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/4763
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/5669
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/4754
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/4760
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/4822
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2556
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/5662
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/4758
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/4773
18ac265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = afed55b