1c93fc11fSTom Stellard //===-- AMDGPUHSATargetObjectFile.cpp - AMDGPU Object Files ---------------===//
2c93fc11fSTom Stellard //
3c93fc11fSTom Stellard //                     The LLVM Compiler Infrastructure
4c93fc11fSTom Stellard //
5c93fc11fSTom Stellard // This file is distributed under the University of Illinois Open Source
6c93fc11fSTom Stellard // License. See LICENSE.TXT for details.
7c93fc11fSTom Stellard //
8c93fc11fSTom Stellard //===----------------------------------------------------------------------===//
9c93fc11fSTom Stellard 
10c93fc11fSTom Stellard #include "AMDGPUTargetObjectFile.h"
11c93fc11fSTom Stellard #include "AMDGPU.h"
126bda14b3SChandler Carruth #include "AMDGPUTargetMachine.h"
136bda14b3SChandler Carruth #include "Utils/AMDGPUBaseInfo.h"
14*264b5d9eSZachary Turner #include "llvm/BinaryFormat/ELF.h"
15c93fc11fSTom Stellard #include "llvm/MC/MCContext.h"
16c93fc11fSTom Stellard #include "llvm/MC/MCSectionELF.h"
17c93fc11fSTom Stellard 
18c93fc11fSTom Stellard using namespace llvm;
19c93fc11fSTom Stellard 
20c93fc11fSTom Stellard //===----------------------------------------------------------------------===//
21c93fc11fSTom Stellard // Generic Object File
22c93fc11fSTom Stellard //===----------------------------------------------------------------------===//
23c93fc11fSTom Stellard 
244367c7fbSEric Christopher MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(
256733564eSPeter Collingbourne     const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
261a14bfa0SYaxun Liu   auto AS = static_cast<const AMDGPUTargetMachine*>(&TM)->getAMDGPUAS();
271a14bfa0SYaxun Liu   if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO, AS) &&
2808326b62SKonstantin Zhuravlyov       AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple()))
29c93fc11fSTom Stellard     return TextSection;
30c93fc11fSTom Stellard 
316733564eSPeter Collingbourne   return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM);
32c93fc11fSTom Stellard }
33