From f5d1f629c693bc30ccc8ff1246cb37986c1adb1c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 23 Feb 2018 11:29:27 -0800 Subject: Define GEN_AS_CONST_HEADERS when generating header files [BZ #22792] Glibc build generates header files to define constants from special .sym files. If a .sym file includes the same header file which it generates, it leads to circular dependency which may lead to build hang on a many-core machine. Define GEN_AS_CONST_HEADERS when generating header files to avoid circular dependency. is needed for i686 and it isn't needed for x86-64 at least since glibc 2.23. Tested on i686 and x86-64. [BZ #22792] * Makerules ($(common-objpfx)%.h): Pass -DGEN_AS_CONST_HEADERS to $(CC). * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Include only if GEN_AS_CONST_HEADERS isn't defined. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Don't include . --- Makerules | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Makerules') diff --git a/Makerules b/Makerules index ef6abeac6d..b2c2724fcb 100644 --- a/Makerules +++ b/Makerules @@ -276,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: is generated from tcb-offsets.sym to define +# offsets and sizes of types in and maybe which +# may include . 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 -- cgit 1.4.1