-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
std.os.linux.start_pie
: Add mips and powerpc support
#20823
Merged
Merged
Conversation
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
alexrp
commented
Jul 27, 2024
.mips64, .mips64el => asm volatile ( | ||
\\ .weak _DYNAMIC | ||
\\ .hidden _DYNAMIC | ||
\\ .balign 8 |
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.
alexrp
force-pushed
the
start-pie-mips-ppc
branch
from
July 28, 2024 15:09
ad21c0c
to
e459240
Compare
On MIPS, this call will require a relocation, which we can't do until after PIE relocations have been applied.
…ibcalls. The code would cause LLVM to emit a jump table for the switch in the loop over the dynamic tags. That jump table was far enough away that the compiler decided to go through the GOT, which would of course break at this early stage as we haven't applied MIPS's local GOT relocations yet, nor can we until we've walked through the _DYNAMIC array. The first attempt at rewriting this used code like this: var sorted_dynv = [_]elf.Addr{0} ** elf.DT_NUM; But this is also problematic as it results in a memcpy() call. Instead, we explicitly initialize it to undefined and use a loop of volatile stores to clear it.
alexrp
force-pushed
the
start-pie-mips-ppc
branch
from
July 29, 2024 23:26
e459240
to
595edff
Compare
cc @kubkon you might want to check the relocation stuff? |
kubkon
requested changes
Jul 30, 2024
Not likely to be necessary ever, but might as well be 100% correct.
alexrp
force-pushed
the
start-pie-mips-ppc
branch
from
July 30, 2024 16:03
595edff
to
2e719f3
Compare
kubkon
approved these changes
Jul 30, 2024
Nice! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requires #20822 to actually work.