diff mbox series

[10/58] Mark internal gmp functions with attribute_hidden [BZ #18822]

Message ID 20170901180029.9527-11-hjl.tools@gmail.com
State New
Headers show
Series Hide internal functions in libc.so | expand

Commit Message

H.J. Lu Sept. 1, 2017, 5:59 p.m. UTC
Mark internal gmp functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/gmp.h: Declare internal functions only if _ISOMAC is
	undefined.
	(__mpn_extract_double): Add attribute_hidden.
	(__mpn_extract_long_double): Likewise.
	(__mpn_extract_float128): Likewise.
	(__mpn_construct_float): Likewise.
	(__mpn_construct_double): Likewise.
	(__mpn_construct_long_double): Likewise.
	(__mpn_construct_float128): Likewise.
	(mpn_add_1): Likewise.
	(mpn_addmul_1): Likewise.
	(mpn_add_n): Likewise.
	(mpn_cmp): Likewise.
	(mpn_divrem): Likewise.
	(mpn_lshift): Likewise.
	(mpn_mul): Likewise.
	(mpn_mul_1): Likewise.
	(mpn_rshift): Likewise.
	(mpn_sub_1): Likewise.
	(mpn_submul_1): Likewise.
	(mpn_sub_n): Likewise.
---
 include/gmp.h     | 33 ++++++++++++++++++++++++++-------
 stdlib/gmp-impl.h | 12 ++++++++----
 2 files changed, 34 insertions(+), 11 deletions(-)

Comments

H.J. Lu Oct. 1, 2017, 9:46 p.m. UTC | #1
On 9/1/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> Mark internal gmp functions with attribute_hidden to allow direct
> access within libc.so and libc.a without using GOT nor PLT.
>
> 	[BZ #18822]
> 	* include/gmp.h: Declare internal functions only if _ISOMAC is
> 	undefined.
> 	(__mpn_extract_double): Add attribute_hidden.
> 	(__mpn_extract_long_double): Likewise.
> 	(__mpn_extract_float128): Likewise.
> 	(__mpn_construct_float): Likewise.
> 	(__mpn_construct_double): Likewise.
> 	(__mpn_construct_long_double): Likewise.
> 	(__mpn_construct_float128): Likewise.
> 	(mpn_add_1): Likewise.
> 	(mpn_addmul_1): Likewise.
> 	(mpn_add_n): Likewise.
> 	(mpn_cmp): Likewise.
> 	(mpn_divrem): Likewise.
> 	(mpn_lshift): Likewise.
> 	(mpn_mul): Likewise.
> 	(mpn_mul_1): Likewise.
> 	(mpn_rshift): Likewise.
> 	(mpn_sub_1): Likewise.
> 	(mpn_submul_1): Likewise.
> 	(mpn_sub_n): Likewise.

Tested with build-many-glibcs.py.  I am checking it in.
diff mbox series

Patch

diff --git a/include/gmp.h b/include/gmp.h
index 3590acf408..657c7a0148 100644
--- a/include/gmp.h
+++ b/include/gmp.h
@@ -8,32 +8,51 @@ 
 
 #include <bits/floatn.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern mp_size_t __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
 				       int *expt, int *is_neg,
-				       double value);
+				       double value) attribute_hidden;
 
 extern mp_size_t __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
 					    int *expt, int *is_neg,
-					    long double value);
+					    long double value)
+     attribute_hidden;
 
 #if __HAVE_DISTINCT_FLOAT128
 extern mp_size_t __mpn_extract_float128 (mp_ptr res_ptr, mp_size_t size,
 					 int *expt, int *is_neg,
-					 _Float128 value);
+					 _Float128 value)
+     attribute_hidden;
 #endif
 
-extern float __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign);
+extern float __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign)
+     attribute_hidden;
 
 extern double __mpn_construct_double (mp_srcptr frac_ptr, int expt,
-				      int negative);
+				      int negative) attribute_hidden;
 
 extern long double __mpn_construct_long_double (mp_srcptr frac_ptr, int expt,
-						int sign);
+						int sign)
+     attribute_hidden;
 
 #if __HAVE_DISTINCT_FLOAT128
 extern _Float128 __mpn_construct_float128 (mp_srcptr frac_ptr, int expt,
-					   int sign);
+					   int sign) attribute_hidden;
+#endif
+
+extern __typeof (mpn_add_1) mpn_add_1 attribute_hidden;
+extern __typeof (mpn_addmul_1) mpn_addmul_1 attribute_hidden;
+extern __typeof (mpn_add_n) mpn_add_n attribute_hidden;
+extern __typeof (mpn_cmp) mpn_cmp attribute_hidden;
+extern __typeof (mpn_divrem) mpn_divrem attribute_hidden;
+extern __typeof (mpn_lshift) mpn_lshift attribute_hidden;
+extern __typeof (mpn_mul) mpn_mul attribute_hidden;
+extern __typeof (mpn_mul_1) mpn_mul_1 attribute_hidden;
+extern __typeof (mpn_rshift) mpn_rshift attribute_hidden;
+extern __typeof (mpn_sub_1) mpn_sub_1 attribute_hidden;
+extern __typeof (mpn_submul_1) mpn_submul_1 attribute_hidden;
+extern __typeof (mpn_sub_n) mpn_sub_n attribute_hidden;
 #endif
 
 #endif
diff --git a/stdlib/gmp-impl.h b/stdlib/gmp-impl.h
index 42d3e4afac..cbbf9479ac 100644
--- a/stdlib/gmp-impl.h
+++ b/stdlib/gmp-impl.h
@@ -308,13 +308,17 @@  typedef unsigned int UHWtype;
 
 /* Prototypes for internal mpn calls.  */
 extern void impn_mul_n_basecase _PROTO ((mp_ptr prodp, mp_srcptr up,
-					 mp_srcptr vp, mp_size_t size));
+					 mp_srcptr vp, mp_size_t size))
+     attribute_hidden;
 extern void impn_mul_n _PROTO ((mp_ptr prodp, mp_srcptr up, mp_srcptr vp,
-				mp_size_t size, mp_ptr tspace));
+				mp_size_t size, mp_ptr tspace))
+     attribute_hidden;
 extern void impn_sqr_n_basecase _PROTO ((mp_ptr prodp, mp_srcptr up,
-					 mp_size_t size));
+					 mp_size_t size))
+     attribute_hidden;
 extern void impn_sqr_n _PROTO ((mp_ptr prodp, mp_srcptr up, mp_size_t size,
-				mp_ptr tspace));
+				mp_ptr tspace))
+     attribute_hidden;