[PATCH] D68712: Avoid PT_LOAD to have overlapping p_offset ranges on EM_AMDGPU

Dineshkumar Bhaskaran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 09:12:41 PDT 2019


dineshkb-amd created this revision.
dineshkb-amd added a reviewer: MaskRay.
dineshkb-amd added a project: AMDGPU.
Herald added subscribers: llvm-commits, fedor.sergeev, arichardson, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl, emaste, jyknight.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Changes introduced in commit https://llvm.org/svn/llvm-project/lld/trunk@370180 allows PT_LOAD to have overlapping p_offset ranges on EM_AMDGPU and EM_SPARCV9. However this is introducing crashes in an AMD internal test cases. Thus is selectively disable for AMDGPU.

The test case is not included as it requires elaborate setup and has several application layers.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D68712

Files:
  ELF/Writer.cpp
  test/ELF/amdgpu-relocs.s


Index: test/ELF/amdgpu-relocs.s
===================================================================
--- test/ELF/amdgpu-relocs.s
+++ test/ELF/amdgpu-relocs.s
@@ -94,7 +94,7 @@
 # linker.
 # CHECK: Relocations [
 # CHECK: .rela.dyn {
-# CHECK-NEXT: R_AMDGPU_RELATIVE64 - 0x3928
+# CHECK-NEXT: R_AMDGPU_RELATIVE64 - 0x3008
 # CHECK-NEXT: R_AMDGPU_ABS64 common_var0 0x0
 # CHECK-NEXT: R_AMDGPU_ABS64 common_var1 0x0
 # CHECK-NEXT: R_AMDGPU_ABS64 common_var2 0x0
@@ -114,16 +114,16 @@
 # CHECK-NEXT: }
 # CHECK-NEXT: ]
 
-# NM: 0000000000003930 B common_var0
-# NM: 0000000000003d30 B common_var1
-# NM: 0000000000004130 B common_var2
-# NM: 0000000000003928 d temp2
+# NM: 0000000000003010 B common_var0
+# NM: 0000000000003410 B common_var1
+# NM: 0000000000003810 B common_var2
+# NM: 0000000000003008 d temp2
 
-# temp2 - foo = 0x3928-0x768 = 0x31c0
+# temp2 - foo = 0x3008-0x768 = 0x28a0
 # HEX:      section '.rodata':
-# HEX-NEXT: 0x00000768 c0310000 00000000
+# HEX-NEXT: 0x00000768 a0280000 00000000
 
 # common_var2+4, common_var1+8, and common_var0+12.
 # HEX:      section 'nonalloc':
-# HEX-NEXT: 0x00000000 00000000 34410000 00000000 383d0000
-# HEX-NEXT: 0x00000010 00000000 3c390000
+# HEX-NEXT: 0x00000000 00000000 14380000 00000000 18340000
+# HEX-NEXT: 0x00000010 00000000 1c300000
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -2241,7 +2241,9 @@
       // maximum page size boundary so that we can find the ELF header at the
       // start. We cannot benefit from overlapping p_offset ranges with the
       // previous segment anyway.
-      if (config->zSeparate == SeparateSegmentKind::Loadable ||
+      bool enable = config->emachine != EM_AMDGPU;
+
+      if (!enable || config->zSeparate == SeparateSegmentKind::Loadable ||
           (config->zSeparate == SeparateSegmentKind::Code && prev &&
            (prev->p_flags & PF_X) != (p->p_flags & PF_X)) ||
           cmd->type == SHT_LLVM_PART_EHDR)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68712.224070.patch
Type: text/x-patch
Size: 2009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191009/35f7c41b/attachment.bin>


More information about the llvm-commits mailing list