From def7a07288d23a2ea6ad0645f9db6558a54d6d12 Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@cray.com>
Date: Thu, 27 Jan 2022 09:14:43 +0100
Subject: [PATCH] [liberl] add embedded build option

---
 deps/liberl/Makefile.am              |  9 ++++++++-
 deps/liberl/configure.ac             | 10 ++++++++++
 deps/liberl/include/erl_threadpool.h |  2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/deps/liberl/Makefile.am b/deps/liberl/Makefile.am
index f45237d5..93f2eee4 100644
--- a/deps/liberl/Makefile.am
+++ b/deps/liberl/Makefile.am
@@ -31,10 +31,17 @@
 #
 
 ACLOCAL_AMFLAGS=-I m4
+noinst_LTLIBRARIES =
+lib_LTLIBRARIES =
+
+if EMBEDDED
+noinst_LTLIBRARIES += liberl.la
+else
+lib_LTLIBRARIES += liberl.la
+endif
 
 # ERL library
 SUBDIRS = erl . tests
-lib_LTLIBRARIES = liberl.la
 liberl_la_SOURCES = include/erl_status.h \
 		    include/erl_logging.h \
 		    include/erl_threadpool.h \
diff --git a/deps/liberl/configure.ac b/deps/liberl/configure.ac
index b779567c..dec850a5 100644
--- a/deps/liberl/configure.ac
+++ b/deps/liberl/configure.ac
@@ -37,6 +37,16 @@ AC_PROG_CC
 AM_PROG_AR
 AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-ustar])
 
+AC_ARG_ENABLE([embedded],
+              [AS_HELP_STRING([--enable-embedded],
+                              [Enable embedded support (build convenience library, no symbol versioning) @<:@default=no@:>@])
+              ],
+              [ac_asm_symver_support=0
+               icc_symver_hack=1],
+              [enable_embedded=no])
+AM_CONDITIONAL([EMBEDDED], [test x"$enable_embedded" = x"yes"])
+
+
 AC_ARG_ENABLE([numa],
               [AS_HELP_STRING([--enable-numa],[Disable libnuma usage (default: use if detected)])],
 	      [enable_numa=$enableval],[enable_numa=yes])
diff --git a/deps/liberl/include/erl_threadpool.h b/deps/liberl/include/erl_threadpool.h
index f283f325..d5bd312c 100644
--- a/deps/liberl/include/erl_threadpool.h
+++ b/deps/liberl/include/erl_threadpool.h
@@ -84,7 +84,7 @@ erl__get_binding_index_rr1(const struct erl_threadpool_attr *attr, int nnodes, i
 int
 erl__get_binding_index_rrall(const struct erl_threadpool_attr *attr, int nnodes, int ncpus, int tid);
 
-int (*erl__get_binding_index[ERL_tp_cpubind__max]) 
+static int (*const erl__get_binding_index[ERL_tp_cpubind__max]) 
     (const struct erl_threadpool_attr *attr, int nnodes, int ncpus, int tid) = {
   erl__get_binding_error,
   erl__get_binding_index_fixed,
-- 
GitLab