mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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:
parent
1af4bec1e2
commit
92583e0712
@ -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)
|
||||
|
4
test/MC/Mips/unaligned-nops.s
Normal file
4
test/MC/Mips/unaligned-nops.s
Normal file
@ -0,0 +1,4 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=mipsel %s -o %t
|
||||
.byte 1
|
||||
.p2align 2
|
||||
foo:
|
Loading…
Reference in New Issue
Block a user