This is an archive of the discontinued LLVM Phabricator instance.

[RuntimeDyld] fix too-small-bitmask error
ClosedPublic

Authored by nickdesaulniers on May 21 2019, 6:35 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2019, 6:35 PM
MaskRay added inline comments.
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
839 ↗(On Diff #200624)

How about DataSize &= -(uint64_t)getStubAlignment(); ?

nickdesaulniers marked an inline comment as done.May 31 2019, 9:28 PM
MaskRay accepted this revision.May 31 2019, 9:30 PM
This revision is now accepted and ready to land.May 31 2019, 9:30 PM
This revision was automatically updated to reflect the committed changes.