From 3ea1c62cbae2fa89cd49a47879bd63bcfdf3fb9b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 30 Mar 2020 17:37:01 -0700 Subject: [WebAssembly] Emit .llvmcmd and .llvmbc as custom sections Fixes: https://bugs.llvm.org/show_bug.cgi?id=45362 Differential Revision: https://reviews.llvm.org/D77115 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 17946696a26f..e7750ccf3ad8 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1755,6 +1755,14 @@ MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal( StringRef Name = GO->getSection(); + // Certain data sections we treat as named custom sections rather than + // segments within the data section. + // This could be avoided if all data segements (the wasm sense) were + // represented as thier own sections (in the llvm sense). + // TODO(sbc): https://github.com/WebAssembly/tool-conventions/issues/138 + if (Name == ".llvmcmd" || Name == ".llvmbc") + Kind = SectionKind::getMetadata(); + StringRef Group = ""; if (const Comdat *C = getWasmComdat(GO)) { Group = C->getName(); -- cgit v1.2.3