Index: include/llvm/Object/RelocVisitor.h
===================================================================
--- include/llvm/Object/RelocVisitor.h
+++ include/llvm/Object/RelocVisitor.h
@@ -139,6 +139,14 @@
           HasError = true;
           return RelocToApply();
         }
+      case Triple::amdgcn:
+        switch (RelocType) {
+        case llvm::ELF::R_AMDGPU_ABS32:
+          return visitELF_AMDGPU_ABS32(R, Value);
+        default:
+          HasError = true;
+          return RelocToApply();
+        }
       default:
         HasError = true;
         return RelocToApply();
@@ -403,6 +411,11 @@
     return RelocToApply(static_cast<uint32_t>(Res), 4);
   }
 
+  RelocToApply visitELF_AMDGPU_ABS32(RelocationRef R, uint64_t Value) {
+    int64_t Addend = getELFAddend(R);
+    return RelocToApply(Value + Addend, 4);
+  }
+
   /// I386 COFF
   RelocToApply visitCOFF_I386_SECREL(RelocationRef R, uint64_t Value) {
     return RelocToApply(static_cast<uint32_t>(Value), /*Width=*/4);
Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
===================================================================
--- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
+++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
@@ -47,6 +47,8 @@
 
   switch (Fixup.getKind()) {
   default: break;
+  case FK_Data_4:
+    return ELF::R_AMDGPU_ABS32;
   case FK_PCRel_4:
     return ELF::R_AMDGPU_REL32;
   }
Index: test/MC/AMDGPU/relocs-abs32.s
===================================================================
--- test/MC/AMDGPU/relocs-abs32.s
+++ test/MC/AMDGPU/relocs-abs32.s
@@ -0,0 +1,298 @@
+; RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s | llvm-readobj -r | FileCheck %s --check-prefix=READOBJ
+; RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
+; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s --check-prefix=DWARFDUMP
+
+; READOBJ: Section (10) .rela.debug_info {
+; READOBJ-NEXT: 0x6 R_AMDGPU_ABS32 .debug_abbrev 0x0
+; READOBJ-NEXT: 0xC R_AMDGPU_ABS32 .debug_str 0x0
+; READOBJ-NEXT: 0x12 R_AMDGPU_ABS32 .debug_str 0x23
+; READOBJ-NEXT: 0x16 R_AMDGPU_ABS32 .debug_line 0x0
+; READOBJ-NEXT: 0x1A R_AMDGPU_ABS32 .debug_str 0x2D
+; READOBJ-NEXT: 0x1E R_AMDGPU_ABS32 .text 0x0
+; READOBJ-NEXT: 0x22 R_AMDGPU_ABS32 .text 0x128
+; READOBJ-NEXT: 0x27 R_AMDGPU_ABS32 .text 0x0
+; READOBJ-NEXT: 0x2B R_AMDGPU_ABS32 .text 0x128
+; READOBJ-NEXT: 0x2F R_AMDGPU_ABS32 .debug_str 0x4B
+; READOBJ-NEXT: 0x38 R_AMDGPU_ABS32 .debug_str 0x52
+; READOBJ-NEXT: 0x49 R_AMDGPU_ABS32 .debug_str 0x54
+; READOBJ-NEXT: }
+
+; READOBJ: Section (14) .rela.debug_pubnames {
+; READOBJ-NEXT: 0x6 R_AMDGPU_ABS32 .debug_info 0x0
+; READOBJ-NEXT: }
+
+; READOBJ: Section (16) .rela.debug_pubtypes {
+; READOBJ-NEXT: 0x6 R_AMDGPU_ABS32 .debug_info 0x0
+; READOBJ-NEXT: }
+
+; READOBJ: Section (20) .rela.debug_line {
+; READOBJ-NEXT: 0x2D R_AMDGPU_ABS32 .text 0x0
+; READOBJ-NEXT: }
+
+; DWARFDUMP: DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000000] = "clang version 3.9.0 (trunk 273560)")
+; DWARFDUMP: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000023] = "relocs.cl")
+; DWARFDUMP: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x0000002d] = "/home/kzhuravl/Lightning/test")
+; DWARFDUMP: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000052] = "A")
+; DWARFDUMP: DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000054] = "int")
+
+	.text
+	.hsa_code_object_version 2,0
+	.hsa_code_object_isa 8,0,3,"AMD","AMDGPU"
+	.section	.AMDGPU.config
+	.text
+	.globl	relocs
+	.p2align	8
+	.type	relocs,@function
+	.amdgpu_hsa_kernel relocs
+relocs:                                 ; @relocs
+.Lfunc_begin0:
+	.file	1 "relocs.cl"
+	.loc	1 1 0                   ; relocs.cl:1:0
+	.amd_kernel_code_t
+		kernel_code_version_major = 1
+		kernel_code_version_minor = 0
+		machine_kind = 1
+		machine_version_major = 8
+		machine_version_minor = 0
+		machine_version_stepping = 3
+		kernel_code_entry_byte_offset = 256
+		kernel_code_prefetch_byte_size = 0
+		max_scratch_backing_memory_byte_size = 0
+		compute_pgm_rsrc1_vgprs = 0
+		compute_pgm_rsrc1_sgprs = 1
+		compute_pgm_rsrc1_priority = 0
+		compute_pgm_rsrc1_float_mode = 192
+		compute_pgm_rsrc1_priv = 0
+		compute_pgm_rsrc1_dx10_clamp = 1
+		compute_pgm_rsrc1_debug_mode = 0
+		compute_pgm_rsrc1_ieee_mode = 0
+		compute_pgm_rsrc2_scratch_en = 0
+		compute_pgm_rsrc2_user_sgpr = 6
+		compute_pgm_rsrc2_tgid_x_en = 1
+		compute_pgm_rsrc2_tgid_y_en = 0
+		compute_pgm_rsrc2_tgid_z_en = 0
+		compute_pgm_rsrc2_tg_size_en = 0
+		compute_pgm_rsrc2_tidig_comp_cnt = 0
+		compute_pgm_rsrc2_excp_en_msb = 0
+		compute_pgm_rsrc2_lds_size = 0
+		compute_pgm_rsrc2_excp_en = 0
+		enable_sgpr_private_segment_buffer = 1
+		enable_sgpr_dispatch_ptr = 0
+		enable_sgpr_queue_ptr = 0
+		enable_sgpr_kernarg_segment_ptr = 1
+		enable_sgpr_dispatch_id = 0
+		enable_sgpr_flat_scratch_init = 0
+		enable_sgpr_private_segment_size = 0
+		enable_sgpr_grid_workgroup_count_x = 0
+		enable_sgpr_grid_workgroup_count_y = 0
+		enable_sgpr_grid_workgroup_count_z = 0
+		enable_ordered_append_gds = 0
+		private_element_size = 1
+		is_ptr64 = 1
+		is_dynamic_callstack = 0
+		is_debug_enabled = 0
+		is_xnack_enabled = 0
+		workitem_private_segment_byte_size = 0
+		workgroup_group_segment_byte_size = 0
+		gds_segment_byte_size = 0
+		kernarg_segment_byte_size = 8
+		workgroup_fbarrier_count = 0
+		wavefront_sgpr_count = 12
+		workitem_vgpr_count = 3
+		reserved_vgpr_first = 0
+		reserved_vgpr_count = 0
+		reserved_sgpr_first = 0
+		reserved_sgpr_count = 0
+		debug_wavefront_private_segment_offset_sgpr = 0
+		debug_private_segment_buffer_sgpr = 0
+		kernarg_segment_alignment = 4
+		group_segment_alignment = 4
+		private_segment_alignment = 4
+		wavefront_size = 6
+		call_convention = 0
+		runtime_loader_kernel_symbol = 0
+	.end_amd_kernel_code_t
+; BB#0:                                 ; %entry
+	s_load_dwordx2 s[0:1], s[4:5], 0x0
+.Ltmp0:
+	.loc	1 2 6 prologue_end      ; relocs.cl:2:6
+	v_mov_b32_e32 v2, 0x7b
+	s_waitcnt lgkmcnt(0)
+	v_mov_b32_e32 v0, s0
+	v_mov_b32_e32 v1, s1
+	flat_store_dword v[0:1], v2
+	.loc	1 3 1                   ; relocs.cl:3:1
+	s_endpgm
+.Ltmp1:
+.Lfunc_end0:
+	.size	relocs, .Lfunc_end0-relocs
+
+	.section	.AMDGPU.csdata
+; Kernel info:
+; codeLenInByte = 36
+; NumSgprs: 12
+; NumVgprs: 3
+; FloatMode: 192
+; IeeeMode: 0
+; ScratchSize: 0
+; LDSByteSize: 0 bytes/workgroup (compile time only)
+; ReservedVGPRFirst: 0
+; ReservedVGPRCount: 0
+; COMPUTE_PGM_RSRC2:USER_SGPR: 6
+; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
+; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
+; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
+; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
+	.section	.debug_str,"MS",@progbits,1
+.Linfo_string0:
+	.asciz	"clang version 3.9.0 (trunk 273560)" ; string offset=0
+.Linfo_string1:
+	.asciz	"relocs.cl"             ; string offset=35
+.Linfo_string2:
+	.asciz	"/home/kzhuravl/Lightning/test" ; string offset=45
+.Linfo_string3:
+	.asciz	"relocs"                ; string offset=75
+.Linfo_string4:
+	.asciz	"A"                     ; string offset=82
+.Linfo_string5:
+	.asciz	"int"                   ; string offset=84
+	.section	.debug_loc
+	.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	1                       ; DW_CHILDREN_yes
+	.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	39                      ; DW_AT_prototyped
+	.byte	12                      ; DW_FORM_flag
+	.byte	63                      ; DW_AT_external
+	.byte	12                      ; DW_FORM_flag
+	.byte	0                       ; EOM(1)
+	.byte	0                       ; EOM(2)
+	.byte	3                       ; Abbreviation Code
+	.byte	5                       ; DW_TAG_formal_parameter
+	.byte	0                       ; DW_CHILDREN_no
+	.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	73                      ; DW_AT_type
+	.byte	19                      ; DW_FORM_ref4
+	.byte	0                       ; EOM(1)
+	.byte	0                       ; EOM(2)
+	.byte	4                       ; Abbreviation Code
+	.byte	15                      ; DW_TAG_pointer_type
+	.byte	0                       ; DW_CHILDREN_no
+	.byte	73                      ; DW_AT_type
+	.byte	19                      ; DW_FORM_ref4
+	.byte	0                       ; EOM(1)
+	.byte	0                       ; EOM(2)
+	.byte	5                       ; Abbreviation Code
+	.byte	36                      ; DW_TAG_base_type
+	.byte	0                       ; DW_CHILDREN_no
+	.byte	3                       ; DW_AT_name
+	.byte	14                      ; DW_FORM_strp
+	.byte	62                      ; DW_AT_encoding
+	.byte	11                      ; DW_FORM_data1
+	.byte	11                      ; DW_AT_byte_size
+	.byte	11                      ; DW_FORM_data1
+	.byte	0                       ; EOM(1)
+	.byte	0                       ; EOM(2)
+	.byte	0                       ; EOM(3)
+	.section	.debug_info
+.Lsection_info:
+.Lcu_begin0:
+	.long	76                      ; 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:0x45 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:0x1d 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_prototyped
+	.byte	1                       ; DW_AT_external
+	.byte	3                       ; Abbrev [3] 0x37:0xb DW_TAG_formal_parameter
+	.long	.Linfo_string4          ; DW_AT_name
+	.byte	1                       ; DW_AT_decl_file
+	.byte	1                       ; DW_AT_decl_line
+	.long	67                      ; DW_AT_type
+	.byte	0                       ; End Of Children Mark
+	.byte	4                       ; Abbrev [4] 0x43:0x5 DW_TAG_pointer_type
+	.long	72                      ; DW_AT_type
+	.byte	5                       ; Abbrev [5] 0x48:0x7 DW_TAG_base_type
+	.long	.Linfo_string5          ; DW_AT_name
+	.byte	5                       ; DW_AT_encoding
+	.byte	4                       ; DW_AT_byte_size
+	.byte	0                       ; End Of Children Mark
+	.section	.debug_ranges
+.Ldebug_range:
+	.section	.debug_macinfo
+.Ldebug_macinfo:
+.Lcu_macro_begin0:
+	.byte	0                       ; End Of Macro List Mark
+	.section	.debug_pubnames
+	.long	.LpubNames_end0-.LpubNames_begin0 ; Length of Public Names Info
+.LpubNames_begin0:
+	.short	2                       ; DWARF Version
+	.long	.Lcu_begin0             ; Offset of Compilation Unit Info
+	.long	80                      ; Compilation Unit Length
+	.long	38                      ; DIE offset
+	.asciz	"relocs"                ; External Name
+	.long	0                       ; End Mark
+.LpubNames_end0:
+	.section	.debug_pubtypes
+	.long	.LpubTypes_end0-.LpubTypes_begin0 ; Length of Public Types Info
+.LpubTypes_begin0:
+	.short	2                       ; DWARF Version
+	.long	.Lcu_begin0             ; Offset of Compilation Unit Info
+	.long	80                      ; Compilation Unit Length
+	.long	72                      ; DIE offset
+	.asciz	"int"                   ; External Name
+	.long	0                       ; End Mark
+.LpubTypes_end0:
+
+	.ident	"clang version 3.9.0 (trunk 273560)"
+	.section	".note.GNU-stack"
+	.section	.debug_line
+.Lline_table_start0: