[PATCH] D25694: [AMDGPU] Mark .note section SHF_ALLOC so lld creates a segment for it

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 12:34:20 PDT 2016


kzhuravl created this revision.
kzhuravl added a reviewer: tstellarAMD.
kzhuravl added a subscriber: llvm-commits.
Herald added subscribers: tony-tye, yaxunl, nhaehnle, wdng, arsenm.

https://reviews.llvm.org/D25694

Files:
  lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
  test/CodeGen/AMDGPU/hsa.ll


Index: test/CodeGen/AMDGPU/hsa.ll
===================================================================
--- test/CodeGen/AMDGPU/hsa.ll
+++ test/CodeGen/AMDGPU/hsa.ll
@@ -17,11 +17,16 @@
 ; ELF: }
 
 ; ELF: SHT_NOTE
+; ELF: Flags [ (0x2)
+; ELF: SHF_ALLOC (0x2)
+; ELF: ]
+; ELF: SectionData (
 ; ELF: 0000: 04000000 08000000 01000000 414D4400
 ; ELF: 0010: 02000000 01000000 04000000 1B000000
 ; ELF: 0020: 03000000 414D4400 04000700 07000000
 ; ELF: 0030: 00000000 00000000 414D4400 414D4447
 ; ELF: 0040: 50550000
+; ELF: )
 
 ; ELF: Symbol {
 ; ELF: Name: simple
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -97,7 +97,8 @@
 AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectVersion(uint32_t Major,
                                                            uint32_t Minor) {
   MCStreamer &OS = getStreamer();
-  MCSectionELF *Note = OS.getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
+  MCSectionELF *Note =
+      OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
 
   unsigned NameSZ = 4;
 
@@ -120,7 +121,8 @@
                                                        StringRef VendorName,
                                                        StringRef ArchName) {
   MCStreamer &OS = getStreamer();
-  MCSectionELF *Note = OS.getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
+  MCSectionELF *Note =
+      OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
 
   unsigned NameSZ = 4;
   uint16_t VendorNameSize = VendorName.size() + 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25694.74887.patch
Type: text/x-patch
Size: 1707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161017/90a73f52/attachment.bin>


More information about the llvm-commits mailing list