<div dir="ltr"><div><br></div>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.<div><br></div><div>=========================================</div><div><br></div><div><div>#include <sanitizer/dfsan_interface.h></div><div>#include <assert.h></div><div><br></div><div>int main(void) {</div><div> int i = 1;</div><div> </div><div> dfsan_label i_label = dfsan_create_label("i", 0);</div><div> dfsan_set_label(i_label, &i, sizeof(i));</div><div><br></div><div> return 0;</div><div>}</div><div><br></div><div>=========================================<br></div><div><br></div><div>clang -c -emit-llvm -fsanitize=dataflow test.c -o test.bc<br></div><div><br></div><div><div>clang -fsanitize=dataflow test2.bc -o test2</div><div><br></div><div>/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o: In function `_start': </div><div>(.text+0x20): undefined reference to `main' </div><div>/tmp/test2-c642ef.o: In function `dfs$main': </div><div>test2.bc:(.text+0x96): undefined reference to `dfs$dfsan_create_label' </div><div>test2.bc:(.text+0xeb): undefined reference to `dfs$dfsan_set_label' </div><div>/tmp/test2-c642ef.o: In function `dfs$dfsw$dfsan_create_label': </div><div>test2.bc:(.text+0x16e): undefined reference to `dfs$dfsan_create_label' </div><div>/tmp/test2-c642ef.o: In function `dfs$dfsw$dfsan_set_label': </div><div>test2.bc:(.text+0x1e4): undefined reference to `dfs$dfsan_set_label' </div><div>clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)</div></div><div><br></div><div>=========================================<br></div><div><br></div><div>Any idea what might I be doing wrong?</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div></div>