[llvm-dev] Linker error while linking DataFlowSanitizer to LLVM IR

don hinton via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 15 17:24:09 PDT 2017


I don't use the pre-built binaries, but I believe the missing symbols are
part of compiler-rt.  Please see: https://compiler-rt.llvm.org/

hth...
don

On Thu, Jun 15, 2017 at 5:09 PM, Dipanjan Das via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

>
> This happens with LLVM 4.0, too. Is it a bug I am hitting, by any chance?
>
> On 14 June 2017 at 17:00, Dipanjan Das <mail.dipanjan.das at gmail.com>
> wrote:
>
>>
>> I am using pre-built LLVM/Clang 3.8.0 binaries on Ubuntu 16.04.2, 64 bit.
>> I tried to lift a minimal program to LLVM IR, then link the IR to
>> DataFlowSanitizer libraries to produce executable code. In the second step,
>> the process throws a bunch of linker errors.
>>
>> =========================================
>>
>> #include <sanitizer/dfsan_interface.h>
>> #include <assert.h>
>>
>> int main(void) {
>>   int i = 1;
>>
>>   dfsan_label i_label = dfsan_create_label("i", 0);
>>   dfsan_set_label(i_label, &i, sizeof(i));
>>
>>   return 0;
>> }
>>
>> =========================================
>>
>> clang -c -emit-llvm -fsanitize=dataflow test.c -o test.bc
>>
>> clang -fsanitize=dataflow test2.bc -o test2
>>
>> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o:
>> In function `_start':
>> (.text+0x20): undefined reference to `main'
>>
>> /tmp/test2-c642ef.o: In function `dfs$main':
>>
>> test2.bc:(.text+0x96): undefined reference to `dfs$dfsan_create_label'
>>
>> test2.bc:(.text+0xeb): undefined reference to `dfs$dfsan_set_label'
>>
>> /tmp/test2-c642ef.o: In function `dfs$dfsw$dfsan_create_label':
>>
>> test2.bc:(.text+0x16e): undefined reference to `dfs$dfsan_create_label'
>>
>> /tmp/test2-c642ef.o: In function `dfs$dfsw$dfsan_set_label':
>>
>> test2.bc:(.text+0x1e4): undefined reference to `dfs$dfsan_set_label'
>>
>> clang-3.8: error: linker command failed with exit code 1 (use -v to see
>> invocation)
>>
>> =========================================
>>
>> Any idea what might I be doing wrong?
>>
>> --
>>
>> Thanks & Regards,
>> Dipanjan
>>
>
>
>
> --
>
> Thanks & Regards,
> Dipanjan
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170615/cbe5005d/attachment.html>


More information about the llvm-dev mailing list