[llvm] r211150 - [llvm-readobj][ELF] New `-mips-plt-got` command line option to output

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 12:58:22 PST 2016


On Tue, Feb 2, 2016 at 10:47 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>> You are right, in general case this function might return unexpected
>> section. A better name for it is 'findFirstSectionAtAddress'.
>>
>> AFAIK dynamic linker and readelf tool do not rely on the actual
>> section size. They use DT_PLTGOT to find section address,
>> DT_MIPS_LOCAL_GOTNO to iterate over local GOT entries and
>> DT_MIPS_SYMTABNO/DT_MIPS_GOTSYM to iterate over global GOT entries.
>>
>> I do not know what is the best solution in our case. Probably more
>> accurate approach is to find a section with specified address and
>> non-zero size. I can take a look at this problem if you do not plan to
>> fix it by yourself.
>
> Can't you use DT_MIPS_SYMTABNO like the dynamic linker?

Yes, it is possible. But in that case we can miss some kind of invalid
GOT. For example, if .got section size is less than the number
calculated from DT_MIPS_LOCAL_GOTNO / DT_MIPS_SYMTABNO /
DT_MIPS_GOTSYM we will not show any error. One more point - TLS and
multi-GOT entries. They live beyond local/global part of GOT. Now
llvm-readobj shows their number using .got section size.

-- 
Simon Atanasyan


More information about the llvm-commits mailing list