[PATCH 0/4 REVIEW] libtool and libctf fixes for Solaris 11

Nick Alcock nick.alcock@oracle.com
Fri Jun 25 16:13:31 GMT 2021


There are three intertwined bugs here, two in libtool.m4, one in libctf.
The underlying "problem" is that libctf tries to version its symbols: if
it can't use a GNU version script it tries to hide unnecessary symbols
using Libtool's --export-symbols-regex flag... and that flag has kinda
rusted.

Firstly, it relies on running nm and knowing what the symbol type codes
it emits (in BSD mode) mean: Solaris 11 has gained 'C' for common
symbols, like GNU nm, but libtool.m4 was never updated to know about
that, so the test failed.

Secondly, it relies on knowing how to switch nm into BSD mode, which it
does by nm'ing a bunch of candidate nms with various flags: but it nms
/dev/null and has not-very-good handling of nms that emit errors if you
do that.

Thirdly, libtool's nm option scanning is entirely suppressed if NM is
set in the environment, on the grounds that the user must have set it --
but libtool already augments other things set in the environment with
extra flags if needed, and the user can hardly be expected to know that
Libtool needs 'nm -p' on Solaris, not just nm. Worse yet, Cygnus
configure sets NM unconditionally, stopping the test dead.  Fixed by
checking flags even if the user overrides nm, but checking the specific
nm they requested.

The first two patches in this series need review because, well, libtool
upstream is dead enough that I don't know if I can even submit it there,
but it should probably go to GCC and binutils-gdb. I have tested it on
Solaris 11.3, Solaris 11.4, FreeBSD, (x86-64 and SPARC) Linux, and
Cygwin, which should be enough coverage, I hope.  libtool upstream has
diverged in this area and the patch would need redoing in any case
(though the conflicts look quite minor, I don't have time right now and
doing that wouldn't help fix any of the reporter's problems in any case).

(The latter two patches, sent to binutils@ alone, enable symbol
versioning on Solaris 11.4, which provides a --version-script flag
almost but not quite compatible with GNU ld's, and regenerate most
relevant configure scripts, skipping only sim/ because it's in a ferment
of change right now.)

Cc: gcc-patches@gcc.gnu.org

Nick Alcock (4):
  libtool.m4: augment symcode for Solaris 11
  libtool.m4: fix nm BSD flag detection
  libctf: try several possibilities for linker versioning flags
  configure: regenerate in all projects that use libtool.m4

 bfd/configure       |  91 ++++++++++++-------------
 binutils/configure  |  91 ++++++++++++-------------
 gas/configure       |  91 ++++++++++++-------------
 gprof/configure     |  91 ++++++++++++-------------
 ld/configure        |  91 ++++++++++++-------------
 libctf/Makefile.am  |   5 +-
 libctf/Makefile.in  |   6 +-
 libctf/configure    | 157 ++++++++++++++++++++++++++++++--------------
 libctf/configure.ac |  46 ++++++++++++-
 libctf/libctf.ver   |  10 ++-
 libtool.m4          |  90 ++++++++++++-------------
 opcodes/configure   |  91 ++++++++++++-------------
 zlib/configure      |  91 ++++++++++++-------------
 13 files changed, 531 insertions(+), 420 deletions(-)

-- 
2.32.0.255.gd9b1d14a2a



More information about the Gcc-patches mailing list