Re: [PATCH] kbuild: simpler generation of constants for assembly

From: Alexey Dobriyan
Date: Fri Jun 10 2016 - 07:14:07 EST


On Fri, Jun 3, 2016 at 2:24 AM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sat, 21 May 2016 01:27:36 +0300 Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
>
>> Instead of showing how cool sed(1) invocation could be, rely on the fact
>> that gcc doesn't really look inside "asm" statement body and more or less
>> directly emits it into assembly. Pretend "#define" is an instruction.
>>
>> %a prints integer as plain integer without '$' or other characters.
>> C++ comment takes care of trailing '#' character nobody asked for.
>>
>> Remove empty lines in generated file while I'm at it.
>>
>> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
>> ---
>>
>> NOT compile tested on ia64.
>> Compile tested on arm.
>
> I tried ia64 defconfig and it exploded.

> In file included from include/linux/mm_types.h:14,
> from include/linux/sched.h:27,
> from arch/ia64/kernel/asm-offsets.c:9:
> include/linux/page-flags-layout.h:14:18: error: operator '<' has no left operand
> include/linux/page-flags-layout.h:16:20: error: operator '<=' has no left operand
> include/linux/page-flags-layout.h:18:20: error: operator '<=' has no left operand
> include/linux/page-flags-layout.h:20:20: error: operator '<=' has no left operand
> include/linux/page-flags-layout.h:23:2: error: #error ZONES_SHIFT -- too many zones configured adjust calculation

"%0" :: "i" (x) prints number with $ sign.
"%a0" :: "i" (x) prints number without $ sign.

on ia64:
"%0: prints number without $.
"%a0" prints nothing.

I can add special case for ia64 but other archs can be inconsistent as well.

Alexey