diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-09 22:05:14 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-09 22:05:14 +0800 |
| commit | 3a57627e59ba18b6f9f9aae7bb60c390c0d3575a (patch) | |
| tree | 736ca062bfffbd68177a512dfe145b06c16d11b1 /backend/lib/AsmPrinter/AsmPrinter.cpp | |
| parent | 379ff50dcc7ccf977379aee68fa9d10f69065d23 (diff) | |
| download | rcc-project-3a57627e59ba18b6f9f9aae7bb60c390c0d3575a.tar.gz rcc-project-3a57627e59ba18b6f9f9aae7bb60c390c0d3575a.tar.xz | |
[MC] Implement RV64GC object emission
Diffstat (limited to 'backend/lib/AsmPrinter/AsmPrinter.cpp')
| -rw-r--r-- | backend/lib/AsmPrinter/AsmPrinter.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/backend/lib/AsmPrinter/AsmPrinter.cpp b/backend/lib/AsmPrinter/AsmPrinter.cpp index cebd6b8..49388e1 100644 --- a/backend/lib/AsmPrinter/AsmPrinter.cpp +++ b/backend/lib/AsmPrinter/AsmPrinter.cpp @@ -318,7 +318,7 @@ Expected<void> AsmPrinter::emitGlobalObjects(const CompilationUnit &Unit) { const GlobalObjectDesc *Object = Unit.globalObjectAt(Index); if (Object == nullptr) return makeUnexpected(ErrorCode::InternalError, "compilation unit contains a null global"); - if (Object->isDeclaration() || Object->Linkage == GlobalLinkage::AvailableExternally) + if (Object->Linkage == GlobalLinkage::AvailableExternally) continue; const mc::MCSymbolRef Symbol = Context->globalSymbol(*Object); @@ -327,14 +327,11 @@ Expected<void> AsmPrinter::emitGlobalObjects(const CompilationUnit &Unit) { auto Attributes = emitGlobalAttributes(*Object, Symbol, *Streamer); if (!Attributes) return std::unexpected(Attributes.error()); + if (Object->isDeclaration()) + continue; if (Object->Linkage == GlobalLinkage::Common) { - auto Name = mc::printMCSymbolName(Symbol->name()); - if (!Name) - return std::unexpected(Name.error()); - auto Common = - Streamer->emitDirective("comm", *Name + "," + std::to_string(Object->Size) + "," + - std::to_string(Object->Align.bytes())); + auto Common = Streamer->emitCommonSymbol(Symbol, Object->Size, Object->Align.bytes()); if (!Common) return std::unexpected(Common.error()); continue; |
