Skip to content

Commit e8b00e8

Browse files
committed
Merge branch 'master' into common-impl-strcasecmp
2 parents 0fdb9c6 + 837e0f9 commit e8b00e8

File tree

18 files changed

+29
-160
lines changed

18 files changed

+29
-160
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ set(ZIG_STAGE2_SOURCES
640640
src/link/MachO/synthetic.zig
641641
src/link/MachO/Thunk.zig
642642
src/link/MachO/uuid.zig
643-
src/link/NvPtx.zig
644643
src/link/Plan9.zig
645644
src/link/Plan9/aout.zig
646645
src/link/SpirV.zig

lib/c.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ comptime {
1717
if (builtin.target.isMuslLibC() or builtin.target.isWasiLibC()) {
1818
// Files specific to musl and wasi-libc.
1919
_ = @import("c/string.zig");
20+
_ = @import("c/strings.zig");
2021
}
2122

2223
if (builtin.target.isMuslLibC()) {

lib/c/string.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ comptime {
1010
@export(&strncasecmp, .{ .name = "strncasecmp", .linkage = common.linkage, .visibility = common.visibility });
1111
@export(&__strcasecmp_l, .{ .name = "__strcasecmp_l", .linkage = common.linkage, .visibility = common.visibility });
1212
@export(&__strncasecmp_l, .{ .name = "__strncasecmp_l", .linkage = common.linkage, .visibility = common.visibility });
13+
@export(&__strcasecmp_l, .{ .name = "strcasecmp_l", .linkage = .weak, .visibility = common.visibility });
14+
@export(&__strncasecmp_l, .{ .name = "strncasecmp_l", .linkage = .weak, .visibility = common.visibility });
1315
}
1416

1517
fn strcmp(s1: [*:0]const c_char, s2: [*:0]const c_char) callconv(.c) c_int {

lib/c/strings.zig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const std = @import("std");
2+
const common = @import("common.zig");
3+
4+
comptime {
5+
@export(&bzero, .{ .name = "bzero", .linkage = common.linkage, .visibility = common.visibility });
6+
}
7+
8+
fn bzero(s: *anyopaque, n: usize) callconv(.c) void {
9+
const s_cast: [*]u8 = @ptrCast(s);
10+
@memset(s_cast[0..n], 0);
11+
}
12+
13+
test bzero {
14+
var array: [10]u8 = [_]u8{ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
15+
var a = std.mem.zeroes([array.len]u8);
16+
a[9] = '0';
17+
bzero(&array[0], 9);
18+
try std.testing.expect(std.mem.eql(u8, &array, &a));
19+
}

lib/libc/musl/src/string/bzero.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/libcxx/include/__flat_map/flat_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class flat_map {
113113

114114
class value_compare {
115115
private:
116-
key_compare __comp_;
116+
_LIBCPP_NO_UNIQUE_ADDRESS key_compare __comp_;
117117
_LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : __comp_(__c) {}
118118
friend flat_map;
119119

lib/libcxx/include/__flat_map/flat_multimap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class flat_multimap {
115115

116116
class value_compare {
117117
private:
118-
key_compare __comp_;
118+
_LIBCPP_NO_UNIQUE_ADDRESS key_compare __comp_;
119119
_LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : __comp_(__c) {}
120120
friend flat_multimap;
121121

lib/std/Target.zig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,6 @@ pub const ObjectFormat = enum {
10171017
hex,
10181018
/// The Mach object format used by macOS and other Apple platforms.
10191019
macho,
1020-
/// Nvidia's PTX (Parallel Thread Execution) assembly language.
1021-
nvptx,
10221020
/// The a.out format used by Plan 9 from Bell Labs.
10231021
plan9,
10241022
/// Machine code with no metadata.
@@ -1039,7 +1037,6 @@ pub const ObjectFormat = enum {
10391037
.coff => ".obj",
10401038
.elf, .goff, .macho, .wasm, .xcoff => ".o",
10411039
.hex => ".ihex",
1042-
.nvptx => ".ptx",
10431040
.plan9 => arch.plan9Ext(),
10441041
.raw => ".bin",
10451042
.spirv => ".spv",
@@ -1054,7 +1051,6 @@ pub const ObjectFormat = enum {
10541051
.uefi, .windows => .coff,
10551052
.zos => .goff,
10561053
else => switch (arch) {
1057-
.nvptx, .nvptx64 => .nvptx,
10581054
.spirv, .spirv32, .spirv64 => .spirv,
10591055
.wasm32, .wasm64 => .wasm,
10601056
else => .elf,

lib/std/os/linux.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usi
20422042

20432043
pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {
20442044
if (native_arch == .x86) {
2045-
return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 });
2045+
return socketcall(SC.accept, &[4]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len), 0 });
20462046
}
20472047
return accept4(fd, addr, len, 0);
20482048
}

lib/std/zig.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
232232
t.libPrefix(), root_name,
233233
}),
234234
},
235-
.nvptx => return std.fmt.allocPrint(allocator, "{s}.ptx", .{root_name}),
236235
}
237236
}
238237

src/Compilation/Config.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pub fn resolve(options: Options) ResolveError!Config {
434434
.windows, .uefi => .code_view,
435435
else => .{ .dwarf = .@"32" },
436436
},
437-
.spirv, .nvptx, .hex, .raw, .plan9 => .strip,
437+
.spirv, .hex, .raw, .plan9 => .strip,
438438
};
439439
};
440440

src/codegen.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ fn lowerUavRef(
666666
switch (lf.tag) {
667667
.c => unreachable,
668668
.spirv => unreachable,
669-
.nvptx => unreachable,
670669
.wasm => {
671670
dev.check(link.File.Tag.wasm.devFeature());
672671
const wasm = lf.cast(.wasm).?;
@@ -739,7 +738,6 @@ fn lowerNavRef(
739738
switch (lf.tag) {
740739
.c => unreachable,
741740
.spirv => unreachable,
742-
.nvptx => unreachable,
743741
.wasm => {
744742
dev.check(link.File.Tag.wasm.devFeature());
745743
const wasm = lf.cast(.wasm).?;

src/dev.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub const Env = enum {
8181
.wasm_linker,
8282
.spirv_linker,
8383
.plan9_linker,
84-
.nvptx_linker,
8584
.goff_linker,
8685
.xcoff_linker,
8786
=> true,
@@ -229,7 +228,6 @@ pub const Feature = enum {
229228
wasm_linker,
230229
spirv_linker,
231230
plan9_linker,
232-
nvptx_linker,
233231
goff_linker,
234232
xcoff_linker,
235233
};

src/link.zig

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ pub const File = struct {
597597
.mode = determineMode(use_lld, output_mode, link_mode),
598598
});
599599
},
600-
.c, .spirv, .nvptx => dev.checkAny(&.{ .c_linker, .spirv_linker, .nvptx_linker }),
600+
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
601601
}
602602
}
603603

@@ -670,7 +670,7 @@ pub const File = struct {
670670
}
671671
}
672672
},
673-
.c, .spirv, .nvptx => dev.checkAny(&.{ .c_linker, .spirv_linker, .nvptx_linker }),
673+
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
674674
}
675675
}
676676

@@ -697,7 +697,6 @@ pub const File = struct {
697697
.plan9 => unreachable,
698698
.spirv => unreachable,
699699
.c => unreachable,
700-
.nvptx => unreachable,
701700
inline else => |tag| {
702701
dev.check(tag.devFeature());
703702
return @as(*tag.Type(), @fieldParentPtr("base", base)).getGlobalSymbol(name, lib_name);
@@ -766,7 +765,7 @@ pub const File = struct {
766765
}
767766

768767
switch (base.tag) {
769-
.spirv, .nvptx => {},
768+
.spirv => {},
770769
.goff, .xcoff => {},
771770
inline else => |tag| {
772771
dev.check(tag.devFeature());
@@ -901,7 +900,6 @@ pub const File = struct {
901900
switch (base.tag) {
902901
.c => unreachable,
903902
.spirv => unreachable,
904-
.nvptx => unreachable,
905903
.wasm => unreachable,
906904
.goff, .xcoff => unreachable,
907905
inline else => |tag| {
@@ -921,7 +919,6 @@ pub const File = struct {
921919
switch (base.tag) {
922920
.c => unreachable,
923921
.spirv => unreachable,
924-
.nvptx => unreachable,
925922
.wasm => unreachable,
926923
.goff, .xcoff => unreachable,
927924
inline else => |tag| {
@@ -935,7 +932,6 @@ pub const File = struct {
935932
switch (base.tag) {
936933
.c => unreachable,
937934
.spirv => unreachable,
938-
.nvptx => unreachable,
939935
.wasm => unreachable,
940936
.goff, .xcoff => unreachable,
941937
inline else => |tag| {
@@ -953,7 +949,6 @@ pub const File = struct {
953949
switch (base.tag) {
954950
.plan9,
955951
.spirv,
956-
.nvptx,
957952
.goff,
958953
.xcoff,
959954
=> {},
@@ -1251,7 +1246,6 @@ pub const File = struct {
12511246
wasm,
12521247
spirv,
12531248
plan9,
1254-
nvptx,
12551249
goff,
12561250
xcoff,
12571251

@@ -1264,7 +1258,6 @@ pub const File = struct {
12641258
.wasm => Wasm,
12651259
.spirv => SpirV,
12661260
.plan9 => Plan9,
1267-
.nvptx => NvPtx,
12681261
.goff => Goff,
12691262
.xcoff => Xcoff,
12701263
};
@@ -1279,7 +1272,6 @@ pub const File = struct {
12791272
.plan9 => .plan9,
12801273
.c => .c,
12811274
.spirv => .spirv,
1282-
.nvptx => .nvptx,
12831275
.goff => .goff,
12841276
.xcoff => .xcoff,
12851277
.hex => @panic("TODO implement hex object format"),
@@ -1386,7 +1378,6 @@ pub const File = struct {
13861378
pub const MachO = @import("link/MachO.zig");
13871379
pub const SpirV = @import("link/SpirV.zig");
13881380
pub const Wasm = @import("link/Wasm.zig");
1389-
pub const NvPtx = @import("link/NvPtx.zig");
13901381
pub const Goff = @import("link/Goff.zig");
13911382
pub const Xcoff = @import("link/Xcoff.zig");
13921383
pub const Dwarf = @import("link/Dwarf.zig");

src/link/NvPtx.zig

Lines changed: 0 additions & 123 deletions
This file was deleted.

src/musl.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,6 @@ const src_files = [_][]const u8{
18401840
"musl/src/string/arm/__aeabi_memset.s",
18411841
"musl/src/string/bcmp.c",
18421842
"musl/src/string/bcopy.c",
1843-
"musl/src/string/bzero.c",
18441843
"musl/src/string/explicit_bzero.c",
18451844
"musl/src/string/i386/memset.s",
18461845
"musl/src/string/index.c",

src/target.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
140140
.goff,
141141
.hex,
142142
.macho,
143-
.nvptx,
144143
.spirv,
145144
.raw,
146145
.wasm,

0 commit comments

Comments
 (0)