Skip to contentSkip to conversation

vmlinux.lds.h: Clean up errors in vmlinux.lds.h

PATCH NAK KaiLong Wang 4 participants 5 messages Sep 28, 2023 – Oct 5, 2023 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmlinux.lds.h: Clean up errors in vmlinux.lds.h

Fix the following errors reported by checkpatch:

ERROR: spaces required around that ':' (ctx:WxV)
ERROR: space required after that ',' (ctx:VxO)
ERROR: need consistent spacing around '*' (ctx:VxW)

---
 include/asm-generic/vmlinux.lds.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
include/asm-generic/vmlinux.lds.h +11 -11
index 9c59409104f6..9e19234bbf97 100644
@@ -63,8 +63,8 @@
  * up in the PT_NOTE Program Header.
  */
 #ifdef EMITS_PT_NOTE
-#define NOTES_HEADERS		:text :note
-#define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } :text
+#define NOTES_HEADERS : text : note
+#define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } : text
 #else
 #define NOTES_HEADERS
 #define NOTES_HEADERS_RESTORE
@@ -98,10 +98,10 @@
  */
 #if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_] * .data..L * .data..compoundliteral * .data.$__unnamed_ * .data.$L*
 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
-#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
-#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
+#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_] * .rodata..L*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_] * .bss..compoundliteral*
 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
 #else
 #define TEXT_MAIN .text
@@ -294,7 +294,7 @@
 #ifdef CONFIG_SERIAL_EARLYCON
 #define EARLYCON_TABLE()						\
 	. = ALIGN(8);							\
-	BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table, , _end)
+	BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table,, _end)
 #else
 #define EARLYCON_TABLE()
 #endif
@@ -462,7 +462,7 @@
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		__start_rodata = .;					\
-		*(.rodata) *(.rodata.*)					\
+		*(.rodata) * (.rodata.*)					\
 		SCHED_DATA						\
 		RO_AFTER_INIT_DATA	/* Read only after init */	\
 		. = ALIGN(8);						\
@@ -494,28 +494,28 @@
 	/* Kernel symbol table: Normal symbols */			\
 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
 		__start___ksymtab = .;					\
-		KEEP(*(SORT(___ksymtab+*)))				\
+		KEEP(*(SORT(___ksymtab+ *)))				\
 		__stop___ksymtab = .;					\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
 		__start___ksymtab_gpl = .;				\
-		KEEP(*(SORT(___ksymtab_gpl+*)))				\
+		KEEP(*(SORT(___ksymtab_gpl+ *)))			\
 		__stop___ksymtab_gpl = .;				\
 	}								\
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
 		__start___kcrctab = .;					\
-		KEEP(*(SORT(___kcrctab+*)))				\
+		KEEP(*(SORT(___kcrctab+ *)))				\
 		__stop___kcrctab = .;					\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
 		__start___kcrctab_gpl = .;				\
-		KEEP(*(SORT(___kcrctab_gpl+*)))				\
+		KEEP(*(SORT(___kcrctab_gpl+ *)))			\
 		__stop___kcrctab_gpl = .;				\
 	}								\
 									\
Signature · 1 line
2.17.1
#1 lore raw
kernel test robot noticed the following build errors:

Hi KaiLong,

kernel test robot noticed the following build errors:

[auto build test ERROR on arnd-asm-generic/master]
[also build test ERROR on soc/for-next linus/master v6.6-rc3 next-20230929] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/KaiLong-Wang/vmlinux-lds-h-Clean-up-errors-in-vmlinux-lds-h/20230928-110313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link:    https://lore.kernel.org/r/72e80688.8a8.18ad9bba905.Coremail.wangkailong%40jari.cn
patch subject: [PATCH] vmlinux.lds.h: Clean up errors in vmlinux.lds.h
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20230930/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> arm-linux-gnueabi-ld:./arch/arm/kernel/vmlinux.lds:20: syntax error
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to KaiLong Wang
kernel test robot noticed the following build errors:

Hi KaiLong,

kernel test robot noticed the following build errors:

