Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: drop unused sections and remapped reset handlers

There are no .bootstrap or .ResetVector.text sections linked to the
vmlinux image, drop these sections from vmlinux.ld.S. Drop
RESET_VECTOR_VADDR definition only used for .ResetVector.text.

Drop remapped copies of primary and secondary reset vectors, as modern
gdb don't have problems stepping through instructions at arbitrary
locations. Drop corresponding sections from the corresponding linker
scripts.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

-93
-13
arch/xtensa/boot/boot-elf/boot.lds.S
··· 40 40 *(.bss) 41 41 __bss_end = .; 42 42 } 43 - 44 - #ifdef CONFIG_MMU 45 - /* 46 - * This is a remapped copy of the Reset Vector Code. 47 - * It keeps gdb in sync with the PC after switching 48 - * to the temporary mapping used while setting up 49 - * the V2 MMU mappings for Linux. 50 - */ 51 - .ResetVector.remapped_text 0x46000000 (INFO): 52 - { 53 - *(.ResetVector.remapped_text) 54 - } 55 - #endif 56 43 }
-28
arch/xtensa/boot/boot-elf/bootstrap.S
··· 58 58 wsr a0, ps 59 59 rsync 60 60 61 - Offset = _SetupMMU - _ResetVector 62 - 63 61 #ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 64 62 initialize_mmu 65 63 #endif ··· 72 74 movi a3, 0 73 75 movi a4, 0 74 76 jx a0 75 - 76 - #ifdef CONFIG_MMU 77 - .align 4 78 - 79 - .section .ResetVector.remapped_text, "x" 80 - .global _RemappedResetVector 81 - 82 - /* Do org before literals */ 83 - .org 0 84 - 85 - _RemappedResetVector: 86 - .begin no-absolute-literals 87 - .literal_position 88 - 89 - _j _RemappedSetupMMU 90 - 91 - /* Position Remapped code at the same location as the original code */ 92 - . = _RemappedResetVector + Offset 93 - 94 - _RemappedSetupMMU: 95 - #ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 96 - initialize_mmu 97 - #endif 98 - 99 - .end no-absolute-literals 100 - #endif
-4
arch/xtensa/include/asm/vectors.h
··· 85 85 /* Used to set VECBASE register */ 86 86 #define VECBASE_RESET_VADDR VIRTUAL_MEMORY_ADDRESS 87 87 88 - #define RESET_VECTOR_VECOFS (XCHAL_RESET_VECTOR_VADDR - \ 89 - VECBASE_RESET_VADDR) 90 - #define RESET_VECTOR_VADDR XC_VADDR(RESET_VECTOR_VECOFS) 91 - 92 88 #if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE 93 89 94 90 #define USER_VECTOR_VADDR XC_VADDR(XCHAL_USER_VECOFS)
-23
arch/xtensa/kernel/mxhead.S
··· 48 48 rsync 49 49 50 50 _SetupMMU: 51 - Offset = _SetupMMU - _SecondaryResetVector 52 - 53 51 #ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 54 52 initialize_mmu 55 53 #endif ··· 58 60 movi a2, 0 # a2 == NULL 59 61 movi a3, _startup 60 62 jx a3 61 - 62 - .end no-absolute-literals 63 - 64 - 65 - .section .SecondaryResetVector.remapped_text, "ax" 66 - .global _RemappedSecondaryResetVector 67 - 68 - .org 0 # Need to do org before literals 69 - 70 - _RemappedSecondaryResetVector: 71 - .begin no-absolute-literals 72 - .literal_position 73 - 74 - _j _RemappedSetupMMU 75 - . = _RemappedSecondaryResetVector + Offset 76 - 77 - _RemappedSetupMMU: 78 - 79 - #ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 80 - initialize_mmu 81 - #endif 82 63 83 64 .end no-absolute-literals
-25
arch/xtensa/kernel/vmlinux.lds.S
··· 298 298 299 299 _end = .; 300 300 301 - /* only used by the boot loader */ 302 - 303 - . = ALIGN(0x10); 304 - .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) } 305 - 306 - .ResetVector.text RESET_VECTOR_VADDR : 307 - { 308 - *(.ResetVector.text) 309 - } 310 - 311 - 312 - /* 313 - * This is a remapped copy of the Secondary Reset Vector Code. 314 - * It keeps gdb in sync with the PC after switching 315 - * to the temporary mapping used while setting up 316 - * the V2 MMU mappings for Linux. 317 - * 318 - * Only debug information about this section is put in the kernel image. 319 - */ 320 - .SecondaryResetVector.remapped_text 0x46000000 (INFO): 321 - { 322 - *(.SecondaryResetVector.remapped_text) 323 - } 324 - 325 - 326 301 .xt.lit : { *(.xt.lit) } 327 302 .xt.prop : { *(.xt.prop) } 328 303