[cfe-users] clang sparc: generated .o file incompatible with elf64-x86-64

suyash singh via cfe-users cfe-users at lists.llvm.org
Mon May 4 05:15:28 PDT 2020

I am trying to cross compile with clang and run Undefined Behavior
Sanitizer for .c file

*Command I am running*

clang -target sparc -integrated-as -fuse-ld=lld -fsanitize=undefined test1.c

clang is the cross compiler

sparc is the target architecture.

-integrated-as to use the llvm assembler

-fuse-ld=lld to use lld linker

-fsanitize=undefined to run UBSan


ld.lld: error: /tmp/test1-43c7c0.o is incompatible with elf64-x86-64

collect2: error: ld returned 1 exit status

clang-11: error: linker (via gcc) command failed with exit code 1 (use -v
to see invocation)

*My system*

Ubuntu 18.04


command executed on ubuntu terminal

without -target sparc on a file.c which does not contain sparc assembly the
clang works fine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200504/575fc3f5/attachment.html>

More information about the cfe-users mailing list