diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-20 12:59:37 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-20 12:59:37 -0400 |
| commit | 245dc9d930a4f11a7ce719d3b9aa272a6a1127ff (patch) | |
| tree | fa19e9ca728f987450885d56a42bf8272cce04e4 /tools | |
| parent | 541e763010403d8233a6420756a1e8393f1dd4c2 (diff) | |
| download | zig-245dc9d930a4f11a7ce719d3b9aa272a6a1127ff.tar.gz zig-245dc9d930a4f11a7ce719d3b9aa272a6a1127ff.zip | |
include ld symbols when generating glibc dummy objects
closes #4748
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/update_glibc.zig | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/tools/update_glibc.zig b/tools/update_glibc.zig index 84522aabe4..4a5b1751a2 100644 --- a/tools/update_glibc.zig +++ b/tools/update_glibc.zig @@ -20,6 +20,7 @@ const lib_names = [_][]const u8{ "m", "pthread", "rt", + "ld", }; // fpu/nofpu are hardcoded elsewhere, based on .gnueabi/.gnueabihf with an exception for .arm @@ -154,22 +155,24 @@ pub fn main() !void { const fn_set = &target_funcs_gop.kv.value.list; for (lib_names) |lib_name, lib_name_index| { - const basename = try fmt.allocPrint(allocator, "lib{}.abilist", .{lib_name}); + const lib_prefix = if (std.mem.eql(u8, lib_name, "ld")) "" else "lib"; + const basename = try fmt.allocPrint(allocator, "{}{}.abilist", .{ lib_prefix, lib_name }); const abi_list_filename = blk: { - if (abi_list.targets[0].abi == .gnuabi64 and std.mem.eql(u8, lib_name, "c")) { + const is_c = std.mem.eql(u8, lib_name, "c"); + const is_m = std.mem.eql(u8, lib_name, "m"); + const is_ld = std.mem.eql(u8, lib_name, "ld"); + if (abi_list.targets[0].abi == .gnuabi64 and (is_c or is_ld)) { break :blk try fs.path.join(allocator, &[_][]const u8{ prefix, abi_list.path, "n64", basename }); - } else if (abi_list.targets[0].abi == .gnuabin32 and std.mem.eql(u8, lib_name, "c")) { + } else if (abi_list.targets[0].abi == .gnuabin32 and (is_c or is_ld)) { break :blk try fs.path.join(allocator, &[_][]const u8{ prefix, abi_list.path, "n32", basename }); } else if (abi_list.targets[0].arch != .arm and abi_list.targets[0].abi == .gnueabihf and - (std.mem.eql(u8, lib_name, "c") or - (std.mem.eql(u8, lib_name, "m") and abi_list.targets[0].arch == .powerpc))) + (is_c or (is_m and abi_list.targets[0].arch == .powerpc))) { break :blk try fs.path.join(allocator, &[_][]const u8{ prefix, abi_list.path, "fpu", basename }); } else if (abi_list.targets[0].arch != .arm and abi_list.targets[0].abi == .gnueabi and - (std.mem.eql(u8, lib_name, "c") or - (std.mem.eql(u8, lib_name, "m") and abi_list.targets[0].arch == .powerpc))) + (is_c or (is_m and abi_list.targets[0].arch == .powerpc))) { break :blk try fs.path.join(allocator, &[_][]const u8{ prefix, abi_list.path, "nofpu", basename }); } else if (abi_list.targets[0].arch == .arm) { @@ -234,8 +237,8 @@ pub fn main() !void { const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" }); const vers_txt_file = try fs.cwd().createFile(vers_txt_path, .{}); defer vers_txt_file.close(); - var buffered = std.io.BufferedOutStream(fs.File.WriteError).init(&vers_txt_file.outStream().stream); - const vers_txt = &buffered.stream; + var buffered = std.io.bufferedOutStream(vers_txt_file.outStream()); + const vers_txt = buffered.outStream(); for (global_ver_list) |name, i| { _ = global_ver_set.put(name, i) catch unreachable; try vers_txt.print("{}\n", .{name}); @@ -246,8 +249,8 @@ pub fn main() !void { const fns_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "fns.txt" }); const fns_txt_file = try fs.cwd().createFile(fns_txt_path, .{}); defer fns_txt_file.close(); - var buffered = std.io.BufferedOutStream(fs.File.WriteError).init(&fns_txt_file.outStream().stream); - const fns_txt = &buffered.stream; + var buffered = std.io.bufferedOutStream(fns_txt_file.outStream()); + const fns_txt = buffered.outStream(); for (global_fn_list) |name, i| { const kv = global_fn_set.get(name).?; kv.value.index = i; @@ -277,8 +280,8 @@ pub fn main() !void { const abilist_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "abi.txt" }); const abilist_txt_file = try fs.cwd().createFile(abilist_txt_path, .{}); defer abilist_txt_file.close(); - var buffered = std.io.BufferedOutStream(fs.File.WriteError).init(&abilist_txt_file.outStream().stream); - const abilist_txt = &buffered.stream; + var buffered = std.io.bufferedOutStream(abilist_txt_file.outStream()); + const abilist_txt = buffered.outStream(); // first iterate over the abi lists for (abi_lists) |*abi_list, abi_index| { |
