Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/binutils/dist/bfd Fix 'nm /dev/ksyms' (noticed...



details:   https://anonhg.NetBSD.org/src/rev/fb664f6e8232
branches:  trunk
changeset: 465632:fb664f6e8232
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Nov 30 22:50:11 2019 +0000

description:
Fix 'nm /dev/ksyms' (noticed by ryo).

Since binutils 2.15, nm(1) cannot be used for character devices.
We worked around this by a local patch:

http://cvsweb.netbsd.org/bsdweb.cgi/src/gnu/dist/binutils/binutils/Attic/bucomm.c?r1=1.1.1.2&hideattic=0#rev1.2

With recent update of binutils, 'nm /dev/ksyms' got broken again.
This is due to a consistency check involving file size reported by
stat(2), which is always zero for character devices. So, skip this
check if file size is zero.

diffstat:

 external/gpl3/binutils/dist/bfd/elf.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r f2a561a81f6b -r fb664f6e8232 external/gpl3/binutils/dist/bfd/elf.c
--- a/external/gpl3/binutils/dist/bfd/elf.c     Sat Nov 30 20:45:49 2019 +0000
+++ b/external/gpl3/binutils/dist/bfd/elf.c     Sat Nov 30 22:50:11 2019 +0000
@@ -298,7 +298,8 @@
       /* Allocate and clear an extra byte at the end, to prevent crashes
         in case the string table is not terminated.  */
       if (shstrtabsize + 1 <= 1
-         || shstrtabsize > bfd_get_file_size (abfd)
+         || (bfd_get_file_size (abfd) > 0 /* not a character device */
+               && shstrtabsize > bfd_get_file_size (abfd))
          || bfd_seek (abfd, offset, SEEK_SET) != 0
          || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL)
        shstrtab = NULL;



Home | Main Index | Thread Index | Old Index