[all-commits] [llvm/llvm-project] 9742c2: [BOLT] Fix empty function emission in non-relocati...

maksfb via All-commits all-commits at lists.llvm.org
Fri Sep 16 13:39:00 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9742c25b9894d4805e05369c50cc8e0562a3cb92
      https://github.com/llvm/llvm-project/commit/9742c25b9894d4805e05369c50cc8e0562a3cb92
  Author: Maksim Panchenko <maks at fb.com>
  Date:   2022-09-16 (Fri, 16 Sep 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/lib/Core/BinaryEmitter.cpp
    A bolt/test/X86/nop-function.s

  Log Message:
  -----------
  [BOLT] Fix empty function emission in non-relocation mode

In non-relocation mode, every function is emitted in its own section. If
a function is empty, RuntimeDyld will still allocate 1-byte section
for the function and initialize it with zero. As a result, we will
overwrite the first byte of the original function contents with zero.
Such scenario can happen when the input function had only NOP
instructions which BOLT removes by default. Even though such functions
likely cause undefined behavior, it's better to preserve their contents.

Reviewed By: yota9

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




More information about the All-commits mailing list