From 7586f613d58db8f210649c890c467edce11643b9 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Fri, 28 Jun 2019 00:58:35 +0200 Subject: Added function-section functionality --- src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 57eeef59df..0074b0ddf8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,6 +85,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { " -isystem [dir] add additional search path for other .h files\n" " -mllvm [arg] forward an arg to LLVM's option processing\n" " --override-std-dir [arg] use an alternate Zig standard library\n" + " -ffunction-sections places each function in a seperate section\n" "\n" "Link Options:\n" " --bundle-compiler-rt [path] for static libraries, include compiler-rt symbols\n" @@ -450,6 +451,7 @@ int main(int argc, char **argv) { ValgrindSupport valgrind_support = ValgrindSupportAuto; WantPIC want_pic = WantPICAuto; WantStackCheck want_stack_check = WantStackCheckAuto; + bool function_sections = false; ZigList llvm_argv = {0}; llvm_argv.append("zig (LLVM option parsing)"); @@ -688,6 +690,8 @@ int main(int argc, char **argv) { return EXIT_FAILURE; } cur_pkg = cur_pkg->parent; + } else if (strcmp(arg, "-ffunction-sections") == 0) { + function_sections = true; } else if (i + 1 >= argc) { fprintf(stderr, "Expected another argument after %s\n", arg); return print_error_usage(arg0); @@ -1101,6 +1105,7 @@ int main(int argc, char **argv) { g->bundle_compiler_rt = bundle_compiler_rt; codegen_set_errmsg_color(g, color); g->system_linker_hack = system_linker_hack; + g->function_sections = function_sections; for (size_t i = 0; i < lib_dirs.length; i += 1) { codegen_add_lib_dir(g, lib_dirs.at(i)); -- cgit v1.2.3