diff mbox series

[2/7] Generate gcc-macros.h

Message ID 589769aee82434f370de47d9746aec521aab1f46.1642162312.git.fweimer@redhat.com
State Committed
Commit ef7c6d42fe163a5e49a478c43e655ce4633fa5ba
Headers show
Series Reliable CPU compatibility diagnostics in ld.so | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer Jan. 14, 2022, 12:40 p.m. UTC
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.
---
 Makeconfig | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

H.J. Lu Jan. 14, 2022, 2:24 p.m. UTC | #1
On Fri, Jan 14, 2022 at 4:42 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> 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.
> ---
>  Makeconfig | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/Makeconfig b/Makeconfig
> index 9b6fc6b08f..2e79077343 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -1202,6 +1202,15 @@ $(common-objpfx)dl-tunable-list.stmp: \
>         touch $@
>  endif
>
> +# Dump the GCC macros used by the default compiler flags to a header
> +# file, so that they can be inspected when using different compiler
> +# flags.  Add the GCCMACRO prefix to make these macro names unique.
> +$(common-objpfx)gcc-macros.h.in: $(common-objpfx)config.status
> +       $(CC) $(CFLAGS) $(CPPFLAGS) -E -dM -x c -o $@ /dev/null
> +$(common-objpfx)gcc-macros.h: $(common-objpfx)gcc-macros.h.in
> +       sed 's/^#define /#define GCCMACRO/' < $< > $@
> +before-compile += $(common-objpfx)gcc-macros.h
> +
>  # Generate version maps, but wait until sysdep-subdirs is known
>  ifeq ($(sysd-sorted-done),t)
>  ifeq ($(build-shared),yes)
> --
> 2.34.1
>
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.
diff mbox series

Patch

diff --git a/Makeconfig b/Makeconfig
index 9b6fc6b08f..2e79077343 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1202,6 +1202,15 @@  $(common-objpfx)dl-tunable-list.stmp: \
 	touch $@
 endif
 
+# Dump the GCC macros used by the default compiler flags to a header
+# file, so that they can be inspected when using different compiler
+# flags.  Add the GCCMACRO prefix to make these macro names unique.
+$(common-objpfx)gcc-macros.h.in: $(common-objpfx)config.status
+	$(CC) $(CFLAGS) $(CPPFLAGS) -E -dM -x c -o $@ /dev/null
+$(common-objpfx)gcc-macros.h: $(common-objpfx)gcc-macros.h.in
+	sed 's/^#define /#define GCCMACRO/' < $< > $@
+before-compile += $(common-objpfx)gcc-macros.h
+
 # Generate version maps, but wait until sysdep-subdirs is known
 ifeq ($(sysd-sorted-done),t)
 ifeq ($(build-shared),yes)