File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -45,29 +45,21 @@ pub const File = union(enum) {
4545
4646 /// Encodes symbol rank so that the following ordering applies:
4747 /// * strong in object
48- /// * weak in object
49- /// * tentative in object
5048 /// * strong in archive/dylib
49+ /// * weak in object
5150 /// * weak in archive/dylib
51+ /// * tentative in object
5252 /// * tentative in archive
5353 /// * unclaimed
54+ /// Ties are broken by file priority.
5455 pub fn getSymbolRank (file : File , args : struct {
5556 archive : bool = false ,
5657 weak : bool = false ,
5758 tentative : bool = false ,
5859 }) u32 {
59- if (file != .dylib and ! args .archive ) {
60- const base : u32 = blk : {
61- if (args .tentative ) break :blk 3 ;
62- break :blk if (args .weak ) 2 else 1 ;
63- };
64- return (base << 16 ) + file .getIndex ();
65- }
66- const base : u32 = blk : {
67- if (args .tentative ) break :blk 3 ;
68- break :blk if (args .weak ) 2 else 1 ;
69- };
70- return base + (file .getIndex () << 24 );
60+ const archive_or_dylib = @as (u32 , @intFromBool (file == .dylib or args .archive )) << 29 ;
61+ const strength : u32 = if (args .tentative ) 0b10 << 30 else if (args .weak ) 0b01 << 30 else 0b00 << 30 ;
62+ return strength | archive_or_dylib | file .getIndex ();
7163 }
7264
7365 pub fn getAtom (file : File , atom_index : Atom.Index ) ? * Atom {
You can’t perform that action at this time.
0 commit comments