This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Fix instrumentation problem with floating point
ClosedPublic

Authored by maksfb on Jun 30 2022, 6:57 PM.

Details

Summary

If BOLT instrumentation runtime uses XMM registers, it can interfere
with the user program causing crashes and unexpected behavior. This
happens as the instrumentation code preserves general purpose registers
only.

Build BOLT instrumentation runtime with "-mno-sse".

Diff Detail

Event Timeline

maksfb created this revision.Jun 30 2022, 6:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 6:57 PM
Herald added a subscriber: mgorny. · View Herald Transcript
maksfb requested review of this revision.Jun 30 2022, 6:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 6:57 PM
Amir accepted this revision.Jul 1 2022, 2:01 PM

LGTM

This revision is now accepted and ready to land.Jul 1 2022, 2:01 PM
This revision was landed with ongoing or failed builds.Jul 1 2022, 3:29 PM
This revision was automatically updated to reflect the committed changes.
maksfb added a comment.Jul 5 2022, 5:18 PM

This change broke user-func-reorder.c test on some platforms. -mno-sse forced some compilers to emit a call to memset() that was not provided by our runtime. According to documentation, freestanding environment should still provide memcpy, memmove,
memset and memcmp, so in the worst case we can expect the compiler to emit calls to those.