Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8f02ca7 authored by Max Filippov's avatar Max Filippov
Browse files

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: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 7bf5234d
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -42,12 +42,12 @@ export PLATFORM


# temporarily until string.h is fixed
# temporarily until string.h is fixed
KBUILD_CFLAGS += -ffreestanding -D__linux__
KBUILD_CFLAGS += -ffreestanding -D__linux__

KBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
KBUILD_CFLAGS += -pipe -mlongcalls

KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)


KBUILD_AFLAGS += -mlongcalls -mtext-section-literals

ifneq ($(CONFIG_LD_NO_RELAX),)
ifneq ($(CONFIG_LD_NO_RELAX),)
LDFLAGS := --no-relax
LDFLAGS := --no-relax
endif
endif
+1 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ __start_a0:
	.align 4
	.align 4


	.section .text, "ax"
	.section .text, "ax"
	.literal_position
	.begin literal_prefix .text
	.begin literal_prefix .text


	/* put literals in here! */
	/* put literals in here! */
+0 −3
Original line number Original line Diff line number Diff line
@@ -17,9 +17,6 @@ obj-$(CONFIG_XTENSA_VARIANT_HAVE_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_S32C1I_SELFTEST) += s32c1i_selftest.o
obj-$(CONFIG_S32C1I_SELFTEST) += s32c1i_selftest.o


AFLAGS_head.o += -mtext-section-literals
AFLAGS_mxhead.o += -mtext-section-literals

# In the Xtensa architecture, assembly generates literals which must always
# In the Xtensa architecture, assembly generates literals which must always
# precede the L32R instruction with a relative offset less than 256 kB.
# precede the L32R instruction with a relative offset less than 256 kB.
# Therefore, the .text and .literal section must be combined in parenthesis
# Therefore, the .text and .literal section must be combined in parenthesis
+1 −1
Original line number Original line Diff line number Diff line
@@ -155,7 +155,7 @@
 *	     <  VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
 *	     <  VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
 */
 */



	.literal_position
ENTRY(fast_unaligned)
ENTRY(fast_unaligned)


	/* Note: We don't expect the address to be aligned on a word
	/* Note: We don't expect the address to be aligned on a word
+8 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,7 @@
 *
 *
 * Note: _user_exception might be at an odd address. Don't use call0..call12
 * Note: _user_exception might be at an odd address. Don't use call0..call12
 */
 */
	.literal_position


ENTRY(user_exception)
ENTRY(user_exception)


@@ -777,6 +778,8 @@ ENDPROC(kernel_exception)
 * When we get here,  a0 is trashed and saved to excsave[debuglevel]
 * When we get here,  a0 is trashed and saved to excsave[debuglevel]
 */
 */


	.literal_position

ENTRY(debug_exception)
ENTRY(debug_exception)


	rsr	a0, SREG_EPS + XCHAL_DEBUGLEVEL
	rsr	a0, SREG_EPS + XCHAL_DEBUGLEVEL
@@ -916,6 +919,8 @@ ENDPROC(debug_exception)
unrecoverable_text:
unrecoverable_text:
	.ascii "Unrecoverable error in exception handler\0"
	.ascii "Unrecoverable error in exception handler\0"


	.literal_position

ENTRY(unrecoverable_exception)
ENTRY(unrecoverable_exception)


	movi	a0, 1
	movi	a0, 1
@@ -1117,6 +1122,8 @@ ENDPROC(fast_syscall_unrecoverable)
 *		j done
 *		j done
 */
 */


	.literal_position

#ifdef CONFIG_FAST_SYSCALL_XTENSA
#ifdef CONFIG_FAST_SYSCALL_XTENSA


#define TRY								\
#define TRY								\
@@ -1887,6 +1894,7 @@ ENDPROC(fast_store_prohibited)
 * void system_call (struct pt_regs* regs, int exccause)
 * void system_call (struct pt_regs* regs, int exccause)
 *                            a2                 a3
 *                            a2                 a3
 */
 */
	.literal_position


ENTRY(system_call)
ENTRY(system_call)


Loading