Skip to content

Commit

Permalink
sh: generate position independent code for all platforms
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vzapolskiy authored and trini committed Dec 3, 2016
1 parent 3500581 commit 76a5598
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/sh/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion arch/sh/cpu/u-boot.lds
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SECTIONS
PROVIDE (_fgot = .);
.got :
{
*(.got)
*(.got.plt) *(.got)
. = ALIGN(4);
} >ram
PROVIDE (_egot = .);
Expand Down

0 comments on commit 76a5598

Please sign in to comment.