Skip to content

Commit

Permalink
prefix symbols with _ for 32-bit x86 Windows (#242)
Browse files Browse the repository at this point in the history
In a case that I believe can only be hit for Clang i686-*-windows-gnu (AKA MinGW), symbols in asm need to be prefixed with `_`.  Fixes #237
  • Loading branch information
jeremyd2019 authored Sep 9, 2021
1 parent 60dec83 commit d0ef09a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/cdefs-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@
#endif /* __warn_references */
#endif /* __STDC__ */
#elif defined(__clang__) /* CLANG */
#if defined(_WIN32) && defined(_X86_)
#define openlibm_asm_symbol_prefix "_"
#else
#define openlibm_asm_symbol_prefix ""
#endif
#ifdef __STDC__
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak_reference " #alias); \
__asm__(".set " #alias ", " #sym)
__asm__(".weak_reference " openlibm_asm_symbol_prefix #alias); \
__asm__(".set " openlibm_asm_symbol_prefix #alias ", " openlibm_asm_symbol_prefix #sym)
#else
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak_reference alias");\
__asm__(".set alias, sym")
__asm__(".weak_reference openlibm_asm_symbol_prefix/**/alias");\
__asm__(".set openlibm_asm_symbol_prefix/**/alias, openlibm_asm_symbol_prefix/**/sym")
#endif
#else /* !__ELF__ */
#ifdef __STDC__
Expand Down

0 comments on commit d0ef09a

Please sign in to comment.