Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -1428,6 +1428,7 @@ void AMDGPUTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { switch (Type) { + case R_AMDGPU_ABS32: case R_AMDGPU_GOTPCREL: case R_AMDGPU_REL32: write32le(Loc, Val); @@ -1439,6 +1440,8 @@ RelExpr AMDGPUTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const { switch (Type) { + case R_AMDGPU_ABS32: + return R_ABS; case R_AMDGPU_REL32: return R_PC; case R_AMDGPU_GOTPCREL: Index: test/ELF/amdgpu-elf64-dwarf-relocs.s =================================================================== --- test/ELF/amdgpu-elf64-dwarf-relocs.s +++ test/ELF/amdgpu-elf64-dwarf-relocs.s @@ -0,0 +1,109 @@ +# REQUIRES: amdgpu + +# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s --check-prefix=DWARFDUMP + +# DWARFDUMP: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 3.9.0 (trunk 274858)") +# DWARFDUMP: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000023] = "amdgpu-elf64-dwarf-relocs.cl") +# DWARFDUMP: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000040] = "/home/kzhuravl/Git/Lightning/test") +# DWARFDUMP: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000062] = "amdgpu_elf64_dwarf_relocs") +# DWARFDUMP: DW_AT_decl_file [DW_FORM_data1] ("/home/kzhuravl/Git/Lightning/test/amdgpu-elf64-dwarf-relocs.cl") + +amdgpu_elf64_dwarf_relocs: +.Lfunc_begin0: + .file 1 "amdgpu-elf64-dwarf-relocs.cl" + .loc 1 1 0 + .loc 1 1 42 prologue_end + s_endpgm +.Lfunc_end0: + .size amdgpu_elf64_dwarf_relocs, .Lfunc_end0-amdgpu_elf64_dwarf_relocs + +.section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 3.9.0 (trunk 274858)" ; string offset=0 +.Linfo_string1: + .asciz "amdgpu-elf64-dwarf-relocs.cl" ; string offset=35 +.Linfo_string2: + .asciz "/home/kzhuravl/Git/Lightning/test" ; string offset=64 +.Linfo_string3: + .asciz "amdgpu_elf64_dwarf_relocs" ; string offset=98 + +.section .debug_abbrev +.Lsection_abbrev: + .byte 1 ; Abbreviation Code + .byte 17 ; DW_TAG_compile_unit + .byte 1 ; DW_CHILDREN_yes + .byte 37 ; DW_AT_producer + .byte 14 ; DW_FORM_strp + .byte 19 ; DW_AT_language + .byte 5 ; DW_FORM_data2 + .byte 3 ; DW_AT_name + .byte 14 ; DW_FORM_strp + .byte 16 ; DW_AT_stmt_list + .byte 6 ; DW_FORM_data4 + .byte 27 ; DW_AT_comp_dir + .byte 14 ; DW_FORM_strp + .byte 17 ; DW_AT_low_pc + .byte 1 ; DW_FORM_addr + .byte 18 ; DW_AT_high_pc + .byte 1 ; DW_FORM_addr + .byte 0 ; EOM(1) + .byte 0 ; EOM(2) + .byte 2 ; Abbreviation Code + .byte 46 ; DW_TAG_subprogram + .byte 0 ; DW_CHILDREN_no + .byte 17 ; DW_AT_low_pc + .byte 1 ; DW_FORM_addr + .byte 18 ; DW_AT_high_pc + .byte 1 ; DW_FORM_addr + .byte 3 ; DW_AT_name + .byte 14 ; DW_FORM_strp + .byte 58 ; DW_AT_decl_file + .byte 11 ; DW_FORM_data1 + .byte 59 ; DW_AT_decl_line + .byte 11 ; DW_FORM_data1 + .byte 63 ; DW_AT_external + .byte 12 ; DW_FORM_flag + .byte 0 ; EOM(1) + .byte 0 ; EOM(2) + .byte 0 ; EOM(3) + +.section .debug_info +.Lsection_info: +.Lcu_begin0: + .long 51 ; Length of Unit + .short 2 ; DWARF version number + .long .Lsection_abbrev ; Offset Into Abbrev. Section + .byte 4 ; Address Size (in bytes) + .byte 1 ; Abbrev [1] 0xb:0x2c DW_TAG_compile_unit + .long .Linfo_string0 ; DW_AT_producer + .short 12 ; DW_AT_language + .long .Linfo_string1 ; DW_AT_name + .long .Lline_table_start0 ; DW_AT_stmt_list + .long .Linfo_string2 ; DW_AT_comp_dir + .long .Lfunc_begin0 ; DW_AT_low_pc + .long .Lfunc_end0 ; DW_AT_high_pc + .byte 2 ; Abbrev [2] 0x26:0x10 DW_TAG_subprogram + .long .Lfunc_begin0 ; DW_AT_low_pc + .long .Lfunc_end0 ; DW_AT_high_pc + .long .Linfo_string3 ; DW_AT_name + .byte 1 ; DW_AT_decl_file + .byte 1 ; DW_AT_decl_line + .byte 1 ; DW_AT_external + .byte 0 ; End Of Children Mark +.Lcu_macro_begin0: + .byte 0 + .section .debug_pubnames + .long .LpubNames_end0-.LpubNames_begin0 +.LpubNames_begin0: + .short 2 + .long .Lcu_begin0 + .long 55 + .long 38 + .asciz "amdgpu_elf64_dwarf_relocs" + .long 0 +.LpubNames_end0: + +.section .debug_line +.Lline_table_start0: