[kvm-unit-tests PATCH v5 16/29] powerpc: Set .got section alignment to 256 bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modern powerpc64 toolchains require the .got section have alignment of
256 bytes. Incorrect alignment ends up causing the .data section ELF
load address to move by 8 bytes from its file offset, relative to
previous sections. This is not a problem for the QEMU bios loader used
by the pseries machine, but it is a problem for the powernv machine
using skiboot as the bios and the test programs as a kernel, because the
skiboot ELF loader is crippled:

  * Note that we execute the kernel in-place, we don't actually
  * obey the load informations in the headers. This is expected
  * to work for the Linux Kernel because it's a fairly dumb ELF
  * but it will not work for any ELF binary.

This causes all references to data to be incorrect. Aligning the .got
to 256 bytes prevents this offset skew and allows the skiboot "flat"
loader to work. [I don't know why the .got alignment can cause this
difference in linking.]

Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
---
 powerpc/flat.lds | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/powerpc/flat.lds b/powerpc/flat.lds
index 5eed368d..e07b91c1 100644
--- a/powerpc/flat.lds
+++ b/powerpc/flat.lds
@@ -41,8 +41,7 @@ SECTIONS
     /*
      * tocptr is tocbase + 32K, allowing toc offsets to be +-32K
      */
-    tocptr = . + 32K;
-    .got : { *(.toc) *(.got) }
+    .got : ALIGN(256) { tocptr = . + 32K; *(.toc .got) }
     . = ALIGN(64K);
     edata = .;
     . += 64K;
-- 
2.42.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux