Hi,

LLVM 6.0.0 does now complain of code does computation on NULL pointers,
which apparently binutils makes use of.  I think we can teach binutils
to stop doing that.

Is my C foo correct?  Feedback?

Patrick

diff --git a/gnu/usr.bin/binutils-2.17/bfd/elflink.c 
b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
index a6d17dcb4d9..aa010f9d0b2 100644
--- a/gnu/usr.bin/binutils-2.17/bfd/elflink.c
+++ b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
@@ -4517,7 +4517,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abfd,
   len = strlen (name);
   copy = bfd_alloc (abfd, len);
   if (copy == NULL)
-    return (struct elf_link_hash_entry *) 0 - 1;
+    return (struct elf_link_hash_entry *)-1;
 
   first = p - name + 1;
   memcpy (copy, name, first);
@@ -4629,7 +4629,7 @@ elf_link_add_archive_symbols (bfd *abfd, struct 
bfd_link_info *info)
            }
 
          h = archive_symbol_lookup (abfd, info, symdef->name);
-         if (h == (struct elf_link_hash_entry *) 0 - 1)
+         if (h == (struct elf_link_hash_entry *)-1)
            goto error_return;
 
          if (h == NULL)
diff --git a/gnu/usr.bin/binutils-2.17/include/obstack.h 
b/gnu/usr.bin/binutils-2.17/include/obstack.h
index 88c2a264adc..8839c48e95f 100644
--- a/gnu/usr.bin/binutils-2.17/include/obstack.h
+++ b/gnu/usr.bin/binutils-2.17/include/obstack.h
@@ -123,7 +123,7 @@ extern "C" {
 #endif
 
 #ifndef __INT_TO_PTR
-# define __INT_TO_PTR(P) ((P) + (char *) 0)
+# define __INT_TO_PTR(P) ((char *)(P))
 #endif
 
 /* We need the type of the resulting object.  If __PTRDIFF_TYPE__ is

Reply via email to