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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 10:59:12 PST 2016

(now with the correct list)

> +template <class ELFT>
> +static const typename ELFFile<ELFT>::Elf_Shdr *
> +findSectionByAddress(const ELFFile<ELFT> *Obj, uint64_t Addr) {
> +  for (const auto &Shdr : Obj->sections())
> +    if (Shdr.sh_addr == Addr)
> +      return &Shdr;
> +  return nullptr;
> +}

Hi Simon, this assumes that the first section with a given address is
the one you want. This seems invalid since you can have multiple empty
sections at the same address. From the code it looks like this is used
to find the size of sections like .got. Is this really what the
dynamic linker does? Or it doesn't need to know the size at at all?


More information about the llvm-commits mailing list