acadia-newlib/newlib/libc/machine
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
..
a29k newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
aarch64 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
amdgcn newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
arc newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
arm newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
bfin newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
cr16 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
cris newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
crx newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
csky newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
d10v newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
d30v newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
epiphany newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
fr30 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
frv newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
ft32 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
h8300 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
h8500 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
hppa newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
i386 libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
i960 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
iq2000 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
lm32 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
m32c newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
m32r newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
m68hc11 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
m68k newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
m88k newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
mep newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
microblaze newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
mips newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
mn10200 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
mn10300 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
moxie newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
msp430 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
mt newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
nds32 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
necv70 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
nios2 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
nvptx newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
or1k newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
powerpc newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
pru newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
riscv newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
rl78 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
rx newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
sh newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
shared_x86/sys Cygwin: don't export _feinitialise from newlib 2021-04-13 12:55:34 +02:00
sparc newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
spu newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
tic4x newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
tic6x newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
tic80 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
v850 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
visium newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
w65 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
x86_64 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
xc16x newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
xscale newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
xstormy16 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
z8k newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
Makefile.am newlib: Remove automake option 'cygnus' 2021-12-29 22:45:04 +00:00
Makefile.in newlib: Regenerate autotools files 2021-12-29 22:45:06 +00: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