When I build Julia, it runs command “./julia-debug -O0 -C “native” --output-o path/basecompiler-debug-o.a.tmp --startup-file=no --warn-overwrite=yes -g1 Base_compiler.jl --buildroot ./ --dataroot ../usr/share/”, but I got an error.
I check the asm by gdb, #0 load from the 3rd argument register, actually the register value is not a address but a number 0x3.
From #1 to #0, the function called itself, before the call, asm load 0x3 to the 3rd register.
I also find other j_xx function dose the same thing: loads 0x3 to the 3rd register and calls itself .
So, Could anybody tell me how or where does the j_xx function generated?
First of all, thank you very much for your reply!
I am trying to compile the Julia on my own platform.
Do you have a version relationship table for Julia and LLVM?
I think they are in deps/patches/ in julia’s source tree: julia/deps/patches at v1.12.1 · JuliaLang/julia · GitHub
It changes by julia version, since the julia developers are submitting patches to llvm, and there’s some lag.
By their names it looks like they are instances of julia methods. E.g. j_fixup_phinode_value!_53300 is a compiler-generated name for an instance of fixup_phinode_value!, a julia function defined in Compiler/src/ssair/ir.jl. Similarly with japi1_just_fixup!_22814 which is an instance of just_fixup! in the same file. If you have the wrong version of llvm, or have not applied the patches, it’s likely that their native code is wrong in various ways. Though, I don’t know the inner workings of the compiler.
I am not sure why that involves you providing a different LLVM. I compiled Julia from source following the instructions in the GitHub Readme just fine. You can find links to Julia’s dependencies there as well but usually they are either provided directly or downloaded automatically.
Still, using the prebuild binaries (via juliaup) is what anyone should use except if you plan to do development on Julia itself.
LLVM patches are not there. Besides, that directory contains patches for fully from source builds, which may (but in theory should not) match the binary builds done in Yggdrasil used in the official binaries, so that directory isn’t the source of truth.