Commit Graph

393 Commits

Author SHA1 Message Date
H.J. Lu a67029ff12 Use $(DEFAULT-LDFLAGS-$(@F)) in +link-static-before-libc
Use $(LDFLAGS-$(@F)) with tst-tls1-static-non-pie may not be sufficient
when static PIE is built by default.  Use $(DEFAULT-LDFLAGS-$(@F)) in
+link-static-before-libc to make sure that tst-tls1-static-non-pie is
always built as non-PIE static executable and make sure that crt1.o is
used with tst-tls1-static-non-pie.

	* Makeconfig (+link-static-before-libc): Use
	$(DEFAULT-LDFLAGS-$(@F)).
	* elf/Makefile (CRT-tst-tls1-static-non-pie): New.
	(LDFLAGS-tst-tls1-static-non-pie): Renamed to ...
	(DEFAULT-LDFLAGS-tst-tls1-static-non-pie): This.
2017-10-04 17:16:04 -07:00
H.J. Lu 34d6a3cbf2 Support mcount/gprof test with GCC defaulting to PIE
The mcount/gprof test should be linked with gcrt1.o, not Scrt1.o.

	* Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
	the startup object.
2017-08-17 04:56:01 -07:00
Florian Weimer 6014c65de2 gmon: Add test for basic mcount/gprof functionality 2017-08-15 15:49:45 +02:00
Zack Weinberg 65b6d8b79c Polish the treatment of dl-tunable-list.h in Makeconfig.
Like basically all before-compile headers, dl-tunable-list.h should be
generated using a stamp file to minimize unnecessary rebuilding; it
wasn't being added to common-generated, so it wouldn't get cleaned up;
and it was in between the rules for libc-modules.h/.stmp and their own
addition to common-generated.

	* Makeconfig (dl-tunable-list.h): Generate using a stamp file.
	(common-generated): Add libc-modules.h and libc-modules.stmp in a
	more appropriate location. Also add dl-tunable-list.h and
	dl-tunable-list.stmp.
2017-06-09 09:35:31 -04:00
H.J. Lu ee8015b9ea Support dl-tunables.list in subdirectories
We can put processor specific tunables in dl-tunables.list under
sysdeps instead of in elf/dl-tunables.list.

	* Makeconfig ($(common-objpfx)dl-tunable-list.h): Also check
	dl-tunables.list in subdirectories.
2017-05-25 05:41:18 -07:00
Zack Weinberg 7c3018f9e4 Suppress internal declarations for most of the testsuite.
This patch adds a new build module called 'testsuite'.
IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus
(which means several ad-hoc tests for __cplusplus can go away).
libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is
defined; in particular, _ISOMAC mode does not get config.h
automatically anymore.

There are still quite a few tests that need to see internal gunk of
one variety or another.  For them, we now have 'tests-internal' and
'test-internal-extras'; files in this category will still be compiled
with MODULE_NAME=nonlib, and everything proceeds as it always has.
The bulk of this patch is moving tests from 'tests' to
'tests-internal'.  There is also 'tests-static-internal', which has
the same effect on files in 'tests-static', and 'modules-names-tests',
which has the *inverse* effect on files in 'modules-names' (it's
inverted because most of the things in modules-names are *not* tests).
For both of these, the file must appear in *both* the new variable and
the old one.

There is also now a special case for when libc-symbols.h is included
without MODULE_NAME being defined at all.  (This happens during the
creation of libc-modules.h, and also when preprocessing Versions
files.)  When this happens, IS_IN is set to be always false and
_ISOMAC is *not* defined, which was the status quo, but now it's
explicit.

The remaining changes to C source files in this patch seemed likely to
cause problems in the absence of the main change.  They should be
relatively self-explanatory.  In a few cases I duplicated a definition
from an internal header rather than move the test to tests-internal;
this was a judgement call each time and I'm happy to change those
however reviewers feel is more appropriate.

	* Makerules: New subdir configuration variables 'tests-internal'
	and 'test-internal-extras'.  Test files in these categories will
	still be compiled with MODULE_NAME=nonlib.  Test files in the
	existing categories (tests, xtests, test-srcs, test-extras) are
	now compiled with MODULE_NAME=testsuite.
	New subdir configuration variable 'modules-names-tests'.  Files
	which are in both 'modules-names' and 'modules-names-tests' will
	be compiled with MODULE_NAME=testsuite instead of
	MODULE_NAME=extramodules.
	(gen-as-const-headers): Move to tests-internal.
	(do-tests-clean, common-mostlyclean): Support tests-internal.
	* Makeconfig (built-modules): Add testsuite.
	* Makefile: Change libof-check-installed-headers-c and
	libof-check-installed-headers-cxx to 'testsuite'.
	* Rules: Likewise.  Support tests-internal.
	* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
	Remove extra-modules.mk.

	* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
	* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
	PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
	very top of the file and rationalize their order.
	If MODULE_NAME is not defined at all, define IS_IN to always be
	false, and don't define _ISOMAC.
	If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
	true, define _ISOMAC and suppress everything else in this file,
	starting with the inclusion of config.h.
	Do check for inappropriate definitions of __OPTIMIZE__ and
	__FAST_MATH__ here, but only if _ISOMAC is not defined.
        Correct some out-of-date commentary.

	* include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE
	and _Mlong_double_ before including math.h.
	* include/string.h: If _ISOMAC is defined, don't expose
	_STRING_ARCH_unaligned. Move a comment to a more appropriate
	location.

	* include/errno.h, include/stdio.h, include/stdlib.h, include/string.h
	* include/time.h, include/unistd.h, include/wchar.h: No need to
	check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.

	* misc/sys/cdefs.h (__NTHNL): New macro.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h
	(__m81_defun): Use __NTHNL to avoid errors with GCC 6.

	* elf/tst-env-setuid-tunables.c: Include config.h with _LIBC
	defined, for HAVE_TUNABLES.
	* inet/tst-checks-posix.c: No need to define _ISOMAC.
	* intl/tst-gettext2.c: Provide own definition of N_.
	* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
	* math/test-signgam-main.c: No need to define _ISOMAC.
	* stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to...
	* stdlib/tst-strtod1i.c: ...this new file.
	* stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice.
        Split tests of __strtod_internal to...
	* stdlib/tst-strtod5i.c: ...this new file.
	* string/test-string.h: Include stdint.h. Duplicate definition of
	inhibit_loop_to_libcall here (from libc-symbols.h).
	* string/test-strstr.c: Provide dummy definition of
	libc_hidden_builtin_def when including strstr.c.
	* sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC
	mode; no need to test __STRICT_ANSI__ nor __cplusplus as well.
	* sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h.
	Don't include init-arch.h.
	* sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h.
	Don't include init-arch.h.

	* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
	tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest,
	unload, unload2, circleload1, neededtest, neededtest2,
	neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3,
	tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1,
	tst-stackguard1, tst-_dl_addr_inside_object, and all of the
	ifunc tests to tests-internal.
	Don't add $(modules-names) to test-extras.
	* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
	Add tst-deadline to tests-static-internal.
	* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
	tests-internal.
	* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
	* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
	tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3,
	tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static,
	tst-sem12-static, and tst-stackguard1-static to tests-internal.
        Link tests-internal with libpthread also.
	Don't add $(modules-names) to test-extras.
	* nss/Makefile: Move tst-field to tests-internal.
	* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
	tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
	* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
	tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
	tests-internal.
        * sunrpc/Makefile: Move tst-svc_register to tests-internal.
	* sysdeps/powerpc/Makefile: Move test-get_hwcap and
	test-get_hwcap-static to tests-internal.
	* sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to
	tests-internal.
	* sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to
	modules-names-tests.
