This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 05/10] Remove __need macros from errno.h (__need_Emath, __need_error_t).


On 05/10/2017 01:47 PM, Joseph Myers wrote:
On Wed, 10 May 2017, Florian Weimer wrote:

On 05/09/2017 11:38 PM, Joseph Myers wrote:
On Tue, 9 May 2017, Zack Weinberg wrote:

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 74f9a49b05..075c996f28 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -326,6 +326,13 @@
   # define __attribute_artificial__ /* Ignore */
   #endif
   +/* Force use of the initial-exec TLS model.  */
+#if __GNUC_PREREQ (3,3)
+# define __attribute_tls_model_ie__ __attribute__ ((tls_model
("initial-exec")))

This is not namespace-clean for an installed header (needs to be
__tls_model__).

The larger problem is that we need to error out if __GLIBC_USE (TLS_ERRNO) and
the compiler does not support the initial-exec TLS model because it cannot
produce the required ABI for the errno symbol.

You don't need initial-exec TLS for errno.  If a port wishes to export TLS
errno directly, it's perfectly valid for the headers to do

extern _Thread_local int errno;
#define errno errno

with any C11 compiler, and if the compiler only supports GD model TLS,
that's fine for accessing an IE variable (it may or may not get optimized
to IE by the linker).  Declaring the TLS model is simply an optimization.

That's true if we want to create a port which is effectively C11-only. (The NaCl header generator uses __thread, though, so it's still non-standard.)

However, I still think that the NaCl port should be aligned with the rest of glibc in this regard, and that Zack's cleanup should not introduce a new extension point for it. Particularly since we don't have a working port right now which would exercise this functionality, so it's likely to be broken anyway.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]