Using --version-script with clang17

From: Tatsuki Makino <tatsuki_makino_at_hotmail.com>
Date: Thu, 07 Mar 2024 21:25:10 UTC
Hello.

This is related to Re: How do I clear no-longer-usable packages from poudriere?

There are some fixes for build failures when clang17 and version-script are combined in porttree as well.
Nothing seemed to be wrong with clang15.
It seems that since clang16, the warning to be strict has been issued.
clang17 will exit it as an error.

dns/libidn

Ports that use ld-version-script.m4 for configure, such as dns/libidn and devel/fstrm, seem to have changed their behavior due to the change.
clang16 produces the following log, but it is not an error.

ld: warning: version script assignment of 'VERS_1' to symbol 'sym' failed: symbol not defined
ld: warning: version script assignment of 'VERS_2' to symbol 'sym' failed: symbol not defined

clang17 makes the following error.

clang: error: linker command failed with exit code 1 (use -v to see invocation)

These may be corrected by applying the following patches.

Regards.
Below is an example of a patch.

diff --git a/dns/libidn/files/patch-configure b/dns/libidn/files/patch-configure
new file mode 100644
index 00000000000..bf982ce0360
--- /dev/null
+++ b/dns/libidn/files/patch-configure
@@ -0,0 +1,16 @@
+--- configure.orig	2021-07-22 13:51:19 UTC
++++ configure
+@@ -25746,11 +25746,11 @@ if ac_fn_c_try_link "$LINENO"; then :
+ else
+   cat > conftest.map <<EOF
+ VERS_1 {
+-        global: sym;
++        global: main;
+ };
+
+ VERS_2 {
+-        global: sym;
++        global: main;
+ } VERS_1;
+ EOF
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/dns/libidn/files/patch-gl_m4_ld-version-script.m4 b/dns/libidn/files/patch-gl_m4_ld-version-script.m4
new file mode 100644
index 00000000000..83c00f27181
--- /dev/null
+++ b/dns/libidn/files/patch-gl_m4_ld-version-script.m4
@@ -0,0 +1,16 @@
+--- gl/m4/ld-version-script.m4.orig	2021-07-22 13:49:04 UTC
++++ gl/m4/ld-version-script.m4
+@@ -31,11 +31,11 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT],
+           [],
+           [cat > conftest.map <<EOF
+ VERS_1 {
+-        global: sym;
++        global: main;
+ };
+
+ VERS_2 {
+-        global: sym;
++        global: main;
+ } VERS_1;
+ EOF
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],