summaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-11-28 00:15:35 +0200
committerTom Rini <trini@konsulko.com>2016-12-02 21:32:54 -0500
commit76a55989b180d1d9ab273fde01e5b2a18413fadf (patch)
tree7d9e72899144a19d3cf2d1b94b9d1a7210adbecc /arch/sh
parent3500581ef3461c7cf5ca6fef7b45dd2dee0df28e (diff)
sh: generate position independent code for all platforms
Finally add fpic compilation option to produce relocatable code. Note that this requires to define CONFIG_NEEDS_MANUAL_RELOC for all board files, also relocation support still has some limitations (e.g. a developer should care not to overwrite the executing code or memset() with zeroes not yet relocated data on malloc init etc.), which may be fixed while switching to PIE. Due to short investigation the architecture code is not ready for PIE linking, this will require some manipulations with .dyn* sections. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/config.mk1
-rw-r--r--arch/sh/cpu/u-boot.lds2
2 files changed, 2 insertions, 1 deletions
diff --git a/arch/sh/config.mk b/arch/sh/config.mk
index 673ed8dfa4..71540c8bb2 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -15,5 +15,6 @@ CONFIG_STANDALONE_LOAD_ADDR += -EB
endif
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+PLATFORM_RELFLAGS += -fpic
LDFLAGS_FINAL = --gc-sections
PLATFORM_RELFLAGS += -ffixed-r13
diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds
index f2e48c6eca..bbf9ff485f 100644
--- a/arch/sh/cpu/u-boot.lds
+++ b/arch/sh/cpu/u-boot.lds
@@ -60,7 +60,7 @@ SECTIONS
PROVIDE (_fgot = .);
.got :
{
- *(.got)
+ *(.got.plt) *(.got)
. = ALIGN(4);
} >ram
PROVIDE (_egot = .);