| ... | ... | @@ -51,6 +51,7 @@ pub fn build(b: *Build) void { |
| 51 | 51 | elf_step.dependOn(testLargeAlignmentDso(b, .{ .target = glibc_target, .dynamic_linker = dynamic_linker })); |
| 52 | 52 | |
| 53 | 53 | for (&[_]CrossTarget{ musl_target, glibc_target }) |target| { |
| 54 | elf_step.dependOn(testEntryPoint(b, .{ .target = target })); |
| 54 | 55 | elf_step.dependOn(testLargeAlignmentExe(b, .{ .target = target })); |
| 55 | 56 | } |
| 56 | 57 | } |
| ... | ... | @@ -564,6 +565,49 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { |
| 564 | 565 | return test_step; |
| 565 | 566 | } |
| 566 | 567 | |
| 568 | fn testEntryPoint(b: *Build, opts: Options) *Step { |
| 569 | const test_step = addTestStep(b, "entry-point", opts); |
| 570 | |
| 571 | const a_o = addObject(b, "a", opts); |
| 572 | addAsmSourceBytes(a_o, |
| 573 | \\.globl foo, bar |
| 574 | \\foo = 0x1000 |
| 575 | \\bar = 0x2000 |
| 576 | ); |
| 577 | |
| 578 | const b_o = addObject(b, "b", opts); |
| 579 | addCSourceBytes(b_o, "int main() { return 0; }", &.{}); |
| 580 | |
| 581 | { |
| 582 | const exe = addExecutable(b, "main", opts); |
| 583 | exe.addObject(a_o); |
| 584 | exe.addObject(b_o); |
| 585 | exe.entry_symbol_name = "foo"; |
| 586 | |
| 587 | const check = exe.checkObject(); |
| 588 | check.checkStart(); |
| 589 | check.checkExact("header"); |
| 590 | check.checkExact("entry 1000"); |
| 591 | test_step.dependOn(&check.step); |
| 592 | } |
| 593 | |
| 594 | { |
| 595 | // TODO if I rename this to `main` it fails |
| 596 | const exe = addExecutable(b, "other", opts); |
| 597 | exe.addObject(a_o); |
| 598 | exe.addObject(b_o); |
| 599 | exe.entry_symbol_name = "bar"; |
| 600 | |
| 601 | const check = exe.checkObject(); |
| 602 | check.checkStart(); |
| 603 | check.checkExact("header"); |
| 604 | check.checkExact("entry 2000"); |
| 605 | test_step.dependOn(&check.step); |
| 606 | } |
| 607 | |
| 608 | return test_step; |
| 609 | } |
| 610 | |
| 567 | 611 | fn testGcSections(b: *Build, opts: Options) *Step { |
| 568 | 612 | const test_step = addTestStep(b, "gc-sections", opts); |
| 569 | 613 | |