authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-27 16:12:06-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 19:49:07-07:00
log6509c492ad7908c515a0c00751e1348b26dda4e7
tree4424e28452be76d1ad081d6284e1f625955efbee
parent791e83c22396e029e0f2bc19b75fd86f8cd7851f

move misc_errors from linker to Compilation

So that they can be referenced by getAllErrorsAlloc(). Fixes missing compile errors.

5 files changed, 130 insertions(+), 125 deletions(-)

src/Compilation.zig+68-65
...@@ -28,7 +28,9 @@ const libcxx = @import("libcxx.zig");...@@ -28,7 +28,9 @@ const libcxx = @import("libcxx.zig");
28const wasi_libc = @import("wasi_libc.zig");28const wasi_libc = @import("wasi_libc.zig");
29const fatal = @import("main.zig").fatal;29const fatal = @import("main.zig").fatal;
30const clangMain = @import("main.zig").clangMain;30const clangMain = @import("main.zig").clangMain;
31const Module = @import("Module.zig");31const Zcu = @import("Module.zig");
32/// Deprecated; use `Zcu`.
33const Module = Zcu;
32const InternPool = @import("InternPool.zig");34const InternPool = @import("InternPool.zig");
33const Cache = std.Build.Cache;35const Cache = std.Build.Cache;
34const c_codegen = @import("codegen/c.zig");36const c_codegen = @import("codegen/c.zig");
...@@ -97,6 +99,7 @@ win32_resource_table: if (build_options.only_core_functionality) void else std.A...@@ -97,6 +99,7 @@ win32_resource_table: if (build_options.only_core_functionality) void else std.A
97 if (build_options.only_core_functionality) {} else .{},99 if (build_options.only_core_functionality) {} else .{},
98100
99link_error_flags: link.File.ErrorFlags = .{},101link_error_flags: link.File.ErrorFlags = .{},
102link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{},
100lld_errors: std.ArrayListUnmanaged(LldError) = .{},103lld_errors: std.ArrayListUnmanaged(LldError) = .{},
101104
102work_queue: std.fifo.LinearFifo(Job, .Dynamic),105work_queue: std.fifo.LinearFifo(Job, .Dynamic),
...@@ -1874,87 +1877,90 @@ pub fn create(gpa: Allocator, options: CreateOptions) !*Compilation {...@@ -1874,87 +1877,90 @@ pub fn create(gpa: Allocator, options: CreateOptions) !*Compilation {
1874 return comp;1877 return comp;
1875}1878}
18761879
1877pub fn destroy(self: *Compilation) void {1880pub fn destroy(comp: *Compilation) void {
1878 if (self.bin_file) |lf| lf.destroy();1881 if (comp.bin_file) |lf| lf.destroy();
1879 if (self.module) |zcu| zcu.deinit();1882 if (comp.module) |zcu| zcu.deinit();
1880 self.cache_use.deinit();1883 comp.cache_use.deinit();
1881 self.work_queue.deinit();1884 comp.work_queue.deinit();
1882 self.anon_work_queue.deinit();1885 comp.anon_work_queue.deinit();
1883 self.c_object_work_queue.deinit();1886 comp.c_object_work_queue.deinit();
1884 if (!build_options.only_core_functionality) {1887 if (!build_options.only_core_functionality) {
1885 self.win32_resource_work_queue.deinit();1888 comp.win32_resource_work_queue.deinit();
1886 }1889 }
1887 self.astgen_work_queue.deinit();1890 comp.astgen_work_queue.deinit();
1888 self.embed_file_work_queue.deinit();1891 comp.embed_file_work_queue.deinit();
18891892
1890 const gpa = self.gpa;1893 const gpa = comp.gpa;
1891 self.system_libs.deinit(gpa);1894 comp.system_libs.deinit(gpa);
18921895
1893 {1896 {
1894 var it = self.crt_files.iterator();1897 var it = comp.crt_files.iterator();
1895 while (it.next()) |entry| {1898 while (it.next()) |entry| {
1896 gpa.free(entry.key_ptr.*);1899 gpa.free(entry.key_ptr.*);
1897 entry.value_ptr.deinit(gpa);1900 entry.value_ptr.deinit(gpa);
1898 }1901 }
1899 self.crt_files.deinit(gpa);1902 comp.crt_files.deinit(gpa);
1900 }1903 }
19011904
1902 if (self.libunwind_static_lib) |*crt_file| {1905 if (comp.libunwind_static_lib) |*crt_file| {
1903 crt_file.deinit(gpa);1906 crt_file.deinit(gpa);
1904 }1907 }
1905 if (self.libcxx_static_lib) |*crt_file| {1908 if (comp.libcxx_static_lib) |*crt_file| {
1906 crt_file.deinit(gpa);1909 crt_file.deinit(gpa);
1907 }1910 }
1908 if (self.libcxxabi_static_lib) |*crt_file| {1911 if (comp.libcxxabi_static_lib) |*crt_file| {
1909 crt_file.deinit(gpa);1912 crt_file.deinit(gpa);
1910 }1913 }
1911 if (self.compiler_rt_lib) |*crt_file| {1914 if (comp.compiler_rt_lib) |*crt_file| {
1912 crt_file.deinit(gpa);1915 crt_file.deinit(gpa);
1913 }1916 }
1914 if (self.compiler_rt_obj) |*crt_file| {1917 if (comp.compiler_rt_obj) |*crt_file| {
1915 crt_file.deinit(gpa);1918 crt_file.deinit(gpa);
1916 }1919 }
1917 if (self.libc_static_lib) |*crt_file| {1920 if (comp.libc_static_lib) |*crt_file| {
1918 crt_file.deinit(gpa);1921 crt_file.deinit(gpa);
1919 }1922 }
19201923
1921 if (self.glibc_so_files) |*glibc_file| {1924 if (comp.glibc_so_files) |*glibc_file| {
1922 glibc_file.deinit(gpa);1925 glibc_file.deinit(gpa);
1923 }1926 }
19241927
1925 for (self.c_object_table.keys()) |key| {1928 for (comp.c_object_table.keys()) |key| {
1926 key.destroy(gpa);1929 key.destroy(gpa);
1927 }1930 }
1928 self.c_object_table.deinit(gpa);1931 comp.c_object_table.deinit(gpa);
19291932
1930 for (self.failed_c_objects.values()) |bundle| {1933 for (comp.failed_c_objects.values()) |bundle| {
1931 bundle.destroy(gpa);1934 bundle.destroy(gpa);
1932 }1935 }
1933 self.failed_c_objects.deinit(gpa);1936 comp.failed_c_objects.deinit(gpa);
19341937
1935 if (!build_options.only_core_functionality) {1938 if (!build_options.only_core_functionality) {
1936 for (self.win32_resource_table.keys()) |key| {1939 for (comp.win32_resource_table.keys()) |key| {
1937 key.destroy(gpa);1940 key.destroy(gpa);
1938 }1941 }
1939 self.win32_resource_table.deinit(gpa);1942 comp.win32_resource_table.deinit(gpa);
19401943
1941 for (self.failed_win32_resources.values()) |*value| {1944 for (comp.failed_win32_resources.values()) |*value| {
1942 value.deinit(gpa);1945 value.deinit(gpa);
1943 }1946 }
1944 self.failed_win32_resources.deinit(gpa);1947 comp.failed_win32_resources.deinit(gpa);
1945 }1948 }
19461949
1947 for (self.lld_errors.items) |*lld_error| {1950 for (comp.link_errors.items) |*item| item.deinit(gpa);
1951 comp.link_errors.deinit(gpa);
1952
1953 for (comp.lld_errors.items) |*lld_error| {
1948 lld_error.deinit(gpa);1954 lld_error.deinit(gpa);
1949 }1955 }
1950 self.lld_errors.deinit(gpa);1956 comp.lld_errors.deinit(gpa);
19511957
1952 self.clearMiscFailures();1958 comp.clearMiscFailures();
19531959
1954 self.cache_parent.manifest_dir.close();1960 comp.cache_parent.manifest_dir.close();
19551961
1956 // This destroys `self`.1962 // This destroys `comp`.
1957 var arena_instance = self.arena;1963 var arena_instance = comp.arena;
1958 arena_instance.deinit();1964 arena_instance.deinit();
1959}1965}
19601966
...@@ -2214,7 +2220,6 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void...@@ -2214,7 +2220,6 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
2214 error.LLDReportedFailure => {}, // error reported via lockAndParseLldStderr2220 error.LLDReportedFailure => {}, // error reported via lockAndParseLldStderr
2215 else => |e| return e,2221 else => |e| return e,
2216 };2222 };
2217 comp.link_error_flags = lf.error_flags;
2218 }2223 }
22192224
2220 if (comp.module) |module| {2225 if (comp.module) |module| {
...@@ -2745,23 +2750,23 @@ fn addBuf(bufs_list: []std.os.iovec_const, bufs_len: *usize, buf: []const u8) vo...@@ -2745,23 +2750,23 @@ fn addBuf(bufs_list: []std.os.iovec_const, bufs_len: *usize, buf: []const u8) vo
2745}2750}
27462751
2747/// This function is temporally single-threaded.2752/// This function is temporally single-threaded.
2748pub fn totalErrorCount(self: *Compilation) u32 {2753pub fn totalErrorCount(comp: *Compilation) u32 {
2749 var total: usize =2754 var total: usize =
2750 self.misc_failures.count() +2755 comp.misc_failures.count() +
2751 @intFromBool(self.alloc_failure_occurred) +2756 @intFromBool(comp.alloc_failure_occurred) +
2752 self.lld_errors.items.len;2757 comp.lld_errors.items.len;
27532758
2754 for (self.failed_c_objects.values()) |bundle| {2759 for (comp.failed_c_objects.values()) |bundle| {
2755 total += bundle.diags.len;2760 total += bundle.diags.len;
2756 }2761 }
27572762
2758 if (!build_options.only_core_functionality) {2763 if (!build_options.only_core_functionality) {
2759 for (self.failed_win32_resources.values()) |errs| {2764 for (comp.failed_win32_resources.values()) |errs| {
2760 total += errs.errorMessageCount();2765 total += errs.errorMessageCount();
2761 }2766 }
2762 }2767 }
27632768
2764 if (self.module) |module| {2769 if (comp.module) |module| {
2765 total += module.failed_exports.count();2770 total += module.failed_exports.count();
2766 total += module.failed_embed_files.count();2771 total += module.failed_embed_files.count();
27672772
...@@ -2804,17 +2809,15 @@ pub fn totalErrorCount(self: *Compilation) u32 {...@@ -2804,17 +2809,15 @@ pub fn totalErrorCount(self: *Compilation) u32 {
28042809
2805 // The "no entry point found" error only counts if there are no semantic analysis errors.2810 // The "no entry point found" error only counts if there are no semantic analysis errors.
2806 if (total == 0) {2811 if (total == 0) {
2807 total += @intFromBool(self.link_error_flags.no_entry_point_found);2812 total += @intFromBool(comp.link_error_flags.no_entry_point_found);
2808 }2813 }
2809 total += @intFromBool(self.link_error_flags.missing_libc);2814 total += @intFromBool(comp.link_error_flags.missing_libc);
28102815
2811 if (self.bin_file) |lf| {2816 total += comp.link_errors.items.len;
2812 total += lf.misc_errors.items.len;
2813 }
28142817
2815 // Compile log errors only count if there are no other errors.2818 // Compile log errors only count if there are no other errors.
2816 if (total == 0) {2819 if (total == 0) {
2817 if (self.module) |module| {2820 if (comp.module) |module| {
2818 total += @intFromBool(module.compile_log_decls.count() != 0);2821 total += @intFromBool(module.compile_log_decls.count() != 0);
2819 }2822 }
2820 }2823 }
...@@ -2823,24 +2826,24 @@ pub fn totalErrorCount(self: *Compilation) u32 {...@@ -2823,24 +2826,24 @@ pub fn totalErrorCount(self: *Compilation) u32 {
2823}2826}
28242827
2825/// This function is temporally single-threaded.2828/// This function is temporally single-threaded.
2826pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {2829pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
2827 const gpa = self.gpa;2830 const gpa = comp.gpa;
28282831
2829 var bundle: ErrorBundle.Wip = undefined;2832 var bundle: ErrorBundle.Wip = undefined;
2830 try bundle.init(gpa);2833 try bundle.init(gpa);
2831 defer bundle.deinit();2834 defer bundle.deinit();
28322835
2833 for (self.failed_c_objects.values()) |diag_bundle| {2836 for (comp.failed_c_objects.values()) |diag_bundle| {
2834 try diag_bundle.addToErrorBundle(&bundle);2837 try diag_bundle.addToErrorBundle(&bundle);
2835 }2838 }
28362839
2837 if (!build_options.only_core_functionality) {2840 if (!build_options.only_core_functionality) {
2838 for (self.failed_win32_resources.values()) |error_bundle| {2841 for (comp.failed_win32_resources.values()) |error_bundle| {
2839 try bundle.addBundleAsRoots(error_bundle);2842 try bundle.addBundleAsRoots(error_bundle);
2840 }2843 }
2841 }2844 }
28422845
2843 for (self.lld_errors.items) |lld_error| {2846 for (comp.lld_errors.items) |lld_error| {
2844 const notes_len = @as(u32, @intCast(lld_error.context_lines.len));2847 const notes_len = @as(u32, @intCast(lld_error.context_lines.len));
28452848
2846 try bundle.addRootErrorMessage(.{2849 try bundle.addRootErrorMessage(.{
...@@ -2854,19 +2857,19 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {...@@ -2854,19 +2857,19 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
2854 }));2857 }));
2855 }2858 }
2856 }2859 }
2857 for (self.misc_failures.values()) |*value| {2860 for (comp.misc_failures.values()) |*value| {
2858 try bundle.addRootErrorMessage(.{2861 try bundle.addRootErrorMessage(.{
2859 .msg = try bundle.addString(value.msg),2862 .msg = try bundle.addString(value.msg),
2860 .notes_len = if (value.children) |b| b.errorMessageCount() else 0,2863 .notes_len = if (value.children) |b| b.errorMessageCount() else 0,
2861 });2864 });
2862 if (value.children) |b| try bundle.addBundleAsNotes(b);2865 if (value.children) |b| try bundle.addBundleAsNotes(b);
2863 }2866 }
2864 if (self.alloc_failure_occurred) {2867 if (comp.alloc_failure_occurred) {
2865 try bundle.addRootErrorMessage(.{2868 try bundle.addRootErrorMessage(.{
2866 .msg = try bundle.addString("memory allocation failure"),2869 .msg = try bundle.addString("memory allocation failure"),
2867 });2870 });
2868 }2871 }
2869 if (self.module) |module| {2872 if (comp.module) |module| {
2870 for (module.failed_files.keys(), module.failed_files.values()) |file, error_msg| {2873 for (module.failed_files.keys(), module.failed_files.values()) |file, error_msg| {
2871 if (error_msg) |msg| {2874 if (error_msg) |msg| {
2872 try addModuleErrorMsg(module, &bundle, msg.*);2875 try addModuleErrorMsg(module, &bundle, msg.*);
...@@ -2938,14 +2941,14 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {...@@ -2938,14 +2941,14 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
2938 }2941 }
29392942
2940 if (bundle.root_list.items.len == 0) {2943 if (bundle.root_list.items.len == 0) {
2941 if (self.link_error_flags.no_entry_point_found) {2944 if (comp.link_error_flags.no_entry_point_found) {
2942 try bundle.addRootErrorMessage(.{2945 try bundle.addRootErrorMessage(.{
2943 .msg = try bundle.addString("no entry point found"),2946 .msg = try bundle.addString("no entry point found"),
2944 });2947 });
2945 }2948 }
2946 }2949 }
29472950
2948 if (self.link_error_flags.missing_libc) {2951 if (comp.link_error_flags.missing_libc) {
2949 try bundle.addRootErrorMessage(.{2952 try bundle.addRootErrorMessage(.{
2950 .msg = try bundle.addString("libc not available"),2953 .msg = try bundle.addString("libc not available"),
2951 .notes_len = 2,2954 .notes_len = 2,
...@@ -2959,7 +2962,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {...@@ -2959,7 +2962,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
2959 }));2962 }));
2960 }2963 }
29612964
2962 if (self.bin_file) |lf| for (lf.misc_errors.items) |link_err| {2965 for (comp.link_errors.items) |link_err| {
2963 try bundle.addRootErrorMessage(.{2966 try bundle.addRootErrorMessage(.{
2964 .msg = try bundle.addString(link_err.msg),2967 .msg = try bundle.addString(link_err.msg),
2965 .notes_len = @intCast(link_err.notes.len),2968 .notes_len = @intCast(link_err.notes.len),
...@@ -2970,9 +2973,9 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {...@@ -2970,9 +2973,9 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
2970 .msg = try bundle.addString(note.msg),2973 .msg = try bundle.addString(note.msg),
2971 }));2974 }));
2972 }2975 }
2973 };2976 }
29742977
2975 if (self.module) |module| {2978 if (comp.module) |module| {
2976 if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) {2979 if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) {
2977 const keys = module.compile_log_decls.keys();2980 const keys = module.compile_log_decls.keys();
2978 const values = module.compile_log_decls.values();2981 const values = module.compile_log_decls.values();
...@@ -2998,9 +3001,9 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {...@@ -2998,9 +3001,9 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
2998 }3001 }
2999 }3002 }
30003003
3001 assert(self.totalErrorCount() == bundle.root_list.items.len);3004 assert(comp.totalErrorCount() == bundle.root_list.items.len);
30023005
3003 const compile_log_text = if (self.module) |m| m.compile_log_text.items else "";3006 const compile_log_text = if (comp.module) |m| m.compile_log_text.items else "";
3004 return bundle.toOwnedBundle(compile_log_text);3007 return bundle.toOwnedBundle(compile_log_text);
3005}3008}
30063009
src/link.zig-8
...@@ -67,9 +67,6 @@ pub const File = struct {...@@ -67,9 +67,6 @@ pub const File = struct {
67 allow_shlib_undefined: bool,67 allow_shlib_undefined: bool,
68 stack_size: u64,68 stack_size: u64,
6969
70 error_flags: ErrorFlags = .{},
71 misc_errors: std.ArrayListUnmanaged(ErrorMsg) = .{},
72
73 /// Prevents other processes from clobbering files in the output directory70 /// Prevents other processes from clobbering files in the output directory
74 /// of this linking operation.71 /// of this linking operation.
75 lock: ?Cache.Lock = null,72 lock: ?Cache.Lock = null,
...@@ -465,13 +462,8 @@ pub const File = struct {...@@ -465,13 +462,8 @@ pub const File = struct {
465 }462 }
466463
467 pub fn destroy(base: *File) void {464 pub fn destroy(base: *File) void {
468 const gpa = base.comp.gpa;
469 base.releaseLock();465 base.releaseLock();
470 if (base.file) |f| f.close();466 if (base.file) |f| f.close();
471 {
472 for (base.misc_errors.items) |*item| item.deinit(gpa);
473 base.misc_errors.deinit(gpa);
474 }
475 switch (base.tag) {467 switch (base.tag) {
476 .c => @fieldParentPtr(C, "base", base).deinit(),468 .c => @fieldParentPtr(C, "base", base).deinit(),
477469
src/link/Coff.zig+2-2
...@@ -1839,10 +1839,10 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod...@@ -1839,10 +1839,10 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
18391839
1840 if (self.entry_addr == null and comp.config.output_mode == .Exe) {1840 if (self.entry_addr == null and comp.config.output_mode == .Exe) {
1841 log.debug("flushing. no_entry_point_found = true\n", .{});1841 log.debug("flushing. no_entry_point_found = true\n", .{});
1842 self.base.error_flags.no_entry_point_found = true;1842 comp.link_error_flags.no_entry_point_found = true;
1843 } else {1843 } else {
1844 log.debug("flushing. no_entry_point_found = false\n", .{});1844 log.debug("flushing. no_entry_point_found = false\n", .{});
1845 self.base.error_flags.no_entry_point_found = false;1845 comp.link_error_flags.no_entry_point_found = false;
1846 try self.writeHeader();1846 try self.writeHeader();
1847 }1847 }
18481848
src/link/Elf.zig+29-26
...@@ -1170,7 +1170,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node...@@ -1170,7 +1170,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
1170 }1170 }
11711171
1172 // libc dep1172 // libc dep
1173 self.base.error_flags.missing_libc = false;1173 comp.link_error_flags.missing_libc = false;
1174 if (comp.config.link_libc) {1174 if (comp.config.link_libc) {
1175 if (comp.libc_installation) |lc| {1175 if (comp.libc_installation) |lc| {
1176 const flags = target_util.libcFullLinkFlags(target);1176 const flags = target_util.libcFullLinkFlags(target);
...@@ -1221,7 +1221,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node...@@ -1221,7 +1221,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
1221 });1221 });
1222 try system_libs.append(.{ .path = path });1222 try system_libs.append(.{ .path = path });
1223 } else {1223 } else {
1224 self.base.error_flags.missing_libc = true;1224 comp.link_error_flags.missing_libc = true;
1225 }1225 }
1226 }1226 }
12271227
...@@ -1259,7 +1259,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node...@@ -1259,7 +1259,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
1259 };1259 };
1260 }1260 }
12611261
1262 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1262 if (comp.link_errors.items.len > 0) return error.FlushFailure;
12631263
1264 // Init all objects1264 // Init all objects
1265 for (self.objects.items) |index| {1265 for (self.objects.items) |index| {
...@@ -1269,7 +1269,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node...@@ -1269,7 +1269,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
1269 try self.file(index).?.shared_object.init(self);1269 try self.file(index).?.shared_object.init(self);
1270 }1270 }
12711271
1272 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1272 if (comp.link_errors.items.len > 0) return error.FlushFailure;
12731273
1274 // Dedup shared objects1274 // Dedup shared objects
1275 {1275 {
...@@ -1388,14 +1388,14 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node...@@ -1388,14 +1388,14 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
13881388
1389 if (self.entry_index == null and self.base.isExe()) {1389 if (self.entry_index == null and self.base.isExe()) {
1390 log.debug("flushing. no_entry_point_found = true", .{});1390 log.debug("flushing. no_entry_point_found = true", .{});
1391 self.base.error_flags.no_entry_point_found = true;1391 comp.link_error_flags.no_entry_point_found = true;
1392 } else {1392 } else {
1393 log.debug("flushing. no_entry_point_found = false", .{});1393 log.debug("flushing. no_entry_point_found = false", .{});
1394 self.base.error_flags.no_entry_point_found = false;1394 comp.link_error_flags.no_entry_point_found = false;
1395 try self.writeElfHeader();1395 try self.writeElfHeader();
1396 }1396 }
13971397
1398 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1398 if (comp.link_errors.items.len > 0) return error.FlushFailure;
1399}1399}
14001400
1401pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {1401pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {
...@@ -1427,7 +1427,7 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const...@@ -1427,7 +1427,7 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const
1427 };1427 };
1428 }1428 }
14291429
1430 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1430 if (comp.link_errors.items.len > 0) return error.FlushFailure;
14311431
1432 // First, we flush relocatable object file generated with our backends.1432 // First, we flush relocatable object file generated with our backends.
1433 if (self.zigObjectPtr()) |zig_object| {1433 if (self.zigObjectPtr()) |zig_object| {
...@@ -1539,7 +1539,7 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const...@@ -1539,7 +1539,7 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const
1539 try self.base.file.?.setEndPos(total_size);1539 try self.base.file.?.setEndPos(total_size);
1540 try self.base.file.?.pwriteAll(buffer.items, 0);1540 try self.base.file.?.pwriteAll(buffer.items, 0);
15411541
1542 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1542 if (comp.link_errors.items.len > 0) return error.FlushFailure;
1543}1543}
15441544
1545pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {1545pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {
...@@ -1570,14 +1570,14 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)...@@ -1570,14 +1570,14 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)
1570 };1570 };
1571 }1571 }
15721572
1573 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1573 if (comp.link_errors.items.len > 0) return error.FlushFailure;
15741574
1575 // Init all objects1575 // Init all objects
1576 for (self.objects.items) |index| {1576 for (self.objects.items) |index| {
1577 try self.file(index).?.object.init(self);1577 try self.file(index).?.object.init(self);
1578 }1578 }
15791579
1580 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1580 if (comp.link_errors.items.len > 0) return error.FlushFailure;
15811581
1582 // Now, we are ready to resolve the symbols across all input files.1582 // Now, we are ready to resolve the symbols across all input files.
1583 // We will first resolve the files in the ZigObject, next in the parsed1583 // We will first resolve the files in the ZigObject, next in the parsed
...@@ -1611,7 +1611,7 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)...@@ -1611,7 +1611,7 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)
1611 try self.writeShdrTable();1611 try self.writeShdrTable();
1612 try self.writeElfHeader();1612 try self.writeElfHeader();
16131613
1614 if (self.base.misc_errors.items.len > 0) return error.FlushFailure;1614 if (comp.link_errors.items.len > 0) return error.FlushFailure;
1615}1615}
16161616
1617/// --verbose-link output1617/// --verbose-link output
...@@ -2888,7 +2888,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -2888,7 +2888,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
2888 }2888 }
28892889
2890 // libc dep2890 // libc dep
2891 self.base.error_flags.missing_libc = false;2891 comp.link_error_flags.missing_libc = false;
2892 if (comp.config.link_libc) {2892 if (comp.config.link_libc) {
2893 if (self.base.comp.libc_installation != null) {2893 if (self.base.comp.libc_installation != null) {
2894 const needs_grouping = link_mode == .Static;2894 const needs_grouping = link_mode == .Static;
...@@ -2909,7 +2909,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -2909,7 +2909,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
2909 .Dynamic => "libc.so",2909 .Dynamic => "libc.so",
2910 }));2910 }));
2911 } else {2911 } else {
2912 self.base.error_flags.missing_libc = true;2912 comp.link_error_flags.missing_libc = true;
2913 }2913 }
2914 }2914 }
2915 }2915 }
...@@ -3132,7 +3132,8 @@ fn writePhdrTable(self: *Elf) !void {...@@ -3132,7 +3132,8 @@ fn writePhdrTable(self: *Elf) !void {
3132}3132}
31333133
3134fn writeElfHeader(self: *Elf) !void {3134fn writeElfHeader(self: *Elf) !void {
3135 if (self.base.misc_errors.items.len > 0) return; // We had errors, so skip flushing to render the output unusable3135 const comp = self.base.comp;
3136 if (comp.link_errors.items.len > 0) return; // We had errors, so skip flushing to render the output unusable
31363137
3137 var hdr_buf: [@sizeOf(elf.Elf64_Ehdr)]u8 = undefined;3138 var hdr_buf: [@sizeOf(elf.Elf64_Ehdr)]u8 = undefined;
31383139
...@@ -3146,7 +3147,6 @@ fn writeElfHeader(self: *Elf) !void {...@@ -3146,7 +3147,6 @@ fn writeElfHeader(self: *Elf) !void {
3146 };3147 };
3147 index += 1;3148 index += 1;
31483149
3149 const comp = self.base.comp;
3150 const target = comp.root_mod.resolved_target.result;3150 const target = comp.root_mod.resolved_target.result;
3151 const endian = target.cpu.arch.endian();3151 const endian = target.cpu.arch.endian();
3152 hdr_buf[index] = switch (endian) {3152 hdr_buf[index] = switch (endian) {
...@@ -6055,7 +6055,7 @@ pub fn tlsAddress(self: *Elf) u64 {...@@ -6055,7 +6055,7 @@ pub fn tlsAddress(self: *Elf) u64 {
6055}6055}
60566056
6057const ErrorWithNotes = struct {6057const ErrorWithNotes = struct {
6058 /// Allocated index in misc_errors array.6058 /// Allocated index in comp.link_errors array.
6059 index: usize,6059 index: usize,
60606060
6061 /// Next available note slot.6061 /// Next available note slot.
...@@ -6069,7 +6069,7 @@ const ErrorWithNotes = struct {...@@ -6069,7 +6069,7 @@ const ErrorWithNotes = struct {
6069 ) error{OutOfMemory}!void {6069 ) error{OutOfMemory}!void {
6070 const comp = elf_file.base.comp;6070 const comp = elf_file.base.comp;
6071 const gpa = comp.gpa;6071 const gpa = comp.gpa;
6072 const err_msg = &elf_file.base.misc_errors.items[err.index];6072 const err_msg = &comp.link_errors.items[err.index];
6073 err_msg.msg = try std.fmt.allocPrint(gpa, format, args);6073 err_msg.msg = try std.fmt.allocPrint(gpa, format, args);
6074 }6074 }
60756075
...@@ -6081,7 +6081,7 @@ const ErrorWithNotes = struct {...@@ -6081,7 +6081,7 @@ const ErrorWithNotes = struct {
6081 ) error{OutOfMemory}!void {6081 ) error{OutOfMemory}!void {
6082 const comp = elf_file.base.comp;6082 const comp = elf_file.base.comp;
6083 const gpa = comp.gpa;6083 const gpa = comp.gpa;
6084 const err_msg = &elf_file.base.misc_errors.items[err.index];6084 const err_msg = &comp.link_errors.items[err.index];
6085 assert(err.note_slot < err_msg.notes.len);6085 assert(err.note_slot < err_msg.notes.len);
6086 err_msg.notes[err.note_slot] = .{ .msg = try std.fmt.allocPrint(gpa, format, args) };6086 err_msg.notes[err.note_slot] = .{ .msg = try std.fmt.allocPrint(gpa, format, args) };
6087 err.note_slot += 1;6087 err.note_slot += 1;
...@@ -6089,15 +6089,17 @@ const ErrorWithNotes = struct {...@@ -6089,15 +6089,17 @@ const ErrorWithNotes = struct {
6089};6089};
60906090
6091pub fn addErrorWithNotes(self: *Elf, note_count: usize) error{OutOfMemory}!ErrorWithNotes {6091pub fn addErrorWithNotes(self: *Elf, note_count: usize) error{OutOfMemory}!ErrorWithNotes {
6092 const gpa = self.base.comp.gpa;6092 const comp = self.base.comp;
6093 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);6093 const gpa = comp.gpa;
6094 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
6094 return self.addErrorWithNotesAssumeCapacity(note_count);6095 return self.addErrorWithNotesAssumeCapacity(note_count);
6095}6096}
60966097
6097fn addErrorWithNotesAssumeCapacity(self: *Elf, note_count: usize) error{OutOfMemory}!ErrorWithNotes {6098fn addErrorWithNotesAssumeCapacity(self: *Elf, note_count: usize) error{OutOfMemory}!ErrorWithNotes {
6098 const gpa = self.base.comp.gpa;6099 const comp = self.base.comp;
6099 const index = self.base.misc_errors.items.len;6100 const gpa = comp.gpa;
6100 const err = self.base.misc_errors.addOneAssumeCapacity();6101 const index = comp.link_errors.items.len;
6102 const err = comp.link_errors.addOneAssumeCapacity();
6101 err.* = .{ .msg = undefined, .notes = try gpa.alloc(link.File.ErrorMsg, note_count) };6103 err.* = .{ .msg = undefined, .notes = try gpa.alloc(link.File.ErrorMsg, note_count) };
6102 return .{ .index = index };6104 return .{ .index = index };
6103}6105}
...@@ -6129,10 +6131,11 @@ pub fn insertDynString(self: *Elf, name: []const u8) error{OutOfMemory}!u32 {...@@ -6129,10 +6131,11 @@ pub fn insertDynString(self: *Elf, name: []const u8) error{OutOfMemory}!u32 {
6129}6131}
61306132
6131fn reportUndefinedSymbols(self: *Elf, undefs: anytype) !void {6133fn reportUndefinedSymbols(self: *Elf, undefs: anytype) !void {
6132 const gpa = self.base.comp.gpa;6134 const comp = self.base.comp;
6135 const gpa = comp.gpa;
6133 const max_notes = 4;6136 const max_notes = 4;
61346137
6135 try self.base.misc_errors.ensureUnusedCapacity(gpa, undefs.count());6138 try comp.link_errors.ensureUnusedCapacity(gpa, undefs.count());
61366139
6137 var it = undefs.iterator();6140 var it = undefs.iterator();
6138 while (it.next()) |entry| {6141 while (it.next()) |entry| {
src/link/MachO.zig+31-24
...@@ -323,8 +323,8 @@ pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) li...@@ -323,8 +323,8 @@ pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) li
323 if (build_options.have_llvm) {323 if (build_options.have_llvm) {
324 return self.base.linkAsArchive(comp, prog_node);324 return self.base.linkAsArchive(comp, prog_node);
325 } else {325 } else {
326 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);326 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
327 self.base.misc_errors.appendAssumeCapacity(.{327 comp.link_errors.appendAssumeCapacity(.{
328 .msg = try gpa.dupe(u8, "TODO: non-LLVM archiver for MachO object files"),328 .msg = try gpa.dupe(u8, "TODO: non-LLVM archiver for MachO object files"),
329 });329 });
330 return error.FlushFailure;330 return error.FlushFailure;
...@@ -426,7 +426,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No...@@ -426,7 +426,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No
426 try self.resolveSymbols();426 try self.resolveSymbols();
427427
428 if (self.getEntryPoint() == null) {428 if (self.getEntryPoint() == null) {
429 self.base.error_flags.no_entry_point_found = true;429 comp.link_error_flags.no_entry_point_found = true;
430 }430 }
431 if (self.unresolved.count() > 0) {431 if (self.unresolved.count() > 0) {
432 try self.reportUndefined();432 try self.reportUndefined();
...@@ -5254,14 +5254,15 @@ fn reportMissingLibraryError(...@@ -5254,14 +5254,15 @@ fn reportMissingLibraryError(
5254 comptime format: []const u8,5254 comptime format: []const u8,
5255 args: anytype,5255 args: anytype,
5256) error{OutOfMemory}!void {5256) error{OutOfMemory}!void {
5257 const gpa = self.base.comp.gpa;5257 const comp = self.base.comp;
5258 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5258 const gpa = comp.gpa;
5259 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
5259 const notes = try gpa.alloc(File.ErrorMsg, checked_paths.len);5260 const notes = try gpa.alloc(File.ErrorMsg, checked_paths.len);
5260 errdefer gpa.free(notes);5261 errdefer gpa.free(notes);
5261 for (checked_paths, notes) |path, *note| {5262 for (checked_paths, notes) |path, *note| {
5262 note.* = .{ .msg = try std.fmt.allocPrint(gpa, "tried {s}", .{path}) };5263 note.* = .{ .msg = try std.fmt.allocPrint(gpa, "tried {s}", .{path}) };
5263 }5264 }
5264 self.base.misc_errors.appendAssumeCapacity(.{5265 comp.link_errors.appendAssumeCapacity(.{
5265 .msg = try std.fmt.allocPrint(gpa, format, args),5266 .msg = try std.fmt.allocPrint(gpa, format, args),
5266 .notes = notes,5267 .notes = notes,
5267 });5268 });
...@@ -5274,15 +5275,16 @@ fn reportDependencyError(...@@ -5274,15 +5275,16 @@ fn reportDependencyError(
5274 comptime format: []const u8,5275 comptime format: []const u8,
5275 args: anytype,5276 args: anytype,
5276) error{OutOfMemory}!void {5277) error{OutOfMemory}!void {
5277 const gpa = self.base.comp.gpa;5278 const comp = self.base.comp;
5278 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5279 const gpa = comp.gpa;
5280 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
5279 var notes = try std.ArrayList(File.ErrorMsg).initCapacity(gpa, 2);5281 var notes = try std.ArrayList(File.ErrorMsg).initCapacity(gpa, 2);
5280 defer notes.deinit();5282 defer notes.deinit();
5281 if (path) |p| {5283 if (path) |p| {
5282 notes.appendAssumeCapacity(.{ .msg = try std.fmt.allocPrint(gpa, "while parsing {s}", .{p}) });5284 notes.appendAssumeCapacity(.{ .msg = try std.fmt.allocPrint(gpa, "while parsing {s}", .{p}) });
5283 }5285 }
5284 notes.appendAssumeCapacity(.{ .msg = try std.fmt.allocPrint(gpa, "a dependency of {s}", .{parent}) });5286 notes.appendAssumeCapacity(.{ .msg = try std.fmt.allocPrint(gpa, "a dependency of {s}", .{parent}) });
5285 self.base.misc_errors.appendAssumeCapacity(.{5287 comp.link_errors.appendAssumeCapacity(.{
5286 .msg = try std.fmt.allocPrint(gpa, format, args),5288 .msg = try std.fmt.allocPrint(gpa, format, args),
5287 .notes = try notes.toOwnedSlice(),5289 .notes = try notes.toOwnedSlice(),
5288 });5290 });
...@@ -5294,12 +5296,13 @@ pub fn reportParseError(...@@ -5294,12 +5296,13 @@ pub fn reportParseError(
5294 comptime format: []const u8,5296 comptime format: []const u8,
5295 args: anytype,5297 args: anytype,
5296) error{OutOfMemory}!void {5298) error{OutOfMemory}!void {
5297 const gpa = self.base.comp.gpa;5299 const comp = self.base.comp;
5298 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5300 const gpa = comp.gpa;
5301 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
5299 var notes = try gpa.alloc(File.ErrorMsg, 1);5302 var notes = try gpa.alloc(File.ErrorMsg, 1);
5300 errdefer gpa.free(notes);5303 errdefer gpa.free(notes);
5301 notes[0] = .{ .msg = try std.fmt.allocPrint(gpa, "while parsing {s}", .{path}) };5304 notes[0] = .{ .msg = try std.fmt.allocPrint(gpa, "while parsing {s}", .{path}) };
5302 self.base.misc_errors.appendAssumeCapacity(.{5305 comp.link_errors.appendAssumeCapacity(.{
5303 .msg = try std.fmt.allocPrint(gpa, format, args),5306 .msg = try std.fmt.allocPrint(gpa, format, args),
5304 .notes = notes,5307 .notes = notes,
5305 });5308 });
...@@ -5311,21 +5314,23 @@ pub fn reportUnresolvedBoundarySymbol(...@@ -5311,21 +5314,23 @@ pub fn reportUnresolvedBoundarySymbol(
5311 comptime format: []const u8,5314 comptime format: []const u8,
5312 args: anytype,5315 args: anytype,
5313) error{OutOfMemory}!void {5316) error{OutOfMemory}!void {
5314 const gpa = self.base.comp.gpa;5317 const comp = self.base.comp;
5315 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5318 const gpa = comp.gpa;
5319 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
5316 var notes = try gpa.alloc(File.ErrorMsg, 1);5320 var notes = try gpa.alloc(File.ErrorMsg, 1);
5317 errdefer gpa.free(notes);5321 errdefer gpa.free(notes);
5318 notes[0] = .{ .msg = try std.fmt.allocPrint(gpa, "while resolving {s}", .{sym_name}) };5322 notes[0] = .{ .msg = try std.fmt.allocPrint(gpa, "while resolving {s}", .{sym_name}) };
5319 self.base.misc_errors.appendAssumeCapacity(.{5323 comp.link_errors.appendAssumeCapacity(.{
5320 .msg = try std.fmt.allocPrint(gpa, format, args),5324 .msg = try std.fmt.allocPrint(gpa, format, args),
5321 .notes = notes,5325 .notes = notes,
5322 });5326 });
5323}5327}
53245328
5325pub fn reportUndefined(self: *MachO) error{OutOfMemory}!void {5329pub fn reportUndefined(self: *MachO) error{OutOfMemory}!void {
5326 const gpa = self.base.comp.gpa;5330 const comp = self.base.comp;
5331 const gpa = comp.gpa;
5327 const count = self.unresolved.count();5332 const count = self.unresolved.count();
5328 try self.base.misc_errors.ensureUnusedCapacity(gpa, count);5333 try comp.link_errors.ensureUnusedCapacity(gpa, count);
53295334
5330 for (self.unresolved.keys()) |global_index| {5335 for (self.unresolved.keys()) |global_index| {
5331 const global = self.globals.items[global_index];5336 const global = self.globals.items[global_index];
...@@ -5346,7 +5351,7 @@ pub fn reportUndefined(self: *MachO) error{OutOfMemory}!void {...@@ -5346,7 +5351,7 @@ pub fn reportUndefined(self: *MachO) error{OutOfMemory}!void {
5346 };5351 };
5347 err_msg.notes = try notes.toOwnedSlice();5352 err_msg.notes = try notes.toOwnedSlice();
53485353
5349 self.base.misc_errors.appendAssumeCapacity(err_msg);5354 comp.link_errors.appendAssumeCapacity(err_msg);
5350 }5355 }
5351}5356}
53525357
...@@ -5355,8 +5360,9 @@ fn reportSymbolCollision(...@@ -5355,8 +5360,9 @@ fn reportSymbolCollision(
5355 first: SymbolWithLoc,5360 first: SymbolWithLoc,
5356 other: SymbolWithLoc,5361 other: SymbolWithLoc,
5357) error{OutOfMemory}!void {5362) error{OutOfMemory}!void {
5358 const gpa = self.base.comp.gpa;5363 const comp = self.base.comp;
5359 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5364 const gpa = comp.gpa;
5365 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
53605366
5361 var notes = try std.ArrayList(File.ErrorMsg).initCapacity(gpa, 2);5367 var notes = try std.ArrayList(File.ErrorMsg).initCapacity(gpa, 2);
5362 defer notes.deinit();5368 defer notes.deinit();
...@@ -5379,12 +5385,13 @@ fn reportSymbolCollision(...@@ -5379,12 +5385,13 @@ fn reportSymbolCollision(
5379 }) };5385 }) };
5380 err_msg.notes = try notes.toOwnedSlice();5386 err_msg.notes = try notes.toOwnedSlice();
53815387
5382 self.base.misc_errors.appendAssumeCapacity(err_msg);5388 comp.link_errors.appendAssumeCapacity(err_msg);
5383}5389}
53845390
5385fn reportUnhandledSymbolType(self: *MachO, sym_with_loc: SymbolWithLoc) error{OutOfMemory}!void {5391fn reportUnhandledSymbolType(self: *MachO, sym_with_loc: SymbolWithLoc) error{OutOfMemory}!void {
5386 const gpa = self.base.comp.gpa;5392 const comp = self.base.comp;
5387 try self.base.misc_errors.ensureUnusedCapacity(gpa, 1);5393 const gpa = comp.gpa;
5394 try comp.link_errors.ensureUnusedCapacity(gpa, 1);
53885395
5389 const notes = try gpa.alloc(File.ErrorMsg, 1);5396 const notes = try gpa.alloc(File.ErrorMsg, 1);
5390 errdefer gpa.free(notes);5397 errdefer gpa.free(notes);
...@@ -5402,7 +5409,7 @@ fn reportUnhandledSymbolType(self: *MachO, sym_with_loc: SymbolWithLoc) error{Ou...@@ -5402,7 +5409,7 @@ fn reportUnhandledSymbolType(self: *MachO, sym_with_loc: SymbolWithLoc) error{Ou
5402 else5409 else
5403 unreachable;5410 unreachable;
54045411
5405 self.base.misc_errors.appendAssumeCapacity(.{5412 comp.link_errors.appendAssumeCapacity(.{
5406 .msg = try std.fmt.allocPrint(gpa, "unhandled symbol type: '{s}' has type {s}", .{5413 .msg = try std.fmt.allocPrint(gpa, "unhandled symbol type: '{s}' has type {s}", .{
5407 self.getSymbolName(sym_with_loc),5414 self.getSymbolName(sym_with_loc),
5408 sym_type,5415 sym_type,