This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by Higuoxing on May 7 2020, 2:33 AM.

Details

Summary

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;
  1. If the .dynamic section is acquired from section headers, the .dynamic

section is checked in getSectionContentsAsArray<Elf_Dyn>(&Sec).

Diff Detail

Event Timeline

Higuoxing created this revision.May 7 2020, 2:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2020, 2:33 AM
MaskRay accepted this revision.May 7 2020, 9:00 AM

Thanks!

This revision is now accepted and ready to land.May 7 2020, 9:00 AM
This revision was automatically updated to reflect the committed changes.
abhinavgaba added inline comments.
llvm/lib/Object/ELF.cpp
505

This is not being read anymore. So it's causing these warnings:
variable ‘DynSecSize’ set but not used [-Werror=unused-but-set-variable].

Higuoxing marked 2 inline comments as done.May 10 2020, 10:27 PM
Higuoxing added inline comments.
llvm/lib/Object/ELF.cpp
505