Skip to content

Commit 7493858

Browse files
committed
update zig sources to 0.15.0-dev.233+7c85dc460
1 parent 7fe559c commit 7493858

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1289
-629
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ to find and inspect the patch diffs.
1111
* LLVM, LLD, Clang 20.1.2
1212
* zlib 1.3.1
1313
* zstd 1.5.2
14-
* zig 0.15.0-dev.203+53270f008
14+
* zig 0.15.0-dev.233+7c85dc460
1515

1616
For other versions, check the git tags of this repository.
1717

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TARGET="$1" # Example: riscv64-linux-gnu
77
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`
88

99
ROOTDIR="$(pwd)"
10-
ZIG_VERSION="0.15.0-dev.203+53270f008"
10+
ZIG_VERSION="0.15.0-dev.233+7c85dc460"
1111

1212
TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu
1313

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if "%VSCMD_ARG_HOST_ARCH%"=="x86" set OUTDIR=out-win-x86
3535

3636
set ROOTDIR=%~dp0
3737
set "ROOTDIR_CMAKE=%ROOTDIR:\=/%"
38-
set ZIG_VERSION="0.15.0-dev.203+53270f008"
38+
set ZIG_VERSION="0.15.0-dev.233+7c85dc460"
3939
set JOBS_ARG=
4040

4141
pushd %ROOTDIR%

zig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ if(MSVC)
809809
else()
810810
set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
811811
set(ZIG1_COMPILE_FLAGS "-std=c99 -Os")
812-
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-stack-protector")
812+
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector")
813813
if(APPLE)
814814
set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
815815
elseif(MINGW)

zig/bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
123123
if (f == NULL)
124124
panic("unable to open config.zig for writing");
125125

126-
const char *zig_version = "0.15.0-dev.203+53270f008";
126+
const char *zig_version = "0.15.0-dev.233+7c85dc460";
127127

128128
int written = fprintf(f,
129129
"pub const have_llvm = false;\n"

zig/build.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,10 @@ const llvm_libs = [_][]const u8{
11961196
"LLVMSystemZCodeGen",
11971197
"LLVMSystemZDesc",
11981198
"LLVMSystemZInfo",
1199+
"LLVMSPIRVCodeGen",
1200+
"LLVMSPIRVDesc",
1201+
"LLVMSPIRVInfo",
1202+
"LLVMSPIRVAnalysis",
11991203
"LLVMSparcDisassembler",
12001204
"LLVMSparcAsmParser",
12011205
"LLVMSparcCodeGen",

zig/cmake/Findlld.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
1212
/usr/lib/llvm-20/include
1313
/usr/local/llvm200/include
1414
/usr/local/llvm20/include
15-
/usr/local/opt/llvm@20/include
16-
/opt/homebrew/opt/llvm@20/include
15+
/usr/local/opt/lld@20/include
16+
/opt/homebrew/opt/lld@20/include
1717
/mingw64/include)
1818

1919
find_library(LLD_LIBRARY NAMES lld-20.0 lld200 lld NAMES_PER_DIR
@@ -22,8 +22,8 @@ find_library(LLD_LIBRARY NAMES lld-20.0 lld200 lld NAMES_PER_DIR
2222
/usr/lib/llvm-20/lib
2323
/usr/local/llvm200/lib
2424
/usr/local/llvm20/lib
25-
/usr/local/opt/llvm@20/lib
26-
/opt/homebrew/opt/llvm@20/lib
25+
/usr/local/opt/lld@20/lib
26+
/opt/homebrew/opt/lld@20/lib
2727
)
2828
if(EXISTS ${LLD_LIBRARY})
2929
set(LLD_LIBRARIES ${LLD_LIBRARY})
@@ -37,8 +37,8 @@ else()
3737
/usr/lib/llvm-20/lib
3838
/usr/local/llvm200/lib
3939
/usr/local/llvm20/lib
40-
/usr/local/opt/llvm@20/lib
41-
/opt/homebrew/opt/llvm@20/lib
40+
/usr/local/opt/lld@20/lib
41+
/opt/homebrew/opt/lld@20/lib
4242
/mingw64/lib
4343
/c/msys64/mingw64/lib
4444
c:/msys64/mingw64/lib)

zig/cmake/Findllvm.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ else()
227227
FIND_AND_ADD_LLVM_LIB(LLVMSystemZCodeGen)
228228
FIND_AND_ADD_LLVM_LIB(LLVMSystemZDesc)
229229
FIND_AND_ADD_LLVM_LIB(LLVMSystemZInfo)
230+
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVCodeGen)
231+
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVDesc)
232+
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVInfo)
233+
FIND_AND_ADD_LLVM_LIB(LLVMSPIRVAnalysis)
230234
FIND_AND_ADD_LLVM_LIB(LLVMSparcDisassembler)
231235
FIND_AND_ADD_LLVM_LIB(LLVMSparcAsmParser)
232236
FIND_AND_ADD_LLVM_LIB(LLVMSparcCodeGen)

zig/lib/compiler/aro_translate_c.zig

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,19 +1502,29 @@ pub fn ScopeExtra(comptime ScopeExtraContext: type, comptime ScopeExtraType: typ
15021502
return scope.base.parent.?.getAlias(name);
15031503
}
15041504

1505-
/// Finds the (potentially) mangled struct name for a locally scoped extern variable given the original declaration name.
1505+
/// Finds the (potentially) mangled struct name for a locally scoped extern variable or function given the original declaration name.
15061506
///
15071507
/// Block scoped extern declarations translate to:
15081508
/// const MangledStructName = struct {extern [qualifiers] original_extern_variable_name: [type]};
15091509
/// This finds MangledStructName given original_extern_variable_name for referencing correctly in transDeclRefExpr()
15101510
pub fn getLocalExternAlias(scope: *Block, name: []const u8) ?[]const u8 {
15111511
for (scope.statements.items) |node| {
1512-
if (node.tag() == .extern_local_var) {
1513-
const parent_node = node.castTag(.extern_local_var).?;
1514-
const init_node = parent_node.data.init.castTag(.var_decl).?;
1515-
if (std.mem.eql(u8, init_node.data.name, name)) {
1516-
return parent_node.data.name;
1517-
}
1512+
switch (node.tag()) {
1513+
.extern_local_var => {
1514+
const parent_node = node.castTag(.extern_local_var).?;
1515+
const init_node = parent_node.data.init.castTag(.var_decl).?;
1516+
if (std.mem.eql(u8, init_node.data.name, name)) {
1517+
return parent_node.data.name;
1518+
}
1519+
},
1520+
.extern_local_fn => {
1521+
const parent_node = node.castTag(.extern_local_fn).?;
1522+
const init_node = parent_node.data.init.castTag(.func).?;
1523+
if (std.mem.eql(u8, init_node.data.name.?, name)) {
1524+
return parent_node.data.name;
1525+
}
1526+
},
1527+
else => {},
15181528
}
15191529
}
15201530
return null;

zig/lib/compiler/aro_translate_c/ast.zig

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub const Node = extern union {
5757
static_local_var,
5858
/// const ExternLocal_name = struct { init }
5959
extern_local_var,
60+
/// const ExternLocal_name = struct { init }
61+
extern_local_fn,
6062
/// var name = init.*
6163
mut_str,
6264
func,
@@ -367,7 +369,13 @@ pub const Node = extern union {
367369
.c_pointer, .single_pointer => Payload.Pointer,
368370
.array_type, .null_sentinel_array_type => Payload.Array,
369371
.arg_redecl, .alias, .fail_decl => Payload.ArgRedecl,
370-
.var_simple, .pub_var_simple, .static_local_var, .extern_local_var, .mut_str => Payload.SimpleVarDecl,
372+
.var_simple,
373+
.pub_var_simple,
374+
.static_local_var,
375+
.extern_local_var,
376+
.extern_local_fn,
377+
.mut_str,
378+
=> Payload.SimpleVarDecl,
371379
.enum_constant => Payload.EnumConstant,
372380
.array_filler => Payload.ArrayFiller,
373381
.pub_inline_fn => Payload.PubInlineFn,
@@ -1265,8 +1273,11 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
12651273
} },
12661274
});
12671275
},
1268-
.extern_local_var => {
1269-
const payload = node.castTag(.extern_local_var).?.data;
1276+
.extern_local_var, .extern_local_fn => {
1277+
const payload = if (node.tag() == .extern_local_var)
1278+
node.castTag(.extern_local_var).?.data
1279+
else
1280+
node.castTag(.extern_local_fn).?.data;
12701281

12711282
const const_tok = try c.addToken(.keyword_const, "const");
12721283
_ = try c.addIdentifier(payload.name);
@@ -2293,7 +2304,7 @@ fn renderNullSentinelArrayType(c: *Context, len: usize, elem_type: Node) !NodeIn
22932304
fn addSemicolonIfNeeded(c: *Context, node: Node) !void {
22942305
switch (node.tag()) {
22952306
.warning => unreachable,
2296-
.var_decl, .var_simple, .arg_redecl, .alias, .block, .empty_block, .block_single, .@"switch", .static_local_var, .extern_local_var, .mut_str => {},
2307+
.var_decl, .var_simple, .arg_redecl, .alias, .block, .empty_block, .block_single, .@"switch", .static_local_var, .extern_local_var, .extern_local_fn, .mut_str => {},
22972308
.while_true => {
22982309
const payload = node.castTag(.while_true).?.data;
22992310
return addSemicolonIfNotBlock(c, payload);
@@ -2390,6 +2401,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex {
23902401
.builtin_extern,
23912402
.static_local_var,
23922403
.extern_local_var,
2404+
.extern_local_fn,
23932405
.mut_str,
23942406
.macro_arithmetic,
23952407
=> {

0 commit comments

Comments
 (0)