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] For BZ #17328, mark __errno_location with __attribute__((returns_nonnull)) for gcc >=4.9.0


On 03/02/2015 11:46 PM, Roland McGrath wrote:

> Something that we could consider as a middle road is exporting errno with a
> proper symbol version (it's currently GLIBC_PRIVATE, which nothing residing
> outside the libc source tree should ever use) and then having errno.h do:
> 
> 	extern __thread int errno;

Can we make the TLS offset part of the ABI instead and somehow teach GCC
about it?  Then there would at least be an unquestionable improvement.

Right now, we have (in PIC code):

	call	__errno_location@PLT
	movl	(%rax), %eax

This turns into:

	data32
	leaq	errcode@tlsgd(%rip), %rdi
	data32
	data32
	rex64
	call	__tls_get_addr@PLT
	movl	(%rax), %eax

errno is mostly used on error paths, so this just bloats the code and is
probably even slower, too.

-- 
Florian Weimer / Red Hat Product Security


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