acadia-newlib/newlib/libc/sys/linux
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
..
argp newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
bits
cmath newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
dl 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 libc/time: Move internal newlib tz-structs into own header 2020-10-15 16:59:51 +02:00
intl newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
linuxthreads libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
machine libtool.m4: fix nm BSD flag detection 2022-01-12 08:49:10 -05:00
net newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
sys Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
Makefile.am newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
Makefile.in newlib: migrate from INCLUDES to AM_CPPFLAGS 2022-01-05 20:29:53 -05:00
aclocal.m4 newlib: regen aclocal.m4 after autoconf update 2022-01-12 07:01:18 -05:00
aio.c
aio64.c
bp-checks.h
brk.c
calloc.c
callocr.c
cfreer.c
cfspeed.c
clock_getres.c
clock_gettime.c
clock_settime.c
config.h
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
confstr.c
confstr.h
crt1.c
ctermid.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fclean.c
flockfile.c
fpathconf.c
free.c
freer.c
fstab.c
fstatvfs.c
fstatvfs64.c
ftok.c
ftw.c
ftw64.c
funlockfile.c
getdate.c sys: remove TRAD_SYNOPSIS 2017-12-01 03:41:52 -06:00
getdate_err.c
gethostid.c
gethostname.c
getlogin.c ansification: remove _DEFUN_VOID 2018-01-17 11:47:19 -06:00
getopt.c
getopt1.c
getpwent.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
getreent.c
getrlimit64.c
getwd.c
hp-timing.h
ids.c
inode.c
internal_statvfs.c
io.c
io64.c
ipc.c
isatty.c
kernel_sigaction.h
libc-internal.h
libc-symbols.h headers: properly decorate attributes 2014-08-01 15:44:51 +00:00
libc-tsd.h
libintl.h
linux.c
linux_fsinfo.h
malign.c
malignr.c
mallinfor.c
malloc.c
mallocr.c
malloptr.c
mallstatsr.c
mcheck.c
mhooks.h
mmap.c
mntent.c
mntent_r.c
mq_close.c
mq_getattr.c
mq_notify.c
mq_open.c
mq_receive.c
mq_send.c
mq_setattr.c
mq_unlink.c
mqlocal.h
msize.c
msizer.c
mstats.c
mtrim.c
mtrimr.c
ntp_gettime.c
pathconf.c
pread.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
pread64.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
process.c
prof-freq.c
profile.c
pvallocr.c
pwrite.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
pwrite64.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
raise.c
readdir64.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
realloc.c
reallocr.c
realpath.c 2013-11-18 Joel Sherrill <joel.sherrill@oarcorp.com> 2013-11-19 17:32:24 +00:00
rename.c
resource.c
scandir64.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
sched.c
select.c
seteuid.c
sethostid.c
sethostname.c
setrlimit64.c
shared.ld 2014-12-18 Jeff Johnston <jjohnstn@redhat.com> 2014-12-18 20:30:11 +00:00
shlib-compat.h
shm_open.c
shm_unlink.c
sig.c
sigaction.c
siglongjmp.c
signal.c
sigqueue.c
sigset.c
sigwait.c
sleep.c
socket.c
sockops.h
stack.c
statvfs.c 2013-11-21 Daniel Ramirez <javamonn@gmail.com> 2013-11-22 01:17:42 +00:00
statvfs64.c
strsignal.c
strverscmp.c
sysconf.c
sysctl.c
systat.c
system.c
tcdrain.c
tcsendbrk.c
termios.c
thread-m.h
time.c
ttyname_r.c
usleep.c
utimes.c
vallocr.c
versionsort.c
versionsort64.c
wait.c