Skip to content

Commit 18560f1

Browse files
committed
[AMDGPU] Mark .note section SHF_ALLOC so lld creates a segment for it
Differential Revision: https://reviews.llvm.org/D25694 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284435 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fd7d73f commit 18560f1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ void
9797
AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectVersion(uint32_t Major,
9898
uint32_t Minor) {
9999
MCStreamer &OS = getStreamer();
100-
MCSectionELF *Note = OS.getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
100+
MCSectionELF *Note =
101+
OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
101102

102103
unsigned NameSZ = 4;
103104

@@ -120,7 +121,8 @@ AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(uint32_t Major,
120121
StringRef VendorName,
121122
StringRef ArchName) {
122123
MCStreamer &OS = getStreamer();
123-
MCSectionELF *Note = OS.getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
124+
MCSectionELF *Note =
125+
OS.getContext().getELFSection(".note", ELF::SHT_NOTE, ELF::SHF_ALLOC);
124126

125127
unsigned NameSZ = 4;
126128
uint16_t VendorNameSize = VendorName.size() + 1;

test/CodeGen/AMDGPU/hsa.ll

+5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@
1717
; ELF: }
1818

1919
; ELF: SHT_NOTE
20+
; ELF: Flags [ (0x2)
21+
; ELF: SHF_ALLOC (0x2)
22+
; ELF: ]
23+
; ELF: SectionData (
2024
; ELF: 0000: 04000000 08000000 01000000 414D4400
2125
; ELF: 0010: 02000000 01000000 04000000 1B000000
2226
; ELF: 0020: 03000000 414D4400 04000700 07000000
2327
; ELF: 0030: 00000000 00000000 414D4400 414D4447
2428
; ELF: 0040: 50550000
29+
; ELF: )
2530

2631
; ELF: Symbol {
2732
; ELF: Name: simple

0 commit comments

Comments
 (0)