1#ifndef _CDEFS_COMPAT_H_
2#define _CDEFS_COMPAT_H_
4#if !defined(__BEGIN_DECLS)
5#if defined(__cplusplus)
6#define __BEGIN_DECLS extern "C" {
14#if defined(__ICCARM__)
15#define __volatile volatile
18#elif defined(__GNUC__)
19#if defined(__strong_alias) && defined(__NetBSD__)
20#define openlibm_strong_reference(sym,alias) __strong_alias(alias,sym)
21#elif defined(__strong_reference)
22#define openlibm_strong_reference(sym,alias) __strong_reference(sym,alias)
25#define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym)
27#define openlibm_strong_reference(sym,aliassym) \
28 OLM_DLLEXPORT extern __typeof (aliassym) aliassym __attribute__ ((__alias__ (#sym)));
33#define openlibm_weak_reference(sym,alias) openlibm_strong_reference(sym,alias)
34#elif defined(__weak_alias) && defined(__NetBSD__)
35#define openlibm_weak_reference(sym,alias) __weak_alias(alias,sym)
36#elif defined(__weak_reference)
37#define openlibm_weak_reference(sym,alias) __weak_reference(sym,alias)
41#define openlibm_weak_reference(sym,alias) \
42 __asm__(".weak " #alias); \
43 __asm__(".equ " #alias ", " #sym)
44#ifdef __warn_references
45#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
47#define openlibm_warn_references(sym,msg) \
48 __asm__(".section .gnu.warning." #sym); \
49 __asm__(".asciz \"" msg "\""); \
53#define openlibm_weak_reference(sym,alias) \
54 __asm__(".weak alias"); \
55 __asm__(".equ alias, sym")
56#ifdef __warn_references
57#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
59#define openlibm_warn_references(sym,msg) \
60 __asm__(".section .gnu.warning.sym"); \
61 __asm__(".asciz \"msg\""); \
65#elif defined(__clang__)
66#if defined(_WIN32) && defined(_X86_)
67#define openlibm_asm_symbol_prefix "_"
69#define openlibm_asm_symbol_prefix ""
72#define openlibm_weak_reference(sym,alias) \
73 __asm__(".weak_reference " openlibm_asm_symbol_prefix #alias); \
74 __asm__(".set " openlibm_asm_symbol_prefix #alias ", " openlibm_asm_symbol_prefix #sym)
76#define openlibm_weak_reference(sym,alias) \
77 __asm__(".weak_reference openlibm_asm_symbol_prefix/**/alias");\
78 __asm__(".set openlibm_asm_symbol_prefix/**/alias, openlibm_asm_symbol_prefix/**/sym")
82#define openlibm_weak_reference(sym,alias) \
83 __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
84 __asm__(".stabs \"_" #sym "\",1,0,0,0")
85#ifdef __warn_references
86#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
88#define openlibm_warn_references(sym,msg) \
89 __asm__(".stabs \"" msg "\",30,0,0,0"); \
90 __asm__(".stabs \"_" #sym "\",1,0,0,0")
93#define openlibm_weak_reference(sym,alias) \
94 __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
95 __asm__(".stabs \"_/**/sym\",1,0,0,0")
96#ifdef __warn_references
97#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
99#define openlibm_warn_references(sym,msg) \
100 __asm__(".stabs msg,30,0,0,0"); \
101 __asm__(".stabs \"_/**/sym\",1,0,0,0")