hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN
cover hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN
Hi all,
This series fixes an error with ARCH=hexagon that was pointed out by the patch "mm/slub: use stackdepot to save stack trace in objects", which is in -mm/-next.
The first patch fixes that error by handling the '.irqentry.text' and '.softirqentry.text' sections.
The second patch switches Hexagon over to the common DISCARDS macro, which should have been done when Hexagon was merged into the tree to match commit 023bf6f1b8bf ("linker script: unify usage of discard definition").
The third patch selects CONFIG_ARCH_WANT_LD_ORPHAN_WARN so that something like this does not happen again.
Nathan Chancellor (3):
hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
hexagon: Use common DISCARDS macro
hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
arch/hexagon/Kconfig | 1 + arch/hexagon/kernel/vmlinux.lds.S | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-)
base-commit: 7a42b92b6d30c3f09629c7d5ada9e3de2aba01af
Signature · 1 line
2.32.0.rc0
PATCH 1/3 hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
Patch "mm/slub: use stackdepot to save stack trace in objects" in -mm selects CONFIG_STACKDEPOT when CONFIG_STACKTRACE_SUPPORT is selected and CONFIG_STACKDEPOT requires IRQENTRY_TEXT and SOFTIRQENTRY_TEXT to be handled after commit 505a0ef15f96 ("kasan: stackdepot: move filter_irq_stacks() to stackdepot.c") due to the use of the __{,soft}irqentry_text_{start,end} section symbols. If those sections are not handled, the build is broken.
$ make ARCH=hexagon CROSS_COMPILE=hexagon-linux- LLVM=1 LLVM_IAS=1 defconfig all ... ld.lld: error: undefined symbol: __irqentry_text_start
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
ld.lld: error: undefined symbol: __irqentry_text_end
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
ld.lld: error: undefined symbol: __softirqentry_text_start
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
ld.lld: error: undefined symbol: __softirqentry_text_end
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
...
Add these sections to the Hexagon linker script so the build continues to work. ld.lld's orphan section warning would have caught this prior to the -mm commit mentioned above:
ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text'
--- arch/hexagon/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/hexagon/kernel/vmlinux.lds.S +2 -0
@@ -38,6 +38,8 @@ SECTIONS .text : AT(ADDR(.text)) { _text = .; TEXT_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT SCHED_TEXT CPUIDLE_TEXT LOCK_TEXT
Signature · 1 line
2.32.0.rc0
Re: [PATCH 1/3] hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
Quoted 40 lines · Nathan Chancellor
Patch "mm/slub: use stackdepot to save stack trace in objects" in -mm selects
CONFIG_STACKDEPOTwhenCONFIG_STACKTRACE_SUPPORTis selected andCONFIG_STACKDEPOTrequiresIRQENTRY_TEXTandSOFTIRQENTRY_TEXTto be handled after commit505a0ef15f96("kasan: stackdepot: movefilter_irq_stacks()tostackdepot.c") due to the use of the __{,soft}irqentry_text_{start,end} section symbols. If those sections are not handled, the build is broken.$ make ARCH=hexagon CROSS_COMPILE=hexagon-linux- LLVM=1 LLVM_IAS=1 defconfig all ... ld.lld: error: undefined symbol: __irqentry_text_startQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.ald.lld: error: undefined symbol:
__irqentry_text_endQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.ald.lld: error: undefined symbol:
__softirqentry_text_startQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.ald.lld: error: undefined symbol:
__softirqentry_text_endQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a
referenced bystackdepot.c
stackdepot.o:(filter_irq_stacks) in archivelib/built-in.a...
Add these sections to the Hexagon linker script so the build continues to work. ld.lld's orphan section warning would have caught this prior to the -mm commit mentioned above:
Quoted 7 lines
ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text' ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is being placed in '.softirqentry.text'
Fixes 505a0ef15f96 ("kasan: stackdepot: move filter_irq_stacks() to stackdepot.c")Signed-off-by Nathan Chancellor <[email protected]>
Thanks for the series, and sorry I didn't get around to reviewing before I took time off last week.
Quoted 20 lines
--- arch/hexagon/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)arch/hexagon/kernel/vmlinux.lds.S +2
-1@@ -38,6 +38,8 @@ SECTIONS .text : AT(ADDR(.text)) { _text = .; TEXT_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT SCHED_TEXT CPUIDLE_TEXT LOCK_TEXT --2.32.0.rc0
Signature · 2 lines
Thanks, ~Nick Desaulniers
RE: [PATCH 1/3] hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
In reply to Nathan ChancellorQuoted 20 lines
-----Original Message-----
From: Nathan Chancellor <[email protected]>
Sent: Thursday, May 20, 2021 8:13 PM
To: Brian Cain <[email protected]>; Andrew Morton <akpm@linux- foundation.org>
Cc: Nick Desaulniers <[email protected]>; linux- [email protected]; [email protected]; clang-built- [email protected]; Nathan Chancellor <[email protected]>
Subject: [PATCH 1/3] hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker scriptPatch "mm/slub: use stackdepot to save stack trace in objects" in -mm selects
CONFIG_STACKDEPOTwhenCONFIG_STACKTRACE_SUPPORTis selected andCONFIG_STACKDEPOTrequiresIRQENTRY_TEXTandSOFTIRQENTRY_TEXTto be
handled after commit505a0ef15f96("kasan: stackdepot: movefilter_irq_stacks()tostackdepot.c") due to the use of the __{,soft}irqentry_text_{start,end} section symbols. If those sections are not handled, the build is broken.
Quoted 6 lines
$ make ARCH=hexagon CROSS_COMPILE=hexagon-linux- LLVM=1 LLVM_IAS=1 defconfig all ... ld.lld: error: undefined symbol: __irqentry_text_startQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 4 lines
ld.lld: error: undefined symbol:
__irqentry_text_endQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 4 lines
ld.lld: error: undefined symbol:
__softirqentry_text_startQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 4 lines
ld.lld: error: undefined symbol:
__softirqentry_text_endQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
stackdepot.c
stackdepot.o:(filter_irq_stacks) in archive
lib/built-in.a
Quoted 7 lines
...
Add these sections to the Hexagon linker script so the build continues to work. ld.lld's orphan section warning would have caught this prior to the -mm commit mentioned above:
ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is
being placed in
Quoted 2 lines
'.softirqentry.text'
ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is
being placed in
Quoted 2 lines
'.softirqentry.text'
ld.lld: warning: kernel/built-in.a(softirq.o):(.softirqentry.text) is
being placed in
Quoted 25 lines
'.softirqentry.text'
Fixes 505a0ef15f96 ("kasan: stackdepot: move filter_irq_stacks() to
stackdepot.c")Signed-off-by Nathan Chancellor <[email protected]>--- arch/hexagon/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)arch/hexagon/kernel/vmlinux.lds.S +2
-1@@ -38,6 +38,8 @@ SECTIONS .text : AT(ADDR(.text)) { _text = .; TEXT_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT SCHED_TEXT CPUIDLE_TEXT LOCK_TEXT --
Quoted 1 line
2.32.0.rc0
PATCH 2/3 hexagon: Use common DISCARDS macro
In reply to Nathan Chancellorld.lld warns that the '.modinfo' section is not currently handled:
ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo'
The '.modinfo' section was added in commit 898490c010b5 ("moduleparam:
Save information about built-in modules in separate file") to the DISCARDS macro but Hexagon has never used that macro. The unification of DISCARDS happened in commit 023bf6f1b8bf ("linker script: unify usage of discard definition") in 2009, prior to Hexagon being added in 2011.
Switch Hexagon over to the DISCARDS macro so that anything that is expected to be discarded gets discarded.
--- arch/hexagon/kernel/vmlinux.lds.S | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/hexagon/kernel/vmlinux.lds.S +1 -6
@@ -61,14 +61,9 @@ SECTIONS _end = .; - /DISCARD/ : { - EXIT_TEXT - EXIT_DATA - EXIT_CALL - } - STABS_DEBUG DWARF_DEBUG ELF_DETAILS + DISCARDS }
Signature · 1 line
2.32.0.rc0
Re: [PATCH 2/3] hexagon: Use common DISCARDS macro
Quoted 14 lines · Nathan Chancellor
ld.lld warns that the '.modinfo' section is not currently handled:
ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo'
The '.modinfo' section was added in commit
898490c010b5("moduleparam:
Save information about built-in modules in separate file") to the DISCARDS macro but Hexagon has never used that macro. The unification of DISCARDS happened in commit023bf6f1b8bf("linker script: unify usage of discard definition") in 2009, prior to Hexagon being added in 2011.
Quoted 5 lines
Switch Hexagon over to the DISCARDS macro so that anything that is expected to be discarded gets discarded.
Fixes e95bf452a9e2 ("Hexagon: Add configuration and makefiles for the Hexagon architecture.")Signed-off-by Nathan Chancellor <[email protected]>
Thanks for the patch.
Quoted 27 lines
--- arch/hexagon/kernel/vmlinux.lds.S | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)arch/hexagon/kernel/vmlinux.lds.S +1
-7@@ -61,14 +61,9 @@ SECTIONS _end = .; - /DISCARD/ : { - EXIT_TEXT - EXIT_DATA - EXIT_CALL - } - STABS_DEBUG DWARF_DEBUG ELF_DETAILS + DISCARDS } --2.32.0.rc0
Signature · 2 lines
Thanks, ~Nick Desaulniers
RE: [PATCH 2/3] hexagon: Use common DISCARDS macro
In reply to Nathan ChancellorQuoted 12 lines
-----Original Message-----
From: Nathan Chancellor <[email protected]>
Sent: Thursday, May 20, 2021 8:13 PM
To: Brian Cain <[email protected]>; Andrew Morton <akpm@linux- foundation.org>
Cc: Nick Desaulniers <[email protected]>; linux- [email protected]; [email protected]; clang-built- [email protected]; Nathan Chancellor <[email protected]>
Subject: [PATCH 2/3] hexagon: Use common DISCARDS macro
Quoted 3 lines
ld.lld warns that the '.modinfo' section is not currently handled:
ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed
in
Quoted 2 lines
'.modinfo'
ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being
placed in
Quoted 2 lines
'.modinfo'
ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being
placed in
Quoted 2 lines
'.modinfo'
ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being
placed in
Quoted 40 lines
'.modinfo'
The '.modinfo' section was added in commit
898490c010b5("moduleparam:
Save information about built-in modules in separate file") to the DISCARDS macro but Hexagon has never used that macro. The unification of DISCARDS happened in commit023bf6f1b8bf("linker script: unify usage of discard definition") in 2009, prior to Hexagon being added in 2011.Switch Hexagon over to the DISCARDS macro so that anything that is expected to be discarded gets discarded.
Fixes e95bf452a9e2 ("Hexagon: Add configuration and makefiles for theHexagon architecture.")
Signed-off-by Nathan Chancellor <[email protected]>--- arch/hexagon/kernel/vmlinux.lds.S | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)arch/hexagon/kernel/vmlinux.lds.S +1
-7@@ -61,14 +61,9 @@ SECTIONS _end = .; - /DISCARD/ : { - EXIT_TEXT - EXIT_DATA - EXIT_CALL - } - STABS_DEBUG DWARF_DEBUG ELF_DETAILS + DISCARDS } --
Quoted 1 line
2.32.0.rc0
PATCH 3/3 hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
In reply to Nathan ChancellorNow that we handle all of the sections in a Hexagon defconfig, select ARCH_WANT_LD_ORPHAN_WARN so that unhandled sections are warned about by default.
--- arch/hexagon/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/Kconfig +1 -0
@@ -30,6 +30,7 @@ config HEXAGON select MODULES_USE_ELF_RELA select GENERIC_CPU_DEVICES select SET_FS + select ARCH_WANT_LD_ORPHAN_WARN help Qualcomm Hexagon is a processor architecture designed for high performance and low power across a wide variety of applications.
Signature · 1 line
2.32.0.rc0
Re: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
Quoted 4 lines · Nathan Chancellor
Now that we handle all of the sections in a Hexagon defconfig, select
ARCH_WANT_LD_ORPHAN_WARNso that unhandled sections are warned about by default.
Great to see another arch using this build-safety feature!
Quoted 21 lines
Signed-off-by Nathan Chancellor <[email protected]>--- arch/hexagon/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/hexagon/Kconfig +1
-1@@ -30,6 +30,7 @@ config HEXAGON select MODULES_USE_ELF_RELA select GENERIC_CPU_DEVICES select SET_FS + select ARCH_WANT_LD_ORPHAN_WARN help Qualcomm Hexagon is a processor architecture designed for high performance and low power across a wide variety of applications. --2.32.0.rc0
Signature · 2 lines
Thanks, ~Nick Desaulniers
RE: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
In reply to Nathan ChancellorQuoted 35 lines
-----Original Message-----
From: Nathan Chancellor <[email protected]>
Sent: Thursday, May 20, 2021 8:13 PM
To: Brian Cain <[email protected]>; Andrew Morton <akpm@linux- foundation.org>
Cc: Nick Desaulniers <[email protected]>; linux- [email protected]; [email protected]; clang-built- [email protected]; Nathan Chancellor <[email protected]>
Subject: [PATCH 3/3] hexagon: SelectARCH_WANT_LD_ORPHAN_WARNNow that we handle all of the sections in a Hexagon defconfig, select
ARCH_WANT_LD_ORPHAN_WARNso that unhandled sections are warned about by
default.Signed-off-by Nathan Chancellor <[email protected]>--- arch/hexagon/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/hexagon/Kconfig +1
-1@@ -30,6 +30,7 @@ config HEXAGON select MODULES_USE_ELF_RELA select GENERIC_CPU_DEVICES select SET_FS + select ARCH_WANT_LD_ORPHAN_WARN help Qualcomm Hexagon is a processor architecture designed for high performance and low power across a wide variety of applications. --
Quoted 1 line
2.32.0.rc0
Quoted 22 lines · Nathan Chancellor
Hi all,
This series fixes an error with ARCH=hexagon that was pointed out by the patch "mm/slub: use stackdepot to save stack trace in objects", which is in -mm/-next.
The first patch fixes that error by handling the '.irqentry.text' and '.softirqentry.text' sections.
The second patch switches Hexagon over to the common DISCARDS macro, which should have been done when Hexagon was merged into the tree to match commit
023bf6f1b8bf("linker script: unify usage of discard definition").The third patch selects
CONFIG_ARCH_WANT_LD_ORPHAN_WARNso that something like this does not happen again.Nathan Chancellor (3):
hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
hexagon: Use common DISCARDS macro
hexagon: SelectARCH_WANT_LD_ORPHAN_WARN
Quoted 7 lines
arch/hexagon/Kconfig | 1 + arch/hexagon/kernel/vmlinux.lds.S | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-)base-commit:
7a42b92b6d30c3f09629c7d5ada9e3de2aba01af
Brian, did you have any comments on this series? ARCH=hexagon defconfig is currently broken in -next, it would be a real shame if this continued to regress after you just got Hexagon building in mainline. These patches seem like they would be worthy of a 5.13 pull request. Otherwise, Andrew could pick them up with your ack and stick them in front of "mm/slub: use stackdepot to save stack trace in objects" so that there is no build regression.
Cheers,
Nathan
Quoted 2 lines
-----Original Message-----
From: Nathan Chancellor <[email protected]>
...
Quoted 2 lines · Nathan Chancellor
Quoted 1 line
Hi all,
...
Quoted 4 lines
Brian, did you have any comments on this series? ARCH=hexagon defconfig is currently broken in -next, it would be a real shame if this continued to regress after you just got Hexagon building in mainline. These patches seem like they would be worthy of a 5.13 pull request.
I have started the internal review process to get these queued up in my tree. But I don't know if I would have it in time for 5.13.
Quoted 3 lines
Otherwise, Andrew could pick them up with your ack and stick them in front of "mm/slub: use stackdepot to save stack trace in objects" so that there is no build regression.
Of course: I'll send my ack for the sake of keeping the build green.
-Brian
Quoted 13 lines · Brian Cain
Quoted 2 lines
-----Original Message-----
From: Nathan Chancellor <[email protected]>...
Quoted 2 lines · Nathan Chancellor
Quoted 1 line
Hi all,
...
Quoted 4 lines
Brian, did you have any comments on this series? ARCH=hexagon defconfig is currently broken in -next, it would be a real shame if this continued to regress after you just got Hexagon building in mainline. These patches seem like they would be worthy of a 5.13 pull request.
I have started the internal review process to get these queued up in my tree. But I don't know if I would have it in time for 5.13.
Quoted 7 lines
Quoted 3 lines
Otherwise, Andrew could pick them up with your ack and stick them in front of "mm/slub: use stackdepot to save stack trace in objects" so that there is no build regression.
Of course: I'll send my ack for the sake of keeping the build green.
-Brian
Andrew, is there any way you can pick this up so that the Hexagon build can start being green? I explained the issue in the cover letter so that you know where to stick this patch set in your stack. If you have any more questions, please let me know.
Cheers,
Nathan