summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-11-16 14:21:20 +1030
committerAlistair Popple <alistair@popple.id.au>2017-11-22 10:35:17 +1100
commit527fe54e1c95e031efd3db008c3f4e096cb3ea58 (patch)
tree8ecb73a760c8642a775143c2a7085d4720ea0505 /Makefile.am
parent58950eef124fcb37687f856fc5ee7936cb4e31cc (diff)
downloadpdbg-527fe54e1c95e031efd3db008c3f4e096cb3ea58.tar.gz
pdbg-527fe54e1c95e031efd3db008c3f4e096cb3ea58.zip
Rework generation of .dtb.o
The .dtb.o files are currently generated by compiling the .dts into .dtb, and then making a pass of objcopy to turn them into an ELF file that can be linked with the rest of pdbg. Unfortunately, this objcopy logic doesn't work on all platforms, because it doesn't generate an object file with the correct ABI flags. For example, on mips32r6, it fails to build with: mipsel-buildroot-linux-gnu/bin/ld: fake.dtb.o: warning: linking abicalls files with non-abicalls files mipsel-buildroot-linux-gnu/bin/ld: fake.dtb.o: linking -mnan=legacy module with previous -mnan=2008 modules mipsel-buildroot-linux-gnu/bin/ld: failed to merge target specific data of file fake.dtb.o mipsel-buildroot-linux-gnu/bin/ld: p8-fsi.dtb.o: warning: linking abicalls files with non-abicalls files In order to fix this, we want to generate a proper object file with gcc instead of playing tricks with objcopy, and this is what this commit implement. We have a template.S file, which gets sed'ed on the fly to point to the right file / use the right symbol name, and then is fed to gcc. This allows to remove all the objdump/objcopy logic from the configure.ac script as well. This fixes build issues of pdbg seems inside the Buildroot project: http://autobuild.buildroot.net/?reason=pdbg-77158819158d1d7053a737ac090d04fdfbfe9265 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Cyril Bur <cyrilbur@gmail.com> [joel: - integrate Cyril/Stephen's tr change - fix out of tree builds] Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am9
1 files changed, 2 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 5832590..9d34bff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,10 +61,5 @@ p9r-fsi.dtb.o: p9r-fsi.dts p9-fsi.dtsi
p9z-fsi.dtb.o: p9z-fsi.dts p9-fsi.dtsi
%.dtb.o: %.dts
dtc -i$(dir $@) -I dts $< -O dtb > $@.tmp
-
-# We need to align the output as some processor/kernel
-# combinations can't deal with the alignment errors when
-# unflattening the device-tree
- dd if=$@.tmp of=$@ ibs=16 conv=sync
- rm $@.tmp
- $(OBJCOPY) -I binary -O @ARCH_FF@ $@ $@
+ symbol_prefix=`echo $@ | tr '.-' '_'` ; \
+ sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CC) -xassembler - -c -o $@
OpenPOWER on IntegriCloud