Skip to content

Commit

Permalink
Fix build error on riscv64 by linking libatomic
Browse files Browse the repository at this point in the history
  • Loading branch information
hack3ric authored and andikleen committed Aug 22, 2022
1 parent 8b18345 commit 10c277c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ memhog_LDADD = libnuma.la

libnuma_la_SOURCES = libnuma.c syscall.c distance.c affinity.c affinity.h sysfs.c sysfs.h rtnetlink.c rtnetlink.h versions.ldscript
libnuma_la_LDFLAGS = -version-info 1:0:0 -Wl,--version-script,$(srcdir)/versions.ldscript -Wl,-init,numa_init -Wl,-fini,numa_fini
if RISCV64
libnuma_la_LDFLAGS += -latomic
endif

check_PROGRAMS = \
test/distance \
Expand Down
7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ AC_PROG_CC
# Override CFLAGS so that we can specify custom CFLAGS for numademo.
AX_AM_OVERRIDE_VAR([CFLAGS])

AX_TLS([:],[:])
AX_TLS

AX_CHECK_COMPILE_FLAG([-ftree-vectorize], [tree_vectorize="true"])
AM_CONDITIONAL([HAVE_TREE_VECTORIZE], [test x"${tree_vectorize}" = x"true"])

AC_CONFIG_FILES([Makefile])
AC_CANONICAL_TARGET
AM_CONDITIONAL([RISCV64], [test x"${target_cpu}" = x"riscv64"])

AC_SEARCH_LIBS([__atomic_fetch_and_1], [atomic])
AC_CONFIG_FILES([Makefile])

# GCC tries to be "helpful" and only issue a warning for unrecognized
# attributes. So we compile the test with Werror, so that if the
Expand Down

0 comments on commit 10c277c

Please sign in to comment.