summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-01 15:07:06 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-01 15:07:23 -0700
commit8bcdb7e0c5346d2e9d61b208d80fd8213e1dbd90 (patch)
tree487999b729d1c71503ec9215a26d95644ca5efed /iconv
parent8ed3b64330cd24e2a17d8794a871cab034707a33 (diff)
downloadglibc-8bcdb7e0c5346d2e9d61b208d80fd8213e1dbd90.tar.gz
glibc-8bcdb7e0c5346d2e9d61b208d80fd8213e1dbd90.tar.xz
glibc-8bcdb7e0c5346d2e9d61b208d80fd8213e1dbd90.zip
Mark internal functions with attribute_hidden [BZ #18822]
Mark internal functions with attribute_hidden to allow direct access to
internal functions within libc.so and libc.a without using GOT nor PLT.

Size comparison of libc.so:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 1728577	  20584	  17088	1766249	 1af369
After : 1728593	  20584	  17088	1766265	 1af379

The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined
since it is hidden, which increases the code size of gconv_dl.os by 18
bytes.

On i686:
        text	   data	    bss	    dec	    hex
Before: 1869039	  11444	  11112	1891595	 1cdd0b
After : 1868635	  11444	  11112	1891191	 1cdb77

The code size is decreased by avoiding GOT/PLT for hidden functions.

	[BZ #18822]
	* iconv/gconv_int.h (__gconv_open): Add attribute_hidden.
	(__gconv_close): Likewise.
	(__gconv): Likewise.
	(__gconv_find_transform): Likewise.
	(__gconv_lookup_cache): Likewise.
	(__gconv_compare_alias_cache): Likewise.
	(__gconv_load_cache): Likewise.
	(__gconv_get_path): Likewise.
	(__gconv_close_transform): Likewise.
	(__gconv_release_cache): Likewise.
	(__gconv_find_shlib): Likewise.
	(__gconv_release_shlib): Likewise.
	(__gconv_get_builtin_trans): Likewise.
	(__gconv_compare_alias): Likewise.
	* include/dlfcn.h (_dlerror_run): Likewise.
	* include/stdio.h (__fortify_fail_abort): Likewise.
	* include/time.h (__tz_compute): Likewise.
	(__strptime_internal): Likewise.
	* intl/gettextP.h (_nl_find_domain): Likewise.
	(_nl_load_domain): Likewise.
	(_nl_find_msg): Likewise.
	* intl/plural-exp.h (FREE_EXPRESSION): Likewise.
	(EXTRACT_PLURAL_EXPRESSION): Likewise.
	* locale/coll-lookup.h (__collidx_table_lookup): Likewise.
	* resolv/gai_misc.h (__gai_enqueue_request): Likewise.
	(__gai_find_request): Likewise.
	(__gai_remove_request): Likewise.
	(__gai_notify): Likewise.
	(__gai_notify_only): Likewise.
	* sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise.
	* sysdeps/generic/ldsodefs.h (_dl_fini): Likewise.
	(_dl_non_dynamic_init): Likewise.
	(_dl_aux_init): Likewise.
	* sysdeps/i386/machine-gmon.h (mcount_internal): Likewise.
	* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64):
	Likewise.
	* wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise.
	(__wcsmbs_clone_conv): Likewise.
	(__wcsmbs_named_conv): Likewise.
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_int.h43
1 files changed, 28 insertions, 15 deletions
diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h
index b1433f801e..2afd12a977 100644
--- a/iconv/gconv_int.h
+++ b/iconv/gconv_int.h
@@ -156,10 +156,12 @@ __libc_lock_define (extern, __gconv_lock attribute_hidden)
 
 /* Return in *HANDLE decriptor for transformation from FROMSET to TOSET.  */
 extern int __gconv_open (const char *toset, const char *fromset,
-			 __gconv_t *handle, int flags);
+			 __gconv_t *handle, int flags)
+     attribute_hidden;
 
 /* Free resources associated with transformation descriptor CD.  */
