[llvm] [XCOFF] make related SD symbols as isFunction (PR #69553)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 11:33:06 PDT 2023
================
@@ -215,7 +205,38 @@ Error SymbolizableObjectFile::addSymbol(const SymbolRef &Symbol,
if (Obj.isELF() && ELFSymbolRef(Symbol).getBinding() != ELF::STB_LOCAL)
ELFSymIdx = 0;
- Symbols.push_back({SymbolAddress, SymbolSize, SymbolName, ELFSymIdx});
+
+ // If the SymbolAddress exists, use the one with the large Size.
+ // This helps us avoid symbols with no size information (Size = 0).
+ if (!Symbols.count(SymbolAddress) ||
+ (!Obj.isXCOFF() && SymbolSize >= Symbols[SymbolAddress].Size)) {
+ Symbols[SymbolAddress] = {SymbolSize, SymbolName, ELFSymIdx};
+ } else if (Obj.isXCOFF()) {
+ // If the existing entry has no name, it must be a artificial symbol,
+ // replace it.
+ if (Symbols[SymbolAddress].Name.empty()) {
+ Symbols[SymbolAddress] = {SymbolSize, SymbolName, ELFSymIdx};
+ return Error::success();
+ }
+
+ // For XCOFF, XTY_SD symbol and its first XTY_LD symbol have same addresses,
+ // the symbol size of XTY_SD symbol is the size of the section while symbol
+ // size of the XTY_LD symbol is 0, but we need the XTY_LD symbol instead of
+ // the XTY_SD symbol.
+ XCOFFSymbolRef XCOFFSymbol = XCOFFSymbolRef(Symbol);
+ if (XCOFFSymbol.isCsectSymbol()) {
+ Expected<XCOFFCsectAuxRef> ExpCsectAuxEnt =
+ XCOFFSymbolRef(Symbol).getXCOFFCsectAuxRef();
----------------
diggerlin wrote:
change to `XCOFFSymbol.getXCOFFCsectAuxRef()`
https://github.com/llvm/llvm-project/pull/69553
More information about the llvm-commits
mailing list