[all-commits] [llvm/llvm-project] 1b2106: [WebAssembly][Objcopy] Write output section header...

Derek Schuff via All-commits all-commits at lists.llvm.org
Thu Jul 27 15:44:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b21067cf247c62c2442daa7ee2d3915249d1ee2
      https://github.com/llvm/llvm-project/commit/1b21067cf247c62c2442daa7ee2d3915249d1ee2
  Author: Derek Schuff <dschuff at chromium.org>
  Date:   2023-07-27 (Thu, 27 Jul 2023)

  Changed paths:
    M llvm/include/llvm/Object/Wasm.h
    M llvm/include/llvm/ObjectYAML/WasmYAML.h
    M llvm/lib/ObjCopy/wasm/WasmObject.h
    M llvm/lib/ObjCopy/wasm/WasmReader.cpp
    M llvm/lib/ObjCopy/wasm/WasmWriter.cpp
    M llvm/lib/Object/WasmObjectFile.cpp
    M llvm/lib/ObjectYAML/WasmEmitter.cpp
    M llvm/lib/ObjectYAML/WasmYAML.cpp
    A llvm/test/ObjectYAML/wasm/section_header_size.yaml
    A llvm/test/tools/llvm-objcopy/wasm/section-header-size.test
    M llvm/tools/obj2yaml/wasm2yaml.cpp

  Log Message:
  -----------
  [WebAssembly][Objcopy] Write output section headers identically to inputs

Previously when objcopy generated section headers, it padded the LEB
that encodes the section size out to 5 bytes, matching the behavior of
clang. This is correct, but results in a binary that differs from the
input. This can sometimes have undesirable consequences (e.g. breaking
source maps).

This change makes the object reader remember the size of the LEB
encoding in the section header, so that llvm-objcopy can reproduce it
exactly. For sections not read from an object file (e.g. that
llvm-objcopy is adding itself), pad to 5 bytes.

Reviewed By: jhenderson

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




More information about the All-commits mailing list