libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] libtool: Limit a length of DLL name to 8.3 correctly


From: KO Myung-Hun
Subject: [PATCH 2/2] libtool: Limit a length of DLL name to 8.3 correctly
Date: Sun, 15 Oct 2023 02:04:23 +0900

If a length of $release and/or $versionsuffix is more than 8 bytes,
a length of DLL name may be more than 8.

Then, this corrupts a generated DLL on OS/2.

* m4/libtool.m4 (soname_spec) [os2*]: Limit a length of DLL name to 8.3
correctly.
---
 m4/libtool.m4 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index f63b8406..c2eb0481 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2967,9 +2967,14 @@ os2*)
   need_lib_prefix=no
   # OS/2 can only load a DLL with a base name of 8 characters or less.
   soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
-    v=$($ECHO $release$versuffix | tr -d .-);
-    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
-    $ECHO $n$v`$shared_ext'
+    n=$($ECHO $libname | tr -d .-);
+    l=${#n}; test $l -gt 3 && l=3; mr=$((8 - $l));
+    r=$($ECHO $release | tr -d .-);
+    l=${#r}; test $l -gt 2 && l=2; mv=$(($mr - $l));
+    v=$($ECHO $versuffix | tr -d .- | cut -b -$mv);
+    r=$($ECHO $r | cut -b -$(($mr - ${#v})));
+    n=$($ECHO $n | cut -b -$((8 - ${#r} - ${#v})));
+    $ECHO $n$r$v`$shared_ext'
   library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
   shlibpath_var=BEGINLIBPATH
-- 
2.42.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]