summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2017-12-14 18:46:43 +0000
committerPaul Robinson <paul.robinson@sony.com>2017-12-14 18:46:43 +0000
commita1cedd6c46705aac4d78e827c6ca6a365fbafa32 (patch)
treebeec847e4f92a549d851c98cf2f2b3bcc7c3cb22
parent5b0d5b45a241a9563d1075fa8e66be941b96443b (diff)
downloadbcm5719-llvm-a1cedd6c46705aac4d78e827c6ca6a365fbafa32.tar.gz
bcm5719-llvm-a1cedd6c46705aac4d78e827c6ca6a365fbafa32.zip
[MC] Allow .file directives to be out-of-order
llvm-svn: 320727
-rw-r--r--llvm/lib/MC/MCDwarf.cpp3
-rw-r--r--llvm/test/MC/MachO/loc.s20
2 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index bda0ec14599..9e5d9ff73c7 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -435,7 +435,8 @@ unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory,
return IterBool.first->second;
}
// Make space for this FileNumber in the MCDwarfFiles vector if needed.
- MCDwarfFiles.resize(FileNumber + 1);
+ if (FileNumber >= MCDwarfFiles.size())
+ MCDwarfFiles.resize(FileNumber + 1);
// Get the new MCDwarfFile slot for this FileNumber.
MCDwarfFile &File = MCDwarfFiles[FileNumber];
diff --git a/llvm/test/MC/MachO/loc.s b/llvm/test/MC/MachO/loc.s
index c1a2edd6090..b3f1c2a875e 100644
--- a/llvm/test/MC/MachO/loc.s
+++ b/llvm/test/MC/MachO/loc.s
@@ -1,7 +1,7 @@
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -r -s -sd | FileCheck %s
-
- .file 1 "foo"
- .loc 1 64 0
+ .file 2 "foo"
+ .file 1 "bar"
+ .loc 2 64 0
nop
// CHECK: Section {
@@ -9,10 +9,10 @@
// CHECK: Name: __debug_line (5F 5F 64 65 62 75 67 5F 6C 69 6E 65 00 00 00 00)
// CHECK: Segment: __DWARF (5F 5F 44 57 41 52 46 00 00 00 00 00 00 00 00 00)
// CHECK: Address: 0x1
-// CHECK: Size: 0x33
+// CHECK: Size: 0x3C
// CHECK: Offset: 237
// CHECK: Alignment: 0
-// CHECK: RelocationOffset: 0x120
+// CHECK: RelocationOffset: 0x12C
// CHECK: RelocationCount: 1
// CHECK: Type: 0x0
// CHECK: Attributes [ (0x20000)
@@ -21,15 +21,15 @@
// CHECK: Reserved1: 0x0
// CHECK: Reserved2: 0x0
// CHECK: SectionData (
-// CHECK: 0000: 2F000000 02001A00 00000101 FB0E0D00 |/...............|
-// CHECK: 0010: 01010101 00000001 00000100 666F6F00 |............foo.|
-// CHECK: 0020: 00000000 00050200 00000003 3F010201 |............?...|
-// CHECK: 0030: 000101 |...|
+// CHECK: 0000: 38000000 02002100 00000101 FB0E0D00 |8.....!.........|
+// CHECK: 0010: 01010101 00000001 00000100 62617200 |............bar.|
+// CHECK: 0020: 00000066 6F6F0000 00000004 02000502 |...foo..........|
+// CHECK: 0030: 00000000 033F0102 01000101 |.....?......|
// CHECK: )
// CHECK: }
// CHECK: ]
// CHECK: Relocations [
// CHECK: Section __debug_line {
-// CHECK: 0x27 0 2 0 GENERIC_RELOC_VANILLA 0 __text
+// CHECK: 0x30 0 2 0 GENERIC_RELOC_VANILLA 0 __text
// CHECK: }
// CHECK: ]
OpenPOWER on IntegriCloud