You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Weird behavior when trying to build a fully static binary with MUSL (x86_64-unknown-linux-musl) #79624
Basically I'm not getting an executable-format(it's still executable tho, more like a lib) output binary when I specify x86_64-unknown-linux-musl as the target. This is what I ran:
Static PIE is reported as "dynamically linked" by file.
So, is there anything I could do regarding this issue ?
Maybe compiling the rust-compiler with static_position_independent_executables disabled in the .rs file as you specified would help ? Although, it seems like a complicated process 😅
Thanks!
I don't think anything needs to be done here?
(Besides enabling static_position_independent_executables for i686-unknown-linux-musl perhaps.)
This
Basically I'm not getting an executable-format(it's still executable tho, more like a lib) output binary
is the expected behavior, static position-independent executables are indeed executables, but they may confuse tools like file which may report them as dynamic libraries.
I don't think anything needs to be done here?
(Besides enabling static_position_independent_executables for i686-unknown-linux-musl perhaps.)
This
Basically I'm not getting an executable-format(it's still executable tho, more like a lib) output binary
is the expected behavior, static position-independent executables are indeed executables, but they may confuse tools like file which may report them as dynamic libraries.
Okay so, that means I got nothing to worry about, right ?
Static PIE is reported as "dynamically linked" by file.
I am wonder that why it only enable static_position_independent_executables for x86_64 but no enable in i686, although i686 don't support pic instruction, but can implement it by call and get return addr(in fact, gcc use it to implement pic in i686), so I think we can think i686 support pic, so we should enable static_position_independent_executables for it ?
I just want to build a i686 musl pie executeable file, but i found it link the crtbegin but not crtbeginS, and I finally found that static_position_independent_executables is false in i686 target.
Activity
petrochenkov commentedon Dec 2, 2020
This happens because
static_position_independent_executablesis enabled in https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs but not in https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs.(
static_position_independent_executableswas enabled in #70740, not sure why it was done forx86_64only.)Static PIE is reported as "dynamically linked" by
file.axonasif commentedon Dec 2, 2020
So, is there anything I could do regarding this issue ?
Maybe compiling the rust-compiler with
static_position_independent_executablesdisabled in the.rsfile as you specified would help ? Although, it seems like a complicated process 😅Thanks!
petrochenkov commentedon Dec 2, 2020
I don't think anything needs to be done here?
(Besides enabling
static_position_independent_executablesfori686-unknown-linux-muslperhaps.)This
is the expected behavior, static position-independent executables are indeed executables, but they may confuse tools like
filewhich may report them as dynamic libraries.axonasif commentedon Dec 3, 2020
Okay so, that means I got nothing to worry about, right ?
petrochenkov commentedon Dec 4, 2020
Right, closing as not-an-issue.
plusls commentedon Jan 13, 2023
I am wonder that why it only enable
static_position_independent_executablesfor x86_64 but no enable in i686, although i686 don't support pic instruction, but can implement it by call and get return addr(in fact, gcc use it to implement pic in i686), so I think we can think i686 support pic, so we should enablestatic_position_independent_executablesfor it ?I just want to build a i686 musl pie executeable file, but i found it link the crtbegin but not crtbeginS, and I finally found that
static_position_independent_executablesis false in i686 target.