94084c
commit ef7c6d42fe163a5e49a478c43e655ce4633fa5ba
94084c
Author: Florian Weimer <fweimer@redhat.com>
94084c
Date:   Fri Jan 14 16:09:20 2022 +0100
94084c
94084c
    Generate gcc-macros.h
94084c
    
94084c
    The file can be used to check the effect of the default compiler
94084c
    flags on code generation even in areas of the build that uses
94084c
    non-default compiler flags.
94084c
    
94084c
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
94084c
94084c
diff --git a/Makeconfig b/Makeconfig
94084c
index 8bc5540292c7b6fa..99898a632a64be91 100644
94084c
--- a/Makeconfig
94084c
+++ b/Makeconfig
94084c
@@ -1202,6 +1202,15 @@ $(common-objpfx)dl-tunable-list.stmp: \
94084c
 	touch $@
94084c
 endif
94084c
 
94084c
+# Dump the GCC macros used by the default compiler flags to a header
94084c
+# file, so that they can be inspected when using different compiler
94084c
+# flags.  Add the GCCMACRO prefix to make these macro names unique.
94084c
+$(common-objpfx)gcc-macros.h.in: $(common-objpfx)config.status
94084c
+	$(CC) $(CFLAGS) $(CPPFLAGS) -E -dM -x c -o $@ /dev/null
94084c
+$(common-objpfx)gcc-macros.h: $(common-objpfx)gcc-macros.h.in
94084c
+	sed 's/^#define /#define GCCMACRO/' < $< > $@
94084c
+before-compile += $(common-objpfx)gcc-macros.h
94084c
+
94084c
 # Generate version maps, but wait until sysdep-subdirs is known
94084c
 ifeq ($(sysd-sorted-done),t)
94084c
 ifeq ($(build-shared),yes)