[PATCH] D99972: [lld-macho] Fix & refactor symbol size calculations

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 10:22:04 PDT 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a subscriber: mgrang.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I noticed two problems with the previous implementation:

- N_ALT_ENTRY symbols weren't being handled correctly -- they should determine the size of the previous symbol, even though they don't cause a new section to be created
- The last symbol in a section had its size calculated wrongly; the first subsection's size was used instead of the last one

I decided to take the opportunity to refactor things as well, mainly to
realize my observation
here <https://reviews.llvm.org/D98837#inline-931511> that we could
avoid doing a binary search to match symbols with subsections. I think
the resulting code is a bit simpler too.

      N           Min           Max        Median           Avg        Stddev
  x  20          4.31          4.43          4.37        4.3775   0.034162922
  +  20          4.32          4.43          4.38        4.3755    0.02799906
  No difference proven at 95.0% confidence


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99972

Files:
  lld/MachO/Driver.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/SymbolTable.cpp
  lld/MachO/Symbols.h
  lld/test/MachO/stabs.s
  lld/test/MachO/symtab.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99972.335577.patch
Type: text/x-patch
Size: 16098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/307f7551/attachment.bin>


More information about the llvm-commits mailing list