adding GCC optimze O0 to early_fixmap_init causes compiler error (BUILD_BUG failed)

Chan Kim ckim at
Sun Jan 23 06:23:17 EST 2022

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/

  CALL    scripts/

  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_,

      |                                      ^

./include/linux/compiler.h:331:4: note: in definition of macro

  331 |    prefix ## suffix();    \

      |    ^~~~~~

./include/linux/compiler.h:350:2: note: in expansion of macro

  350 |  _compiletime_assert(condition, msg, __compiletime_assert_,

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

./include/linux/build_bug.h:39:37: note: in expansion of macro

   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)

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

./include/linux/build_bug.h:59:21: note: in expansion of macro

   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

   88 |  BUILD_BUG();

      |  ^~~~~~~~~

make[2]: *** [scripts/ arch/arm64/mm/mmu.o] Error 1

make[1]: *** [scripts/ 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?


Chan Kim


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Kernelnewbies mailing list