mirror of https://github.com/ipxe/ipxe.git
[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>pull/51/head
parent
a8037ee131
commit
1f65ed53da
|
@ -491,6 +491,11 @@ LDFLAGS += -static
|
||||||
#
|
#
|
||||||
CFLAGS += -include include/compiler.h
|
CFLAGS += -include include/compiler.h
|
||||||
|
|
||||||
|
# The section type character (e.g. "@" in "@progbits") varies by
|
||||||
|
# architecture.
|
||||||
|
#
|
||||||
|
CFLAGS += -DASM_TCHAR='$(ASM_TCHAR)' -DASM_TCHAR_OPS='$(ASM_TCHAR_OPS)'
|
||||||
|
|
||||||
# CFLAGS for specific object types
|
# CFLAGS for specific object types
|
||||||
#
|
#
|
||||||
CFLAGS_c +=
|
CFLAGS_c +=
|
||||||
|
@ -896,7 +901,7 @@ endif
|
||||||
# Device ID tables (using IDs from ROM definition file)
|
# Device ID tables (using IDs from ROM definition file)
|
||||||
#
|
#
|
||||||
define obj_pci_id_asm
|
define obj_pci_id_asm
|
||||||
.section ".pci_devlist.$(1)", "a", @progbits
|
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
|
||||||
.globl pci_devlist_$(1)
|
.globl pci_devlist_$(1)
|
||||||
pci_devlist_$(1):
|
pci_devlist_$(1):
|
||||||
.short ( 0x$(1) & 0xffff )
|
.short ( 0x$(1) & 0xffff )
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Assembler section type character
|
||||||
|
#
|
||||||
|
ASM_TCHAR := @
|
||||||
|
ASM_TCHAR_OPS := @
|
||||||
|
|
||||||
# Include common x86 headers
|
# Include common x86 headers
|
||||||
#
|
#
|
||||||
INCDIRS += arch/x86/include
|
INCDIRS += arch/x86/include
|
||||||
|
|
|
@ -45,7 +45,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
#define CERT( _index, _path ) \
|
#define CERT( _index, _path ) \
|
||||||
extern char stored_cert_ ## _index ## _data[]; \
|
extern char stored_cert_ ## _index ## _data[]; \
|
||||||
extern char stored_cert_ ## _index ## _len[]; \
|
extern char stored_cert_ ## _index ## _len[]; \
|
||||||
__asm__ ( ".section \".rodata\", \"a\", @progbits\n\t" \
|
__asm__ ( ".section \".rodata\", \"a\", " PROGBITS "\n\t" \
|
||||||
"\nstored_cert_" #_index "_data:\n\t" \
|
"\nstored_cert_" #_index "_data:\n\t" \
|
||||||
".incbin \"" _path "\"\n\t" \
|
".incbin \"" _path "\"\n\t" \
|
||||||
"\nstored_cert_" #_index "_end:\n\t" \
|
"\nstored_cert_" #_index "_end:\n\t" \
|
||||||
|
|
|
@ -54,7 +54,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
/* Raw private key data */
|
/* Raw private key data */
|
||||||
extern char private_key_data[];
|
extern char private_key_data[];
|
||||||
extern char private_key_len[];
|
extern char private_key_len[];
|
||||||
__asm__ ( ".section \".rodata\", \"a\", @progbits\n\t"
|
__asm__ ( ".section \".rodata\", \"a\", " PROGBITS "\n\t"
|
||||||
"\nprivate_key_data:\n\t"
|
"\nprivate_key_data:\n\t"
|
||||||
#ifdef PRIVATE_KEY
|
#ifdef PRIVATE_KEY
|
||||||
".incbin \"" PRIVATE_KEY "\"\n\t"
|
".incbin \"" PRIVATE_KEY "\"\n\t"
|
||||||
|
|
|
@ -18,7 +18,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
#define EMBED( _index, _path, _name ) \
|
#define EMBED( _index, _path, _name ) \
|
||||||
extern char embedded_image_ ## _index ## _data[]; \
|
extern char embedded_image_ ## _index ## _data[]; \
|
||||||
extern char embedded_image_ ## _index ## _len[]; \
|
extern char embedded_image_ ## _index ## _len[]; \
|
||||||
__asm__ ( ".section \".rodata\", \"a\", @progbits\n\t" \
|
__asm__ ( ".section \".rodata\", \"a\", " PROGBITS "\n\t" \
|
||||||
"\nembedded_image_" #_index "_data:\n\t" \
|
"\nembedded_image_" #_index "_data:\n\t" \
|
||||||
".incbin \"" _path "\"\n\t" \
|
".incbin \"" _path "\"\n\t" \
|
||||||
"\nembedded_image_" #_index "_end:\n\t" \
|
"\nembedded_image_" #_index "_end:\n\t" \
|
||||||
|
|
|
@ -52,6 +52,17 @@
|
||||||
/** Stringify expanded argument */
|
/** Stringify expanded argument */
|
||||||
#define _S2( x ) _S1 ( x )
|
#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
|
* @defgroup symmacros Macros to provide or require explicit symbols
|
||||||
* @{
|
* @{
|
||||||
|
@ -64,7 +75,7 @@
|
||||||
*/
|
*/
|
||||||
#ifdef ASSEMBLY
|
#ifdef ASSEMBLY
|
||||||
#define PROVIDE_SYMBOL( symbol ) \
|
#define PROVIDE_SYMBOL( symbol ) \
|
||||||
.section ".provided", "a", @nobits ; \
|
.section ".provided", "a", NOBITS ; \
|
||||||
.hidden symbol ; \
|
.hidden symbol ; \
|
||||||
.globl symbol ; \
|
.globl symbol ; \
|
||||||
symbol: ; \
|
symbol: ; \
|
||||||
|
@ -139,14 +150,14 @@
|
||||||
*/
|
*/
|
||||||
#ifdef ASSEMBLY
|
#ifdef ASSEMBLY
|
||||||
#define PROVIDE_REQUIRING_SYMBOL() \
|
#define PROVIDE_REQUIRING_SYMBOL() \
|
||||||
.section ".tbl.requiring_symbols", "a", @progbits ; \
|
.section ".tbl.requiring_symbols", "a", PROGBITS ; \
|
||||||
__requiring_symbol__: .byte 0 ; \
|
__requiring_symbol__: .byte 0 ; \
|
||||||
.size __requiring_symbol__, . - __requiring_symbol__ ; \
|
.size __requiring_symbol__, . - __requiring_symbol__ ; \
|
||||||
.previous
|
.previous
|
||||||
#else
|
#else
|
||||||
#define PROVIDE_REQUIRING_SYMBOL() \
|
#define PROVIDE_REQUIRING_SYMBOL() \
|
||||||
__asm__ ( ".section \".tbl.requiring_symbols\", " \
|
__asm__ ( ".section \".tbl.requiring_symbols\", " \
|
||||||
" \"a\", @progbits\n" \
|
" \"a\", " PROGBITS "\n" \
|
||||||
"__requiring_symbol__:\t.byte 0\n" \
|
"__requiring_symbol__:\t.byte 0\n" \
|
||||||
".size __requiring_symbol__, " \
|
".size __requiring_symbol__, " \
|
||||||
" . - __requiring_symbol__\n" \
|
" . - __requiring_symbol__\n" \
|
||||||
|
|
|
@ -258,7 +258,7 @@ static inline void eplatform_discard ( int dummy __unused, ... ) {}
|
||||||
* @ret error Error
|
* @ret error Error
|
||||||
*/
|
*/
|
||||||
#define __einfo_error( einfo ) ( { \
|
#define __einfo_error( einfo ) ( { \
|
||||||
__asm__ ( ".section \".einfo\", \"\", @progbits\n\t" \
|
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
|
||||||
".align 8\n\t" \
|
".align 8\n\t" \
|
||||||
"\n1:\n\t" \
|
"\n1:\n\t" \
|
||||||
".long ( 4f - 1b )\n\t" \
|
".long ( 4f - 1b )\n\t" \
|
||||||
|
|
Loading…
Reference in New Issue