[llvm-dev] shadow-stack and llvm_gc_root_chain linkage when using JIT (original) (raw)

Nikodemus Siivola via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 1 00:30:26 PDT 2017


What is the expected way of gaining access to llvm_gc_root_chain when using JIT?

The only way I could figure out was this:

    fpm->add(llvm::createShadowStackGCLoweringPass());
    fpm->doInitialization();
    fpm->run(*f);
    // EPIC KLUDGE
    auto wrong = _module->getNamedGlobal("llvm_gc_root_chain");
    auto right = new llvm::GlobalVariable(
        *_module.get(),
        wrong->getType()->getContainedType(0),
        false, // variable
        llvm::GlobalVariable::ExternalLinkage,
        nullptr,
        "my_gc_root_chain");
    wrong->replaceAllUsesWith(right);

...which works, has a bit of a smell about it.

I cannot use the LLVM's definition from my GC because this is running in JIT.

I gave up trying to give it external linkage before shadow-stack-gc-lowering-pass since it makes a unique struct type that I cannot match (or I'm misunderstanding something badly), causing Stores to fail when using my definition.

Cheers,

-- nikodemus -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171101/d7f80a68/attachment.html>



More information about the llvm-dev mailing list