mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
llvm-svn: 95135
This commit is contained in:
parent
ec61994b1d
commit
eb0b81040a
@ -348,7 +348,11 @@ private:
|
|||||||
|
|
||||||
/// Fixups - The list of fixups in this section.
|
/// Fixups - The list of fixups in this section.
|
||||||
std::vector<Fixup> Fixups;
|
std::vector<Fixup> Fixups;
|
||||||
|
|
||||||
|
/// HasInstructions - Whether this section has had instructions emitted into
|
||||||
|
/// it.
|
||||||
|
unsigned HasInstructions : 1;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -429,6 +433,9 @@ public:
|
|||||||
}
|
}
|
||||||
void setFileSize(uint64_t Value) { FileSize = Value; }
|
void setFileSize(uint64_t Value) { FileSize = Value; }
|
||||||
|
|
||||||
|
bool hasInstructions() const { return HasInstructions; }
|
||||||
|
void setHasInstructions(bool Value) { HasInstructions = Value; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -266,11 +266,15 @@ public:
|
|||||||
Write32(SD.getSize()); // size
|
Write32(SD.getSize()); // size
|
||||||
Write32(FileOffset);
|
Write32(FileOffset);
|
||||||
|
|
||||||
|
unsigned Flags = Section.getTypeAndAttributes();
|
||||||
|
if (SD.hasInstructions())
|
||||||
|
Flags |= MCSectionMachO::S_ATTR_SOME_INSTRUCTIONS;
|
||||||
|
|
||||||
assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!");
|
assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!");
|
||||||
Write32(Log2_32(SD.getAlignment()));
|
Write32(Log2_32(SD.getAlignment()));
|
||||||
Write32(NumRelocations ? RelocationsStart : 0);
|
Write32(NumRelocations ? RelocationsStart : 0);
|
||||||
Write32(NumRelocations);
|
Write32(NumRelocations);
|
||||||
Write32(Section.getTypeAndAttributes());
|
Write32(Flags);
|
||||||
Write32(0); // reserved1
|
Write32(0); // reserved1
|
||||||
Write32(Section.getStubSize()); // reserved2
|
Write32(Section.getStubSize()); // reserved2
|
||||||
|
|
||||||
@ -901,7 +905,8 @@ MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
|
|||||||
Address(~UINT64_C(0)),
|
Address(~UINT64_C(0)),
|
||||||
Size(~UINT64_C(0)),
|
Size(~UINT64_C(0)),
|
||||||
FileSize(~UINT64_C(0)),
|
FileSize(~UINT64_C(0)),
|
||||||
LastFixupLookup(~0)
|
LastFixupLookup(~0),
|
||||||
|
HasInstructions(false)
|
||||||
{
|
{
|
||||||
if (A)
|
if (A)
|
||||||
A->getSectionList().push_back(this);
|
A->getSectionList().push_back(this);
|
||||||
|
@ -362,8 +362,8 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
|
|||||||
if (!Emitter)
|
if (!Emitter)
|
||||||
llvm_unreachable("no code emitter available!");
|
llvm_unreachable("no code emitter available!");
|
||||||
|
|
||||||
// FIXME: Emitting an instruction should cause S_ATTR_SOME_INSTRUCTIONS to
|
CurSectionData->setHasInstructions(true);
|
||||||
// be set for the current section.
|
|
||||||
// FIXME: Relocations!
|
// FIXME: Relocations!
|
||||||
SmallString<256> Code;
|
SmallString<256> Code;
|
||||||
raw_svector_ostream VecOS(Code);
|
raw_svector_ostream VecOS(Code);
|
||||||
|
14
test/MC/MachO/section-flags.s
Normal file
14
test/MC/MachO/section-flags.s
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
|
||||||
|
//
|
||||||
|
// CHECK: # Section 0
|
||||||
|
// CHECK: 'section_name', '__text
|
||||||
|
// CHECK: 'flags', 0x80000000
|
||||||
|
// CHECK: # Section 1
|
||||||
|
// CHECK: 'section_name', '__data
|
||||||
|
// CHECK: 'flags', 0x400
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
.data
|
||||||
|
f0:
|
||||||
|
movl $0, %eax
|
Loading…
Reference in New Issue
Block a user