| ... | ... | @@ -43,6 +43,10 @@ pub fn build(b: *Build) void { |
| 43 | 43 | elf_step.dependOn(testDsoPlt(b, .{ .target = glibc_target, .dynamic_linker = dynamic_linker })); |
| 44 | 44 | elf_step.dependOn(testDsoUndef(b, .{ .target = glibc_target, .dynamic_linker = dynamic_linker })); |
| 45 | 45 | elf_step.dependOn(testLargeAlignmentDso(b, .{ .target = glibc_target, .dynamic_linker = dynamic_linker })); |
| 46 | |
| 47 | for (&[_]CrossTarget{ musl_target, glibc_target }) |target| { |
| 48 | elf_step.dependOn(testLargeAlignmentExe(b, .{ .target = target })); |
| 49 | } |
| 46 | 50 | } |
| 47 | 51 | |
| 48 | 52 | fn testCommonSymbols(b: *Build, opts: Options) *Step { |
| ... | ... | @@ -373,6 +377,49 @@ fn testLargeAlignmentDso(b: *Build, opts: Options) *Step { |
| 373 | 377 | return test_step; |
| 374 | 378 | } |
| 375 | 379 | |
| 380 | fn testLargeAlignmentExe(b: *Build, opts: Options) *Step { |
| 381 | const test_step = addTestStep(b, "large-alignment-exe", opts); |
| 382 | |
| 383 | const exe = addExecutable(b, opts); |
| 384 | addCSourceBytes(exe, |
| 385 | \\#include <stdio.h> |
| 386 | \\#include <stdint.h> |
| 387 | \\ |
| 388 | \\void hello() __attribute__((aligned(32768), section(".hello"))); |
| 389 | \\void world() __attribute__((aligned(32768), section(".world"))); |
| 390 | \\ |
| 391 | \\void hello() { |
| 392 | \\ printf("Hello"); |
| 393 | \\} |
| 394 | \\ |
| 395 | \\void world() { |
| 396 | \\ printf(" world"); |
| 397 | \\} |
| 398 | \\ |
| 399 | \\int main() { |
| 400 | \\ hello(); |
| 401 | \\ world(); |
| 402 | \\} |
| 403 | , &.{}); |
| 404 | exe.link_function_sections = true; |
| 405 | exe.is_linking_libc = true; |
| 406 | |
| 407 | const run = addRunArtifact(exe); |
| 408 | run.expectStdOutEqual("Hello world"); |
| 409 | test_step.dependOn(&run.step); |
| 410 | |
| 411 | const check = exe.checkObject(); |
| 412 | check.checkInSymtab(); |
| 413 | check.checkExtract("{addr1} {size1} {shndx1} FUNC LOCAL DEFAULT hello"); |
| 414 | check.checkInSymtab(); |
| 415 | check.checkExtract("{addr2} {size2} {shndx2} FUNC LOCAL DEFAULT world"); |
| 416 | check.checkComputeCompare("addr1 16 %", .{ .op = .eq, .value = .{ .literal = 0 } }); |
| 417 | check.checkComputeCompare("addr2 16 %", .{ .op = .eq, .value = .{ .literal = 0 } }); |
| 418 | test_step.dependOn(&check.step); |
| 419 | |
| 420 | return test_step; |
| 421 | } |
| 422 | |
| 376 | 423 | fn testLinkingC(b: *Build, opts: Options) *Step { |
| 377 | 424 | const test_step = addTestStep(b, "linking-c", opts); |
| 378 | 425 | |