[all-commits] [llvm/llvm-project] 3b8d2b: Reland: "[lld][WebAssembly] Initial support mergin...

Sam Clegg via All-commits all-commits at lists.llvm.org
Mon May 10 16:06:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b8d2be527259b303d6c3428df16fb3fd02af2bc
      https://github.com/llvm/llvm-project/commit/3b8d2be527259b303d6c3428df16fb3fd02af2bc
  Author: Sam Clegg <sbc at chromium.org>
  Date:   2021-05-10 (Mon, 10 May 2021)

  Changed paths:
    A lld/test/wasm/merge-string.s
    M lld/wasm/CMakeLists.txt
    M lld/wasm/Driver.cpp
    M lld/wasm/InputChunks.cpp
    M lld/wasm/InputChunks.h
    M lld/wasm/InputFiles.cpp
    A lld/wasm/OutputSegment.cpp
    M lld/wasm/OutputSegment.h
    M lld/wasm/Symbols.cpp
    M lld/wasm/SyntheticSections.cpp
    M lld/wasm/Writer.cpp
    M llvm/include/llvm/BinaryFormat/Wasm.h
    M llvm/include/llvm/MC/MCContext.h
    M llvm/include/llvm/MC/MCSectionWasm.h
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/lib/MC/MCContext.cpp
    M llvm/lib/MC/MCObjectFileInfo.cpp
    M llvm/lib/MC/MCParser/WasmAsmParser.cpp
    M llvm/lib/MC/MCSectionWasm.cpp
    M llvm/lib/MC/WasmObjectWriter.cpp
    M llvm/lib/Object/WasmObjectFile.cpp
    M llvm/lib/ObjectYAML/WasmYAML.cpp
    M llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
    A llvm/test/MC/WebAssembly/section-flags-changed.s
    M llvm/test/MC/WebAssembly/unnamed-data.ll
    M llvm/tools/obj2yaml/wasm2yaml.cpp

  Log Message:
  -----------
  Reland: "[lld][WebAssembly] Initial support merging string data"

This change was originally landed in: 5000a1b4b9edeb9e994f2a5b36da8d48599bea49
It was reverted in: 061e071d8c9b98526f35cad55a918a4f1615afd4

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)

Differential Revision: https://reviews.llvm.org/D97657




More information about the All-commits mailing list