authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-04-20 23:05:45+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-04-20 23:36:42+02:00
logbc0d84be0bff3751f2adb996f417866fbc8eee2c
treed7ab7bcccdc1c3f63341deff60f7ef1ea1876504
parent342235e5eb30426cf8bba0ad76e14e21fac18e79

test/link/elf: add merge strings test for -r mode


1 files changed, 27 insertions(+), 0 deletions(-)

test/link/elf.zig+27
......@@ -2649,6 +2649,33 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {
26492649 return test_step;
26502650}
26512651
2652// Adapted from https://github.com/rui314/mold/blob/main/test/elf/relocatable-mergeable-sections.sh
2653fn 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
26522679fn testRelocatableNoEhFrame(b: *Build, opts: Options) *Step {
26532680 const test_step = addTestStep(b, "relocatable-no-eh-frame", opts);
26542681