]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtool: Limit a length of DLL name to 8.3 correctly
authorKO Myung-Hun <komh@chollian.net>
Thu, 13 Nov 2025 05:41:48 +0000 (14:41 +0900)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Mon, 17 Nov 2025 19:48:05 +0000 (21:48 +0200)
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.

This patch assures 3 bytes for libname, 2 bytes for release, and 3 bytes
for version at least.

* m4/libtool.m4 (soname_spec) [os2*]: Limit a length of DLL name to 8.3
correctly.

m4/libtool.m4

index 6c3029f8fd078cfb22d6bc7e60851da557c5d5c3..495bd10b88b4918433ddb2b47d14a2fb1356fcb7 100644 (file)
@@ -3173,9 +3173,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 3 -lt "$l" && l=3; mr=$((8 - $l));
+    r=$($ECHO $release | tr -d .-);
+    l=${#r}; test 2 -lt "$l" && 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