Support padding unaligned data in .text.

llvm-svn: 218870
This commit is contained in:
Joerg Sonnenberger 2014-10-02 13:41:42 +00:00
parent 205f8fd1ec
commit f148a6d498
2 changed files with 10 additions and 1 deletions

View File

@ -367,7 +367,12 @@ bool MipsAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
// Check for a less than instruction size number of bytes
// FIXME: 16 bit instructions are not handled yet here.
// We shouldn't be using a hard coded number for instruction size.
if (Count % 4) return false;
// If the count is not 4-byte aligned, we must be writing data into the text
// section (otherwise we have unaligned instructions, and thus have far
// bigger problems), so just write zeros instead.
for (uint64_t i = 0, e = Count % 4; i != e; ++i)
OW->Write8(0);
uint64_t NumNops = Count / 4;
for (uint64_t i = 0; i != NumNops; ++i)

View File

@ -0,0 +1,4 @@
# RUN: llvm-mc -filetype=obj -triple=mipsel %s -o %t
.byte 1
.p2align 2
foo: