[all-commits] [llvm/llvm-project] ce86a9: [Object] Remove unneeded check in ELFFile<ELFT>::d...

Xing GUO via All-commits all-commits at lists.llvm.org
Thu May 7 18:51:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ce86a986c39b2ad50ce495fe2d69c95d8a961c37
      https://github.com/llvm/llvm-project/commit/ce86a986c39b2ad50ce495fe2d69c95d8a961c37
  Author: Xing GUO <higuoxing at gmail.com>
  Date:   2020-05-08 (Fri, 08 May 2020)

  Changed paths:
    M llvm/lib/Object/ELF.cpp

  Log Message:
  -----------
  [Object] Remove unneeded check in ELFFile<ELFT>::dynamicEntries().

Check for `DynSecSize % sizeof(Elf_Dyn) != 0` is unneeded in this context.

1. If the .dynamic section is acquired from program headers, the .dynamic
section is "cut off" by

```
makeArrayRef(..., Phdr.p_filesz / sizeof(Elf_Dyn));
DynSeSize = Phdr.p_filesz;
```

2. If the .dynamic section is acquired from section headers, the .dynamic
section is checked in `getSectionContentsAsArray<Elf_Dyn>(&Sec)`.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D79560




More information about the All-commits mailing list