mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
test: add a test that verifies no debug handlers get pulled into compiler_rt
build: fix CheckObject checkNotPresent only checking a single line of the haystack
This commit is contained in:
parent
78449b6d98
commit
8b9627f01d
@ -478,8 +478,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
},
|
||||
.not_present => {
|
||||
while (it.next()) |line| {
|
||||
if (act.notPresent(b, step, line)) break;
|
||||
} else {
|
||||
if (act.notPresent(b, step, line)) continue;
|
||||
return step.fail(
|
||||
\\
|
||||
\\========= expected not to find: ===================
|
||||
|
||||
@ -241,6 +241,10 @@ pub const build_cases = [_]BuildCase{
|
||||
.build_root = "test/standalone/coff_dwarf",
|
||||
.import = @import("standalone/coff_dwarf/build.zig"),
|
||||
},
|
||||
.{
|
||||
.build_root = "test/standalone/compiler_rt_panic",
|
||||
.import = @import("standalone/compiler_rt_panic/build.zig"),
|
||||
},
|
||||
};
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
26
test/standalone/compiler_rt_panic/build.zig
Normal file
26
test/standalone/compiler_rt_panic/build.zig
Normal file
@ -0,0 +1,26 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const test_step = b.step("test", "Test it");
|
||||
b.default_step = test_step;
|
||||
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
if (target.getObjectFormat() != .elf) return;
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "main",
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
});
|
||||
exe.addCSourceFile("main.c", &.{});
|
||||
exe.link_gc_sections = false;
|
||||
exe.bundle_compiler_rt = true;
|
||||
|
||||
// Verify compiler_rt hasn't pulled in any debug handlers
|
||||
const check_exe = exe.checkObject();
|
||||
check_exe.checkInSymtab();
|
||||
check_exe.checkNotPresent("debug.readElfDebugInfo");
|
||||
test_step.dependOn(&check_exe.step);
|
||||
}
|
||||
11
test/standalone/compiler_rt_panic/main.c
Normal file
11
test/standalone/compiler_rt_panic/main.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stddef.h>
|
||||
|
||||
void* __memset(void* dest, char c, size_t n, size_t dest_n);
|
||||
|
||||
char foo[128];
|
||||
|
||||
int main() {
|
||||
__memset(&foo[0], 0xff, 128, 128);
|
||||
return foo[64];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user