2017-05-11 19:27:59 -04:00
Florian Weimer 2d6ab5df3b Document and fix --enable-bind-now [BZ #21015] 2017-03-02 14:44:28 +01:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Siddhesh Poyarekar 6765d5d34d Enhance --enable-tunables to select tunables frontend at build time
At the GNU Tools Cauldron 2016, the state of the current tunables
patchset was considered OK with the addition of a way to select the
frontend to be used for the tunables.  That is, to avoid being locked
in to one type of frontend initially, it should be possible to build
tunables with a different frontend with something as simple as a
configure switch.

To that effect, this patch enhances the --enable-tunables option to
accept more values than just 'yes' or 'no'.  The current frontend (and
default when enable-tunables is 'yes') is called 'valstring', to
select the frontend where a single environment variable is set to a
colon-separated value string.  More such frontends can be added in
future.

	* Makeconfig (have-tunables): Check for non-negative instead
	of positive.
	* configure.ac: Add 'valstring' as a valid value for
	--enable-tunables.
	* configure: Regenerate.
	* elf/Makefile (have-tunables): Check for non-negative instead
	of positive.
	(CPPFLAGS-dl-tunables.c): Define TUNABLES_FRONTEND for
	dl-tunables.c.
	* elf/dl-tunables.c (GLIBC_TUNABLES): Define only when
	TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring.
	(tunables_strdup): Likewise.
	(disable_tunables): Likewise.
	(parse_tunables): Likewise.
	(__tunables_init): Process GLIBC_TUNABLES envvar only when.
	TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring.
	* elf/dl-tunables.h (TUNABLES_FRONTEND_valstring): New macro.
	(TUNABLES_FRONTEND_yes): New macro, define as
	TUNABLES_FRONTEND_valstring by default.
	* manual/install.texi: Document new acceptable values for
	--enable-tunables.
	* INSTALL: Regenerate.
2016-12-31 23:49:24 +05:30
Siddhesh Poyarekar 67e58f3941 Add framework for tunables
The tunables framework allows us to uniformly manage and expose global
variables inside glibc as switches to users.  tunables/README has
instructions for glibc developers to add new tunables.

Tunables support can be enabled by passing the --enable-tunables
configure flag to the configure script.  This patch only adds a
framework and does not pose any limitations on how tunable values are
read from the user.  It also adds environment variables used in malloc
behaviour tweaking to the tunables framework as a PoC of the
compatibility interface.

	* manual/install.texi: Add --enable-tunables option.
	* INSTALL: Regenerate.
	* README.tunables: New file.
	* Makeconfig (CPPFLAGS): Define TOP_NAMESPACE.
	(before-compile): Generate dl-tunable-list.h early.
	* config.h.in: Add HAVE_TUNABLES.
	* config.make.in: Add have-tunables.
	* configure.ac: Add --enable-tunables option.
	* configure: Regenerate.
	* csu/init-first.c (__libc_init_first): Move
	__libc_init_secure earlier...
	* csu/init-first.c (LIBC_START_MAIN):... to here.
	Include dl-tunables.h, libc-internal.h.
	(LIBC_START_MAIN) [!SHARED]: Initialize tunables for static
	binaries.
	* elf/Makefile (dl-routines): Add dl-tunables.
	* elf/Versions (ld): Add __tunable_set_val to GLIBC_PRIVATE
	namespace.
	* elf/dl-support (_dl_nondynamic_init): Unset MALLOC_CHECK_
	only when !HAVE_TUNABLES.
	* elf/rtld.c (process_envvars): Likewise.
	* elf/dl-sysdep.c [HAVE_TUNABLES]: Include dl-tunables.h
	(_dl_sysdep_start): Call __tunables_init.
	* elf/dl-tunable-types.h: New file.
	* elf/dl-tunables.c: New file.
	* elf/dl-tunables.h: New file.
	* elf/dl-tunables.list: New file.
	* malloc/tst-malloc-usable-static.c: New test case.
	* malloc/Makefile (tests-static): Add it.
	* malloc/arena.c [HAVE_TUNABLES]: Include dl-tunables.h.
	Define TUNABLE_NAMESPACE.
	(DL_TUNABLE_CALLBACK (set_mallopt_check)): New function.
	(DL_TUNABLE_CALLBACK_FNDECL): New macro.  Use it to define
	callback functions.
	(ptmalloc_init): Set tunable values.
	* scripts/gen-tunables.awk: New file.
	* sysdeps/mach/hurd/dl-sysdep.c: Include dl-tunables.h.
	(_dl_sysdep_start): Call __tunables_init.
2016-12-31 23:49:24 +05:30
Nick Alcock cecbc7967f Enable -fstack-protector=* when requested by configure [BZ #7065] 2016-12-26 10:11:06 +01:00
Florian Weimer 76dcbf42df Expose linking against libsupport as make dependency
This ensures that tests are rebuilt when libsupport changes.
2016-12-13 07:58:41 +01:00
Florian Weimer c23de0aacb support: Introduce new subdirectory for test infrastructure
The new test driver in <support/test-driver.c> has feature parity with
the old one.  The main difference is that its hooking mechanism is
based on functions and function pointers instead of macros.  This
commit also implements a new environment variable, TEST_COREDUMPS,
which disables the code which disables coredumps (that is, it enables
them if the invocation environment has not disabled them).

<test-skeleton.c> defines wrapper functions so that it is possible to
use existing macros with the new-style hook functionality.

This commit changes only a few test cases to the new test driver, to
make sure that it works as expected.
2016-12-09 08:18:27 +01:00
Martin Galvan 23b5cae1af Add pretty printers for the NPTL lock types
This patch adds pretty printers for the following NPTL types:

- pthread_mutex_t
- pthread_mutexattr_t
- pthread_cond_t
- pthread_condattr_t
- pthread_rwlock_t
- pthread_rwlockattr_t

To load the pretty printers into your gdb session, do the following:

python
import sys
sys.path.insert(0, '/path/to/glibc/build/nptl/pretty-printers')
end

source /path/to/glibc/source/pretty-printers/nptl-printers.py

You can check which printers are registered and enabled by issuing the
'info pretty-printer' gdb command. Printers should trigger automatically when
trying to print a variable of one of the types mentioned above.

The printers are architecture-independent, and were tested on an AMD64 running
Ubuntu 14.04 and an x86 VM running Fedora 24.

In order to work, the printers need to know the values of various flags that
are scattered throughout pthread.h and pthreadP.h as enums and #defines. Since
replicating these constants in the printers file itself would create a
maintenance burden, I wrote a script called gen-py-const.awk that Makerules uses
to extract the constants. This script is pretty much the same as gen-as-const.awk,
except it doesn't cast the constant values to 'long' and is thorougly documented.
The constants need only to be enumerated in a .pysym file, which is then referenced
by a Make variable called gen-py-const-headers.

As for the install directory, I discussed this with Mike Frysinger and Siddhesh
Poyarekar, and we agreed that it can be handled in a separate patch, and shouldn't
block merging of this one.

In addition, I've written a series of test cases for the pretty printers.
Each lock type (mutex, condvar and rwlock) has two test programs, one for itself
and other for its related 'attributes' object. Each test program in turn has a
PExpect-based Python script that drives gdb and compares its output to the
expected printer's. The tests run on the glibc host, which is assumed to have
both gdb and PExpect; if either is absent the tests will fail with code 77
(UNSUPPORTED). For cross-testing you should use cross-test-ssh.sh as test-wrapper.
I've tested the printers on both native builds and a cross build using a Beaglebone
Black running Debian, with the build system's filesystem shared with the board
through NFS.

Finally, I've written a README that explains all this and more.

	* INSTALL: Regenerated.
	* Makeconfig: Add comments and whitespace to make the control flow
	clearer.
	(+link-printers-tests, +link-pie-printers-tests, CFLAGS-printers-tests,
	installed-rtld-LDFLAGS, built-rtld-LDFLAGS, link-libc-rpath,
	link-libc-tests-after-rpath-link, link-libc-printers-tests): New.
	(rtld-LDFLAGS, rtld-tests-LDFLAGS, link-libc-tests-rpath-link,
	link-libc-tests): Use the new variables as required.
	* Makerules ($(py-const)): New rule.
	generated: Add $(py-const).
	* README.pretty-printers: New file.
	* Rules (tests-printers-programs, tests-printers-out, py-env): New.
	(others): Depend on $(py-const).
	(tests): Depend on $(tests-printers-programs) or $(tests-printers-out),
	as required.  Pass $(tests-printers) to merge-test-results.sh.
	* manual/install.texi: Add requirements for testing the pretty printers.
	* nptl/Makefile (gen-py-const-headers, pretty-printers, tests-printers,
	CFLAGS-test-mutexattr-printers.c CFLAGS-test-mutex-printers.c,
	CFLAGS-test-condattr-printers.c, CFLAGS-test-cond-printers.c,
	CFLAGS-test-rwlockattr-printers.c CFLAGS-test-rwlock-printers.c,
	tests-printers-libs): Define.
	* nptl/nptl-printers.py: New file.
	* nptl/nptl_lock_constants.pysym: Likewise.
	* nptl/test-cond-printers.c: Likewise.
	* nptl/test-cond-printers.py: Likewise.
	* nptl/test-condattr-printers.c: Likewise.
	* nptl/test-condattr-printers.py: Likewise.
	* nptl/test-mutex-printers.c: Likewise.
	* nptl/test-mutex-printers.py: Likewise.
	* nptl/test-mutexattr-printers.c: Likewise.
	* nptl/test-mutexattr-printers.py: Likewise.
	* nptl/test-rwlock-printers.c: Likewise.
	* nptl/test-rwlock-printers.py: Likewise.
	* nptl/test-rwlockattr-printers.c: Likewise.
	* nptl/test-rwlockattr-printers.py: Likewise.
	* scripts/gen-py-const.awk: Likewise.
	* scripts/test_printers_common.py: Likewise.
	* scripts/test_printers_exceptions.py: Likewise.
2016-12-08 18:59:02 +05:30
Florian Weimer 612148c660 Generate .op pattern rules for profiling builds only
.op pattern rules are not used in non-profiling builds.

This does not cause any changes to both profiling and non-profiling
builds.
2016-09-21 10:45:19 +02:00
Florian Weimer 8837917cf1 Remove remnants of .og patterns
This was used by --enable-omitfp, and the bulk of it was removed in this
commit:

commit bdeba1354b
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Jan 7 11:29:31 2012 -0500

    Remove --enable-omitfp support
2016-09-20 12:18:13 +02:00
Siddhesh Poyarekar c10f90dcef Revert "Add pretty printers for the NPTL lock types"
This reverts commit 62ce266b0b.

The change is not mature enough because it needs the following fixes:

1. Redirect test output to a file like other tests

2. Eliminate the need to use a .gdbinit because distributions will
   break without it.  I should have caught that but I was in too much
   of a hurry to get the patch in :/

3. Feature checking during configure to determine things like minimum
   required gdb version, python-pexpect version, etc. to make sure
   that tests work correctly.
2016-07-11 20:32:12 +05:30
Martin Galvan 62ce266b0b Add pretty printers for the NPTL lock types
This patch adds pretty printers for the following NPTL types:

- pthread_mutex_t
- pthread_mutexattr_t
- pthread_cond_t
- pthread_condattr_t
- pthread_rwlock_t
- pthread_rwlockattr_t

To load the pretty printers into your gdb session, do the following:

python
import sys
sys.path.insert(0, '/path/to/glibc/build/nptl/pretty-printers')
end

source /path/to/glibc/source/pretty-printers/nptl-printers.py

You can check which printers are registered and enabled by issuing the
'info pretty-printer' gdb command. Printers should trigger automatically when
trying to print a variable of one of the types mentioned above.

The printers are architecture-independent, and were manually tested on both
the gdb CLI and Eclipse CDT.

In order to work, the printers need to know the values of various flags that
are scattered throughout pthread.h and pthreadP.h as enums and #defines. Since
replicating these constants in the printers file itself would create a
maintenance burden, I wrote a script called gen-py-const.awk that Makerules uses
to extract the constants. This script is pretty much the same as gen-as-const.awk,
except it doesn't cast the constant values to 'long' and is thorougly documented.
The constants need only to be enumerated in a .pysym file, which is then referenced
by a Make variable called gen-py-const-headers.

As for the install directory, I discussed this with Mike Frysinger and Siddhesh
Poyarekar, and we agreed that it can be handled in a separate patch, and it shouldn't
block merging of this one.

In addition, I've written a series of test cases for the pretty printers.
Each lock type (mutex, condvar and rwlock) has two test programs, one for itself
and other for its related 'attributes' object. Each test program in turn has a
PExpect-based Python script that drives gdb and compares its output to the
expected printer's. The tests run on the glibc host, which is assumed to have
both gdb and PExpect; if either is absent the tests will fail with code 77
(UNSUPPORTED). For cross-testing you should use cross-test-ssh.sh as test-wrapper.
I've tested the printers on both a native build and a cross build using a Beaglebone
Black, with the build system's filesystem shared with the board through NFS.

Finally, I've written a README that explains all this and more.

Hopefully this should be good to go in now. Thanks.

ChangeLog:

2016-07-04  Martin Galvan  <martin.galvan@tallertechnologies.com>

	* Makeconfig (build-hardcoded-path-in-tests): Set to 'yes' for shared builds
	if tests-need-hardcoded-path is defined.
	(all-subdirs): Add pretty-printers.
	* Makerules ($(py-const)): New rule.
	* Rules (others): Add $(py-const), if defined.
	* nptl/Makefile (gen-py-const-headers): Define.
	* nptl/nptl-printers.py: New file.
	* nptl/nptl_lock_constants.pysym: Likewise.
	* pretty-printers/Makefile: Likewise.
	* pretty-printers/README: Likewise.
	* pretty-printers/test-condvar-attributes.c: Likewise.
	* pretty-printers/test-condvar-attributes.p: Likewise.
	* pretty-printers/test-condvar-printer.c: Likewise.
	* pretty-printers/test-condvar-printer.py: Likewise.
	* pretty-printers/test-mutex-attributes.c: Likewise.
	* pretty-printers/test-mutex-attributes.py: Likewise.
	* pretty-printers/test-mutex-printer.c: Likewise.
	* pretty-printers/test-mutex-printer.py: Likewise.
	* pretty-printers/test-rwlock-attributes.c: Likewise.
	* pretty-printers/test-rwlock-attributes.py: Likewise.
	* pretty-printers/test-rwlock-printer.c: Likewise.
	* pretty-printers/test-rwlock-printer.py: Likewise.
	* pretty-printers/test_common.py: Likewise.
	* scripts/gen-py-const.awk: Likewise.
2016-07-08 20:03:05 +05:30
H.J. Lu 8321286846 Make copies of cstdlib/cmath and use them [BZ #20314]
If C++ headers <cstdlib> or <cmath> are used, GCC 6 will include
/usr/include/stdlib.h or /usr/include/math.h from "#include_next"
(instead of stdlib/stdlib.h or math/math.h in the glibc source
directory), and this turns up as a make dependency.  An implicit
rule will kick in and make will try to install stdlib/stdlib.h or
math/math.h as /usr/include/stdlib.h or /usr/include/math.h because
the target is out of date.  We make a copy of <cstdlib> and <cmath>
in the glibc build directory so that stdlib/stdlib.h and math/math.h
will be used instead of /usr/include/stdlib.h and /usr/include/math.h.

	[BZ #20314]
	* Makeconfig (CXXFLAGS): Prepend -I$(common-objpfx).
	* Makerules (before-compile): Add $(common-objpfx)cstdlib and
	$(common-objpfx)cmath.
	($(common-objpfx)cstdlib): New target.
	($(common-objpfx)cmath): Likewise.
2016-07-05 15:01:46 -07:00
Carlos O'Donell 314f6deec9 Enable --localedir to set message catalog directory (Bug 14259)
In 1999 the project split "localedir" into "localedir" (path to compiled
locale archives) and "msgcatdir" (path to message catalogs). This
predates the 2002 change in the GNU Coding Standard to document the use
of "localedir" for the path to the message catalogs. It appears that
newlib, gcc, and several other projects also used "msgcatdir" at one
point or another in the past, and so it is in line with historical
precedent that glibc would also use "msgcatdir." However, given that the
GNU Coding Standard uses "localedir", we will switch to that for
consistency as a GNU project. Previous uses of --localdir didn't work
anyway (see bug 14259).

I am committing this patch in the understanding that nobody would object
to fixing #14259 as part of aligning our variable usage to the GNU
Coding Standard.

Given that previous "localedir" uses were converted to "complocaledir"
by [1], we can now convert "msgcatdir" to "localedir" and complete the
transition. With an addition to config.make.in we also fix bug 14259 and
allow users to specify the locale dependent data directory with
"--localedir" at configure time. There is still no way to control at
configure time the location of the *compiled* locale directory.

Tested on x86_64 with no regressions.

Tested using "--localedir" to specify alternate locale dependent data
directory and verified with "make install DESTDIR=/tmp/glibc".

[1] 90fe682d30
2016-02-24 20:06:04 -05:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Carlos O'Donell 90fe682d30 Rename localedir to complocaledir (bug 14259).
In preparation to fix the --localedir configure argument we must
move the existing conflicting definition of localedir to a more
appropriate name. Given that all current internal uses of localedir
relate to the compiled locales we rename to complocaledir.
2015-11-27 10:22:38 -05:00
Joseph Myers 783dd2d3af Use -std=gnu11 instead of -std=gnu99.
Now that GCC 4.7 or later is required to build glibc, this patch moves
the build from using -std=gnu99 to -std=gnu11 (option added in 4.7).
This allows use of C11 features from GCC's headers, such as new
float.h macros and max_align_t.

Tested for x86_64 and x86 (testsuite; installed stripped shared
libraries are unchanged by the patch on x86_64, while I see some
slight code reordering of no significance on x86).

	* Makeconfig (CFLAGS): Use -std=gnu11 instead of -std=gnu99.
	* Makefile ($(objpfx)c++-types-check.out): Filter out -std=gnu11
	instead of -std=gnu99.
	* configure.ac (systemtap): Test with -std=gnu11 instead of
	-std=gnu99.
	* configure: Regenerated.
	* math/gen-auto-libm-tests.c: Use -std=gnu11 instead of -std=gnu99
	in compilation command in comment.
2015-10-27 21:47:22 +00:00
Joseph Myers e4f5eae8f0 Remove configure test for needing -P for .S files.
There is a configure test for "whether we need to use -P to assemble
.S files".

I think this test is long obsolete.  I don't have a specific reference
to a binutils change or version that obsoleted this test, but: (a) we
only support GNU binutils; (b) it looks like every architecture
supported by glibc has '#' as a line comment character in its gas
port; (c) in any case, if the (compiler, assembler) combination in use
cannot compile a .S file without special options, that would clearly
be a substantially broken combination, which I don't think we need to
allow for at all.

The test in question was added by:

Thu Jan 27 16:46:03 1994  Roland McGrath  (roland@churchy.gnu.ai.mit.edu)

        * configure.in (asm-CPPFLAGS): Add new check to see if assembling
        a .S file loses without -P.  If so, set asm-CPPFLAGS=-P in config.make.

This patch removes the test and the reference to this issue in the
comment on the default empty definition of asm-CPPFLAGS.  (Various
other settings of asm-CPPFLAGS remain in sysdeps Makefile fragments.)

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

	* configure.ac (libc_cv_need_minus_P): Remove configure test.
	* configure: Regenerated.
	* Makeconfig (asm-CPPFLAGS): Remove reference to -P in comment.
2015-10-27 10:46:15 +00:00
Joseph Myers 8e2f7c6811 Use -Wold-style-definition.
This patch makes glibc build with -Wold-style-definition to avoid
old-style function definitions creeping back in by accident.

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).  Also tested build for arm,
mips64 and powerpc32.  Hopefully there aren't any remaining
system-specific files with old-style definitions whose formatting
evaded my searches, but if there are, they will be easy to fix.

	* Makeconfig (+gccwarn-c): Add -Wold-style-definition.
	* Makefile ($(objpfx)c++-types-check.out): Filter out
	$(+gccwarn-c) instead of -Wstrict-prototypes.
2015-10-21 15:14:13 +00:00
Joseph Myers 361468f226 Remove -fgnu89-inline configure test.
There is a configure test for -fgnu89-inline.  This option was added
in GCC 4.2, so the test is obsolete; this patch removes it.

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

	* configure.ac (libc_cv_gnu89_inline): Remove configure test.
	* configure: Regenerated.
	* config.make.in (gnu89-inline-CFLAGS): Remove variable.
	* Makeconfig (CFLAGS): Use -fgnu89-inline instead of
	$(gnu89-inline-CFLAGS).
2015-10-19 12:07:03 +00:00
Joseph Myers 56ab386964 Remove -fexceptions configure test.
There is a configure test for -fexceptions.  This option was added in
GCC 2.8, so the test is obsolete - and indeed plenty of code is using
-fexceptions directly.  This patch removes the configure test and
makes all uses of $(exceptions) use -fexceptions directly.

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

	* configure.ac (libc_cv_gcc_exceptions): Remove configure test.
	* configure: Regenerated.
	* sysdeps/arm/configure.ac (libc_cv_gcc_exceptions): Do not set
	variable.
	(exceptions): Likewise.
	* sysdeps/arm/configure: Regenerated.
	* config.make.in (exceptions): Remove variable.
	* Makeconfig (uses-callbacks): Use -fexceptions instead of
	$(exceptions).
	* debug/Makefile (CFLAGS-dprintf_chk.c): Likewise.
	(CFLAGS-vdprintf_chk.c): Likewise.
	(CFLAGS-printf_chk.c): Likewise.
	(CFLAGS-fprintf_chk.c): Likewise.
	(CFLAGS-vprintf_chk.c): Likewise.
	(CFLAGS-vfprintf_chk.c): Likewise.
	(CFLAGS-gets_chk.c): Likewise.
	(CFLAGS-fgets_chk.c): Likewise.
	(CFLAGS-fgets_u_chk.c): Likewise.
	(CFLAGS-fread_chk.c): Likewise.
	(CFLAGS-fread_u_chk.c): Likewise.
	(CFLAGS-wprintf_chk.c): Likewise.
	(CFLAGS-fwprintf_chk.c): Likewise.
	(CFLAGS-vwprintf_chk.c): Likewise.
	(CFLAGS-vfwprintf_chk.c): Likewise.
	(CFLAGS-fgetws_chk.c): Likewise.
	(CFLAGS-fgetws_u_chk.c): Likewise.
	* libio/Makefile (CFLAGS-fileops.c): Likewise.
	(CFLAGS-fputc.c): Likewise.
	(CFLAGS-fputwc.c): Likewise.
	(CFLAGS-freopen64.c): Likewise.
	(CFLAGS-freopen.c): Likewise.
	(CFLAGS-fseek.c): Likewise.
	(CFLAGS-fseeko64.c): Likewise.
	(CFLAGS-fseeko.c): Likewise.
	(CFLAGS-ftello64.c): Likewise.
	(CFLAGS-ftello.c): Likewise.
	(CFLAGS-fwide.c): Likewise.
	(CFLAGS-genops.c): Likewise.
	(CFLAGS-getc.c): Likewise.
	(CFLAGS-getchar.c): Likewise.
	(CFLAGS-getwc.c): Likewise.
	(CFLAGS-getwchar.c): Likewise.
	(CFLAGS-iofclose.c): Likewise.
	(CFLAGS-iofflush.c): Likewise.
	(CFLAGS-iofgetpos64.c): Likewise.
	(CFLAGS-iofgetpos.c): Likewise.
	(CFLAGS-iofgets.c): Likewise.
	(CFLAGS-iofgetws.c): Likewise.
	(CFLAGS-iofputs.c): Likewise.
	(CFLAGS-iofputws.c): Likewise.
	(CFLAGS-iofread.c): Likewise.
	(CFLAGS-iofsetpos64.c): Likewise.
	(CFLAGS-iofsetpos.c): Likewise.
	(CFLAGS-ioftell.c): Likewise.
	(CFLAGS-iofwrite.c): Likewise.
	(CFLAGS-iogetdelim.c): Likewise.
	(CFLAGS-iogetline.c): Likewise.
	(CFLAGS-iogets.c): Likewise.
	(CFLAGS-iogetwline.c): Likewise.
	(CFLAGS-ioputs.c): Likewise.
	(CFLAGS-ioseekoff.c): Likewise.
	(CFLAGS-ioseekpos.c): Likewise.
	(CFLAGS-iosetbuffer.c): Likewise.
	(CFLAGS-iosetvbuf.c): Likewise.
	(CFLAGS-ioungetc.c): Likewise.
	(CFLAGS-ioungetwc.c): Likewise.
	(CFLAGS-oldfileops.c): Likewise.
	(CFLAGS-oldiofclose.c): Likewise.
	(CFLAGS-oldiofgetpos64.c): Likewise.
	(CFLAGS-oldiofgetpos.c): Likewise.
	(CFLAGS-oldiofsetpos64.c): Likewise.
	(CFLAGS-oldiofsetpos.c): Likewise.
	(CFLAGS-peekc.c): Likewise.
	(CFLAGS-putc.c): Likewise.
	(CFLAGS-putchar.c): Likewise.
	(CFLAGS-putwc.c): Likewise.
	(CFLAGS-putwchar.c): Likewise.
	(CFLAGS-rewind.c): Likewise.
	(CFLAGS-wfileops.c): Likewise.
	(CFLAGS-wgenops.c): Likewise.
	(CFLAGS-oldiofopen.c): Likewise.
	(CFLAGS-iofopen.c): Likewise.
	(CFLAGS-iofopen64.c): Likewise.
	(CFLAGS-oldtmpfile.c): Likewise.
	* stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise.
	(CFLAGS-fprintf.c): Likewise.
	(CFLAGS-printf.c): Likewise.
	(CFLAGS-vfwprintf.c): Likewise.
	(CFLAGS-vfscanf.c): Likewise.
	(CFLAGS-vfwscanf.c): Likewise.
	(CFLAGS-fscanf.c): Likewise.
	(CFLAGS-scanf.c): Likewise.
	(CFLAGS-isoc99_vfscanf.c): Likewise.
	(CFLAGS-isoc99_vscanf.c): Likewise.
	(CFLAGS-isoc99_fscanf.c): Likewise.
	(CFLAGS-isoc99_scanf.c): Likewise.
	* wcsmbs/Makefile (CFLAGS-isoc99_wscanf.c): Likewise.
	(CFLAGS-isoc99_fwscanf.c): Likewise.
	(CFLAGS-isoc99_vwscanf.c): Likewise.
	(CFLAGS-isoc99_vfwscanf.c): Likewise.
2015-10-15 22:35:13 +00:00
Joseph Myers 48bb14bdbb Don't use -Wno-error=undef.
This patch removes the use of -Wno-error=undef, so that -Wundef
warnings become errors.

Tested for x86_64, x86, mips64 (all three ABIs) and arm.

	* Makeconfig [$(enable-werror) = yes] (+gccwarn): Do not add
	-Wno-error=undef.
2015-08-20 20:50:05 +00:00
Siddhesh Poyarekar e400f3ccd3 Use IE model for static variables in libc.so, libpthread.so and rtld
The recently introduced TLS variables in the thread-local destructor
implementation (__cxa_thread_atexit_impl) used the default GD access
model, resulting in a call to __tls_get_addr.  This causes a deadlock
with recent changes to the way TLS is initialized because DTV
allocations are delayed and hence despite knowing the offset to the
variable inside its TLS block, the thread has to take the global rtld
lock to safely update the TLS offset.

This causes deadlocks when a thread is instantiated and joined inside
a destructor of a dlopen'd DSO.  The correct long term fix is to
somehow not take the lock, but that will need a lot deeper change set
to alter the way in which the big rtld lock is used.

Instead, this patch just eliminates the call to __tls_get_addr for the
thread-local variables inside libc.so, libpthread.so and rtld by
building all of their units with -mtls-model=initial-exec.

There were concerns that the static storage for TLS is limited and
hence we should not be using it.  Additionally, dynamically loaded
modules may result in libc.so looking for this static storage pretty
late in static binaries.  Both concerns are valid when using TLSDESC
since that is where one may attempt to allocate a TLS block from
static storage for even those variables that are not IE.  They're not
very strong arguments for the traditional TLS model though, since it
assumes that the static storage would be used sparingly and definitely
not by default.  Hence, for now this would only theoretically affect
ARM architectures.

The impact is hence limited to statically linked binaries that dlopen
modules that in turn load libc.so, all that on arm hardware.  It seems
like a small enough impact to justify fixing the larger problem that
currently affects everything everywhere.

This still does not solve the original problem completely.  That is,
it is still possible to deadlock on the big rtld lock with a small
tweak to the test case attached to this patch.  That problem is
however not a regression in 2.22 and hence could be tackled as a
separate project.  The test case is picked up as is from Alex's patch.

This change has been tested to verify that it does not cause any
issues on x86_64.

ChangeLog:

	[BZ #18457]
	* nptl/Makefile (tests): New test case tst-join7.
	(modules-names): New test case module tst-join7mod.
	* nptl/tst-join7.c: New file.
	* nptl/tst-join7mod.c: New file.
	* Makeconfig (tls-model): Pass -ftls-model=initial-exec for
	all translation units in libc.so, libpthread.so and rtld.
2015-07-24 19:13:38 +05:30
H.J. Lu cc08749b2d Support compilers defaulting to PIE
To support building glibc with GCC 6 configured with --enable-default-pie,
which generates PIE by default, we need to build programs as PIE.  But
elf/tst-dlopen-aout must not be built as PIE since it tests dlopen on
ET_EXEC file and PIE is ET_DYN.

	[BZ #17841]
	* Makeconfig (no-pie-ldflag): New.
	(+link): Set to $(+link-pie) if default to PIE.
	(+link-tests): Set to $(+link-pie-tests) if default to PIE.
	* config.make.in (build-pie-default): New.
	* configure.ac (libc_cv_pie_default): New.  Set to yes if -fPIE
	is default.  AC_SUBST.
	* configure: Regenerated.
	* elf/Makefile (LDFLAGS-tst-dlopen-aout): New.
2015-06-25 02:49:53 -07:00
Dmitry V. Levin ac63a0783c Prepare for restoration of .interp section in libpthread.so
Make runtime-linker.h available outside $(elf-objpfx) by moving
the file to $(common-objpfx) and the rules for it to Makerules.

Tested for x86_64 and x86 (testsuite, and that no compiled code
changed by the patch).

* Makeconfig (+interp): Remove unused variable.
* elf/Makefile ($(objpfx)interp.os): Define for [$(build-shared) = yes]
only.  Depend on $(common-objpfx)runtime-linker.h instead of
$(elf-objpfx)runtime-linker.h.
($(elf-objpfx)runtime-linker.h): Rename to
$(common-objpfx)runtime-linker.h and move ...
* Makerules [$(build-shared) = yes]: ... here.
* elf/interp.c: Include <runtime-linker.h> instead of
<elf/runtime-linker.h>.
2015-06-10 10:14:45 +00:00
Andrew Senkevich 5695d46f5d This is update for configure, build and install of vector math library.
Installation of libm.so as linker script only in case of libmvec.so build.

2015-05-14  Andrew Senkevich  <andrew.n.senkevich@gmail.com>

    * Makeconfig (rpath-dirs, all-subdirs): Added mathvec folder.
    (libmvec): New variable.
    * configure.ac: Added option for mathvec build.
    * configure: Regenerated.
    * mathvec/Depend: New file.
    * mathvec/Makefile: New file.
    * shlib-versions: Added libmvec.
    * math/Makefile: Added rule for libm.so installation.
2015-05-14 18:07:06 +03:00
Florian Weimer ed159672eb Do not build with -Winline
-Winline causes architecture- and optimization-dependent build failures
due to -Werror.  -Winline warns about inlining decisions based on
branch hints, in effect preventing the use of inline functions in
header files (because they might be called on unlikely branches, leading
to a decision not to inline).

The option was apparently added to the glibc build at a time when GCC
did not support the always_inline attribute.  With current GCC versions,
inlining failure for functions declared always_inline will receive a
warning under -Wattributes, which is enabled by default, so -Winline
appears unnecessary.
2015-04-24 17:06:39 +02:00
Roland McGrath 8a257e2cb5 Omit libc-modules.h for all .v.i files. 2015-04-09 14:42:29 -07:00
Roland McGrath 9162c01d09 Avoid re-exec-self in bug-setlocale1. 2015-03-05 12:58:49 -08:00
Roland McGrath 96a157490c Use -Werror=undef for assembly code. 2015-02-12 13:57:32 -08:00
Roland McGrath 04f5a636b6 Support after-link variable to run a final step on binaries. 2015-02-12 13:38:47 -08:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers a4ecc9eb9b Use -Werror by default, add --disable-werror.
As discussed starting at
<https://sourceware.org/ml/libc-alpha/2014-11/msg00323.html>, this
patch makes the glibc build use -Werror by default to avoid
accidentally adding new warnings to the build.  The configure option
--disable-werror can be used to disable this.

-Wno-error=undef is temporarily used because the build isn't clean
regarding -Wundef warnings.  The idea is that once the remaining
-Wundef warnings have been cleaned up (in at least one configuration),
-Wno-error=undef will be removed.

I get a clean build and test on x86_64 (GCC 4.9 branch) with this
patch.  The expectation is that this may well break the build for some
other configurations, and people seeing such breakage should make
appropriate fixes to fix or suppress the warnings for their
configurations.  In some cases that may involve using pragmas as the
right fix (I think that will be right for the -Wno-inline issue for
MIPS I referred to in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, for
example), in some cases -Wno-error in sysdeps makefiles (__restore_rt
in MIPS sigaction, for example), in some cases substantive fixes for
the warnings.

Note that if, with a view to listing all the warnings then fixing them
all, you just look for "warning:" in output from building and testing
with --disable-werror, you'll see lots of warnings from the linker
about functions such as tmpnam.  Those warnings can be ignored - only
compiler warnings are relevant to -Werror, not linker warnings.

	* configure.ac (--disable-werror): New configure option.
	(enable_werror): New AC_SUBST.
	* configure: Regenerated.
	* config.make.in (enable-werror): New variable.
	* Makeconfig [$(enable-werror) = yes] (+gccwarn): Add -Werror
	-Wno-error=undef.
	(+gccwarn-c): Do not use -Werror=implicit-function-declaration.
	* manual/install.texi (Configuring and compiling): Document
	--disable-werror.
	* INSTALL: Regenerated.
	* debug/Makefile (CFLAGS-tst-chk1.c): Add -Wno-error.
	(CFLAGS-tst-chk2.c): Likewise.
	(CFLAGS-tst-chk3.c): Likewise.
	(CFLAGS-tst-chk4.cc): Likewise.
	(CFLAGS-tst-chk5.cc): Likewise.
	(CFLAGS-tst-chk6.cc): Likewise.
	(CFLAGS-tst-lfschk1.c): Likewise.
	(CFLAGS-tst-lfschk2.c): Likewise.
	(CFLAGS-tst-lfschk3.c): Likewise.
	(CFLAGS-tst-lfschk4.cc): Likewise.
	(CFLAGS-tst-lfschk5.cc): Likewise.
	(CFLAGS-tst-lfschk6.cc): Likewise.
2014-12-10 01:14:48 +00:00
Siddhesh Poyarekar 279bc5b3c3 Use MODULE_NAME in stap-probe instead of IN_LIB
Define MODULE_NAME in the build command and define IN_MODULE using
MODULE_NAME.  Verified that the generated code is unchanged on x86_64.

	* Makeconfig (module-cppflags-real): Define MODULE_NAME
	instead of IN_MODULE.
	* include/libc-symbols.h (IN_MODULE): Define using
	MODULE_NAME.
	(PASTE_NAME, PASTE_NAME1): New macros.
	* include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead
	of IN_LIB.
	(STAP_PROBE_ASM): Likewise.
2014-11-24 11:41:42 +05:30
Siddhesh Poyarekar 130ac68ca2 Auto-generate libc-modules.h
Remove libc-modules.h from the tree and auto-generate it from
soversions.i and the list of modules in the built-modules variable
defined in Makeconfig.  Macros generated have increasing numbered
values, with built-modules having lower values starting from 1,
following which a separator value LIBS_BEGIN is added and then finally
the library names from soversions.i are appended to the list.  This
allows us to conveniently differentiate between the versioned
libraries and other built modules, which is needed in errno.h and
netdb.h to decide whether to use an internal symbol or an external
one.

Verified that generated code remains unchanged on x86_64.

	* Makeconfig (built-modules): List non-library modules to be
	built.
	(module-cppflags): Include libc-modules.h for
	everything except shlib-versions.v.i.
	(CPPFLAGS): Use it.
	(before-compile): Add libc-modules.h.
	($(common-objpfx)libc-modules.h,
	$(common-objpfx)libc-modules.stmp): New targets.
	(common-generated): Add libc-modules.h and libc-modules.stmp.
	($(common-objpfx)Versions.v.i): Depend on libc-modules.h.
	* include/libc-symbols.h: Don't include libc-modules.h.
	* include/libc-modules.h: Remove file.
	* scripts/gen-libc-modules.awk: New script to generate
	libc-modules.h.
	* sysdeps/unix/Makefile ($(common-objpfx)sysd-syscalls):
	Depend on libc-modules.stmp.
2014-11-19 12:16:00 +05:30
Siddhesh Poyarekar 9cd4747089 Add new macro IN_MODULE to identify module in which source is built
The current scheme to identify which module a translation unit is
built in depends on defining multiple macros IS_IN_* and also defining
NOT_IN_libc if we're building a non-libc module.  In addition, there
is an IN_LIB macro that does effectively the same thing, but for
different modules (notably the systemtap probes).  This macro scheme
unifies both ideas to use just one macro IN_MODULE and assign it a
value depending on the module it is being built into.  If the module
is not defined, it defaults to MODULE_libc.

Patches that follow will replace uses of IS_IN_* variables with the
IS_IN() macro.  libc-symbols.h has been converted already to give an
example of how such a transition will look.

Verified that there are no relevant binary changes.  One source change
that will crop up repeatedly is that of nscd_stat, since it uses the
build timestamp as a constant in its logic.

	* Makeconfig (in-module): Get value of libof set for the
	translation unit.
	(CPPFLAGS): Use $(in-module).
	* Makerules: Don't suffix routine names for nonlib.
	* include/libc-modules.h: New file.
	* include/libc-symbols.h: Include libc-modules.h
	(IS_IN): New macro to replace IS_IN_* macros.
	* elf/Makefile: Set libof-* for each routine.
	* elf/rtld-Rules: Likewise.
	* extra-modules.mk: Likewise.
	* iconv/Makefile: Likewise.
	* iconvdata/Makefile: Likewise.
	* locale/Makefile: Likewise.
	* malloc/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* sysdeps/gnu/Makefile: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/Makefile: Likewise.
	* sysdeps/s390/s390-64/Makefile: Likewise.
	* nscd/Makefile: Set libof-* for each routine.  Set CFLAGS and
	CPPFLAGS for nscd instead of nonlib.
2014-11-19 12:13:54 +05:30
Joseph Myers 93ae1ebaa6 Clean up gnu/lib-names.h generation (bug 14171).
This patch eliminates the mixture of SONAME information in
shlib-versions files and SONAME information used to generate
gnu/lib-names.h in makefiles, with the information in the makefiles
being removed so all this information comes from the shlib-versions
files.

So that gnu/lib-names.h supports multiple ABIs, it is changed to be
generated on the same basis as gnu/stubs.h: when there are multiple
ABIs, gnu/lib-names.h is a wrapper header (the same header installed
whatever ABI is being built) and separate headers such as
gnu/lib-names-64.h contain the substantive contents (only one such
header being installed by any glibc build).

The rules for building gnu/lib-names.h were moved from Makeconfig to
Makerules because they need to come after sysdeps makefiles are
included (now that "ifndef abi-variants" is a toplevel conditional on
the rules rather than $(abi-variants) being evaluated later inside the
commands for a rule).

Tested for x86_64 and x86 that the installed shared libraries are
unchanged by this patch, and examined the installed gnu/lib-names*.h
headers by hand.  Also tested the case of a single ABI (where there is
just a single header installed, again like stubs.h) by hacking
abi-variants to empty for x86_64.

	[BZ #14171]
	* Makeconfig [$(build-shared) = yes]
	($(common-objpfx)soversions.mk): Don't handle SONAMEs specified in
	makefiles.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	($(common-objpfx)gnu/lib-names.h): Remove rule.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	($(common-objpfx)gnu/lib-names.stmp): Likewise.  Split and moved
	to Makerules.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	(before-compile): Don't append $(common-objpfx)gnu/lib-names.h
	here.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	(common-generated): Don't append gnu/lib-names.h and
	gnu/lib-names.stmp here.
	* Makerules [$(build-shared) = yes && $(soversions.mk-done) = t]
	(lib-names-h-abi): New variable.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	(lib-names-stmp-abi): Likewise.
	[$(build-shared) = yes && $(soversions.mk-done) = t &&
	abi-variants] (before-compile): Append
	$(common-objpfx)$(lib-names-h-abi).
	[$(build-shared) = yes && $(soversions.mk-done) = t &&
	abi-variants] (common-generated): Append gnu/lib-names.h.
	[$(build-shared) = yes && $(soversions.mk-done) = t &&
	abi-variants] (install-others-nosubdir): Depend on
	$(inst_includedir)/$(lib-names-h-abi).
	[$(build-shared) = yes && $(soversions.mk-done) = t &&
	abi-variants] ($(common-objpfx)gnu/lib-names.h): New rule.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	($(common-objpfx)$(lib-names-h-abi)): New rule.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	($(common-objpfx)$(lib-names-stmp-abi)): Likewise.
	[$(build-shared) = yes && $(soversions.mk-done) = t]
	(common-generated): Append $(lib-names-h-abi) and
	$(lib-names-stmp-abi).
	* scripts/lib-names.awk: Do not handle multi being set.
	* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-lp64-ld-soname):
	Remove variable.
	(abi-lp64_be-ld-soname): Likewise.
	* sysdeps/unix/sysv/linux/arm/Makefile (abi-soft-ld-soname):
	Likewise.
	(abi-hard-ld-soname): Likewise.
	* sysdeps/unix/sysv/linux/i386/shlib-versions: New file.
	* sysdeps/unix/sysv/linux/mips/Makefile (abi-o32_soft-ld-soname):
	Remove variable.
	(abi-o32_hard-ld-soname): Likewise.
	(abi-o32_soft_2008-ld-soname): Likewise.
	(abi-o32_hard_2008-ld-soname): Likewise.
	(abi-n32_soft-ld-soname): Likewise.
	(abi-n32_hard-ld-soname): Likewise.
	(abi-n32_soft_2008-ld-soname): Likewise.
	(abi-n32_hard_2008-ld-soname): Likewise.
	(abi-n64_soft-ld-soname): Likewise.
	(abi-n64_hard-ld-soname): Likewise.
	(abi-n64_soft_2008-ld-soname): Likewise.
	(abi-n64_hard_2008-ld-soname): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/Makefile (abi-64-v1-ld-soname):
	Likewise.
	(abi-64-v2-ld-soname): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions: Add
	ld.so entries.
	* sysdeps/unix/sysv/linux/s390/Makefile (abi-64-ld-soname): Remove
	variable.
	* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Add ld.so
	entry.
	* sysdeps/unix/sysv/linux/x86/Makefile (abi-32-ld-soname): Remove
	variable.
	(abi-64-ld-soname): Likewise.
	(abi-x32-ld-soname): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Add ld.so
	entry.
	* sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise.
2014-09-26 17:33:04 +00:00
Joseph Myers af296fcdab Remove bitrotten --enable-oldest-abi (bug 6652).
This patch removes the --enable-oldest-abi configure option, which has
long been bitrotten (as reported in bug 6652).  The principle of
removing this option was agreed in the thread starting at
<https://sourceware.org/ml/libc-alpha/2013-07/msg00174.html>.

Tested for x86_64 and x86 that the installed shared libraries other
than libc.so are unchanged by this patch and that libc.so disassembly
and symbol versions are unchanged (debug info changes because of
changed line numbers in csu/version.c).

	[BZ #6652]
	* Makeconfig (soversions-default-setname): Remove variable.
	($(common-objpfx)soversions.i): Don't pass default_setname to
	soversions.awk.
	* Makerules ($(common-objpfx)abi-versions.h): Don't pass
	oldest_abi to abi-versions.awk.
	* config.h.in (GLIBC_OLDEST_ABI): Remove macro undefine.
	* config.make.in (oldest-abi): Remove variable.
	* configure.ac (--enable-oldest-abi): Remove configure option.
	* configure: Regenerated.
	* csu/version.c (banner) [GLIBC_OLDEST_ABI]: Remove conditional
	text.
	* scripts/abi-versions.awk: Do not handle oldest_abi variable.
	* scripts/soversions.awk: Do not handle default_setname variable.
	* sysdeps/mach/hurd/configure.ac: Do not handle oldest_abi
	variable.
	* sysdeps/mach/hurd/configure: Regenerated.
	* sysdeps/unix/sysv/linux/configure.ac: Do not handle oldest_abi
	variable.
	* sysdeps/unix/sysv/linux/configure: Regenerated.
2014-09-16 17:45:03 +00:00
Joseph Myers ba90e05052 Remove configuration name patterns from shlib-versions.
This patch removes the first column (patterns matching configuration
names) from shlib-versions, leaving shlib-versions entry selection
based purely on sysdeps directories.

An implication of this removal is that the default for any non-Linux
ports using NPTL will be the same SONAMEs for NPTL libraries as for
Linux (as those defaults, previously limited to .*-.*-linux.*, are
left in nptl/shlib-versions and nptl_db/shlib-versions).

Special host_os handling in configure.ac that was purely for
shlib-versions is removed.  (The host_os setting is still used for
libc-abis - see
<https://sourceware.org/ml/libc-alpha/2014-01/msg00375.html> regarding
that - but no entries there are affected by this change.)

Tested on x86_64 and x86 that the installed shared libraries are
unchanged by this patch.

	* scripts/soversions.awk: Do not handle configuration names.
	* Makeconfig ($(common-objpfx)soversions.i): Do not pass cpu,
	vendor and os variables to soversions.awk.
	* configure.ac: Do not modify gnu-* host_os.
	* configure: Regenerated
	* shlib-versions: Remove first column with configuration names.
	* nptl/shlib-versions: Likewise.
	* nptl_db/shlib-versions: Likewise.
	* sysdeps/hppa/shlib-versions: Likewise.
	* sysdeps/m68k/shlib-versions: Likewise.
	* sysdeps/mach/hurd/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/alpha/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/arm/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/hppa/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/ia64/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/mips/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/sh/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/tile/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise.

libidn/ChangeLog:
	* shlib-versions: Remove first column with configuration names.
2014-09-12 12:28:47 +00:00
Florian Weimer e6fb95871c Turn on -Werror=implicit-function-declaration
GCC 4.4, the minimum compiler version, supports this option.  Unlike
other warnings, -Wimplicit-function-declaration warnings should be
independent of compiler versions, so this change should not cause
compiler-specific build failures.
2014-09-10 08:13:06 +02:00
Joseph Myers f1eafb41fa Remove shlib-versions ABI names support.
shlib-versions files can contain ABI lines that map triplets to a
canonical ABI name.  This name was once used for various purposes
where test baseline files for different ABIs went in a single
directory; now these purposes use sysdeps files, generation of headers
which have per-ABI variants uses abi-variants and related Makefile
variables and the shlib-versions ABI names are unused.  This patch
duly removes those lines and associated build system support for them.

Tested for x86_64 (both a full testsuite run and confirming the
installed shared libraries are unchanged by the patch).

	* Makeconfig ($(common-objpfx)soversions.mk): Do not generate
	abi-name definition.
	* scripts/soversions.awk: Do not handle or generate ABI lines.
	* shlib-versions: Remove ABI entries.
	* sysdeps/powerpc/nofpu/shlib-versions: Remove file.
	* sysdeps/x86_64/x32/shlib-versions: Remove ABI entry.
2014-06-27 20:24:23 +00:00
Joseph Myers 8540f6d2a7 Don't require test wrappers to preserve environment variables, use more consistent environment.
One wart in the original support for test wrappers for cross testing,
as noted in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00722.html>, is the
requirement for test wrappers to pass a poorly-defined set of
environment variables from the build system to the system running the
glibc under test.  Although some variables are passed explicitly via
$(test-wrapper-env), including LD_* variables that simply can't be
passed implicitly because of the side effects they'd have on the build
system's dynamic linker, others are passed implicitly, including
variables such as GCONV_PATH and LOCPATH that could potentially affect
the build system's libc (so effectively relying on any such effects
not breaking the wrappers).  In addition, the code in
cross-test-ssh.sh for preserving environment variables is fragile (it
depends on how bash formats a list of exported variables, and could
well break for multi-line variable definitions where the contents
contain things looking like other variable definitions).

This patch moves to explicitly passing environment variables via
$(test-wrapper-env).  Makefile variables that previously used
$(test-wrapper) are split up into -before-env and -after-env parts
that can be passed separately to the various .sh files used in
testing, so those files can then insert environment settings between
the two parts.

The common default environment settings in make-test-out are made into
a separate makefile variable that can also be passed to scripts,
rather than many scripts duplicating those settings (for testing an
installed glibc, it is desirable to have the GCONV_PATH setting on
just one place, so just that one place needs to support it pointing to
an installed sysroot instead of the build tree).  The default settings
are included in the variables such as $(test-program-prefix), so that
if tests do not need any non-default settings they can continue to use
single variables rather than the split-up variables.

Although this patch cleans up LC_ALL=C settings (that being part of
the common defaults), various LANG=C and LANGUAGE=C settings remain.
Those are generally unnecessary and I propose a subsequent cleanup to
remove them.  LC_ALL takes precedence over LANG, and while LANGUAGE
takes precedence over LC_ALL, it only does so for settings other than
LC_ALL=C.  So LC_ALL=C on its own is sufficient to ensure the C
locale, and anything that gets LC_ALL=C does not need the other
settings.

While preparing this patch I noticed some tests with .sh files that
appeared to do nothing beyond what the generic makefile support for
tests can do (localedata/tst-wctype.sh - the makefiles support -ENV
variables and .input files - and localedata/tst-mbswcs.sh - just runs
five tests that could be run individually from the makefile).  So I
propose another subsequent cleanup to move those to using the generic
support instead of special .sh files.

Tested x86_64 (native) and powerpc32 (cross).

	* Makeconfig (run-program-env): New variable.
	(run-program-prefix-before-env): Likewise.
	(run-program-prefix-after-env): Likewise.
	(run-program-prefix): Define in terms of new variables.
	(built-program-cmd-before-env): New variable.
	(built-program-cmd-after-env): Likewise.
	(built-program-cmd): Define in terms of new variables.
	(test-program-prefix-before-env): New variable.
	(test-program-prefix-after-env): Likewise.
	(test-program-prefix): Define in terms of new variables.
	(test-program-cmd-before-env): New variable.
	(test-program-cmd-after-env): Likewise.
	(test-program-cmd): Define in terms of new variables.
	* Rules (make-test-out): Use $(run-program-env).
	* scripts/cross-test-ssh.sh (env_blacklist): Remove variable.
	(help): Do not mention environment variables.  Mention
	--timeoutfactor option.
	(timeoutfactor): New variable.
	(blacklist_exports): Remove function.
	(exports): Remove variable.
	(command): Do not include ${exports}.
	* manual/install.texi (Configuring and compiling): Do not mention
	test wrappers preserving environment variables.  Mention that last
	assignment to a variable must take precedence.
	* INSTALL: Regenerated.
	* benchtests/Makefile (run-bench): Use $(run-program-env).
	* catgets/Makefile ($(objpfx)test1.cat): Use
	$(built-program-cmd-before-env), $(run-program-env) and
	$(built-program-cmd-after-env).
	($(objpfx)test2.cat): Do not specify environment variables
	explicitly.
	($(objpfx)de/libc.cat): Use $(built-program-cmd-before-env),
	$(run-program-env) and $(built-program-cmd-after-env).
	($(objpfx)test-gencat.out): Use $(test-program-cmd-before-env),
	$(run-program-env) and $(test-program-cmd-after-env).
	($(objpfx)sample.SJIS.cat): Do not specify environment variables
	explicitly.
	* catgets/test-gencat.sh: Use test_program_cmd_before_env,
	run_program_env and test_program_cmd_after_env arguments.
	* elf/Makefile ($(objpfx)tst-pathopt.out): Use $(run-program-env).
	* elf/tst-pathopt.sh: Use run_program_env argument.
	* iconvdata/Makefile ($(objpfx)iconv-test.out): Use
	$(test-wrapper-env) and $(run-program-env).
	* iconvdata/run-iconv-test.sh: Use test_wrapper_env and
	run_program_env arguments.
	* iconvdata/tst-table.sh: Do not set GCONV_PATH explicitly.
	* intl/Makefile ($(objpfx)tst-gettext.out): Use
	$(test-program-prefix-before-env), $(run-program-env) and
	$(test-program-prefix-after-env).
	($(objpfx)tst-gettext2.out): Likewise.
	* intl/tst-gettext.sh: Use test_program_prefix_before_env,
	run_program_env and test_program_prefix_after_env arguments.
	* intl/tst-gettext2.sh: Likewise.
	* intl/tst-gettext4.sh: Do not set environment variables
	explicitly.
	* intl/tst-gettext6.sh: Likewise.
	* intl/tst-translit.sh: Likewise.
	* malloc/Makefile ($(objpfx)tst-mtrace.out): Use
	$(test-program-prefix-before-env), $(run-program-env) and
	$(test-program-prefix-after-env).
	* malloc/tst-mtrace.sh: Use test_program_prefix_before_env,
	run_program_env and test_program_prefix_after_env arguments.
	* math/Makefile (run-regen-ulps): Use $(run-program-env).
	* nptl/Makefile ($(objpfx)tst-tls6.out): Use $(run-program-env).
	* nptl/tst-tls6.sh: Use run_program_env argument.  Set LANG=C
	explicitly with each use of ${test_wrapper_env}.
	* posix/Makefile ($(objpfx)wordexp-tst.out): Use
	$(test-program-prefix-before-env), $(run-program-env) and
	$(test-program-prefix-after-env).
	* posix/tst-getconf.sh: Do not set environment variables
	explicitly.
	* posix/wordexp-tst.sh: Use test_program_prefix_before_env,
	run_program_env and test_program_prefix_after_env arguments.
	* stdio-common/tst-printf.sh: Do not set environment variables
	explicitly.
	* stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Use
	$(test-program-prefix-before-env), $(run-program-env) and
	$(test-program-prefix-after-env).
	* stdlib/tst-fmtmsg.sh: Use test_program_prefix_before_env,
	run_program_env and test_program_prefix_after_env arguments.
	Split $test calls into $test_pre and $test.
	* timezone/Makefile (build-testdata): Use
	$(built-program-cmd-before-env), $(run-program-env) and
	$(built-program-cmd-after-env).

localedata/ChangeLog:
	* Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use
	$(built-program-cmd-before-env), $(run-program-env) and
	$(built-program-cmd-after-env).
	($(objpfx)sort-test.out): Use $(test-program-prefix-before-env),
	$(run-program-env) and $(test-program-prefix-after-env).
	($(objpfx)tst-fmon.out): Use $(run-program-prefix-before-env),
	$(run-program-env) and $(run-program-prefix-after-env).
	($(objpfx)tst-locale.out): Use $(built-program-cmd-before-env),
	$(run-program-env) and $(built-program-cmd-after-env).
	($(objpfx)tst-trans.out): Use $(run-program-prefix-before-env),
	$(run-program-env), $(run-program-prefix-after-env),
	$(test-program-prefix-before-env) and
	$(test-program-prefix-after-env).
	($(objpfx)tst-ctype.out): Use $(test-program-cmd-before-env),
	$(run-program-env) and $(test-program-cmd-after-env).
	($(objpfx)tst-wctype.out): Likewise.
	($(objpfx)tst-langinfo.out): Likewise.
	($(objpfx)tst-langinfo-static.out): Likewise.
	* gen-locale.sh: Use localedef_before_env, run_program_env and
	localedef_after_env arguments.
	* sort-test.sh: Use test_program_prefix_before_env,
	run_program_env and test_program_prefix_after_env arguments.
	* tst-ctype.sh: Use tst_ctype_before_env, run_program_env and
	tst_ctype_after_env arguments.
	* tst-fmon.sh: Use run_program_prefix_before_env, run_program_env
	and run_program_prefix_after_env arguments.
	* tst-langinfo.sh: Use tst_langinfo_before_env, run_program_env
	and tst_langinfo_after_env arguments.
	* tst-locale.sh: Use localedef_before_env, run_program_env and
	localedef_after_env arguments.
	* tst-mbswcs.sh: Do not set environment variables explicitly.
	* tst-numeric.sh: Likewise.
	* tst-rpmatch.sh: Likewise.
	* tst-trans.sh: Use run_program_prefix_before_env,
	run_program_env, run_program_prefix_after_env,
	test_program_prefix_before_env and test_program_prefix_after_env
	arguments.
	* tst-wctype.sh: Use tst_wctype_before_env, run_program_env and
	tst_wctype_after_env arguments.
2014-06-06 22:19:27 +00:00
Joseph Myers 4134b50d67 Consistently use $(elf-objpfx).
As previously noted
<https://sourceware.org/ml/libc-alpha/2013-05/msg00696.html>,
$(elf-objpfx) and $(elfobjdir) are redundant and should be
consolidated.  This patch consolidates on $(elf-objpfx) (for
consistency with $(csu-objpfx)), also changing direct uses of
$(common-objpfx)elf/ to use $(elf-objpfx).

Tested x86_64, including that installed shared libraries are unchanged
by the patch.

	* Makeconfig [$(build-hardcoded-path-in-tests) = yes]
	(rtld-tests-LDFLAGS): Use $(elf-objpfx) instead of
	$(common-objpfx)elf/.
	(link-libc-before-gnulib): Likewise.
	(elfobjdir): Remove variable.
	* Makefile (install): Use $(elf-objpfx) instead of
	$(common-objpfx)elf/.
	* Makerules (link-libc-args): Use $(elf-objpfx) instead of
	$(elfobjdir)/.
	(link-libc-deps): Likewise.
	($(common-objpfx)libc.so): Likewise.
	($(common-objpfx)linkobj/libc.so): Likewise.
	[$(cross-compiling) = no] (symbolic-link-prog): Use $(elf-objpfx)
	instead of $(common-objpfx)elf/.
	(symbolic-link-list): Likewise.
	* iconvdata/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Likewise.
	* sysdeps/arm/Makefile (gnulib-arch): Use $(elf-objpfx) instead of
	$(elfobjdir)/.
	(static-gnulib-arch): Likewise.
	* sysdeps/s390/s390-64/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Use $(elf-objpfx) instead of
	$(common-objpfx)elf/.

localedata/ChangeLog:
	* Makefile (LOCALEDEF): Use $(elf-objpfx) instead of
	$(common-objpfx)elf/.
2014-05-21 16:52:08 +00:00
Roland McGrath 95afbbe5fc Some configure-related decrufting. 2014-05-08 11:27:14 -07:00