Subject: Preloading symbols on Solaris 11.3

From: Martyn Plummer <[email-masked]>
Date: Thu, 14 Jan 2016 10:29:17 +0000

Solaris 11.3 (released October 2015) introduced a change in the "nm"
utility which breaks the ability of autoconf to detect that ltdl can use
preloaded symbols. The attached one-line patch fixes the problem.

My software [1] uses autoconf and incorporates the macro file libtool.m4
into the configure script. On Solaris 11.3 I get the following in
config.log:

libltdl_cv_preloaded_symbols=no

This is a change from Solaris 11.2 when the result was "yes".

The bug strikes when the variable "lt_cv_sys_global_symbol_pipe" is set.
The built-in test for the global symbol pipe fails and it is reset to
null.

The  program conftest.c created for the test of the global symbol pipe
is:

#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}

Under Solaris 11.2, the result of "/usr/bin/nm -p" on the object file
for this test program is

0000000032 T main
0000000016 T nm_test_func
0000000001 D nm_test_var

(additional lines of output omitted for clarity). Under 11.3 this is now

0000000032 T main
0000000016 T nm_test_func
0000000001 C nm_test_var

So nm_test_var is now listed as common ("C") instead of initialized data
("D"). This brings the behaviour of Oracle's nm in line with the GNU
version. 

Currently "C" is not recognized as a possible symbol code on Solaris.
Therefore nm_test_var is not extracted by the global symbol pipe and the
test fails. This bug is fixed in the attached patch for libtool.m4,
which adds "C" to the regular expression symcode for Solaris.

best regards
Martyn Plummer

PS The nm utility on Solaris is provided by the base-developer-utilities
package, and the change occurred between versions
0.5.11-0.175.2.0.0.42.2 and 0.5.11-0.175.3.0.0.30.0.

[1]
http://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.0.1.tar.gz

-----------------------------------------------------------------------
This message and its attachments are strictly confidential. If you are
not the intended recipient of this message, please immediately notify 
the sender and delete it. Since its integrity cannot be guaranteed, 
its content cannot involve the sender's responsibility. Any misuse, 
any disclosure or publication of its content, either whole or partial, 
is prohibited, exception made of formally approved use
-----------------------------------------------------------------------
diff -uNr m4-old/libtool.m4 m4/libtool.m4
--- m4-old/libtool.m4	2016-01-14 10:32:08.285837959 +0100
+++ m4/libtool.m4	2016-01-14 10:32:29.853723289 +0100
@@ -3661,7 +3661,7 @@
   symcode='[[BCDEGQRST]]'
   ;;
 solaris*)
-  symcode='[[BDRT]]'
+  symcode='[[BCDRT]]'
   ;;
 sco3.2v5*)
   symcode='[[DT]]'