|
22 | 22 |
|
23 | 23 | ITERABLE_SECTION_ROM_NUMERIC(device, 4)
|
24 | 24 |
|
| 25 | +#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_SHARED_INTERRUPTS) |
| 26 | + /* since z_shared_isr() is not referenced anywhere when |
| 27 | + * zephyr_pre0.elf is built, the linker will end up dropping it. |
| 28 | + * Later on, during the second linking stage (when zephyr.elf is |
| 29 | + * built), the symbol will be added to the text section since it's |
| 30 | + * now being referenced (thanks to isr_tables.c). This is very |
| 31 | + * problematic because adding the z_shared_isr symbol between |
| 32 | + * the linking stages will end up shifting the addresses of the |
| 33 | + * functions, which, in turn, will end up messing the ISR table |
| 34 | + * (as the entries from _sw_isr_table will end up pointing to |
| 35 | + * old addresses of the registered ISRs). To prevent this from |
| 36 | + * happening, instruct the linker to avoid dropping z_shared_isr |
| 37 | + * if it's not being referenced anywhere. |
| 38 | + */ |
| 39 | + SECTION_PROLOGUE(.text.z_shared_isr,,) |
| 40 | + { |
| 41 | + KEEP(*(.text.z_shared_isr)) |
| 42 | + } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 43 | +#endif |
| 44 | + |
25 | 45 | #if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
|
26 | 46 | SECTION_PROLOGUE(sw_isr_table,,)
|
27 | 47 | {
|
|
40 | 60 | /* TODO: does this section require alignment? */
|
41 | 61 | KEEP(*(_SHARED_SW_ISR_TABLE_SECTION_SYMS))
|
42 | 62 | } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
43 |
| - |
44 |
| - SECTION_PROLOGUE(.text.z_shared_isr,,) |
45 |
| - { |
46 |
| - KEEP(*(.text.z_shared_isr)) |
47 |
| - } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
48 | 63 | #endif
|
49 | 64 |
|
50 | 65 | #endif
|
|
0 commit comments