diff options
-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) |