Unify our assembler macros.

Our <machine/asm.h> files were modified from upstream, to the extent
that no architecture was actually using the upstream ENTRY or END macros,
assuming that architecture even had such a macro upstream. This patch moves
everyone to the same macros, with just a few tweaks remaining in the
<machine/asm.h> files, which no one should now use directly.

I've removed most of the unused cruft from the <machine/asm.h> files, though
there's still rather a lot in the mips/mips64 ones.

Bug: 12229603
Change-Id: I2fff287dc571ac1087abe9070362fb9420d85d6d
This commit is contained in:
Elliott Hughes
2014-02-19 16:53:20 -08:00
parent 22c6b7ffd3
commit 851e68a240
94 changed files with 298 additions and 963 deletions

View File

@@ -38,91 +38,17 @@
#ifndef _AARCH64_ASM_H_
#define _AARCH64_ASM_H_
/* TODO: Add cfi directives for creating/restoring FP */
#ifdef __ELF__
# define _C_LABEL(x) x
#else
# ifdef __STDC__
# define _C_LABEL(x) _ ## x
# else
# define _C_LABEL(x) _/**/x
# endif
#endif
#define _ASM_LABEL(x) x
#ifdef __STDC__
# define __CONCAT(x,y) x ## y
# define __STRING(x) #x
#else
# define __CONCAT(x,y) x/**/y
# define __STRING(x) "x"
#endif
#ifndef _ALIGN_TEXT
# define _ALIGN_TEXT .align 0
# define _ALIGN_TEXT .align 0
#endif
#define _ASM_TYPE_FUNCTION %function
#define _ASM_TYPE_OBJECT %object
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .cfi_startproc
#define _ASM_SIZE(x) .size x, .-x;
#define _END(x) \
.cfi_endproc; \
_ASM_SIZE(x)
#define ENTRY(y) _ENTRY(_C_LABEL(y));
#define ENTRY_NP(y) _ENTRY(_C_LABEL(y))
#define END(y) _END(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define ASEND(y) _END(_ASM_LABEL(y))
#ifdef __ELF__
#define ENTRY_PRIVATE(y) ENTRY(y); .hidden _C_LABEL(y)
#else
#define ENTRY_PRIVATE(y) ENTRY(y)
#endif
#define ASMSTR .asciz
#undef __bionic_asm_function_type
#define __bionic_asm_function_type %function
#if defined(__ELF__) && defined(PIC)
#ifdef __STDC__
#define PIC_SYM(x,y) x ## ( ## y ## )
#define PIC_SYM(x,y) x ## ( ## y ## )
#else
#define PIC_SYM(x,y) x/**/(/**/y/**/)
#define PIC_SYM(x,y) x
#endif
#else
#define PIC_SYM(x,y) x
#endif
#ifdef __ELF__
#define RCSID(x) .section ".ident"; .asciz x
#else
#define RCSID(x) .text; .asciz x
#endif
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
#ifdef __STDC__
#define WARN_REFERENCES(sym,msg) \
.stabs msg ## ,30,0,0,0 ; \
.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
#elif defined(__ELF__)
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(sym),1,0,0,0
#else
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(_/**/sym),1,0,0,0
#endif /* __STDC__ */
#endif /* _AARCH64_ASM_H_ */