[llvm] r207941 - MC: support FK_SecRel_4 for Windows on ARM
Saleem Abdulrasool
compnerd at compnerd.org
Sun May 4 16:13:15 PDT 2014
Author: compnerd
Date: Sun May 4 18:13:15 2014
New Revision: 207941
URL: http://llvm.org/viewvc/llvm-project?rev=207941&view=rev
Log:
MC: support FK_SecRel_4 for Windows on ARM
Add handling for FK_SecRel_4 (4-byte section relative relocations). These are
used by the generation of DWARF debug information (the abbrevations use section
relative relocations). This will also be used in generation of CodeView line
tables.
Added:
llvm/trunk/test/MC/ARM/coff-debugging-secrel.ll
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=207941&r1=207940&r2=207941&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Sun May 4 18:13:15 2014
@@ -316,6 +316,8 @@ static unsigned adjustFixupValue(const M
case FK_Data_2:
case FK_Data_4:
return Value;
+ case FK_SecRel_4:
+ return Value;
case ARM::fixup_arm_movt_hi16:
if (!IsPCRel)
Value >>= 16;
@@ -662,6 +664,9 @@ static unsigned getFixupKindNumBytes(uns
case ARM::fixup_t2_movt_hi16:
case ARM::fixup_t2_movw_lo16:
return 4;
+
+ case FK_SecRel_4:
+ return 4;
}
}
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp?rev=207941&r1=207940&r2=207941&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp Sun May 4 18:13:15 2014
@@ -49,6 +49,8 @@ unsigned ARMWinCOFFObjectWriter::getRelo
default:
return COFF::IMAGE_REL_ARM_ADDR32;
}
+ case FK_SecRel_4:
+ return COFF::IMAGE_REL_ARM_SECREL;
case ARM::fixup_t2_condbranch:
return COFF::IMAGE_REL_ARM_BRANCH20T;
case ARM::fixup_t2_uncondbranch:
Added: llvm/trunk/test/MC/ARM/coff-debugging-secrel.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/coff-debugging-secrel.ll?rev=207941&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/coff-debugging-secrel.ll (added)
+++ llvm/trunk/test/MC/ARM/coff-debugging-secrel.ll Sun May 4 18:13:15 2014
@@ -0,0 +1,41 @@
+; RUN: llc -mtriple thumbv7--windows-itanium -filetype obj -o - %s \
+; RUN: | llvm-readobj -r - | FileCheck %s
+
+; ModuleID = '/Users/compnerd/work/llvm/test/MC/ARM/reduced.c'
+target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbv7--windows-itanium"
+
+define arm_aapcs_vfpcc void @function() {
+entry:
+ ret void, !dbg !0
+}
+
+!llvm.dbg.cu = !{!7}
+!llvm.module.flags = !{!9, !10}
+
+!0 = metadata !{i32 1, i32 0, metadata !1, null}
+!1 = metadata !{i32 786478, metadata !2, metadata !3, metadata !"function", metadata !"function", metadata !"", i32 1, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, void ()* @function, null, null, metadata !6, i32 1} ; [ DW_TAG_subprogram ], [line 1], [def], [function]
+!2 = metadata !{metadata !"/Users/compnerd/work/llvm/test/MC/ARM/reduced.c", metadata !"/Users/compnerd/work/llvm"}
+!3 = metadata !{i32 786473, metadata !2} ; [ DW_TAG_file_type] [/Users/compnerd/work/llvm/test/MC/ARM/reduced.c]
+!4 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ], [line 0, size 0, align 0, offset 0] [from ]
+!5 = metadata !{null}
+!6 = metadata !{}
+!7 = metadata !{i32 786449, metadata !2, i32 12, metadata !"clang version 3.5.0", i1 false, metadata !"", i32 0, metadata !6, metadata !6, metadata !8, metadata !6, metadata !6, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/Users/compnerd/work/llvm/test/MC/ARM/reduced.c] [DW_LANG_C99]
+!8 = metadata !{metadata !1}
+!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
+
+; CHECK: Relocations [
+; CHECK: Section {{.*}} .debug_info {
+; CHECK: 0x6 IMAGE_REL_ARM_SECREL .debug_abbrev
+; CHECK: 0xC IMAGE_REL_ARM_SECREL .debug_str
+; CHECK: 0x12 IMAGE_REL_ARM_SECREL .debug_str
+; CHECK: 0x16 IMAGE_REL_ARM_SECREL .debug_line
+; CHECK: 0x1A IMAGE_REL_ARM_SECREL .debug_str
+; CHECK: 0x27 IMAGE_REL_ARM_SECREL .debug_str
+; CHECK: }
+; CHECK: Section {{.*}}.debug_pubnames {
+; CHECK: 0x6 IMAGE_REL_ARM_SECREL .debug_info
+; CHECK: }
+; CHECK: ]
+
More information about the llvm-commits
mailing list