[llvm-dev] Compiling program with dfsan at IR

Peter Collingbourne via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 3 03:43:36 PDT 2017


Try passing -relocation-model=pic at step 4.

Peter

On Sat, Jun 3, 2017 at 2:19 AM, Archa . <archa91 at gmail.com> wrote:

> I tried running step 5 with clang -fsanitize=dataflow instead of gcc but
> it gave the following error:
>
> relocation R_X86_64_32 against `desc' can not be used when making a shared
> object; recompile with -fPIC
> error adding symbols: Bad value
> clang-5.0: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> So I also tried adding -fPIC option at step 1 when converting .c program
> to .bc and still results in same error. Is there anything else I may be
> missing here.
>
> Thanks
>
>
>
> On Fri, Jun 2, 2017 at 9:25 PM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
>
>> Programs compiled with dfsan require a runtime library in order to work
>> correctly. You will need to link your program with "clang
>> -fsanitize=dataflow".
>>
>> Peter
>>
>> On Fri, Jun 2, 2017 at 12:46 AM, Archa . via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Hi,
>>>
>>> I am trying to instrument a small program with dfsan at IR and then
>>> compile it. But I end up with undefined reference errors.
>>>
>>> Steps taken:
>>> 1.Convert toy program to .bc
>>> 2. IR pass to insert dfsan calls
>>> 3.opt -dfsan on resultant bitcode from step 2
>>> 4. llc step3.bc -o step4.s
>>> 5. gcc step.s -o step5.o
>>>
>>> I get error  "undefined reference to `__dfsan_arg_tls' " and so forth
>>> for all functions defined.
>>> Is there something I am missing or doing wrong in my steps.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>>
>>
>>
>> --
>> --
>> Peter
>>
>
>


-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170603/f9f53940/attachment.html>


More information about the llvm-dev mailing list