| ... | @@ -93,8 +93,10 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo | ... | @@ -93,8 +93,10 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 93 | { | 93 | { |
| 94 | SplitIterator it = memSplit(buf_to_slice(abi_txt_contents), str("\n")); | 94 | SplitIterator it = memSplit(buf_to_slice(abi_txt_contents), str("\n")); |
| 95 | ZigGLibCVerList *ver_list_base = nullptr; | 95 | ZigGLibCVerList *ver_list_base = nullptr; |
| | 96 | int line_num = 0; |
| 96 | for (;;) { | 97 | for (;;) { |
| 97 | if (ver_list_base == nullptr) { | 98 | if (ver_list_base == nullptr) { |
| | 99 | line_num += 1; |
| 98 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); | 100 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); |
| 99 | if (!opt_line.is_some) break; | 101 | if (!opt_line.is_some) break; |
| 100 | | 102 | |
| ... | @@ -122,7 +124,19 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo | ... | @@ -122,7 +124,19 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 122 | target->os = OsLinux; | 124 | target->os = OsLinux; |
| 123 | | 125 | |
| 124 | err = target_parse_abi(&target->abi, (char*)opt_abi.value.ptr, opt_abi.value.len); | 126 | err = target_parse_abi(&target->abi, (char*)opt_abi.value.ptr, opt_abi.value.len); |
| 125 | assert(err == ErrorNone); | 127 | if (err != ErrorNone) { |
| | 128 | fprintf(stderr, "Error parsing %s:%d: %s\n", buf_ptr(glibc_abi->abi_txt_path), |
| | 129 | line_num, err_str(err)); |
| | 130 | fprintf(stderr, "arch: '%.*s', os: '%.*s', abi: '%.*s'\n", |
| | 131 | (int)opt_arch.value.len, (const char*)opt_arch.value.ptr, |
| | 132 | (int)opt_os.value.len, (const char*)opt_os.value.ptr, |
| | 133 | (int)opt_abi.value.len, (const char*)opt_abi.value.ptr); |
| | 134 | fprintf(stderr, "parsed from target: '%.*s'\n", |
| | 135 | (int)opt_target.value.len, (const char*)opt_target.value.ptr); |
| | 136 | fprintf(stderr, "parsed from line:\n%.*s\n", (int)opt_line.value.len, opt_line.value.ptr); |
| | 137 | fprintf(stderr, "Zig installation appears to be corrupted.\n"); |
| | 138 | exit(1); |
| | 139 | } |
| 126 | | 140 | |
| 127 | glibc_abi->version_table.put(target, ver_list_base); | 141 | glibc_abi->version_table.put(target, ver_list_base); |
| 128 | } | 142 | } |
| ... | @@ -130,6 +144,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo | ... | @@ -130,6 +144,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo |
| 130 | } | 144 | } |
| 131 | for (size_t fn_i = 0; fn_i < glibc_abi->all_functions.length; fn_i += 1) { | 145 | for (size_t fn_i = 0; fn_i < glibc_abi->all_functions.length; fn_i += 1) { |
| 132 | ZigGLibCVerList *ver_list = &ver_list_base[fn_i]; | 146 | ZigGLibCVerList *ver_list = &ver_list_base[fn_i]; |
| | 147 | line_num += 1; |
| 133 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); | 148 | Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); |
| 134 | assert(opt_line.is_some); | 149 | assert(opt_line.is_some); |
| 135 | | 150 | |
| ... | @@ -266,7 +281,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con | ... | @@ -266,7 +281,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con |
| 266 | // - If there are no versions, don't emit it | 281 | // - If there are no versions, don't emit it |
| 267 | // - Take the greatest one <= than the target one | 282 | // - Take the greatest one <= than the target one |
| 268 | // - If none of them is <= than the | 283 | // - If none of them is <= than the |
| 269 | // specified one don't pick any default version | 284 | // specified one don't pick any default version |
| 270 | if (ver_list->len == 0) continue; | 285 | if (ver_list->len == 0) continue; |
| 271 | uint8_t chosen_def_ver_index = 255; | 286 | uint8_t chosen_def_ver_index = 255; |
| 272 | for (uint8_t ver_i = 0; ver_i < ver_list->len; ver_i += 1) { | 287 | for (uint8_t ver_i = 0; ver_i < ver_list->len; ver_i += 1) { |
| ... | @@ -322,7 +337,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con | ... | @@ -322,7 +337,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con |
| 322 | codegen_set_lib_version(child_gen, lib->sover, 0, 0); | 337 | codegen_set_lib_version(child_gen, lib->sover, 0, 0); |
| 323 | child_gen->is_dynamic = true; | 338 | child_gen->is_dynamic = true; |
| 324 | child_gen->is_dummy_so = true; | 339 | child_gen->is_dummy_so = true; |
| 325 | child_gen->version_script_path = map_file_path; | 340 | child_gen->version_script_path = map_file_path; |
| 326 | child_gen->enable_cache = false; | 341 | child_gen->enable_cache = false; |
| 327 | child_gen->output_dir = dummy_dir; | 342 | child_gen->output_dir = dummy_dir; |
| 328 | codegen_build_and_link(child_gen); | 343 | codegen_build_and_link(child_gen); |