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

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 18:55:51 PDT 2023


================
@@ -1242,10 +1242,8 @@ 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())
+  // A function definition should not be a common type symbol.
----------------
chenzheng1030 wrote:

hmm, the easy way can solve the case when SD symbol has size 0. But more common cases is like: (SD symbol has non-zero size):
```
[3]     m   0x00000000     .text     1  unamex                    test
[4]     a4  0x0000003a       0    0     SD       PR    0    0
[5]     m   0x00000000     .text     1  extern                    .foo
[6]     a4  0x00000003       0    0     LD       PR    0    0
```

I think Stephen means we should not treat `test` as a function since it is a section definition and it has one function(LD), `.foo`.

I will do a complete fix instead of the easy method. Thanks @diggerlin 

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


More information about the llvm-commits mailing list