aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-22 01:22:47 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-22 01:22:47 +0200
commit7bc78967b400322a0fc5651f37a1b0428c37fb9d (patch)
treec4eee7937ac827aa648b1b027232dac88106749c /src/zig_llvm.cpp
parentecd459b8647a1b7cade31f0286694e14101f80f4 (diff)
downloadzig-7bc78967b400322a0fc5651f37a1b0428c37fb9d.tar.gz
zig-7bc78967b400322a0fc5651f37a1b0428c37fb9d.zip
start: Fix _start() to initialize the ToC for powerpc64.
The previous version of this function referenced the argc_argv_ptr global variable as an inline asm operand. This caused LLVM to generate prologue code to initialize the ToC so that the global variable can actually be accessed. Ordinarily, there's nothing wrong with that. But _start() is a naked function! This makes it actually super surprising that LLVM did this. It also means that the old version only really worked by accident. Once the reference to the global variable was removed, no ToC was set up, thus violating the calling convention once we got to posixCallMainAndExit(). This then caused any attempt to access global variables here to crash - namely when setting std.os.linux.elf_aux_maybe. The fix is to just initialize the ToC manually in _start().
Diffstat (limited to 'src/zig_llvm.cpp')
0 files changed, 0 insertions, 0 deletions