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#119162 - heiher:direct-access-external-data…
…, r=petrochenkov Add unstable `-Z direct-access-external-data` cmdline flag for `rustc` The new flag has been described in the Major Change Proposal at rust-lang/compiler-team#707 Fixes rust-lang#118053
- Loading branch information
Showing
8 changed files
with
74 additions
and
10 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
16 changes: 16 additions & 0 deletions
16
src/doc/unstable-book/src/compiler-flags/direct-access-external-data.md
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,16 @@ | ||
# `direct_access_external_data` | ||
|
||
The tracking issue for this feature is: https://github.com/rust-lang/compiler-team/issues/707 | ||
|
||
------------------------ | ||
|
||
Option `-Z direct-access-external-data` controls how to access symbols of | ||
external data. | ||
|
||
Supported values for this option are: | ||
|
||
- `yes` - Don't use GOT indirection to reference external data symbols. | ||
- `no` - Use GOT indirection to reference external data symbols. | ||
|
||
If the option is not explicitly specified, different targets have different | ||
default values. |
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,21 @@ | ||
// only-loongarch64-unknown-linux-gnu | ||
|
||
// revisions: DEFAULT DIRECT INDIRECT | ||
// [DEFAULT] compile-flags: -C relocation-model=static | ||
// [DIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=yes | ||
// [INDIRECT] compile-flags: -C relocation-model=static -Z direct-access-external-data=no | ||
|
||
#![crate_type = "rlib"] | ||
|
||
// DEFAULT: @VAR = external {{.*}} global i32 | ||
// DIRECT: @VAR = external dso_local {{.*}} global i32 | ||
// INDIRECT: @VAR = external {{.*}} global i32 | ||
|
||
extern "C" { | ||
static VAR: i32; | ||
} | ||
|
||
#[no_mangle] | ||
pub fn get() -> i32 { | ||
unsafe { VAR } | ||
} |