[all-commits] [llvm/llvm-project] ad1f54: [WebAssembly] Generate R_WASM_FUNCTION_OFFSET relo...

Derek Schuff via All-commits all-commits at lists.llvm.org
Mon Jul 19 14:06:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad1f5457d2d89efa49a722404a5f0b744b7a64d1
      https://github.com/llvm/llvm-project/commit/ad1f5457d2d89efa49a722404a5f0b744b7a64d1
  Author: Derek Schuff <dschuff at chromium.org>
  Date:   2021-07-19 (Mon, 19 Jul 2021)

  Changed paths:
    R lld/test/wasm/debuginfo-relocs.s
    M lld/test/wasm/map-file.s
    M llvm/include/llvm/MC/MCWasmObjectWriter.h
    M llvm/lib/MC/WasmObjectWriter.cpp
    M llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
    A llvm/test/MC/WebAssembly/debug-template-param.ll
    A llvm/test/MC/WebAssembly/debuginfo-relocs.s

  Log Message:
  -----------
  [WebAssembly] Generate R_WASM_FUNCTION_OFFSET relocs in debuginfo sections

Debug info sections need R_WASM_FUNCTION_OFFSET_I32 relocs (with FK_Data_4 fixup
kinds) to refer to functions (instead of R_WASM_TABLE_INDEX as is used in data
sections). Usually this is done in a convoluted way, with unnamed temp data
symbols which target the start of the function, in which case
WasmObjectWriter::recordRelocation converts it to use the section symbol
instead. However in some cases the function can actually be undefined; in this
case the dwarf generator uses the function symbol (a named undefined function
symbol) instead. In that case the section-symbol transform doesn't work and we
need to generate the correct reloc type a different way. In this change
WebAssemblyWasmObjectWriter::getRelocType takes the fixup section type into
account to choose the correct reloc type.

Fixes PR50408
Differential Revision: https://reviews.llvm.org/D103557




More information about the All-commits mailing list