ARM: use linker magic for vectors and vector stubs
Use linker magic to create the vectors and vector stubs: we can tell the linker to place them at an appropriate VMA, but keep the LMA within the kernel. This gets rid of some unnecessary symbol manipulation, and have the linker calculate the relocations appropriately. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
		
					parent
					
						
							
								19accfd373
							
						
					
				
			
			
				commit
				
					
						b9b32bf70f
					
				
			
		
					 2 changed files with 27 additions and 18 deletions
				
			
		| 
						 | 
					@ -993,7 +993,7 @@ ENDPROC(vector_\name)
 | 
				
			||||||
1:
 | 
					1:
 | 
				
			||||||
	.endm
 | 
						.endm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.globl	__stubs_start
 | 
						.section .stubs, "ax", %progbits
 | 
				
			||||||
__stubs_start:
 | 
					__stubs_start:
 | 
				
			||||||
	@ This must be the first word
 | 
						@ This must be the first word
 | 
				
			||||||
	.word	vector_swi
 | 
						.word	vector_swi
 | 
				
			||||||
| 
						 | 
					@ -1120,24 +1120,16 @@ vector_addrexcptn:
 | 
				
			||||||
vector_fiq:
 | 
					vector_fiq:
 | 
				
			||||||
	subs	pc, lr, #4
 | 
						subs	pc, lr, #4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.globl	__stubs_end
 | 
						.section .vectors, "ax", %progbits
 | 
				
			||||||
__stubs_end:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	.equ	stubs_offset, __vectors_start + 0x1000 - __stubs_start
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	.globl	__vectors_start
 | 
					 | 
				
			||||||
__vectors_start:
 | 
					__vectors_start:
 | 
				
			||||||
	W(b)	vector_rst + stubs_offset
 | 
						W(b)	vector_rst
 | 
				
			||||||
	W(b)	vector_und + stubs_offset
 | 
						W(b)	vector_und
 | 
				
			||||||
	W(ldr)	pc, .LCvswi + stubs_offset
 | 
						W(ldr)	pc, __vectors_start + 0x1000
 | 
				
			||||||
	W(b)	vector_pabt + stubs_offset
 | 
						W(b)	vector_pabt
 | 
				
			||||||
	W(b)	vector_dabt + stubs_offset
 | 
						W(b)	vector_dabt
 | 
				
			||||||
	W(b)	vector_addrexcptn + stubs_offset
 | 
						W(b)	vector_addrexcptn
 | 
				
			||||||
	W(b)	vector_irq + stubs_offset
 | 
						W(b)	vector_irq
 | 
				
			||||||
	W(b)	vector_fiq + stubs_offset
 | 
						W(b)	vector_fiq
 | 
				
			||||||
 | 
					 | 
				
			||||||
	.globl	__vectors_end
 | 
					 | 
				
			||||||
__vectors_end:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.data
 | 
						.data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,6 +148,23 @@ SECTIONS
 | 
				
			||||||
	. = ALIGN(PAGE_SIZE);
 | 
						. = ALIGN(PAGE_SIZE);
 | 
				
			||||||
	__init_begin = .;
 | 
						__init_begin = .;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * The vectors and stubs are relocatable code, and the
 | 
				
			||||||
 | 
						 * only thing that matters is their relative offsets
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						__vectors_start = .;
 | 
				
			||||||
 | 
						.vectors 0 : AT(__vectors_start) {
 | 
				
			||||||
 | 
							*(.vectors)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						. = __vectors_start + SIZEOF(.vectors);
 | 
				
			||||||
 | 
						__vectors_end = .;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__stubs_start = .;
 | 
				
			||||||
 | 
						.stubs 0x1000 : AT(__stubs_start) {
 | 
				
			||||||
 | 
							*(.stubs)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						. = __stubs_start + SIZEOF(.stubs);
 | 
				
			||||||
 | 
						__stubs_end = .;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	INIT_TEXT_SECTION(8)
 | 
						INIT_TEXT_SECTION(8)
 | 
				
			||||||
	.exit.text : {
 | 
						.exit.text : {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue