authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-07 16:02:58-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-07 16:02:58-05:00
loge2e9be5deac75e102bc5faaa94aa17308224f9f6
treeed6c69e1735acc2ee9615b86a9a12fb25b192eb4
parent437c6a4b7ef115208ae84a938f989b92fb282c39
parentaf390b75dbdb33f6ccf80c14d32ee5b89421c35b
signaturelock-open Commit is signed but in an unrecognized format.

Merge branch 'dcao-master'

closes #3981

8 files changed, 29 insertions(+), 1 deletions(-)

lib/std/build.zig+6-1
...@@ -1175,6 +1175,8 @@ pub const LibExeObjStep = struct {...@@ -1175,6 +1175,8 @@ pub const LibExeObjStep = struct {
11751175
1176 valgrind_support: ?bool = null,1176 valgrind_support: ?bool = null,
11771177
1178 link_eh_frame_hdr: bool = false,
1179
1178 /// Uses system Wine installation to run cross compiled Windows build artifacts.1180 /// Uses system Wine installation to run cross compiled Windows build artifacts.
1179 enable_wine: bool = false,1181 enable_wine: bool = false,
11801182
...@@ -1910,7 +1912,10 @@ pub const LibExeObjStep = struct {...@@ -1910,7 +1912,10 @@ pub const LibExeObjStep = struct {
1910 if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable;1912 if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable;
19111913
1912 if (self.strip) {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 }
19151920
1916 if (self.single_threaded) {1921 if (self.single_threaded) {
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,
172172
173 link_eh_frame_hdr: bool = false,
174
173 darwin_version_min: DarwinVersionMin = .None,175 darwin_version_min: DarwinVersionMin = .None,
174176
175 test_filters: []const []const u8 = &[_][]const u8{},177 test_filters: []const []const u8 = &[_][]const u8{},
src-self-hosted/link.zig+3
...@@ -144,6 +144,9 @@ fn constructLinkerArgsElf(ctx: *Context) !void {...@@ -144,6 +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 if (ctx.comp.link_eh_frame_hdr) {
148 try ctx.args.append("--eh-frame-hdr");
149 }
147150
148 //lj->args.append("-m");151 //lj->args.append("-m");
149 //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 linked154 \\ --static Output will be statically linked
155 \\ --strip Exclude debug symbols155 \\ --strip Exclude debug symbols
156 \\ -target [name] <arch><sub>-<os>-<abi> see the targets command156 \\ -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 tokenization158 \\ --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;
212214
...@@ -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;
500504
505 comp.link_eh_frame_hdr = link_eh_frame_hdr;
506
501 comp.err_color = color;507 comp.err_color = color;
502508
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+2
...@@ -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));
86338634
8634 Buf digest = BUF_INIT;8635 Buf digest = BUF_INIT;
...@@ -10279,6 +10280,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {...@@ -10279,6 +10280,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
10279 cache_buf_opt(ch, g->test_filter);10280 cache_buf_opt(ch, g->test_filter);
10280 cache_buf_opt(ch, g->test_name_prefix);10281 cache_buf_opt(ch, g->test_name_prefix);
10281 }10282 }
10283 cache_bool(ch, g->link_eh_frame_hdr);
10282 cache_bool(ch, g->is_single_threaded);10284 cache_bool(ch, g->is_single_threaded);
10283 cache_bool(ch, g->linker_rdynamic);10285 cache_bool(ch, g->linker_rdynamic);
10284 cache_bool(ch, g->each_lib_rpath);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,6 +1647,10 @@ static void construct_linker_job_elf(LinkJob *lj) {
1647 lj->args.append("--gc-sections");1647 lj->args.append("--gc-sections");
1648 }1648 }
16491649
1650 if (g->link_eh_frame_hdr) {
1651 lj->args.append("--eh-frame-hdr");
1652 }
1653
1650 lj->args.append("-m");1654 lj->args.append("-m");
1651 lj->args.append(getLDMOption(g->zig_target));1655 lj->args.append(getLDMOption(g->zig_target));
16521656
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;