Skip to content

Commit

Permalink
native: Don't use __xstat on loongarch64
Browse files Browse the repository at this point in the history
We currently define __xstat to allow linking against older glibc builds.

glibc on loongarch64 does not have __xstat (not necessary), which
currently breaks our native library.

Detect the loongarch architecture and skip our xstat workaround.

Also see https://lists.openembedded.org/g/openembedded-core/topic/99216091
  • Loading branch information
kohlschuetter committed Sep 5, 2024
1 parent 0f4fb9e commit 3d4553e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions junixsocket-native/src/main/c/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,20 +367,24 @@ int jux_mangleErrno(int);
# else
// This allows us to link against older glibc versions
# define memcpy memmove
# ifndef _STAT_VER
# if defined(__loongarch64)
// no stat/__xstat workaround on loongarch64
# else
# ifndef _STAT_VER
# if defined(__aarch64__) || defined(__riscv)
# define _STAT_VER 0
# elif defined(__x86_64__)
# define _STAT_VER 1
# else
# define _STAT_VER 3
# endif
# endif
# if !defined(__xstat)
# endif
# if !defined(__xstat)
extern int __xstat (int __ver, const char *__filename,
struct stat *__stat_buf) __THROW __nonnull ((2, 3));
# endif
# define stat(...) __xstat(_STAT_VER, __VA_ARGS__)
# endif
# define stat(...) __xstat(_STAT_VER, __VA_ARGS__)
# endif
#endif

Expand Down

0 comments on commit 3d4553e

Please sign in to comment.