aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-10 16:43:51 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-10 16:43:51 -0700
commit1ff9a18cd327027164073f1ebf9c2cca6c3de876 (patch)
tree97cc523ac0c060e892f4df9cac6d62beb07d01e4 /src/stage1/codegen.cpp
parentc4c5020f0267758c7eb127689177cf1a70fb6d97 (diff)
downloadzig-1ff9a18cd327027164073f1ebf9c2cca6c3de876.tar.gz
zig-1ff9a18cd327027164073f1ebf9c2cca6c3de876.zip
stage1: back out the broken visibility changes
``` $ valgrind ./zig test ../test/behavior.zig -target powerpc-linux-musl -lc -I../test ==2828778== Invalid read of size 1 ==2828778== at 0x6EA0265: LLVMSetVisibility (in /home/andy/Downloads/zig/build/zig) ==2828778== by 0x1BCE60B: do_code_gen(CodeGen*) (codegen.cpp:9031) ==2828778== by 0x1BD51E2: codegen_build_object(CodeGen*) (codegen.cpp:10610) ==2828778== by 0x1BA5C17: zig_stage1_build_object (stage1.cpp:132) ==2828778== by 0xE61E24: Module.build_object (stage1.zig:149) ==2828778== by 0xC3D4CE: Compilation.updateStage1Module (Compilation.zig:5025) ==2828778== by 0xC3117E: Compilation.performAllTheWork (Compilation.zig:2691) ==2828778== by 0xC2A3ED: Compilation.update (Compilation.zig:2098) ==2828778== by 0xBB9D1F: main.updateModule (main.zig:3104) ==2828778== by 0xB16B75: main.buildOutputType (main.zig:2793) ==2828778== by 0xAD0526: main.mainArgs (main.zig:225) ==2828778== by 0xACFCB9: main (stage1.zig:48) ``` Since the plan is to ship stage3 for Zig 0.10.0, the stage1 implementation of this hardly matters.
Diffstat (limited to 'src/stage1/codegen.cpp')
-rw-r--r--src/stage1/codegen.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp
index e057a8cc80..d101030c33 100644
--- a/src/stage1/codegen.cpp
+++ b/src/stage1/codegen.cpp
@@ -242,18 +242,6 @@ static LLVMLinkage to_llvm_linkage(GlobalLinkageId id, bool is_extern) {
zig_unreachable();
}
-static LLVMVisibility to_llvm_visibility(SymbolVisibilityId id) {
- switch (id) {
- case SymbolVisibilityIdDefault:
- return LLVMDefaultVisibility;
- case SymbolVisibilityIdHidden:
- return LLVMHiddenVisibility;
- case SymbolVisibilityIdProtected:
- return LLVMProtectedVisibility;
- }
- zig_unreachable();
-}
-
struct CalcLLVMFieldIndex {
uint32_t offset;
uint32_t field_index;
@@ -412,7 +400,6 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
const char *unmangled_name = buf_ptr(&fn->symbol_name);
const char *symbol_name;
GlobalLinkageId linkage;
- SymbolVisibilityId visibility = SymbolVisibilityIdDefault;
if (fn->body_node == nullptr) {
symbol_name = unmangled_name;
linkage = GlobalLinkageIdStrong;
@@ -423,7 +410,6 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
GlobalExport *fn_export = &fn->export_list.items[0];
symbol_name = buf_ptr(&fn_export->name);
linkage = fn_export->linkage;
- visibility = fn_export->visibility;
}
CallingConvention cc = fn->type_entry->data.fn.fn_type_id.cc;
@@ -546,8 +532,6 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
LLVMSetUnnamedAddr(llvm_fn, true);
}
- LLVMSetVisibility(llvm_fn, to_llvm_visibility(visibility));
-
ZigType *return_type = fn_type->data.fn.fn_type_id.return_type;
if (return_type->id == ZigTypeIdUnreachable) {
addLLVMFnAttr(llvm_fn, "noreturn");
@@ -8967,7 +8951,6 @@ static void do_code_gen(CodeGen *g) {
assert(var->decl_node);
GlobalLinkageId linkage;
- SymbolVisibilityId visibility = SymbolVisibilityIdDefault;
const char *unmangled_name = var->name;
const char *symbol_name;
if (var->export_list.length == 0) {
@@ -8982,7 +8965,6 @@ static void do_code_gen(CodeGen *g) {
GlobalExport *global_export = &var->export_list.items[0];
symbol_name = buf_ptr(&global_export->name);
linkage = global_export->linkage;
- visibility = global_export->visibility;
}
LLVMValueRef global_value;
@@ -9028,8 +9010,6 @@ static void do_code_gen(CodeGen *g) {
set_global_tls(g, var, global_value);
}
- LLVMSetVisibility(global_value, to_llvm_visibility(visibility));
-
var->value_ref = global_value;
for (size_t export_i = 1; export_i < var->export_list.length; export_i += 1) {