diff --git a/lld/ELF/Arch/AMDGPU.cpp b/lld/ELF/Arch/AMDGPU.cpp --- a/lld/ELF/Arch/AMDGPU.cpp +++ b/lld/ELF/Arch/AMDGPU.cpp @@ -114,6 +114,7 @@ case ELFABIVERSION_AMDGPU_HSA_V3: return calcEFlagsV3(); case ELFABIVERSION_AMDGPU_HSA_V4: + case ELFABIVERSION_AMDGPU_HSA_V5: return calcEFlagsV4(); default: error("unknown abi version: " + Twine(abiVersion)); diff --git a/lld/test/ELF/amdgpu-abi-version.s b/lld/test/ELF/amdgpu-abi-version.s --- a/lld/test/ELF/amdgpu-abi-version.s +++ b/lld/test/ELF/amdgpu-abi-version.s @@ -1,10 +1,24 @@ # REQUIRES: amdgpu # RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=3 -filetype=obj %s -o %t.o # RUN: ld.lld -shared %t.o -o %t.so -# RUN: llvm-readobj --file-headers %t.so | FileCheck %s +# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=COV3 %s -# CHECK: OS/ABI: AMDGPU_HSA (0x40) -# CHECK: ABIVersion: 1 +# COV3: OS/ABI: AMDGPU_HSA (0x40) +# COV3: ABIVersion: 1 + +# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 -filetype=obj %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=COV4 %s + +# COV4: OS/ABI: AMDGPU_HSA (0x40) +# COV4: ABIVersion: 2 + +# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 -filetype=obj %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=COV5 %s + +# COV5: OS/ABI: AMDGPU_HSA (0x40) +# COV5: ABIVersion: 3 .text s_nop 0x0