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

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 22:34:40 PDT 2023


================
@@ -83,8 +83,30 @@ class SymbolizableObjectFile : public SymbolizableModule {
     // getNameFromSymbolTable.
     uint32_t ELFLocalSymIdx;
 
+    // Both are false if this is not a XCOFF local symbol.
+    bool IsXCOFFSDSymbol;
+    bool IsXCOFFLDSymbol;
----------------
chenzheng1030 wrote:

```
I do not think we care about the size of the symbol when priority the same address symbols in XCOFF , we care about the symbol type and storage mapping class.
```

Thanks @diggerlin for pointing out these existing functions. The implementation here is same with those places. Except that here we only care about the symbol type. Because the symbols in llvm-symbolizer are already filtered. See the function `SymbolizableObjectFile::addSymbol()`. Using address and symbol type are enough to sort the filtered symbols.

However, I agree with you that it is strange we still need to sort based on symbol size. We need to prioritize based on size for below two symbols(actually I think this is an existing XCOFF symbol table bug) :
```
[1]     m   0x00000000     .text     1  unamex                    **No Symbol**
[2]     a4  0x00000000       0    0     SD       PR    0    0
[3]     m   0x00000000     .text     1  extern                    .foo
[4]     a4  0x00000019       0    0     SD       PR    0    0
```
( Compiled from `llvm/test/tools/llvm-symbolizer/xcoff-sd-symbol.ll` in this patch, `llc -filetype=obj xcoff-sd-symbol.ll -mtriple=powerpc-aix-ibm-xcoff -function-sections`)

If there is no label under symbol 1(.text csect for all no csect functions), we can remove the symbol 1 and symbol 2, right? And with this redundant symbol, there is not way to prioritize symbol 1 and symbol 3. Sizes are a workaround better than names?

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


More information about the llvm-commits mailing list