OLD | NEW |
1 ; Tests that we generate an ELF container with fields that make sense, | 1 ; Tests that we generate an ELF container with fields that make sense, |
2 ; cross-validating against llvm-mc. | 2 ; cross-validating against llvm-mc. |
3 | 3 |
4 ; For the integrated ELF writer, we can't pipe the output because we need | 4 ; For the integrated ELF writer, we can't pipe the output because we need |
5 ; to seek backward and patch up the file headers. So, use a temporary file. | 5 ; to seek backward and patch up the file headers. So, use a temporary file. |
6 ; RUN: %p2i -i %s --filetype=obj --output %t --args -O2 --verbose none \ | 6 ; RUN: %p2i -i %s --filetype=obj --output %t --args -O2 --verbose none \ |
7 ; RUN: -allow-externally-defined-symbols \ | 7 ; RUN: -allow-externally-defined-symbols \ |
8 ; RUN: && llvm-readobj -file-headers -sections -section-data \ | 8 ; RUN: && llvm-readobj -file-headers -sections -section-data \ |
9 ; RUN: -relocations -symbols %t | FileCheck %s | 9 ; RUN: -relocations -symbols %t | FileCheck %s |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 @double_zero_const = internal constant [8 x i8] zeroinitializer, align 32 | 50 @double_zero_const = internal constant [8 x i8] zeroinitializer, align 32 |
51 @double_zero_const2 = internal constant [8 x i8] zeroinitializer, align 8 | 51 @double_zero_const2 = internal constant [8 x i8] zeroinitializer, align 8 |
52 | 52 |
53 ; Use float/double constants to test constant pools. | 53 ; Use float/double constants to test constant pools. |
54 define internal float @returnFloatConst() { | 54 define internal float @returnFloatConst() { |
55 entry: | 55 entry: |
56 %f = fadd float -0.0, 0x3FF3AE1400000000 | 56 %f = fadd float -0.0, 0x3FF3AE1400000000 |
57 ret float %f | 57 ret float %f |
58 } | 58 } |
59 ; TEXT-RELOCS-LABEL: returnFloatConst | 59 ; TEXT-RELOCS-LABEL: returnFloatConst |
60 ; TEXT-RELOCS: movss {{.*}} R_386_32 .L$float$80000000 | 60 ; TEXT-RELOCS: movss {{.*}} R_386_32 {{.*}}80000000 |
61 ; TEXT-RELOCS: addss {{.*}} R_386_32 .L$float$3f9d70a0 | 61 ; TEXT-RELOCS: addss {{.*}} R_386_32 {{.*}}3f9d70a0 |
62 | 62 |
63 define internal double @returnDoubleConst() { | 63 define internal double @returnDoubleConst() { |
64 entry: | 64 entry: |
65 %d = fadd double 0x7FFFFFFFFFFFFFFFF, 0xFFF7FFFFFFFFFFFF | 65 %d = fadd double 0x7FFFFFFFFFFFFFFFF, 0xFFF7FFFFFFFFFFFF |
66 %d2 = fadd double %d, 0xFFF8000000000003 | 66 %d2 = fadd double %d, 0xFFF8000000000003 |
67 ret double %d2 | 67 ret double %d2 |
68 } | 68 } |
69 ; TEXT-RELOCS-LABEL: returnDoubleConst | 69 ; TEXT-RELOCS-LABEL: returnDoubleConst |
70 ; TEXT-RELOCS: movsd {{.*}} R_386_32 .L$double$ffffffffffffffff | 70 ; TEXT-RELOCS: movsd {{.*}} R_386_32 {{.*}}ffffffffffffffff |
71 ; TEXT-RELOCS: addsd {{.*}} R_386_32 .L$double$fff7ffffffffffff | 71 ; TEXT-RELOCS: addsd {{.*}} R_386_32 {{.*}}fff7ffffffffffff |
72 ; TEXT-RELOCS: addsd {{.*}} R_386_32 .L$double$fff8000000000003 | 72 ; TEXT-RELOCS: addsd {{.*}} R_386_32 {{.*}}fff8000000000003 |
73 | 73 |
74 ; Test intrinsics that call out to external functions. | 74 ; Test intrinsics that call out to external functions. |
75 define internal void @test_memcpy(i32 %iptr_dst, i32 %len) { | 75 define internal void @test_memcpy(i32 %iptr_dst, i32 %len) { |
76 entry: | 76 entry: |
77 %dst = inttoptr i32 %iptr_dst to i8* | 77 %dst = inttoptr i32 %iptr_dst to i8* |
78 %src = bitcast [7 x i8]* @bytes to i8* | 78 %src = bitcast [7 x i8]* @bytes to i8* |
79 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 79 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
80 i32 %len, i32 1, i1 false) | 80 i32 %len, i32 1, i1 false) |
81 ret void | 81 ret void |
82 } | 82 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 ; CHECK: Size: {{[1-9][0-9]*}} | 378 ; CHECK: Size: {{[1-9][0-9]*}} |
379 ; CHECK: Link: 0 | 379 ; CHECK: Link: 0 |
380 ; CHECK: Info: 0 | 380 ; CHECK: Info: 0 |
381 ; CHECK: AddressAlignment: 1 | 381 ; CHECK: AddressAlignment: 1 |
382 ; CHECK: EntrySize: 0 | 382 ; CHECK: EntrySize: 0 |
383 ; CHECK: } | 383 ; CHECK: } |
384 | 384 |
385 | 385 |
386 ; CHECK: Relocations [ | 386 ; CHECK: Relocations [ |
387 ; CHECK: Section ({{[0-9]+}}) .rel.text { | 387 ; CHECK: Section ({{[0-9]+}}) .rel.text { |
388 ; CHECK: 0x7 R_386_32 .L$float$80000000 0x0 | 388 ; CHECK: 0x7 R_386_32 {{.*}}80000000 0x0 |
389 ; CHECK: 0xF R_386_32 .L$float$3f9d70a0 0x0 | 389 ; CHECK: 0xF R_386_32 {{.*}}3f9d70a0 0x0 |
390 ; CHECK: 0x27 R_386_32 .L$double$ffffffffffffffff 0x0 | 390 ; CHECK: 0x27 R_386_32 {{.*}}ffffffffffffffff 0x0 |
391 ; CHECK: 0x2F R_386_32 .L$double$fff7ffffffffffff 0x0 | 391 ; CHECK: 0x2F R_386_32 {{.*}}fff7ffffffffffff 0x0 |
392 ; CHECK: 0x37 R_386_32 .L$double$fff8000000000003 0x0 | 392 ; CHECK: 0x37 R_386_32 {{.*}}fff8000000000003 0x0 |
393 ; CHECK: 0x{{.*}} R_386_PC32 memcpy | 393 ; CHECK: 0x{{.*}} R_386_PC32 memcpy |
394 ; CHECK: 0x{{.*}} R_386_PC32 memset | 394 ; CHECK: 0x{{.*}} R_386_PC32 memset |
395 ; CHECK: 0x{{.*}} R_386_PC32 external_foo | 395 ; CHECK: 0x{{.*}} R_386_PC32 external_foo |
396 ; CHECK: } | 396 ; CHECK: } |
397 ; CHECK: Section ({{[0-9]+}}) .rel.data { | 397 ; CHECK: Section ({{[0-9]+}}) .rel.data { |
398 ; The set of relocations between llvm-mc and the integrated elf-writer | 398 ; The set of relocations between llvm-mc and the integrated elf-writer |
399 ; are different. For local symbols, llvm-mc uses the section + offset within | 399 ; are different. For local symbols, llvm-mc uses the section + offset within |
400 ; the section, while the integrated elf-writer refers the symbol itself. | 400 ; the section, while the integrated elf-writer refers the symbol itself. |
401 ; CHECK: 0x10 R_386_32 {{.*}} 0x0 | 401 ; CHECK: 0x10 R_386_32 {{.*}} 0x0 |
402 ; CHECK: 0x14 R_386_32 {{.*}} 0x0 | 402 ; CHECK: 0x14 R_386_32 {{.*}} 0x0 |
(...skipping 11 matching lines...) Expand all Loading... |
414 ; CHECK-NEXT: Symbol { | 414 ; CHECK-NEXT: Symbol { |
415 ; CHECK-NEXT: Name: (0) | 415 ; CHECK-NEXT: Name: (0) |
416 ; CHECK-NEXT: Value: 0x0 | 416 ; CHECK-NEXT: Value: 0x0 |
417 ; CHECK-NEXT: Size: 0 | 417 ; CHECK-NEXT: Size: 0 |
418 ; CHECK-NEXT: Binding: Local | 418 ; CHECK-NEXT: Binding: Local |
419 ; CHECK-NEXT: Type: None | 419 ; CHECK-NEXT: Type: None |
420 ; CHECK-NEXT: Other: 0 | 420 ; CHECK-NEXT: Other: 0 |
421 ; CHECK-NEXT: Section: Undefined (0x0) | 421 ; CHECK-NEXT: Section: Undefined (0x0) |
422 ; CHECK-NEXT: } | 422 ; CHECK-NEXT: } |
423 ; CHECK: Symbol { | 423 ; CHECK: Symbol { |
424 ; CHECK: Name: .L$double$fff8000000000003 | 424 ; CHECK: Name: {{.*}}fff8000000000003 |
425 ; CHECK-NEXT: Value: 0x8 | 425 ; CHECK-NEXT: Value: 0x8 |
426 ; CHECK-NEXT: Size: 0 | 426 ; CHECK-NEXT: Size: 0 |
427 ; CHECK-NEXT: Binding: Local (0x0) | 427 ; CHECK-NEXT: Binding: Local (0x0) |
428 ; CHECK-NEXT: Type: None (0x0) | 428 ; CHECK-NEXT: Type: None (0x0) |
429 ; CHECK-NEXT: Other: 0 | 429 ; CHECK-NEXT: Other: 0 |
430 ; CHECK-NEXT: Section: .rodata.cst8 | 430 ; CHECK-NEXT: Section: .rodata.cst8 |
431 ; CHECK-NEXT: } | 431 ; CHECK-NEXT: } |
432 ; CHECK: Symbol { | 432 ; CHECK: Symbol { |
433 ; CHECK: Name: .L$double$ffffffffffffffff | 433 ; CHECK: Name: {{.*}}ffffffffffffffff |
434 ; CHECK-NEXT: Value: 0x10 | 434 ; CHECK-NEXT: Value: 0x10 |
435 ; CHECK-NEXT: Size: 0 | 435 ; CHECK-NEXT: Size: 0 |
436 ; CHECK-NEXT: Binding: Local (0x0) | 436 ; CHECK-NEXT: Binding: Local (0x0) |
437 ; CHECK-NEXT: Type: None (0x0) | 437 ; CHECK-NEXT: Type: None (0x0) |
438 ; CHECK-NEXT: Other: 0 | 438 ; CHECK-NEXT: Other: 0 |
439 ; CHECK-NEXT: Section: .rodata.cst8 | 439 ; CHECK-NEXT: Section: .rodata.cst8 |
440 ; CHECK-NEXT: } | 440 ; CHECK-NEXT: } |
441 ; CHECK: Symbol { | 441 ; CHECK: Symbol { |
442 ; CHECK: Name: .L$float$3f9d70a0 | 442 ; CHECK: Name: {{.*}}3f9d70a0 |
443 ; CHECK-NEXT: Value: 0x0 | 443 ; CHECK-NEXT: Value: 0x0 |
444 ; CHECK-NEXT: Size: 0 | 444 ; CHECK-NEXT: Size: 0 |
445 ; CHECK-NEXT: Binding: Local (0x0) | 445 ; CHECK-NEXT: Binding: Local (0x0) |
446 ; CHECK-NEXT: Type: None (0x0) | 446 ; CHECK-NEXT: Type: None (0x0) |
447 ; CHECK-NEXT: Other: 0 | 447 ; CHECK-NEXT: Other: 0 |
448 ; CHECK-NEXT: Section: .rodata.cst4 | 448 ; CHECK-NEXT: Section: .rodata.cst4 |
449 ; CHECK-NEXT: } | 449 ; CHECK-NEXT: } |
450 ; CHECK: Symbol { | 450 ; CHECK: Symbol { |
451 ; CHECK: Name: .L$float$80000000 | 451 ; CHECK: Name: {{.*}}80000000 |
452 ; CHECK-NEXT: Value: 0x4 | 452 ; CHECK-NEXT: Value: 0x4 |
453 ; CHECK-NEXT: Size: 0 | 453 ; CHECK-NEXT: Size: 0 |
454 ; CHECK-NEXT: Binding: Local (0x0) | 454 ; CHECK-NEXT: Binding: Local (0x0) |
455 ; CHECK-NEXT: Type: None (0x0) | 455 ; CHECK-NEXT: Type: None (0x0) |
456 ; CHECK-NEXT: Other: 0 | 456 ; CHECK-NEXT: Other: 0 |
457 ; CHECK-NEXT: Section: .rodata.cst4 | 457 ; CHECK-NEXT: Section: .rodata.cst4 |
458 ; CHECK-NEXT: } | 458 ; CHECK-NEXT: } |
459 ; CHECK: Symbol { | 459 ; CHECK: Symbol { |
460 ; CHECK: Name: addend_ptr | 460 ; CHECK: Name: addend_ptr |
461 ; CHECK-NEXT: Value: 0x18 | 461 ; CHECK-NEXT: Value: 0x18 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 ; CHECK: Symbol { | 640 ; CHECK: Symbol { |
641 ; CHECK: Name: memset | 641 ; CHECK: Name: memset |
642 ; CHECK-NEXT: Value: 0x0 | 642 ; CHECK-NEXT: Value: 0x0 |
643 ; CHECK-NEXT: Size: 0 | 643 ; CHECK-NEXT: Size: 0 |
644 ; CHECK-NEXT: Binding: Global | 644 ; CHECK-NEXT: Binding: Global |
645 ; CHECK-NEXT: Type: None | 645 ; CHECK-NEXT: Type: None |
646 ; CHECK-NEXT: Other: 0 | 646 ; CHECK-NEXT: Other: 0 |
647 ; CHECK-NEXT: Section: Undefined | 647 ; CHECK-NEXT: Section: Undefined |
648 ; CHECK-NEXT: } | 648 ; CHECK-NEXT: } |
649 ; CHECK: ] | 649 ; CHECK: ] |
OLD | NEW |