[PATCH] D74531: [WebAssembly] Emit PCH __clang_ast in custom section

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 09:10:51 PST 2020


sbc100 added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1701
+  if (Name == "__clangast")
+    return SectionKind::getMetadata();
+
----------------
Hmm.. it looks like this function isn't actually needed: https://reviews.llvm.org/D74565.

Does this change work if you simply `return K` here?   I guess/hope it does.


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:383
+    uint64_t RoundedUpLength = (MinLength + 3ULL) & ~3ULL;
+    encodeULEB128(Name.size(), W.OS, 5 + (RoundedUpLength - MinLength));
+    W.OS << Name;
----------------
I general this seems like trick that could work.   However, I think this value is encoded as an LEB32 which means its max length is technically 5.  I don't think a 6 byte LEB is valid .


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:1113
+  if (Sym.getName() == "__clang_ast")
+    return false;
+
----------------
Why this part needed ?  What happens if you don't specify this?  I looks like removes section symbol from the symtab?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74531/new/

https://reviews.llvm.org/D74531





More information about the llvm-commits mailing list