summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-06-11 14:17:30 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-06-21 22:59:20 +0200
commitc37980c31a30f0623a0ca8f112298e44039ed6bb (patch)
tree85af61bd66e05bd9da198f5098ef56f7ebbe34a5 /Makefile
parent7737c994609ffb50194d5ddb67467ae0fcd8f775 (diff)
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: Albert ARIBAUD <albert.u.boot@aribaud.net> Tested-by: Lubomir Popov <lpopov@mm-sol.com> Tested-by: Jeroen Hofstee <jeroen@myspectrum.nl> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index af4c3c0a98d..b1e5d5f52ea 100644
--- a/Makefile
+++ b/Makefile
@@ -743,6 +743,13 @@ tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
$(MAKE) -C $@ all
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):
@mkdir -p $(dir $(VERSION_FILE))
@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \