Undefined reference to `__sync_bool_compare_and_swap_4' for some Leon configurations with gfortran

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Mar 1 06:47:28 UTC 2017



On 28/02/17 15:27, Jan.Sommer at dlr.de wrote:
>
>> -----Ursprüngliche Nachricht-----
>> Von: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
>> Gesendet: Montag, 27. Februar 2017 15:25
>> An: Sommer, Jan; devel at rtems.org
>> Betreff: Re: AW: AW: AW: Undefined reference to
>> `__sync_bool_compare_and_swap_4' for some Leon configurations with
>> gfortran
>>
>>
>>
>> On 27/02/17 15:15, Jan.Sommer at dlr.de wrote:
>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
>>>>> Gesendet: Montag, 27. Februar 2017 15:11
>>>>> An: Sommer, Jan;devel at rtems.org
>>>>> Betreff: Re: AW: AW: Undefined reference to
>>>>> `__sync_bool_compare_and_swap_4' for some Leon configurations with
>>>>> gfortran
>>>>>
>>>>> On 27/02/17 15:08,Jan.Sommer at dlr.de  wrote:
>>>>>>> Ok, thanks for the clarification.
>>>>>>> I will try to create a patch for gcc and put rtems CC for the discussion.
>>>>> Another option would be to provide the __sync_() stuff also via libatomic.
>>>>>
>>> True. I will ask on the gcc mailinglist what they would prefer.
>>>
>> This __sync_() stuff seems to be used in several places in GCC. So, changing
>> libbacktrace is probably not enough. We need a general solution for the
>> __sync_() builtins on RTEMS. I don't think GCC can be changed to emit
>> __atomic_() calls for the __sync_() builtins (I would still try to ask). The libgcc or
>> libatomic is probably a good place to add them for RTEMS as functions
>> implemented via __atomic_() builtins.
>>
> I updated the __sync-check of libbacktrace and now the undefined references are gone and my test program compiles.
> If there are no objections I would try to push something like the attached patch upstream. Do you have any suggestions to which branches?
> I thought about trunk and the gcc-6 branch or do we need further backports for older RTEMS versions?

I don't think this is the way to go. Firstly, this is certainly not a 
SPARC-specific problem. Secondly, RTEMS is multi-threaded, are you sure 
you can simply disable this feature? RTEMS supports C11 atomic 
operations which includes libatomic support. However, we lack the 
__sync_* builtin support on targets without atomic operations in 
hardware. This is the problem we should fix. We should provide these 
functions either in libgcc or in libatomic.

One open question is why is there a libbacktrace dependency in 
libgfortran? Does this add any value to embedded targets?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list