| OLD | NEW |
| (Empty) | |
| 1 ; Tests filetype=obj with -ffunction-sections. |
| 2 |
| 3 ; RUN: %p2i -i %s --args -O2 --verbose none -filetype=obj -o %t \ |
| 4 ; RUN: -ffunction-sections && \ |
| 5 ; RUN: llvm-readobj -file-headers -sections -section-data \ |
| 6 ; RUN: -relocations -symbols %t | FileCheck %s |
| 7 |
| 8 ; RUN: %p2i -i %s --args -O2 --verbose none -ffunction-sections \ |
| 9 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj -o - \ |
| 10 ; RUN: | llvm-readobj -file-headers -sections -section-data \ |
| 11 ; RUN: -relocations -symbols - | FileCheck %s |
| 12 |
| 13 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) |
| 14 |
| 15 define internal i32 @foo(i32 %x, i32 %len) { |
| 16 %y = add i32 %x, %x |
| 17 %dst = inttoptr i32 %y to i8* |
| 18 %src = inttoptr i32 %x to i8* |
| 19 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 20 i32 %len, i32 1, i1 false) |
| 21 |
| 22 ret i32 %y |
| 23 } |
| 24 |
| 25 define internal i32 @bar(i32 %x) { |
| 26 ret i32 %x |
| 27 } |
| 28 |
| 29 define void @_start(i32 %x) { |
| 30 %y = call i32 @bar(i32 4) |
| 31 %ignored = call i32 @foo(i32 %x, i32 %y) |
| 32 ret void |
| 33 } |
| 34 |
| 35 ; CHECK: Section { |
| 36 ; CHECK: Name: .text.foo |
| 37 ; CHECK: Type: SHT_PROGBITS |
| 38 ; CHECK: Flags [ (0x6) |
| 39 ; CHECK: SHF_ALLOC |
| 40 ; CHECK: SHF_EXECINSTR |
| 41 ; CHECK: ] |
| 42 ; CHECK: } |
| 43 ; CHECK: Section { |
| 44 ; CHECK: Name: .rel.text.foo |
| 45 ; CHECK: Type: SHT_REL |
| 46 ; CHECK: Flags [ (0x0) |
| 47 ; CHECK: ] |
| 48 ; CHECK: } |
| 49 |
| 50 ; CHECK: Section { |
| 51 ; CHECK: Name: .text.bar |
| 52 ; CHECK: Type: SHT_PROGBITS |
| 53 ; CHECK: Flags [ (0x6) |
| 54 ; CHECK: SHF_ALLOC |
| 55 ; CHECK: SHF_EXECINSTR |
| 56 ; CHECK: ] |
| 57 ; CHECK: } |
| 58 |
| 59 ; CHECK: Section { |
| 60 ; CHECK: Name: .text._start |
| 61 ; CHECK: Type: SHT_PROGBITS |
| 62 ; CHECK: Flags [ (0x6) |
| 63 ; CHECK: SHF_ALLOC |
| 64 ; CHECK: SHF_EXECINSTR |
| 65 ; CHECK: ] |
| 66 ; CHECK: } |
| 67 ; CHECK: Section { |
| 68 ; CHECK: Name: .rel.text._start |
| 69 ; CHECK: Type: SHT_REL |
| 70 ; CHECK: Flags [ (0x0) |
| 71 ; CHECK: ] |
| 72 ; CHECK: ) |
| 73 ; CHECK: } |
| 74 |
| 75 ; CHECK: Relocations [ |
| 76 ; CHECK: Section ({{[0-9]+}}) .rel.text.foo { |
| 77 ; CHECK: 0x21 R_386_PC32 memcpy 0x0 |
| 78 ; CHECK: } |
| 79 ; Relocation can be against the start of the section or |
| 80 ; the function's symbol itself. |
| 81 ; CHECK: Section ({{[0-9]+}}) .rel.text._start { |
| 82 ; CHECK: 0x13 R_386_PC32 {{.*}}bar 0x0 |
| 83 ; CHECK: 0x25 R_386_PC32 {{.*}}foo 0x0 |
| 84 ; CHECK: } |
| 85 ; CHECK: ] |
| 86 |
| 87 ; CHECK: Symbols [ |
| 88 ; CHECK: Name: bar |
| 89 ; CHECK: Name: foo |
| 90 ; CHECK: Name: _start |
| 91 ; CHECK: Name: memcpy |
| 92 ; CHECK: ] |
| OLD | NEW |