diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-31 22:49:50 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-31 22:49:50 +0000 |
commit | 47c9f84d50ebb9c485c66e236db278ae356f943d (patch) | |
tree | 49867efbe0a731ea2ab6bedea44776f5b891540d | |
parent | cccd2c604e4600feb108c51839fc82f7933fc759 (diff) | |
download | bcm5719-llvm-47c9f84d50ebb9c485c66e236db278ae356f943d.tar.gz bcm5719-llvm-47c9f84d50ebb9c485c66e236db278ae356f943d.zip |
Simplify. NFC.
The sections are ordered, so we can just use the first one when
looking for the lowest address.
llvm-svn: 304369
-rw-r--r-- | lld/ELF/Writer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index adc606049eb..8d7ee8e3d58 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1697,12 +1697,12 @@ template <class ELFT> void Writer<ELFT>::fixPredefinedSymbols() { if (Config->EMachine == EM_MIPS && !ElfSym::MipsGp->Value) { // Find GP-relative section with the lowest address // and use this address to calculate default _gp value. - uint64_t Gp = -1; - for (const OutputSection *OS : OutputSections) - if ((OS->Flags & SHF_MIPS_GPREL) && OS->Addr < Gp) - Gp = OS->Addr; - if (Gp != (uint64_t)-1) - ElfSym::MipsGp->Value = Gp + 0x7ff0; + for (const OutputSection *OS : OutputSections) { + if (OS->Flags & SHF_MIPS_GPREL) { + ElfSym::MipsGp->Value = OS->Addr + 0x7ff0; + break; + } + } } } |