[llvm] [XCOFF] make related SD symbols as isFunction (PR #69553)

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 00:54:53 PST 2023


================
@@ -1288,7 +1288,7 @@ Expected<bool> XCOFFSymbolRef::isFunction() const {
   if (CsectAuxRef.getSymbolType() == XCOFF::XTY_LD)
     return true;
 
-  return false;
+  return createError("csect symbol has no valid symbol type.");
----------------
chenzheng1030 wrote:

The symbol type is for result of `CsectAuxRef.getSymbolType()`. For XCOFF symbols, there are four symbol types, see: 
```
enum SymbolType : uint8_t {
  XTY_ER = 0, ///< External reference.
  XTY_SD = 1, ///< Csect definition for initialized storage.
  XTY_LD = 2, ///< Label definition.
              ///< Defines an entry point to an initialized csect.
  XTY_CM = 3  ///< Common csect definition. For uninitialized storage.
};
```

So if the code goes here, the symbol type must be valid. I think `symbol type` means more than just `type` for XCOFF symbols.

https://github.com/llvm/llvm-project/pull/69553


More information about the llvm-commits mailing list