mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 23:19:03 +00:00
on darwin empty functions need to codegen into something of non-zero length,
otherwise labels get incorrectly merged. We handled this by emitting a ".byte 0", but this isn't correct on thumb/arm targets where the text segment needs to be a multiple of 2/4 bytes. Handle this by emitting a noop. This is more gross than it should be because arm/ppc are not fully mc'ized yet. This fixes rdar://7908505 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -585,9 +585,15 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
|
||||
// If the function is empty and the object file uses .subsections_via_symbols,
|
||||
// then we need to emit *something* to the function body to prevent the
|
||||
// labels from collapsing together. Just emit a 0 byte.
|
||||
if (MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode)
|
||||
OutStreamer.EmitIntValue(0, 1, 0/*addrspace*/);
|
||||
// labels from collapsing together. Just emit a noop.
|
||||
if (MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode) {
|
||||
MCInst Noop;
|
||||
TM.getInstrInfo()->getNoopForMachoTarget(Noop);
|
||||
if (Noop.getOpcode())
|
||||
OutStreamer.EmitInstruction(Noop);
|
||||
else // Target not mc-ized yet.
|
||||
OutStreamer.EmitRawText(StringRef("\tnop\n"));
|
||||
}
|
||||
|
||||
// Emit target-specific gunk after the function body.
|
||||
EmitFunctionBodyEnd();
|
||||
|
||||
Reference in New Issue
Block a user