Index: lib/ReaderWriter/ELF/Atoms.cpp =================================================================== --- lib/ReaderWriter/ELF/Atoms.cpp +++ lib/ReaderWriter/ELF/Atoms.cpp @@ -82,7 +82,7 @@ return _section->sh_type == SHT_NOBITS ? typeThreadZeroFill : typeThreadData; - if (_section->sh_flags == SHF_ALLOC && _section->sh_type == SHT_PROGBITS) + if ((_section->sh_flags & ~SHF_MASKOS) == SHF_ALLOC && _section->sh_type == SHT_PROGBITS) return _contentType = typeConstant; if (_symbol->getType() == STT_GNU_IFUNC) return _contentType = typeResolver; Index: test/elf/AMDGPU/hsa-symbols.test =================================================================== --- test/elf/AMDGPU/hsa-symbols.test +++ test/elf/AMDGPU/hsa-symbols.test @@ -3,11 +3,19 @@ # RUN: llvm-readobj -h -program-headers -s -symbols %t.exe | FileCheck %s # CHECK: Symbol { +# CHECK: Name: readonly_agent +# CHECK: Binding: Local +# CHECK: Type: Object +# CHECK: Section: .hsarodata_readonly_agent +# CHECK: } + +# CHECK: Symbol { # CHECK: Name: global_agent # CHECK: Binding: Local # CHECK: Type: Object # CHECK: Section: .hsadata_global_agent # CHECK: } + --- FileHeader: Class: ELFCLASS64 @@ -22,9 +30,19 @@ SHF_AMDGPU_HSA_AGENT ] AddressAlign: 0x0000000000000004 Content: '' + + - Name: .hsarodata_readonly_agent + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_AMDGPU_HSA_AGENT, SHF_AMDGPU_HSA_READONLY ] + Content: 'abcd' + Symbols: Local: - Name: global_agent Type: STT_OBJECT Section: .hsadata_global_agent + + - Name: readonly_agent + Type: STT_OBJECT + Section: .hsarodata_readonly_agent ...