fix thread local variables for non- position independent code
This fixes comes thanks to Rich Felker from the musl libc project, who gave me this crucial information: "to satisfy the abi, your init code has to write the same value to that memory location as the value passed to the [arch_prctl] syscall" This commit also changes the rules for when to build statically by default. When building objects and static libraries, position independent code is disabled if no libraries will be dynamically linked and the target does not require position independent code. closes #2063
This commit is contained in:
@@ -7314,17 +7314,14 @@ static bool detect_dynamic_link(CodeGen *g) {
|
||||
return false;
|
||||
if (target_requires_pic(g->zig_target, g->libc_link_lib != nullptr))
|
||||
return true;
|
||||
if (g->out_type == OutTypeExe) {
|
||||
// If there are no dynamic libraries then we can disable PIC
|
||||
for (size_t i = 0; i < g->link_libs_list.length; i += 1) {
|
||||
LinkLib *link_lib = g->link_libs_list.at(i);
|
||||
if (target_is_libc_lib_name(g->zig_target, buf_ptr(link_lib->name)))
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// If there are no dynamic libraries then we can disable PIC
|
||||
for (size_t i = 0; i < g->link_libs_list.length; i += 1) {
|
||||
LinkLib *link_lib = g->link_libs_list.at(i);
|
||||
if (target_is_libc_lib_name(g->zig_target, buf_ptr(link_lib->name)))
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool detect_pic(CodeGen *g) {
|
||||
|
||||
Reference in New Issue
Block a user