| ... | ... | @@ -533,7 +533,6 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 533 | 533 | var opt_symbol_name: ?[]const u8 = null; |
| 534 | 534 | var versions = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len); |
| 535 | 535 | var weak_linkages = try std.DynamicBitSetUnmanaged.initEmpty(arena, metadata.all_versions.len); |
| 536 | | var sym_unversioned = false; |
| 537 | 536 | |
| 538 | 537 | var inc_fbs = std.io.fixedBufferStream(metadata.inclusions); |
| 539 | 538 | var inc_reader = inc_fbs.reader(); |
| ... | ... | @@ -548,11 +547,17 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 548 | 547 | opt_symbol_name = sym_name_buf.items; |
| 549 | 548 | versions.unsetAll(); |
| 550 | 549 | weak_linkages.unsetAll(); |
| 551 | | sym_unversioned = false; |
| 552 | 550 | |
| 553 | 551 | break :n sym_name_buf.items; |
| 554 | 552 | }; |
| 555 | 553 | |
| 554 | // Pick the default symbol version: |
| 555 | // - If there are no versions, don't emit it |
| 556 | // - Take the greatest one <= than the target one |
| 557 | // - If none of them is <= than the |
| 558 | // specified one don't pick any default version |
| 559 | var chosen_def_ver_index: usize = 255; |
| 560 | var chosen_unversioned_ver_index: usize = 255; |
| 556 | 561 | { |
| 557 | 562 | const targets = try std.leb.readUleb128(u64, inc_reader); |
| 558 | 563 | var lib_index = try inc_reader.readByte(); |
| ... | ... | @@ -574,7 +579,12 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 574 | 579 | const ver_i = @as(u7, @truncate(byte)); |
| 575 | 580 | if (ok_lib_and_target and ver_i <= target_ver_index) { |
| 576 | 581 | versions.set(ver_i); |
| 577 | | if (is_unversioned) sym_unversioned = true; |
| 582 | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 583 | chosen_def_ver_index = ver_i; |
| 584 | } |
| 585 | if (is_unversioned and (chosen_unversioned_ver_index == 255 or ver_i > chosen_unversioned_ver_index)) { |
| 586 | chosen_unversioned_ver_index = ver_i; |
| 587 | } |
| 578 | 588 | if (is_weak) weak_linkages.set(ver_i); |
| 579 | 589 | } |
| 580 | 590 | if (last) break; |
| ... | ... | @@ -585,25 +595,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 585 | 595 | } else continue; |
| 586 | 596 | } |
| 587 | 597 | |
| 588 | | // Pick the default symbol version: |
| 589 | | // - If there are no versions, don't emit it |
| 590 | | // - Take the greatest one <= than the target one |
| 591 | | // - If none of them is <= than the |
| 592 | | // specified one don't pick any default version |
| 593 | | var chosen_def_ver_index: usize = 255; |
| 594 | | { |
| 595 | | var versions_iter = versions.iterator(.{}); |
| 596 | | while (versions_iter.next()) |ver_i| { |
| 597 | | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 598 | | chosen_def_ver_index = ver_i; |
| 599 | | } |
| 600 | | } |
| 601 | | } |
| 602 | | |
| 603 | 598 | { |
| 604 | 599 | var versions_iter = versions.iterator(.{}); |
| 605 | 600 | while (versions_iter.next()) |ver_index| { |
| 606 | | if (sym_unversioned) { |
| 601 | if (chosen_unversioned_ver_index != 255 and ver_index == chosen_unversioned_ver_index) { |
| 607 | 602 | // Example: |
| 608 | 603 | // .balign 4 |
| 609 | 604 | // .globl _Exit |
| ... | ... | @@ -701,11 +696,17 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 701 | 696 | opt_symbol_name = sym_name_buf.items; |
| 702 | 697 | versions.unsetAll(); |
| 703 | 698 | weak_linkages.unsetAll(); |
| 704 | | sym_unversioned = false; |
| 705 | 699 | |
| 706 | 700 | break :n sym_name_buf.items; |
| 707 | 701 | }; |
| 708 | 702 | |
| 703 | // Pick the default symbol version: |
| 704 | // - If there are no versions, don't emit it |
| 705 | // - Take the greatest one <= than the target one |
| 706 | // - If none of them is <= than the |
| 707 | // specified one don't pick any default version |
| 708 | var chosen_def_ver_index: usize = 255; |
| 709 | var chosen_unversioned_ver_index: usize = 255; |
| 709 | 710 | { |
| 710 | 711 | const targets = try std.leb.readUleb128(u64, inc_reader); |
| 711 | 712 | const size = try std.leb.readUleb128(u16, inc_reader); |
| ... | ... | @@ -728,8 +729,13 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 728 | 729 | const ver_i = @as(u7, @truncate(byte)); |
| 729 | 730 | if (ok_lib_and_target and ver_i <= target_ver_index) { |
| 730 | 731 | versions.set(ver_i); |
| 732 | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 733 | chosen_def_ver_index = ver_i; |
| 734 | } |
| 735 | if (is_unversioned and (chosen_unversioned_ver_index == 255 or ver_i > chosen_unversioned_ver_index)) { |
| 736 | chosen_unversioned_ver_index = ver_i; |
| 737 | } |
| 731 | 738 | sizes[ver_i] = size; |
| 732 | | if (is_unversioned) sym_unversioned = true; |
| 733 | 739 | if (is_weak) weak_linkages.set(ver_i); |
| 734 | 740 | } |
| 735 | 741 | if (last) break; |
| ... | ... | @@ -740,25 +746,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 740 | 746 | } else continue; |
| 741 | 747 | } |
| 742 | 748 | |
| 743 | | // Pick the default symbol version: |
| 744 | | // - If there are no versions, don't emit it |
| 745 | | // - Take the greatest one <= than the target one |
| 746 | | // - If none of them is <= than the |
| 747 | | // specified one don't pick any default version |
| 748 | | var chosen_def_ver_index: usize = 255; |
| 749 | | { |
| 750 | | var versions_iter = versions.iterator(.{}); |
| 751 | | while (versions_iter.next()) |ver_i| { |
| 752 | | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 753 | | chosen_def_ver_index = ver_i; |
| 754 | | } |
| 755 | | } |
| 756 | | } |
| 757 | | |
| 758 | 749 | { |
| 759 | 750 | var versions_iter = versions.iterator(.{}); |
| 760 | 751 | while (versions_iter.next()) |ver_index| { |
| 761 | | if (sym_unversioned) { |
| 752 | if (chosen_unversioned_ver_index != 255 and ver_index == chosen_unversioned_ver_index) { |
| 762 | 753 | // Example: |
| 763 | 754 | // .balign 4 |
| 764 | 755 | // .globl malloc_conf |
| ... | ... | @@ -843,11 +834,17 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 843 | 834 | opt_symbol_name = sym_name_buf.items; |
| 844 | 835 | versions.unsetAll(); |
| 845 | 836 | weak_linkages.unsetAll(); |
| 846 | | sym_unversioned = false; |
| 847 | 837 | |
| 848 | 838 | break :n sym_name_buf.items; |
| 849 | 839 | }; |
| 850 | 840 | |
| 841 | // Pick the default symbol version: |
| 842 | // - If there are no versions, don't emit it |
| 843 | // - Take the greatest one <= than the target one |
| 844 | // - If none of them is <= than the |
| 845 | // specified one don't pick any default version |
| 846 | var chosen_def_ver_index: usize = 255; |
| 847 | var chosen_unversioned_ver_index: usize = 255; |
| 851 | 848 | { |
| 852 | 849 | const targets = try std.leb.readUleb128(u64, inc_reader); |
| 853 | 850 | const size = try std.leb.readUleb128(u16, inc_reader); |
| ... | ... | @@ -870,8 +867,13 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 870 | 867 | const ver_i = @as(u7, @truncate(byte)); |
| 871 | 868 | if (ok_lib_and_target and ver_i <= target_ver_index) { |
| 872 | 869 | versions.set(ver_i); |
| 870 | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 871 | chosen_def_ver_index = ver_i; |
| 872 | } |
| 873 | if (is_unversioned and (chosen_unversioned_ver_index == 255 or ver_i > chosen_unversioned_ver_index)) { |
| 874 | chosen_unversioned_ver_index = ver_i; |
| 875 | } |
| 873 | 876 | sizes[ver_i] = size; |
| 874 | | if (is_unversioned) sym_unversioned = true; |
| 875 | 877 | if (is_weak) weak_linkages.set(ver_i); |
| 876 | 878 | } |
| 877 | 879 | if (last) break; |
| ... | ... | @@ -882,25 +884,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 882 | 884 | } else continue; |
| 883 | 885 | } |
| 884 | 886 | |
| 885 | | // Pick the default symbol version: |
| 886 | | // - If there are no versions, don't emit it |
| 887 | | // - Take the greatest one <= than the target one |
| 888 | | // - If none of them is <= than the |
| 889 | | // specified one don't pick any default version |
| 890 | | var chosen_def_ver_index: usize = 255; |
| 891 | | { |
| 892 | | var versions_iter = versions.iterator(.{}); |
| 893 | | while (versions_iter.next()) |ver_i| { |
| 894 | | if (chosen_def_ver_index == 255 or ver_i > chosen_def_ver_index) { |
| 895 | | chosen_def_ver_index = ver_i; |
| 896 | | } |
| 897 | | } |
| 898 | | } |
| 899 | | |
| 900 | 887 | { |
| 901 | 888 | var versions_iter = versions.iterator(.{}); |
| 902 | 889 | while (versions_iter.next()) |ver_index| { |
| 903 | | if (sym_unversioned) { |
| 890 | if (chosen_unversioned_ver_index != 255 and ver_index == chosen_unversioned_ver_index) { |
| 904 | 891 | // Example: |
| 905 | 892 | // .balign 4 |
| 906 | 893 | // .globl _ThreadRuneLocale |