summaryrefslogtreecommitdiff
path: root/llvm/lib/Object/SymbolSize.cpp
AgeCommit message (Collapse)Author
2024-02-22[Symbolizer][WebAssembly] Use wasm-specific getSymbolSize (#82083)Derek Schuff
getSymbolSize was recently added to WasmObjectFile and has correct sizes for most symbol types. This makes llvm-symbolizer correctly symbolize addresses in the middle of the symbol. When reworking the test I also noticed that the DWARF info seems to be wrong for the first instruction in each function. I noted that in the test comments but didn't attempt to fix here.
2023-10-18nfc, address post commit comments related to code format for 581c64aChen Zheng
2023-10-12[XCOFF][OBJECT] get symbol size by calling XCOFF interfaces (#67304)Chen Zheng
Computing the symbol size as the gap between sorted symbols are not right for XCOFF. For XCOFF, the size info is stored in aux symbol and can be got from existing XCOFF interface `getSymbolSize()`. This patch changes XCOFFObjectFile to call this API to get sizes for symbols.
2023-07-31[Object] Fix grammar mistake in the commentSteven Wu
Update comment in previous commit from D156603.
2023-07-30[SymbolSize] Improve the performance of SymbolSize computationSteven Wu
The current algorithm to compute the symbol size is quadratic if there are lots of symbols sharing the same addresses. This happens in a debug build when lots of debug symbols get emitted in the symtab. This patch improves the performance like `llvm-symbolizer` that relies on the symbol size computation. Symbolizing a release+assert clang with DebugInfo sees significant improvements from 3:40min to less than 1s. Reviewed By: pete, mehdi_amini, arsenm, MaskRay Differential Revision: https://reviews.llvm.org/D156603
2021-06-10[llvm-objdump][XCOFF] Enable the -l (--line-numbers) option.Esme-Yi
Summary: Add support for dumping line number information for XCOFF object files in llvm-objdump. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D101272
2021-01-16[llvm] Use *::empty (NFC)Kazu Hirata
2020-05-02[Object] Change ObjectFile::getSymbolValue() return type to Expected<uint64_t>Xing GUO
Summary: In D77860, we have changed `getSymbolFlags()` return type to `Expected<uint32_t>`. This change helps bubble the error further up the stack. Reviewers: jhenderson, grimar, JDevlieghere, MaskRay Reviewed By: jhenderson Subscribers: hiraditya, MaskRay, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79075
2020-01-28[NFC] Fix unused variable warning.Nate Voorhies
Reviewers: dschuff Reviewed By: dschuff Subscribers: hiraditya, aheejin, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73591
2020-01-28[WebAssembly] Add WebAssembly support to llvm-symbolizerDerek Schuff
The only thing missing for basic llvm-symbolizer support is the ability on lib/Object to get a wasm symbol's section ID, which allows sorting and computation of the symbols' sizes. Also, when the WasmAsmParser switches sections on new functions, also add the section to the list of Dwarf sections if Dwarf is being generated for assembly; this allows writing of simple tests. Reviewers: sbc100, jhenderson, aardappel Differential Revision: https://reviews.llvm.org/D73246
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-04-23Fix computeSymbolSizes SEGFAULT on invalid fileAdrian Prantl
We use llvm-symbolizer in some production systems, and we run it against all possibly related files, including some that are not ELF. We noticed that for some of those invalid files, llvm-symbolizer would crash with SEGFAULT. Here is an example of such a file. It is due to that in computeSymbolSizes, a loop uses condition for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) { where if Addresses.size() is 0, N would overflow and causing the loop to access invalid memory. Instead of patching the loop conditions, the commit makes so that the function returns early if Addresses is empty. Validated by checking that llvm-symbolizer no longer crashes. Patch by Teng Qin! Differential Revision: https://reviews.llvm.org/D44285 llvm-svn: 330610
2016-11-15Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizesKuba Brecka
Sometimes, llvm-symbolizer gives wrong results due to incorrect sizes of some symbols. The reason for that was an incorrectly sorted array in computeSymbolSizes. The comparison function used subtraction of unsigned types, which is incorrect. Let's change this to return explicit -1 or 1. Differential Revision: https://reviews.llvm.org/D26537 llvm-svn: 287028
2015-06-29[SymbolSize] Skip sorting by index, just assign by index.Benjamin Kramer
No functional change intended. llvm-svn: 240961
2015-06-25Add an ELFSymbolRef type.Rafael Espindola
This allows user code to say Sym.getSize() instead of having to manually fetch the object. llvm-svn: 240708
2015-06-25Use computeSymbolSizes in llvm-symbolize.Rafael Espindola
llvm-svn: 240646
2015-06-24Make computeSymbolSizes never fail.Rafael Espindola
On ELF that was already the case since getting the size of a symbol never fails. On MachO and COFF we could fail trying to get the section of a symbol. But we don't really need the section, just the section number to know if two symbols are in the same section or not. llvm-svn: 240580
2015-06-24Use Symbol::getValue to simplify object::computeSymbolSizes. NFC.Rafael Espindola
llvm-svn: 240575
2015-06-24Change how symbol sizes are handled in lib/Object.Rafael Espindola
COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
2015-06-23Handle multiple symbols having the same address.Rafael Espindola
I will add an explicit test in a second, but this fixes the bots. llvm-svn: 240372
2015-06-23Extract an utility for computing symbol sizes on MachO and COFF.Rafael Espindola
I will add a second user in the next commit. llvm-svn: 240366