[llvm] [XCOFF] make related SD symbols as isFunction (PR #69553)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 00:15:00 PST 2023
================
@@ -1242,25 +1242,56 @@ bool XCOFFSymbolRef::isFunction() const {
const XCOFFCsectAuxRef CsectAuxRef = ExpCsectAuxEnt.get();
- // A function definition should be a label definition.
- // FIXME: This is not necessarily the case when -ffunction-sections is
- // enabled.
- if (!CsectAuxRef.isLabel())
+ if (CsectAuxRef.getStorageMappingClass() != XCOFF::XMC_PR &&
+ CsectAuxRef.getStorageMappingClass() != XCOFF::XMC_GL)
return false;
- if (CsectAuxRef.getStorageMappingClass() != XCOFF::XMC_PR)
+ // A function definition should not be a common type symbol or a external
+ // symbol.
+ if (CsectAuxRef.getSymbolType() == XCOFF::XTY_CM ||
+ CsectAuxRef.getSymbolType() == XCOFF::XTY_ER)
return false;
- const int16_t SectNum = getSectionNumber();
- Expected<DataRefImpl> SI = getObject()->getSectionByNum(SectNum);
- if (!SI) {
- // If we could not get the section, then this symbol should not be
- // a function. So consume the error and return `false` to move on.
- consumeError(SI.takeError());
- return false;
+ // If the next symbol is an XTY_LD type symbol with same address, this XTY_SD
----------------
jh7370 wrote:
Sorry, missed this.
https://github.com/llvm/llvm-project/pull/69553
More information about the llvm-commits
mailing list