unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
blob 5ad5ffc249aaa2be81a7da014c87e2d4ee352bf6 3562 bytes (raw)
name: gnu/packages/patches/zig-0.10.0-610-bootstrap-resolve-conflicts.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c03faf1e9..89406eb1b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -846,16 +846,17 @@ else()
 endif()
 
 set(ZIG_BUILD_ARGS
-  --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
-  "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
-  "-Denable-llvm"
-  ${ZIG_RELEASE_ARG}
-  ${ZIG_STATIC_ARG}
-  ${ZIG_NO_LIB_ARG}
-  ${ZIG_SINGLE_THREADED_ARG}
-  "-Dtarget=${ZIG_TARGET_TRIPLE}"
-  "-Dcpu=${ZIG_TARGET_MCPU}"
-  "-Dversion-string=${RESOLVED_ZIG_VERSION}"
+    --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
+    "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
+    "-Denable-llvm"
+    "-Denable-stage1"
+    ${ZIG_RELEASE_ARG}
+    ${ZIG_STATIC_ARG}
+    ${ZIG_NO_LIB_ARG}
+    ${ZIG_SINGLE_THREADED_ARG}
+    "-Dtarget=${ZIG_TARGET_TRIPLE}"
+    "-Dcpu=${ZIG_TARGET_MCPU}"
+    "-Dversion-string=${RESOLVED_ZIG_VERSION}"
 )
 
 add_custom_target(stage3 ALL
diff --git a/build.zig b/build.zig
index cf0e092326..7f80c3e1df 100644
--- a/build.zig
+++ b/build.zig
@@ -142,7 +142,8 @@ pub fn build(b: *Builder) !void {
     const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false;
     const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse (enable_llvm or only_c);
     const sanitize_thread = b.option(bool, "sanitize-thread", "Enable thread-sanitization") orelse false;
-    const strip = b.option(bool, "strip", "Omit debug information");
+    const strip = b.option(bool, "strip", "Omit debug information") orelse false;
+    const use_zig0 = b.option(bool, "zig0", "Bootstrap using zig0") orelse false;
     const value_tracing = b.option(bool, "value-tracing", "Enable extra state tracking to help troubleshoot bugs in the compiler (using the std.debug.Trace API)") orelse false;
 
     const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: {
@@ -151,7 +152,22 @@ pub fn build(b: *Builder) !void {
         break :blk 4;
     };
 
-    const exe = addCompilerStep(b);
+    if (only_c) {
+        target.ofmt = .c;
+    }
+
+    const main_file: ?[]const u8 = mf: {
+        if (!have_stage1) break :mf "src/main.zig";
+        if (use_zig0) break :mf null;
+        break :mf "src/stage1.zig";
+    };
+
+    const exe = b.addExecutable("zig", main_file);
+
+    const compile_step = b.step("compile", "Build the self-hosted compiler");
+    compile_step.dependOn(&exe.step);
+
+    exe.stack_size = stack_size;
     exe.strip = strip;
     exe.sanitize_thread = sanitize_thread;
     exe.build_id = b.option(bool, "build-id", "Include a build id note") orelse false;
diff --git a/src/translate_c/ast.zig b/src/translate_c/ast.zig
index 20e4259725..bc0f002c21 100644
--- a/src/translate_c/ast.zig
+++ b/src/translate_c/ast.zig
@@ -1448,6 +1448,12 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
         .optional_type => return renderPrefixOp(c, node, .optional_type, .question_mark, "?"),
         .address_of => {
             const payload = node.castTag(.address_of).?.data;
+            if (c.zig_is_stage1 and payload.tag() == .fn_identifier)
+                return try c.addNode(.{
+                    .tag = .identifier,
+                    .main_token = try c.addIdentifier(payload.castTag(.fn_identifier).?.data),
+                    .data = undefined,
+                });
 
             const ampersand = try c.addToken(.ampersand, "&");
             const base = if (payload.tag() == .fn_identifier)

debug log:

solving 5ad5ffc249 ...
found 5ad5ffc249 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).