[llvm] r348074 - [llvm-readobj] Improve dynamic section iteration NFC.
Xing GUO via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 1 04:27:24 PST 2018
Author: higuoxing
Date: Sat Dec 1 04:27:24 2018
New Revision: 348074
URL: http://llvm.org/viewvc/llvm-project?rev=348074&view=rev
Log:
[llvm-readobj] Improve dynamic section iteration NFC.
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=348074&r1=348073&r2=348074&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Sat Dec 1 04:27:24 2018
@@ -639,9 +639,12 @@ static void printVersionDefinitionSectio
// is determined by DT_VERDEFNUM tag.
unsigned VerDefsNum = 0;
for (const typename ELFO::Elf_Dyn &Dyn : Dumper->dynamic_table()) {
- if (Dyn.d_tag == DT_VERDEFNUM)
+ if (Dyn.d_tag == DT_VERDEFNUM) {
VerDefsNum = Dyn.d_un.d_val;
+ break;
+ }
}
+
const uint8_t *SecStartAddress =
(const uint8_t *)Obj->base() + Sec->sh_offset;
const uint8_t *SecEndAddress = SecStartAddress + Sec->sh_size;
@@ -692,9 +695,12 @@ static void printVersionDependencySectio
return;
unsigned VerNeedNum = 0;
- for (const typename ELFO::Elf_Dyn &Dyn : Dumper->dynamic_table())
- if (Dyn.d_tag == DT_VERNEEDNUM)
+ for (const typename ELFO::Elf_Dyn &Dyn : Dumper->dynamic_table()) {
+ if (Dyn.d_tag == DT_VERNEEDNUM) {
VerNeedNum = Dyn.d_un.d_val;
+ break;
+ }
+ }
const uint8_t *SecData = (const uint8_t *)Obj->base() + Sec->sh_offset;
const typename ELFO::Elf_Shdr *StrTab =
More information about the llvm-commits
mailing list