mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2025-01-01 06:23:39 +01:00
8b59bbc18b
skip END and add .drectve export in assembly versions uncomment __strong_reference definition from cdefs-compat.h use weak references in place of strong references on Mac add DLLEXPORT to all strong references Fixes Julia issue #6777
83 lines
2.1 KiB
C
83 lines
2.1 KiB
C
#ifndef _CDEFS_COMPAT_H_
|
|
#define _CDEFS_COMPAT_H_
|
|
|
|
#ifndef _WIN32
|
|
#include "sys/cdefs.h"
|
|
#else /* _WIN32 */
|
|
|
|
#if defined(__cplusplus)
|
|
#define __BEGIN_DECLS extern "C" {
|
|
#define __END_DECLS }
|
|
#else
|
|
#define __BEGIN_DECLS
|
|
#define __END_DECLS
|
|
#endif
|
|
|
|
#define _SYS_CDEFS_H_
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
#ifndef __strong_reference
|
|
#ifdef __APPLE__
|
|
#define __strong_reference(sym,aliassym) __weak_reference(sym,aliassym)
|
|
#else
|
|
#define __strong_reference(sym,aliassym) \
|
|
DLLEXPORT extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
|
|
#endif /* __APPLE__ */
|
|
#endif /* __strong_reference */
|
|
|
|
#ifndef __weak_reference
|
|
#ifdef __ELF__
|
|
#ifdef __STDC__
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".weak " #alias); \
|
|
__asm__(".equ " #alias ", " #sym)
|
|
#define __warn_references(sym,msg) \
|
|
__asm__(".section .gnu.warning." #sym); \
|
|
__asm__(".asciz \"" msg "\""); \
|
|
__asm__(".previous")
|
|
#else
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".weak alias"); \
|
|
__asm__(".equ alias, sym")
|
|
#define __warn_references(sym,msg) \
|
|
__asm__(".section .gnu.warning.sym"); \
|
|
__asm__(".asciz \"msg\""); \
|
|
__asm__(".previous")
|
|
#endif /* __STDC__ */
|
|
#elif defined(__clang__) /* CLANG */
|
|
#ifdef __STDC__
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".weak_reference " #alias); \
|
|
__asm__(".set " #alias ", " #sym)
|
|
#else
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".weak_reference alias");\
|
|
__asm__(".set alias, sym")
|
|
#endif
|
|
#else /* !__ELF__ */
|
|
#ifdef __STDC__
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
|
|
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
|
#define __warn_references(sym,msg) \
|
|
__asm__(".stabs \"" msg "\",30,0,0,0"); \
|
|
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
|
#else
|
|
#define __weak_reference(sym,alias) \
|
|
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
|
|
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
|
#define __warn_references(sym,msg) \
|
|
__asm__(".stabs msg,30,0,0,0"); \
|
|
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
|
#endif /* __STDC__ */
|
|
#endif /* __ELF__ */
|
|
#endif /* __weak_reference */
|
|
#endif /* __GNUC__ */
|
|
|
|
|
|
#endif /* _CDEFS_COMPAT_H_ */
|