-extern int __gconv_close (__gconv_t cd);
+extern int __gconv_close (__gconv_t cd)
+     attribute_hidden;
 
 /* Transform at most *INBYTESLEFT bytes from buffer starting at *INBUF
    according to rules described by CD and place up to *OUTBYTESLEFT
@@ -167,33 +169,38 @@ extern int __gconv_close (__gconv_t cd);
    conversions in *IRREVERSIBLE if this pointer is not null.  */
 extern int __gconv (__gconv_t cd, const unsigned char **inbuf,
 		    const unsigned char *inbufend, unsigned char **outbuf,
-		    unsigned char *outbufend, size_t *irreversible);
+		    unsigned char *outbufend, size_t *irreversible)
+     attribute_hidden;
 
 /* Return in *HANDLE a pointer to an array with *NSTEPS elements describing
    the single steps necessary for transformation from FROMSET to TOSET.  */
 extern int __gconv_find_transform (const char *toset, const char *fromset,
 				   struct __gconv_step **handle,
-				   size_t *nsteps, int flags);
+				   size_t *nsteps, int flags)
+     attribute_hidden;
 
 /* Search for transformation in cache data.  */
 extern int __gconv_lookup_cache (const char *toset, const char *fromset,
 				 struct __gconv_step **handle, size_t *nsteps,
-				 int flags);
+				 int flags)
+     attribute_hidden;
 
 /* Compare the two name for whether they are after alias expansion the
    same.  This function uses the cache and fails if none is
    loaded.  */
 extern int __gconv_compare_alias_cache (const char *name1, const char *name2,
-					int *result);
+					int *result)
+     attribute_hidden;
 
 /* Free data associated with a step's structure.  */
-extern void __gconv_release_step (struct __gconv_step *step);
+extern void __gconv_release_step (struct __gconv_step *step)
+     attribute_hidden;
 
 /* Read all the configuration data and cache it.  */
 extern void __gconv_read_conf (void) attribute_hidden;
 
 /* Try to read module cache file.  */
-extern int __gconv_load_cache (void);
+extern int __gconv_load_cache (void) attribute_hidden;
 
 /* Retrieve pointer to internal cache.  */
 extern void *__gconv_get_cache (void);
@@ -205,7 +212,7 @@ extern struct gconv_module *__gconv_get_modules_db (void);
 extern void *__gconv_get_alias_db (void);
 
 /* Determine the directories we are looking in.  */
-extern void __gconv_get_path (void);
+extern void __gconv_get_path (void) attribute_hidden;
 
 /* Comparison function to search alias.  */
 extern int __gconv_alias_compare (const void *p1, const void *p2)
@@ -214,28 +221,34 @@ extern int __gconv_alias_compare (const void *p1, const void *p2)
 /* Clear reference to transformation step implementations which might
    cause the code to be unloaded.  */
 extern int __gconv_close_transform (struct __gconv_step *steps,
-				    size_t nsteps);
+				    size_t nsteps)
+     attribute_hidden;
 
 /* Free all resources allocated for the transformation record when
    using the cache.  */
-extern void __gconv_release_cache (struct __gconv_step *steps, size_t nsteps);
+extern void __gconv_release_cache (struct __gconv_step *steps, size_t nsteps)
+     attribute_hidden;
 
 /* Load shared object named by NAME.  If already loaded increment reference
    count.  */
-extern struct __gconv_loaded_object *__gconv_find_shlib (const char *name);
+extern struct __gconv_loaded_object *__gconv_find_shlib (const char *name)
+     attribute_hidden;
 
 /* Release shared object.  If no further reference is available unload
    the object.  */
-extern void __gconv_release_shlib (struct __gconv_loaded_object *handle);
+extern void __gconv_release_shlib (struct __gconv_loaded_object *handle)
+     attribute_hidden;
 
 /* Fill STEP with information about builtin module with NAME.  */
 extern void __gconv_get_builtin_trans (const char *name,
-				       struct __gconv_step *step);
+				       struct __gconv_step *step)
+     attribute_hidden;
 
 libc_hidden_proto (__gconv_transliterate)
 
 /* If NAME is an codeset alias expand it.  */
-extern int __gconv_compare_alias (const char *name1, const char *name2);
+extern int __gconv_compare_alias (const char *name1, const char *name2)
+     attribute_hidden;
 
 
 /* Builtin transformations.  */