summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-03-15 16:10:45 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-03 12:18:08 +0100
commit1893b8b90ca78e0bd823abb2484908afd038f485 (patch)
treef5a4d6185f843d7b9e2711c8a0798ae5732528a2
parente0235ddd2b74faccb752c4d036bb2e72063e9a35 (diff)
build: mark binary data as read-only with objcopy
Check for objcopy in configure.ac and then mark binary data as read-only by renaming .data to .rodata and setting the correct flags. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac8
2 files changed, 9 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 9cd8326..ee84429 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -131,6 +131,7 @@ CLEANFILES += src/*.bin.lo src/*.bin.o
src/%.bin.lo: src/%.bin
$(AM_V_GEN)$(LD) -r -o "src/$*.bin.o" -z noexecstack --format=binary "$<"
+ $(AM_V_at)$(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents "src/$*.bin.o"
$(AM_V_at)echo "# $@ - a libtool object file" >"$@"
$(AM_V_at)echo "# Generated by $(shell $(LIBTOOL) --version | head -n 1)" >>"$@"
$(AM_V_at)echo "#" >>"$@"
diff --git a/configure.ac b/configure.ac
index ac942b8..eb3020f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -777,6 +777,14 @@ fi
# gles2 helpers
AM_CONDITIONAL([BUILD_HAVE_GLES2], [test "x$have_gles2" = "xyes"])
+# check for mandatory objcopy program
+AC_ARG_VAR([OBJCOPY], [objcopy program])
+AC_CHECK_TOOL([OBJCOPY], [objcopy], "")
+
+if test "x$OBJCOPY" = "x" ; then
+ AC_ERROR([Cannot find "objcopy" program])
+fi
+
#
# Makefile vars
# After everything is configured, we correctly substitute the values for the