[PATCH] D12788: [elf2] Combine adjacent compatible OutputSections in PT_LOADs.

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 13:54:32 PDT 2015


Bigcheese added inline comments.

================
Comment at: ELF/Writer.cpp:397-404
@@ +396,10 @@
+  void writeHeaderTo(typename ELFFile<ELFType<E, Is64Bits>>::Elf_Phdr *PHDR) {
+    PHDR->p_type = Header.p_type;
+    PHDR->p_flags = Header.p_flags;
+    PHDR->p_offset = Header.p_offset;
+    PHDR->p_vaddr = Header.p_vaddr;
+    PHDR->p_paddr = Header.p_paddr;
+    PHDR->p_filesz = Header.p_filesz;
+    PHDR->p_memsz = Header.p_memsz;
+    PHDR->p_align = Header.p_align;
+  }
----------------
ruiu wrote:
> Can this just be *PHDR = Header?
No, they are different types.

================
Comment at: test/elf2/basic64be.s:152-175
@@ -151,26 +151,26 @@
 # CHECK-NEXT: ProgramHeaders [
-# CHECK-NEXT:  ProgramHeader {
-# CHECK-NEXT:    Type: PT_LOAD (0x1)
-# CHECK-NEXT:    Offset: 0x0
-# CHECK-NEXT:    VirtualAddress: 0x10000
-# CHECK-NEXT:    PhysicalAddress: 0x10000
-# CHECK-NEXT:    FileSize: 232
-# CHECK-NEXT:    MemSize: 232
-# CHECK-NEXT:    Flags [
-# CHECK-NEXT:      PF_R
-# CHECK-NEXT:    ]
-# CHECK-NEXT:    Alignment: 4096
-# CHECK-NEXT:  }
-# CHECK-NEXT:  ProgramHeader {
-# CHECK-NEXT:    Type: PT_LOAD (0x1)
-# CHECK-NEXT:    Offset: 0x1000
-# CHECK-NEXT:    VirtualAddress: 0x11000
-# CHECK-NEXT:    PhysicalAddress: 0x11000
-# CHECK-NEXT:    FileSize: 12
-# CHECK-NEXT:    MemSize: 12
-# CHECK-NEXT:    Flags [ (0x5)
-# CHECK-NEXT:      PF_R (0x4)
-# CHECK-NEXT:      PF_X (0x1)
-# CHECK-NEXT:    ]
-# CHECK-NEXT:    Alignment: 4096
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x0
+# CHECK-NEXT:     VirtualAddress: 0x10000
+# CHECK-NEXT:     PhysicalAddress: 0x10000
+# CHECK-NEXT:     FileSize: 232
+# CHECK-NEXT:     MemSize: 232
+# CHECK-NEXT:     Flags [ (0x4)
+# CHECK-NEXT:       PF_R (0x4)
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
+# CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     VirtualAddress: 0x11000
+# CHECK-NEXT:     PhysicalAddress: 0x11000
+# CHECK-NEXT:     FileSize: 12
+# CHECK-NEXT:     MemSize: 12
+# CHECK-NEXT:     Flags [ (0x5)
+# CHECK-NEXT:       PF_R (0x4)
+# CHECK-NEXT:       PF_X (0x1)
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
 # CHECK-NEXT:  }
----------------
Ah, that wasn't supposed to happen.


http://reviews.llvm.org/D12788





More information about the llvm-commits mailing list