Split Header into individual fields.

This is similar to what was done for InputSection.

With this the various fields are stored in host order and only
converted to target order when writing.

llvm-svn: 286327
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 12a3ab0..bb1b588 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -355,7 +355,7 @@
 }
 
 void X86TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
-  write32le(Buf, Out<ELF32LE>::Dynamic->getVA());
+  write32le(Buf, Out<ELF32LE>::Dynamic->Addr);
 }
 
 void X86TargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &S) const {
@@ -403,7 +403,7 @@
       0x90, 0x90, 0x90, 0x90              // nop; nop; nop; nop
   };
   memcpy(Buf, PltData, sizeof(PltData));
-  uint32_t Got = Out<ELF32LE>::GotPlt->getVA();
+  uint32_t Got = Out<ELF32LE>::GotPlt->Addr;
   write32le(Buf + 2, Got + 4);
   write32le(Buf + 8, Got + 8);
 }
@@ -420,7 +420,7 @@
 
   // jmp *foo@GOT(%ebx) or jmp *foo_in_GOT
   Buf[1] = Config->Pic ? 0xa3 : 0x25;
-  uint32_t Got = Out<ELF32LE>::GotPlt->getVA();
+  uint32_t Got = Out<ELF32LE>::GotPlt->Addr;
   write32le(Buf + 2, Config->Shared ? GotEntryAddr - Got : GotEntryAddr);
   write32le(Buf + 7, RelOff);
   write32le(Buf + 12, -Index * PltEntrySize - PltHeaderSize - 16);
@@ -595,7 +595,7 @@
   // required, but it is documented in the psabi and the glibc dynamic linker
   // seems to use it (note that this is relevant for linking ld.so, not any
   // other program).
-  write64le(Buf, Out<ELFT>::Dynamic->getVA());
+  write64le(Buf, Out<ELFT>::Dynamic->Addr);
 }
 
 template <class ELFT>
@@ -613,8 +613,8 @@
       0x0f, 0x1f, 0x40, 0x00              // nopl 0x0(rax)
   };
   memcpy(Buf, PltData, sizeof(PltData));
-  uint64_t Got = Out<ELFT>::GotPlt->getVA();
-  uint64_t Plt = Out<ELFT>::Plt->getVA();
+  uint64_t Got = Out<ELFT>::GotPlt->Addr;
+  uint64_t Plt = Out<ELFT>::Plt->Addr;
   write32le(Buf + 2, Got - Plt + 2); // GOT+8
   write32le(Buf + 8, Got - Plt + 4); // GOT+16
 }
@@ -1019,7 +1019,7 @@
   // TOC starts where the first of these sections starts. We always create a
   // .got when we see a relocation that uses it, so for us the start is always
   // the .got.
-  uint64_t TocVA = Out<ELF64BE>::Got->getVA();
+  uint64_t TocVA = Out<ELF64BE>::Got->Addr;
 
   // Per the ppc64-elf-linux ABI, The TOC base is TOC value plus 0x8000
   // thus permitting a full 64 Kbytes segment. Note that the glibc startup
@@ -1254,7 +1254,7 @@
 }
 
 void AArch64TargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &) const {
-  write64le(Buf, Out<ELF64LE>::Plt->getVA());
+  write64le(Buf, Out<ELF64LE>::Plt->Addr);
 }
 
 static uint64_t getAArch64Page(uint64_t Expr) {
@@ -1274,8 +1274,8 @@
   };
   memcpy(Buf, PltData, sizeof(PltData));
 
-  uint64_t Got = Out<ELF64LE>::GotPlt->getVA();
-  uint64_t Plt = Out<ELF64LE>::Plt->getVA();
+  uint64_t Got = Out<ELF64LE>::GotPlt->Addr;
+  uint64_t Plt = Out<ELF64LE>::Plt->Addr;
   relocateOne(Buf + 4, R_AARCH64_ADR_PREL_PG_HI21,
               getAArch64Page(Got + 16) - getAArch64Page(Plt + 4));
   relocateOne(Buf + 8, R_AARCH64_LDST64_ABS_LO12_NC, Got + 16);
@@ -1616,7 +1616,7 @@
 }
 
 void ARMTargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &) const {
-  write32le(Buf, Out<ELF32LE>::Plt->getVA());
+  write32le(Buf, Out<ELF32LE>::Plt->Addr);
 }
 
 void ARMTargetInfo::writePltHeader(uint8_t *Buf) const {
@@ -1628,8 +1628,8 @@
       0x00, 0x00, 0x00, 0x00, // L2: .word   &(.got.plt) - L1 - 8
   };
   memcpy(Buf, PltData, sizeof(PltData));
-  uint64_t GotPlt = Out<ELF32LE>::GotPlt->getVA();
-  uint64_t L1 = Out<ELF32LE>::Plt->getVA() + 8;
+  uint64_t GotPlt = Out<ELF32LE>::GotPlt->Addr;
+  uint64_t L1 = Out<ELF32LE>::Plt->Addr + 8;
   write32le(Buf + 16, GotPlt - L1 - 8);
 }
 
@@ -1996,7 +1996,7 @@
 
 template <class ELFT>
 void MipsTargetInfo<ELFT>::writeGotPlt(uint8_t *Buf, const SymbolBody &) const {
-  write32<ELFT::TargetEndianness>(Buf, Out<ELFT>::Plt->getVA());
+  write32<ELFT::TargetEndianness>(Buf, Out<ELFT>::Plt->Addr);
 }
 
 template <endianness E, uint8_t BSIZE, uint8_t SHIFT>
@@ -2063,7 +2063,7 @@
   write32<E>(Buf + 20, 0x0018c082); // srl   $24, $24, 2
   write32<E>(Buf + 24, 0x0320f809); // jalr  $25
   write32<E>(Buf + 28, 0x2718fffe); // subu  $24, $24, 2
-  uint64_t Got = Out<ELFT>::GotPlt->getVA();
+  uint64_t Got = Out<ELFT>::GotPlt->Addr;
   writeMipsHi16<E>(Buf, Got);
   writeMipsLo16<E>(Buf + 4, Got);
   writeMipsLo16<E>(Buf + 8, Got);