Skip to contentSkip to conversation

linux-next: build failure after merge of the tip tree

PATCH Superseded Stephen Rothwell 5 participants 12 messages Oct 9, 2020 – Oct 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (perf) failed like this:

In file included from tools/include/linux/build_bug.h:5,
from tools/include/linux/kernel.h:8,
from util/intel-pt-decoder/intel-pt-insn-decoder.c:7:
util/intel-pt-decoder/../../../arch/x86/lib/insn.c: In function '__insn_get_emulate_prefix':
tools/include/linux/compiler.h:37:38: error: nested extern declaration of '__compiletime_assert_0' [-Werror=nested-externs]
37 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

      |                                      ^~~~~~~~~~~~~~~~~~~~~
tools/include/linux/compiler.h:16:15: note: in definition of macro '__compiletime_assert'
   16 |   extern void prefix ## suffix(void) __compiletime_error(msg); \
      |               ^~~~~~
tools/include/linux/compiler.h:37:2: note: in expansion of macro '_compiletime_assert'
   37 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
tools/include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
tools/include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
   59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
      |                     ^~~~~~~~~~~~~~~~
util/intel-pt-decoder/../../../arch/x86/lib/insn.c:27:3: note: in expansion of macro 'BUILD_BUG'
   27 |   BUILD_BUG(); break;     \
      |   ^~~~~~~~~

util/intel-pt-decoder/../../../arch/x86/lib/insn.c:40:41: note: in expansion of macro 'leXX_to_cpu'
40 | ({ t r = *(t*)((insn)->next_byte + n); leXX_to_cpu(t, r); })
| ^~~~~~~~~~~
util/intel-pt-decoder/../../../arch/x86/lib/insn.c:46:61: note: in expansion of macro '__peek_nbyte_next'
46 | ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
| ^~~~~~~~~~~~~~~~~
util/intel-pt-decoder/../../../arch/x86/lib/insn.c:86:7: note: in expansion of macro 'peek_nbyte_next'
86 | if (peek_nbyte_next(insn_byte_t, insn, i) != prefix[i])

      |       ^~~~~~~~~~~~~~~

Caused by commit

2a522b53c470 ("x86/insn: Support big endian cross-compiles")

I have reverted commits

a23b701ae9b3 objtool: Rework header include paths 1b4998c364bc objtool: Fix x86 orc generation on big endian cross compiles 317664a7fcc9 objtool: Fix reloc generation on big endian cross compiles 2a522b53c470 x86/insn: Support big endian cross-compiles 2486baae2cf6 objtool: Allow nested externs to enable BUILD_BUG()

for today.

This is a PowerPC LE native build of tools/perf.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 12 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (perf) failed like this:

In file included from tools/include/linux/build_bug.h:5,
from tools/include/linux/kernel.h:8,
from util/intel-pt-decoder/intel-pt-insn-decoder.c:7:
util/intel-pt-decoder/../../../arch/x86/lib/insn.c: In function '__insn_get_emulate_prefix':
tools/include/linux/compiler.h:37:38: error: nested extern declaration of '__compiletime_assert_0' [-Werror=nested-externs]
37 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

      |                                      ^~~~~~~~~~~~~~~~~~~~~

...snip...

Quoted 13 lines

Caused by commit

2a522b53c470 ("x86/insn: Support big endian cross-compiles")

I have reverted commits

a23b701ae9b3 objtool: Rework header include paths 1b4998c364bc objtool: Fix x86 orc generation on big endian cross compiles 317664a7fcc9 objtool: Fix reloc generation on big endian cross compiles 2a522b53c470 x86/insn: Support big endian cross-compiles 2486baae2cf6 objtool: Allow nested externs to enable BUILD_BUG()

Quoted 3 lines

for today.

This is a PowerPC LE native build of tools/perf.

Oh, I missed that. Sorry about that. Obviously x86 instruction decoder is also used in perf. The question is, should we just disable -Wnested-externs for perf like we did for the objtool. Or since we got BUILD_BUG() implementation in tools simply disable -Wnested-externs for all tools altogether? By throwing it out of EXTRA_WARNINGS.

Vasily Gorbik (1):
perf build: Allow nested externs to enable BUILD_BUG() usage

 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 6 lines
⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿
⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿
⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿
⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿
⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿
#2 lore raw

PATCH 1/1 perf build: Allow nested externs to enable BUILD_BUG() usage

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();

} while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 190be4fa5c21..8137a6046a47 100644
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
 
 include $(srctree)/tools/scripts/Makefile.arch
 
Signature · 6 lines
⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿
⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿
⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿
⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿
⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿
#3 lore raw

Re: [PATCH 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

Quoted 25 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +0 -0
index 190be4fa5c21..8137a6046a47 100644

tools/perf/Makefile.config $(shell printf "" > $(OUTPUT).config-detected) · line 19

Quoted 5 lines
tools/perf/Makefile.config +1 -1
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))

looks good, but I can't apply the patch with 'git am'

Applying: perf build: Allow nested externs to enable BUILD_BUG() usage
error: patch failed: tools/perf/Makefile.config:16
error: tools/perf/Makefile.config: patch does not apply
Patch failed at 0001 perf build: Allow nested externs to enable BUILD_BUG() usage
hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

