clang sparc: generated .o file incompatible with elf64-x86-64
Hesham Almatary
hesham.almatary at cl.cam.ac.uk
Mon May 4 12:56:30 UTC 2020
Have you seen that?
https://stackoverflow.com/questions/19118854/unable-to-cross-compile-to-sparc-using-clang
I’m not sure sparc backend is well supported by clang/llvm. Try with riscv.
On Mon, 4 May 2020 at 13:34, Hesham Almatary <hesham.almatary at cl.cam.ac.uk>
wrote:
>
>
> On Mon, 4 May 2020 at 13:19, Joel Sherrill <joel at rtems.org> wrote:
>
>>
>>
>> On Mon, May 4, 2020, 7:16 AM suyash singh <suyashsingh234 at gmail.com>
>> wrote:
>>
>>> 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
>>>
>>> *Error*
>>>
>>> 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
>>>
>>> x86_64
>>>
>>> command executed on ubuntu terminal
>>>
>>> without -target sparc on a file.c which does not contain sparc assembly
>>> the clang works fine
>>>
>>
>> This is the same problem you had with as. You need to properly specify
>> the target and have the target as and ld in your PATH.
>>
>
> Also can you add -v and send the output?
>
>>
>> --joel
>>
>>> _______________________________________________
>>> devel mailing list
>>> devel at rtems.org
>>> http://lists.rtems.org/mailman/listinfo/devel
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200504/c21278da/attachment-0001.html>
More information about the devel
mailing list