Skip to content

Commit

Permalink
Merge pull request #21999 from jacobly0/incr-cases
Browse files Browse the repository at this point in the history
link: fix failing incremental test cases
  • Loading branch information
jacobly0 authored Nov 17, 2024
2 parents 53a232e + 11e54a3 commit 7266d44
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/dev.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub const Env = enum {
sema,

/// - sema
/// - `zig build-* -fno-llvm -fno-lld -target x86_64-linux`
/// - `zig build-* -fincremental -fno-llvm -fno-lld -target x86_64-linux --listen=-`
@"x86_64-linux",

/// - sema
Expand Down Expand Up @@ -130,6 +130,8 @@ pub const Env = enum {
else => Env.ast_gen.supports(feature),
},
.@"x86_64-linux" => switch (feature) {
.stdio_listen,
.incremental,
.x86_64_backend,
.elf_linker,
=> true,
Expand Down
9 changes: 5 additions & 4 deletions src/link/Elf/ZigObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ pub fn updateFunc(
});
defer gpa.free(name);
const osec = if (self.text_index) |sect_sym_index|
self.atom(self.symbol(sect_sym_index).ref.index).?.output_section_index
self.symbol(sect_sym_index).output_section_index
else osec: {
const osec = try elf_file.addSection(.{
.name = try elf_file.insertShString(".text"),
Expand Down Expand Up @@ -1896,12 +1896,13 @@ pub fn deleteExport(
} orelse return;
const zcu = elf_file.base.comp.zcu.?;
const exp_name = name.toSlice(&zcu.intern_pool);
const esym_index = metadata.@"export"(self, exp_name) orelse return;
const sym_index = metadata.@"export"(self, exp_name) orelse return;
log.debug("deleting export '{s}'", .{exp_name});
const esym = &self.symtab.items(.elf_sym)[esym_index.*];
const esym_index = self.symbol(sym_index.*).esym_index;
const esym = &self.symtab.items(.elf_sym)[esym_index];
_ = self.globals_lookup.remove(esym.st_name);
esym.* = Elf.null_sym;
self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;
self.symtab.items(.shndx)[esym_index] = elf.SHN_UNDEF;
}

pub fn getGlobalSymbol(self: *ZigObject, elf_file: *Elf, name: []const u8, lib_name: ?[]const u8) !u32 {
Expand Down
3 changes: 1 addition & 2 deletions test/incremental/add_decl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Disabled on self-hosted due to linker crash
// #target=x86_64-linux-selfhosted
#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#update=initial version
Expand Down
3 changes: 1 addition & 2 deletions test/incremental/fix_astgen_failure
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Disabled on self-hosted due to linker crash
// #target=x86_64-linux-selfhosted
#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#update=initial version with error
Expand Down
2 changes: 1 addition & 1 deletion test/incremental/function_becomes_inline
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#target=x86_64-linux-selfhosted
#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#update=non-inline version
Expand Down
2 changes: 1 addition & 1 deletion test/incremental/recursive_function_becomes_non_recursive
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#target=x86_64-linux-selfhosted
#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#update=initial version
Expand Down

0 comments on commit 7266d44

Please sign in to comment.