I wonder it's that picture at the bottom ;-)

jirka

Quoted 10 lines
tools/perf/Makefile.config +0 -1
 include $(srctree)/tools/scripts/Makefile.arch
 
-- 

⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿
⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿
⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿
⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿
⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿

#4 lore raw

Re: [PATCH 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

Quoted 2 lines · Jiri Olsa
Quoted 1 line · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

...snip...

Quoted 22 lines

tools/perf/Makefile.config $(shell printf "" > $(OUTPUT).config-detected) · line 19

Quoted 10 lines
tools/perf/Makefile.config +1 -1
index 190be4fa5c21..8137a6046a47 100644
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))

looks good, but I can't apply the patch with 'git am'

Applying: perf build: Allow nested externs to enable BUILD_BUG() usage
error: patch failed: tools/perf/Makefile.config:16
error: tools/perf/Makefile.config: patch does not apply
Patch failed at 0001 perf build: Allow nested externs to enable BUILD_BUG() usage
hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Quoted 16 lines

I wonder it's that picture at the bottom ;-)

jirka

Quoted 10 lines
tools/perf/Makefile.config +0 -1
 include $(srctree)/tools/scripts/Makefile.arch
 
-- 

⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿
⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿
⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿
⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿
⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿

What? This makes tux and blind people very unhappy. Those are nothing else but braille utf-8 characters. And I've seen people on lkml are using those, i.e. debian icon in a signature. Oh, well... I'll avoid using this signature in future.

BTW which branch did you try to apply it on? I've just checked perf/core and there should be no conflicts as well. But I assume this should go via objtool together with other changes which introduced that BUILD_BUG() usage.

Anyhow I've resent the patch without fancy signatures included.

#5 lore raw

PATCH RESEND 1/1 perf build: Allow nested externs to enable BUILD_BUG() usage

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();

} while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

---
Resend with no fancy signatures.

 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 854da830b5ca..834061e94e7c 100644
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
 
 include $(srctree)/tools/scripts/Makefile.arch
 
Signature · 1 line
2.25.4
Acked-by on v1 1/1
#6 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

Quoted 8 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);
Quoted 8 lines

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

that one applied nicely ;-) thanks

jirka

Quoted 22 lines

---
Resend with no fancy signatures.

 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 854da830b5ca..834061e94e7c 100644
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
 
 include $(srctree)/tools/scripts/Makefile.arch
 
Signature · 1 line
2.25.4
#7 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

Hi all,

Quoted 16 lines · On Fri, 9 Oct 2020 14:41:11 +0200 Jiri Olsa <[email protected]> wrote:
Quoted 14 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

Quoted 6 lines
Quoted 2 lines

that one applied nicely ;-) thanks

I will apply that patch to the merge of the tip tree today (instead of reverting the series I reverted in Friday) (unless I get an update of the tip tree containing it, of course).

Signature · 2 lines
Cheers,
Stephen Rothwell
author Tested-by
#8 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

Hi all,

Quoted 21 lines · On Mon, 12 Oct 2020 08:59:36 +1100 Stephen Rothwell <[email protected]>…
Quoted 19 lines · On Fri, 9 Oct 2020 14:41:11 +0200 Jiri Olsa <[email protected]> wrote:
Quoted 16 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

Quoted 7 lines
Quoted 3 lines

that one applied nicely ;-) thanks

I will apply that patch to the merge of the tip tree today (instead of reverting the series I reverted in Friday) (unless I get an update of the tip tree containing it, of course).

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer Applied
#9 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

In reply to Stephen Rothwell

Em Mon, Oct 12, 2020 at 08:59:36AM +1100, Stephen Rothwell escreveu:

Quoted 22 lines

Hi all,

Quoted 19 lines · On Fri, 9 Oct 2020 14:41:11 +0200 Jiri Olsa <[email protected]> wrote:
Quoted 16 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

Quoted 7 lines
Quoted 3 lines

that one applied nicely ;-) thanks

I will apply that patch to the merge of the tip tree today (instead of reverting the series I reverted in Friday) (unless I get an update of the tip tree containing it, of course).

Applied to perf/core that will go to Linus this week, maybe even today.

- Arnaldo

maintainer Applied
#10 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

In reply to Jiri Olsa

Em Fri, Oct 09, 2020 at 02:41:11PM +0200, Jiri Olsa escreveu:

Quoted 15 lines · Vasily Gorbik
Quoted 14 lines

Currently BUILD_BUG() macro is expanded to smth like the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

Quoted 6 lines
Quoted 2 lines

that one applied nicely ;-) thanks

Thanks, applied.

- Arnaldo

#11 lore raw

Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

In reply to Vasily Gorbik
Quoted 2 lines · Vasily Gorbik

Currently BUILD_BUG() macro is expanded to smth like the following:

Two feedbacks:

#1: Greg KH told me to expand abbreviated words, here "smth = something".

#2: Interesting to see an ASCII-art in the signature is causing such troubles.

- Sedat -

Quoted 36 lines
   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf includes in intel-pt-decoder, build perf without -Wnested-externs.

---
Resend with no fancy signatures.

 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -2
index 854da830b5ca..834061e94e7c 100644
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
 
 include $(srctree)/tools/scripts/Makefile.arch
 
--

2.25.4