This is an archive of the discontinued LLVM Phabricator instance.

[libc] Make the errno macro resolve to the thread local variable directly.
ClosedPublic

Authored by sivachandra on Mar 3 2022, 10:21 AM.

Details

Summary

With modern architectures having a thread pointer and language supporting
thread locals, there is no reason to use a function intermediary to access
the thread local errno value.

The entrypoint corresponding to errno has been replaced with an object
library as there is no formal entrypoint for errno anymore.

Diff Detail

Event Timeline

sivachandra created this revision.Mar 3 2022, 10:21 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 3 2022, 10:21 AM
sivachandra requested review of this revision.Mar 3 2022, 10:21 AM
michaelrj accepted this revision.Mar 3 2022, 1:15 PM
michaelrj added a subscriber: michaelrj.

LGTM

This revision is now accepted and ready to land.Mar 3 2022, 1:15 PM
jeffbailey accepted this revision.Mar 3 2022, 10:28 PM

I spent a bit of time just trying to think of if there's a more straightforward way to do the dummy_errno. Something like a base library of support services to gloss over which libc it's built against. I couldn't think of any (and it would be outside the scope of this CL).

libc/src/errno/CMakeLists.txt