<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>==============================<wbr>===========</div><div><br></div><div><div style="font-size:12.8px">#include <sanitizer/dfsan_interface.h></div><div style="font-size:12.8px">#include <assert.h></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">int main(void) {</div><div style="font-size:12.8px">  int i = 1;</div><div style="font-size:12.8px">  </div><div style="font-size:12.8px">  dfsan_label i_label = dfsan_create_label("i", 0);</div><div style="font-size:12.8px">  dfsan_set_label(i_label, &i, sizeof(i));</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">  return 0;</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">==============================<wbr>===========<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">clang -c -emit-llvm -fsanitize=dataflow test.c -o test.bc<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>clang -fsanitize=dataflow test2.bc -o test2</div><div><br></div><div>/usr/lib/gcc/x86_64-linux-gnu/<wbr>5.4.0/../../../x86_64-linux-<wbr>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 style="font-size:12.8px"><br></div><div style="font-size:12.8px">==============================<wbr>===========<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Any idea what might I be doing wrong?</div><div class="gmail-yj6qo gmail-ajU" style="margin:2px 0px 0px;font-size:12.8px"></div></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>