Commit Graph

225 Commits

Author SHA1 Message Date
Florian Weimer 89baed0b93 Revert "Detect ld.so and libc.so version inconsistency during startup"
This reverts commit 6f85dbf102.

Once this change hits the release branches, it will require relinking
of all statically linked applications before static dlopen works
again, for the majority of updates on release branches: The NEWS file
is regularly updated with bug references, so the __libc_early_init
suffix changes, and static dlopen cannot find the function anymore.

While this ABI check is still technically correct (we do require
rebuilding & relinking after glibc updates to keep static dlopen
working), it is too drastic for stable release branches.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-25 18:46:43 +02:00
Florian Weimer 6f85dbf102 Detect ld.so and libc.so version inconsistency during startup
The files NEWS, include/link.h, and sysdeps/generic/ldsodefs.h
contribute to the version fingerprint used for detection.  The
fingerprint can be further refined using the --with-extra-version-id
configure argument.

_dl_call_libc_early_init is replaced with _dl_lookup_libc_early_init.
The new function is used store a pointer to libc.so's
__libc_early_init function in the libc_map_early_init member of the
ld.so namespace structure.  This function pointer can then be called
directly, so the separate invocation function is no longer needed.

The versioned symbol lookup needs the symbol versioning data
structures, so the initialization of libc_map and libc_map_early_init
is now done from _dl_check_map_versions, after this information
becomes available.  (_dl_map_object_from_fd does not set this up
in time, so the initialization code had to be moved from there.)
This means that the separate initialization code can be removed from
dl_main because _dl_check_map_versions covers all maps, including
the initial executable loaded by the kernel.  The lookup still happens
before relocation and the invocation of IFUNC resolvers, so IFUNC
resolvers are protected from ABI mismatch.

The __libc_early_init function pointer is not protected because
so little code runs between the pointer write and the invocation
(only dynamic linker code and IFUNC resolvers).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-24 17:35:57 +02:00
Adhemerval Zanella f39ff483f3 Remove configure fno_unit_at_a_time
Since it is not used any longer.

Reviewed-by: Fangrui Song <maskray@google.com>
2022-05-13 10:54:41 -03:00
Florian Weimer e47de5cb2d Do not use --hash-style=both for building glibc shared objects
The comment indicates that --hash-style=both was used to maintain
compatibility with static dlopen, but we had many internal ABI
changes since then, so this compatiblity does not add value anymore.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-04-29 16:37:51 +02:00
Fangrui Song 3ee318c923 Remove -z combreloc and HAVE_Z_COMBRELOC
-z combreloc has been the default regadless of the architecture since
binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The
configure check added in commit fdde83499a (2001) has long been
unneeded.

We can therefore treat HAVE_Z_COMBRELOC as always 1 and delete dead code
paths in dl-machine.h files (many were copied from commit a711b01d34
and ee0cb67ec2).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-04-04 17:19:07 -07:00
Florian Weimer 9ba202c78f Add --with-rtld-early-cflags configure option
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-01-14 20:17:15 +01:00
Siddhesh Poyarekar 23645707f1 Replace --enable-static-pie with --disable-default-pie
Build glibc programs and tests as PIE by default and enable static-pie
automatically if the architecture and toolchain supports it.

Also add a new configuration option --disable-default-pie to prevent
building programs as PIE.

Only the following architectures now have PIE disabled by default
because they do not work at the moment.  hppa, ia64, alpha and csky
don't work because the linker is unable to handle a pcrel relocation
generated from PIE objects.  The microblaze compiler is currently
failing with an ICE.  GNU hurd tries to enable static-pie, which does
not work and hence fails.  All these targets have default PIE disabled
at the moment and I have left it to the target maintainers to enable PIE
on their targets.

build-many-glibcs runs clean for all targets.  I also tested x86_64 on
Fedora and Ubuntu, to verify that the default build as well as
--disable-default-pie work as expected with both system toolchains.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-12-13 08:08:59 +05:30
Florian Weimer ad201afe5c Add pthread-in-libc, libpthread-routines-var, librt-routines-var
These make variables can be used to add routines to different
libraries for the Hurd and Linux builds.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-05-03 08:13:32 +02:00
Fangrui Song 87d583c6e8 install: Replace scripts/output-format.sed with objdump -f [BZ #26559]
GNU ld and gold have supported --print-output-format since 2011. glibc
requires binutils>=2.25 (2015), so if LD is GNU ld or gold, we can
assume the option is supported.

lld is by default a cross linker supporting multiple targets. It auto
detects the file format and does not need OUTPUT_FORMAT. It does not
support --print-output-format.

By parsing objdump -f, we can support all the three linkers.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-11 12:03:36 -08:00
Richard Earnshaw 3378408987 config: Allow memory tagging to be enabled when configuring glibc
This patch adds the configuration machinery to allow memory tagging to be
enabled from the command line via the configure option --enable-memory-tagging.

The current default is off, though in time we may change that once the API
is more stable.
2020-12-21 15:25:25 +00:00
Petr Vorel 5500cdba40 Remove --enable-obsolete-rpc configure flag
Sun RPC was removed from glibc. This includes rpcgen program, librpcsvc,
and Sun RPC headers. Also test for bug #20790 was removed
(test for rpcgen).

Backward compatibility for old programs is kept only for architectures
and ABIs that have been added in or before version 2.28.

libtirpc is mature enough, librpcsvc and rpcgen are provided in
rpcsvc-proto project.

NOTE: libnsl code depends on Sun RPC (installed libnsl headers use
installed Sun RPC headers), thus --enable-obsolete-rpc was a dependency
for --enable-obsolete-nsl (removed in a previous commit).

The arc ABI list file has to be updated because the port was added
with the sunrpc symbols

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-13 19:36:35 +02:00
Petr Vorel ae7a94e5e3 Remove --enable-obsolete-nsl configure flag
this means that *always* libnsl is only built as shared library for
backward compatibility and the NSS modules libnss_nis and libnss_nisplus
are not built at all, libnsl's headers aren't installed.

This compatibility is kept only for architectures and ABIs that have
been added in or before version 2.28.

Replacement implementations based on TIRPC, which additionally support
IPv6, are available from <https://github.com/thkukuk/>.

This change does not affect libnss_compat which does not depended
on libnsl since 2.27 and thus can be used without NIS.

libnsl code depends on Sun RPC, e.g. on --enable-obsolete-rpc (installed
libnsl headers use installed Sun RPC headers), which will be removed in
the following commit.
2020-07-08 17:25:57 +02:00
Adhemerval Zanella 91f043ae84 Make --bindir effective
This allows sets a path using --bindir.  Checked on x86_64-linux-gnu
with a non-default --bindir and checked resulting installed binaries
(pldd for instance).

	* config.make.in (bindir): New variable.

Reviewed-by: DJ Delorie <dj@redhat.com>
2019-05-14 11:04:33 -03:00
Adhemerval Zanella b5c45e8375 Fix ifunc support with DT_TEXTREL segments (BZ#20480)
Currently, DT_TEXTREL is incompatible with IFUNC.  When DT_TEXTREL or
DF_TEXTREL is seen, the dynamic linker calls __mprotect on the segments
with PROT_READ|PROT_WRITE before applying dynamic relocations. It leads
to segfault when performing IFUNC resolution (which requires PROT_EXEC
as well for the IFUNC resolver).

This patch makes it call __mprotect with extra PROT_WRITE bit, which
will keep the PROT_EXEC bit if exists, and thus fixes the segfault.
FreeBSD rtld libexec/rtld-elf/rtld.c (reloc_textrel_prot) does the same.

Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
sparc64-linux-gnu, sparcv9-linux-gnu, and armv8-linux-gnueabihf.

	Adam J. Richte  <adam_richter2004@yahoo.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Fangrui Song  <maskray@google.com>

	[BZ #20480]
	* config.h.in (CAN_TEXTREL_IFUNC): New define.
	* configure.ac: Add check if linker supports textrel relocation with
	ifunc.
	* elf/dl-reloc.c (_dl_relocate_object): Use all required flags on
	DT_TEXTREL segments, not only PROT_READ and PROT_WRITE.
	* elf/Makefile (ifunc-pie-tests): Add tst-ifunc-textrel.
	(CFLAGS-tst-ifunc-textrel.c): New rule.
	* elf/tst-ifunc-textrel.c: New file.
2018-09-25 16:27:50 -03:00
Florian Weimer 6413fcde4f Add --with-nonshared-cflags option to configure 2018-08-17 11:44:39 +02:00
Zack Weinberg e69d994a63 New configure option --disable-crypt.
Some Linux distributions are experimenting with a new, separately
maintained and hopefully more agile implementation of the crypt
API.  To facilitate this, add a configure option which disables
glibc's embedded libcrypt.  When this option is given, libcrypt.*
and crypt.h will not be built nor installed.
2018-06-29 16:53:47 +02:00
H.J. Lu 00c714df39 Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
After --enable-static-pie is added to configure, libc_cv_pie_default is
set to yes when either --enable-static-pie is used to configure glibc
or GCC defaults to PIE.  We should set no-pie-ldflag to -no-pie, which
is supported on GCC 6 and later, only if GCC defaults to PIE, not when
--enable-static-pie is used to configure glibc.

Tested on x32 with --enable-static-pie using GCC 5 and without
--enable-static-pie using GCC 7.

	[BZ #22614]
	* Makeconfig (no-pie-ldflag): Set to -no-pie only if
	$(cc-pie-default) == yes.
	* config.make.in (cc-pie-default): New.
	* configure.ac (libc_cv_pie_default): Renamed to ...
	(libc_cv_cc_pie_default): This.
	(libc_cv_pie_default): Set to $libc_cv_cc_pie_default.
	* configure: Regenerated.
2017-12-18 12:24:38 -08:00
Joseph Myers 8df5d34720 Remove --with-fp / --without-fp.
There is a configure option --without-fp that specifies that nofpu
sysdeps directories should be used instead of fpu directories.

For most glibc configurations, this option is of no use: either there
is no valid nofpu variant of that configuration, or there are no fpu
or nofpu sysdeps directories for that processor and so the option does
nothing.  For a few configurations, if you are using a soft-float
compiler this option is required, and failing to use it generally
results in compilation errors from inline asm using unavailable
floating-point instructions.

We're moving away from --with-cpu to configuring glibc based on how
the compiler generates code, and it is natural to do so for
--without-fp as well; in most cases the soft-float and hard-float ABIs
are incompatible so you have no hope of building a working glibc with
an inappropriately configured compiler or libgcc.

This patch eliminates --without-fp, replacing it entirely by automatic
configuration based on the compiler.  Configurations for which this is
relevant (coldfire / mips / powerpc32 / sh) define a variable
with_fp_cond in their preconfigure fragments (under the same
conditions under which those fragments do anything); this is a
preprocessor conditional which the toplevel configure script then uses
in a test to determine which sysdeps directories to use.

The config.make with-fp variable remains.  It's used only by powerpc
(sysdeps/powerpc/powerpc32/Makefile) to add -mhard-float to various
flags variables.  For powerpc, -mcpu= options can imply use of
soft-float.  That could be an issue if you want to build for
e.g. 476fp, but are using --with-cpu=476 because there isn't a 476fp
sysdeps directory.  If in future we eliminate --with-cpu and replace
it entirely by testing the compiler, it would be natural at that point
to eliminate that code as well (as the user should then just use a
compiler defaulting to 476fp and the 476 sysdeps directory would be
used automatically).

Tested for x86_64, and tested with build-many-glibcs.py that installed
shared libraries are unchanged by this patch.

	* configure.ac (--with-fp): Remove configure option.
	(with_fp_cond): New variable.
	(libc_cv_with_fp): New configure test.  Use this variable instead
	of with_fp.
	* configure: Regenerated.
	* config.make.in (with-fp): Use @libc_cv_with_fp@.
	* manual/install.texi (Configuring and compiling): Remove
	--without-fp.
	* INSTALL: Regenerated.
	* sysdeps/m68k/preconfigure (with_fp_cond): Define for ColdFire.
	* sysdeps/mips/preconfigure (with_fp_cond): Define.
	* sysdeps/powerpc/preconfigure (with_fp_cond): Define for 32-bit.
	* sysdeps/sh/preconfigure (with_fp_cond): Define.
	* scripts/build-many-glibcs.py (Context.add_all_configs): Do not
	use --without-fp to configure glibc.
2017-12-12 13:56:47 +00:00
Rogerio Alves 07ed18d26a Add elision tunables
This patch adds several new tunables to control the behavior of
elision on supported platforms[1].   Since elision now depends
on tunables, we should always *compile* with elision enabled,
and leave the code disabled, but available for runtime
selection.  This gives us *much* better compile-time testing of
the existing code to avoid bit-rot[2].

Tested on ppc, ppc64, ppc64le, s390x and x86_64.

[1] This part of the patch was initially proposed by
Paul Murphy but was "staled" because the framework have changed
since the patch was originally proposed:

https://patchwork.sourceware.org/patch/10342/

[2] This part of the patch was inititally proposed as a RFC by
Carlos O'Donnell.  Make sense to me integrate this on the patch:

https://sourceware.org/ml/libc-alpha/2017-05/msg00335.html

	* elf/dl-tunables.list: Add elision parameters.
	* manual/tunables.texi: Add entries about elision tunable.
	* sysdeps/unix/sysv/linux/powerpc/elision-conf.c:
	Add callback functions to dynamically enable/disable elision.
	Add multiple callbacks functions to set elision parameters.
	Deleted __libc_enable_secure check.
	* sysdeps/unix/sysv/linux/s390/elision-conf.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/elision-conf.c: Likewise.
	* configure: Regenerated.
	* configure.ac: Option enable_lock_elision was deleted.
	* config.h.in: ENABLE_LOCK_ELISION flag was deleted.
	* config.make.in: Remove references to enable_lock_elision.
	* manual/install.texi: Elision configure option was removed.
	* INSTALL: Regenerated to remove enable_lock_elision.
	* nptl/Makefile:
	Disable elision so it can verify error case for destroying a mutex.
	* sysdeps/powerpc/nptl/elide.h:
	Cleanup ENABLE_LOCK_ELISION check.
	Deleted macros for the case when ENABLE_LOCK_ELISION was not defined.
	* sysdeps/s390/configure: Regenerated.
	* sysdeps/s390/configure.ac: Remove references to enable_lock_elision..
	* nptl/tst-mutex8.c:
	Deleted all #ifndef ENABLE_LOCK_ELISION from the test.
	* sysdeps/powerpc/powerpc32/sysdep.h:
	Deleted all ENABLE_LOCK_ELISION checks.
	* sysdeps/powerpc/powerpc64/sysdep.h: Likewise.
	* sysdeps/powerpc/sysdep.h: Likewise.
	* sysdeps/s390/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/force-elision.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/elision-conf.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/force-elision.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/Makefile: Remove references to
	enable-lock-elision.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
2017-12-05 17:48:48 -02:00
H.J. Lu abcb584d0e Use newly built crt*.o files to build shared objects [BZ #22362]
When multi-lib GCC is used to build glibc, the search order of GCC driver
for crt*.o is -B*/`gcc -print-multi-directory`, the installed diretory,
-B*/.  This patch adds multi-lib support to csu/Makefile so that
-B/glibc-build-directory/csu/ will pick up the newly built crt*.o.

Tested on x86-64 for i686 and x32.

	[BZ #22362]
	* Makerules (make-link-multidir): New.
	* config.make.in (multidir): New.
	* configure.ac (libc_cv_multidir): New.  AC_SUBST.
	* configure: Regenerated.
	* csu/Makefile [$(multidir) != .](multilib-extra-objs): New.
	[$(multidir) != .](extra-objs): Add $(multilib-extra-objs).
	[$(multidir) != .]($(addprefix $(objpfx)$(multidir)/, $(install-lib))):
	New target.
2017-11-06 08:29:57 -08:00
Joseph Myers 644d38570a Remove add-ons mechanism.
glibc has an add-ons mechanism to allow additional software to be
integrated into the glibc build.  Such add-ons may be within the glibc
source tree, or outside it at a path passed to the --enable-add-ons
configure option.

localedata and crypt were once add-ons, distributed in separate
release tarballs, but long since stopped using that mechanism.
Linuxthreads was always an add-on.  Ports spent some time as an add-on
with separate release tarballs, then was first moved into the glibc
source tree, then had its sysdeps files moved into the main sysdeps
hierarchy so the add-ons mechanism was no longer used.  NPTL spent
some time as an add-on in the main glibc tree before stopping using
the add-on mechanism.  libidn used to have separate release tarballs
but no longer does so, but still uses the add-ons mechanism within the
glibc source tree.  Various other software has supported building with
the add-ons mechanism at times in the past, but I don't think any is
still widely used.

Add-ons involve significant, little-used complexity in the glibc build
system, and make it hard to understand what the space of possible
glibc configurations is.  This patch removes the add-ons mechanism.
libidn is now built via the Subdirs mechanism to cause any
configuration using sysdeps/unix/inet to build libidn; HAVE_LIBIDN
(which effectively means shared libraries are available) is now
defined via sysdeps/unix/inet/configure.  Various references to
add-ons around the source tree are removed (in the case of maint.texi,
the example list of sysdeps directories is still very out of date).

Externally maintained ports should now put their files in the normal
sysdeps directory structure rather than being arranged as add-ons;
they probably need to change e.g. elf.h anyway, rather than actually
being able to work just as a drop-in subtree.  Hurd libpthread should
be arranged similarly to NPTL, so some files might go in a
hurd-pthreads (or similar) top-level directory in glibc, while sysdeps
files should go in the normal sysdeps directory structure (possibly in
hurd or hurd-pthreads subdirectories, just as there are nptl
subdirectories in the sysdeps tree).

Tested for x86_64, and with build-many-glibcs.py.

	* configure.ac (--enable-add-ons): Remove option.
	(machine): Do not mention add-ons in comment.
	(LIBC_PRECONFIGURE): Likewise.
	(add_ons): Remove variable and sanity checks and logic to locate
	add-ons.
	(add_ons_automatic): Remove variable.
	(configured_add_ons): Likewise.
	(add_ons_sfx): Likewise.
	(add_ons_pfx): Likewise.
	(add_on_subdirs): Likewise.
	(sysnames_add_ons): Likewise.  Remove loop over add-ons and
	consideration of add-ons in Implies handling.
	(sysdeps_add_ons): Likewise.
	* configure: Regenerated.
	* libidn/configure.ac: Remove.
	* libidn/configure: Likewise.
	* sysdeps/unix/inet/configure.ac: New file.
	* sysdeps/unix/inet/configure: New generated file.
	* sysdeps/unix/inet/Subdirs: Add libidn.
	* Makeconfig (sysdeps-srcdirs): Remove variable.
	(+sysdep_dirs): Do not include $(sysdeps-srcdirs).
	($(common-objpfx)config.status): Do not depend on add-on files.
	($(common-objpfx)shlib-versions.v.i): Do not mention add-ons in
	comment.
	(all-subdirs): Do not include $(add-on-subdirs).
	* Makefile (dist-prepare): Do not use $(sysdeps-add-ons).
	* config.make.in (add-ons): Remove variable.
	(add-on-subdirs): Likewise.
	(sysdeps-add-ons): Likewise.
	* manual/Makefile (add-chapters): Remove.
	($(objpfx)texis): Do not depend on $(add-chapters).
	(nonexamples): Do not handle $(add-chapters).
	(examples): Do not handle $(add-ons).
	(chapters.% top-menu.%): Do not pass '$(add-chapters)' to
	libc-texinfo.sh.
	* manual/install.texi (Installation): Do not mention add-ons.
	(--enable-add-ons): Do not document configure option.
	* INSTALL: Regenerated.
	* manual/libc-texinfo.sh: Do not handle $2 add-ons argument.
	* manual/maint.texi (Hierarchy Conventions): Do not mention
	add-ons.
	* scripts/build-many-glibcs.py (Glibc.build_glibc): Do not use
	--enable-add-ons.
	* scripts/gen-sorted.awk: Do not handle Subdirs files from
	add-ons.
	* scripts/test-installation.pl: Do not handle glibc-compat add-on.
	* sysdeps/nptl/Makeconfig: Do not mention add-ons in comment.
2017-10-05 15:58:13 +00:00
Florian Weimer 6014c65de2 gmon: Add test for basic mcount/gprof functionality 2017-08-15 15:49:45 +02:00
H.J. Lu 19f1a11e7e Check linker support for INSERT in linker script
Since gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=21676

tst-split-dynreloc fails to link with gold.  Check if linker supports
INSERT in linker script before using it.

	* config.make.in (have-insert): New.
	* configure.ac (libc_cv_insert): New.  Set to yes if linker
	supports INSERT in linker script.
	(AC_SUBST(libc_cv_insert): New.
	* configure: Regenerated.
	* sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc only
	if $(have-insert) == yes.
2017-08-04 12:17:30 -07:00
DJ Delorie d5c3fafc43 Add per-thread cache to malloc
* config.make.in: Enable experimental malloc option.
* configure.ac: Likewise.
* configure: Regenerate.
* manual/install.texi: Document it.
* INSTALL: Regenerate.
* malloc/Makefile: Likewise.
* malloc/malloc.c: Add per-thread cache (tcache).
(tcache_put): New.
(tcache_get): New.
(tcache_thread_freeres): New.
(tcache_init): New.
(__libc_malloc): Use cached chunks if available.
(__libc_free): Initialize tcache if needed.
(__libc_realloc): Likewise.
(__libc_calloc): Likewise.
(_int_malloc): Prefill tcache when appropriate.
(_int_free): Likewise.
(do_set_tcache_max): New.
(do_set_tcache_count): New.
(do_set_tcache_unsorted_limit): New.
* manual/probes.texi: Document new probes.
* malloc/arena.c: Add new tcache tunables.
* elf/dl-tunables.list: Likewise.
* manual/tunables.texi: Document them.
* NEWS: Mention the per-thread cache.
2017-07-06 13:37:30 -04:00
H.J. Lu a65ea28d18 Make copy of <bits/std_abs.h> from GCC 7 [BZ #21573]
<bits/std_abs.h> from GCC 7 will include /usr/include/stdlib.h from
"#include_next" (instead of stdlib/stdlib.h in the glibc source
directory), and this turns up as a make dependency.  Also make a copy
of <bits/std_abs.h> to prevent it from including /usr/include/stdlib.h.

	[BZ #21573]
	* Makerules [$(c++-bits-std_abs-h) != ""] (before-compile): Add
	$(common-objpfx)bits/std_abs.h.
	[$(c++-bits-std_abs-h) != ""] ($(common-objpfx)bits/std_abs.h):
	New target.
	* config.make.in (c++-bits-std_abs-h): New.
	* configure.ac (find_cxx_header): Use "\,$1," with sed.
	(CXX_BITS_STD_ABS_H): New.
	(AC_SUBST(CXX_BITS_STD_ABS_H)): Likewise.
	* configure: Regenerated.
2017-06-13 10:53:45 -07:00
Thorsten Kukuk 1e4d83f6fe Deprecate libnsl by default (only shared library will be
build for backward compatibility, no linking possible) and disable building
of libnss_compat, libnss_nis and libnss_nisplus, except --enable-obsolete-nsl
option is given to configure.

        * config.h.in: Add LINK_OBSOLETE_NSL.
        * config.make.in: Add build-obsolete-nsl.
        * configure.ac: Add obsolete-nsl option.
        * include/libc-symbols.h: Define libnsl_hidden_nolink_def.
        * include/rpcsvc/yp.h: Add missing functions as libnsl_hidden_proto.
        * include/rpcsvc/nislib.h: Likewise.
        * include/rpcsvc/ypclnt.h: Likewise.
        * manual/install.texi: Document --enable-obsolete-nsl.
        * nis/Makefile: Build only libnsl by default (add build-obsolete-nsl).
        * nis/nis_add.c: Replace libnsl_hidden_def with
        libnsl_hidden_nolink_def.
        * nis/nis_addmember.c: Likewise.
        * nis/nis_call.c: Likewise.
        * nis/nis_clone_obj.c: Likewise.
        * nis/nis_defaults.c: Likeise.
        * nis/nis_domain_of_r.c: Likewise.
        * nis/nis_error.c: Likewise.
        * nis/nis_file.c: Likewise.
        * nis/nis_free.c: Likewise.
        * nis_local_names.c: Likewise.
        * nis/nis_lookup.c: Likewise.
        * nis/nis_modify.c: Likewise.
        * nis/nis_print.c: Likewise.
        * nis/nis_remove.c: Likewise.
        * nis/nis_table.c: Likewise.
        * nis/nis_util.c: Likewise.
        * nis/nis_xdr.c: Likewise.
        * nis/yp_xdr.c: Likewise.
        * nis/ypclnt.c: Likewise.
        * nis/ypupdate_xdr.c: Likewise.
        * nis/nis_checkpoint.c: Add libnsl_hidden_nolink_def to all functions.
        * nis/nis_clone_dir.c: Likewise.
        * nis/nis_clone_res.c: Likewise.
        * nis/nis_creategroup.c: Likewise.
        * nis/nis_destroygroup.c: Likewise.
        * nis/nis_domain_of.c: Likewise.
        * nis/nis_getservlist.c: Likewise.
        * nis/nis_ismember.c: Likewise.
        * nis/nis_mkdir.c: Likewise.
        * nis/nis_ping.c: Likewise.
        * nis/nis_print_group_entry.c: Likewise.
        * nis/nis_removemember.c: Likewise.
        * nis/nis_rmdir.c: Likewise.
        * nis/nis_server.c: Likewise.
        * nis/nis_subr.c: Likewise.
        * nis/nis_verifygroup.c: Likewise.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
2017-03-21 15:14:27 +01:00
Siddhesh Poyarekar 9dd409a5f4 Initialize tunable list with the GLIBC_TUNABLES environment variable
Read tunables values from the users using the GLIBC_TUNABLES
environment variable.  The value of this variable is a colon-separated
list of name=value pairs.  So a typical string would look like this:

GLIBC_TUNABLES=glibc.malloc.mmap_threshold=2048:glibc.malloc.trim_threshold=1024

	* config.make.in (have-loop-to-function): Define.
	* elf/Makefile (CFLAGS-dl-tunables.c): Add
	-fno-tree-loop-distribute-patterns.
	* elf/dl-tunables.c: Include libc-internals.h.
	(GLIBC_TUNABLES): New macro.
	(tunables_strdup): New function.
	(parse_tunables): New function.
	(min_strlen): New function.
	(__tunables_init): Use the new functions and macro.
	(disable_tunable): Disable tunable from GLIBC_TUNABLES.
	* malloc/tst-malloc-usable-tunables.c: New test case.
	* malloc/tst-malloc-usable-static-tunables.c: New test case.
	* malloc/Makefile (tests, tests-static): Add tests.
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 10c85e76c0 Disable stack protector in early static initialization [BZ #7065]
The startup code in csu/, and the brk and sbrk functions are
needed very early in initialization of a statically-linked program,
before the stack guard is initialized; TLS initialization also uses
memcpy, which cannot overrun its own stack.  Mark all of these as
-fno-stack-protector.

We also finally introduce @libc_cv_ssp@ and @no_stack_protector@, both
substituted by the configury changes made earlier, to detect the case
when -fno-stack-protector is supported by the compiler, and
unconditionally pass it in when this is the case, whether or not
--enable-stack-protector is passed to configure.  (This means that
it'll even work when the compiler's been hacked to pass
-fstack-protector by default, unless the hackage is so broken that
it does so in a way that is impossible to override.)
2016-12-26 10:08:45 +01:00
Siddhesh Poyarekar 8ce8299f94 Add configure check for python program
Add a configure check that looks for python3 and python in that order
since we had agreed in the past to prefer python3 over python in all
our code.  The patch also adjusts invocations through the various
Makefiles to use the set variable.

	* configure.ac: Check for python3 or python.
	* configure: Regenerated.
	* config.make.in (PYTHON): New variable.
	* benchtests/Makefile: Don't define PYTHON.
	(bench): Define target only if PYTHON was defined.
	* Rules: Don't define PYTHON.
	Define pretty printer targets only if PYTHON was defined.
	(tests-printers): Add to tests-unsupported if PYTHON is not
	found.
	(python-flags, python-invoke): Remove.
	(tests-printers-out): Use PYTHON instead of python-invoke.
2016-12-22 23:07:52 +05:30
Carlos O'Donell 84aa75162c Bug 20918 - Building with --enable-nss-crypt fails tst-linkall-static
Some configurations may use NSS cryptographic routines but have no
static library for those routines. The following changes allow glibc to
be built and tested with --enable-nss-crypt, but without having a static
NSS library. At a high level the change does two things:

(1) Detect at configure time if static NSS crypto libraries are
    available.  Assumes libfreebl3.a (instead of the existing Fedora
    libfreebl.a which is incomplete) which matches libfreebl3.so.

(2) If static NSS crypto libraries are _not_ available then adjust the
    way in which we build tst-linkall-static. This includes excluding a
    reference to crypt and not linking against libcrypt.a, all of which
    will fail otherwise.

Testing assumptions:
* Static library is named libfreebl3.a (not libfreebl.a as is currently
  provided in Fedora), matching libfreebl3.so shared link name.

Tested on x86_64 on Fedora with:

(a) --enable-nss-crypt, with no static NSS library support: PASS
    (previous FAIL)

(b) --enable-nss-crypt, with faked static NSS library support: PASS
    (unsupported)
	* Requires changing elf/Makefile to include a stub
	  /lib64/libfreebl3.a for testing purposes.

(c) --disable-nss-crypt: PASS
    (default)

No regressions on x86_64.

For details see:
https://www.sourceware.org/ml/libc-alpha/2016-11/msg00647.html
2016-12-02 15:39:09 -05:00
Florian Weimer fc3e1337be Avoid running $(CXX) during build to obtain header file paths
This reduces the build time somewhat and is particularly noticeable
during rebuilds with few code changes.
2016-09-21 10:45:32 +02: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
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
H.J. Lu 89569c8bb6 Run tst-prelink test for GLOB_DAT reloc
Run tst-prelink test on targets with GLOB_DAT relocaton.

	* config.make.in (have-glob-dat-reloc): New.
	* configure.ac (libc_cv_has_glob_dat): New.  Set to yes if
	target supports GLOB_DAT relocaton. AC_SUBST.
	* configure: Regenerated.
	* elf/Makefile (tests): Add tst-prelink.
	(tests-special): Add $(objpfx)tst-prelink-cmp.out.
	(tst-prelink-ENV): New.
	($(objpfx)tst-prelink-conflict.out): Likewise.
	($(objpfx)tst-prelink-cmp.out): Likewise.
	* sysdeps/x86/tst-prelink.c: Moved to ...
	* elf/tst-prelink.c: Here.
	* sysdeps/x86/tst-prelink.exp: Moved to ...
	* elf/tst-prelink.exp: Here.
	* sysdeps/x86/Makefile (tests): Don't add tst-prelink.
	(tst-prelink-ENV): Removed.
	($(objpfx)tst-prelink-conflict.out): Likewise.
	($(objpfx)tst-prelink-cmp.out): Likewise.
	(tests-special): Don't add $(objpfx)tst-prelink-cmp.out.
2015-11-14 12:00:38 -08:00
Joseph Myers 3e2ee6f0e3 Remove sysdeps/nptl/configure.ac.
sysdeps/nptl/configure.ac tests for forced unwind support and the C
cleanup attribute, giving errors if either is unsupported.  It does
nothing beyond running those two tests.

Both the attribute, and _Unwind_GetCFA which is used in the forced
unwind test, were added in GCC 3.3.  Thus these tests are long
obsolete, and this patch removes the configure fragment running them,
along with associated conditionals.

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

	* sysdeps/nptl/configure.ac: Remove file.
	* sysdeps/nptl/configure: Remove generated file.
	* configure.ac (libc_cv_forced_unwind): Do not substitute.
	* configure: Regenerated.
	* config.h.in (HAVE_FORCED_UNWIND): Remove #undef.
	* config.make.in (have-forced-unwind): Remove variable.
	* nptl/Makefile [$(have-forced-unwind) = yes]: Make code
	unconditional.
	* nptl/descr.h [HAVE_FORCED_UNWIND]: Likewise.
	* nptl/unwind.c [HAVE_FORCED_UNWIND]: Likewise.
	(__pthread_unwind) [!HAVE_FORCED_UNWIND]: Remove conditional code.
	* nptl/version.c [HAVE_FORCED_UNWIND]: Make code unconditional.
	* sysdeps/nptl/Makefile [$(have-forced-unwind) = yes]: Make code
	unconditional.
2015-10-27 21:46:03 +00:00
Joseph Myers f5659917f9 Remove support for removing glibc 2.0 headers.
There is a configure test for the presence of glibc 2.0 headers (that
were renamed / no longer installed in glibc 2.1) and associated
support for removing them on "make install".

Normal practice for subsequent removal / renaming of installed files
has been not to do anything special about removing them; if you want
installed files from an old installation removed reliably, you need to
use a packaging system that tracks what files were installed by a
previous glibc package (via installing in an intermediate directory
with install_root).  I think it's been long enough since 2.0 that it's
not particularly useful to have that special logic for those old
headers either; this patch removes it.

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

	* configure.ac (old_glibc_headers): Remove configure test.
	* configure: Regenerated.
	* config.make.in (old-glibc-headers): Remove variable.
	* Makefile [!$(install_root) && $(old-glibc-headers) = yes]
	(install): Remove dependency on remove-old-headers.
	(headers2_0): Remove variable.
	(remove-old-headers): Remove rule.
2015-10-26 22:46:04 +00:00
Mike Frysinger 6ab674ebff use -fstack-protector-strong when available
With gcc-4.9, a new -fstack-protector-strong flag is available that is
between -fstack-protector (pretty weak) and -fstack-protector-all (pretty
strong) that provides good trade-offs between overhead but still providing
good coverage.  Update the places in glibc that use ssp to use this flag
when it's available.

This also kills off the indirection of hardcoding the flag name in the
Makefiles and adding it based on a have-ssp boolean.  Instead, the build
always expands the $(stack-protector) variable to the best ssp setting.
This makes the build logic a bit simpler and allows people to easily set
to a diff flag like:
	make stack-protector=-fstack-protector-all
2015-10-19 15:36:48 -04: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 2b714df5d8 Remove -Bgroup configure test.
There is a configure test for the -Bgroup linker option whose results
aren't used anywhere.  This patch removes that test.

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

	* configure.ac (libc_cv_Bgroup): Remove configure test.
	* configure: Regenerated.
	* config.make.in (have-Bgroup): Remove variable.
2015-10-15 23:36:22 +00:00
Joseph Myers 3d0dbdc467 Remove sizeof (long double) configure test.
There is a configure test for sizeof (long double) whose results
aren't used anywhere.  This patch removes that test.

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

	* configure.ac (sizeof_long_double): Remove configure test.
	* configure: Regenerated.
	* config.make.in (sizeof-long-double): Remove variable.
2015-10-15 23:30:42 +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 30f58bb192 Remove -static-libgcc configure test.
There is a configure test for -static-libgcc.  GCC added this option
in version 3.0, so this test is obsolete; this patch removes it.

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

	* configure.ac (libc_cv_gcc_static_libgcc): Remove configure test.
	* configure: Regenerated.
	* config.make.in (static-libgcc): Remove variable.
	* Makerules (build-shlib-helper): Use -static-libgcc instead of
	$(static-libgcc).
	(build-module-helper): Likewise.
2015-10-15 19:32:58 +00:00
Florian Weimer 99e1dc0a68 Add a test case for C++11 thread_local support
This requires a C++ compiler with thread_local support, and a new
configure check is needed.
2015-10-06 21:27:55 +02:00
Mike Frysinger 1cba4036b6 timezone: add a configure flag to disable program install
Some distros build+install the timezone tools (zic/zdump/tzselect) outside
of glibc and use the upstream package directly.  Add a configure flag to
glibc so they can disable install of those tools.

This allows tests to run & pass regardless of the configure flag.  Only
the install of them is impacted.
2015-09-18 19:39:46 -04:00
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
H.J. Lu 83569fb894 Add a testcase for copy reloc against protected data
Linkers in some versions of binutils 2.25 and 2.26 don't support protected
data symbol with error messsage like:

/usr/bin/ld: copy reloc against protected `bar' is invalid
/usr/bin/ld: failed to set dynamic section sizes: Bad value

We check if linker supports copy reloc against protected data symbol to
avoid running the test if linker is broken.

	[BZ #17711]
	* config.make.in (have-protected-data): New.
	* configure.ac: Check linker support for protected data symbol.
	* configure: Regenerated.
	* elf/Makefile (modules-names): Add tst-protected1moda and
	tst-protected1modb if $(have-protected-data) is yes.
	(tests): Add tst-protected1a and tst-protected1b if
	$(have-protected-data) is yes.
	($(objpfx)tst-protected1a): New.
	($(objpfx)tst-protected1b): Likewise.
	(tst-protected1modb.so-no-z-defs): Likewise.
	* elf/tst-protected1a.c: New file.
	* elf/tst-protected1b.c: Likewise.
	* elf/tst-protected1mod.h: Likewise.
	* elf/tst-protected1moda.c: Likewise.
	* elf/tst-protected1modb.c: Likewise.
2015-03-31 05:21:12 -07: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
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
Dominik Vogt 5a414ff70c S/390: Port of lock elision to System/z
Added support for TX lock elision of pthread mutexes on s390 and
s390x.  This may improve lock scaling of existing programs on TX
capable systems.  The lock elision code is only built with
--enable-lock-elision=yes and then requires a GCC version supporting
the TX builtins.  With lock elision default mutexes are elided via
__builtin_tbegin, if the cpu supports transactions. By default lock
elision is not enabled and the elision code is not built.
2014-05-09 16:58:46 +02:00