[PATCH] D18499: [ELF] - Implemented prototype of location counter support.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 14:50:02 PDT 2016


ruiu added a comment.

This is I think better, although it needs brush-ups in terms of coding style.


================
Comment at: ELF/Writer.cpp:1421-1436
@@ +1420,18 @@
+
+  uintX_t FileOff = 0;
+  size_t I = 0;
+  for (OutputSectionBase<ELFT> *Sec : OutputSections) {
+    uintX_t Align = Sec->getAlign();
+    if (Sec->getType() != SHT_NOBITS)
+      FileOff = alignTo(FileOff, Align);
+    Sec->setFileOffset(FileOff);
+    if (Sec->getType() != SHT_NOBITS)
+      FileOff += Sec->getSize();
+
+    StringRef Name = Sec->getName();
+    uintX_t VA = (I < dummySectionsNum()) ? (uintX_t)Script->getDummieSecVA(I)
+                                          : (uintX_t)Script->getSecVA(Name);
+    Sec->setVA(VA);
+    ++I;
+  }
+
----------------
This is very similar to the code in assignAddresses.


http://reviews.llvm.org/D18499





More information about the llvm-commits mailing list