diff options
| author | Joerg Sonnenberger <joerg@bec.de> | 2014-10-02 13:41:42 +0000 |
|---|---|---|
| committer | Joerg Sonnenberger <joerg@bec.de> | 2014-10-02 13:41:42 +0000 |
| commit | f148a6d498e2636ef82b44e0d0aecd72209aca35 (patch) | |
| tree | 32a443a8e1a83cada08d9147e3b792640a623602 /llvm/lib | |
| parent | 205f8fd1ec9b366069d97bae5a0f86d6058980ec (diff) | |
| download | bcm5719-llvm-f148a6d498e2636ef82b44e0d0aecd72209aca35.tar.gz bcm5719-llvm-f148a6d498e2636ef82b44e0d0aecd72209aca35.zip | |
Support padding unaligned data in .text.
llvm-svn: 218870
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index d8e6128cd54..efeb54d91b8 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp @@ -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) |

