[PATCH] D14628: ELF: Ignore OS bits in sh_flag when assigning 'Constant' ContentType for Atoms

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 14:42:57 PST 2015


tstellarAMD created this revision.
tstellarAMD added a reviewer: ruiu.
tstellarAMD added a subscriber: llvm-commits.

http://reviews.llvm.org/D14628

Files:
  lib/ReaderWriter/ELF/Atoms.cpp
  test/elf/AMDGPU/hsa-symbols.test

Index: test/elf/AMDGPU/hsa-symbols.test
===================================================================
--- test/elf/AMDGPU/hsa-symbols.test
+++ test/elf/AMDGPU/hsa-symbols.test
@@ -3,11 +3,19 @@
 # RUN: llvm-readobj -h -program-headers -s -symbols %t.exe | FileCheck %s
 
 # CHECK: Symbol {
+# CHECK: Name: readonly_agent
+# CHECK: Binding: Local
+# CHECK: Type: Object
+# CHECK: Section: .hsarodata_readonly_agent
+# CHECK: }
+
+# CHECK: Symbol {
 # CHECK: Name: global_agent
 # CHECK: Binding: Local
 # CHECK: Type: Object
 # CHECK: Section: .hsadata_global_agent
 # CHECK: }
+
 ---
 FileHeader:
   Class:           ELFCLASS64
@@ -22,9 +30,19 @@
                        SHF_AMDGPU_HSA_AGENT ]
     AddressAlign:    0x0000000000000004
     Content:         ''
+
+  - Name:           .hsarodata_readonly_agent
+    Type:           SHT_PROGBITS
+    Flags:          [ SHF_ALLOC, SHF_AMDGPU_HSA_AGENT, SHF_AMDGPU_HSA_READONLY ]
+    Content:        'abcd'
+
 Symbols:
   Local:
     - Name:            global_agent
       Type:            STT_OBJECT
       Section:         .hsadata_global_agent
+
+    - Name:            readonly_agent
+      Type:            STT_OBJECT
+      Section:         .hsarodata_readonly_agent
 ...
Index: lib/ReaderWriter/ELF/Atoms.cpp
===================================================================
--- lib/ReaderWriter/ELF/Atoms.cpp
+++ lib/ReaderWriter/ELF/Atoms.cpp
@@ -82,7 +82,7 @@
     return _section->sh_type == SHT_NOBITS ? typeThreadZeroFill
                                            : typeThreadData;
 
-  if (_section->sh_flags == SHF_ALLOC && _section->sh_type == SHT_PROGBITS)
+  if ((_section->sh_flags & ~SHF_MASKOS) == SHF_ALLOC && _section->sh_type == SHT_PROGBITS)
     return _contentType = typeConstant;
   if (_symbol->getType() == STT_GNU_IFUNC)
     return _contentType = typeResolver;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14628.40091.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151112/dc43632a/attachment.bin>


More information about the llvm-commits mailing list