| ... | @@ -2649,6 +2649,33 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step { | ... | @@ -2649,6 +2649,33 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step { |
| 2649 | return test_step; | 2649 | return test_step; |
| 2650 | } | 2650 | } |
| 2651 | | 2651 | |
| | 2652 | // Adapted from https://github.com/rui314/mold/blob/main/test/elf/relocatable-mergeable-sections.sh |
| | 2653 | fn testRelocatableMergeStrings(b: *Build, opts: Options) *Step { |
| | 2654 | const test_step = addTestStep(b, "relocatable-merge-strings", opts); |
| | 2655 | |
| | 2656 | const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |
| | 2657 | \\.section .rodata.str1.1,"aMS",@progbits,1 |
| | 2658 | \\val1: |
| | 2659 | \\.ascii "Hello \0" |
| | 2660 | \\.section .rodata.str1.1,"aMS",@progbits,1 |
| | 2661 | \\val5: |
| | 2662 | \\.ascii "World \0" |
| | 2663 | \\.section .rodata.str1.1,"aMS",@progbits,1 |
| | 2664 | \\val7: |
| | 2665 | \\.ascii "Hello \0" |
| | 2666 | }); |
| | 2667 | |
| | 2668 | const obj2 = addObject(b, opts, .{ .name = "b" }); |
| | 2669 | obj2.addObject(obj1); |
| | 2670 | |
| | 2671 | const check = obj2.checkObject(); |
| | 2672 | check.dumpSection(".rodata.str1.1"); |
| | 2673 | check.checkExact("Hello \x00World \x00"); |
| | 2674 | test_step.dependOn(&check.step); |
| | 2675 | |
| | 2676 | return test_step; |
| | 2677 | } |
| | 2678 | |
| 2652 | fn testRelocatableNoEhFrame(b: *Build, opts: Options) *Step { | 2679 | fn testRelocatableNoEhFrame(b: *Build, opts: Options) *Step { |
| 2653 | const test_step = addTestStep(b, "relocatable-no-eh-frame", opts); | 2680 | const test_step = addTestStep(b, "relocatable-no-eh-frame", opts); |
| 2654 | | 2681 | |