aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-25 23:55:37 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-30 01:26:10 +0200
commit2386bfe854826e0726b7002c04cd9fc4c08d68f3 (patch)
treed0f5634fbea27b77f895b12629fe96b37f156dab /src/codegen
parent68cebde186eb8507509c9418c1ab3b843c6f24ff (diff)
downloadzig-2386bfe854826e0726b7002c04cd9fc4c08d68f3.tar.gz
zig-2386bfe854826e0726b7002c04cd9fc4c08d68f3.zip
std.os.linux.start_pie: Rewrite relocate() to avoid jump tables and libcalls.
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.
Diffstat (limited to 'src/codegen')
0 files changed, 0 insertions, 0 deletions