Page MenuHomePhabricator

[MC] Support symbolic expressions in assembly directives

Authored by phosek on May 27 2016, 2:33 PM.



This matches the behavior of GNU assembler which supports symbolic
expressions in absolute expressions used in assembly directives.

Diff Detail


Event Timeline

phosek updated this revision to Diff 58840.May 27 2016, 2:33 PM
phosek retitled this revision from to [MC] Support symbolic expressions in assembly directives.
phosek updated this object.
phosek added a reviewer: rafael.
phosek set the repository for this revision to rL LLVM.
phosek added subscribers: rafael, phosek, llvm-commits.

This is a reland of D20656, I believe the test failure was caused by the truncateToSize invocation at MCAsmStreamer.cpp:844. The second argument is number of bytes and not number of bits to truncate to, so the original version which contained truncateToSize(Expr, 32) was obviously wrong.

Unfortunately, I haven't managed to replicate the test failure on my machines (both x86-64 Linux and OS X)—even the original version passed check-all locally but failed on bots—so I don't know if this was the only issue but I haven't spotted anything obviously wrong after going through the entire patch.

rafael edited edge metadata.May 27 2016, 2:59 PM

Have you tried building with asan/ubsan?


phosek updated this revision to Diff 58863.May 27 2016, 4:31 PM
phosek edited edge metadata.

I've managed to replicate the failure in Release+Asserts build (I was using Debug previously) and I've fixed one other issue in the test, now all the tests should be passing (hopefully everywhere).

Cool, go for it.

Unless there is a substantial change in the patch I don't think you
need a second review.


This revision was automatically updated to reflect the committed changes.
filcab added a subscriber: filcab.Jun 6 2016, 5:40 AM

Just noticed with gcc: Please add the missing emitFill overload to MCObjectStreamer too:
virtual void emitFill(uint64_t NumValues, int64_t Size, int64_t Expr);