add stack protector safety when linking libc

* introduce zigrt file. it contains only weak symbols so that
   multiple instances can be merged. it contains __zig_panic
   so that multiple .o files can call the same panic function.
 * remove `@setFnVisible` builtin and add @setGlobalLinkage builtin
   which is more powerful
 * add `@panic` builtin function.
 * fix collision of symbols with extern prototypes and internal
   function names
 * add stack protector safety when linking against libc. To add
   the safety mechanism without libc requires implementing
   Thread Local Storage. See #276
This commit is contained in:
Andrew Kelley
2017-03-26 21:07:07 -04:00
parent 8aeea72654
commit a32b5929cc
19 changed files with 437 additions and 185 deletions

View File

@@ -635,8 +635,7 @@ static void visit_fn_decl(Context *c, const FunctionDecl *fn_decl) {
}
assert(fn_type->id == TypeTableEntryIdFn);
bool internal_linkage = false;
FnTableEntry *fn_entry = create_fn_raw(FnInlineAuto, internal_linkage);
FnTableEntry *fn_entry = create_fn_raw(FnInlineAuto, GlobalLinkageIdStrong);
buf_init_from_buf(&fn_entry->symbol_name, fn_name);
fn_entry->type_entry = fn_type;