authorgravatar for sentrycraft123@gmail.comJan200101 <sentrycraft123@gmail.com> 2020-08-22 15:08:34+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-08-22 16:38:03+03:00
log9605e5363b22874550687f5f96dc6cc8bf462115
tree83ad776ba3b5e6dade2a3ac96e8f899f83245635
parent69de1a51cd4f43e1d7a1fab3208b835b6841579d

update update_glibc and process_headers to latest zig


2 files changed, 23 insertions(+), 22 deletions(-)

tools/process_headers.zig+3-2
......@@ -15,6 +15,7 @@ const Arch = std.Target.Cpu.Arch;
1515const Abi = std.Target.Abi;
1616const OsTag = std.Target.Os.Tag;
1717const assert = std.debug.assert;
18const Sha256 = std.crypto.hash.sha2.Sha256;
1819
1920const LibCTarget = struct {
2021 name: []const u8,
......@@ -313,7 +314,7 @@ pub fn main() !void {
313314 var max_bytes_saved: usize = 0;
314315 var total_bytes: usize = 0;
315316
316 var hasher = std.crypto.hash.sha2.Sha256.init(.{});
317 var hasher = Sha256.init(.{});
317318
318319 for (libc_targets) |libc_target| {
319320 const dest_target = DestTarget{
......@@ -359,7 +360,7 @@ pub fn main() !void {
359360 const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t");
360361 total_bytes += raw_bytes.len;
361362 const hash = try allocator.alloc(u8, 32);
362 hasher.reset();
363 hasher = Sha256.init(.{});
363364 hasher.update(rel_path);
364365 hasher.update(trimmed);
365366 hasher.final(hash);
tools/update_glibc.zig+20-20
......@@ -148,12 +148,12 @@ pub fn main() !void {
148148 for (abi_lists) |*abi_list| {
149149 const target_funcs_gop = try target_functions.getOrPut(@ptrToInt(abi_list));
150150 if (!target_funcs_gop.found_existing) {
151 target_funcs_gop.kv.value = FunctionSet{
151 target_funcs_gop.entry.value = FunctionSet{
152152 .list = std.ArrayList(VersionedFn).init(allocator),
153153 .fn_vers_list = FnVersionList.init(allocator),
154154 };
155155 }
156 const fn_set = &target_funcs_gop.kv.value.list;
156 const fn_set = &target_funcs_gop.entry.value.list;
157157
158158 for (lib_names) |lib_name, lib_name_index| {
159159 const lib_prefix = if (std.mem.eql(u8, lib_name, "ld")) "" else "lib";
......@@ -203,11 +203,11 @@ pub fn main() !void {
203203 _ = try global_ver_set.put(ver, undefined);
204204 const gop = try global_fn_set.getOrPut(name);
205205 if (gop.found_existing) {
206 if (!std.mem.eql(u8, gop.kv.value.lib, "c")) {
207 gop.kv.value.lib = lib_name;
206 if (!std.mem.eql(u8, gop.entry.value.lib, "c")) {
207 gop.entry.value.lib = lib_name;
208208 }
209209 } else {
210 gop.kv.value = Function{
210 gop.entry.value = Function{
211211 .name = name,
212212 .lib = lib_name,
213213 .index = undefined,
......@@ -224,14 +224,14 @@ pub fn main() !void {
224224 const global_fn_list = blk: {
225225 var list = std.ArrayList([]const u8).init(allocator);
226226 var it = global_fn_set.iterator();
227 while (it.next()) |kv| try list.append(kv.key);
227 while (it.next()) |entry| try list.append(entry.key);
228228 std.sort.sort([]const u8, list.span(), {}, strCmpLessThan);
229229 break :blk list.span();
230230 };
231231 const global_ver_list = blk: {
232232 var list = std.ArrayList([]const u8).init(allocator);
233233 var it = global_ver_set.iterator();
234 while (it.next()) |kv| try list.append(kv.key);
234 while (it.next()) |entry| try list.append(entry.key);
235235 std.sort.sort([]const u8, list.span(), {}, versionLessThan);
236236 break :blk list.span();
237237 };
......@@ -254,9 +254,9 @@ pub fn main() !void {
254254 var buffered = std.io.bufferedOutStream(fns_txt_file.outStream());
255255 const fns_txt = buffered.outStream();
256256 for (global_fn_list) |name, i| {
257 const kv = global_fn_set.get(name).?;
258 kv.value.index = i;
259 try fns_txt.print("{} {}\n", .{ name, kv.value.lib });
257 const entry = global_fn_set.getEntry(name).?;
258 entry.value.index = i;
259 try fns_txt.print("{} {}\n", .{ name, entry.value.lib });
260260 }
261261 try buffered.flush();
262262 }
......@@ -264,16 +264,16 @@ pub fn main() !void {
264264 // Now the mapping of version and function to integer index is complete.
265265 // Here we create a mapping of function name to list of versions.
266266 for (abi_lists) |*abi_list, abi_index| {
267 const kv = target_functions.get(@ptrToInt(abi_list)).?;
268 const fn_vers_list = &kv.value.fn_vers_list;
269 for (kv.value.list.span()) |*ver_fn| {
267 const entry = target_functions.getEntry(@ptrToInt(abi_list)).?;
268 const fn_vers_list = &entry.value.fn_vers_list;
269 for (entry.value.list.span()) |*ver_fn| {
270270 const gop = try fn_vers_list.getOrPut(ver_fn.name);
271271 if (!gop.found_existing) {
272 gop.kv.value = std.ArrayList(usize).init(allocator);
272 gop.entry.value = std.ArrayList(usize).init(allocator);
273273 }
274 const ver_index = global_ver_set.get(ver_fn.ver).?.value;
275 if (std.mem.indexOfScalar(usize, gop.kv.value.span(), ver_index) == null) {
276 try gop.kv.value.append(ver_index);
274 const ver_index = global_ver_set.getEntry(ver_fn.ver).?.value;
275 if (std.mem.indexOfScalar(usize, gop.entry.value.span(), ver_index) == null) {
276 try gop.entry.value.append(ver_index);
277277 }
278278 }
279279 }
......@@ -287,7 +287,7 @@ pub fn main() !void {
287287
288288 // first iterate over the abi lists
289289 for (abi_lists) |*abi_list, abi_index| {
290 const fn_vers_list = &target_functions.get(@ptrToInt(abi_list)).?.value.fn_vers_list;
290 const fn_vers_list = &target_functions.getEntry(@ptrToInt(abi_list)).?.value.fn_vers_list;
291291 for (abi_list.targets) |target, it_i| {
292292 if (it_i != 0) try abilist_txt.writeByte(' ');
293293 try abilist_txt.print("{}-linux-{}", .{ @tagName(target.arch), @tagName(target.abi) });
......@@ -295,11 +295,11 @@ pub fn main() !void {
295295 try abilist_txt.writeByte('\n');
296296 // next, each line implicitly corresponds to a function
297297 for (global_fn_list) |name| {
298 const kv = fn_vers_list.get(name) orelse {
298 const entry = fn_vers_list.getEntry(name) orelse {
299299 try abilist_txt.writeByte('\n');
300300 continue;
301301 };
302 for (kv.value.span()) |ver_index, it_i| {
302 for (entry.value.span()) |ver_index, it_i| {
303303 if (it_i != 0) try abilist_txt.writeByte(' ');
304304 try abilist_txt.print("{d}", .{ver_index});
305305 }