[llvm] r188925 - MC CFG: Remap enough for data too, analoguous to r188873.

Ahmed Bougacha ahmed.bougacha at gmail.com
Wed Aug 21 12:40:28 PDT 2013


Author: ab
Date: Wed Aug 21 14:40:28 2013
New Revision: 188925

URL: http://llvm.org/viewvc/llvm-project?rev=188925&view=rev
Log:
MC CFG: Remap enough for data too, analoguous to r188873.

Added:
    llvm/trunk/test/Object/X86/objdump-cfg-invalid-opcode.yaml
Modified:
    llvm/trunk/lib/MC/MCAtom.cpp

Modified: llvm/trunk/lib/MC/MCAtom.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAtom.cpp?rev=188925&r1=188924&r2=188925&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAtom.cpp (original)
+++ llvm/trunk/lib/MC/MCAtom.cpp Wed Aug 21 14:40:28 2013
@@ -44,7 +44,7 @@ void MCAtom::remapForSplit(uint64_t Spli
 
 void MCDataAtom::addData(const MCData &D) {
   Data.push_back(D);
-  if (Data.size() > Begin - End)
+  if (Data.size() > Begin - End - 1)
     remap(Begin, End + 1);
 }
 

Added: llvm/trunk/test/Object/X86/objdump-cfg-invalid-opcode.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/objdump-cfg-invalid-opcode.yaml?rev=188925&view=auto
==============================================================================
--- llvm/trunk/test/Object/X86/objdump-cfg-invalid-opcode.yaml (added)
+++ llvm/trunk/test/Object/X86/objdump-cfg-invalid-opcode.yaml Wed Aug 21 14:40:28 2013
@@ -0,0 +1,48 @@
+# RUN: yaml2obj -format=elf %s | llvm-objdump -d -yaml-cfg=%t - && FileCheck --check-prefix=CFG < %t %s
+# REQUIRES: shell
+#
+# Generated from:
+# main:
+# .LBL0_1:
+# 	movq	8(%rsi), %rax
+# 	<invalid opcode: 06>
+
+!ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data: ELFDATA2LSB
+  Type: ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name: .text
+    Type: SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+    Content: "488B460806"
+
+## 0000000000000000 <main>:
+
+#CFG: Atoms:
+#CFG:   - StartAddress:    0x0000000000000000
+#CFG:     Size:            4
+#CFG:     Type:            Text
+
+##    0:   48 8b 46 08             mov    0x8(%rsi),%rax
+#CFG:       - Inst:            MOV64rm
+#CFG:         Size:            4
+#CFG:         Ops:             [ RRAX, RRSI, I1, R, I8, R ]
+
+
+#CFG:   - StartAddress:    0x0000000000000004
+#CFG:     Size:            1
+#CFG:     Type:            Data
+
+##    4:   06                      (bad)
+#CFG:     Content:         06
+
+Symbols:
+  Global:
+    - Name: main
+      Type: STT_FUNC
+      Section: .text
+      Value: 0x0
+      Size: 5





More information about the llvm-commits mailing list