git: c8105d1652b2 - stable/12 - clang: Build with -fno-strict-aliasing when using GCC
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Dec 2021 11:55:47 UTC
The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c8105d1652b2def0ec05f96d39c5e3a4a6c56992 commit c8105d1652b2def0ec05f96d39c5e3a4a6c56992 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2021-08-24 13:59:36 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-12-25 11:51:19 +0000 clang: Build with -fno-strict-aliasing when using GCC Somewhat ironically, there are strict aliasing violations in Clang, which can result in the following assertion failure: Assertion `*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"' failed. Upstream's clang/CMakeLists.txt specifically (not LLVM as a whole) passes -fno-strict-aliasing if the compiler is not Clang, and this fixes the above issue. This was seen when cross-building from Linux using a bootstrap compiler, but likely also affects worlds built with a new enough external GCC toolchain. MFC after: 1 week Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D31533 (cherry picked from commit c1f7d8dd23db693106fcd66e0b1766a3f3194670) --- lib/clang/clang.build.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index 0d3151178eb9..fb64b16935f2 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -13,4 +13,6 @@ CFLAGS+= -DCLANG_ENABLE_ARCMT CFLAGS+= -DCLANG_ENABLE_STATIC_ANALYZER .endif +CFLAGS.gcc+= -fno-strict-aliasing + .include "llvm.build.mk"