error: impossible constraint in 'asm' when compiling kernel code with -O0 option

Jeffrey Walton noloader at gmail.com
Wed Oct 6 01:54:16 EDT 2021


On Tue, Oct 5, 2021 at 10:59 PM <ckim at etri.re.kr> wrote:
>
> In linux-5.4.21 code,
>
> To prevent some variables from being ‘optimized out’ during kernel code analysis using gdb, I added in drivers/iommu/Makefile,
> ...
> ./include/linux/compiler-gcc.h:120:38: error: impossible constraint in 'asm'
>
>   120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
>...
>
> ./arch/arm64/include/asm/jump_label.h:38:2: note: in expansion of macro 'asm_volatile_goto'
>
>    38 |  asm_volatile_goto(
>
>       |  ^~~~~~~~~~~~~~~~~
>
> make[2]: *** [scripts/Makefile.build:266: drivers/iommu/io-pgtable-arm.o] Error 1
>
> make[1]: *** [scripts/Makefile.build:509: drivers/iommu] Error 2
>
> make: *** [Makefile:1652: drivers] Error 2
>
> Does anybody know how can I use -O0 flag? (I tried -Og flag but some variables are still optimized out).

Does goto(x) eventually paste x? I.e.,  ##x? Also see token pasting at
https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html.

Jeff



More information about the Kernelnewbies mailing list