[PATCH] D76081: [Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 09:07:11 PDT 2020
Higuoxing added a comment.
In D76081#1939223 <https://reviews.llvm.org/D76081#1939223>, @grimar wrote:
> I do not have a good answer right now. Seems the API could be revisited and refined.
> `section_begin()` and `section_end()` just ignore errors now.
> `symbol_begin()` has a different logic from `dynamic_symbol_begin` that does not look ideal to me either:
>
> DataRefImpl Sym =
> toDRI(DotSymtabSec,
> DotSymtabSec && DotSymtabSec->sh_size >= sizeof(Elf_Sym) ? 1 : 0);
>
>
> (it is unclear to me how it works when `sh_size==1`, for example)
When `sh_size == 1`, it's similar to `toDRI(DotSymtabSec, 0)` and `symbol_end()` will return `toDRI(DotSymtabSec, sh_size / sizeof(Elf_Sym)`. Hence, no symbol is returned.
> I think we should investigate how API is used by each tool, find what they want
> and then decide how to clean-up/improve/expand/remove it.
Sure, I will take a look at those tools. Thanks :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76081/new/
https://reviews.llvm.org/D76081
More information about the llvm-commits
mailing list