[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
Wed Sep 25 02:16:08 PDT 2019


MaskRay added a comment.

> It is possible that several function symbols have the same value, for example as a result of linker optimizations such as collapsing of identical functions into one function body. See PR43245.

Yes. A simple reproduce:

  clang -ffunction-sections -fstack-size-section a.c -c
  ld.lld --icf=all a.o -o a

Another type of cases is function aliases (`__attribute__((alias(foo)))`).

> This patch fixes readelf/readobj to dump the stack size for all such functions, not just the first one found in the symbol table.

It may be clearer to restate this: for each stack size entry, dump all functions (not just the first one) with the specified address.



================
Comment at: test/tools/llvm-readobj/stack-sizes.test:153
+    Binding: STB_GLOBAL
 
 ## Check that we report an error when we find relocations whose offsets point outside
----------------
Add another entry with `Type: STT_NOTYPE` to demonstrate that a non-function symbol is not dumped.


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

https://reviews.llvm.org/D67998





More information about the llvm-commits mailing list