Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:04:11+00:00 2026-05-29T08:04:11+00:00

In my application i have 2 LLVM modules – the runtime one (which contains

  • 0

In my application i have 2 LLVM modules – the runtime one (which contains void foo(int * a) function definition) and executable one (which i’m creating using LLVM C++ API).

In my executable module i create int main(int argc, char ** argv) and want to put llvm::CallInst into it’s body, which would call foo() function from runtime module.

Here is my code:

Function * fooF = Function::Create(runtimeModule->getFunction("foo")->getFunctionType(),
    GlobalValue::WeakAnyLinkage, "foo", execModule);

After that, i link two modules together:

Linker linker("blabla", execModule, false);
linker.LinkInFile("/path/to/runtime.bc", false);
execModule = linker.releaseModule();

This compiles OK, however when i run Verifier pass on linked module i get:

Global is external, but doesn't have external or dllimport or weak linkage!
void (%i32*)* @foo
invalid linkage type for function declaration
void (%i32*)* @foo

It’s worth mentioning, that all globals in runtime module are internalized using Internalize pass. After linking, but before running Verifier, i’m running Dead Global Elimination pass amongst some other optimizations. And when i do dump() on resulting module, i see, that @foo which is coming from runtime module gets removed too, despite it’s used by main(). It seems, LLVM thinks that @foo definition in runtime and @foo declaration in executable are unrelated.

I’ve tried to play with linkage types – no luck.

So, what is the right way to create a call to the function from another module?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:04:12+00:00Added an answer on May 29, 2026 at 8:04 am

    Ok, i’ve fixed it, but i still can’t understand what was the problem. During building of my runtime bitcode module, i’ve been applying internalize transformation on it. So i tried to do this at run-time after linking and it helped me.

    Ah, and i’ve been using GlobalValue::WeakAnyLinkage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my console application have an abstract Factory class Listener which contains code for
My application have several modules, each in one tab on the mainform. When using
I have one question; In my ASP.NET MVC web application have to do certain
I have application which needs to use a dll (also written by me) which
I have Application written with GWT 1.7. I have one page where I upload
My application have a configuration xml-file. That file contains more than 50 program settings.
I'm starting work with PHPUnit with Kohana. My application have many controllers which simply
In my CodeIgniter application have a common header and footer view, which I include
My Application have 5 activities(A1,A2,A3,A4,A5). Each activity have one text view and one button(B1,B2,B3,B4,B5).
My application have an function that allow user to move and scale the image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.