Commit e408786075b9540f76783f5c3ce87f6d1ece13cf

Guillem Jover 2023-02-12T23:55:09

build: Fix version script linker support detection When the linker uses --no-undefined-version either specified by the user or as the default behavior (such as with newer clang >= 16 releases), a missing symbol definition will cause a linker error if that symbol is listed in the version script. Closes: #1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/m4/libmd-linker.m4 b/m4/libmd-linker.m4
index 7d1236a..3d6edcd 100644
--- a/m4/libmd-linker.m4
+++ b/m4/libmd-linker.m4
@@ -8,7 +8,11 @@ AC_DEFUN([LIBMD_LINKER_VERSION_SCRIPT], [
     save_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
     AC_LINK_IFELSE([
-      AC_LANG_PROGRAM([], [])
+      AC_LANG_PROGRAM([[
+extern int symbol(void);
+int symbol(void) { return 0; }
+]], [[
+]])
     ], [
       libmd_cv_version_script=yes
     ], [