Skip to content

"LLVM ERROR: Broken module found, compilation aborted!" when compiling a sysimage with a ccallable function and a certain cpu target #34064

Closed

Description

When trying to change the cpu target used when generating "apps" in PackageCompiler (JuliaLang/PackageCompilerX.jl#43) with the "app" at (https://github.com/KristofferC/PackageCompilerX.jl/blob/master/examples/MyApp/src/MyApp.jl) I hit the following CI error

Linux (https://travis-ci.com/KristofferC/PackageCompilerX.jl/jobs/265321335#L264-L267):

<unknown>: error: Cannot represent a difference across sections
Aliasee should be either GlobalValue or ConstantExpr
i32 ()* @julia_main
LLVM ERROR: Broken module found, compilation aborted!

Mac (https://travis-ci.com/KristofferC/PackageCompilerX.jl/jobs/265321336#L197-L212);

signal (11): Segmentation fault: 11
in expression starting at none:0
_ZN12_GLOBAL__N_119X86MachObjectWriter16recordRelocationEPN4llvm16MachObjectWriterERNS1_11MCAssemblerERKNS1_11MCAsmLayoutEPKNS1_10MCFragmentERKNS1_7MCFixupENS1_7MCValueERy at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm16MachObjectWriter16recordRelocationERNS_11MCAssemblerERKNS_11MCAsmLayoutEPKNS_10MCFragmentERKNS_7MCFixupENS_7MCValueERy at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm11MCAssembler6layoutERNS_11MCAsmLayoutE at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm11MCAssembler6FinishEv at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN12_GLOBAL__N_115MCMachOStreamer10FinishImplEv at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm10MCStreamer6FinishEv at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm10AsmPrinter14doFinalizationERNS_6ModuleE at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm13FPPassManager14doFinalizationERNS_6ModuleE at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /Users/travis/julia/lib/julia/libLLVM.dylib (unknown line)
operator() at /Users/sabae/buildbot/worker/package_macos64/build/src/jitlayers.cpp:1086 [inlined]
jl_dump_native at /Users/sabae/buildbot/worker/package_macos64/build/src/jitlayers.cpp:1095
jl_write_compiler_output at /Users/sabae/buildbot/worker/package_macos64/build/src/precompile.c:93
jl_atexit_hook at /Users/sabae/buildbot/worker/package_macos64/build/src/init.c:230
main at /Users/travis/julia/bin/julia (unknown line)

It can be reprod on the linked branch above with pwd in the root git repo and running:

using PackageCompilerX
 create_sysimage(:MyApp, sysimage_path="MyApp.so", cpu_target="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)", project="examples/MyApp", incremental=false)

Note that incremental=false seems to be needed (which means that a new sysimage is bootstrapped from scratch (corecompiler.ji -> sys.ji -> sys.o).

I can reduce it to just a set of raw commands if that would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions