2015-09-25 23:41:28 +02:00
|
|
|
//===-- AMDGPUHSATargetObjectFile.cpp - AMDGPU Object Files ---------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-09-25 23:41:28 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-12-10 03:13:01 +01:00
|
|
|
#include "AMDGPUTargetObjectFile.h"
|
2017-06-06 13:49:48 +02:00
|
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
2020-12-25 16:52:14 +01:00
|
|
|
#include "llvm/IR/GlobalObject.h"
|
|
|
|
#include "llvm/MC/SectionKind.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2015-09-25 23:41:28 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2015-12-10 03:13:01 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generic Object File
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-09-16 09:33:15 +02:00
|
|
|
MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(
|
2016-10-24 21:23:39 +02:00
|
|
|
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
|
2017-11-01 20:12:38 +01:00
|
|
|
if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO) &&
|
2016-10-20 20:12:38 +02:00
|
|
|
AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple()))
|
2015-12-10 03:13:01 +01:00
|
|
|
return TextSection;
|
|
|
|
|
2016-10-24 21:23:39 +02:00
|
|
|
return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM);
|
2015-12-10 03:13:01 +01:00
|
|
|
}
|
[AMDGPU] Set metadata access for explicit section
Summary:
This patch provides a means to set Metadata section kind
for a global variable, if its explicit section name is
prefixed with ".AMDGPU.metadata."
This could be useful to make the global variable go to
an ELF section without any section flags set.
Reviewers: dstuttard, tpr, kzhuravl, nhaehnle, t-tye
Reviewed By: dstuttard, kzhuravl
Subscribers: llvm-commits, arsenm, jvesely, wdng, yaxunl, t-tye
Differential Revision: https://reviews.llvm.org/D55267
llvm-svn: 348922
2018-12-12 12:20:04 +01:00
|
|
|
|
|
|
|
MCSection *AMDGPUTargetObjectFile::getExplicitSectionGlobal(
|
|
|
|
const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
|
|
|
|
// Set metadata access for the explicit section
|
|
|
|
StringRef SectionName = GO->getSection();
|
[AMDGPU] Change section name with metadata access
Summary:
The commit rL348922 introduced a means to set Metadata
section kind for a global variable, if its explicit section
name was prefixed with ".AMDGPU.metadata.".
This patch changes that prefix to ".AMDGPU.comment.",
as "metadata" in the section name might lead to
ambiguity with metadata used by AMD PAL runtime.
Change-Id: Idd4748800d6fe801441d91595fc21e5a4171e668
Reviewers: kzhuravl
Reviewed By: kzhuravl
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D56197
llvm-svn: 350292
2019-01-03 12:22:58 +01:00
|
|
|
if (SectionName.startswith(".AMDGPU.comment."))
|
[AMDGPU] Set metadata access for explicit section
Summary:
This patch provides a means to set Metadata section kind
for a global variable, if its explicit section name is
prefixed with ".AMDGPU.metadata."
This could be useful to make the global variable go to
an ELF section without any section flags set.
Reviewers: dstuttard, tpr, kzhuravl, nhaehnle, t-tye
Reviewed By: dstuttard, kzhuravl
Subscribers: llvm-commits, arsenm, jvesely, wdng, yaxunl, t-tye
Differential Revision: https://reviews.llvm.org/D55267
llvm-svn: 348922
2018-12-12 12:20:04 +01:00
|
|
|
SK = SectionKind::getMetadata();
|
|
|
|
|
|
|
|
return TargetLoweringObjectFileELF::getExplicitSectionGlobal(GO, SK, TM);
|
|
|
|
}
|