rtems assembler

suyash singh suyashsingh234 at gmail.com
Sat May 2 06:02:35 UTC 2020


Ok I think I found a solution.

use -integrated-as with clang

clang is using the system assembler(usr/bin/as) instead of the llvm
assembler(llvm-as)

It's still not working but at least assembler command failed error is gone

On Thu, Apr 30, 2020 at 9:36 PM Hesham Almatary <heshamelmatary at gmail.com>
wrote:

>
>
> On Thu, 30 Apr 2020 at 15:56, suyash singh <suyashsingh234 at gmail.com>
> wrote:
>
>> after adding -v
>> https://hastebin.com/epijunegix.coffeescript
>>
>> with sparc-unknown-elf
>> https://hastebin.com/ijohidofus.coffeescript
>>
>> (target getting an extra unknown for some reason)
>>
>> riscv64-unknown-elf
>> https://hastebin.com/jirusidoti.sql
>>  different error: unknown register name (maybe because erc32 bsp with
>> riscv)
>>
> Yes, you need to run that on an RTEMS riscv BSP and not sparc sources
>
>
>>
>> On Thu, Apr 30, 2020 at 8:08 PM Hesham Almatary <heshamelmatary at gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Thu, 30 Apr 2020 at 15:21, suyash singh <suyashsingh234 at gmail.com>
>>> wrote:
>>>
>>>> I think it doesn't support sparc backend although it does not give
>>>> unknown target error.
>>>>
>>>> I compiled this c program with
>>>> export PATH=$HOME/quick-start/rtems/5/bin:"$PATH"
>>>>  clang -target sparc-unknown-rtems5 test1.c
>>>>
>>> Can you add -v to that command and post the output? Also try with
>>> sparc-unknown-elf. Last thing to try is to do the same for
>>> riscv64-unknown-elf
>>>
>>>>
>>>> *test1.c*
>>>> int main(int argc, char **argv) {
>>>>   int k = 0x7fffffff;
>>>>   k += argc;
>>>>   return 0;
>>>> }
>>>>
>>>> same error
>>>> /usr/bin/as: unrecognized option '-Av8'
>>>> clang-11: error: assembler command failed with exit code 1
>>>>
>>>> If i write
>>>> clang -target hello test1.c
>>>> error: unknown target triple 'hello', please use -triple or -arch
>>>>
>>>> So I guess it is detecting sparc but not working with it
>>>>
>>>> On Thu, Apr 30, 2020 at 7:07 PM Hesham Almatary <
>>>> heshamelmatary at gmail.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Thu, 30 Apr 2020 at 14:18, suyash singh <suyashsingh234 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> I am using ubuntu 18.04 terminal
>>>>>>
>>>>>> Here's the python script I wrote to find all include files and run
>>>>>> clang -fsanitize
>>>>>>
>>>>>> # run with python3 in terminal
>>>>>>
>>>>>> import subprocess
>>>>>> import os
>>>>>>
>>>>>> relativedir="../bsps/sparc/erc32/btimer"
>>>>>> directory=os.path.join(os.getcwd(),"../")
>>>>>> file="btimer.c"
>>>>>> root_dir="ubsan"
>>>>>>
>>>>>> arr=['clang','-target','sparc','-
>>>>>>
>>>>> target needs to be sparc-unknown-rtems5 to pick up the correct tools.
>>>>> Does your clang support sparc backend? Can you try to compile and link some
>>>>> simple C program with it?
>>>>>
>>>>>
>>>>>> fsanitize=undefined',"-I../../../../../../rtems/5/sparc-rtems5/erc32/lib/include","-I../../../../../../rtems/5/sparc-rtems5/include/"]
>>>>>>
>>>>>> for path, subdirs, files in os.walk(directory):
>>>>>>         for subdir in subdirs:
>>>>>>             if(subdir=="include"):
>>>>>>                 includepath=os.path.join(path,subdir)
>>>>>>                 idx=includepath.find("..")
>>>>>>                 arr.append("-I../../../../"+includepath[idx+3:])
>>>>>> arr.append(file)
>>>>>> subprocess.run(arr,cwd=relativedir, stdout=subprocess.PIPE)
>>>>>> #result=subprocess.run(['./a.out'],cwd=relativedir,
>>>>>> stdout=subprocess.PIPE)
>>>>>>
>>>>>> On Thu, Apr 30, 2020 at 6:44 PM Hesham Almatary <
>>>>>> heshamelmatary at gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Thu, 30 Apr 2020 at 13:51, Joel Sherrill <joel at rtems.org> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Apr 30, 2020 at 7:34 AM suyash singh <
>>>>>>>> suyashsingh234 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>> I was running clang UBSan on
>>>>>>>>> bsps/sparc/erc32/btimer/btimer.c
>>>>>>>>>
>>>>>>>>> and got error
>>>>>>>>>
>>>>>>>>> /usr/bin/as: unrecognized option '-Av8'
>>>>>>>>> clang-11: error: assembler command failed with exit code 1
>>>>>>>>>
>>>>>>>>> I am not sure but is it because clang is using wrong assembler?
>>>>>>>>>
>>>>>>>>
>>>>>>>> I haven't seen anyone run into this in a long time. :)
>>>>>>>>
>>>>>>>> In this case, it is likely one of two things:
>>>>>>>>
>>>>>>>> + Look at your $PATH. Make sure the RTEMS tools are first.
>>>>>>>>
>>>>>>>> + But in your case, I expect that it is because the clang didn't
>>>>>>>> know (somehow) to put the target name in front of the as.
>>>>>>>> Did you invoke it for sparc-rtems5? If so, then there is a
>>>>>>>> path through clang where it isn't looking at the target name.
>>>>>>>>
>>>>>>> That’s likely to be the problem. I expect Suyash isn’t cross
>>>>>>> compiling with clang.
>>>>>>>
>>>>>>>
>>>>>>>> I also double checked the as manual to ensure -Av8 was in
>>>>>>>> fact a sparc option.
>>>>>>>>
>>>>>>>> --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
>>>>>>>
>>>>>>> --
>>>>>>> Hesham
>>>>>>> _______________________________________________
>>>>>>> devel mailing list
>>>>>>> devel at rtems.org
>>>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>>>
>>>>>> --
>>>>> Hesham
>>>>>
>>>> --
>>> Hesham
>>>
>> --
> Hesham
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200502/1845cc7c/attachment-0001.html>


More information about the devel mailing list