Skip to content

Commit dad2d65

Browse files
jonathonpenixkartben
authored andcommitted
sw_isr_table: Force align _isr_list_sname instances
For some target and optimization level combinations (aarch64 and -O2, for example), GCC will over align _isr_list_sname instances. The local isr declaration parser doesn't expect the extra padding that may be introduced and will produce unexpected errors about bad IRQs (`error: IRQ 1903323438 (offset=0) exceeds the maximum of 42`, for example). Prevent this issue by forcing the expected alignment of _isr_list_sname. Fixes #81254 Signed-off-by: Jonathon Penix <[email protected]>
1 parent 0584f30 commit dad2d65

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

include/zephyr/sw_isr_table.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
213213

214214
#define _Z_ISR_DECLARE_C(irq, flags, func, param, counter) \
215215
_Z_ISR_TABLE_ENTRY(irq, func, param, _MK_ISR_ELEMENT_SECTION(counter)); \
216-
static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
216+
static Z_DECL_ALIGN(struct _isr_list_sname) Z_GENERIC_SECTION(.intList) \
217217
__used _MK_ISR_NAME(func, counter) = \
218218
{irq, flags, _MK_ISR_ELEMENT_SECTION(counter)}
219219

@@ -247,7 +247,7 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
247247

248248
#define _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \
249249
_Z_ISR_DIRECT_TABLE_ENTRY(irq, func, _MK_IRQ_ELEMENT_SECTION(counter)); \
250-
static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
250+
static Z_DECL_ALIGN(struct _isr_list_sname) Z_GENERIC_SECTION(.intList) \
251251
__used _MK_ISR_NAME(func, counter) = { \
252252
irq, \
253253
ISR_FLAG_DIRECT | (flags), \

tests/kernel/interrupt/testcase.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tests:
5656
extra_configs:
5757
- CONFIG_SHARED_INTERRUPTS=y
5858
filter: not CONFIG_TRUSTED_EXECUTION_NONSECURE
59-
arch.shared_interrupt.lto:
59+
arch.shared_interrupt.lto: &shared-interrupt-lto
6060
# excluded because of failures during test_prevent_interruption
6161
platform_exclude: qemu_cortex_m0
6262
arch_exclude:
@@ -79,6 +79,14 @@ tests:
7979
filter: >
8080
not CONFIG_TRUSTED_EXECUTION_NONSECURE and CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED
8181
and not CONFIG_CODE_DATA_RELOCATION
82+
arch.shared_interrupt.lto.speed:
83+
<<: *shared-interrupt-lto
84+
extra_configs:
85+
- CONFIG_SHARED_INTERRUPTS=y
86+
- CONFIG_TEST_USERSPACE=n
87+
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
88+
- CONFIG_LTO=y
89+
- CONFIG_SPEED_OPTIMIZATIONS=y
8290
arch.interrupt.multilevel:
8391
filter: CONFIG_MULTI_LEVEL_INTERRUPTS
8492
extra_args:

0 commit comments

Comments
 (0)