about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-12 16:22:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-12 16:22:51 +0000
commit5a6fa4d7ed465c2f7da9d73004c972519dc2100e (patch)
treecefc8c3b17e8e57731afe93278c12a0d5137bae0 /include
parent2581b98ecb1f2b3669a4b88a605f763fa4e85ee6 (diff)
downloadglibc-5a6fa4d7ed465c2f7da9d73004c972519dc2100e.tar.gz
glibc-5a6fa4d7ed465c2f7da9d73004c972519dc2100e.tar.xz
glibc-5a6fa4d7ed465c2f7da9d73004c972519dc2100e.zip
Fix tzfile.c namespace (bug 17583).
tzfile.c is brought in by various ISO C functions, but calls fileno,
fread_unlocked and ftello, which are not ISO C functions.  This patch
adds names __fileno, __fread_unlocked and __ftello for those
functions, making tzfile.c use those new names.

Note: there are various uses of fileno elsewhere in glibc that I
didn't change, although it may turn out that some of those also need
to use __fileno.

Tested for x86_64 with the glibc testsuite.  Changed line numbers in
tzfile.c cause changes in assertions, and for some reason this ends up
with different instruction choice and register allocation, affecting
the size of __tzfile_read and so making comparison of disassembly for
libc.so problematic.

	[BZ #17583]
	* libio/fileno.c (fileno): Rename to __fileno and define as weak
	alias of __fileno.  Use libc_hidden_weak.
	(__fileno): Use libc_hidden_def.
	[weak_alias] (fileno_unlocked): Define as weak alias of __fileno.
	* libio/ftello.c (ftello): Rename to __ftello and define as weak
	alias of __ftello.
	[__OFF_T_MATCHES_OFF64_T] (ftello64): Define as weak alias of
	__ftello.
	* libio/iofread.c [weak_alias && !_IO_MTSAFE_IO]
	(__fread_unlocked): Define as strong alias of _IO_fread.  Use
	libc_hidden_def.
	(fread_unlocked): Don't use libc_hidden_ver.
	* libio/iofread_u.c (fread_unlocked): Rename to __fread_unlocked
	and define as weak alias of __fread_unlocked.  Don't use
	libc_hidden_def.
	(__fread_unlocked): Use libc_hidden_def.
	* include/stdio.h (__fileno): Declare.  Use libc_hidden_proto.
	(ftello): Don't use libc_hidden_proto.
	(__ftello): Declare.  Use libc_hidden_proto.
	(fread_unlocked): Don't use libc_hidden_proto.
	(__fread_unlocked): Declare.  Use libc_hidden_proto.
	* time/tzfile.c (__tzfile_read): Use __fileno, __fread_unlocked
	and __ftello instead of fileno, fread_unlocked and ftello.
Diffstat (limited to 'include')
-rw-r--r--include/stdio.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 9f2ea31bc9..f6c0a77b3c 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -143,12 +143,16 @@ libc_hidden_proto (perror)
 libc_hidden_proto (remove)
 libc_hidden_proto (rewind)
 libc_hidden_proto (fileno)
+extern __typeof (fileno) __fileno;
+libc_hidden_proto (__fileno)
 libc_hidden_proto (fwrite)
 libc_hidden_proto (fseek)
-libc_hidden_proto (ftello)
+extern __typeof (ftello) __ftello;
+libc_hidden_proto (__ftello)
 libc_hidden_proto (fflush)
 libc_hidden_proto (fflush_unlocked)
-libc_hidden_proto (fread_unlocked)
+extern __typeof (fread_unlocked) __fread_unlocked;
+libc_hidden_proto (__fread_unlocked)
 libc_hidden_proto (fwrite_unlocked)
 libc_hidden_proto (fgets_unlocked)
 libc_hidden_proto (fputs_unlocked)