Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or 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
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.
GNU ld builds a 64-bit PowerPC ELFv1 import stub in one of eight basic layouts,
and kuna names only three of them. The plain
bctrstub that ld gives anexecutable which creates no threads is one of the other five, so in a stripped
binary the import is an anonymous function and a no-return import no longer
ends its block:
-Wl,--plt-static-chainprints the same. With neither option the output isexit(1); // no-return.Fix
std r2,40(r1), an entry load fromr2or from anaddisbase,mtctr, and the TOC load, thenbctror the lazy-resolution tail. Theenvironment load that
--plt-static-chainadds is now optional in everylayout, and either ending may follow. Before,
bctrwas accepted only afteran environment load from an
addisbase, and the lazy tail only without one.r2itself is the base, the environment load must precede the TOC load,which replaces
r2. The same two loads in the other order stay unnamed.still select one zero-addend
R_PPC64_JMP_SLOT, and a lazy tail must stillreach that import's resolver entry. ld's rarer forms (an
addi-adjustedbase, the
xor/addpair it uses when the resolver is out of branch range,and stubs without the TOC save) stay unnamed.
Tests
entry register, and decline each single deviation: a wrong offset, register
or base in any load, a missing TOC load, the loads or the CTR move out of
order, an entry register other than
r11orr12, an ending that isneither
bctrnor the whole lazy tail, and the rarer forms above. They failwithout the fix.
__stack_chk_failno-return; conflicting TOCs, a local-descriptor alias, anonzero addend and a lazy tail that reaches another import's resolver entry
stay unnamed. Two of these tests fail without the fix.
elf/ppc64v1-moregains its 113 import names. Its 33halt_baddatatruncations are gone, and 454 of its 457 import call sitesmatch the C prototypes; the other three are as before. Four functions there
lose 44 call sites that were reached only by running past a no-return call.
Because
mainno longer runs into_start, the speculative gap-walk addssub_4bc0inside it; kuna misses the ELFv1_startwith or without thischange.
elf/ppc64v1-libz-static-chain.sogains its 50 names and prints all 176functions exactly as
elf/ppc64v1-libz.so. No datatest or stage expectationmoved.