AMDGPU/SI: Emit constant arrays in the .hsrodata_readonly_agent section
[oota-llvm.git] / lib / Target / AMDGPU / AMDGPUHSATargetObjectFile.cpp
index ee42eaacf546fb4e087994f59fdcc6d02ad6a804..32f53edeb770b7cc9de8a6a0e3fd1fc9ae622de3 100644 (file)
@@ -26,6 +26,7 @@ void AMDGPUHSATargetObjectFile::Initialize(MCContext &Ctx,
   DataGlobalAgentSection = AMDGPU::getHSADataGlobalAgentSection(Ctx);
   DataGlobalProgramSection = AMDGPU::getHSADataGlobalProgramSection(Ctx);
 
+  RodataReadonlyAgentSection = AMDGPU::getHSARodataReadonlyAgentSection(Ctx);
 }
 
 bool AMDGPUHSATargetObjectFile::isAgentAllocationSection(
@@ -63,5 +64,8 @@ MCSection *AMDGPUHSATargetObjectFile::SelectSectionForGlobal(
       return DataGlobalProgramSection;
   }
 
+  if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GV))
+    return RodataReadonlyAgentSection;
+
   return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
 }