stdlib: Do not use GLIBC_PRIVATE ABI for errno in libc_nonshared.a
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
warning
|
Patch is already merged
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
warning
|
Patch is already merged
|
Commit Message
Using TLS directly introduces a GLIBC_PRIVATE ABI dependency
into libc_nonshared.a, and thus indirectly into applications.
Adding the !defined LIBC_NONSHARED condition deactivates direct
TLS access, and libc_nonshared.a code switches to using
__errno_location, like application code.
Currently, this has no effect because there is no code in
libc_nonshared.a that accesses errno.
---
include/errno.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: 1b171c942ea066c08a1e5aefb977e35da08ed291
Comments
On 9/6/24 5:18 AM, Florian Weimer wrote:
> Using TLS directly introduces a GLIBC_PRIVATE ABI dependency
> into libc_nonshared.a, and thus indirectly into applications.
Yes, we should avoid that.
> Adding the !defined LIBC_NONSHARED condition deactivates direct
> TLS access, and libc_nonshared.a code switches to using
> __errno_location, like application code.
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> Currently, this has no effect because there is no code in
> libc_nonshared.a that accesses errno.
>
> ---
> include/errno.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/errno.h b/include/errno.h
> index c361a785c2..f0ccaa74dd 100644
> --- a/include/errno.h
> +++ b/include/errno.h
> @@ -20,7 +20,7 @@
> # define errno rtld_errno
> extern int rtld_errno attribute_hidden;
>
> -# elif IS_IN_LIB && !IS_IN (rtld)
> +# elif IS_IN_LIB && !IS_IN (rtld) && !defined LIBC_NONSHARED
OK. That works. There area couple of ways to organize this, but this
way avoids defining the direct access to errno.
OK. The stdlib/errno.h definition prevails here.
OK. Reviewed all other errno.h for similar constructs but we're clean,
except for this internal view you're fixing.
>
> # undef errno
> # if IS_IN (libc)
>
> base-commit: 1b171c942ea066c08a1e5aefb977e35da08ed291
>
@@ -20,7 +20,7 @@
# define errno rtld_errno
extern int rtld_errno attribute_hidden;
-# elif IS_IN_LIB && !IS_IN (rtld)
+# elif IS_IN_LIB && !IS_IN (rtld) && !defined LIBC_NONSHARED
# undef errno
# if IS_IN (libc)