aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2016-03-13 11:09:01 +0000
committerMichael Brown <mcb30@ipxe.org>2016-03-13 11:20:53 +0000
commit1f65ed53da16e383416ae034b585fd52682f5ea7 (patch)
tree3503be882258c7f371875fbb9dde567f72649fff /src/include
parenta8037ee131a9501ddfc89ce157e3718b1a3b86a7 (diff)
downloadipxe-1f65ed53da16e383416ae034b585fd52682f5ea7.zip
ipxe-1f65ed53da16e383416ae034b585fd52682f5ea7.tar.gz
ipxe-1f65ed53da16e383416ae034b585fd52682f5ea7.tar.bz2
[build] Allow assembler section type character to vary by architecture
On some architectures (such as ARM) the "@" character is used as a comment delimiter. A section type argument such as "@progbits" therefore becomes "%progbits". This is further complicated by the fact that the "%" character has special meaning for inline assembly when input or output operands are used, in which cases "@progbits" becomes "%%progbits". Allow the section type character(s) to be defined via Makefile variables. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/compiler.h17
-rw-r--r--src/include/errno.h2
2 files changed, 15 insertions, 4 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index ca82f95..32afb64 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -52,6 +52,17 @@
/** Stringify expanded argument */
#define _S2( x ) _S1 ( x )
+/* Assembler section types */
+#ifdef ASSEMBLY
+#define PROGBITS _C2 ( ASM_TCHAR, progbits )
+#define NOBITS _C2 ( ASM_TCHAR, nobits )
+#else
+#define PROGBITS_OPS _S2 ( ASM_TCHAR_OPS ) "progbits"
+#define PROGBITS _S2 ( ASM_TCHAR ) "progbits"
+#define NOBITS_OPS _S2 ( ASM_TCHAR_OPS ) "nobits"
+#define NOBITS _S2 ( ASM_TCHAR ) "nobits"
+#endif
+
/**
* @defgroup symmacros Macros to provide or require explicit symbols
* @{
@@ -64,7 +75,7 @@
*/
#ifdef ASSEMBLY
#define PROVIDE_SYMBOL( symbol ) \
- .section ".provided", "a", @nobits ; \
+ .section ".provided", "a", NOBITS ; \
.hidden symbol ; \
.globl symbol ; \
symbol: ; \
@@ -139,14 +150,14 @@
*/
#ifdef ASSEMBLY
#define PROVIDE_REQUIRING_SYMBOL() \
- .section ".tbl.requiring_symbols", "a", @progbits ; \
+ .section ".tbl.requiring_symbols", "a", PROGBITS ; \
__requiring_symbol__: .byte 0 ; \
.size __requiring_symbol__, . - __requiring_symbol__ ; \
.previous
#else
#define PROVIDE_REQUIRING_SYMBOL() \
__asm__ ( ".section \".tbl.requiring_symbols\", " \
- " \"a\", @progbits\n" \
+ " \"a\", " PROGBITS "\n" \
"__requiring_symbol__:\t.byte 0\n" \
".size __requiring_symbol__, " \
" . - __requiring_symbol__\n" \
diff --git a/src/include/errno.h b/src/include/errno.h
index 036479a..342384f 100644
--- a/src/include/errno.h
+++ b/src/include/errno.h
@@ -258,7 +258,7 @@ static inline void eplatform_discard ( int dummy __unused, ... ) {}
* @ret error Error
*/
#define __einfo_error( einfo ) ( { \
- __asm__ ( ".section \".einfo\", \"\", @progbits\n\t" \
+ __asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
".align 8\n\t" \
"\n1:\n\t" \
".long ( 4f - 1b )\n\t" \