123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef _MACHINE_ASM_H_
- #define _MACHINE_ASM_H_
- #if defined(__APPLE__)
- #include "osx_asm.h"
- #define CNAME(x) EXT(x)
- #else
- #include "cdefs-compat.h"
- #ifdef PIC
- #define PIC_PROLOGUE \
- pushl %ebx; \
- call 1f; \
- 1: \
- popl %ebx; \
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
- #define PIC_EPILOGUE \
- popl %ebx
- #define PIC_PLT(x) x@PLT
- #define PIC_GOT(x) x@GOT(%ebx)
- #else
- #define PIC_PROLOGUE
- #define PIC_EPILOGUE
- #define PIC_PLT(x) x
- #define PIC_GOT(x) x
- #endif
- #define _START_ENTRY .p2align 2,0x90
- #if defined(__ELF__)
- #define CNAME(csym) csym
- #define HIDENAME(asmsym) .asmsym
- #define _ENTRY(x) .text; _START_ENTRY; \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x):
- #define END(x) .size x, . - x
- #elif defined(_WIN32)
- #ifndef _MSC_VER
- #define END(x) .end
- #define _START_ENTRY_WIN .text; _START_ENTRY
- #else
- #define END(x) end
- #define _START_ENTRY_WIN .code; _START_ENTRY
- #endif
- #define CNAME(csym) _##csym
- #define HIDENAME(asmsym) .asmsym
- #define _ENTRY(x) _START_ENTRY_WIN; \
- .globl CNAME(x); .section .drectve; .ascii " -export:" #x; \
- .section .text; .def CNAME(x); .scl 2; .type 32; .endef; CNAME(x):
- #endif
- #ifdef PROF
- #define ALTENTRY(x) _ENTRY(x); \
- pushl %ebp; movl %esp,%ebp; \
- call PIC_PLT(HIDENAME(mcount)); \
- popl %ebp; \
- jmp 9f
- #define ENTRY(x) _ENTRY(x); \
- pushl %ebp; movl %esp,%ebp; \
- call PIC_PLT(HIDENAME(mcount)); \
- popl %ebp; \
- 9:
- #else
- #define ALTENTRY(x) _ENTRY(x)
- #define ENTRY(x) _ENTRY(x)
- #endif
- #define RCSID(x) .text; .asciz x
- #undef __FBSDID
- #define __FBSDID(s)
- #endif
- #endif
|