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

Dipanjan Das via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 14 17:00:01 PDT 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170614/c95c74cd/attachment.html>


More information about the llvm-dev mailing list