Skip to content

Commit ac0b48a

Browse files
committed
Revert "MCAssembler::layout: remove the unused MCAsmLayout parameter"
This reverts commit 63ec52f.
1 parent 46f7929 commit ac0b48a

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
2121
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
2222
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
23+
#include "llvm/MC/MCAsmLayout.h"
2324
#include "llvm/MC/MCAssembler.h"
2425
#include "llvm/MC/MCContext.h"
2526
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -2415,7 +2416,8 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
24152416

24162417
MCAssembler &Assembler =
24172418
static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler();
2418-
Assembler.layout();
2419+
MCAsmLayout Layout(Assembler);
2420+
Assembler.layout(Layout);
24192421

24202422
// Obtain fragment sizes.
24212423
std::vector<uint64_t> FragmentSizes;

llvm/include/llvm/MC/MCAssembler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class MCRelaxableFragment;
4646
class MCSymbolRefExpr;
4747
class raw_ostream;
4848
class MCAsmBackend;
49+
class MCAsmLayout;
4950
class MCContext;
5051
class MCCodeEmitter;
5152
class MCFragment;
@@ -340,7 +341,7 @@ class MCAssembler {
340341
void Finish();
341342

342343
// Layout all section and prepare them for emission.
343-
void layout();
344+
void layout(MCAsmLayout &Layout);
344345

345346
// FIXME: This does not belong here.
346347
bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }

llvm/lib/MC/MCAssembler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/ADT/Twine.h"
1616
#include "llvm/MC/MCAsmBackend.h"
1717
#include "llvm/MC/MCAsmInfo.h"
18+
#include "llvm/MC/MCAsmLayout.h"
1819
#include "llvm/MC/MCCodeEmitter.h"
1920
#include "llvm/MC/MCCodeView.h"
2021
#include "llvm/MC/MCContext.h"
@@ -936,7 +937,7 @@ MCAssembler::handleFixup(MCFragment &F, const MCFixup &Fixup,
936937
return std::make_tuple(Target, FixedValue, IsResolved);
937938
}
938939

939-
void MCAssembler::layout() {
940+
void MCAssembler::layout(MCAsmLayout &Layout) {
940941
assert(getBackendPtr() && "Expected assembler backend");
941942
DEBUG_WITH_TYPE("mc-dump", {
942943
errs() << "assembler backend - pre-layout\n--\n";
@@ -1073,7 +1074,9 @@ void MCAssembler::layout() {
10731074
}
10741075

10751076
void MCAssembler::Finish() {
1076-
layout();
1077+
// Create the layout object.
1078+
MCAsmLayout Layout(*this);
1079+
layout(Layout);
10771080

10781081
// Write the object file.
10791082
stats::ObjectBytes += getWriter().writeObject(*this);

llvm/lib/MC/MCExpr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "llvm/Config/llvm-config.h"
1313
#include "llvm/MC/MCAsmBackend.h"
1414
#include "llvm/MC/MCAsmInfo.h"
15+
#include "llvm/MC/MCAsmLayout.h"
1516
#include "llvm/MC/MCAssembler.h"
1617
#include "llvm/MC/MCContext.h"
1718
#include "llvm/MC/MCObjectWriter.h"

llvm/tools/dsymutil/MachOUtils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "LinkUtils.h"
1313
#include "llvm/ADT/SmallString.h"
1414
#include "llvm/CodeGen/NonRelocatableStringpool.h"
15+
#include "llvm/MC/MCAsmLayout.h"
1516
#include "llvm/MC/MCAssembler.h"
1617
#include "llvm/MC/MCMachObjectWriter.h"
1718
#include "llvm/MC/MCObjectStreamer.h"
@@ -380,7 +381,8 @@ bool generateDsymCompanion(
380381
auto &Writer = static_cast<MachObjectWriter &>(MCAsm.getWriter());
381382

382383
// Layout but don't emit.
383-
MCAsm.layout();
384+
MCAsmLayout Layout(MCAsm);
385+
MCAsm.layout(Layout);
384386

385387
BinaryHolder InputBinaryHolder(VFS, false);
386388

0 commit comments

Comments
 (0)