[PATCH 3/4] powerpc: Runtime selection between sc and scv for syscalls
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Dec 1 13:35:55 GMT 2020
On 01/12/2020 10:11, Florian Weimer via Libc-alpha wrote:
> * Matheus Castanho via Libc-alpha:
>
>> Hi Florian,
>>
>> On 11/19/20 5:35 PM, Florian Weimer wrote:
>>> * Matheus Castanho:
>>>
>>>> That should work for shared libc, but in the static case we may also
>>>> hit the same problem: trying to access the TLS to read hwcap2 before
>>>> it has been initialized, but this time in csu/libc-tls.c
>>>
>>> Ahh.
>>>
>>>> Is there a way to also check if we are in the static startup code at
>>>> compile time? If not, I'm afraid I'll have to keep the check for the
>>>> thread pointer.
>>>
>>> Is the thread pointer in a regular register? Then you could install a
>>> fake TCB early on that has a zero bit in the right place.
>>>
>>> The other option would be to always use the old interface for !SHARED.
>>> Just saying. 8-)
>>>
>>
>> I believe adding the fake TCB is a bit out of the scope of this patch, and I'd
>> also prefer to keep the same behavior for both static and shared libcs, so we
>> avoid surprises in the future.
>>
>> Do you see this as a blocker for merging this patch?
>
> I think the run-time check in the shared builds is unnecessary. I don't
> have an opinion on the static case, but I think ld.so should use the
> legacy interface unconditionally, and shared libc.so should use a
> dynamic check while assuming that the TCB is initialized. If we can
> avoid making things harder for the branch predict, we should do so.
I agree, for static case it might be more complicate to disentangle the
loader code so the check might be required.
>
> In the end, it's your port though, and I don't have a strong opinion
> here.
>
> Thanks,
> Florian
>
More information about the Libc-alpha
mailing list