more patches more newlib-1.16.0 : setjmp & longjmp for 4.9 branch

Ralf Corsepius ralf.corsepius at rtems.org
Tue Mar 3 02:57:11 UTC 2009


Joel Sherrill wrote:
> Kate Feng wrote:
>> Ralf Corsepius wrote:
>>   
>>> Kate Feng wrote:
>>>     
>>>> Hi,
>>>>
>>>> Attached is the patches for newlib-1.16.0.  The setjmp() and longjmp()
>>>> are broken, which could affect their function in the 4.9. branch.
>>>> The patch for the setjmp.S is only for powerPC port, which was tested
>>>> for my applications.  The path for the setjmp.h should be applied to
>>>> all platforms.
>>>>       
>>> Some questions:
>>>
>>> * Which bug is this patch supposed to fix?
>>> Please elaborate.
>>>
>>> * Whatever you are trying to fix, is almost certainly not RTEMS 
>>> specific but architecture specific
>>> => Your use of  __rtems__ is not the "right way" to do it.
>>>
>>>     
> I think I remember this patch and there was some reason
> you needed to know you were in supervisor mode in the
> environment to do it.  That's what the __rtems__ was for.
Without knowing the cause, I don't see any reason of applying this patch.

> I don't recall what the purpose of the patch is though
>> The machine/powerpc/setjmp.S file is probably only linked to powerPC port.
No. This file is shared with other powerpc targets in newlib.

>> Thus, it's  probably OK.  However, setjmp() , when called, will trigger 
>> the error
>> message of :
>> "In BSP_exceptionHandler()
>> Uhuuuh, Exception 10 in unknown task???".
>> Using  sigsetjmp(buf, 1) did not solve the problem.  Thus,
>> I simply apply the patch from the newlib1.15.0, which I used for the
>> RTEMS4.8.0.  Perhaps, it was implemented wrongly in 4.8 , instead ?
>>
>> I agree with you that the patch fixes the problem, but ties its function 
>> to architecture
>> specific.  At this point, I do remember reading about that 'setjmp' and 
>> 'longjmp'
>> should be used carefully that there are  other more graceful ways to 
>> handle it.
>> This is my memory from last century that I guess I would have to dig 
>> into for
>> the more elegant solution........
>>
>> Thanks a lot for your pointer.  Perhaps, it is better not to apply the 
>> patch so that
>> it does not add architecture specific patch......  Please advise.
My point is: machine/powerpc/setjmp.S is not RTEMS specific, but a file 
which is shared between all newlib powerpc targets.

So, we need to exactly know which issue it is your patch tries to work 
around and under which conditions the changes your patch implements are 
needed.

The condition hardly is "#if __rtems__", but is something else.

Ralf





More information about the users mailing list