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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev

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

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev

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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Loading...