[m-rev.] for review: Don't use __builtin_setjmp, __builtin_longjmp on AArch64.

Julien Fischer jfischer at opturion.com
Thu May 26 15:00:28 AEST 2022



On Thu, 26 May 2022, Peter Wang wrote:

> On Wed, 25 May 2022 18:52:22 +1000 Julien Fischer <jfischer at opturion.com> wrote:
>>
>> Hi Peter,
>>
>> On Wed, 25 May 2022, Peter Wang wrote:
>>
>>> There is an issue on Linux/aarch64/glibc where a commit performed on a
>>> thread using the gcc __builtin_longjmp function causes an assertion
>>> failure in pthread_create() if the Mercury runtime is dynamically
>>> linked:
>>>
>>>    pthread_create.c:430: start_thread: Assertion `freesize < pd->stackblock_size' failed.
>>>
>>> or a crash if the Mercury runtime is statically linked:
>>>
>>>    *** Mercury runtime: caught segmentation violation ***
>>>    cause: address not mapped to object
>>>
>>> Tested using gcc version 6.3.0 20170516 (Debian 6.3.0-18)
>>
>> Are you in a position to test it with other versions?
>
> Yes. The problem also occurs with gcc 8.3.0, but not gcc 10.2.
> I have updated the patch accordingly.
>
>>> diff --git a/runtime/mercury.h b/runtime/mercury.h
>>> index 699dc9712..748e38906 100644
>>> --- a/runtime/mercury.h
>>> +++ b/runtime/mercury.h
>>

>> That looks fine otherwise; I assume I should apply this one to the
>> release branch as well?
>
> Yes, thanks.
>
> The updated patch follows (for review).

That's fine.

Julien.


More information about the reviews mailing list