rtems assembler

suyash singh suyashsingh234 at gmail.com
Thu Apr 30 14:20:25 UTC 2020


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

*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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200430/b0e95152/attachment.html>


More information about the devel mailing list