Open minneelyyyy opened 1 year ago
0.12.0-dev.1390+94cee4fb2
LLVM Emit Object... LLVM ERROR: Unsupported expression in static initializer: or (i48 shl (i48 zext (i32 ptrtoint (ptr @arch.x86.gdt.gdt to i32) to i48), i48 16), i48 39)
Thread 1 "zig" received signal SIGABRT, Aborted.
0x00007fffea4a1adc in __pthread_kill_implementation () from /nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6
(gdb) bt
#0 0x00007fffea4a1adc in __pthread_kill_implementation () from /nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6
#1 0x00007fffea452cb6 in raise () from /nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6
#2 0x00007fffea43c8ba in abort () from /nix/store/dg8mpqqykmw9c7l0bgzzb5znkymlbfjw-glibc-2.37-8/lib/libc.so.6
#3 0x00007fffeafca215 in llvm::report_fatal_error (Reason=..., GenCrashDiag=GenCrashDiag@entry=true) at /home/meghan/src/llvm-17/llvm/lib/Support/ErrorHandling.cpp:123
#4 0x00007fffebded011 in llvm::AsmPrinter::lowerConstant (this=0x368e280, CV=0x357c070) at /home/meghan/src/llvm-17/llvm/include/llvm/ADT/Twine.h:233
#5 0x00007fffebdf3df6 in emitGlobalConstantImpl (DL=..., CV=CV@entry=0x357c070, AP=..., BaseCV=0x353a450, BaseCV@entry=0x0, Offset=Offset@entry=0, AliasList=AliasList@entry=0x0)
at /home/meghan/src/llvm-17/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3584
#6 0x00007fffebdf4aa8 in llvm::AsmPrinter::emitGlobalConstant (this=0x368e280, DL=..., CV=0x357c070, AliasList=0x0) at /home/meghan/src/llvm-17/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3600
#7 0x00007fffebdf72cd in llvm::AsmPrinter::emitGlobalVariable (this=0x368e280, GV=<optimized out>) at /home/meghan/src/llvm-17/llvm/include/llvm/IR/GlobalValue.h:653
#8 0x00007fffebdf175d in llvm::AsmPrinter::doFinalization (this=0x368e280, M=...) at /home/meghan/src/llvm-17/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2165
#9 0x00007fffeb3c8f04 in llvm::FPPassManager::doFinalization (this=0x363f4a0, M=...) at /home/meghan/src/llvm-17/llvm/lib/IR/LegacyPassManager.cpp:1499
#10 0x00007fffeb3d4f56 in (anonymous namespace)::MPPassManager::runOnModule (M=..., this=<optimized out>) at /home/meghan/src/llvm-17/llvm/lib/IR/LegacyPassManager.cpp:1586
#11 llvm::legacy::PassManagerImpl::run (this=0x35cc150, M=...) at /home/meghan/src/llvm-17/llvm/lib/IR/LegacyPassManager.cpp:535
#12 0x0000000002f2e77b in ZigLLVMTargetMachineEmitToFile (targ_machine_ref=<optimized out>, module_ref=0x34fda80, error_message=0x7ffffffeb200, is_debug=<optimized out>, is_small=<optimized out>, time_report=<optimized out>, tsan=false, lto=false,
asm_filename=0x0, bin_filename=0x3642f00 "kernel.elf.o", llvm_ir_filename=0x0, bitcode_filename=<optimized out>) at /home/meghan/src/zig/src/zig_llvm.cpp:357
#13 0x000000000113239d in codegen.llvm.Object.flushModule (self=0x34fa3a0, comp=0x34f78b0, prog_node=0x7fffffff1338) at /home/meghan/src/zig/src/codegen/llvm.zig:1291
#14 0x0000000001152a26 in link.Elf.flushModule (self=0x34f9950, comp=0x34f78b0, prog_node=0x7fffffff1338) at /home/meghan/src/zig/src/link/Elf.zig:862
#15 0x0000000001148347 in link.Elf.linkWithLLD (self=0x34f9950, comp=0x34f78b0, prog_node=0x7fffffff1338) at /home/meghan/src/zig/src/link/Elf.zig:1936
#16 0x0000000000e3dc4f in link.Elf.flush (self=0x34f9950, comp=0x34f78b0, prog_node=0x7fffffff1338) at /home/meghan/src/zig/src/link/Elf.zig:848
#17 0x0000000000b1371d in link.File.flush (base=0x34f9b40, comp=0x34f78b0, prog_node=0x7fffffff1338) at link.zig:819
#18 0x0000000000b12f76 in Compilation.flush (comp=0x34f78b0, prog_node=0x7fffffff1338) at Compilation.zig:2393
#19 0x0000000000b56d56 in Compilation.update (comp=0x34f78b0, main_progress_node=0x7fffffff1338) at Compilation.zig:2350
#20 0x0000000000b85753 in main.updateModule (comp=0x34f78b0) at main.zig:4226
#21 0x0000000000ba7bf3 in main.buildOutputType (gpa=..., arena=..., all_args=..., arg_mode=...) at main.zig:3627
#22 0x00000000009b92b0 in main.mainArgs (gpa=..., arena=..., args=...) at main.zig:271
#23 0x00000000009b6596 in main.main () at main.zig:215
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
the code is at https://github.com/girlbuzz/minos and if you simply build with
zig build -Darch=x86
then you should get an error message that looks like this:the related code seems to be this little line of code in
src/arch/x86/gdt.zig
when i set .offset to something like
@ptrFromInt(0x1000)
then it doesn't produce an error.I was also able to reproduce the issue with just this code
Expected Behavior
Ideally this code would just compile, or if this isn't allowed for some reason, there should be a better error message produced by Zig itself and not an LLVM error.