Skip to content

Commit

Permalink
Fixed prebuilt binary compatibility with musl and ARM64 systems
Browse files Browse the repository at this point in the history
fixes #1578 (comment)

- up until recently, we've never provided musl and arm64 prebuilt binaries to users
- to maintain compatibility with older glibc versions, we have a symbol
  override that gets included at compile time
- this didn't take into account ARM64 systems, which ship with a later
  glibc version which first supported arm64: https://www.phoronix.com/scan.php?page=news_item&px=MTI2MTc
- it also didn't take into account musl systems, which don't use glibc
  and therefore should be ignored
  • Loading branch information
daniellockyer committed Apr 17, 2022
1 parent 241d710 commit 73da410
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/gcc-preinclude.h
@@ -1,6 +1,26 @@

// http://web.archive.org/web/20140401031018/http://rjpower9000.wordpress.com:80/2012/04/09/fun-with-shared-libraries-version-glibc_2-14-not-found/

#if defined(__linux__) && defined(__x86_64__)
#define _GNU_SOURCE
#include <features.h>
#undef _GNU_SOURCE

#if defined(__linux__) && defined(__USE_GNU)

#if defined(__x86_64__)
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
__asm__(".symver exp,exp@GLIBC_2.2.5");
__asm__(".symver log,log@GLIBC_2.2.5");
__asm__(".symver pow,pow@GLIBC_2.2.5");
__asm__(".symver fcntl64,fcntl@GLIBC_2.2.5");
#endif

#if defined(__aarch64__) || defined(_M_ARM64)
__asm__(".symver memcpy,memcpy@GLIBC_2.17");
__asm__(".symver exp,exp@GLIBC_2.17");
__asm__(".symver log,log@GLIBC_2.17");
__asm__(".symver pow,pow@GLIBC_2.17");
__asm__(".symver fcntl64,fcntl@GLIBC_2.17");
#endif

#endif

0 comments on commit 73da410

Please sign in to comment.