[PATCH] D97657: [lld][WebAssembly] Initial support merging string data

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 28 22:03:17 PST 2021


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, sunfish, hiraditya, jgravelle-google, mgorny, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

This change adds support for a new WASM_SEG_FLAG_STRINGS flag in
the object format which works in a similar fashion to SHF_STRINGS
in the ELF world.

Unlike the ELF linker this support is currently limited:

- No support for SHF_MERGE (non-string merging)
- Always do full tail merging ("lo" can be merged with "hello")
- Only support single byte strings (p2align 0)

Like the ELF linker merging is only performed at `-O1` and above.

This fixes part of https://bugs.llvm.org/show_bug.cgi?id=48828,
although crucially it doesn't not currently support debug sections
because they are not represented by data segments (they are custom
sections)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97657

Files:
  lld/test/wasm/merge-string.s
  lld/wasm/CMakeLists.txt
  lld/wasm/Driver.cpp
  lld/wasm/InputChunks.cpp
  lld/wasm/InputChunks.h
  lld/wasm/InputFiles.cpp
  lld/wasm/OutputSegment.cpp
  lld/wasm/OutputSegment.h
  lld/wasm/Symbols.cpp
  lld/wasm/SyntheticSections.cpp
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCSectionWasm.h
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/MC/MCSectionWasm.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/tools/obj2yaml/wasm2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97657.327026.patch
Type: text/x-patch
Size: 46445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210301/d1c60023/attachment.bin>


More information about the llvm-commits mailing list