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
The position-independent-executables target file option currently has the following behavior when using gcc as the linker:
When true, add "-pie" to the command line
When false, do nothing
However, if gcc is built with --enable-default-pie, which seems to be the default now for recent versions of gcc, this logic fails when position-independent-executables is set to false. In that case, the logic should be reversed:
When true, do nothing
When false, add "-no-pie" to the command line
The obvious way to resolve this would be to pass "-pie" when true and "-no-pie" when false, but sadly, older versions of gcc will fail to link with "-no-pie" because it doesn't recognize that command line option and errors out.
It seems like the correct thing to do would be split the link step for gcc into two steps:
call "gcc -v" to see if --enable-default-pie is set
pass the appropriate pie flag to gcc based on this
I think this is the root cause for these issues: #35061#47037
If you all agree this is the correct path and can give me a hint as to where/how this should be done I can take a stab at writing the code for it.
The text was updated successfully, but these errors were encountered:
When linking with gcc, run gcc -v to see if --enable-default-pie is
compiled in. If it is, pass -no-pie when necessary to disable pie.
Otherwise, pass -pie when necessary to enable it.
Fixesrust-lang#48032 and fixesrust-lang#35061
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Feb 25, 2018
pass correct pie args to gcc linker
When linking with gcc, run gcc -v to see if --enable-default-pie is
compiled in. If it is, pass -no-pie when necessary to disable pie.
Otherwise, pass -pie when necessary to enable it.
Fixesrust-lang#48032 and fixesrust-lang#35061
The
position-independent-executables
target file option currently has the following behavior when using gcc as the linker:However, if gcc is built with --enable-default-pie, which seems to be the default now for recent versions of gcc, this logic fails when
position-independent-executables
is set to false. In that case, the logic should be reversed:The obvious way to resolve this would be to pass "-pie" when true and "-no-pie" when false, but sadly, older versions of gcc will fail to link with "-no-pie" because it doesn't recognize that command line option and errors out.
It seems like the correct thing to do would be split the link step for gcc into two steps:
I think this is the root cause for these issues: #35061 #47037
If you all agree this is the correct path and can give me a hint as to where/how this should be done I can take a stab at writing the code for it.
The text was updated successfully, but these errors were encountered: