[all-commits] [llvm/llvm-project] 5a4390: [llvm-objdump] Exclude __mh_*_header symbols durin...

Greg McGary via All-commits all-commits at lists.llvm.org
Wed May 12 06:39:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a439015393e616b2faed9a9fbb1d7036b28e786
      https://github.com/llvm/llvm-project/commit/5a439015393e616b2faed9a9fbb1d7036b28e786
  Author: Greg McGary <gkm at fb.com>
  Date:   2021-05-12 (Wed, 12 May 2021)

  Changed paths:
    A llvm/test/tools/llvm-objdump/MachO/no-text-symbols-disassembly.test
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [llvm-objdump] Exclude __mh_*_header symbols during MachO disassembly

`__mh_(execute|dylib|dylinker|bundle|preload|object)_header` are special symbols whose values hold the VMA of the Mach header to support introspection. They are attached to the first section in `__TEXT`, even though their addresses are outside `__TEXT`, and they do not refer to code.

It is normally harmless, but when the first section of `__TEXT` has no other symbols, `__mh_*_header` is considered by the disassembler when determing function boundaries. Since `__mh_*_header` refers to an address outside `__TEXT`, the boundary determination fails and disassembly quits.

Since `__TEXT,__text` normally has symbols, this bug is obscured. Experiments placing `__stubs` and `__stub_helper` first exposed the bug, since neither has symbols.

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




More information about the All-commits mailing list