Skip to content

jl_error() and jl_errorf() unsafe to call if LLVM not fully initialized #45847

Open
@staticfloat

Description

@staticfloat

If the runtime errors out early on in the bringup process, we can end up attempting to construct a backtrace and failing due to data structures not having been initialized yet. A historical example (which I am about to replace with jl_printf() and exit()):

jl_errorf("Invalid CPU name \"%s\".", TheCPU.c_str());

Because jl_errorf unconditionally subs off to jl_throw, we end up attempting to construct a backtrace. jl_error, in contrast, contains a guarding if statement, however it too fails in this case, as we are far enough to have initialized jl_errorexception_type as a tag from the system image, but not far enough yet to have fully initialized LLVM.

We should have some way of denoting to the rest of the runtime that LLVM is initialized. Jeff recommended that we:

Maybe we should have jl_init_llvm handle filling in the libjulia-codegen function pointers, so the system just behaves as if codegen is not available before it's initialized?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions