[all-commits] [llvm/llvm-project] 73332d: [lld][WebAssembly] Do not merge comdat data segments

Sam Clegg via All-commits all-commits at lists.llvm.org
Mon May 3 16:44:00 PDT 2021


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

  Changed paths:
    A lld/test/wasm/Inputs/comdat-data.s
    A lld/test/wasm/relocatable-comdat.s
    M lld/wasm/Writer.cpp
    M llvm/lib/Object/WasmObjectFile.cpp

  Log Message:
  -----------
  [lld][WebAssembly] Do not merge comdat data segments

When running in relocatable mode any input data segments that are part
of a comdat group should not be merged with other segments of the same
name.  This is because the final linker needs to keep the separate so
they can be included/excluded individually.

Often this is not a problem since normally only one section with a given
name `foo` ends up in the output object file.  However, the problem
occurs when one input contains `foo` which part of a comdat and another
object contains a local symbol `foo` we were attempting to merge them.

This behaviour matches (I believe) that of the ELF linker.  See
`LinkerScript.cpp:addInputSec`.

Fixes: https://github.com/emscripten-core/emscripten/issues/9726

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




More information about the All-commits mailing list