Skip to content
Snippets Groups Projects
Commit c37980c3 authored by Albert ARIBAUD's avatar Albert ARIBAUD
Browse files

arm: ensure u-boot only uses relative relocations


Add a Makefile target ('checkarmreloc') which
fails if the ELF binary contains relocation records
of types other than R_ARM_RELATIVE.

Signed-off-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tested-by: default avatarLubomir Popov <lpopov@mm-sol.com>
Tested-by: default avatarJeroen Hofstee <jeroen@myspectrum.nl>
Reviewed-by: default avatarBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
parent 7737c994
No related branches found
No related tags found
No related merge requests found
...@@ -743,6 +743,13 @@ tools: $(VERSION_FILE) $(TIMESTAMP_FILE) ...@@ -743,6 +743,13 @@ tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
$(MAKE) -C $@ all $(MAKE) -C $@ all
endif # config.mk endif # config.mk
# ARM relocations should all be R_ARM_RELATIVE.
checkarmreloc: $(obj)u-boot
@if test "R_ARM_RELATIVE" != \
"`readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
then echo "$< contains relocations other than \
R_ARM_RELATIVE"; false; fi
$(VERSION_FILE): $(VERSION_FILE):
@mkdir -p $(dir $(VERSION_FILE)) @mkdir -p $(dir $(VERSION_FILE))
@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
......
...@@ -109,3 +109,8 @@ ifeq ($(GAS_BUG_12532),y) ...@@ -109,3 +109,8 @@ ifeq ($(GAS_BUG_12532),y)
PLATFORM_RELFLAGS += -fno-optimize-sibling-calls PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
endif endif
endif endif
# check that only R_ARM_RELATIVE relocations are generated
ifneq ($(CONFIG_SPL_BUILD),y)
ALL-y += checkarmreloc
endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment