newlib-cygwin/newlib/libc
Nick Alcock 5ab7dd14e1 libtool.m4: fix nm BSD flag detection
Libtool needs to get BSD-format (or MS-format) output out of the system
nm, so that it can scan generated object files for symbol names for
-export-symbols-regex support.  Some nms need specific flags to turn on
BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
Unfortunately the code to do this has a pair of interlocking flaws:

 - it runs the test by doing an nm of /dev/null.  Some platforms
   reasonably refuse to do an nm on a device file, but before now this
   has only been worked around by assuming that the error message has a
   specific textual form emitted by Tru64 nm, and that getting this
   error means this is Tru64 nm and that nm -B would work to produce
   BSD-format output, even though the test never actually got anything
   but an error message out of nm -B.  This is fixable by nm'ing *nm
   itself* (since we necessarily have a path to it).

 - the test is entirely skipped if NM is set in the environment, on the
   grounds that the user has overridden the test: but the user cannot
   reasonably be expected to know that libtool wants not only nm but
   also flags forcing BSD-format output.  Worse yet, one such "user" is
   the top-level Cygnus configure script, which neither tests for
   nor specifies any BSD-format flags.  So platforms needing BSD-format
   flags always fail to set them when run in a Cygnus tree, breaking
   -export-symbols-regex on such platforms.  Libtool also needs to
   augment $LD on some platforms, but this is done unconditionally,
   augmenting whatever the user specified: the nm check should do the
   same.

   One wrinkle: if the user has overridden $NM, a path might have been
   provided: so we use the user-specified path if there was one, and
   otherwise do the path search as usual.  (If the nm specified doesn't
   work, this might lead to a few extra pointless path searches -- but
   the test is going to fail anyway, so that's not a problem.)

(Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
*that* is a symlink to /usr/bin/nm.)

ChangeLog
2021-09-27  Nick Alcock  <nick.alcock@oracle.com>

	PR libctf/27967
	* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
	NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
	errors from nms that refuse to work on non-regular files.  Remove
	other workarounds for this problem.  Strip out blank lines from the
	nm output.
2022-01-12 08:49:10 -05:00
..
argz newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
ctype newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
errno newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
iconv newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
include ldtoa: Import gdtoa from OpenBSD. 2021-12-03 19:20:17 +09:00
locale newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
machine libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
misc newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
posix posix_spawn: fix get/set uid/gid calls for 32 bit Cygwin 2022-01-12 11:57:35 +01:00
reent newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
search newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
signal newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
ssp newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
stdio newlib: fix silent build in a few subdirs 2022-01-05 20:38:25 -05:00
stdio64 newlib: fix silent build in a few subdirs 2022-01-05 20:38:25 -05:00
stdlib newlib: fix silent build in a few subdirs 2022-01-05 20:38:25 -05:00
string newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
sys libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
syscalls newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
time newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
unix newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
xdr newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
Makefile.am newlib: use .texi with libc & libm manuals 2022-01-07 15:54:10 -05:00
Makefile.in newlib: use .texi with libc & libm manuals 2022-01-07 15:54:10 -05:00
Makefile.unidata cleanup Unicode data files after generating updated tables 2021-11-16 11:24:29 +01:00
aclocal.m4 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
configure libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
configure.ac libgloss/newlib: rename configure.in to configure.ac 2021-09-13 10:14:37 -04:00
libc.in.xml newlib: use .texi with libc & libm manuals 2022-01-07 15:54:10 -05:00
libc.texi newlib: use .texi with libc & libm manuals 2022-01-07 15:54:10 -05:00
saber Remove matherr, and SVID and X/Open math library configurations 2019-01-23 10:46:24 +01:00
sys.tex Don't include stdio64 functions in reentrant syscalls menu when not bulding stdio64. 2015-08-03 09:54:33 +01:00