[PATCH] D30750: Rename PT_NOTE namespace name used in AMDGPUPTNote.h
Guansong Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 10:53:14 PST 2017
guansong created this revision.
Herald added subscribers: tpr, dstuttard, nhaehnle, wdng, arsenm.
On Ubuntu 14.04, PT_NOTE is #defined in elf.h.
This causes potential confusion for compilation if code uses PT_NOTE from AMDGPUNote.h and also include the elf header, even you qualify the usage with AMDGPU::PT_NOTE.
https://reviews.llvm.org/D30750
Files:
lib/Target/AMDGPU/AMDGPUPTNote.h
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
@@ -85,7 +85,7 @@
class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer {
MCStreamer &Streamer;
- void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::PT_NOTE::NoteType Type,
+ void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::AMD_PT_NOTE::NoteType Type,
function_ref<void(MCELFStreamer &)> EmitDesc);
public:
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -125,20 +125,20 @@
}
void AMDGPUTargetELFStreamer::EmitAMDGPUNote(
- const MCExpr *DescSZ, PT_NOTE::NoteType Type,
+ const MCExpr *DescSZ, AMD_PT_NOTE::NoteType Type,
function_ref<void(MCELFStreamer &)> EmitDesc) {
auto &S = getStreamer();
auto &Context = S.getContext();
- auto NameSZ = sizeof(PT_NOTE::NoteName);
+ auto NameSZ = sizeof(AMD_PT_NOTE::NoteName);
S.PushSection();
S.SwitchSection(Context.getELFSection(
- PT_NOTE::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
+ AMD_PT_NOTE::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
S.EmitIntValue(NameSZ, 4); // namesz
S.EmitValue(DescSZ, 4); // descz
S.EmitIntValue(Type, 4); // type
- S.EmitBytes(StringRef(PT_NOTE::NoteName, NameSZ)); // name
+ S.EmitBytes(StringRef(AMD_PT_NOTE::NoteName, NameSZ)); // name
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
EmitDesc(S); // desc
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
@@ -151,7 +151,7 @@
EmitAMDGPUNote(
MCConstantExpr::create(8, getContext()),
- PT_NOTE::NT_AMDGPU_HSA_CODE_OBJECT_VERSION,
+ AMD_PT_NOTE::NT_AMDGPU_HSA_CODE_OBJECT_VERSION,
[&](MCELFStreamer &OS){
OS.EmitIntValue(Major, 4);
OS.EmitIntValue(Minor, 4);
@@ -174,7 +174,7 @@
EmitAMDGPUNote(
MCConstantExpr::create(DescSZ, getContext()),
- PT_NOTE::NT_AMDGPU_HSA_ISA,
+ AMD_PT_NOTE::NT_AMDGPU_HSA_ISA,
[&](MCELFStreamer &OS) {
OS.EmitIntValue(VendorNameSize, 2);
OS.EmitIntValue(ArchNameSize, 2);
@@ -240,7 +240,7 @@
EmitAMDGPUNote(
DescSZ,
- PT_NOTE::NT_AMDGPU_HSA_RUNTIME_METADATA,
+ AMD_PT_NOTE::NT_AMDGPU_HSA_RUNTIME_METADATA,
[&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin);
OS.EmitBytes(VerifiedMetadata.get());
Index: lib/Target/AMDGPU/AMDGPUPTNote.h
===================================================================
--- lib/Target/AMDGPU/AMDGPUPTNote.h
+++ lib/Target/AMDGPU/AMDGPUPTNote.h
@@ -19,7 +19,7 @@
namespace AMDGPU {
-namespace PT_NOTE {
+namespace AMD_PT_NOTE {
const char SectionName[] = ".note";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30750.91052.patch
Type: text/x-patch
Size: 3101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170308/db22ce72/attachment.bin>
More information about the llvm-commits
mailing list