/// if not specified it is automatically created from backend.
void Finish();
+ // Layout all section and prepare them for emission.
+ void layout(MCAsmLayout &Layout);
+
// FIXME: This does not belong here.
bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }
void setSubsectionsViaSymbols(bool Value) { SubsectionsViaSymbols = Value; }
return std::make_pair(FixedValue, IsPCRel);
}
-void MCAssembler::Finish() {
+void MCAssembler::layout(MCAsmLayout &Layout) {
DEBUG_WITH_TYPE("mc-dump", {
llvm::errs() << "assembler backend - pre-layout\n--\n";
dump(); });
- // Create the layout object.
- MCAsmLayout Layout(*this);
-
// Create dummy fragments and assign section ordinals.
unsigned SectionIndex = 0;
for (MCSection &Sec : *this) {
llvm::errs() << "assembler backend - final-layout\n--\n";
dump(); });
- uint64_t StartOffset = OS.tell();
-
// Allow the object writer a chance to perform post-layout binding (for
// example, to set the index fields in the symbol data).
getWriter().executePostLayoutBinding(*this, Layout);
}
}
}
+}
+
+void MCAssembler::Finish() {
+ // Create the layout object.
+ MCAsmLayout Layout(*this);
+ layout(Layout);
+
+ uint64_t StartOffset = OS.tell();
// Write the object file.
getWriter().writeObject(*this, Layout);