diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/rel24-non-zero-addend.yaml b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/rel24-non-zero-addend.yaml new file mode 100644 index 0000000000000..6e0ffe741606f --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/rel24-non-zero-addend.yaml @@ -0,0 +1,192 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_PPC64 + Flags: [ ] + SectionHeaderStringTable: .strtab +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x10 + Content: 00004C3C000042380000623C000063E8000063802000804E00000000000000000000000000000060000000600000006000004C3C00004238A602087CE1FF21F8300001F80100004820002138100001E8A603087C2000804E00000000000000000000000000000060000000600000006000004C3C00004238A602087CE1FF21F8300001F80100004820002138100001E8A603087C2000804E000000000000000000000000 + - Name: .text.startup + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x10 + Content: 00004C3C000042380000623C00008038000063E8000083902000804E00000000000000000000000000000060000000602000804E000000000000000000000000 + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x4 + Content: '01000000' + - Name: .note.GNU-stack + Type: SHT_PROGBITS + AddressAlign: 0x1 + - Name: .toc + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x8 + Content: '0000000000000000' + - Name: .eh_frame + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x8 + Content: 1000000000000000017A5200047841011B0C01001000000018000000000000002800000000000000100000002C0000000000000010000000000000001400000040000000000000003400000000450E2011417E001800000058000000000000003400000000450E2011417E0000000000 + - Name: .rela.text + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x8 + Info: .text + Relocations: + - Symbol: .TOC. + Type: R_PPC64_REL16_HA + - Offset: 0x4 + Symbol: .TOC. + Type: R_PPC64_REL16_LO + Addend: 4 + - Offset: 0x8 + Symbol: .toc + Type: R_PPC64_TOC16_HA + - Offset: 0xC + Symbol: .toc + Type: R_PPC64_TOC16_LO_DS + - Offset: 0x30 + Symbol: .TOC. + Type: R_PPC64_REL16_HA + - Offset: 0x34 + Symbol: .TOC. + Type: R_PPC64_REL16_LO + Addend: 4 + - Offset: 0x44 + Symbol: ctor_func + Type: R_PPC64_REL24 + - Offset: 0x70 + Symbol: .TOC. + Type: R_PPC64_REL16_HA + - Offset: 0x74 + Symbol: .TOC. + Type: R_PPC64_REL16_LO + Addend: 4 + - Offset: 0x84 + Symbol: .text.startup + Type: R_PPC64_REL24 + Addend: 48 + - Name: .rela.text.startup + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x8 + Info: .text.startup + Relocations: + - Symbol: .TOC. + Type: R_PPC64_REL16_HA + - Offset: 0x4 + Symbol: .TOC. + Type: R_PPC64_REL16_LO + Addend: 4 + - Offset: 0x8 + Symbol: .toc + Type: R_PPC64_TOC16_HA + - Offset: 0x10 + Symbol: .toc + Type: R_PPC64_TOC16_LO_DS + - Name: .rela.toc + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x8 + Info: .toc + Relocations: + - Symbol: var + Type: R_PPC64_ADDR64 + - Name: .rela.eh_frame + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x8 + Info: .eh_frame + Relocations: + - Offset: 0x1C + Symbol: .text.startup + Type: R_PPC64_REL32 + - Offset: 0x30 + Symbol: .text.startup + Type: R_PPC64_REL32 + Addend: 48 + - Offset: 0x44 + Symbol: .text + Type: R_PPC64_REL32 + Addend: 48 + - Offset: 0x5C + Symbol: .text + Type: R_PPC64_REL32 + Addend: 112 + - Type: SectionHeaderTable + Sections: + - Name: .strtab + - Name: .text + - Name: .rela.text + - Name: .text.startup + - Name: .rela.text.startup + - Name: .data + - Name: .note.GNU-stack + - Name: .toc + - Name: .rela.toc + - Name: .eh_frame + - Name: .rela.eh_frame + - Name: .symtab +Symbols: + - Name: test-global-ctors.ll + Type: STT_FILE + Index: SHN_ABS + - Name: .text + Type: STT_SECTION + Section: .text + - Name: .text.startup + Type: STT_SECTION + Section: .text.startup + - Name: ctor_func + Type: STT_FUNC + Section: .text.startup + Size: 0x28 + Other: [ 96 ] + - Name: dtor_func + Type: STT_FUNC + Section: .text.startup + Value: 0x30 + Size: 0x10 + - Name: .toc + Type: STT_SECTION + Section: .toc + - Name: main + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Size: 0x24 + Other: [ 96 ] + - Name: .TOC. + Binding: STB_GLOBAL + - Name: __orc_init_func.test-global-ctors.ll + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x30 + Size: 0x34 + Other: [ STV_HIDDEN, 96 ] + - Name: __orc_deinit_func.test-global-ctors.ll + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x70 + Size: 0x34 + Other: [ STV_HIDDEN, 96 ] + - Name: var + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Size: 0x4 +... diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/ppc64-rel24-non-zero-addend.test b/llvm/test/ExecutionEngine/JITLink/ppc64/ppc64-rel24-non-zero-addend.test new file mode 100644 index 0000000000000..6ee7ba407f935 --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/ppc64-rel24-non-zero-addend.test @@ -0,0 +1,7 @@ +# REQUIRES: asserts +# RUN: yaml2obj %S/Inputs/rel24-non-zero-addend.yaml -o %t.o +# RUN: not --crash llvm-jitlink -noexec %t.o 2>&1 | FileCheck %s +# CHECK: Addend == 0 && "Addend is expected to be 0 for a function call" +# +# The object is generated from llvm/test/ExecutionEngine/MCJIT/test-global-ctors.ll, +# containing an R_PPC64_REL24 whose addend is not zero.