[auto build test ERROR on arnd-asm-generic/master]
[also build test ERROR on soc/for-next linus/master v6.6-rc3 next-20230929] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/KaiLong-Wang/vmlinux-lds-h-Clean-up-errors-in-vmlinux-lds-h/20230928-110313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link:    https://lore.kernel.org/r/72e80688.8a8.18ad9bba905.Coremail.wangkailong%40jari.cn
patch subject: [PATCH] vmlinux.lds.h: Clean up errors in vmlinux.lds.h
config: csky-randconfig-001-20230930 (https://download.01.org/0day-ci/archive/20230930/[email protected]/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> csky-linux-ld:./arch/csky/kernel/vmlinux.lds:32: syntax error
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
In reply to KaiLong Wang
Quoted 16 lines · KaiLong Wang

Fix the following errors reported by checkpatch:

ERROR: spaces required around that ':' (ctx:WxV)
ERROR: space required after that ',' (ctx:VxO)
ERROR: need consistent spacing around '*' (ctx:VxW)

---
 include/asm-generic/vmlinux.lds.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -0
index 9c59409104f6..9e19234bbf97 100644

include/asm-generic/vmlinux.lds.h line 67

Quoted 7 lines
include/asm-generic/vmlinux.lds.h +2 -2
@@ -63,8 +63,8 @@
  * up in the PT_NOTE Program Header.
  */
 #ifdef EMITS_PT_NOTE
-#define NOTES_HEADERS		:text :note
-#define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } :text
+#define NOTES_HEADERS : text : note
+#define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } : text

Personally I prefer macro arguments to be aligned.

Quoted 5 lines
include/asm-generic/vmlinux.lds.h +0 -0
 #else
 #define NOTES_HEADERS
 #define NOTES_HEADERS_RESTORE
@@ -98,10 +98,10 @@
  */

include/asm-generic/vmlinux.lds.h line 105

Quoted 10 lines
include/asm-generic/vmlinux.lds.h +3 -3
 #if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_] * .data..L * .data..compoundliteral * .data.$__unnamed_ * .data.$L*
 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
-#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
-#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
+#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_] * .rodata..L*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_] * .bss..compoundliteral*
 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*

Is it taking a pointer or changing to multiplication?

Quoted 33 lines
include/asm-generic/vmlinux.lds.h +4 -4
 #else
 #define TEXT_MAIN .text
@@ -462,7 +462,7 @@
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		__start_rodata = .;					\
-		*(.rodata) *(.rodata.*)					\
+		*(.rodata) * (.rodata.*)					\
 		SCHED_DATA						\
 		RO_AFTER_INIT_DATA	/* Read only after init */	\
 		. = ALIGN(8);						\
@@ -494,28 +494,28 @@
 	/* Kernel symbol table: Normal symbols */			\
 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
 		__start___ksymtab = .;					\
-		KEEP(*(SORT(___ksymtab+*)))				\
+		KEEP(*(SORT(___ksymtab+ *)))				\
 		__stop___ksymtab = .;					\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
 		__start___ksymtab_gpl = .;				\
-		KEEP(*(SORT(___ksymtab_gpl+*)))				\
+		KEEP(*(SORT(___ksymtab_gpl+ *)))			\
 		__stop___ksymtab_gpl = .;				\
 	}								\
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
 		__start___kcrctab = .;					\
-		KEEP(*(SORT(___kcrctab+*)))				\
+		KEEP(*(SORT(___kcrctab+ *)))				\

include/asm-generic/vmlinux.lds.h line 520

Quoted 10 lines
include/asm-generic/vmlinux.lds.h +1 -1
 		__stop___kcrctab = .;					\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
 		__start___kcrctab_gpl = .;				\
-		KEEP(*(SORT(___kcrctab_gpl+*)))				\
+		KEEP(*(SORT(___kcrctab_gpl+ *)))			\
 		__stop___kcrctab_gpl = .;				\
 	}								\

Same here.

Confused...

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#4 lore raw
In reply to KaiLong Wang
Quoted 8 lines · KaiLong Wang

