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 9260413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:53:08+00:00 2026-06-18T12:53:08+00:00

I am profiling a few files in Spec2K6 benchmark with a profiler written in

  • 0

I am profiling a few files in Spec2K6 benchmark with a profiler written in LLVM, and cannot understand what is the correct way to link multiple .bc files.

For example, the benchmark has concat.c, which uses the xmalloc method defined in xmalloc.c, which uses xexit method from xexit.c

I am using the following commands to link multiple .bc files before I profile them –

CFLAGS='-D_GNU_SOURCE -D_XOPEN_SOURCE=600 -c -Wall -pedantic -Wno-long-long -g -O0 -    I/net/x/silkyar/llvm/include -I/net/403.gcc/src'
clang $CFLAGS -emit-llvm -c 403.gcc/src/concat.c -o concat.bc
clang $CFLAGS -emit-llvm -c 403.gcc/src/xexit.c -o xexit.bc
clang $CFLAGS -emit-llvm -c 403.gcc/src/xmalloc.c -o xmalloc.bc 
llvm-link concat.bc xexit.bc xmalloc.bc -o a.bc
llc a.bc -o a.s
g++ -o final a.s
./final

but this fails with,
llvm-link: link error in ‘xexit.bc’: Linking globals named ‘xexit’: symbol multiply defined!
/tmp/ccUldT0Y.o:(.debug_info+0x1e): undefined reference to .Lline_table_start0'
/tmp/ccUldT0Y.o:(.debug_info+0x42f): undefined reference to
.Lline_table_start1′
/tmp/ccUldT0Y.o:(.debug_info+0x4a0): undefined reference to `.Lline_table_start2′
collect2: ld returned 1 exit status

Could anyone please guide me on how llvm-link works.

Thanks.

  • 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-06-18T12:53:09+00:00Added an answer on June 18, 2026 at 12:53 pm

    In general, llvm-link works fine. Here’s a simple demonstration (with LLVM built from trunk a few days ago):

    $ cat lib.c 
    int libfoo(int x) {
        return x * 2;
    }
    
    $ cat user.c
    int libfoo(int);
    
    
    int bar(int a, int b) {
        return a + libfoo(b);
    }
    $ clang -emit-llvm -c user.c -o user.bc
    $ clang -emit-llvm -c lib.c -o lib.bc
    $ llvm-link lib.bc user.bc -o linked.bc
    $ llvm-dis linked.bc
    $ cat linked.ll
    ; ModuleID = 'linked.bc'
    target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"
    
    define i32 @libfoo(i32 %x) nounwind uwtable {
    entry:
      %x.addr = alloca i32, align 4
      store i32 %x, i32* %x.addr, align 4
      %0 = load i32* %x.addr, align 4
      %mul = mul nsw i32 %0, 2
      ret i32 %mul
    }
    
    define i32 @bar(i32 %a, i32 %b) nounwind uwtable {
    entry:
      %a.addr = alloca i32, align 4
      %b.addr = alloca i32, align 4
      store i32 %a, i32* %a.addr, align 4
      store i32 %b, i32* %b.addr, align 4
      %0 = load i32* %a.addr, align 4
      %1 = load i32* %b.addr, align 4
      %call = call i32 @libfoo(i32 %1)
      %add = add nsw i32 %0, %call
      ret i32 %add
    }
    

    So you have to carefully examine your specific code for symbol duplication, missing, etc.

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

Sidebar

Related Questions

We've been profiling our code recently and we've come across a few annoying hotspots.
After using EFProfiler (absolutely fantastic tool BTW!) for profiling a few of our Entity
I used 'package.skeleton()' to generate .Rd help files a few months ago. I have
A few years ago, Apple released software glossaries (bilingual files) for each of the
I have a few .rb files and I want to use the same variables
I'm currently profiling my app and coming across a few leaks. I've tried releasing
while profiling a java application that calculates hierarchical clustering of thousands of elements I
I'm profiling some code, and cProfile reports that almost all the time is spent
I am currently profiling my node.js application.I found this blog: http://blog.nodejs.org/2012/04/25/profiling-node-js/ that suggests I
I have tried profiling my app, but found that TraceView isn't that user friendly,

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.