]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - Makerules
NEWS: Mention bug 24112.
[thirdparty/glibc.git] / Makerules
index 7656c492da55b73632961cc212a098674fba3e62..a10a0b4d7021e8ecb517ab57bef5e630892fd814 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2017 Free Software Foundation, Inc.
+# Copyright (C) 1991-2018 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -134,6 +134,14 @@ $(common-objpfx)cstdlib: $(c++-cstdlib-header)
 $(common-objpfx)cmath: $(c++-cmath-header)
        $(INSTALL_DATA) $< $@T
        $(move-if-change) $@T $@
+ifneq (,$(c++-bits-std_abs-h))
+# Also make a copy of <bits/std_abs.h> from GCC 7 to prevent it from
+# including /usr/include/stdlib.h.
+before-compile := $(common-objpfx)bits/std_abs.h $(before-compile)
+$(common-objpfx)bits/std_abs.h: $(c++-bits-std_abs-h)
+       $(INSTALL_DATA) $< $@T
+       $(move-if-change) $@T $@
+endif
 endif
 
 before-compile := $(common-objpfx)libc-abis.h $(before-compile)
@@ -268,10 +276,17 @@ ifdef gen-as-const-headers
 # Generating headers for assembly constants.
 # We need this defined early to get into before-compile before
 # it's used in sysd-rules, below.
+# Define GEN_AS_CONST_HEADERS to avoid circular dependency [BZ #22792].
+# NB: <tcb-offsets.h> is generated from tcb-offsets.sym to define
+# offsets and sizes of types in <tls.h> and maybe <pthread.h> which
+# may include <tcb-offsets.h>.  Target header files can check if
+# GEN_AS_CONST_HEADERS is defined to avoid circular dependency which
+# may lead to build hang on a many-core machine.
 $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
                                           %.sym $(common-before-compile)
        $(AWK) -f $< $(filter %.sym,$^) \
-       | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) -x c - \
+       | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) \
+               -DGEN_AS_CONST_HEADERS -x c - \
                -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)'
        sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \
                $(@:.h.d=.h)T3 > $(@:.h.d=.h)T
@@ -633,9 +648,6 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 PROVIDE(__start___libc_atexit = .);\
                 __libc_atexit : { *(__libc_atexit) }\
                 PROVIDE(__stop___libc_atexit = .);\
-                PROVIDE(__start___libc_thread_subfreeres = .);\
-                __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
-                PROVIDE(__stop___libc_thread_subfreeres = .);\
                 PROVIDE(__start___libc_IO_vtables = .);\
                 __libc_IO_vtables : { *(__libc_IO_vtables) }\
                 PROVIDE(__stop___libc_IO_vtables = .);\
@@ -678,14 +690,17 @@ $(build-module-helper) -o $@ $(shlib-lds-flags) \
 $(call after-link,$@)
 endef
 
+# sofini.os must be placed last since it terminates .eh_frame section.
 build-module-helper-objlist = \
        $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
                   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
+                               $(elf-objpfx)sofini.os \
                                $(link-libc-deps),$^))
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
 build-shlib-objlist = $(build-module-helper-objlist) \
-                     $(LDLIBS-$(@F:lib%.so=%).so)
+                     $(LDLIBS-$(@F:lib%.so=%).so) \
+                     $(filter $(elf-objpfx)sofini.os,$^)
 
 # Don't try to use -lc when making libc.so itself.
 # Also omits crti.o and crtn.o, which we do not want
@@ -1068,6 +1083,12 @@ rm -f $@.new
 $(SHELL) $(..)scripts/rellns-sh $< $@.new
 mv -f $@.new $@
 endef
+define make-link-multidir
+$(patsubst %/,cd %,$(objpfx)); \
+  $(addprefix $(abspath $(..)scripts/mkinstalldirs) ,$(dir $(multidir))); \
+  $(LN_S) . $(multidir) 2> /dev/null; \
+  test -L $(multidir)
+endef
 else
 # If we have no symbolic links don't bother with rellns-sh.
 define make-link
@@ -1075,6 +1096,10 @@ rm -f $@.new
 $(LN_S) $< $@.new
 mv -f $@.new $@
 endef
+define make-link-multidir
+$(make-target-directory)
+ln -f $(objpfx)/$(@F) $@
+endef
 endif
 
 ifeq (yes,$(build-shared))
@@ -1351,7 +1376,8 @@ lib := testsuite
 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
 
-all-nonlib := $(strip $(tests-internal) $(test-internal-extras) $(others))
+all-nonlib := $(strip $(tests-internal) $(test-internal-extras) \
+                     $(others) $(others-extras))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
@@ -1513,8 +1539,7 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
                   $(common-objpfx)config.make
        $(make-target-directory)
        { echo '#include "$(..)posix/bits/posix1_lim.h"';               \
-         echo '#define _LIBC 1';                                       \
-         echo '#include "$(..)misc/sys/uio.h"'; } |                    \
+       } |                                                             \
        $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)'   \
              $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
        sed $(sed-remove-objpfx) $(sed-remove-dotdot)                   \
@@ -1522,21 +1547,14 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
        mv -f $(@:st=dt) $(@:st=d)
        fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`;       \
        filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;    \
-       iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`;        \
        fopen_max=$${fopen_max:-16};                                    \
        filename_max=$${filename_max:-1024};                            \
-       if [ -z "$$iov_max" ]; then                                     \
-         define_iov_max="# undef IOV_MAX";                             \
-       else                                                            \
-         define_iov_max="# define IOV_MAX $$iov_max";                  \
-       fi;                                                             \
        sed -e "s/@FOPEN_MAX@/$$fopen_max/"                             \
            -e "s/@FILENAME_MAX@/$$filename_max/"                       \
            -e "s/@L_tmpnam@/$(L_tmpnam)/"                              \
            -e "s/@TMP_MAX@/$(TMP_MAX)/"                                \
            -e "s/@L_ctermid@/$(L_ctermid)/"                            \
            -e "s/@L_cuserid@/$(L_cuserid)/"                            \
-           -e "s/@define_IOV_MAX@/$$define_iov_max/"                   \
            $< > $(@:st=h.new)
        $(move-if-change) $(@:st=h.new) $(@:st=h)
 # Remove these last so that they can be examined if something went wrong.