Re: [PATCH v2] arch: use ASM_NL instead of ';' for assembler newline character in the macro

From: Chen Gang
Date: Thu Nov 21 2013 - 05:50:30 EST


On 11/21/2013 05:58 PM, Vineet Gupta wrote:
> On 11/01/2013 11:15 AM, Vineet Gupta wrote:
>> +CC Sam, Tim, Joe, Michal, David
>>
>> Guys can you please take a look at this patch and suggest the best way to merge.
>>
>> The root cause is some gas ports (including ARC) use ';' for comment (vs. newline)
>> More background at https://lkml.org/lkml/2013/10/24/365
>
> Ping ! Any objections to this. Given that this is exception case, it is simpler
> than defining a Kconfig control.
>

Hmm... I guess your meaning is that define a macro (e.g. ASM_NL) in
Kconfig instead of in "asm/linkage.h".

For me, I still recommend to define a macro in "asm/linkage.h", "in
Kconfig" is not quite straight and simple than current way:

- "in Kconfig" need 2 macros for it, but "asm/linkage.h" need 1.

- Kconfig is normally for using configurations (face to downstream)
upstream related configurations (e.g. related with compiler) are
often in Makefile or specific header files (e.g "linkage.h")

Thanks.

> -Vineet
>>
>>
>> On 10/29/2013 07:21 AM, Chen Gang wrote:
>>> For some assemblers, they use another character as newline in a macro
>>> (e.g. arc uses '`'), so for generic assembly code, need use ASM_NL (a
>>> macro) instead of ';' for it.
>>>
>>> Also need notice about code styles ('\t' for each line).
>>>
>>>
>>> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
>>> ---
>>> arch/arc/include/asm/linkage.h | 2 ++
>>> include/linux/linkage.h | 19 ++++++++++++-------
>>> 2 files changed, 14 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h
>>> index 0283e9e..66ee552 100644
>>> --- a/arch/arc/include/asm/linkage.h
>>> +++ b/arch/arc/include/asm/linkage.h
>>> @@ -11,6 +11,8 @@
>>>
>>> #ifdef __ASSEMBLY__
>>>
>>> +#define ASM_NL ` /* use '`' to mark new line in macro */
>>> +
>>> /* Can't use the ENTRY macro in linux/linkage.h
>>> * gas considers ';' as comment vs. newline
>>> */
>>> diff --git a/include/linux/linkage.h b/include/linux/linkage.h
>>> index d3e8ad2..a6a42dd 100644
>>> --- a/include/linux/linkage.h
>>> +++ b/include/linux/linkage.h
>>> @@ -6,6 +6,11 @@
>>> #include <linux/export.h>
>>> #include <asm/linkage.h>
>>>
>>> +/* Some toolchains use other characters (e.g. '`') to mark new line in macro */
>>> +#ifndef ASM_NL
>>> +#define ASM_NL ;
>>> +#endif
>>> +
>>> #ifdef __cplusplus
>>> #define CPP_ASMLINKAGE extern "C"
>>> #else
>>> @@ -75,21 +80,21 @@
>>>
>>> #ifndef ENTRY
>>> #define ENTRY(name) \
>>> - .globl name; \
>>> - ALIGN; \
>>> - name:
>>> + .globl name ASM_NL \
>>> + ALIGN ASM_NL \
>>> + name:
>>> #endif
>>> #endif /* LINKER_SCRIPT */
>>>
>>> #ifndef WEAK
>>> #define WEAK(name) \
>>> - .weak name; \
>>> + .weak name ASM_NL \
>>> name:
>>> #endif
>>>
>>> #ifndef END
>>> #define END(name) \
>>> - .size name, .-name
>>> + .size name, .-name
>>> #endif
>>>
>>> /* If symbol 'name' is treated as a subroutine (gets called, and returns)
>>> @@ -98,8 +103,8 @@
>>> */
>>> #ifndef ENDPROC
>>> #define ENDPROC(name) \
>>> - .type name, @function; \
>>> - END(name)
>>> + .type name, @function ASM_NL \
>>> + END(name)
>>> #endif
>>>
>>> #endif
>>>
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>


--
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/