Support padding unaligned data in .text.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2014-10-02 13:41:42 +00:00
parent 1af4bec1e2
commit 92583e0712
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: