Commit 200036a8 authored by Helge Deller's avatar Helge Deller

parisc: Allow building 64-bit kernel without -mlong-calls compiler option

A 64-bit kernel built without CONFIG_MLONGCALLS (-mlong-calls compiler
option) usually fails to link because of unreachable functions.  Try to
work around that linking issue by moving the *.init and *.exit text
segments closer to the main text segment. With that change those
segments now don't get freed at runtime any longer, but since we in most
cases run with huge-page enabled, we ignore the lost memory in
preference of better performance.

This change will not guarantee that every kernel config will now
sucessfully build with short calls and without linking issues.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 7a95aab5
...@@ -194,7 +194,8 @@ config PREFETCH ...@@ -194,7 +194,8 @@ config PREFETCH
config MLONGCALLS config MLONGCALLS
bool "Enable the -mlong-calls compiler option for big kernels" bool "Enable the -mlong-calls compiler option for big kernels"
default y default y if !MODULES || UBSAN || FTRACE
default n
depends on PA8X00 depends on PA8X00
help help
If you configure the kernel to include many drivers built-in instead If you configure the kernel to include many drivers built-in instead
......
...@@ -35,6 +35,15 @@ OUTPUT_FORMAT("elf64-hppa-linux") ...@@ -35,6 +35,15 @@ OUTPUT_FORMAT("elf64-hppa-linux")
OUTPUT_ARCH(hppa:hppa2.0w) OUTPUT_ARCH(hppa:hppa2.0w)
#endif #endif
#define EXIT_TEXT_SECTIONS() .exit.text : { EXIT_TEXT }
#if !defined(CONFIG_64BIT) || defined(CONFIG_MLONGCALLS)
#define MLONGCALL_KEEP(x)
#define MLONGCALL_DISCARD(x) x
#else
#define MLONGCALL_KEEP(x) x
#define MLONGCALL_DISCARD(x)
#endif
ENTRY(parisc_kernel_start) ENTRY(parisc_kernel_start)
#ifndef CONFIG_64BIT #ifndef CONFIG_64BIT
jiffies = jiffies_64 + 4; jiffies = jiffies_64 + 4;
...@@ -47,15 +56,11 @@ SECTIONS ...@@ -47,15 +56,11 @@ SECTIONS
__init_begin = .; __init_begin = .;
HEAD_TEXT_SECTION HEAD_TEXT_SECTION
INIT_TEXT_SECTION(8) MLONGCALL_DISCARD(INIT_TEXT_SECTION(8))
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
INIT_DATA_SECTION(PAGE_SIZE) INIT_DATA_SECTION(PAGE_SIZE)
/* we have to discard exit text and such at runtime, not link time */ MLONGCALL_DISCARD(EXIT_TEXT_SECTIONS())
.exit.text :
{
EXIT_TEXT
}
.exit.data : .exit.data :
{ {
EXIT_DATA EXIT_DATA
...@@ -73,11 +78,12 @@ SECTIONS ...@@ -73,11 +78,12 @@ SECTIONS
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
_stext = .; _stext = .;
MLONGCALL_KEEP(INIT_TEXT_SECTION(8))
.text ALIGN(PAGE_SIZE) : { .text ALIGN(PAGE_SIZE) : {
TEXT_TEXT TEXT_TEXT
LOCK_TEXT
SCHED_TEXT SCHED_TEXT
CPUIDLE_TEXT CPUIDLE_TEXT
LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
IRQENTRY_TEXT IRQENTRY_TEXT
SOFTIRQENTRY_TEXT SOFTIRQENTRY_TEXT
...@@ -92,6 +98,7 @@ SECTIONS ...@@ -92,6 +98,7 @@ SECTIONS
*(.lock.text) /* out-of-line lock text */ *(.lock.text) /* out-of-line lock text */
*(.gnu.warning) *(.gnu.warning)
} }
MLONGCALL_KEEP(EXIT_TEXT_SECTIONS())
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
_etext = .; _etext = .;
/* End of text section */ /* End of text section */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment