Use uint64_t instead of uintX_t and size_t.

uint64_t is simpler and less error-prone than target or host-dependent types.

llvm-svn: 298969
This commit is contained in:
Rui Ueyama 2017-03-29 00:49:50 +00:00
parent c95671bd78
commit 6022b2be55
4 changed files with 6 additions and 8 deletions

View File

@ -444,10 +444,8 @@ static std::vector<SharedSymbol *> getSymbolsAt(SharedSymbol *SS) {
// debug. What's a solution? Instead of exporting a varaible V from a DSO, // debug. What's a solution? Instead of exporting a varaible V from a DSO,
// define an accessor getV(). // define an accessor getV().
template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) { template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
typedef typename ELFT::uint uintX_t;
// Copy relocation against zero-sized symbol doesn't make sense. // Copy relocation against zero-sized symbol doesn't make sense.
uintX_t SymSize = SS->template getSize<ELFT>(); uint64_t SymSize = SS->template getSize<ELFT>();
if (SymSize == 0) if (SymSize == 0)
fatal("cannot create a copy relocation for symbol " + toString(*SS)); fatal("cannot create a copy relocation for symbol " + toString(*SS));
@ -455,7 +453,7 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
// memory protection by reserving space in the .bss.rel.ro section. // memory protection by reserving space in the .bss.rel.ro section.
bool IsReadOnly = isReadOnly<ELFT>(SS); bool IsReadOnly = isReadOnly<ELFT>(SS);
BssSection *Sec = IsReadOnly ? In<ELFT>::BssRelRo : In<ELFT>::Bss; BssSection *Sec = IsReadOnly ? In<ELFT>::BssRelRo : In<ELFT>::Bss;
uintX_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>()); uint64_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
// Look through the DSO's dynamic symbol table for aliases and create a // Look through the DSO's dynamic symbol table for aliases and create a
// dynamic symbol for each one. This causes the copy relocation to correctly // dynamic symbol for each one. This causes the copy relocation to correctly

View File

@ -240,7 +240,7 @@ public:
// CopyRelSec and CopyRelSecOff are significant only when NeedsCopy is true. // CopyRelSec and CopyRelSecOff are significant only when NeedsCopy is true.
InputSection *CopyRelSec; InputSection *CopyRelSec;
size_t CopyRelSecOff; uint64_t CopyRelSecOff;
private: private:
template <class ELFT> const typename ELFT::Sym &getSym() const { template <class ELFT> const typename ELFT::Sym &getSym() const {

View File

@ -367,11 +367,11 @@ void BuildIdSection::computeHash(
BssSection::BssSection(StringRef Name) BssSection::BssSection(StringRef Name)
: SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, 0, Name) {} : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, 0, Name) {}
size_t BssSection::reserveSpace(size_t Size, uint32_t Alignment) { size_t BssSection::reserveSpace(uint64_t Size, uint32_t Alignment) {
if (OutSec) if (OutSec)
OutSec->updateAlignment(Alignment); OutSec->updateAlignment(Alignment);
this->Size = alignTo(this->Size, Alignment) + Size; this->Size = alignTo(this->Size, Alignment) + Size;
this->Alignment = std::max<uint32_t>(this->Alignment, Alignment); this->Alignment = std::max(this->Alignment, Alignment);
return this->Size - Size; return this->Size - Size;
} }

View File

@ -166,7 +166,7 @@ public:
size_t getSize() const override { return Size; } size_t getSize() const override { return Size; }
private: private:
size_t Size = 0; uint64_t Size = 0;
}; };
class MipsGotSection final : public SyntheticSection { class MipsGotSection final : public SyntheticSection {