[PATCH] D67998: [llvm-readobj/llvm-readelf]: Dump stack-size entry for all function symbols that have a particular value (fixes PR43245)

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 02:21:02 PDT 2019


MaskRay added a comment.

In D67998#1683795 <https://reviews.llvm.org/D67998#1683795>, @jhenderson wrote:

> In D67998#1682945 <https://reviews.llvm.org/D67998#1682945>, @wolfgangp wrote:
>
> > Yes, good observation. There is also the question what to do if the sizes of 2 different entries with the same address don't match. This should probably elicit a warning.
>
>
> I agree this should probably print a warning, and I think it then should do a best guess print of the stack sizes. I have three options, in rough order of preference for this:
>
> 1. Display the entries with symbols in the order they appear in the symbol table, i.e. if `foo` and `bar` appear in that order in the symbol table, with the same address, I'd print `foo` with the first stack size and `bar` with the second. This is probably a reasonable guess based on what the linker might have done (putting the symbols in order they are discovered, same as the stack sizes entries).
> 2. Display only the largest entry, but once per symbol with the same address. In practice, this is probably just as good. It doesn't really make sense for two symbols to have the same address but different stack sizes: that would imply that the same bit of code has different possible sizes, which doesn't really make sense.
> 3. Display the first entry size, for each symbol. This is probably the simplest.


The warning case should be very rare. The ICF implementation in neither gold nor lld folds sections with different sizes (i.e. functions with different sizes) gold/icf.cc#l756 lld/ELF/ICF.cpp#L305.  st_size=0 aliases can sometimes happen for STT_NOTYPE symbols, but I can't find any case for STT_FUNC. Emitting a warnings looks good to me. I think the we can just pick the simplest guessing approach.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67998/new/

https://reviews.llvm.org/D67998





More information about the llvm-commits mailing list