diff options
author | Philipp Krones <philipp.krones@embecosm.com> | 2021-05-23 14:15:23 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-05-23 14:15:23 -0700 |
commit | c2f819af73c54a8cf923e5a25099ca95dbe76312 (patch) | |
tree | 97a4ff834d4680ecbbd3f7c1fde1c749d2398f26 /llvm/lib/Object/ModuleSymbolTable.cpp | |
parent | cb1511645170ec23036631790398d8143a832265 (diff) | |
download | llvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.zip llvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.tar.gz llvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.tar.bz2 |
[MC] Refactor MCObjectFileInfo initialization and allow targets to create MCObjectFileInfo
This makes it possible for targets to define their own MCObjectFileInfo.
This MCObjectFileInfo is then used to determine things like section alignment.
This is a follow up to D101462 and prepares for the RISCV backend defining the
text section alignment depending on the enabled extensions.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101921
Diffstat (limited to 'llvm/lib/Object/ModuleSymbolTable.cpp')
-rw-r--r-- | llvm/lib/Object/ModuleSymbolTable.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Object/ModuleSymbolTable.cpp b/llvm/lib/Object/ModuleSymbolTable.cpp index a00fea3..9cdc281 100644 --- a/llvm/lib/Object/ModuleSymbolTable.cpp +++ b/llvm/lib/Object/ModuleSymbolTable.cpp @@ -99,10 +99,11 @@ initializeRecordStreamer(const Module &M, if (!MCII) return; - MCObjectFileInfo MOFI; - MCContext MCCtx(TT, MAI.get(), MRI.get(), &MOFI, STI.get()); - MOFI.initMCObjectFileInfo(MCCtx, /*PIC=*/false); - MOFI.setSDKVersion(M.getSDKVersion()); + MCContext MCCtx(TT, MAI.get(), MRI.get(), STI.get()); + std::unique_ptr<MCObjectFileInfo> MOFI( + T->createMCObjectFileInfo(MCCtx, /*PIC=*/false)); + MOFI->setSDKVersion(M.getSDKVersion()); + MCCtx.setObjectFileInfo(MOFI.get()); RecordStreamer Streamer(MCCtx, M); T->createNullTargetStreamer(Streamer); |