Module Name:    src
Committed By:   rin
Date:           Sat Nov 30 22:50:11 UTC 2019

Modified Files:
        src/external/gpl3/binutils/dist/bfd: elf.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/binutils/dist/bfd/elf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elf.c
diff -u src/external/gpl3/binutils/dist/bfd/elf.c:1.13 src/external/gpl3/binutils/dist/bfd/elf.c:1.14
--- src/external/gpl3/binutils/dist/bfd/elf.c:1.13	Wed Nov  7 01:13:52 2018
+++ src/external/gpl3/binutils/dist/bfd/elf.c	Sat Nov 30 22:50:11 2019
@@ -298,7 +298,8 @@ bfd_elf_get_str_section (bfd *abfd, unsi
       /* 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;

Reply via email to