This is an archive of the discontinued LLVM Phabricator instance.

Support target Assemblers without a zero directive
Needs ReviewPublic

Authored by borisboesler on Dec 1 2021, 6:36 AM.

Details

Summary

MCAsmStreamer fails to emit fill bytes if the target's assembler does not provide a zero directive to fill a number of bytes in memory with a given value. If the directive does not exist an empty MCStreamer::emitFill() is called. A nested code block does emit bytes with a Data8BitsDirective, but is inside a if (const char *ZeroDirective = MAI->getZeroDirective()) block. This should be the fall through case.

Diff Detail

Event Timeline

borisboesler created this revision.Dec 1 2021, 6:36 AM
borisboesler requested review of this revision.Dec 1 2021, 6:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2021, 6:36 AM

Thanks for fixing this. Can you provide a test case for one of the targets which doesn't initialize ZeroDirective?

Thanks for fixing this. Can you provide a test case for one of the targets which doesn't initialize ZeroDirective?

All targets support a ZeroDirective; its initial value is "\t.zero\t" and some targets overwrite it with "\t.space\t"or "\t.skip\t" or ".b8". My out of source target does not support such a directive.

What would the result of the target tests be, if I set ZeroDirective = nullptr; in each target? Do the test expect a .zero or similar?