Fix the following errors reported by checkpatch:

ERROR: spaces required around that ':' (ctx:WxV)
ERROR: space required after that ',' (ctx:VxO)
ERROR: need consistent spacing around '*' (ctx:VxW)

NAK

Please don't use checkpatch without testing the result. And please don't go around running checkpatch on existing source files to generate cosmetic patches: checkpatch is useful for new code contributions but there is no desire in the community to make the entire existing code base checkpatch-clean (and given this broken patch, that is not even possible)

checkpatch does not work for linker scripts and this header file is #include'd by linker scripts exclusively.

If you are looking for ways to start contributing to the linux kernel, have a look at drivers/staging instead of proposing cosmetic 'fixes' that break the code.

Quoted 86 lines
---
 include/asm-generic/vmlinux.lds.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
include/asm-generic/vmlinux.lds.h +11 -12
index 9c59409104f6..9e19234bbf97 100644
@@ -63,8 +63,8 @@
  * up in the PT_NOTE Program Header.
  */
 #ifdef EMITS_PT_NOTE
-#define NOTES_HEADERS          :text :note
-#define NOTES_HEADERS_RESTORE  __restore_ph : { *(.__restore_ph) } :text
+#define NOTES_HEADERS : text : note
+#define NOTES_HEADERS_RESTORE  __restore_ph : { *(.__restore_ph) } : text
 #else
 #define NOTES_HEADERS
 #define NOTES_HEADERS_RESTORE
@@ -98,10 +98,10 @@
  */
 #if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_] * .data..L * .data..compoundliteral * .data.$__unnamed_ * .data.$L*
 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
-#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
-#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
+#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_] * .rodata..L*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_] * .bss..compoundliteral*
 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
 #else
 #define TEXT_MAIN .text
@@ -294,7 +294,7 @@
 #ifdef CONFIG_SERIAL_EARLYCON
 #define EARLYCON_TABLE()                                               \
        . = ALIGN(8);                                                   \
-       BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table, , _end)
+       BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table,, _end)
 #else
 #define EARLYCON_TABLE()
 #endif
@@ -462,7 +462,7 @@
        . = ALIGN((align));                                             \
        .rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {           \
                __start_rodata = .;                                     \
-               *(.rodata) *(.rodata.*)                                 \
+               *(.rodata) * (.rodata.*)                                        \
                SCHED_DATA                                              \
                RO_AFTER_INIT_DATA      /* Read only after init */      \
                . = ALIGN(8);                                           \
@@ -494,28 +494,28 @@
        /* Kernel symbol table: Normal symbols */                       \
        __ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {         \
                __start___ksymtab = .;                                  \
-               KEEP(*(SORT(___ksymtab+*)))                             \
+               KEEP(*(SORT(___ksymtab+ *)))                            \
                __stop___ksymtab = .;                                   \
        }                                                               \
                                                                        \
        /* Kernel symbol table: GPL-only symbols */                     \
        __ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {     \
                __start___ksymtab_gpl = .;                              \
-               KEEP(*(SORT(___ksymtab_gpl+*)))                         \
+               KEEP(*(SORT(___ksymtab_gpl+ *)))                        \
                __stop___ksymtab_gpl = .;                               \
        }                                                               \
                                                                        \
        /* Kernel symbol table: Normal symbols */                       \
        __kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {         \
                __start___kcrctab = .;                                  \
-               KEEP(*(SORT(___kcrctab+*)))                             \
+               KEEP(*(SORT(___kcrctab+ *)))                            \
                __stop___kcrctab = .;                                   \
        }                                                               \
                                                                        \
        /* Kernel symbol table: GPL-only symbols */                     \
        __kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {     \
                __start___kcrctab_gpl = .;                              \
-               KEEP(*(SORT(___kcrctab_gpl+*)))                         \
+               KEEP(*(SORT(___kcrctab_gpl+ *)))                        \
                __stop___kcrctab_gpl = .;                               \
        }                                                               \
                                                                        \
--

2.17.1