[all-commits] [llvm/llvm-project] 5000a1: [lld][WebAssembly] Initial support merging string ...

Sam Clegg via All-commits all-commits at lists.llvm.org
Mon May 10 13:15:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5000a1b4b9edeb9e994f2a5b36da8d48599bea49
      https://github.com/llvm/llvm-project/commit/5000a1b4b9edeb9e994f2a5b36da8d48599bea49
  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/tools/obj2yaml/wasm2yaml.cpp

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

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