* adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed)
@ 2022-01-23 11:23 Chan Kim
2022-01-23 11:36 ` Chan Kim
2022-01-23 16:46 ` jim.cromie
0 siblings, 2 replies; 4+ messages in thread
From: Chan Kim @ 2022-01-23 11:23 UTC (permalink / raw)
To: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 2512 bytes --]
Hello all,
In linux 5.4.21, when tell the compiler to use no optimzation for function
early_fixmap_init as below,
(I need to compile with O0 to follow what's happening here using gdb.)
#pragma GCC push_options
#pragma GCC optimze ("O0")
void __init early_fixmap_init(void)
{
...
}
#pragma GCC pop_options
I get this compiler error below. (make ARCH=arm64
CROSS_COMPILE=aarch64-none-elf- Image -j24)
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
CC drivers/irqchip/irq-gic-v3.o
In file included from ./include/linux/build_bug.h:5,
from ./arch/arm64/include/asm/sysreg.h:758,
from ./arch/arm64/include/asm/cputype.h:126,
from ./arch/arm64/include/asm/cache.h:8,
from ./include/linux/cache.h:6,
from arch/arm64/mm/mmu.c:9:
./arch/arm64/include/asm/pgalloc.h: In function '__pgd_populate.constprop':
./include/linux/compiler.h:350:38: error: call to '__compiletime_assert_88'
declared with attribute error: BUILD_BUG failed
350 | _compiletime_assert(condition, msg, __compiletime_assert_,
__LINE__)
| ^
./include/linux/compiler.h:331:4: note: in definition of macro
'__compiletime_assert'
331 | prefix ## suffix(); \
| ^~~~~~
./include/linux/compiler.h:350:2: note: in expansion of macro
'_compiletime_assert'
350 | _compiletime_assert(condition, msg, __compiletime_assert_,
__LINE__)
| ^~~~~~~~~~~~~~~~~~~
./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)
| ^~~~~~~~~~~~~~~~~~
./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")
| ^~~~~~~~~~~~~~~~
./arch/arm64/include/asm/pgalloc.h:88:2: note: in expansion of macro
'BUILD_BUG'
88 | BUILD_BUG();
| ^~~~~~~~~
make[2]: *** [scripts/Makefile.build:265: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:509: arch/arm64/mm] Error 2
make: *** [Makefile:1652: arch/arm64] Error 2
make: *** Waiting for unfinished jobs....
AR drivers/irqchip/built-in.a
AR drivers/built-in.
What does this mean and what should I do?
Thanks!
Chan Kim
[-- Attachment #1.2: Type: text/html, Size: 11025 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed)
2022-01-23 11:23 adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed) Chan Kim
@ 2022-01-23 11:36 ` Chan Kim
2022-01-23 16:46 ` jim.cromie
1 sibling, 0 replies; 4+ messages in thread
From: Chan Kim @ 2022-01-23 11:36 UTC (permalink / raw)
To: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 2950 bytes --]
I found adding the same #pragma directives warp to #include <linux/cache.h>
makes the compiler error go away!
#pragma GCC push_options
#pragma GCC optimize ("O0")
#include <linux/cache.h>
#pragma GCC pop_option
Chan
From: Chan Kim <ckim@etri.re.kr>
Sent: Sunday, January 23, 2022 8:23 PM
To: kernelnewbies@kernelnewbies.org
Subject: adding GCC optimze O0 to early_fixmap_init causes compiler error
(BUILD_BUG failed)
Hello all,
In linux 5.4.21, when tell the compiler to use no optimzation for function
early_fixmap_init as below,
(I need to compile with O0 to follow what's happening here using gdb.)
#pragma GCC push_options
#pragma GCC optimze ("O0")
void __init early_fixmap_init(void)
{
...
}
#pragma GCC pop_options
I get this compiler error below. (make ARCH=arm64
CROSS_COMPILE=aarch64-none-elf- Image -j24)
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
CC drivers/irqchip/irq-gic-v3.o
In file included from ./include/linux/build_bug.h:5,
from ./arch/arm64/include/asm/sysreg.h:758,
from ./arch/arm64/include/asm/cputype.h:126,
from ./arch/arm64/include/asm/cache.h:8,
from ./include/linux/cache.h:6,
from arch/arm64/mm/mmu.c:9:
./arch/arm64/include/asm/pgalloc.h: In function '__pgd_populate.constprop':
./include/linux/compiler.h:350:38: error: call to '__compiletime_assert_88'
declared with attribute error: BUILD_BUG failed
350 | _compiletime_assert(condition, msg, __compiletime_assert_,
__LINE__)
| ^
./include/linux/compiler.h:331:4: note: in definition of macro
'__compiletime_assert'
331 | prefix ## suffix(); \
| ^~~~~~
./include/linux/compiler.h:350:2: note: in expansion of macro
'_compiletime_assert'
350 | _compiletime_assert(condition, msg, __compiletime_assert_,
__LINE__)
| ^~~~~~~~~~~~~~~~~~~
./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)
| ^~~~~~~~~~~~~~~~~~
./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")
| ^~~~~~~~~~~~~~~~
./arch/arm64/include/asm/pgalloc.h:88:2: note: in expansion of macro
'BUILD_BUG'
88 | BUILD_BUG();
| ^~~~~~~~~
make[2]: *** [scripts/Makefile.build:265: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:509: arch/arm64/mm] Error 2
make: *** [Makefile:1652: arch/arm64] Error 2
make: *** Waiting for unfinished jobs....
AR drivers/irqchip/built-in.a
AR drivers/built-in.
What does this mean and what should I do?
Thanks!
Chan Kim
[-- Attachment #1.2: Type: text/html, Size: 12938 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed)
2022-01-23 11:23 adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed) Chan Kim
2022-01-23 11:36 ` Chan Kim
@ 2022-01-23 16:46 ` jim.cromie
2022-01-24 1:25 ` Chan Kim
1 sibling, 1 reply; 4+ messages in thread
From: jim.cromie @ 2022-01-23 16:46 UTC (permalink / raw)
To: Chan Kim; +Cc: kernelnewbies
On Sun, Jan 23, 2022 at 4:23 AM Chan Kim <ckim@etri.re.kr> wrote:
>
> Hello all,
>
> In linux 5.4.21, when tell the compiler to use no optimzation for function early_fixmap_init as below,
>
> (I need to compile with O0 to follow what’s happening here using gdb.)
>
> #pragma GCC push_options
>
> #pragma GCC optimze ("O0")
>
> void __init early_fixmap_init(void)
>
> {
>
> ...
>
> }
>
> #pragma GCC pop_options
>
>
>
> I get this compiler error below. (make ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- Image -j24)
>
> CALL scripts/atomic/check-atomics.sh
>
> CALL scripts/checksyscalls.sh
>
> CHK include/generated/compile.h
>
> CC arch/arm64/mm/mmu.o
>
> CC drivers/irqchip/irq-gic-v3.o
>
> In file included from ./include/linux/build_bug.h:5,
>
> from ./arch/arm64/include/asm/sysreg.h:758,
>
> from ./arch/arm64/include/asm/cputype.h:126,
>
> from ./arch/arm64/include/asm/cache.h:8,
>
> from ./include/linux/cache.h:6,
>
> from arch/arm64/mm/mmu.c:9:
>
> ./arch/arm64/include/asm/pgalloc.h: In function '__pgd_populate.constprop':
>
> ./include/linux/compiler.h:350:38: error: call to '__compiletime_assert_88' declared with attribute error: BUILD_BUG failed
>
> 350 | _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>
> | ^
>
> ./include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert'
>
> 331 | prefix ## suffix(); \
>
> | ^~~~~~
>
> ./include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
>
> 350 | _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>
> | ^~~~~~~~~~~~~~~~~~~
>
> ./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)
>
> | ^~~~~~~~~~~~~~~~~~
>
> ./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")
>
> | ^~~~~~~~~~~~~~~~
>
> ./arch/arm64/include/asm/pgalloc.h:88:2: note: in expansion of macro 'BUILD_BUG'
>
> 88 | BUILD_BUG();
>
> | ^~~~~~~~~
>
> make[2]: *** [scripts/Makefile.build:265: arch/arm64/mm/mmu.o] Error 1
>
> make[1]: *** [scripts/Makefile.build:509: arch/arm64/mm] Error 2
>
> make: *** [Makefile:1652: arch/arm64] Error 2
>
> make: *** Waiting for unfinished jobs....
>
> AR drivers/irqchip/built-in.a
>
> AR drivers/built-in.
>
>
>
> What does this mean and what should I do?
>
it means that some precondition failed, and you reached a known broken setup.
Instead of giving you a broken kernel, its told you that you have to
fix this 1st.
try making an intermediate output, forex:
make init/main.i
that should provide hints as to how you got to the BUILD_BUG
I dont think banging on -O compile options will help,
at least not after seeing GregKH opine on it.
> Thanks!
>
> Chan Kim
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed)
2022-01-23 16:46 ` jim.cromie
@ 2022-01-24 1:25 ` Chan Kim
0 siblings, 0 replies; 4+ messages in thread
From: Chan Kim @ 2022-01-24 1:25 UTC (permalink / raw)
To: jim.cromie, Greg KH; +Cc: 'kernelnewbies'
Hi, As I sent already the error message shows the discrepancy starts from include/linux/cache.h,
So I added the same #pragma thing around that #include <linux/cache.h> and the compile error is gone.
This is only for debugging a boot failure in a qemu machine (which is for a real fpga board), so I can follow the code with gdb.
And I needed to analyzing what kernel does until the problem occurs, though it isn't an easy task for me to follow.(but I think it's worth it.)
Thanks for the comments.
Chan
> -----Original Message-----
> From: jim.cromie@gmail.com <jim.cromie@gmail.com>
> Sent: Monday, January 24, 2022 1:47 AM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
> Subject: Re: adding GCC optimze O0 to early_fixmap_init causes compiler
> error (BUILD_BUG failed)
>
> On Sun, Jan 23, 2022 at 4:23 AM Chan Kim <ckim@etri.re.kr> wrote:
> >
> > Hello all,
> >
> > In linux 5.4.21, when tell the compiler to use no optimzation for
> > function early_fixmap_init as below,
> >
> > (I need to compile with O0 to follow what’s happening here using gdb.)
> >
> > #pragma GCC push_options
> >
> > #pragma GCC optimze ("O0")
> >
> > void __init early_fixmap_init(void)
> >
> > {
> >
> > ...
> >
> > }
> >
> > #pragma GCC pop_options
> >
> >
> >
> > I get this compiler error below. (make ARCH=arm64
> > CROSS_COMPILE=aarch64-none-elf- Image -j24)
> >
> > CALL scripts/atomic/check-atomics.sh
> >
> > CALL scripts/checksyscalls.sh
> >
> > CHK include/generated/compile.h
> >
> > CC arch/arm64/mm/mmu.o
> >
> > CC drivers/irqchip/irq-gic-v3.o
> >
> > In file included from ./include/linux/build_bug.h:5,
> >
> > from ./arch/arm64/include/asm/sysreg.h:758,
> >
> > from ./arch/arm64/include/asm/cputype.h:126,
> >
> > from ./arch/arm64/include/asm/cache.h:8,
> >
> > from ./include/linux/cache.h:6,
> >
> > from arch/arm64/mm/mmu.c:9:
> >
> > ./arch/arm64/include/asm/pgalloc.h: In function
> '__pgd_populate.constprop':
> >
> > ./include/linux/compiler.h:350:38: error: call to
> > '__compiletime_assert_88' declared with attribute error: BUILD_BUG
> > failed
> >
> > 350 | _compiletime_assert(condition, msg, __compiletime_assert_,
> > __LINE__)
> >
> > | ^
> >
> > ./include/linux/compiler.h:331:4: note: in definition of macro
> '__compiletime_assert'
> >
> > 331 | prefix ## suffix(); \
> >
> > | ^~~~~~
> >
> > ./include/linux/compiler.h:350:2: note: in expansion of macro
> '_compiletime_assert'
> >
> > 350 | _compiletime_assert(condition, msg, __compiletime_assert_,
> > __LINE__)
> >
> > | ^~~~~~~~~~~~~~~~~~~
> >
> > ./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)
> >
> > | ^~~~~~~~~~~~~~~~~~
> >
> > ./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")
> >
> > | ^~~~~~~~~~~~~~~~
> >
> > ./arch/arm64/include/asm/pgalloc.h:88:2: note: in expansion of macro
> 'BUILD_BUG'
> >
> > 88 | BUILD_BUG();
> >
> > | ^~~~~~~~~
> >
> > make[2]: *** [scripts/Makefile.build:265: arch/arm64/mm/mmu.o] Error 1
> >
> > make[1]: *** [scripts/Makefile.build:509: arch/arm64/mm] Error 2
> >
> > make: *** [Makefile:1652: arch/arm64] Error 2
> >
> > make: *** Waiting for unfinished jobs....
> >
> > AR drivers/irqchip/built-in.a
> >
> > AR drivers/built-in.
> >
> >
> >
> > What does this mean and what should I do?
> >
>
> it means that some precondition failed, and you reached a known broken
> setup.
> Instead of giving you a broken kernel, its told you that you have to fix
> this 1st.
>
> try making an intermediate output, forex:
> make init/main.i
>
> that should provide hints as to how you got to the BUILD_BUG
>
> I dont think banging on -O compile options will help, at least not after
> seeing GregKH opine on it.
>
> > Thanks!
> >
> > Chan Kim
> >
> >
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-24 1:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 11:23 adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed) Chan Kim
2022-01-23 11:36 ` Chan Kim
2022-01-23 16:46 ` jim.cromie
2022-01-24 1:25 ` Chan Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.