| author | |
| committer | |
| log | 8e57dd57cab68b469fcdfd4792ceb5ca09220924 |
| tree | 82d8ba830f2dc166646091c85821f5f6b7818ecc |
| parent | 599213463d51bf3946df53e04091f6cda3d8ee0e |
| signature |
8 files changed, 32 insertions(+), 2 deletions(-)
lib/std/build.zig+9| ... | @@ -40,6 +40,7 @@ pub const Builder = struct { | ... | @@ -40,6 +40,7 @@ pub const Builder = struct { |
| 40 | verbose_ir: bool, | 40 | verbose_ir: bool, |
| 41 | verbose_llvm_ir: bool, | 41 | verbose_llvm_ir: bool, |
| 42 | verbose_cimport: bool, | 42 | verbose_cimport: bool, |
| 43 | link_eh_frame_hdr: bool, | ||
| 43 | invalid_user_input: bool, | 44 | invalid_user_input: bool, |
| 44 | zig_exe: []const u8, | 45 | zig_exe: []const u8, |
| 45 | default_step: *Step, | 46 | default_step: *Step, |
| ... | @@ -136,6 +137,7 @@ pub const Builder = struct { | ... | @@ -136,6 +137,7 @@ pub const Builder = struct { |
| 136 | .verbose_ir = false, | 137 | .verbose_ir = false, |
| 137 | .verbose_llvm_ir = false, | 138 | .verbose_llvm_ir = false, |
| 138 | .verbose_cimport = false, | 139 | .verbose_cimport = false, |
| 140 | .link_eh_frame_hdr = false, | ||
| 139 | .invalid_user_input = false, | 141 | .invalid_user_input = false, |
| 140 | .allocator = allocator, | 142 | .allocator = allocator, |
| 141 | .native_system_lib_paths = ArrayList([]const u8).init(allocator), | 143 | .native_system_lib_paths = ArrayList([]const u8).init(allocator), |
| ... | @@ -1175,6 +1177,8 @@ pub const LibExeObjStep = struct { | ... | @@ -1175,6 +1177,8 @@ pub const LibExeObjStep = struct { |
| 1175 | 1177 | ||
| 1176 | valgrind_support: ?bool = null, | 1178 | valgrind_support: ?bool = null, |
| 1177 | 1179 | ||
| 1180 | link_eh_frame_hdr: bool = false, | ||
| 1181 | |||
| 1178 | /// Uses system Wine installation to run cross compiled Windows build artifacts. | 1182 | /// Uses system Wine installation to run cross compiled Windows build artifacts. |
| 1179 | enable_wine: bool = false, | 1183 | enable_wine: bool = false, |
| 1180 | 1184 | ||
| ... | @@ -1623,6 +1627,10 @@ pub const LibExeObjStep = struct { | ... | @@ -1623,6 +1627,10 @@ pub const LibExeObjStep = struct { |
| 1623 | self.verbose_cc = value; | 1627 | self.verbose_cc = value; |
| 1624 | } | 1628 | } |
| 1625 | 1629 | ||
| 1630 | pub fn setLinkEhFrameHdr(self: *LibExeObjStep, value: bool) void { | ||
| 1631 | self.link_eh_frame_hdr = value; | ||
| 1632 | } | ||
| 1633 | |||
| 1626 | pub fn setBuildMode(self: *LibExeObjStep, mode: builtin.Mode) void { | 1634 | pub fn setBuildMode(self: *LibExeObjStep, mode: builtin.Mode) void { |
| 1627 | self.build_mode = mode; | 1635 | self.build_mode = mode; |
| 1628 | } | 1636 | } |
| ... | @@ -1908,6 +1916,7 @@ pub const LibExeObjStep = struct { | ... | @@ -1908,6 +1916,7 @@ pub const LibExeObjStep = struct { |
| 1908 | if (builder.verbose_llvm_ir) zig_args.append("--verbose-llvm-ir") catch unreachable; | 1916 | if (builder.verbose_llvm_ir) zig_args.append("--verbose-llvm-ir") catch unreachable; |
| 1909 | if (builder.verbose_link or self.verbose_link) zig_args.append("--verbose-link") catch unreachable; | 1917 | if (builder.verbose_link or self.verbose_link) zig_args.append("--verbose-link") catch unreachable; |
| 1910 | if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable; | 1918 | if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable; |
| 1919 | if (builder.link_eh_frame_hdr or self.link_eh_frame_hdr) zig_args.append("--eh-frame-hdr") catch unreachable; | ||
| 1911 | 1920 | ||
| 1912 | if (self.strip) { | 1921 | if (self.strip) { |
| 1913 | zig_args.append("--strip") catch unreachable; | 1922 | zig_args.append("--strip") catch unreachable; |
src-self-hosted/compilation.zig+2| ... | @@ -170,6 +170,8 @@ pub const Compilation = struct { | ... | @@ -170,6 +170,8 @@ pub const Compilation = struct { |
| 170 | verbose_llvm_ir: bool = false, | 170 | verbose_llvm_ir: bool = false, |
| 171 | verbose_link: bool = false, | 171 | verbose_link: bool = false, |
| 172 | 172 | ||
| 173 | link_eh_frame_hdr: bool = false, | ||
| 174 | |||
| 173 | darwin_version_min: DarwinVersionMin = .None, | 175 | darwin_version_min: DarwinVersionMin = .None, |
| 174 | 176 | ||
| 175 | test_filters: []const []const u8 = &[_][]const u8{}, | 177 | test_filters: []const []const u8 = &[_][]const u8{}, |
src-self-hosted/link.zig+3-1| ... | @@ -144,7 +144,9 @@ fn constructLinkerArgsElf(ctx: *Context) !void { | ... | @@ -144,7 +144,9 @@ fn constructLinkerArgsElf(ctx: *Context) !void { |
| 144 | // lj->args.append(g->linker_script); | 144 | // lj->args.append(g->linker_script); |
| 145 | //} | 145 | //} |
| 146 | try ctx.args.append("--gc-sections"); | 146 | try ctx.args.append("--gc-sections"); |
| 147 | try ctx.args.append("--eh-frame-hdr"); | 147 | if (ctx.comp.link_eh_frame_hdr) { |
| 148 | try ctx.args.append("--eh-frame-hdr"); | ||
| 149 | } | ||
| 148 | 150 | ||
| 149 | //lj->args.append("-m"); | 151 | //lj->args.append("-m"); |
| 150 | //lj->args.append(getLDMOption(&g->zig_target)); | 152 | //lj->args.append(getLDMOption(&g->zig_target)); |
src-self-hosted/main.zig+6| ... | @@ -154,6 +154,7 @@ const usage_build_generic = | ... | @@ -154,6 +154,7 @@ const usage_build_generic = |
| 154 | \\ --static Output will be statically linked | 154 | \\ --static Output will be statically linked |
| 155 | \\ --strip Exclude debug symbols | 155 | \\ --strip Exclude debug symbols |
| 156 | \\ -target [name] <arch><sub>-<os>-<abi> see the targets command | 156 | \\ -target [name] <arch><sub>-<os>-<abi> see the targets command |
| 157 | \\ --eh-frame-hdr enable C++ exception handling by passing --eh-frame-hdr to linker | ||
| 157 | \\ --verbose-tokenize Turn on compiler debug output for tokenization | 158 | \\ --verbose-tokenize Turn on compiler debug output for tokenization |
| 158 | \\ --verbose-ast-tree Turn on compiler debug output for parsing into an AST (tree view) | 159 | \\ --verbose-ast-tree Turn on compiler debug output for parsing into an AST (tree view) |
| 159 | \\ --verbose-ast-fmt Turn on compiler debug output for parsing into an AST (render source) | 160 | \\ --verbose-ast-fmt Turn on compiler debug output for parsing into an AST (render source) |
| ... | @@ -207,6 +208,7 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co | ... | @@ -207,6 +208,7 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co |
| 207 | var verbose_llvm_ir = false; | 208 | var verbose_llvm_ir = false; |
| 208 | var verbose_cimport = false; | 209 | var verbose_cimport = false; |
| 209 | var linker_rdynamic = false; | 210 | var linker_rdynamic = false; |
| 211 | var link_eh_frame_hdr = false; | ||
| 210 | var macosx_version_min: ?[]const u8 = null; | 212 | var macosx_version_min: ?[]const u8 = null; |
| 211 | var ios_version_min: ?[]const u8 = null; | 213 | var ios_version_min: ?[]const u8 = null; |
| 212 | 214 | ||
| ... | @@ -369,6 +371,8 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co | ... | @@ -369,6 +371,8 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co |
| 369 | verbose_ir = true; | 371 | verbose_ir = true; |
| 370 | } else if (mem.eql(u8, arg, "--verbose-llvm-ir")) { | 372 | } else if (mem.eql(u8, arg, "--verbose-llvm-ir")) { |
| 371 | verbose_llvm_ir = true; | 373 | verbose_llvm_ir = true; |
| 374 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { | ||
| 375 | link_eh_frame_hdr = true; | ||
| 372 | } else if (mem.eql(u8, arg, "--verbose-cimport")) { | 376 | } else if (mem.eql(u8, arg, "--verbose-cimport")) { |
| 373 | verbose_cimport = true; | 377 | verbose_cimport = true; |
| 374 | } else if (mem.eql(u8, arg, "-rdynamic")) { | 378 | } else if (mem.eql(u8, arg, "-rdynamic")) { |
| ... | @@ -498,6 +502,8 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co | ... | @@ -498,6 +502,8 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co |
| 498 | comp.verbose_llvm_ir = verbose_llvm_ir; | 502 | comp.verbose_llvm_ir = verbose_llvm_ir; |
| 499 | comp.verbose_cimport = verbose_cimport; | 503 | comp.verbose_cimport = verbose_cimport; |
| 500 | 504 | ||
| 505 | comp.link_eh_frame_hdr = link_eh_frame_hdr; | ||
| 506 | |||
| 501 | comp.err_color = color; | 507 | comp.err_color = color; |
| 502 | 508 | ||
| 503 | comp.linker_rdynamic = linker_rdynamic; | 509 | comp.linker_rdynamic = linker_rdynamic; |
src/all_types.hpp+1| ... | @@ -2131,6 +2131,7 @@ struct CodeGen { | ... | @@ -2131,6 +2131,7 @@ struct CodeGen { |
| 2131 | bool have_winmain_crt_startup; | 2131 | bool have_winmain_crt_startup; |
| 2132 | bool have_dllmain_crt_startup; | 2132 | bool have_dllmain_crt_startup; |
| 2133 | bool have_err_ret_tracing; | 2133 | bool have_err_ret_tracing; |
| 2134 | bool link_eh_frame_hdr; | ||
| 2134 | bool c_want_stdint; | 2135 | bool c_want_stdint; |
| 2135 | bool c_want_stdbool; | 2136 | bool c_want_stdbool; |
| 2136 | bool verbose_tokenize; | 2137 | bool verbose_tokenize; |
src/codegen.cpp+3| ... | @@ -8629,6 +8629,7 @@ static Error define_builtin_compile_vars(CodeGen *g) { | ... | @@ -8629,6 +8629,7 @@ static Error define_builtin_compile_vars(CodeGen *g) { |
| 8629 | cache_bool(&cache_hash, g->have_err_ret_tracing); | 8629 | cache_bool(&cache_hash, g->have_err_ret_tracing); |
| 8630 | cache_bool(&cache_hash, g->libc_link_lib != nullptr); | 8630 | cache_bool(&cache_hash, g->libc_link_lib != nullptr); |
| 8631 | cache_bool(&cache_hash, g->valgrind_support); | 8631 | cache_bool(&cache_hash, g->valgrind_support); |
| 8632 | cache_bool(&cache_hash, g->link_eh_frame_hdr); | ||
| 8632 | cache_int(&cache_hash, detect_subsystem(g)); | 8633 | cache_int(&cache_hash, detect_subsystem(g)); |
| 8633 | 8634 | ||
| 8634 | Buf digest = BUF_INIT; | 8635 | Buf digest = BUF_INIT; |
| ... | @@ -9510,6 +9511,7 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose | ... | @@ -9510,6 +9511,7 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose |
| 9510 | cache_int(cache_hash, g->build_mode); | 9511 | cache_int(cache_hash, g->build_mode); |
| 9511 | cache_bool(cache_hash, g->have_pic); | 9512 | cache_bool(cache_hash, g->have_pic); |
| 9512 | cache_bool(cache_hash, g->have_sanitize_c); | 9513 | cache_bool(cache_hash, g->have_sanitize_c); |
| 9514 | cache_bool(cache_hash, g->link_eh_frame_hdr); | ||
| 9513 | cache_bool(cache_hash, want_valgrind_support(g)); | 9515 | cache_bool(cache_hash, want_valgrind_support(g)); |
| 9514 | cache_bool(cache_hash, g->function_sections); | 9516 | cache_bool(cache_hash, g->function_sections); |
| 9515 | for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) { | 9517 | for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) { |
| ... | @@ -10279,6 +10281,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) { | ... | @@ -10279,6 +10281,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) { |
| 10279 | cache_buf_opt(ch, g->test_filter); | 10281 | cache_buf_opt(ch, g->test_filter); |
| 10280 | cache_buf_opt(ch, g->test_name_prefix); | 10282 | cache_buf_opt(ch, g->test_name_prefix); |
| 10281 | } | 10283 | } |
| 10284 | cache_bool(ch, g->link_eh_frame_hdr); | ||
| 10282 | cache_bool(ch, g->is_single_threaded); | 10285 | cache_bool(ch, g->is_single_threaded); |
| 10283 | cache_bool(ch, g->linker_rdynamic); | 10286 | cache_bool(ch, g->linker_rdynamic); |
| 10284 | cache_bool(ch, g->each_lib_rpath); | 10287 | cache_bool(ch, g->each_lib_rpath); |
src/link.cpp+3-1| ... | @@ -1647,7 +1647,9 @@ static void construct_linker_job_elf(LinkJob *lj) { | ... | @@ -1647,7 +1647,9 @@ static void construct_linker_job_elf(LinkJob *lj) { |
| 1647 | lj->args.append("--gc-sections"); | 1647 | lj->args.append("--gc-sections"); |
| 1648 | } | 1648 | } |
| 1649 | 1649 | ||
| 1650 | lj->args.append("--eh-frame-hdr"); | 1650 | if (g->link_eh_frame_hdr) { |
| 1651 | lj->args.append("--eh-frame-hdr"); | ||
| 1652 | } | ||
| 1651 | 1653 | ||
| 1652 | lj->args.append("-m"); | 1654 | lj->args.append("-m"); |
| 1653 | lj->args.append(getLDMOption(g->zig_target)); | 1655 | lj->args.append(getLDMOption(g->zig_target)); |
src/main.cpp+5| ... | @@ -55,6 +55,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { | ... | @@ -55,6 +55,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 55 | " --color [auto|off|on] enable or disable colored error messages\n" | 55 | " --color [auto|off|on] enable or disable colored error messages\n" |
| 56 | " --disable-gen-h do not generate a C header file (.h)\n" | 56 | " --disable-gen-h do not generate a C header file (.h)\n" |
| 57 | " --disable-valgrind omit valgrind client requests in debug builds\n" | 57 | " --disable-valgrind omit valgrind client requests in debug builds\n" |
| 58 | " --eh-frame-hdr enable C++ exception handling by passing --eh-frame-hdr to linker\n" | ||
| 58 | " --enable-valgrind include valgrind client requests release builds\n" | 59 | " --enable-valgrind include valgrind client requests release builds\n" |
| 59 | " -fstack-check enable stack probing in unsafe builds\n" | 60 | " -fstack-check enable stack probing in unsafe builds\n" |
| 60 | " -fno-stack-check disable stack probing in safe builds\n" | 61 | " -fno-stack-check disable stack probing in safe builds\n" |
| ... | @@ -477,6 +478,7 @@ int main(int argc, char **argv) { | ... | @@ -477,6 +478,7 @@ int main(int argc, char **argv) { |
| 477 | bool verbose_llvm_ir = false; | 478 | bool verbose_llvm_ir = false; |
| 478 | bool verbose_cimport = false; | 479 | bool verbose_cimport = false; |
| 479 | bool verbose_cc = false; | 480 | bool verbose_cc = false; |
| 481 | bool link_eh_frame_hdr = false; | ||
| 480 | ErrColor color = ErrColorAuto; | 482 | ErrColor color = ErrColorAuto; |
| 481 | CacheOpt enable_cache = CacheOptAuto; | 483 | CacheOpt enable_cache = CacheOptAuto; |
| 482 | Buf *dynamic_linker = nullptr; | 484 | Buf *dynamic_linker = nullptr; |
| ... | @@ -715,6 +717,8 @@ int main(int argc, char **argv) { | ... | @@ -715,6 +717,8 @@ int main(int argc, char **argv) { |
| 715 | valgrind_support = ValgrindSupportEnabled; | 717 | valgrind_support = ValgrindSupportEnabled; |
| 716 | } else if (strcmp(arg, "--disable-valgrind") == 0) { | 718 | } else if (strcmp(arg, "--disable-valgrind") == 0) { |
| 717 | valgrind_support = ValgrindSupportDisabled; | 719 | valgrind_support = ValgrindSupportDisabled; |
| 720 | } else if (strcmp(arg, "--eh-frame-hdr") == 0) { | ||
| 721 | link_eh_frame_hdr = true; | ||
| 718 | } else if (strcmp(arg, "-fPIC") == 0) { | 722 | } else if (strcmp(arg, "-fPIC") == 0) { |
| 719 | want_pic = WantPICEnabled; | 723 | want_pic = WantPICEnabled; |
| 720 | } else if (strcmp(arg, "-fno-PIC") == 0) { | 724 | } else if (strcmp(arg, "-fno-PIC") == 0) { |
| ... | @@ -1191,6 +1195,7 @@ int main(int argc, char **argv) { | ... | @@ -1191,6 +1195,7 @@ int main(int argc, char **argv) { |
| 1191 | override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node); | 1195 | override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node); |
| 1192 | if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2); | 1196 | if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2); |
| 1193 | g->valgrind_support = valgrind_support; | 1197 | g->valgrind_support = valgrind_support; |
| 1198 | g->link_eh_frame_hdr = link_eh_frame_hdr; | ||
| 1194 | g->want_pic = want_pic; | 1199 | g->want_pic = want_pic; |
| 1195 | g->want_stack_check = want_stack_check; | 1200 | g->want_stack_check = want_stack_check; |
| 1196 | g->want_sanitize_c = want_sanitize_c; | 1201 | g->want_sanitize_c = want_sanitize_c; |