Stop inventing symbol sizes.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 22 May 2015 15:43:00 +0000 (15:43 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 22 May 2015 15:43:00 +0000 (15:43 +0000)
commit7b677dd9860627d94c38af59776c1fe3494aaf5a
tree5281a62568db74f4f13f45b0c18e5e9e2b95f97d
parent08bac7b901744c044b36ff17b5791a7faacd7586
Stop inventing symbol sizes.

MachO and COFF quite reasonably only define the size for common symbols.

We used to try to figure out the "size" by computing the gap from one symbol to
the next.

This would not be correct in general, since a part of a section can belong to no
visible symbol (padding, private globals).

It was also really expensive, since we would walk every symbol to find the size
of one.

If a caller really wants this, it can sort all the symbols once and get all the
gaps ("size") in O(n log n) instead of O(n^2).

On MachO this also has the advantage of centralizing all the checks for an
invalid n_sect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238028 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Object/COFFObjectFile.cpp
lib/Object/MachOObjectFile.cpp
test/Object/Inputs/macho-invalid-getsection-index [deleted file]
test/Object/Inputs/macho64-invalid-getsection-index [deleted file]
test/Object/macho-invalid.test
test/Object/objdump-symbol-table.test
test/tools/llvm-objdump/X86/macho-symbol-table.test