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

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 23:30:01 PDT 2023


chenzheng1030 wrote:

> From your comments, I can't tell what you're trying to accomplish, and I'm not sure of all the things that llvm-symbolizer does. But here are some things to consider (some of them are already done correctly in the code):
> 
>     1. A typical object file without debug information has C_EXT, C_HIDEXT, and C_WEAKEXT symbols, Each of these must have at least one auxiliary symbol table entry, or the object file is invalid.
> 
>     2. Csects (XTY_SD) have addresses and lengths. Labels (XTY_LD) have addresses but do not have lengths. For llvm-symbolizer, you can compute the length of an XTY_SD symbol as number of bytes between it and the first label.  Similarly, you can compute the length of an XTY_LD symbol as the number of bytes between it and the next XTY_LD symbol, or to the end of the containing csect, if there are no more labels.
> 
>     3. Csects can have padding between them.
> 
>     4. 2. BSS symbols (XTY_CM) have addresses and lengths but cannot have labels.
> 
>     5. There can be a label (XTY_LD) at the same address as a csect (XTY_SD). For this case, I would use the label name for printing purposes.
> 
>     6. Zero-length csects are possible. This means that two (or more) csects can have the same address.  In this case, I would pick a csect with a non-zero length to associate with the address. (This handles the TOC vs. TC case mentioned earlier).
> 
>     7. XTY_ER symbols can have addresses, such as when you import a variable at a fixed address.
> 
> 
> If you use the AIX **dump** command, you see output similar to:
> 
> [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
> 
> The letter 'm' indicates a primary symbol table entry (symbols 1 & 3). The other entries (a4) are for auxiliary entries. So I consider this output to be for 2 symbols, not 4.

Thanks for the info. Then I think there is a way to `getSize()` for a XTY_LD symbol. For now the symbol size for this kind of symbol is 0.

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


More information about the llvm-commits mailing list