diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-10 15:41:34 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-10 15:41:34 +0000 |
| commit | 0e876cfb2eb8f0fcedaecc3b0c0c65dcb9b70886 (patch) | |
| tree | b6301c45419eccdd53a6bea87f3ef95625908afe | |
| parent | ca57e53ded1f0c0d697c99c1d8442c2dce011d0c (diff) | |
| download | bcm5719-llvm-0e876cfb2eb8f0fcedaecc3b0c0c65dcb9b70886.tar.gz bcm5719-llvm-0e876cfb2eb8f0fcedaecc3b0c0c65dcb9b70886.zip | |
Replace duplicated '16' with a named constant.
Thanks to Michael Spencer for the suggestion.
llvm-svn: 286462
| -rw-r--r-- | lld/ELF/SyntheticSections.cpp | 5 | ||||
| -rw-r--r-- | lld/ELF/SyntheticSections.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 51e0fc45d44..2e2fc7331bd 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -217,7 +217,7 @@ BuildIdSection<ELFT>::BuildIdSection(size_t HashSize) HashSize(HashSize) { this->Live = true; - Buf.resize(16 + HashSize); + Buf.resize(HeaderSize + HashSize); const endianness E = ELFT::TargetEndianness; write32<E>(Buf.data(), 4); // Name size write32<E>(Buf.data() + 4, HashSize); // Content size @@ -229,8 +229,7 @@ BuildIdSection<ELFT>::BuildIdSection(size_t HashSize) // Returns the location of the build-id hash value in the output. template <class ELFT> uint8_t *BuildIdSection<ELFT>::getOutputLoc(uint8_t *Start) const { - // First 16 bytes are a header. - return Start + this->OutSec->Offset + this->OutSecOff + 16; + return Start + this->OutSec->Offset + this->OutSecOff + HeaderSize; } // Split one uint8 array into small pieces of uint8 arrays. diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 4910293ae00..4e204be372a 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -95,6 +95,8 @@ protected: std::function<void(ArrayRef<uint8_t> Arr, uint8_t *Hash)> Hash); size_t HashSize; + // First 16 bytes are a header. + static const unsigned HeaderSize = 16; }; template <class ELFT> |

