-
Notifications
You must be signed in to change notification settings - Fork 13k
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
statics are null on x86_64-unknown-linux-none #134763
Comments
Your code sample does not compile, it has a syntax error and depends on a crate that you didn't specify in the cargo.toml. After adding the semicolon and removing the syscall (and also specifying panic=abort explicitly because this is incorrectly a panic=unwind target, fixed in #134765) I got a program. |
Opened #134765 to change the defaults to more appropriate ones that should make your program work. |
UPD: #134765 opts to instead documents PIE as default target behavior and mentions using |
…illy, r=jieyouxu Improve default target options for x86_64-unknown-linux-none Without a standard library, we cannot unwind, so it should be panic=abort by default. Additionally, it does not have std because while it is Linux, it cannot use libc, which std uses today for Linux. Using PIE by default may be surprising to users, as shown in rust-lang#134763, so I've documented it explicitly. I'm not sure if we want to count that as fixing the issue or not. cc `@morr0ne,` as you added the target (and are the maintainer), and `@Noratrieb,` who reviewed that PR (:D).
…ly, r=jieyouxu Improve default target options for x86_64-unknown-linux-none Without a standard library, we cannot unwind, so it should be panic=abort by default. Additionally, it does not have std because while it is Linux, it cannot use libc, which std uses today for Linux. Using PIE by default may be surprising to users, as shown in rust-lang#134763, so I've documented it explicitly. I'm not sure if we want to count that as fixing the issue or not. cc `@morr0ne,` as you added the target (and are the maintainer), and `@Noratrieb,` who reviewed that PR (:D).
I'm closing this, since the problem should be fixed with the relocation model. The docs now mention this, but the default is still PIC, so people might run into this again, but there's not that much we can do about it. |
when compiling for
x86_64-unknown-linux-none
, the static items in the following code snippet have null pointers as address. The inline versions work as expected. The exit code of the program is10
.Meta
rustc --version --verbose
:cargo config:
The text was updated successfully, but these errors were encountered: