about summary refs log tree commit diff
path: root/include/stdlib.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-01 14:34:18 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-01 14:34:54 -0700
commit8ed3b64330cd24e2a17d8794a871cab034707a33 (patch)
treec0866d5ce8606469bddba2cf06a430c9c4145aaa /include/stdlib.h
parentef9b6f73f45a46d079018f63e2d9184eaa0db1d5 (diff)
downloadglibc-8ed3b64330cd24e2a17d8794a871cab034707a33.tar.gz
glibc-8ed3b64330cd24e2a17d8794a871cab034707a33.tar.xz
glibc-8ed3b64330cd24e2a17d8794a871cab034707a33.zip
Mark internal stdlib functions with attribute_hidden [BZ #18822]
Mark internal stdlib functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.  __realpath
is hidden with libc_hidden_proto and libc_hidden_def since the exported
realpath is an alias of __realpath.

	[BZ #18822]
	* include/stdlib.h (__random): Add attribute_hidden.
	(__random_r): Likewise.
	(__srandom_r): Likewise.
	(__initstate_r): Likewise.
	(__setstate_r): Likewise.
	(__erand48_r): Likewise.
	(__nrand48_r): Likewise.
	(__jrand48_r): Likewise.
	(__srand48_r): Likewise.
	(__seed48_r): Likewise.
	(__lcong48_r): Likewise.
	(__drand48_iterate): Likewise.
	(__setenv): Likewise.
	(__unsetenv): Likewise.
	(__clearenv): Likewise.
	(__ptsname_r): Likewise.
	(__posix_openpt): Likewise.
	(__add_to_environ): Likewise.
	(__realpath): Add libc_hidden_proto.
	(__ecvt_r): Likewise.
	(__fcvt_r): Likewise.
	(__qecvt_r): Likewise.
	(__qfcvt_r): Likewise.
	* misc/efgcvt_r.c (cvt_symbol_1): Add libc_hidden_def (local).
	* stdlib/canonicalize.c (__realpath): Add libc_hidden_def.
Diffstat (limited to 'include/stdlib.h')
-rw-r--r--include/stdlib.h51
1 files changed, 32 insertions, 19 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 2274790a2e..c0fcb95777 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -36,56 +36,65 @@ libc_hidden_proto (__qsort_r)
 libc_hidden_proto (lrand48_r)
 libc_hidden_proto (wctomb)
 
-extern long int __random (void);
+extern long int __random (void) attribute_hidden;
 extern void __srandom (unsigned int __seed);
 extern char *__initstate (unsigned int __seed, char *__statebuf,
 			  size_t __statelen);
 extern char *__setstate (char *__statebuf);
-extern int __random_r (struct random_data *__buf, int32_t *__result);
-extern int __srandom_r (unsigned int __seed, struct random_data *__buf);
+extern int __random_r (struct random_data *__buf, int32_t *__result)
+     attribute_hidden;
+extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
+     attribute_hidden;
 extern int __initstate_r (unsigned int __seed, char *__statebuf,
-			  size_t __statelen, struct random_data *__buf);
-extern int __setstate_r (char *__statebuf, struct random_data *__buf);
+			  size_t __statelen, struct random_data *__buf)
+     attribute_hidden;
+extern int __setstate_r (char *__statebuf, struct random_data *__buf)
+     attribute_hidden;
 extern int __rand_r (unsigned int *__seed);
 extern int __erand48_r (unsigned short int __xsubi[3],
-			struct drand48_data *__buffer, double *__result);
+			struct drand48_data *__buffer, double *__result)
+     attribute_hidden;
 extern int __nrand48_r (unsigned short int __xsubi[3],
 			struct drand48_data *__buffer,
-			long int *__result);
+			long int *__result) attribute_hidden;
 extern int __jrand48_r (unsigned short int __xsubi[3],
 			struct drand48_data *__buffer,
-			long int *__result);
+			long int *__result) attribute_hidden;
 extern int __srand48_r (long int __seedval,
-			struct drand48_data *__buffer);
+			struct drand48_data *__buffer) attribute_hidden;
 extern int __seed48_r (unsigned short int __seed16v[3],
-		       struct drand48_data *__buffer);
+		       struct drand48_data *__buffer) attribute_hidden;
 extern int __lcong48_r (unsigned short int __param[7],
-			struct drand48_data *__buffer);
+			struct drand48_data *__buffer) attribute_hidden;
 
 /* Internal function to compute next state of the generator.  */
 extern int __drand48_iterate (unsigned short int __xsubi[3],
-			      struct drand48_data *__buffer);
+			      struct drand48_data *__buffer)
+     attribute_hidden;
 
 /* Global state for non-reentrant functions.  Defined in drand48-iter.c.  */
 extern struct drand48_data __libc_drand48_data attribute_hidden;
 
-extern int __setenv (const char *__name, const char *__value, int __replace);
-extern int __unsetenv (const char *__name);
-extern int __clearenv (void);
+extern int __setenv (const char *__name, const char *__value, int __replace)
+     attribute_hidden;
+extern int __unsetenv (const char *__name) attribute_hidden;
+extern int __clearenv (void) attribute_hidden;
 extern char *__mktemp (char *__template) __THROW __nonnull ((1));
 extern char *__canonicalize_file_name (const char *__name);
 extern char *__realpath (const char *__name, char *__resolved);
-extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
+libc_hidden_proto (__realpath)
+extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
+     attribute_hidden;
 # ifndef _ISOMAC
 extern int __ptsname_internal (int fd, char *buf, size_t buflen,
 			       struct stat64 *stp) attribute_hidden;
 # endif
 extern int __getpt (void);
-extern int __posix_openpt (int __oflag);
+extern int __posix_openpt (int __oflag) attribute_hidden;
 
 extern int __add_to_environ (const char *name, const char *value,
-			     const char *combines, int replace);
-
+			     const char *combines, int replace)
+     attribute_hidden;
 extern void _quicksort (void *const pbase, size_t total_elems,
 			size_t size, __compar_d_fn_t cmp, void *arg);
 
@@ -250,9 +259,11 @@ extern char *__gcvt (double __value, int __ndigit, char *__buf);
 extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
 		     int *__restrict __sign, char *__restrict __buf,
 		     size_t __len);
+libc_hidden_proto (__ecvt_r)
 extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
 		     int *__restrict __sign, char *__restrict __buf,
 		     size_t __len);
+libc_hidden_proto (__fcvt_r)
 extern char *__qecvt (long double __value, int __ndigit,
 		      int *__restrict __decpt, int *__restrict __sign);
 extern char *__qfcvt (long double __value, int __ndigit,
@@ -261,9 +272,11 @@ extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
 extern int __qecvt_r (long double __value, int __ndigit,
 		      int *__restrict __decpt, int *__restrict __sign,
 		      char *__restrict __buf, size_t __len);
+libc_hidden_proto (__qecvt_r)
 extern int __qfcvt_r (long double __value, int __ndigit,
 		      int *__restrict __decpt, int *__restrict __sign,
 		      char *__restrict __buf, size_t __len);
+libc_hidden_proto (__qfcvt_r)
 
 # if IS_IN (libc)
 #  undef MB_CUR_MAX