Linking LLVM IR with standard library

Hi,

I have a LLVM IR file generated for a different source language (Not C). I have added a rand() function in it to generate random numbers.

I compiled the .ll file to .o using clang. However, when I execute the .o file all generated numbers are zeros.

How should I link the .ll file with the standard library for the clang to generate the random numbers?

Thanks
-Shilpa

Without reproducible steps, it’s hard to give meaningful advice. In my experience, linking using clang (or gcc) will work.

My compiler does that around in this function:
https://github.com/Leporacanthicus/lacsap/blob/master/binary.cpp#L126

Do reply to ALL recipients (in particular to the mailing list) when replying!

Hi Mats,

Thanks for pointing out. Your suggestion solved my problem.

You have been of great help.

Cheers…:slight_smile:

Thanks,

Shilpa