[all-commits] [llvm/llvm-project] 556af1: [llvm-objcopy] Use getNumberOfSymbols() instead of...

Daan De Meyer via All-commits all-commits at lists.llvm.org
Mon Jan 2 04:29:28 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 556af193309f6e283712602b9a8ca5d19adb1792
      https://github.com/llvm/llvm-project/commit/556af193309f6e283712602b9a8ca5d19adb1792
  Author: Daan De Meyer <daan.j.demeyer at gmail.com>
  Date:   2023-01-02 (Mon, 02 Jan 2023)

  Changed paths:
    M llvm/lib/ObjCopy/COFF/COFFReader.cpp
    A llvm/test/tools/llvm-objcopy/COFF/Inputs/no-symbol-table.yaml
    A llvm/test/tools/llvm-objcopy/COFF/no-symbol-table.test

  Log Message:
  -----------
  [llvm-objcopy] Use getNumberOfSymbols() instead of getRawNumberOfSymbols()

getRawNumberOfSymbols() assumes that a symbol table exists, which isn't
always guaranteed, while getNumberOfSymbols() handles and tolerates objects
without a symbol table. When there is a symbol table, both methods return
the same value.

Also add a test to ensure we don't regress in this regard. The test
generates a basic COFF object with symbols and overrides the symbol table
pointer with zeros to craft the input required to verify llvm-objcopy works
as expected in this scenario.




More information about the All-commits mailing list