| author | |
| committer | |
| log | e2e9be5deac75e102bc5faaa94aa17308224f9f6 |
| tree | ed6c69e1735acc2ee9615b86a9a12fb25b192eb4 |
| parent | 437c6a4b7ef115208ae84a938f989b92fb282c39 |
| parent | af390b75dbdb33f6ccf80c14d32ee5b89421c35b |
| signature | Commit is signed but in an unrecognized format. |
closes #39818 files changed, 29 insertions(+), 1 deletions(-)
lib/std/build.zig+6-1| ... | ... | @@ -1175,6 +1175,8 @@ pub const LibExeObjStep = struct { |
| 1175 | 1175 | |
| 1176 | 1176 | valgrind_support: ?bool = null, |
| 1177 | 1177 | |
| 1178 | link_eh_frame_hdr: bool = false, | |
| 1179 | ||
| 1178 | 1180 | /// Uses system Wine installation to run cross compiled Windows build artifacts. |
| 1179 | 1181 | enable_wine: bool = false, |
| 1180 | 1182 | |
| ... | ... | @@ -1910,7 +1912,10 @@ pub const LibExeObjStep = struct { |
| 1910 | 1912 | if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable; |
| 1911 | 1913 | |
| 1912 | 1914 | if (self.strip) { |
| 1913 | zig_args.append("--strip") catch unreachable; | |
| 1915 | try zig_args.append("--strip"); | |
| 1916 | } | |
| 1917 | if (self.link_eh_frame_hdr) { | |
| 1918 | try zig_args.append("--eh-frame-hdr"); | |
| 1914 | 1919 | } |
| 1915 | 1920 | |
| 1916 | 1921 | if (self.single_threaded) { |
src-self-hosted/compilation.zig+2| ... | ... | @@ -170,6 +170,8 @@ pub const Compilation = struct { |
| 170 | 170 | verbose_llvm_ir: bool = false, |
| 171 | 171 | verbose_link: bool = false, |
| 172 | 172 | |
| 173 | link_eh_frame_hdr: bool = false, | |
| 174 | ||
| 173 | 175 | darwin_version_min: DarwinVersionMin = .None, |
| 174 | 176 | |
| 175 | 177 | test_filters: []const []const u8 = &[_][]const u8{}, |
src-self-hosted/link.zig+3| ... | ... | @@ -144,6 +144,9 @@ fn constructLinkerArgsElf(ctx: *Context) !void { |
| 144 | 144 | // lj->args.append(g->linker_script); |
| 145 | 145 | //} |
| 146 | 146 | try ctx.args.append("--gc-sections"); |
| 147 | if (ctx.comp.link_eh_frame_hdr) { | |
| 148 | try ctx.args.append("--eh-frame-hdr"); | |
| 149 | } | |
| 147 | 150 | |
| 148 | 151 | //lj->args.append("-m"); |
| 149 | 152 | //lj->args.append(getLDMOption(&g->zig_target)); |
src-self-hosted/main.zig+6| ... | ... | @@ -154,6 +154,7 @@ const usage_build_generic = |
| 154 | 154 | \\ --static Output will be statically linked |
| 155 | 155 | \\ --strip Exclude debug symbols |
| 156 | 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 | 158 | \\ --verbose-tokenize Turn on compiler debug output for tokenization |
| 158 | 159 | \\ --verbose-ast-tree Turn on compiler debug output for parsing into an AST (tree view) |
| 159 | 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 | 208 | var verbose_llvm_ir = false; |
| 208 | 209 | var verbose_cimport = false; |
| 209 | 210 | var linker_rdynamic = false; |
| 211 | var link_eh_frame_hdr = false; | |
| 210 | 212 | var macosx_version_min: ?[]const u8 = null; |
| 211 | 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 | 371 | verbose_ir = true; |
| 370 | 372 | } else if (mem.eql(u8, arg, "--verbose-llvm-ir")) { |
| 371 | 373 | verbose_llvm_ir = true; |
| 374 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { | |
| 375 | link_eh_frame_hdr = true; | |
| 372 | 376 | } else if (mem.eql(u8, arg, "--verbose-cimport")) { |
| 373 | 377 | verbose_cimport = true; |
| 374 | 378 | } else if (mem.eql(u8, arg, "-rdynamic")) { |
| ... | ... | @@ -498,6 +502,8 @@ fn buildOutputType(allocator: *Allocator, args: []const []const u8, out_type: Co |
| 498 | 502 | comp.verbose_llvm_ir = verbose_llvm_ir; |
| 499 | 503 | comp.verbose_cimport = verbose_cimport; |
| 500 | 504 | |
| 505 | comp.link_eh_frame_hdr = link_eh_frame_hdr; | |
| 506 | ||
| 501 | 507 | comp.err_color = color; |
| 502 | 508 | |
| 503 | 509 | comp.linker_rdynamic = linker_rdynamic; |
src/all_types.hpp+1| ... | ... | @@ -2131,6 +2131,7 @@ struct CodeGen { |
| 2131 | 2131 | bool have_winmain_crt_startup; |
| 2132 | 2132 | bool have_dllmain_crt_startup; |
| 2133 | 2133 | bool have_err_ret_tracing; |
| 2134 | bool link_eh_frame_hdr; | |
| 2134 | 2135 | bool c_want_stdint; |
| 2135 | 2136 | bool c_want_stdbool; |
| 2136 | 2137 | bool verbose_tokenize; |
src/codegen.cpp+2| ... | ... | @@ -8629,6 +8629,7 @@ static Error define_builtin_compile_vars(CodeGen *g) { |
| 8629 | 8629 | cache_bool(&cache_hash, g->have_err_ret_tracing); |
| 8630 | 8630 | cache_bool(&cache_hash, g->libc_link_lib != nullptr); |
| 8631 | 8631 | cache_bool(&cache_hash, g->valgrind_support); |
| 8632 | cache_bool(&cache_hash, g->link_eh_frame_hdr); | |
| 8632 | 8633 | cache_int(&cache_hash, detect_subsystem(g)); |
| 8633 | 8634 | |
| 8634 | 8635 | Buf digest = BUF_INIT; |
| ... | ... | @@ -10279,6 +10280,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) { |
| 10279 | 10280 | cache_buf_opt(ch, g->test_filter); |
| 10280 | 10281 | cache_buf_opt(ch, g->test_name_prefix); |
| 10281 | 10282 | } |
| 10283 | cache_bool(ch, g->link_eh_frame_hdr); | |
| 10282 | 10284 | cache_bool(ch, g->is_single_threaded); |
| 10283 | 10285 | cache_bool(ch, g->linker_rdynamic); |
| 10284 | 10286 | cache_bool(ch, g->each_lib_rpath); |
src/link.cpp+4| ... | ... | @@ -1647,6 +1647,10 @@ static void construct_linker_job_elf(LinkJob *lj) { |
| 1647 | 1647 | lj->args.append("--gc-sections"); |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | if (g->link_eh_frame_hdr) { | |
| 1651 | lj->args.append("--eh-frame-hdr"); | |
| 1652 | } | |
| 1653 | ||
| 1650 | 1654 | lj->args.append("-m"); |
| 1651 | 1655 | lj->args.append(getLDMOption(g->zig_target)); |
| 1652 | 1656 |
src/main.cpp+5| ... | ... | @@ -55,6 +55,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 55 | 55 | " --color [auto|off|on] enable or disable colored error messages\n" |
| 56 | 56 | " --disable-gen-h do not generate a C header file (.h)\n" |
| 57 | 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 | 59 | " --enable-valgrind include valgrind client requests release builds\n" |
| 59 | 60 | " -fstack-check enable stack probing in unsafe builds\n" |
| 60 | 61 | " -fno-stack-check disable stack probing in safe builds\n" |
| ... | ... | @@ -477,6 +478,7 @@ int main(int argc, char **argv) { |
| 477 | 478 | bool verbose_llvm_ir = false; |
| 478 | 479 | bool verbose_cimport = false; |
| 479 | 480 | bool verbose_cc = false; |
| 481 | bool link_eh_frame_hdr = false; | |
| 480 | 482 | ErrColor color = ErrColorAuto; |
| 481 | 483 | CacheOpt enable_cache = CacheOptAuto; |
| 482 | 484 | Buf *dynamic_linker = nullptr; |
| ... | ... | @@ -715,6 +717,8 @@ int main(int argc, char **argv) { |
| 715 | 717 | valgrind_support = ValgrindSupportEnabled; |
| 716 | 718 | } else if (strcmp(arg, "--disable-valgrind") == 0) { |
| 717 | 719 | valgrind_support = ValgrindSupportDisabled; |
| 720 | } else if (strcmp(arg, "--eh-frame-hdr") == 0) { | |
| 721 | link_eh_frame_hdr = true; | |
| 718 | 722 | } else if (strcmp(arg, "-fPIC") == 0) { |
| 719 | 723 | want_pic = WantPICEnabled; |
| 720 | 724 | } else if (strcmp(arg, "-fno-PIC") == 0) { |
| ... | ... | @@ -1191,6 +1195,7 @@ int main(int argc, char **argv) { |
| 1191 | 1195 | override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node); |
| 1192 | 1196 | if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2); |
| 1193 | 1197 | g->valgrind_support = valgrind_support; |
| 1198 | g->link_eh_frame_hdr = link_eh_frame_hdr; | |
| 1194 | 1199 | g->want_pic = want_pic; |
| 1195 | 1200 | g->want_stack_check = want_stack_check; |
| 1196 | 1201 | g->want_sanitize_c = want_sanitize_c; |