diff mbox

Remove __libc_creat function name

Message ID Pine.LNX.4.64.1410281815170.23740@digraph.polyomino.org.uk
State Committed
Headers show

Commit Message

Joseph Myers Oct. 28, 2014, 6:17 p.m. UTC
glibc has lots of __libc_* function names that no longer serve any
purpose (are not used for any calls or exported at a public symbol
version).  This patch removes __libc_creat.  It has the effect of
creat becoming a strong symbol instead of a weak symbol in various
cases, but that's fine; in shared libraries it doesn't matter at all,
while for static linking the only other symbol sometimes defined in
the same object is creat64, and whenever creat64 is a reserved name so
is creat.

Other such cases of unnecessary __libc_* symbols are expected to be
dealt with in separate patches over time.

Tested for x86_64 (testsuite, and that the disassembly of installed
shared libraries is unchanged by the patch).

2014-10-28  Joseph Myers  <joseph@codesourcery.com>

	* include/fcntl.h (__libc_creat): Remove declaration.
	* io/creat.c (__libc_creat): Rename to creat.
	(creat): Do not define as alias.
	* sysdeps/unix/sysv/linux/alpha/creat.c (creat64): Define as alias
	of creat instead of __libc_creat.
	* sysdeps/unix/sysv/linux/generic/creat.c (__libc_creat): Rename
	to creat.
	(creat): Do not define as alias.
	[__WORDSIZE == 64] (creat64): Define as alias of creat instead of
	* sysdeps/unix/sysv/linux/syscalls.list (creat): Do not define
	__libc_creat name.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (creat):


Roland McGrath Oct. 30, 2014, 5:58 p.m. UTC | #1
diff mbox


diff --git a/include/fcntl.h b/include/fcntl.h
index a636f38..de23728 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -8,7 +8,6 @@  libc_hidden_proto (__open64)
 extern int __libc_open64 (const char *file, int oflag, ...);
 extern int __libc_open (const char *file, int oflag, ...);
 libc_hidden_proto (__libc_open)
-extern int __libc_creat (const char *file, mode_t mode);
 extern int __libc_fcntl (int fd, int cmd, ...);
 extern int __fcntl_nocancel (int fd, int cmd, ...) attribute_hidden;
diff --git a/io/creat.c b/io/creat.c
index 0ff524c..49c2085 100644
--- a/io/creat.c
+++ b/io/creat.c
@@ -23,13 +23,12 @@ 
 /* Create FILE with protections MODE.  */
-__libc_creat (file, mode)
+creat (file, mode)
      const char *file;
      mode_t mode;
   return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
-weak_alias (__libc_creat, creat)
 /* __open handles cancellation.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/creat.c b/sysdeps/unix/sysv/linux/alpha/creat.c
index 9e661ba..7a5afed 100644
--- a/sysdeps/unix/sysv/linux/alpha/creat.c
+++ b/sysdeps/unix/sysv/linux/alpha/creat.c
@@ -5,4 +5,4 @@ 
    could have overridden that with a create64.c, but we might as well do
    the right thing and set up creat64 as an alias.  */
 #include <io/creat.c>
-weak_alias(__libc_creat, creat64)
+weak_alias(creat, creat64)
diff --git a/sysdeps/unix/sysv/linux/generic/creat.c b/sysdeps/unix/sysv/linux/generic/creat.c
index f5d0460..d74719b 100644
--- a/sysdeps/unix/sysv/linux/generic/creat.c
+++ b/sysdeps/unix/sysv/linux/generic/creat.c
@@ -24,15 +24,14 @@ 
 /* Create FILE with protections MODE.  */
-__libc_creat (const char *file, mode_t mode)
+creat (const char *file, mode_t mode)
   return __open (file, O_WRONLY | O_CREAT | O_TRUNC, mode);
-weak_alias (__libc_creat, creat)
 /* __open handles cancellation.  */
 #if __WORDSIZE == 64
-weak_alias (__libc_creat, creat64)
+weak_alias (creat, creat64)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index a0b8de8..a9e5c7b 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -6,7 +6,7 @@  bdflush		EXTRA	bdflush		i:ii	bdflush
 capget		EXTRA	capget		i:pp	capget
 capset		EXTRA	capset		i:pp	capset
 clock_adjtime	EXTRA	clock_adjtime	i:ip	clock_adjtime
-creat		-	creat		Ci:si	__libc_creat creat
+creat		-	creat		Ci:si	creat
 create_module	EXTRA	create_module	3	create_module
 delete_module	EXTRA	delete_module	3	delete_module
 epoll_create	EXTRA	epoll_create	i:i	epoll_create
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 74732ab..77aa246 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -15,7 +15,7 @@  setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit setrlimit64
 readahead	-	readahead	i:iii	__readahead	readahead
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 sync_file_range	-	sync_file_range	Ci:iiii	sync_file_range
-creat		-	creat		Ci:si	__libc_creat	creat creat64
+creat		-	creat		Ci:si	creat		creat64
 open		-	open		Ci:siv	__libc_open	__open open __open64 open64
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64