From e5876ebb72573a1f77480e2432bab1757d9fb79e Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Sat, 1 Jun 2019 04:51:26 +0000 Subject: [PATCH] [RuntimeDyld] fix too-small-bitmask error Summary: This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No. 33". It seems that this statement is doing the standard bitwise trick for adjusting a value to have a specific alignment. The issue is that getStubAlignment() returns an unsigned, while DataSize is declared a uint64_t. The right hand side of the expression is not extended to 64b before bitwise negation, resulting in the top half of the mask being 0s, which is not correct for realignment. Reviewers: lhames, MaskRay Reviewed By: MaskRay Subscribers: RKSimon, MaskRay, hiraditya, llvm-commits, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D62227 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362286 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index e0642adbd31..e26e6ce45db 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -842,7 +842,7 @@ RuntimeDyldImpl::emitSection(const ObjectFile &Obj, // Align DataSize to stub alignment if we have any stubs (PaddingSize will // have been increased above to account for this). if (StubBufSize > 0) - DataSize &= ~(getStubAlignment() - 1); + DataSize &= -(uint64_t)getStubAlignment(); } LLVM_DEBUG(dbgs() << "emitSection SectionID: " << SectionID << " Name: " -- 2.50.1