]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r327164:
authordim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 1 Jan 2018 20:39:12 +0000 (20:39 +0000)
committerdim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 1 Jan 2018 20:39:12 +0000 (20:39 +0000)
commit1f1ef460609dd00c21e38bedfa15ae830d5bd8c6
tree1638c79a67b415f5e76be8dfe1efe7eb26a7d2b8
parent168310cbd2125aef7103d2d00e6cc32bdddffc06
MFC r327164:

Fix clang 6.0.0 compiler warnings in binutils

Latest clang git has a warning -Wnull-pointer-arithmetic which will
trigger a -Werror failure. Addition and subtraction from a null pointer
is undefined behaviour and could be optimized into anything.

Furthermore, using the difference between two pointers and casting the
result back to a pointer is not portable since the size of ptrdiff_t
does not necessary have to be the same as size of void* (this happens
e.g. on CHERI). Using intptr_t instead fixes this portability issue and
the compiler warning.

Submitted by; Alexander Richardson
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D12928

git-svn-id: svn://svn.freebsd.org/base/stable/9@327471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
contrib/binutils/bfd/elflink.c
contrib/binutils/include/obstack.h