[PATCH] D76425: [llvm-readobj] Allow syms from all sections to match stack size entries

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 04:17:19 PDT 2020


jhenderson created this revision.
jhenderson added reviewers: MaskRay, grimar, rupprecht, ruiu, psmith.
Herald added a subscriber: emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Prior to this change, for non-relocatable objects llvm-readobj would assume that all symbols that corresponded to a stack size section's entries were in the section specified by the section's sh_link field. However, in the event that there are multiple sections, the sh_link field cannot be respected, as it only indicates one of those sections (LLD sets the value to the first such section but see D76410 <https://reviews.llvm.org/D76410> for a possible solution).

This patch changes llvm-readobj to ignore the section of symbols in a non-relocatable object (except for undefined symbols which are ignored). One behaviour change is that function symbols that share a value, but in different sections (typically these would appear at the end of a section) will result in the first being picked, even if the second is in the section for the sh_link value. As such symbols will almost never exist (it would require a zero-byte function or a symbol with an incorrect type), I think this is okay.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45228.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76425

Files:
  llvm/test/tools/llvm-readobj/ELF/stack-sizes.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76425.251329.patch
Type: text/x-patch
Size: 7699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200319/ce0abf5f/attachment-0001.bin>


More information about the llvm-commits mailing list