add -ffunction-sections arg when building C objects

the other changes in this commit are minor tidying up
This commit is contained in:
Andrew Kelley
2019-07-03 15:46:27 -04:00
parent 2f4faf306d
commit 4606baee07
2 changed files with 8 additions and 3 deletions

View File

@@ -8341,6 +8341,10 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
args.append("-nostdinc");
args.append("-fno-spell-checking");
if (g->function_sections) {
args.append("-ffunction-sections");
}
if (translate_c) {
// this gives us access to preprocessing entities, presumably at
// the cost of performance
@@ -8765,10 +8769,10 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose
cache_int(cache_hash, g->build_mode);
cache_bool(cache_hash, g->have_pic);
cache_bool(cache_hash, want_valgrind_support(g));
cache_bool(cache_hash, g->function_sections);
for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) {
cache_str(cache_hash, g->clang_argv[arg_i]);
}
cache_bool(cache_hash, g->function_sections);
*out_cache_hash = cache_hash;
return ErrorNone;