Skip to content

Commit

Permalink
test/COFF: Fix symbol indexes and names. Update tests to match.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115642 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Bigcheese committed Oct 5, 2010
1 parent f191d12 commit a25c0a4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
10 changes: 5 additions & 5 deletions test/MC/COFF/basic-coff.ll
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 2
; CHECK: Type = IMAGE_REL_I386_DIR32 (6)
; CHECK: SymbolName =
; CHECK: SymbolName = .data
; CHECK: }
; CHECK: 1 = {
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 5
; CHECK: Type = IMAGE_REL_I386_REL32 (20)
; CHECK: SymbolName = _main
; CHECK: SymbolName = _printf
; CHECK: }
; CHECK: ]
; CHECK: }
Expand Down Expand Up @@ -87,7 +87,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: 15 00 00 00 02 00 00 00 - 00 00 00 00 01 00 00 00 |................|
; CHECK: 00 00 |..|
; CHECK: }
; CHECK: 1 = {
; CHECK: 2 = {
; CHECK: Name = .data
; CHECK: Value = 0
; CHECK: SectionNumber = 2
Expand All @@ -99,7 +99,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: 0C 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |................|
; CHECK: 00 00 |..|
; CHECK: }
; CHECK: 2 = {
; CHECK: 4 = {
; CHECK: Name = _main
; CHECK: Value = 0
; CHECK: SectionNumber = 1
Expand All @@ -109,7 +109,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
; CHECK: NumberOfAuxSymbols = 0
; CHECK: AuxillaryData =
; CHECK: }
; CHECK: 3 = {
; CHECK: 5 = {
; CHECK: Name = _printf
; CHECK: Value = 0
; CHECK: SectionNumber = 0
Expand Down
18 changes: 9 additions & 9 deletions test/MC/COFF/symbol-fragment-offset.ll
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,25 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 2
; CHECK: Type = IMAGE_REL_I386_DIR32 (6)
; CHECK: SymbolName =
; CHECK: SymbolName = .data
; CHECK: }
; CHECK: 1 = {
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 5
; CHECK: Type = IMAGE_REL_I386_REL32 (20)
; CHECK: SymbolName = _main
; CHECK: SymbolName = _printf
; CHECK: }
; CHECK: 2 = {
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 6
; CHECK: Type = IMAGE_REL_I386_DIR32 (6)
; CHECK: SymbolName = _printf
; CHECK: SymbolName = _str
; CHECK: }
; CHECK: 3 = {
; CHECK: VirtualAddress = 0x{{[0-9A-F]+}}
; CHECK: SymbolTableIndex = 7
; CHECK: Type = IMAGE_REL_I386_REL32 (20)
; CHECK: SymbolName = _str
; CHECK: SymbolName = _puts
; CHECK: }
; CHECK: ]
; CHECK: }
Expand Down Expand Up @@ -105,7 +105,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: 00 00 |..|

; CHECK: }
; CHECK: 1 = {
; CHECK: 2 = {
; CHECK: Name = .data
; CHECK: Value = 0
; CHECK: SectionNumber = 2
Expand All @@ -118,7 +118,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: 00 00 |..|

; CHECK: }
; CHECK: 2 = {
; CHECK: 4 = {
; CHECK: Name = _main
; CHECK: Value = 0
; CHECK: SectionNumber = 1
Expand All @@ -128,7 +128,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: NumberOfAuxSymbols = 0
; CHECK: AuxillaryData =

; CHECK: 3 = {
; CHECK: 5 = {
; CHECK: Name = _printf
; CHECK: Value = 0
; CHECK: SectionNumber = 0
Expand All @@ -139,7 +139,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: AuxillaryData =

; CHECK: }
; CHECK: 4 = {
; CHECK: 6 = {
; CHECK: Name = _str
; CHECK: Value = 7
; CHECK: SectionNumber = 2
Expand All @@ -150,7 +150,7 @@ declare i32 @puts(i8* nocapture) nounwind
; CHECK: AuxillaryData =

; CHECK: }
; CHECK: 5 = {
; CHECK: 7 = {
; CHECK: Name = _puts
; CHECK: Value = 0
; CHECK: SectionNumber = 0
Expand Down
16 changes: 10 additions & 6 deletions test/Scripts/coff-dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def symname(value):
0x0010: 'IMAGE_REL_AMD64_SSPAN32',
},
}))),
('SymbolName', ('ptr', '+ PointerToSymbolTable * - SymbolTableIndex 1 18', ('scalar', '<8s', symname)))
('SymbolName', ('ptr', '+ PointerToSymbolTable * SymbolTableIndex 18', ('scalar', '<8s', symname)))
])))),
]))),
('Symbols', ('ptr', 'PointerToSymbolTable', ('byte-array', '* NumberOfSymbols 18', ('struct', [
('Symbols', ('ptr', 'PointerToSymbolTable', ('byte-array', '18', '* NumberOfSymbols 18', ('struct', [
('Name', ('scalar', '<8s', symname)),
('Value', ('scalar', '<L', '%d' )),
('SectionNumber', ('scalar', '<H', '%d' )),
Expand Down Expand Up @@ -487,24 +487,28 @@ def handle_array(entry):
return newItems

def handle_byte_array(entry):
length = entry[1]
element = entry[2]
ent_size = entry[1]
length = entry[2]
element = entry[3]

newItems = []

write("[\n")
indent()

item_size = read_value(ent_size)
value = read_value(length)
end_of_array = Input.tell() + value

prev_loc = Input.tell()
index = 0
while Input.tell() < end_of_array:
write("%d = "%index)
write("%d = " % index)
value = handle_element(element)
write("\n")
newItems.append(value)
index += 1
index += (Input.tell() - prev_loc) / item_size
prev_loc = Input.tell()

dedent()
write("]")
Expand Down

0 comments on commit a25c0a4

Please sign in to comment.