123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #ifndef _MACHINE_ASM_H_
- #define _MACHINE_ASM_H_
- #ifdef __APPLE__
- #include "../i387/osx_asm.h"
- #define CNAME(x) EXT(x)
- #else
- #include "bsd_cdefs.h"
- #ifdef PIC
- #define PIC_PLT(x) x@PLT
- #define PIC_GOT(x) x@GOTPCREL(%rip)
- #else
- #define PIC_PLT(x) x
- #define PIC_GOT(x) x
- #endif
- #define CNAME(csym) csym
- #define HIDENAME(asmsym) .asmsym
- #define _START_ENTRY .p2align 4,0x90
- #if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__)
- #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 _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); \
- pushq %rbp; movq %rsp,%rbp; \
- call PIC_PLT(HIDENAME(mcount)); \
- popq %rbp; \
- jmp 9f
- #define ENTRY(x) _ENTRY(x); \
- pushq %rbp; movq %rsp,%rbp; \
- call PIC_PLT(HIDENAME(mcount)); \
- popq %rbp; \
- 9:
- #else
- #define ALTENTRY(x) _ENTRY(x)
- #define ENTRY(x) _ENTRY(x)
- #endif
- #define RCSID(x) .text; .asciz x
- #undef __FBSDID
- #if !defined(lint) && !defined(STRIP_FBSDID)
- #define __FBSDID(s) .ident s
- #else
- #define __FBSDID(s)
- #endif
- #endif
- #endif
|