diff options
Diffstat (limited to 'test/MC/ELF')
-rw-r--r-- | test/MC/ELF/alias.s | 13 | ||||
-rw-r--r-- | test/MC/ELF/cfi-large-model.s | 27 | ||||
-rw-r--r-- | test/MC/ELF/cfi-version.ll | 26 | ||||
-rw-r--r-- | test/MC/ELF/common-error1.s | 6 | ||||
-rw-r--r-- | test/MC/ELF/common-error2.s | 6 | ||||
-rw-r--r-- | test/MC/ELF/relocation-386.s | 3 | ||||
-rw-r--r-- | test/MC/ELF/section-unique.s | 39 | ||||
-rw-r--r-- | test/MC/ELF/symver-msvc.s | 59 | ||||
-rw-r--r-- | test/MC/ELF/type.s | 12 | ||||
-rw-r--r-- | test/MC/ELF/uleb.s | 9 |
10 files changed, 182 insertions, 18 deletions
diff --git a/test/MC/ELF/alias.s b/test/MC/ELF/alias.s index 2e65ace..8e13182 100644 --- a/test/MC/ELF/alias.s +++ b/test/MC/ELF/alias.s @@ -20,6 +20,10 @@ bar5 = bar4 .long foo2 +// Test that bar6 is a function that doesn't have the same value as foo4. +bar6 = bar5 +bar6: + // CHECK: Symbols [ // CHECK-NEXT: Symbol { // CHECK-NEXT: Name: (0) @@ -58,6 +62,15 @@ bar5 = bar4 // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: bar6 +// CHECK-NEXT: Value: 0x5 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: None +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: foo // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 diff --git a/test/MC/ELF/cfi-large-model.s b/test/MC/ELF/cfi-large-model.s new file mode 100644 index 0000000..16073ad --- /dev/null +++ b/test/MC/ELF/cfi-large-model.s @@ -0,0 +1,27 @@ +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -code-model=large %s \ +// RUN: -o - | llvm-readobj -s -sd | FileCheck %s + +// CHECK: Section { +// CHECK: Index: +// CHECK: Name: .eh_frame +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Offset: 0x40 +// CHECK-NEXT: Size: 56 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 8 +// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 14000000 00000000 037A5200 01781001 |.........zR..x..| +// CHECK-NEXT: 0010: 1C0C0708 90010000 1C000000 1C000000 |................| +// CHECK-NEXT: 0020: 00000000 00000000 00000000 00000000 |................| +// CHECK-NEXT: 0030: 00000000 00000000 |........| +// CHECK-NEXT: ) + +f: + .cfi_startproc + .cfi_endproc diff --git a/test/MC/ELF/cfi-version.ll b/test/MC/ELF/cfi-version.ll index 2938dc7..c8a9978 100644 --- a/test/MC/ELF/cfi-version.ll +++ b/test/MC/ELF/cfi-version.ll @@ -22,19 +22,19 @@ attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !llvm.module.flags = !{!9, !10} !llvm.ident = !{!11} -!0 = metadata !{metadata !"0x11\0012\00clang version 3.5.0 \000\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/tmp/test.c] [DW_LANG_C99] -!1 = metadata !{metadata !"test.c", metadata !"/tmp"} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00foo\00foo\00\002\000\001\000\006\00256\000\002", metadata !1, metadata !5, metadata !6, null, i32 ()* @foo, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 2] [def] [foo] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [/tmp/test.c] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{metadata !8} -!8 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] -!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} -!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 2} -!11 = metadata !{metadata !"clang version 3.5.0 "} -!12 = metadata !{i32 2, i32 0, metadata !4, null} +!0 = !{!"0x11\0012\00clang version 3.5.0 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/test.c] [DW_LANG_C99] +!1 = !{!"test.c", !"/tmp"} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00foo\00foo\00\002\000\001\000\006\00256\000\002", !1, !5, !6, null, i32 ()* @foo, null, null, !2} ; [ DW_TAG_subprogram ] [line 2] [def] [foo] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/test.c] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{!8} +!8 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!9 = !{i32 2, !"Dwarf Version", i32 4} +!10 = !{i32 1, !"Debug Info Version", i32 2} +!11 = !{!"clang version 3.5.0 "} +!12 = !MDLocation(line: 2, scope: !4) ; DWARF2: .debug_frame contents: ; DWARF2: Version: 1 diff --git a/test/MC/ELF/common-error1.s b/test/MC/ELF/common-error1.s new file mode 100644 index 0000000..a413885 --- /dev/null +++ b/test/MC/ELF/common-error1.s @@ -0,0 +1,6 @@ +// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux < %s 2>&1 | FileCheck %s + + .comm C,4,4 + .set A,C + +// CHECK: Common symbol C cannot be used in assignment expr diff --git a/test/MC/ELF/common-error2.s b/test/MC/ELF/common-error2.s new file mode 100644 index 0000000..d666fee --- /dev/null +++ b/test/MC/ELF/common-error2.s @@ -0,0 +1,6 @@ +// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux < %s 2>&1 | FileCheck %s + + .set A,C + .comm C,4,4 + +// CHECK: Common symbol C cannot be used in assignment expr diff --git a/test/MC/ELF/relocation-386.s b/test/MC/ELF/relocation-386.s index ba12df0..83c524b 100644 --- a/test/MC/ELF/relocation-386.s +++ b/test/MC/ELF/relocation-386.s @@ -63,6 +63,8 @@ // Relocation 28 (und_symbol-bar2) is of type R_386_PC8 // CHECK-NEXT: 0xA0 R_386_PC8 und_symbol 0x0 // CHECK-NEXT: 0xA3 R_386_GOTOFF und_symbol 0x0 +// Relocation 29 (zed@PLT) is of type R_386_PLT32 and uses the symbol +// CHECK-NEXT: 0xA9 R_386_PLT32 zed 0x0 // CHECK-NEXT: } // CHECK-NEXT: ] @@ -129,6 +131,7 @@ bar2: .byte und_symbol-bar2 leal 1 + und_symbol@GOTOFF, %edi + movl zed@PLT(%eax), %eax .section zedsec,"awT",@progbits zed: diff --git a/test/MC/ELF/section-unique.s b/test/MC/ELF/section-unique.s new file mode 100644 index 0000000..b482af3 --- /dev/null +++ b/test/MC/ELF/section-unique.s @@ -0,0 +1,39 @@ +// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s +// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -t | FileCheck %s --check-prefix=OBJ + + .section .text,"ax",@progbits,unique + .globl f +f: + nop + + .section .text,"ax",@progbits,unique + .globl g +g: + nop + +// test that f and g are in different sections. + +// CHECK: .section .text,"ax",@progbits,unique +// CHECK: f: + +// CHECK: .section .text,"ax",@progbits,unique +// CHECK: g: + +// OBJ: Symbol { +// OBJ: Name: f +// OBJ: Value: 0x0 +// OBJ: Size: 0 +// OBJ: Binding: Global +// OBJ: Type: None +// OBJ: Other: 0 +// OBJ: Section: .text (0x4) +// OBJ: } +// OBJ: Symbol { +// OBJ: Name: g +// OBJ: Value: 0x0 +// OBJ: Size: 0 +// OBJ: Binding: Global +// OBJ: Type: None +// OBJ: Other: 0 +// OBJ: Section: .text (0x5) +// OBJ: } diff --git a/test/MC/ELF/symver-msvc.s b/test/MC/ELF/symver-msvc.s new file mode 100644 index 0000000..d6730ca --- /dev/null +++ b/test/MC/ELF/symver-msvc.s @@ -0,0 +1,59 @@ +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-windows-elf %s -o - | llvm-readobj -r -t | FileCheck %s + +// Verify that MSVC C++ mangled symbols are not affected by the ELF +// GNU-style symbol versioning. The ELF format is used on Windows by +// the MCJIT execution engine. + + .long "??_R0?AVexception@std@@@8" + .long "@??_R0?AVinvalid_argument@std@@@8" + .long "__imp_??_R0?AVlogic_error@std@@@8" + .long "__imp_@??_R0PAVexception@std@@@8" + + +// CHECK: Relocations [ +// CHECK-NEXT: Section (2) .rela.text { +// CHECK-NEXT: 0x0 R_X86_64_32 ??_R0?AVexception@std@@@8 0x0 +// CHECK-NEXT: 0x4 R_X86_64_32 @??_R0?AVinvalid_argument@std@@@8 0x0 +// CHECK-NEXT: 0x8 R_X86_64_32 __imp_??_R0?AVlogic_error@std@@@8 0x0 +// CHECK-NEXT: 0xC R_X86_64_32 __imp_@??_R0PAVexception@std@@@8 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: ??_R0?AVexception@std@@@8 (102) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: @??_R0?AVinvalid_argument@std@@@8 (1) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: __imp_??_R0?AVlogic_error@std@@@8 (35) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: __imp_@??_R0PAVexception@std@@@8 (69) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Global (0x1) +// CHECK-NEXT: Type: None (0x0) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: Undefined (0x0) +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/MC/ELF/type.s b/test/MC/ELF/type.s index c82d300..f7745d8 100644 --- a/test/MC/ELF/type.s +++ b/test/MC/ELF/type.s @@ -9,8 +9,8 @@ foo: .type bar,@object bar: -// Test that gnu_unique_object is accepted. .type zed,@gnu_unique_object +zed: obj: .global obj @@ -310,3 +310,13 @@ alias12: // CHECK-NEXT: Other: 0 // CHECK-NEXT: Section: .text (0x1) // CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: zed (32) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Unique (0xA) +// CHECK-NEXT: Type: Object (0x1) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x1) +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/MC/ELF/uleb.s b/test/MC/ELF/uleb.s index d755cc2..5d203a9 100644 --- a/test/MC/ELF/uleb.s +++ b/test/MC/ELF/uleb.s @@ -11,16 +11,17 @@ foo: .uleb128 128 .uleb128 16383 .uleb128 16384 + .uleb128 23, 42 // ELF_32: Name: .text // ELF_32: SectionData ( -// ELF_32: 0000: 00017F80 01FF7F80 8001 +// ELF_32: 0000: 00017F80 01FF7F80 8001172A // ELF_32: ) // ELF_64: Name: .text // ELF_64: SectionData ( -// ELF_64: 0000: 00017F80 01FF7F80 8001 +// ELF_64: 0000: 00017F80 01FF7F80 8001172A // ELF_64: ) // MACHO_32: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -// MACHO_32: ('_section_data', '00017f80 01ff7f80 8001') +// MACHO_32: ('_section_data', '00017f80 01ff7f80 8001172a') // MACHO_64: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -// MACHO_64: ('_section_data', '00017f80 01ff7f80 8001') +// MACHO_64: ('_section_data', '00017f80 01ff7f80 8001172a') |