diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-11-29 17:40:51 +1030 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2017-12-08 11:22:09 +1100 |
commit | 8275ca370476a3b2a1fa752d892ee13c2e42d410 (patch) | |
tree | 2f8ebc98b298a73d27ae7dc8f365d54e31bb2185 | |
parent | 5f815d7a742eaebe01d44251db833b8051f393aa (diff) | |
download | pdbg-8275ca370476a3b2a1fa752d892ee13c2e42d410.tar.gz pdbg-8275ca370476a3b2a1fa752d892ee13c2e42d410.zip |
template.S: fix to build on architecture with non-empty __USER_LABEL_PREFIX__
Blackfin has a non-empty __USER_LABEL_PREFIX__, which means that a
symbol called "foo" in C must be named "_foo" in assembler.
We now use the preprocessor to set the variables in template.S instead
of using sed.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | template.S | 28 |
2 files changed, 21 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am index 4239a29..e9dd3b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,5 +62,4 @@ 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 - symbol_prefix=`echo $@ | tr '.-' '_'` ; \ - sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CC) -xassembler - -c -o $@ + $(CC) -c $(top_srcdir)/template.S -DSYMBOL_PREFIX=$(shell echo $@ | tr '.-' '_') -DFILENAME=\"$@.tmp\" -o $@ @@ -1,10 +1,22 @@ +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define SYM(x) x +#endif + +#define SYM_START(x) CONCAT1(CONCAT1(_binary_, SYM(x)), _start) +#define SYM_END(x) CONCAT1(CONCAT1(_binary_, SYM(x)), _end) +#define SYM_SIZE(x) CONCAT1(CONCAT1(_binary_, SYM(x)), _size) + .section .data -_binary_SYMBOL_PREFIX_start: -.incbin "FILENAME" +SYM_START(SYMBOL_PREFIX): +.incbin FILENAME .align 4 -_binary_SYMBOL_PREFIX_end: -_binary_SYMBOL_PREFIX_size: - .long _binary_SYMBOL_PREFIX_end - _binary_SYMBOL_PREFIX_start -.globl _binary_SYMBOL_PREFIX_start -.globl _binary_SYMBOL_PREFIX_end -.globl _binary_SYMBOL_PREFIX_size +SYM_END(SYMBOL_PREFIX): +SYM_SIZE(SYMBOL_PREFIX): + .long SYM_END(SYMBOL_PREFIX) - SYM_START(SYMBOL_PREFIX) +.globl SYM_START(SYMBOL_PREFIX) +.globl SYM_END(SYMBOL_PREFIX) +.globl SYM_SIZE(SYMBOL_PREFIX) |