diff options
author | Alistair Popple <alistair@popple.id.au> | 2017-07-13 16:43:58 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2017-07-13 16:43:58 +1000 |
commit | 63c4c233624154d6dcbf21ecab10b4444d332d3c (patch) | |
tree | 08e247fd0c402be9970ce3231da04d5b2f9509ad | |
parent | 8990970954a73e7dab9032ef553f98819d5dc93b (diff) | |
download | pdbg-63c4c233624154d6dcbf21ecab10b4444d332d3c.tar.gz pdbg-63c4c233624154d6dcbf21ecab10b4444d332d3c.zip |
configure.ac: Detect architecture objcopy parameters
The objcopy parameters required to turn device-tree blobs into elf objects for
linking are architecture specific but were hard-coded. This required manual
updates to Makefile.am when compiling for other architectures. Instead detect
the parameters using an autoconf test.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index 1db5546..2bd3f83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,5 +60,4 @@ p9w-fsi.dtb.o: p9w-fsi.dts p9-fsi.dtsi # unflattening the device-tree dd if=$@.tmp of=$@ ibs=16 conv=sync rm $@.tmp -# objcopy -I binary -O elf32-littlearm -B arm $@ $@ - objcopy -I binary -O elf64-x86-64 -B i386:x86-64 $@ $@ + objcopy -I binary -O @ARCH_FF@ $@ $@ diff --git a/configure.ac b/configure.ac index 8bd9c3b..298c1e8 100644 --- a/configure.ac +++ b/configure.ac @@ -6,5 +6,13 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) - +AC_LANG(C) +AC_SUBST([ARCH_FF]) +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[]])], + ARCH_FF=$(${OBJDUMP} -f conftest.$OBJEXT | + sed -ne "s/.*file format //p" -e "s/.*architecture: \(.*\),.*/\1/p" | + tr "\n" " " | + sed -e "s/ / -B /"), + AC_MSG_FAILURE([Unable to determine architecture output file format])) AC_OUTPUT |