glibc: Fix a benign bug when selecting the size of an object symbol.

This didn't cause any problems in practice, but doing it this way is technically
more correct.
This commit is contained in:
Alex Rønne Petersen
2025-05-13 00:20:23 +02:00
parent 9e48e919e7
commit e52ffe6738

View File

@@ -966,6 +966,8 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
const obj_inclusions_len = try inc_reader.readInt(u16, .little);
var sizes = try arena.alloc(u16, metadata.all_versions.len);
sym_i = 0;
opt_symbol_name = null;
versions_buffer = undefined;
@@ -1003,6 +1005,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
if (ok_lib_and_target and ver_i <= target_ver_index) {
versions_buffer[versions_len] = ver_i;
versions_len += 1;
sizes[ver_i] = size;
}
if (last) break;
}
@@ -1066,14 +1069,14 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
sym_plus_ver,
sym_plus_ver,
sym_plus_ver,
size,
sizes[ver_index],
sym_plus_ver,
sym_name,
at_sign_str,
ver.major,
ver.minor,
sym_plus_ver,
size,
sizes[ver_index],
});
} else {
const sym_plus_ver = try std.fmt.allocPrint(
@@ -1094,7 +1097,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
sym_plus_ver,
sym_plus_ver,
sym_plus_ver,
size,
sizes[ver_index],
sym_plus_ver,
sym_name,
at_sign_str,
@@ -1102,7 +1105,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
ver.minor,
ver.patch,
sym_plus_ver,
size,
sizes[ver_index],
});
}
}