This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add hidden visibility to internal function prototypes

On 08/21/2017 11:15 PM, Joseph Myers wrote:
> On Mon, 21 Aug 2017, Florian Weimer wrote:
>>> The test links with, but it uses various GMP objects from libc.a.
>>> Generically, any test using any objects from libc.a will have problems if 
>>> those reference hidden symbols (in this case, __assert_fail) from 
>>> elsewhere in libc.
>> I don't think linking a test both against libc.a and is valid.
>> In other cases, in order to test hidden symbols, we use fully static
>> linking instead.  Is this something we could do here as well?  I don't
>> think it would invalidate the tests any more than the current hybrid
>> linkage model does.
> As far as I know, linking those tests statically would be OK (it would not 
> significantly affect what they are testing).  That's atext-exp, 
> atest-sincos, atest-exp2 that are using internal GMP objects from libc.a; 
> I don't know if other tests, in math/ or elsewhere, also link against 
> particular libc.a objects.

I think the attached approach will work for the math subdirectory.
Tested on aarch64 and ppc64le.

I see additional aarch64 failures, though (outside math).

math: Statically link tests of internal functionality

2017-08-22  Florian Weimer  <>

	math: Statically link tests of internal functionality.
	* math/Makefile (tests): Remove atest-exp, atest-sincos,
	(tests-static): Add atest-exp, atest-sincos, atest-exp2.
	(gmp-objs): Remove assignment.
	(atest-exp, atest-sincos, atest-exp2): Remove targets.

diff --git a/math/Makefile b/math/Makefile
index 25d3e95c6c..7948d476fa 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -181,7 +181,7 @@ $(inst_libdir)/libm.a: $(common-objpfx) \
 # Rules for the test suite.
-tests = test-matherr-3 test-fenv atest-exp atest-sincos atest-exp2 basic-test \
+tests = test-matherr-3 test-fenv basic-test \
 	test-misc test-fpucw test-fpucw-ieee tst-definitions test-tgmath \
 	test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \
 	test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
@@ -203,6 +203,10 @@ tests-static = test-fpucw-static test-fpucw-ieee-static \
 	       test-signgam-ullong-static test-signgam-ullong-init-static
 tests-internal = test-matherr test-matherr-2
+# These tests use internal (unexported) GMP functions and are linked
+# statically to obtain access to these fucntions.
+tests-static += atest-exp atest-sincos atest-exp2
 ifneq (,$(CXX))
 tests += test-math-isinff test-math-iszero
@@ -569,11 +573,4 @@ endef
 object-suffixes-left := $(libmvec-tests)
 include $(o-iterator)
-gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%.o,\
-		      add_n sub_n cmp addmul_1 mul_1 mul_n divmod_1 \
-		      lshift rshift mp_clz_tab udiv_qrnnd inlines \
-		      $(gmp-sysdep_routines))
-$(objpfx)atest-exp: $(gmp-objs)
-$(objpfx)atest-sincos: $(gmp-objs)
-$(objpfx)atest-exp2: $(gmp-objs)
 $(objpfx)test-fenv-tls: $(shared-thread-library)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]