xtensa: build kernel with text-section-literals
vmlinux.lds.S doesn't do anything special with literals, so instead of keeping them separate put them into the corresponding text sections. Drop explicit .literal sections from the vmlinux.lds.S, use standard section macros. Mark literal pool locations in the assembly sources. Unfortunately assembler doesn't put literals into .init sections and external libgcc may still have .literal sections, so sed transformation to the linker script is still needed. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
@@ -45,24 +45,16 @@ jiffies = jiffies_64;
|
||||
LONG(sym ## _end); \
|
||||
LONG(LOADADDR(section))
|
||||
|
||||
/* Macro to define a section for a vector.
|
||||
*
|
||||
* Use of the MIN function catches the types of errors illustrated in
|
||||
* the following example:
|
||||
*
|
||||
* Assume the section .DoubleExceptionVector.literal is completely
|
||||
* full. Then a programmer adds code to .DoubleExceptionVector.text
|
||||
* that produces another literal. The final literal position will
|
||||
* overlay onto the first word of the adjacent code section
|
||||
* .DoubleExceptionVector.text. (In practice, the literals will
|
||||
* overwrite the code, and the first few instructions will be
|
||||
* garbage.)
|
||||
/*
|
||||
* Macro to define a section for a vector. When CONFIG_VECTORS_OFFSET is
|
||||
* defined code for every vector is located with other init data. At startup
|
||||
* time head.S copies code for every vector to its final position according
|
||||
* to description recorded in the corresponding RELOCATE_ENTRY.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_VECTORS_OFFSET
|
||||
#define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
|
||||
section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
|
||||
LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
|
||||
#define SECTION_VECTOR(sym, section, addr, prevsec) \
|
||||
section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
|
||||
{ \
|
||||
. = ALIGN(4); \
|
||||
sym ## _start = ABSOLUTE(.); \
|
||||
@@ -112,26 +104,19 @@ SECTIONS
|
||||
#if XCHAL_EXCM_LEVEL >= 6
|
||||
SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
|
||||
#endif
|
||||
SECTION_VECTOR (.DebugInterruptVector.literal, DEBUG_VECTOR_VADDR - 4)
|
||||
SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
|
||||
SECTION_VECTOR (.KernelExceptionVector.literal, KERNEL_VECTOR_VADDR - 4)
|
||||
SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
|
||||
SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
|
||||
SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
|
||||
SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20)
|
||||
SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
|
||||
#endif
|
||||
|
||||
IRQENTRY_TEXT
|
||||
SOFTIRQENTRY_TEXT
|
||||
ENTRY_TEXT
|
||||
TEXT_TEXT
|
||||
VMLINUX_SYMBOL(__sched_text_start) = .;
|
||||
*(.sched.literal .sched.text)
|
||||
VMLINUX_SYMBOL(__sched_text_end) = .;
|
||||
VMLINUX_SYMBOL(__cpuidle_text_start) = .;
|
||||
*(.cpuidle.literal .cpuidle.text)
|
||||
VMLINUX_SYMBOL(__cpuidle_text_end) = .;
|
||||
VMLINUX_SYMBOL(__lock_text_start) = .;
|
||||
*(.spinlock.literal .spinlock.text)
|
||||
VMLINUX_SYMBOL(__lock_text_end) = .;
|
||||
SCHED_TEXT
|
||||
CPUIDLE_TEXT
|
||||
LOCK_TEXT
|
||||
|
||||
}
|
||||
_etext = .;
|
||||
@@ -196,8 +181,6 @@ SECTIONS
|
||||
.KernelExceptionVector.text);
|
||||
RELOCATE_ENTRY(_UserExceptionVector_text,
|
||||
.UserExceptionVector.text);
|
||||
RELOCATE_ENTRY(_DoubleExceptionVector_literal,
|
||||
.DoubleExceptionVector.literal);
|
||||
RELOCATE_ENTRY(_DoubleExceptionVector_text,
|
||||
.DoubleExceptionVector.text);
|
||||
RELOCATE_ENTRY(_DebugInterruptVector_text,
|
||||
@@ -230,25 +213,19 @@ SECTIONS
|
||||
|
||||
SECTION_VECTOR (_WindowVectors_text,
|
||||
.WindowVectors.text,
|
||||
WINDOW_VECTORS_VADDR, 4,
|
||||
WINDOW_VECTORS_VADDR,
|
||||
.dummy)
|
||||
SECTION_VECTOR (_DebugInterruptVector_literal,
|
||||
.DebugInterruptVector.literal,
|
||||
DEBUG_VECTOR_VADDR - 4,
|
||||
SIZEOF(.WindowVectors.text),
|
||||
.WindowVectors.text)
|
||||
SECTION_VECTOR (_DebugInterruptVector_text,
|
||||
.DebugInterruptVector.text,
|
||||
DEBUG_VECTOR_VADDR,
|
||||
4,
|
||||
.DebugInterruptVector.literal)
|
||||
.WindowVectors.text)
|
||||
#undef LAST
|
||||
#define LAST .DebugInterruptVector.text
|
||||
#if XCHAL_EXCM_LEVEL >= 2
|
||||
SECTION_VECTOR (_Level2InterruptVector_text,
|
||||
.Level2InterruptVector.text,
|
||||
INTLEVEL2_VECTOR_VADDR,
|
||||
SIZEOF(LAST), LAST)
|
||||
LAST)
|
||||
# undef LAST
|
||||
# define LAST .Level2InterruptVector.text
|
||||
#endif
|
||||
@@ -256,7 +233,7 @@ SECTIONS
|
||||
SECTION_VECTOR (_Level3InterruptVector_text,
|
||||
.Level3InterruptVector.text,
|
||||
INTLEVEL3_VECTOR_VADDR,
|
||||
SIZEOF(LAST), LAST)
|
||||
LAST)
|
||||
# undef LAST
|
||||
# define LAST .Level3InterruptVector.text
|
||||
#endif
|
||||
@@ -264,7 +241,7 @@ SECTIONS
|
||||
SECTION_VECTOR (_Level4InterruptVector_text,
|
||||
.Level4InterruptVector.text,
|
||||
INTLEVEL4_VECTOR_VADDR,
|
||||
SIZEOF(LAST), LAST)
|
||||
LAST)
|
||||
# undef LAST
|
||||
# define LAST .Level4InterruptVector.text
|
||||
#endif
|
||||
@@ -272,7 +249,7 @@ SECTIONS
|
||||
SECTION_VECTOR (_Level5InterruptVector_text,
|
||||
.Level5InterruptVector.text,
|
||||
INTLEVEL5_VECTOR_VADDR,
|
||||
SIZEOF(LAST), LAST)
|
||||
LAST)
|
||||
# undef LAST
|
||||
# define LAST .Level5InterruptVector.text
|
||||
#endif
|
||||
@@ -280,40 +257,23 @@ SECTIONS
|
||||
SECTION_VECTOR (_Level6InterruptVector_text,
|
||||
.Level6InterruptVector.text,
|
||||
INTLEVEL6_VECTOR_VADDR,
|
||||
SIZEOF(LAST), LAST)
|
||||
LAST)
|
||||
# undef LAST
|
||||
# define LAST .Level6InterruptVector.text
|
||||
#endif
|
||||
SECTION_VECTOR (_KernelExceptionVector_literal,
|
||||
.KernelExceptionVector.literal,
|
||||
KERNEL_VECTOR_VADDR - 4,
|
||||
SIZEOF(LAST), LAST)
|
||||
#undef LAST
|
||||
SECTION_VECTOR (_KernelExceptionVector_text,
|
||||
.KernelExceptionVector.text,
|
||||
KERNEL_VECTOR_VADDR,
|
||||
4,
|
||||
.KernelExceptionVector.literal)
|
||||
SECTION_VECTOR (_UserExceptionVector_literal,
|
||||
.UserExceptionVector.literal,
|
||||
USER_VECTOR_VADDR - 4,
|
||||
SIZEOF(.KernelExceptionVector.text),
|
||||
.KernelExceptionVector.text)
|
||||
LAST)
|
||||
#undef LAST
|
||||
SECTION_VECTOR (_UserExceptionVector_text,
|
||||
.UserExceptionVector.text,
|
||||
USER_VECTOR_VADDR,
|
||||
4,
|
||||
.UserExceptionVector.literal)
|
||||
SECTION_VECTOR (_DoubleExceptionVector_literal,
|
||||
.DoubleExceptionVector.literal,
|
||||
DOUBLEEXC_VECTOR_VADDR - 20,
|
||||
SIZEOF(.UserExceptionVector.text),
|
||||
.UserExceptionVector.text)
|
||||
.KernelExceptionVector.text)
|
||||
SECTION_VECTOR (_DoubleExceptionVector_text,
|
||||
.DoubleExceptionVector.text,
|
||||
DOUBLEEXC_VECTOR_VADDR,
|
||||
20,
|
||||
.DoubleExceptionVector.literal)
|
||||
.UserExceptionVector.text)
|
||||
|
||||
. = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
|
||||
|
||||
@@ -323,7 +283,6 @@ SECTIONS
|
||||
SECTION_VECTOR (_SecondaryResetVector_text,
|
||||
.SecondaryResetVector.text,
|
||||
RESET_VECTOR1_VADDR,
|
||||
SIZEOF(.DoubleExceptionVector.text),
|
||||
.DoubleExceptionVector.text)
|
||||
|
||||
. = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
|
||||
@@ -373,5 +332,4 @@ SECTIONS
|
||||
|
||||
/* Sections to be discarded */
|
||||
DISCARDS
|
||||
/DISCARD/ : { *(.exit.literal) }
|
||||
}
|
||||
|
Reference in New Issue
Block a user