about summary refs log tree commit diff
path: root/Makeconfig
Commit message (Collapse)AuthorAgeFilesLines
* Remove ldd libc4 supportAdhemerval Zanella2022-08-041-2/+2
| | | | The older libc versions are obsolete for over twenty years now.
* Enable DT_RELR in glibc shared libraries and PIEs automaticallyH.J. Lu2022-05-181-0/+12
| | | | | | Enable DT_RELR in glibc shared libraries and position independent executables (PIE) automatically if linker supports -z pack-relative-relocs. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* stdio: Remove the usage of $(fno-unit-at-a-time) for errlist.cAdhemerval Zanella2022-05-131-1/+2
| | | | | | | | | | | | | | | | | | The errlist.c is built with -fno-toplevel-reorder to avoid compiler to reorder the compat assembly directives due an assembler issue [1] (fixed on 2.39). This patch removes the compiler flags by split the compat symbol generation in two phases. First the _sys_errlist_internal internal without any compat symbol directive is preprocessed to generate an assembly source code. This generate assembly is then used as input on a platform agnostic errlist-data.S which then creates the compat definitions. This prevents compiler to move any compat directive prior the _sys_errlist_internal definition itself. Checked on a make check run-built-tests=no on all affected ABIs. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29012
* Do not use --hash-style=both for building glibc shared objectsFlorian Weimer2022-04-291-9/+0
| | | | | | | | 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>
* Remove -z combreloc and HAVE_Z_COMBRELOCFangrui Song2022-04-041-8/+2
| | | | | | | | | | | | | -z combreloc has been the default regadless of the architecture since binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The configure check added in commit fdde83499a05 (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 a711b01d34ca and ee0cb67ec238). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add and use link-test-modules-rpath-link [BZ #28455]H.J. Lu2022-01-241-0/+2
| | | | | | | | | | | | | DT_RUNPATH is only used to find the immediate dependencies of the executable or shared object containing the DT_RUNPATH entry: 1. Define link-test-modules-rpath-link if $(build-hardcoded-path-in-tests) is yes. 2. Use $(link-test-modules-rpath-link) in build-module-helper so that test modules can dlopen modules with DT_RUNPATH. 3. Add a test to show why link-test-modules-rpath-link is needed. This partially fixes BZ #28455.
* Generate gcc-macros.hFlorian Weimer2022-01-141-0/+9
| | | | | | | | The file can be used to check the effect of the default compiler flags on code generation even in areas of the build that uses non-default compiler flags. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* Do not build libresolv module with 64 bit time_t flagsAdhemerval Zanella2022-01-121-1/+1
| | | | | | | It is not used to build installed programs. It also fixes resolv/tst-p_secstodate on big endian machines. Checked on i686-linux-gnu and powerpc-linux-gnu-power4.
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* Fix The GNU ToolChain Authors copyright noticeSiddhesh Poyarekar2021-12-171-1/+1
| | | | | | | | | | | I (and maybe one or two others) added a (C) to the copyright notice regardless of the contribution checklist[1] not mentioning it. Fix all these instances so that the notice reads as "Copyright The GNU Toolchain Authors" across the source code. [1] https://sourceware.org/glibc/wiki/Contribution%20checklist Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Use LFS and 64 bit time for installed programs (BZ #15333)Adhemerval Zanella2021-12-151-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The installed programs are built with a combination of different values for MODULE_NAME, as below. To enable both Long File Support and 64 bt time, -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 is added for nonlibi, nscd, lddlibc4, libresolv, ldconfig, locale_programs, iconvprogs, libnss_files, libnss_compat, libnss_db, libnss_hesiod, libutil, libpcprofile, and libSegFault. nscd/nscd nscd/nscd.o MODULE_NAME=nscd nscd/connections.o MODULE_NAME=nscd nscd/pwdcache.o MODULE_NAME=nscd nscd/getpwnam_r.o MODULE_NAME=nscd nscd/getpwuid_r.o MODULE_NAME=nscd nscd/grpcache.o MODULE_NAME=nscd nscd/getgrnam_r.o MODULE_NAME=nscd nscd/getgrgid_r.o MODULE_NAME=nscd nscd/hstcache.o MODULE_NAME=nscd nscd/gethstbyad_r.o MODULE_NAME=nscd nscd/gethstbynm3_r.o MODULE_NAME=nscd nscd/getsrvbynm_r.o MODULE_NAME=nscd nscd/getsrvbypt_r.o MODULE_NAME=nscd nscd/servicescache.o MODULE_NAME=nscd nscd/dbg_log.o MODULE_NAME=nscd nscd/nscd_conf.o MODULE_NAME=nscd nscd/nscd_stat.o MODULE_NAME=nscd nscd/cache.o MODULE_NAME=nscd nscd/mem.o MODULE_NAME=nscd nscd/nscd_setup_thread.o MODULE_NAME=nscd nscd/xmalloc.o MODULE_NAME=nscd nscd/xstrdup.o MODULE_NAME=nscd nscd/aicache.o MODULE_NAME=nscd nscd/initgrcache.o MODULE_NAME=nscd nscd/gai.o MODULE_NAME=nscd nscd/res_hconf.o MODULE_NAME=nscd nscd/netgroupcache.o MODULE_NAME=nscd nscd/cachedumper.o MODULE_NAME=nscd elf/lddlibc4 elf/lddlibc4 MODULE_NAME=lddlibc4 elf/pldd elf/pldd.o MODULE_NAME=nonlib elf/xmalloc.o MODULE_NAME=nonlib elf/sln elf/sln.o MODULE_NAME=nonlib elf/static-stubs.o MODULE_NAME=nonlib elf/sprof MODULE_NAME=nonlib elf/ldconfig elf/ldconfig.o MODULE_NAME=ldconfig elf/cache.o MODULE_NAME=nonlib elf/readlib.o MODULE_NAME=nonlib elf/xmalloc.o MODULE_NAME=nonlib elf/xstrdup.o MODULE_NAME=nonlib elf/chroot_canon.o MODULE_NAME=nonlib elf/static-stubs.o MODULE_NAME=nonlib elf/stringtable.o MODULE_NAME=nonlib io/pwd io/pwd.o MODULE_NAME=nonlib locale/locale locale/locale.o MODULE_NAME=locale_programs locale/locale-spec.o MODULE_NAME=locale_programs locale/charmap-dir.o MODULE_NAME=locale_programs locale/simple-hash.o MODULE_NAME=locale_programs locale/xmalloc.o MODULE_NAME=locale_programs locale/xstrdup.o MODULE_NAME=locale_programs locale/record-status.o MODULE_NAME=locale_programs locale/xasprintf.o MODULE_NAME=locale_programs locale/localedef locale/localedef.o MODULE_NAME=locale_programs locale/ld-ctype.o MODULE_NAME=locale_programs locale/ld-messages.o MODULE_NAME=locale_programs locale/ld-monetary.o MODULE_NAME=locale_programs locale/ld-numeric.o MODULE_NAME=locale_programs locale/ld-time.o MODULE_NAME=locale_programs locale/ld-paper.o MODULE_NAME=locale_programs locale/ld-name.o MODULE_NAME=locale_programs locale/ld-address.o MODULE_NAME=locale_programs locale/ld-telephone.o MODULE_NAME=locale_programs locale/ld-measurement.o MODULE_NAME=locale_programs locale/ld-identification.o MODULE_NAME=locale_programs locale/ld-collate.o MODULE_NAME=locale_programs locale/charmap.o MODULE_NAME=locale_programs locale/linereader.o MODULE_NAME=locale_programs locale/locfile.o MODULE_NAME=locale_programs locale/repertoire.o MODULE_NAME=locale_programs locale/locarchive.o MODULE_NAME=locale_programs locale/md5.o MODULE_NAME=locale_programs locale/charmap-dir.o MODULE_NAME=locale_programs locale/simple-hash.o MODULE_NAME=locale_programs locale/xmalloc.o MODULE_NAME=locale_programs locale/xstrdup.o MODULE_NAME=locale_programs locale/record-status.o MODULE_NAME=locale_programs locale/xasprintf.o MODULE_NAME=locale_programs catgets/gencat catgets/gencat.o MODULE_NAME=nonlib catgets/xmalloc.o MODULE_NAME=nonlib nss/makedb nss/makedb.o MODULE_NAME=nonlib nss/xmalloc.o MODULE_NAME=nonlib nss/hash-string.o MODULE_NAME=nonlib nss/getent nss/getent.o MODULE_NAME=nonlib posix/getconf posix/getconf.o MODULE_NAME=nonlib login/utmpdump login/utmpdump.o MODULE_NAME=nonlib debug/pcprofiledump debug/pcprofiledump.o MODULE_NAME=nonlib timezone/zic timezone/zic.o MODULE_NAME=nonlib timezone/zdump timezone/zdump.o MODULE_NAME=nonlib iconv/iconv_prog iconv/iconv_prog.o MODULE_NAME=nonlib iconv/iconv_charmap.o MODULE_NAME=iconvprogs iconv/charmap.o MODULE_NAME=iconvprogs iconv/charmap-dir.o MODULE_NAME=iconvprogs iconv/linereader.o MODULE_NAME=iconvprogs iconv/dummy-repertoire.o MODULE_NAME=iconvprogs iconv/simple-hash.o MODULE_NAME=iconvprogs iconv/xstrdup.o MODULE_NAME=iconvprogs iconv/xmalloc.o MODULE_NAME=iconvprogs iconv/record-status.o MODULE_NAME=iconvprogs iconv/iconvconfig iconv/iconvconfig.o MODULE_NAME=nonlib iconv/strtab.o MODULE_NAME=iconvprogs iconv/xmalloc.o MODULE_NAME=iconvprogs iconv/hash-string.o MODULE_NAME=iconvprogs nss/libnss_files.so MODULE_NAME=libnss_files nss/libnss_compat.so.2 MODULE_NAME=libnss_compat nss/libnss_db.so MODULE_NAME=libnss_db hesiod/libnss_hesiod.so MODULE_NAME=libnss_hesiod login/libutil.so MODULE_NAME=libutil debug/libpcprofile.so MODULE_NAME=libpcprofile debug/libSegFault.so MODULE_NAME=libSegFault Also, to avoid adding both LFS and 64 bit time support on internal tests they are moved to a newer 'testsuite-internal' module. It should be similar to 'nonlib' regarding internal definition and linking namespace. This patch also enables LFS and 64 bit support of libsupport container programs (echo-container, test-container, shell-container, and true-container). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
* Replace --enable-static-pie with --disable-default-pieSiddhesh Poyarekar2021-12-131-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove the unused +mkdep/+make-deps/s-proto.S/s-proto-cancel.SH.J. Lu2021-11-101-7/+0
| | | | | | | | | | | | | | | Since commit d73f5331ce5370ca5a879229e3842f5de98689cd Author: Roland McGrath <roland@gnu.org> Date: Fri May 2 02:20:45 2003 +0000 2003-05-01 Roland McGrath <roland@redhat.com> dependency is generated by passing -MD -MF to compiler. Remove the unused +mkdep, +make-deps, s-proto.S and s-proto-cancel.S. This fixes BZ #28554.
* Run conform/ tests using newly built libcJoseph Myers2021-09-171-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although the conform/ header tests are built using the headers of the glibc under test, the execution tests from conformtest (a few tests of the values of macros evaluating to string constants) are linked and run with system libc, not the newly built libc. Apart from preventing testing in cross environments, this can be a problem even for native testing. Specifically, it can be useful to do native testing when building with a cross compiler that links with a libc that is not the system libc; for example, on x86_64, you can test all three ABIs that way if the kernel support is present, even if the host OS lacks 32-bit or x32 libraries or they are older than the libraries in the sysroot used by the compiler used to build glibc. This works for almost all tests, but not for these conformtest tests. Arrange for conformtest to link and run test programs similarly to other tests, with consequent refactoring of various variables in Makeconfig to allow passing relevant parts of the link-time command lines down to conformtest. In general, the parts of the link command involving $@ or $^ are separated out from the parts that should be passed to conformtest (the variables passed to conformtest still involve various variables whose names involve $(@F), but those variables simply won't be defined for the conformtest makefile rules and I think their presence there is harmless). This is also most of the support that would be needed to allow running those tests of string constants for cross testing when test-wrapper is defined. That will also need changes to where conformtest.py puts the test executables, so it puts them in the main object directory (expected to be shared with a test system in cross testing) rather than /tmp (not expected to be shared) as at present. Tested for x86_64.
* Force building with -fno-commonFlorian Weimer2021-07-091-1/+5
| | | | | | | | | | As a result, is not necessary to specify __attribute__ ((nocommon)) on individual definitions. GCC 10 defaults to -fno-common on all architectures except ARC, but this change is compatible with older GCC versions and ARC, too. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* resolv: Move libanl into libc (if libpthread is in libc)Florian Weimer2021-07-021-0/+2
| | | | | | | | | | The symbols gai_cancel, gai_error, gai_suspend, getaddrinfo_a, __gai_suspend_time64 were moved using scripts/move-symbol-to-libc.py. For Hurd (which remains !PTHREAD_IN_LIBC), a few #define redirects had to be added because several pthread functions are not available under __. (Linux uses __ prefixes for most hidden aliases, and has to in some cases to avoid linknamespace issues.)
* Fix librt-routines-var issues for !PTHREAD_IN_LIBCFlorian Weimer2021-06-211-1/+1
| | | | | | | The variable name was incorrect, and the existing librt-routines variable needs to be augmented (not assigned) in rt/Makefile. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Makeconfig: Fix time64-compat.mk targetSiddhesh Poyarekar2021-06-171-4/+4
| | | | | | | | | | | | The time64-compat.i needed for the time64-compat.mk Makeconfig include ends up trying to include libc-modules.h, which is not generated until later. This results in an error during build which is not noticed because it somehow does not terminate the build. Exclude the modules cppflags from the pre-processing command and fix up the time64-compat.mk target so that the build runs without issues. Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
* y2038: Add test coverageAdhemerval Zanella2021-06-151-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is enabled through a new rule, tests-y2038, which is built only when the ABI supports the comapt 64-bit time_t (defined by the header time64-compat.h, which also enables the creation of the symbol Version for Linux). It means the tests are not built for ABI which already provide default 64-bit time_t. The new rule already adds the required LFS and 64-bit time_t compiler flags. The current coverage is: * libc: - adjtime tst-adjtime-time64 - adjtimex tst-adjtimex-time64 - clock_adjtime tst-clock_adjtime-time64 - clock_getres tst-clock-time64, tst-cpuclock1-time64 - clock_gettime tst-clock-time64, tst-clock2-time64, tst-cpuclock1-time64 - clock_nanosleep tst-clock_nanosleep-time64, tst-cpuclock1-time64 - clock_settime tst-clock2-time64 - cnd_timedwait tst-cnd-timedwait-time64 - ctime tst-ctime-time64 - ctime_r tst-ctime-time64 - difftime tst-difftime-time64 - fstat tst-stat-time64 - fstatat tst-stat-time64 - futimens tst-futimens-time64 - futimes tst-futimes-time64 - futimesat tst-futimesat-time64 - fts_* tst-fts-time64 - getitimer tst-itimer-timer64 - getrusage - gettimeofday tst-clock_nanosleep-time64 - glob / globfree tst-gnuglob64-time64 - gmtime tst-gmtime-time64 - gmtime_r tst-gmtime-time64 - lstat tst-stat-time64 - localtime tst-y2039-time64 - localtime_t tst-y2039-time64 - lutimes tst-lutimes-time64 - mktime tst-mktime4-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - msgctl test-sysvmsg-time64 - mtx_timedlock tst-mtx-timedlock-time64 - nanosleep tst-cpuclock{12}-time64, tst-mqueue8-time64, tst-clock-time64 - nftw / ftw ftwtest-time64 - ntp_adjtime tst-ntp_adjtime-time64 - ntp_gettime tst-ntp_gettime-time64 - ntp_gettimex tst-ntp_gettimex-time64 - ppoll tst-ppoll-time64 - pselect tst-pselect-time64 - pthread_clockjoin_np tst-join14-time64 - pthread_cond_clockwait tst-cond11-time64 - pthread_cond_timedwait tst-abstime-time64 - pthread_mutex_clocklock tst-abstime-time64 - pthread_mutex_timedlock tst-abstime-time64 - pthread_rwlock_clockrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_clockwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_timedjoin_np tst-join14-time64 - recvmmsg tst-cancel4_2-time64 - sched_rr_get_interval tst-sched_rr_get_interval-time64 - select tst-select-time64 - sem_clockwait tst-sem5-time64 - sem_timedwait tst-sem5-time64 - semctl test-sysvsem-time64 - semtimedop test-sysvsem-time64 - setitimer tst-mqueue2-time64, tst-itimer-timer64 - settimeofday tst-settimeofday-time64 - shmctl test-sysvshm-time64 - sigtimedwait tst-sigtimedwait-time64 - stat tst-stat-time64 - thrd_sleep tst-thrd-sleep-time64 - time tst-mqueue{1248}-time64 - timegm tst-timegm-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 - timerfd_gettime tst-timerfd-time64 - timerfd_settime tst-timerfd-time64 - timespec_get tst-timespec_get-time64 - timespec_getres tst-timespec_getres-time64 - utime tst-utime-time64 - utimensat tst-utimensat-time64 - utimes tst-utimes-time64 - wait3 tst-wait3-time64 - wait4 tst-wait4-time64 * librt: - aio_suspend tst-aio6-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 * libanl: - gai_suspend Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* dlfcn: Cleanups after -ldl is no longer requiredFlorian Weimer2021-06-031-6/+0
| | | | | | | | | | | | This commit removes the ELF constructor and internal variables from dlfcn/dlfcn.c. The file now serves the same purpose as nptl/libpthread-compat.c, so it is renamed to dlfcn/libdl-compat.c. The use of libdl-shared-only-routines ensures that libdl.a is empty. This commit adjusts the test suite not to use $(libdl). The libdl.so symbolic link is no longer installed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add pthread-in-libc, libpthread-routines-var, librt-routines-varFlorian Weimer2021-05-031-0/+11
| | | | | | | | 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>
* Build libc-start with stack protector for SHAREDSiddhesh Poyarekar2021-03-151-0/+8
| | | | | | | | | | This does not change the emitted code since __libc_start_main does not return, but is important for formal flags compliance. This also cleans up the cosmetic inconsistency in the stack protector flags in csu, especially the incorrect value of STACK_PROTECTOR_LEVEL. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* Add {,sysdep-}ld-library-path make variableSamuel Thibault2020-11-161-0/+3
| | | | | | | | On GNU/Hurd we not only need $(common-objpfx) in LD_LIBRARY_PATH when loading dynamic objects, but also $(common-objpfx)/mach and $(common-objpfx)/hurd. This adds an ld-library-path variable to be used as LD_LIBRARY_PATH basis in Makefiles, and a sysdep-ld-library-path variable for sysdeps to add some more paths, here mach/ and hurd/.
* Makeconfig: Use $(error ...) to output error messageSimon Marchi2020-04-291-1/+1
| | | | | | | | | | | | | | | | | | Being not familiar with the glibc repository, I typed "make" inside some subdirectory that has a Makefile, and was met with: $ make ../Makeconfig:42: *** missing separator. Stop. At Makeconfig:42, we have: objdir must be defined by the build-directory Makefile. Change that to use $(error ...), which I guess was the original intention. The result is: $ make ../Makeconfig:42: *** objdir must be defined by the build-directory Makefile. Stop.
* Makeconfig: sandwich gnulib-tests between libc/ld linking of testsPaul E. Murphy2020-03-251-6/+6
| | | | | | | This better resembles the default linking process with the gnulibs, and also resolves the increasingly difficult to maintain f128-loader-link usage on powerpc64le as some libgcc symbols are dependent on those found in the loader (ld).
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Expand $(as-needed) and $(no-as-needed) throughout the build systemFlorian Weimer2019-12-031-5/+2
| | | | | | | | | Since commit a3cc4f48e94f32c9532ee36982ac00eb1e5719b0 ("Remove --as-needed configure test."), --as-needed support is no longer optional. The macros are not much shorter and do not provide documentary value, either, so this commit removes them.
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* test-container: Install with $(sorted-subdirs) [BZ #24794]Tulio Magno Quites Machado Filho2019-07-291-3/+3
| | | | | | | | | | | | | Commit 35e038c1d2ccb3a75395662f9c4f28d85a61444f started to use an incomplete list of subdirs based on $(all-subdirs) causing testroot.pristine to miss files from nss. Tested if the list of files in testroot.pristine remains the same. [BZ #24794] * Makeconfig (all-subdirs): Improved source comments. * Makefile (testroot.pristine/install.stamp): Pass subdirs='$(sorted-subdirs)' to make install.
* Makeconfig: Move -Wl,-rpath-link options before library referencesFlorian Weimer2019-04-261-5/+14
| | | | | | | | | | | | | | | | | | | Previously, the -Wl,-rpath-link options came after the libraries injected using LDLIBS-* variables on the link editor command line for main programs. As a result, it could happen that installed libraries that reference glibc libraries used the installed glibc from the system directories, instead of the glibc from the build tree. This can lead to link failures if the wrong version of libpthread.so.0 is used, for instance, due to differences in the internal GLIBC_PRIVATE interfaces, as seen with memusagestat and -lgd after commit f9b645b4b0a10c43753296ce3fa40053fa44606a ("memusagestat: use local glibc when linking [BZ #18465]"). The isolation is necessarily imperfect because these installed libraries are linked against the installed glibc in the system directories. However, in most cases, the built glibc will be newer than the installed glibc, and this link is permitted because of the ABI backwards compatibility glibc provides.
* Makeconfig: Move $(CC) to +link command variablesFlorian Weimer2019-04-261-13/+17
| | | | | | This change is needed to add linker flags which come very early in the command linke (before LDFLAGS) and are not applied to test programs (only to installed programs).
* Extend BIND_NOW to installed programs with --enable-bind-nowFlorian Weimer2019-04-251-3/+5
| | | | | | | | Commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix --enable-bind-now [BZ #21015]") extended BIND_NOW to all installed shared objects. This change also covers installed programs. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Only build libm with -fno-math-errno (bug 24024)Aurelien Jarno2019-01-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1294b1892e ("Add support for sqrt asm redirects") added the -fno-math-errno flag to build most of the glibc in order to enable GCC to inline math functions. Due to GCC bug #88576, saving and restoring errno around calls to malloc are optimized-out. In turn this causes strerror to set errno to ENOMEM if it get passed an invalid error number and if malloc sets errno to ENOMEM (which might happen even if it succeeds). This is not allowed by POSIX. This patch changes the build flags, building only libm with -fno-math-errno and all the remaining code with -fno-math-errno. This should be safe as libm doesn't contain any code saving and restoring errno around malloc. This patch can probably be reverted once the GCC bug is fixed and available in stable releases. Tested on x86-64, no regression in the testsuite. Changelog: [BZ #24024] * Makeconfig: Build libm with -fno-math-errno but build the remaining code with -fmath-errno. * string/Makefile [$(build-shared)] (tests): Add test-strerror-errno. [$(build-shared)] (LDLIBS-test-strerror-errno): New variable. * string/test-strerror-errno.c: New file.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Don't build libnsl for new ABIsAndreas Schwab2018-09-241-0/+55
| | | | | | For architectures and ABIs that are added in version 2.29 or later the option --enable-obsolete-nsl is no longer available, and no libnsl compatibility library is built.
* Makeconfig: Do not sort and deduplicate +cflags [BZ # 17248]Florian Weimer2018-08-211-3/+0
| | | | | The original intent behind this is unclear. It interferes with flags that has to be ordered in a particular way.
* Add --with-nonshared-cflags option to configureFlorian Weimer2018-08-171-1/+1
|
* Makeconfig (ASFLAGS): Always append required assembler flagsFlorian Weimer2018-08-171-1/+1
| | | | | Otherwise, it is impossible to set ASFLAGS differently from CFLAGS without also overriding essential flags such as -Wa,--noexecstack.
* New configure option --disable-crypt.Zack Weinberg2018-06-291-2/+7
| | | | | | | | 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.
* Add support for sqrt asm redirectsWilco Dijkstra2018-03-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch series cleans up the many uses of __ieee754_sqrt(f/l) in GLIBC. The goal is to enable GCC to do the inlining, and if this fails call the __ieee754_sqrt function. This is done by internally declaring sqrt with asm redirects. The compat symbols and sqrt wrappers need to disable the redirect. The redirect is also disabled if there are already redirects defined when using -ffinite-math-only. All math functions (but not math tests, non-library code and libnldbl) are built with -fno-math-errno which means GCC will typically inline sqrt as a single instruction. This means targets are no longer forced to add a special inline for sqrt. * include/math.h (sqrt): Declare with asm redirect. (sqrtf): Likewise. (sqrtl): Likewise. (sqrtf128): Likewise. * Makeconfig: Add -fno-math-errno for libc/libm, but build testsuite, nonlib and libnldbl with -fmath-errno. * math/w_sqrt_compat.c: Define NO_MATH_REDIRECT. * math/w_sqrt_template.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * sysdeps/i386/fpu/w_sqrt.c: Likewise. * sysdeps/i386/fpu/w_sqrt_compat.c: Likewise. * sysdeps/generic/math-type-macros-float128.h: Remove math.h and complex.h.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Replece LDFLAGS-* = $(no-pie-ldflag) with tst-*-no-pie = yes [BZ #22630]H.J. Lu2017-12-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit 9d7a3741c9e59eba87fb3ca6b9f979befce07826 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Dec 15 16:59:33 2017 -0800 Add --enable-static-pie configure option to build static PIE [BZ #19574] and commit 00c714df398b63934540d95ce3792596f7a94a6c Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Dec 18 12:24:26 2017 -0800 Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614] $(no-pie-ldflag) is no longer effective since no-pie-ldflag is defined to -no-pie only if GCC defaults to PIE. When --enable-static-pie is used to configure glibc build and GCC doesn't default to PIE. no-pie-ldflag is undefined and these tests: elf/Makefile:LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag) elf/Makefile:LDFLAGS-tst-prelink = $(no-pie-ldflag) elf/Makefile:LDFLAGS-tst-main1 = $(no-pie-ldflag) gmon/Makefile:LDFLAGS-tst-gmon := $(no-pie-ldflag) may fail to link. This patch replaces "-pie" with $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) and repleces LDFLAGS-* = $(no-pie-ldflag) with tst-*-no-pie = yes so that tst-dlopen-aout, tst-prelink, tst-main1 and tst-gmon are always built as non-PIE, with and without --enable-static-pie, regardless if GCC defaults to PIE or non-PIE. Tested with build-many-glibcs.py without --enable-static-pie as well as with --enable-static-pie for x86_64, x32 and i686. [BZ #22630] * Makeconfig (link-pie-before-libc): Replace -pie with $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie). * elf/Makefile (LDFLAGS-tst-dlopen-aout): Removed. (tst-dlopen-aout-no-pie): New. (LDFLAGS-tst-prelink): Removed. (tst-prelink-no-pie): New. (LDFLAGS-tst-main1): Removed. (tst-main1-no-pie): New. * gmon/Makefile (LDFLAGS-tst-gmon): Removed. (tst-gmon-no-pie): New.
* Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]H.J. Lu2017-12-181-1/+3
| | | | | | | | | | | | | | | | | | | | 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.
* Add --enable-static-pie configure option to build static PIE [BZ #19574]H.J. Lu2017-12-151-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static PIE extends address space layout randomization to static executables. It provides additional security hardening benefits at the cost of some memory and performance. Dynamic linker, ld.so, is a standalone program which can be loaded at any address. This patch adds a configure option, --enable-static-pie, to embed the part of ld.so in static executable to create static position independent executable (static PIE). A static PIE is similar to static executable, but can be loaded at any address without help from a dynamic linker. When --enable-static-pie is used to configure glibc, libc.a is built as PIE and all static executables, including tests, are built as static PIE. The resulting libc.a can be used together with GCC 8 or above to build static PIE with the compiler option, -static-pie. But GCC 8 isn't required to build glibc with --enable-static-pie. Only GCC with PIE support is needed. When an older GCC is used to build glibc with --enable-static-pie, proper input files are passed to linker to create static executables as static PIE, together with "-z text" to prevent dynamic relocations in read-only segments, which are not allowed in static PIE. The following changes are made for static PIE: 1. Add a new function, _dl_relocate_static_pie, to: a. Get the run-time load address. b. Read the dynamic section. c. Perform dynamic relocations. Dynamic linker also performs these steps. But static PIE doesn't load any shared objects. 2. Call _dl_relocate_static_pie at entrance of LIBC_START_MAIN in libc.a. crt1.o, which is used to create dynamic and non-PIE static executables, is updated to include a dummy _dl_relocate_static_pie. rcrt1.o is added to create static PIE, which will link in the real _dl_relocate_static_pie. grcrt1.o is also added to create static PIE with -pg. GCC 8 has been updated to support rcrt1.o and grcrt1.o for static PIE. Static PIE can work on all architectures which support PIE, provided: 1. Target must support accessing of local functions without dynamic relocations, which is needed in start.S to call __libc_start_main with function addresses of __libc_csu_init, __libc_csu_fini and main. All functions in static PIE are local functions. If PIE start.S can't reach main () defined in a shared object, the code sequence: pass address of local_main to __libc_start_main ... local_main: tail call to main via PLT can be used. 2. start.S is updated to check PIC instead SHARED for PIC code path and avoid dynamic relocation, when PIC is defined and SHARED isn't defined, to support static PIE. 3. All assembly codes are updated check PIC instead SHARED for PIC code path to avoid dynamic relocations in read-only sections. 4. All assembly codes are updated check SHARED instead PIC for static symbol name. 5. elf_machine_load_address in dl-machine.h are updated to support static PIE. 6. __brk works without TLS nor dynamic relocations in read-only section so that it can be used by __libc_setup_tls to initializes TLS in static PIE. NB: When glibc is built with GCC defaulted to PIE, libc.a is compiled with -fPIE, regardless if --enable-static-pie is used to configure glibc. When glibc is configured with --enable-static-pie, libc.a is compiled with -fPIE, regardless whether GCC defaults to PIE or not. The same libc.a can be used to build both static executable and static PIE. There is no need for separate PIE copy of libc.a. On x86-64, the normal static sln: text data bss dec hex filename 625425 8284 5456 639165 9c0bd elf/sln the static PIE sln: text data bss dec hex filename 657626 20636 5392 683654 a6e86 elf/sln The code size is increased by 5% and the binary size is increased by 7%. Linker requirements to build glibc with --enable-static-pie: 1. Linker supports --no-dynamic-linker to remove PT_INTERP segment from static PIE. 2. Linker can create working static PIE. The x86-64 linker needs the fix for https://sourceware.org/bugzilla/show_bug.cgi?id=21782 The i386 linker needs to be able to convert "movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax" if main is defined locally. Binutils 2.29 or above are OK for i686 and x86-64. But linker status for other targets need to be verified. 3. Linker should resolve undefined weak symbols to 0 in static PIE: https://sourceware.org/bugzilla/show_bug.cgi?id=22269 4. Many ELF backend linkers incorrectly check bfd_link_pic for TLS relocations, which should check bfd_link_executable instead: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 Tested on aarch64, i686 and x86-64. Using GCC 7 and binutils master branch, build-many-glibcs.py with --enable-static-pie with all patches for static PIE applied have the following build successes: PASS: glibcs-aarch64_be-linux-gnu build PASS: glibcs-aarch64-linux-gnu build PASS: glibcs-armeb-linux-gnueabi-be8 build PASS: glibcs-armeb-linux-gnueabi build PASS: glibcs-armeb-linux-gnueabihf-be8 build PASS: glibcs-armeb-linux-gnueabihf build PASS: glibcs-arm-linux-gnueabi build PASS: glibcs-arm-linux-gnueabihf build PASS: glibcs-arm-linux-gnueabihf-v7a build PASS: glibcs-arm-linux-gnueabihf-v7a-disable-multi-arch build PASS: glibcs-m68k-linux-gnu build PASS: glibcs-microblazeel-linux-gnu build PASS: glibcs-microblaze-linux-gnu build PASS: glibcs-mips64el-linux-gnu-n32 build PASS: glibcs-mips64el-linux-gnu-n32-nan2008 build PASS: glibcs-mips64el-linux-gnu-n32-nan2008-soft build PASS: glibcs-mips64el-linux-gnu-n32-soft build PASS: glibcs-mips64el-linux-gnu-n64 build PASS: glibcs-mips64el-linux-gnu-n64-nan2008 build PASS: glibcs-mips64el-linux-gnu-n64-nan2008-soft build PASS: glibcs-mips64el-linux-gnu-n64-soft build PASS: glibcs-mips64-linux-gnu-n32 build PASS: glibcs-mips64-linux-gnu-n32-nan2008 build PASS: glibcs-mips64-linux-gnu-n32-nan2008-soft build PASS: glibcs-mips64-linux-gnu-n32-soft build PASS: glibcs-mips64-linux-gnu-n64 build PASS: glibcs-mips64-linux-gnu-n64-nan2008 build PASS: glibcs-mips64-linux-gnu-n64-nan2008-soft build PASS: glibcs-mips64-linux-gnu-n64-soft build PASS: glibcs-mipsel-linux-gnu build PASS: glibcs-mipsel-linux-gnu-nan2008 build PASS: glibcs-mipsel-linux-gnu-nan2008-soft build PASS: glibcs-mipsel-linux-gnu-soft build PASS: glibcs-mips-linux-gnu build PASS: glibcs-mips-linux-gnu-nan2008 build PASS: glibcs-mips-linux-gnu-nan2008-soft build PASS: glibcs-mips-linux-gnu-soft build PASS: glibcs-nios2-linux-gnu build PASS: glibcs-powerpc64le-linux-gnu build PASS: glibcs-powerpc64-linux-gnu build PASS: glibcs-tilegxbe-linux-gnu-32 build PASS: glibcs-tilegxbe-linux-gnu build PASS: glibcs-tilegx-linux-gnu-32 build PASS: glibcs-tilegx-linux-gnu build PASS: glibcs-tilepro-linux-gnu build and the following build failures: FAIL: glibcs-alpha-linux-gnu build elf/sln is failed to link due to: assertion fail bfd/elf64-alpha.c:4125 This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-hppa-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault] https://sourceware.org/bugzilla/show_bug.cgi?id=22537 FAIL: glibcs-ia64-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault] FAIL: glibcs-powerpc-linux-gnu build FAIL: glibcs-powerpc-linux-gnu-soft build FAIL: glibcs-powerpc-linux-gnuspe build FAIL: glibcs-powerpc-linux-gnuspe-e500v1 build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22264 FAIL: glibcs-powerpc-linux-gnu-power4 build elf/sln is failed to link due to: findlocale.c:96:(.text+0x22c): @local call to ifunc memchr This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-s390-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped assertion fail bfd/elflink.c:14299 This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-sh3eb-linux-gnu build FAIL: glibcs-sh3-linux-gnu build FAIL: glibcs-sh4eb-linux-gnu build FAIL: glibcs-sh4eb-linux-gnu-soft build FAIL: glibcs-sh4-linux-gnu build FAIL: glibcs-sh4-linux-gnu-soft build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 Also TLS code sequence in SH assembly syscalls in glibc doesn't match TLS code sequence expected by ld: https://sourceware.org/bugzilla/show_bug.cgi?id=22270 FAIL: glibcs-sparc64-linux-gnu build FAIL: glibcs-sparcv9-linux-gnu build FAIL: glibcs-tilegxbe-linux-gnu build FAIL: glibcs-tilegxbe-linux-gnu-32 build FAIL: glibcs-tilegx-linux-gnu build FAIL: glibcs-tilegx-linux-gnu-32 build FAIL: glibcs-tilepro-linux-gnu build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 [BZ #19574] * INSTALL: Regenerated. * Makeconfig (real-static-start-installed-name): New. (pic-default): Updated for --enable-static-pie. (pie-default): New for --enable-static-pie. (default-pie-ldflag): Likewise. (+link-static-before-libc): Replace $(DEFAULT-LDFLAGS-$(@F)) with $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)). Replace $(static-start-installed-name) with $(real-static-start-installed-name). (+prectorT): Updated for --enable-static-pie. (+postctorT): Likewise. (CFLAGS-.o): Add $(pie-default). (CFLAGS-.op): Likewise. * NEWS: Mention --enable-static-pie. * config.h.in (ENABLE_STATIC_PIE): New. * configure.ac (--enable-static-pie): New configure option. (have-no-dynamic-linker): New LIBC_CONFIG_VAR. (have-static-pie): Likewise. Enable static PIE if linker supports --no-dynamic-linker. (ENABLE_STATIC_PIE): New AC_DEFINE. (enable-static-pie): New LIBC_CONFIG_VAR. * configure: Regenerated. * csu/Makefile (omit-deps): Add r$(start-installed-name) and gr$(start-installed-name) for --enable-static-pie. (extra-objs): Likewise. (install-lib): Likewise. (extra-objs): Add static-reloc.o and static-reloc.os ($(objpfx)$(start-installed-name)): Also depend on $(objpfx)static-reloc.o. ($(objpfx)r$(start-installed-name)): New. ($(objpfx)g$(start-installed-name)): Also depend on $(objpfx)static-reloc.os. ($(objpfx)gr$(start-installed-name)): New. * csu/libc-start.c (LIBC_START_MAIN): Call _dl_relocate_static_pie in libc.a. * csu/libc-tls.c (__libc_setup_tls): Add main_map->l_addr to initimage. * csu/static-reloc.c: New file. * elf/Makefile (routines): Add dl-reloc-static-pie. (elide-routines.os): Likewise. (DEFAULT-LDFLAGS-tst-tls1-static-non-pie): Removed. (tst-tls1-static-non-pie-no-pie): New. * elf/dl-reloc-static-pie.c: New file. * elf/dl-support.c (_dl_get_dl_main_map): New function. * elf/dynamic-link.h (ELF_DURING_STARTUP): Also check STATIC_PIE_BOOTSTRAP. * elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise. * gmon/Makefile (tests): Add tst-gmon-static-pie. (tests-static): Likewise. (DEFAULT-LDFLAGS-tst-gmon-static): Removed. (tst-gmon-static-no-pie): New. (CFLAGS-tst-gmon-static-pie.c): Likewise. (CRT-tst-gmon-static-pie): Likewise. (tst-gmon-static-pie-ENV): Likewise. (tests-special): Likewise. ($(objpfx)tst-gmon-static-pie.out): Likewise. (clean-tst-gmon-static-pie-data): Likewise. ($(objpfx)tst-gmon-static-pie-gprof.out): Likewise. * gmon/tst-gmon-static-pie.c: New file. * manual/install.texi: Document --enable-static-pie. * sysdeps/generic/ldsodefs.h (_dl_relocate_static_pie): New. (_dl_get_dl_main_map): Likewise. * sysdeps/i386/configure.ac: Check if linker supports static PIE. * sysdeps/x86_64/configure.ac: Likewise. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure: Likewise. * sysdeps/mips/Makefile (ASFLAGS-.o): Add $(pie-default). (ASFLAGS-.op): Likewise.
* Add a test for profiling static executableH.J. Lu2017-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | The function, main, is added to profiling output of static executable which must link against gcrt1.o. * Makeconfig (+link-static-before-libc): Use the first of $(CRT-$(@F)) and $(csu-objpfx)$(static-start-installed-name). * gmon/Makefile (tests): Add tst-gmon-static. (tests-static): Likewise. (CFLAGS-tst-gmon-static.c): New. (CRT-tst-gmon-static): Likewise. (DEFAULT-LDFLAGS-tst-gmon-static): Likewise. (tst-gmon-static-ENV): Likewise. (tests-special): Likewise. ($(objpfx)tst-gmon-static.out): Likewise. (clean-tst-gmon-static-data): Likewise. ($(objpfx)tst-gmon-static-gprof.out): Likewise. * gmon/tst-gmon-static-gprof.sh: New file. * gmon/tst-gmon-static.c: Likewise.
* Remove add-ons mechanism.Joseph Myers2017-10-051-22/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use $(DEFAULT-LDFLAGS-$(@F)) in +link-static-before-libcH.J. Lu2017-10-041-0/+1
| | | | | | | | | | | | | | 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.
* Support mcount/gprof test with GCC defaulting to PIEH.J. Lu2017-08-171-1/+1
| | | | | | | 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.
* gmon: Add test for basic mcount/gprof functionalityFlorian Weimer2017-08-151-1/+1
|