From 12e25237309a0e358418e17ed1a71e123b89a7be Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Apr 2021 13:57:16 -0700 Subject: [PATCH 001/101] docgen: correct the progress bar It wasn't showing progress for non-code nodes. --- doc/docgen.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/docgen.zig b/doc/docgen.zig index c77f439f06..8dd299a6c5 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -1023,6 +1023,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe); for (toc.nodes) |node| { + defer root_node.completeOne(); switch (node) { .Content => |data| { try out.writeAll(data); @@ -1062,8 +1063,6 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: any try tokenizeAndPrint(tokenizer, out, content_tok); }, .Code => |code| { - root_node.completeOne(); - const raw_source = tokenizer.buffer[code.source_token.start..code.source_token.end]; const trimmed_raw_source = mem.trim(u8, raw_source, " \n"); if (!code.is_inline) { From 43d364afef7f0609f9d897c7ff129ba6b9b3cab0 Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Fri, 2 Apr 2021 18:57:49 +0200 Subject: [PATCH 002/101] stage2 AArch64: Add ldrh and ldrb instructions --- src/codegen.zig | 37 +++++++++++++++++++++++++++++ src/codegen/aarch64.zig | 52 ++++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 14 deletions(-) diff --git a/src/codegen.zig b/src/codegen.zig index beb3540d37..fbd412ceba 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -3302,6 +3302,43 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { mem.writeIntLittle(u32, try self.code.addManyAsArray(4), Instruction.ldr(reg, .{ .register = .{ .rn = reg } }).toU32()); } }, + .stack_offset => |unadjusted_off| { + // TODO: maybe addressing from sp instead of fp + const abi_size = ty.abiSize(self.target.*); + const adj_off = unadjusted_off + abi_size; + + const rn: Register = switch (arch) { + .aarch64, .aarch64_be => .x29, + .aarch64_32 => .w29, + else => unreachable, + }; + + const offset = if (math.cast(i9, adj_off)) |imm| + Instruction.LoadStoreOffset.imm_post_index(-imm) + else |_| + Instruction.LoadStoreOffset.reg(try self.copyToTmpRegister(src, Type.initTag(.u64), MCValue{ .immediate = adj_off })); + + switch (abi_size) { + 1, 2 => { + const ldr = switch (abi_size) { + 1 => Instruction.ldrb, + 2 => Instruction.ldrh, + else => unreachable, // unexpected abi size + }; + + writeInt(u32, try self.code.addManyAsArray(4), ldr(reg, rn, .{ + .offset = offset, + }).toU32()); + }, + 4, 8 => { + writeInt(u32, try self.code.addManyAsArray(4), Instruction.ldr(reg, .{ .register = .{ + .rn = rn, + .offset = offset, + } }).toU32()); + }, + else => return self.fail(src, "TODO implement genSetReg other types abi_size={}", .{abi_size}), + } + }, else => return self.fail(src, "TODO implement genSetReg for aarch64 {}", .{mcv}), }, .riscv64 => switch (mcv) { diff --git a/src/codegen/aarch64.zig b/src/codegen/aarch64.zig index b80606fe93..38d2842df9 100644 --- a/src/codegen/aarch64.zig +++ b/src/codegen/aarch64.zig @@ -487,11 +487,17 @@ pub const Instruction = union(enum) { /// Which kind of load/store to perform const LoadStoreVariant = enum { /// 32-bit or 64-bit - normal, - /// 16-bit - half, - /// 8-bit - byte, + str, + /// 16-bit, zero-extended + strh, + /// 8-bit, zero-extended + strb, + /// 32-bit or 64-bit + ldr, + /// 16-bit, zero-extended + ldrh, + /// 8-bit, zero-extended + ldrb, }; fn loadStoreRegister( @@ -499,7 +505,6 @@ pub const Instruction = union(enum) { rn: Register, offset: LoadStoreOffset, variant: LoadStoreVariant, - load: bool, ) Instruction { const off = offset.toU12(); const op1: u2 = blk: { @@ -512,7 +517,10 @@ pub const Instruction = union(enum) { } break :blk 0b00; }; - const opc: u2 = if (load) 0b01 else 0b00; + const opc: u2 = switch (variant) { + .ldr, .ldrh, .ldrb => 0b01, + .str, .strh, .strb => 0b00, + }; return Instruction{ .LoadStoreRegister = .{ .rt = rt.id(), @@ -523,13 +531,13 @@ pub const Instruction = union(enum) { .v = 0, .size = blk: { switch (variant) { - .normal => switch (rt.size()) { + .ldr, .str => switch (rt.size()) { 32 => break :blk 0b10, 64 => break :blk 0b11, else => unreachable, // unexpected register size }, - .half => break :blk 0b01, - .byte => break :blk 0b00, + .ldrh, .strh => break :blk 0b01, + .ldrb, .strb => break :blk 0b00, } }, }, @@ -756,25 +764,33 @@ pub const Instruction = union(enum) { pub fn ldr(rt: Register, args: LdrArgs) Instruction { switch (args) { - .register => |info| return loadStoreRegister(rt, info.rn, info.offset, .normal, true), + .register => |info| return loadStoreRegister(rt, info.rn, info.offset, .ldr), .literal => |literal| return loadLiteral(rt, literal), } } + pub fn ldrh(rt: Register, rn: Register, args: StrArgs) Instruction { + return loadStoreRegister(rt, rn, args.offset, .ldrh); + } + + pub fn ldrb(rt: Register, rn: Register, args: StrArgs) Instruction { + return loadStoreRegister(rt, rn, args.offset, .ldrb); + } + pub const StrArgs = struct { offset: LoadStoreOffset = LoadStoreOffset.none, }; pub fn str(rt: Register, rn: Register, args: StrArgs) Instruction { - return loadStoreRegister(rt, rn, args.offset, .normal, false); + return loadStoreRegister(rt, rn, args.offset, .str); } pub fn strh(rt: Register, rn: Register, args: StrArgs) Instruction { - return loadStoreRegister(rt, rn, args.offset, .half, false); + return loadStoreRegister(rt, rn, args.offset, .strh); } pub fn strb(rt: Register, rn: Register, args: StrArgs) Instruction { - return loadStoreRegister(rt, rn, args.offset, .byte, false); + return loadStoreRegister(rt, rn, args.offset, .strb); } // Load or store pair of registers @@ -1004,6 +1020,14 @@ test "serialize instructions" { .inst = Instruction.ldr(.x2, .{ .literal = 0x1 }), .expected = 0b01_011_0_00_0000000000000000001_00010, }, + .{ // ldrh x7, [x4], #0xaa + .inst = Instruction.ldrh(.x7, .x4, .{ .offset = Instruction.LoadStoreOffset.imm_post_index(0xaa) }), + .expected = 0b01_111_0_00_01_0_010101010_01_00100_00111, + }, + .{ // ldrb x9, [x15, #0xff]! + .inst = Instruction.ldrb(.x9, .x15, .{ .offset = Instruction.LoadStoreOffset.imm_pre_index(0xff) }), + .expected = 0b00_111_0_00_01_0_011111111_11_01111_01001, + }, .{ // str x2, [x1] .inst = Instruction.str(.x2, .x1, .{}), .expected = 0b11_111_0_01_00_000000000000_00001_00010, From 97d7fddfb78d17132749cae59fea36fe661bf642 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Apr 2021 19:11:51 -0700 Subject: [PATCH 003/101] stage2: progress towards basic structs Introduce `ResultLoc.none_or_ref` which is used by field access expressions to avoid unnecessary loads when the field access itself will do the load. This turns: ```zig p.y - p.x - p.x ``` from ```zir %14 = load(%4) node_offset:8:12 %15 = field_val(%14, "y") node_offset:8:13 %16 = load(%4) node_offset:8:18 %17 = field_val(%16, "x") node_offset:8:19 %18 = sub(%15, %17) node_offset:8:16 %19 = load(%4) node_offset:8:24 %20 = field_val(%19, "x") node_offset:8:25 ``` to ```zir %14 = field_val(%4, "y") node_offset:8:13 %15 = field_val(%4, "x") node_offset:8:19 %16 = sub(%14, %15) node_offset:8:16 %17 = field_val(%4, "x") node_offset:8:25 ``` Much more compact. This requires `Sema.zirFieldVal` to support both pointers and non-pointers. C backend: Implement typedefs for struct types, as well as the following TZIR instructions: * mul * mulwrap * addwrap * subwrap * ref * struct_field_ptr Note that add, addwrap, sub, subwrap, mul, mulwrap instructions are all incorrect currently and need to be updated to properly handle wrapping and non wrapping for signed and unsigned. C backend: change indentation delta to 1, to make the output smaller and to process fewer bytes. I promise I will add a test case as soon as I fix those warnings that are being printed for my test case. --- src/AstGen.zig | 38 ++++++++----- src/Module.zig | 8 +++ src/Sema.zig | 8 ++- src/codegen/c.zig | 126 ++++++++++++++++++++++++++++++++++++++------ src/zir.zig | 1 + test/stage2/cbe.zig | 4 +- 6 files changed, 152 insertions(+), 33 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 9b4e6c7c1a..6c3ce1251c 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -124,6 +124,9 @@ pub const ResultLoc = union(enum) { /// The expression must generate a pointer rather than a value. For example, the left hand side /// of an assignment uses this kind of result location. ref, + /// The callee will accept a ref, but it is not necessary, and the `ResultLoc` + /// may be treated as `none` instead. + none_or_ref, /// The expression will be coerced into this type, but it will be evaluated as an rvalue. ty: zir.Inst.Ref, /// The expression must store its result into this typed pointer. The result instruction @@ -157,7 +160,7 @@ pub const ResultLoc = union(enum) { var elide_store_to_block_ptr_instructions = false; switch (rl) { // In this branch there will not be any store_to_block_ptr instructions. - .discard, .none, .ty, .ref => return .{ + .discard, .none, .none_or_ref, .ty, .ref => return .{ .tag = .break_operand, .elide_store_to_block_ptr_instructions = false, }, @@ -606,8 +609,13 @@ pub fn expr(gz: *GenZir, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) Inn .deref => { const lhs = try expr(gz, scope, .none, node_datas[node].lhs); - const result = try gz.addUnNode(.load, lhs, node); - return rvalue(gz, scope, rl, result, node); + switch (rl) { + .ref, .none_or_ref => return lhs, + else => { + const result = try gz.addUnNode(.load, lhs, node); + return rvalue(gz, scope, rl, result, node); + }, + } }, .address_of => { const result = try expr(gz, scope, .ref, node_datas[node].lhs); @@ -816,7 +824,7 @@ pub fn structInitExpr( } switch (rl) { .discard => return mod.failNode(scope, node, "TODO implement structInitExpr discard", .{}), - .none => return mod.failNode(scope, node, "TODO implement structInitExpr none", .{}), + .none, .none_or_ref => return mod.failNode(scope, node, "TODO implement structInitExpr none", .{}), .ref => unreachable, // struct literal not valid as l-value .ty => |ty_inst| { return mod.failNode(scope, node, "TODO implement structInitExpr ty", .{}); @@ -1980,7 +1988,7 @@ fn orelseCatchExpr( // TODO handle catch const operand_rl: ResultLoc = switch (block_scope.break_result_loc) { .ref => .ref, - .discard, .none, .block_ptr, .inferred_ptr => .none, + .discard, .none, .none_or_ref, .block_ptr, .inferred_ptr => .none, .ty => |elem_ty| blk: { const wrapped_ty = try block_scope.addUnNode(.optional_type, elem_ty, node); break :blk .{ .ty = wrapped_ty }; @@ -2156,7 +2164,7 @@ pub fn fieldAccess( .field_name_start = str_index, }), else => return rvalue(gz, scope, rl, try gz.addPlNode(.field_val, node, zir.Inst.Field{ - .lhs = try expr(gz, scope, .none, object_node), + .lhs = try expr(gz, scope, .none_or_ref, object_node), .field_name_start = str_index, }), node), } @@ -3474,9 +3482,13 @@ fn identifier( .local_ptr => { const local_ptr = s.cast(Scope.LocalPtr).?; if (mem.eql(u8, local_ptr.name, ident_name)) { - if (rl == .ref) return local_ptr.ptr; - const loaded = try gz.addUnNode(.load, local_ptr.ptr, ident); - return rvalue(gz, scope, rl, loaded, ident); + switch (rl) { + .ref, .none_or_ref => return local_ptr.ptr, + else => { + const loaded = try gz.addUnNode(.load, local_ptr.ptr, ident); + return rvalue(gz, scope, rl, loaded, ident); + }, + } } s = local_ptr.parent; }, @@ -3493,7 +3505,7 @@ fn identifier( } const decl_index = @intCast(u32, gop.index); switch (rl) { - .ref => return gz.addDecl(.decl_ref, decl_index, ident), + .ref, .none_or_ref => return gz.addDecl(.decl_ref, decl_index, ident), else => return rvalue(gz, scope, rl, try gz.addDecl(.decl_val, decl_index, ident), ident), } } @@ -3697,7 +3709,7 @@ fn as( ) InnerError!zir.Inst.Ref { const dest_type = try typeExpr(gz, scope, lhs); switch (rl) { - .none, .discard, .ref, .ty => { + .none, .none_or_ref, .discard, .ref, .ty => { const result = try expr(gz, scope, .{ .ty = dest_type }, rhs); return rvalue(gz, scope, rl, result, node); }, @@ -3781,7 +3793,7 @@ fn bitCast( }); return rvalue(gz, scope, rl, result, node); }, - .ref => unreachable, // `@bitCast` is not allowed as an r-value. + .ref, .none_or_ref => unreachable, // `@bitCast` is not allowed as an r-value. .ptr => |result_ptr| { const casted_result_ptr = try gz.addUnNode(.bitcast_result_ptr, result_ptr, node); return expr(gz, scope, .{ .ptr = casted_result_ptr }, rhs); @@ -4354,7 +4366,7 @@ fn rvalue( src_node: ast.Node.Index, ) InnerError!zir.Inst.Ref { switch (rl) { - .none => return result, + .none, .none_or_ref => return result, .discard => { // Emit a compile error for discarding error values. _ = try gz.addUnNode(.ensure_result_non_error, result, src_node); diff --git a/src/Module.zig b/src/Module.zig index 52a53d034a..9a19dcdd87 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -373,6 +373,11 @@ pub const Struct = struct { /// Uses `unreachable_value` to indicate no default. default_val: Value, }; + + pub fn getFullyQualifiedName(struct_obj: *Struct, gpa: *Allocator) ![]u8 { + // TODO this should return e.g. "std.fs.Dir.OpenOptions" + return gpa.dupe(u8, mem.spanZ(struct_obj.owner_decl.name)); + } }; /// Some Fn struct memory is owned by the Decl's TypedValue.Managed arena allocator. @@ -1048,6 +1053,9 @@ pub const Scope = struct { gz.rl_ty_inst = ty_inst; gz.break_result_loc = parent_rl; }, + .none_or_ref => { + gz.break_result_loc = .ref; + }, .discard, .none, .ptr, .ref => { gz.break_result_loc = parent_rl; }, diff --git a/src/Sema.zig b/src/Sema.zig index 06ff3e445b..216544e1df 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -600,6 +600,7 @@ fn zirStructDecl( const struct_obj = try new_decl_arena.allocator.create(Module.Struct); const struct_ty = try Type.Tag.@"struct".create(&new_decl_arena.allocator, struct_obj); + const struct_val = try Value.Tag.ty.create(&new_decl_arena.allocator, struct_ty); struct_obj.* = .{ .owner_decl = sema.owner_decl, .fields = fields_map, @@ -611,7 +612,7 @@ fn zirStructDecl( }; const new_decl = try sema.mod.createAnonymousDecl(&block.base, &new_decl_arena, .{ .ty = Type.initTag(.type), - .val = try Value.Tag.ty.create(gpa, struct_ty), + .val = struct_val, }); return sema.analyzeDeclVal(block, src, new_decl); } @@ -2139,7 +2140,10 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerErro const extra = sema.code.extraData(zir.Inst.Field, inst_data.payload_index).data; const field_name = sema.code.nullTerminatedString(extra.field_name_start); const object = try sema.resolveInst(extra.lhs); - const object_ptr = try sema.analyzeRef(block, src, object); + const object_ptr = if (object.ty.zigTypeTag() == .Pointer) + object + else + try sema.analyzeRef(block, src, object); const result_ptr = try sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); } diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 6e68a43607..876f86ed02 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -44,24 +44,36 @@ fn formatTypeAsCIdentifier( var buffer = [1]u8{0} ** 128; // We don't care if it gets cut off, it's still more unique than a number var buf = std.fmt.bufPrint(&buffer, "{}", .{data}) catch &buffer; - - for (buf) |c, i| { - switch (c) { - 0 => return writer.writeAll(buf[0..i]), - 'a'...'z', 'A'...'Z', '_', '$' => {}, - '0'...'9' => if (i == 0) { - buf[i] = '_'; - }, - else => buf[i] = '_', - } - } - return writer.writeAll(buf); + return formatIdent(buf, "", .{}, writer); } pub fn typeToCIdentifier(t: Type) std.fmt.Formatter(formatTypeAsCIdentifier) { return .{ .data = t }; } +fn formatIdent( + ident: []const u8, + comptime fmt: []const u8, + options: std.fmt.FormatOptions, + writer: anytype, +) !void { + for (ident) |c, i| { + switch (c) { + 'a'...'z', 'A'...'Z', '_' => try writer.writeByte(c), + '0'...'9' => if (i == 0) { + try writer.print("${x:2}", .{c}); + } else { + try writer.writeByte(c); + }, + else => try writer.print("${x:2}", .{c}), + } + } +} + +pub fn fmtIdent(ident: []const u8) std.fmt.Formatter(formatIdent) { + return .{ .data = ident }; +} + /// This data is available when outputting .c code for a Module. /// It is not available when generating .h file. pub const Object = struct { @@ -430,6 +442,36 @@ pub const DeclGen = struct { try w.writeAll(name); dg.typedefs.putAssumeCapacityNoClobber(t, .{ .name = name, .rendered = rendered }); }, + .Struct => { + if (dg.typedefs.get(t)) |some| { + return w.writeAll(some.name); + } + const struct_obj = t.castTag(.@"struct").?.data; // Handle 0 bit types elsewhere. + const fqn = try struct_obj.getFullyQualifiedName(dg.typedefs.allocator); + defer dg.typedefs.allocator.free(fqn); + + var buffer = std.ArrayList(u8).init(dg.typedefs.allocator); + defer buffer.deinit(); + + try buffer.appendSlice("typedef struct {\n"); + for (struct_obj.fields.entries.items) |entry| { + try buffer.append(' '); + try dg.renderType(buffer.writer(), entry.value.ty); + try buffer.writer().print(" {s};\n", .{fmtIdent(entry.key)}); + } + try buffer.appendSlice("} "); + + const name_start = buffer.items.len; + try buffer.writer().print("zig_S_{s};\n", .{fmtIdent(fqn)}); + + const rendered = buffer.toOwnedSlice(); + errdefer dg.typedefs.allocator.free(rendered); + const name = rendered[name_start .. rendered.len - 2]; + + try dg.typedefs.ensureCapacity(dg.typedefs.capacity() + 1); + try w.writeAll(name); + dg.typedefs.putAssumeCapacityNoClobber(t, .{ .name = name, .rendered = rendered }); + }, .Null, .Undefined => unreachable, // must be const or comptime else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{ @tagName(e), @@ -525,8 +567,23 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi for (body.instructions) |inst| { const result_value = switch (inst.tag) { - .constant => unreachable, // excluded from function bodies + // TODO use a different strategy for add that communicates to the optimizer + // that wrapping is UB. .add => try genBinOp(o, inst.castTag(.add).?, " + "), + // TODO make this do wrapping arithmetic for signed ints + .addwrap => try genBinOp(o, inst.castTag(.add).?, " + "), + // TODO use a different strategy for sub that communicates to the optimizer + // that wrapping is UB. + .sub => try genBinOp(o, inst.castTag(.sub).?, " - "), + // TODO make this do wrapping arithmetic for signed ints + .subwrap => try genBinOp(o, inst.castTag(.sub).?, " - "), + // TODO use a different strategy for mul that communicates to the optimizer + // that wrapping is UB. + .mul => try genBinOp(o, inst.castTag(.sub).?, " * "), + // TODO make this do wrapping multiplication for signed ints + .mulwrap => try genBinOp(o, inst.castTag(.sub).?, " * "), + + .constant => unreachable, // excluded from function bodies .alloc => try genAlloc(o, inst.castTag(.alloc).?), .arg => genArg(o), .assembly => try genAsm(o, inst.castTag(.assembly).?), @@ -546,7 +603,6 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi .ret => try genRet(o, inst.castTag(.ret).?), .retvoid => try genRetVoid(o), .store => try genStore(o, inst.castTag(.store).?), - .sub => try genBinOp(o, inst.castTag(.sub).?, " - "), .unreach => try genUnreach(o, inst.castTag(.unreach).?), .loop => try genLoop(o, inst.castTag(.loop).?), .condbr => try genCondBr(o, inst.castTag(.condbr).?), @@ -567,17 +623,24 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi .wrap_optional => try genWrapOptional(o, inst.castTag(.wrap_optional).?), .optional_payload => try genOptionalPayload(o, inst.castTag(.optional_payload).?), .optional_payload_ptr => try genOptionalPayload(o, inst.castTag(.optional_payload_ptr).?), + .ref => try genRef(o, inst.castTag(.ref).?), + .struct_field_ptr => try genStructFieldPtr(o, inst.castTag(.struct_field_ptr).?), + .is_err => try genIsErr(o, inst.castTag(.is_err).?), .is_err_ptr => try genIsErr(o, inst.castTag(.is_err_ptr).?), .error_to_int => try genErrorToInt(o, inst.castTag(.error_to_int).?), .int_to_error => try genIntToError(o, inst.castTag(.int_to_error).?), + .unwrap_errunion_payload => try genUnwrapErrUnionPay(o, inst.castTag(.unwrap_errunion_payload).?), .unwrap_errunion_err => try genUnwrapErrUnionErr(o, inst.castTag(.unwrap_errunion_err).?), .unwrap_errunion_payload_ptr => try genUnwrapErrUnionPay(o, inst.castTag(.unwrap_errunion_payload_ptr).?), .unwrap_errunion_err_ptr => try genUnwrapErrUnionErr(o, inst.castTag(.unwrap_errunion_err_ptr).?), .wrap_errunion_payload => try genWrapErrUnionPay(o, inst.castTag(.wrap_errunion_payload).?), .wrap_errunion_err => try genWrapErrUnionErr(o, inst.castTag(.wrap_errunion_err).?), - else => |e| return o.dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement codegen for {}", .{e}), + .br_block_flat => return o.dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement codegen for br_block_flat", .{}), + .ptrtoint => return o.dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement codegen for ptrtoint", .{}), + .varptr => return o.dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement codegen for varptr", .{}), + .floatcast => return o.dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement codegen for floatcast", .{}), }; switch (result_value) { .none => {}, @@ -996,6 +1059,37 @@ fn genOptionalPayload(o: *Object, inst: *Inst.UnOp) !CValue { return local; } +fn genRef(o: *Object, inst: *Inst.UnOp) !CValue { + const writer = o.writer(); + const operand = try o.resolveInst(inst.operand); + + const local = try o.allocLocal(inst.base.ty, .Const); + try writer.writeAll(" = "); + try o.writeCValue(writer, operand); + try writer.writeAll(";\n"); + return local; +} + +fn genStructFieldPtr(o: *Object, inst: *Inst.StructFieldPtr) !CValue { + const writer = o.writer(); + const struct_ptr = try o.resolveInst(inst.struct_ptr); + const struct_obj = inst.struct_ptr.ty.elemType().castTag(.@"struct").?.data; + const field_name = struct_obj.fields.entries.items[inst.field_index].key; + + const local = try o.allocLocal(inst.base.ty, .Const); + switch (struct_ptr) { + .local_ref => |i| { + try writer.print(" = &t{d}.{};\n", .{ i, fmtIdent(field_name) }); + }, + else => { + try writer.writeAll(" = &"); + try o.writeCValue(writer, struct_ptr); + try writer.print("->{};\n", .{fmtIdent(field_name)}); + }, + } + return local; +} + // *(E!T) -> E NOT *E fn genUnwrapErrUnionErr(o: *Object, inst: *Inst.UnOp) !CValue { const writer = o.writer(); @@ -1088,7 +1182,7 @@ fn IndentWriter(comptime UnderlyingWriter: type) type { pub const Error = UnderlyingWriter.Error; pub const Writer = std.io.Writer(*Self, Error, write); - pub const indent_delta = 4; + pub const indent_delta = 1; underlying_writer: UnderlyingWriter, indent_count: usize = 0, diff --git a/src/zir.zig b/src/zir.zig index 5b1ad5ce18..92d155618e 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -338,6 +338,7 @@ pub const Inst = struct { field_ptr, /// Given a struct or object that contains virtual fields, returns the named field. /// The field name is stored in string_bytes. Used by a.b syntax. + /// This instruction also accepts a pointer. /// Uses `pl_node` field. The AST node is the a.b syntax. Payload is Field. field_val, /// Given a pointer to a struct or object that contains virtual fields, returns a pointer diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index e54f4b9650..a80b904ae4 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -489,8 +489,8 @@ pub fn addCases(ctx: *TestContext) !void { \\ZIG_EXTERN_C zig_noreturn void _start(void); \\ \\zig_noreturn void _start(void) { - \\ zig_breakpoint(); - \\ zig_unreachable(); + \\ zig_breakpoint(); + \\ zig_unreachable(); \\} \\ ); From d47f0abd5b5ba95bacd2d573aeabcc53db8c8fc3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Apr 2021 21:06:09 -0700 Subject: [PATCH 004/101] stage2: Sema: implement validate_struct_init_ptr --- src/Module.zig | 53 ++++++++++++++++++---- src/Sema.zig | 106 +++++++++++++++++++++++++++++++++++++++----- src/zir.zig | 2 + test/stage2/cbe.zig | 45 +++++++++++++++++++ 4 files changed, 186 insertions(+), 20 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index 9a19dcdd87..bab61730e5 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -364,7 +364,7 @@ pub const Struct = struct { /// Represents the declarations inside this struct. container: Scope.Container, - /// Offset from Decl node index, points to the struct AST node. + /// Offset from `owner_decl`, points to the struct AST node. node_offset: i32, pub const Field = struct { @@ -374,9 +374,16 @@ pub const Struct = struct { default_val: Value, }; - pub fn getFullyQualifiedName(struct_obj: *Struct, gpa: *Allocator) ![]u8 { + pub fn getFullyQualifiedName(s: *Struct, gpa: *Allocator) ![]u8 { // TODO this should return e.g. "std.fs.Dir.OpenOptions" - return gpa.dupe(u8, mem.spanZ(struct_obj.owner_decl.name)); + return gpa.dupe(u8, mem.spanZ(s.owner_decl.name)); + } + + pub fn srcLoc(s: Struct) SrcLoc { + return .{ + .container = .{ .decl = s.owner_decl }, + .lazy = .{ .node_offset = s.node_offset }, + }; } }; @@ -1580,6 +1587,7 @@ pub const SrcLoc = struct { .byte_offset, .token_offset, .node_offset, + .node_offset_back2tok, .node_offset_var_decl_ty, .node_offset_for_cond, .node_offset_builtin_call_arg0, @@ -1641,6 +1649,14 @@ pub const SrcLoc = struct { const token_starts = tree.tokens.items(.start); return token_starts[tok_index]; }, + .node_offset_back2tok => |node_off| { + const decl = src_loc.container.decl; + const node = decl.relativeToNodeIndex(node_off); + const tree = decl.container.file_scope.base.tree(); + const tok_index = tree.firstToken(node) - 2; + const token_starts = tree.tokens.items(.start); + return token_starts[tok_index]; + }, .node_offset_var_decl_ty => |node_off| { const decl = src_loc.container.decl; const node = decl.relativeToNodeIndex(node_off); @@ -1755,7 +1771,10 @@ pub const SrcLoc = struct { const node_datas = tree.nodes.items(.data); const node_tags = tree.nodes.items(.tag); const node = decl.relativeToNodeIndex(node_off); - const tok_index = node_datas[node].rhs; + const tok_index = switch (node_tags[node]) { + .field_access => node_datas[node].rhs, + else => tree.firstToken(node) - 2, + }; const token_starts = tree.tokens.items(.start); return token_starts[tok_index]; }, @@ -1996,6 +2015,10 @@ pub const LazySrcLoc = union(enum) { /// from its containing Decl node AST index. /// The Decl is determined contextually. node_offset: i32, + /// The source location points to two tokens left of the first token of an AST node, + /// which is this value offset from its containing Decl node AST index. + /// The Decl is determined contextually. + node_offset_back2tok: i32, /// The source location points to a variable declaration type expression, /// found by taking this AST node index offset from the containing /// Decl AST node, which points to a variable declaration AST node. Next, navigate @@ -2034,10 +2057,10 @@ pub const LazySrcLoc = union(enum) { /// to the callee expression. /// The Decl is determined contextually. node_offset_call_func: i32, - /// The source location points to the field name of a field access expression, - /// found by taking this AST node index offset from the containing - /// Decl AST node, which points to a field access AST node. Next, navigate - /// to the field name token. + /// The payload is offset from the containing Decl AST node. + /// The source location points to the field name of: + /// * a field access expression (`a.b`), or + /// * the operand ("b" node) of a field initialization expression (`.a = b`) /// The Decl is determined contextually. node_offset_field_name: i32, /// The source location points to the pointer of a pointer deref expression, @@ -2122,6 +2145,7 @@ pub const LazySrcLoc = union(enum) { .byte_offset, .token_offset, .node_offset, + .node_offset_back2tok, .node_offset_var_decl_ty, .node_offset_for_cond, .node_offset_builtin_call_arg0, @@ -2164,6 +2188,7 @@ pub const LazySrcLoc = union(enum) { .byte_offset, .token_offset, .node_offset, + .node_offset_back2tok, .node_offset_var_decl_ty, .node_offset_for_cond, .node_offset_builtin_call_arg0, @@ -4011,13 +4036,23 @@ pub fn errNote( parent: *ErrorMsg, comptime format: []const u8, args: anytype, +) error{OutOfMemory}!void { + return mod.errNoteNonLazy(src.toSrcLoc(scope), parent, format, args); +} + +pub fn errNoteNonLazy( + mod: *Module, + src_loc: SrcLoc, + parent: *ErrorMsg, + comptime format: []const u8, + args: anytype, ) error{OutOfMemory}!void { const msg = try std.fmt.allocPrint(mod.gpa, format, args); errdefer mod.gpa.free(msg); parent.notes = try mod.gpa.realloc(parent.notes, parent.notes.len + 1); parent.notes[parent.notes.len - 1] = .{ - .src_loc = src.toSrcLoc(scope), + .src_loc = src_loc, .msg = msg, }; } diff --git a/src/Sema.zig b/src/Sema.zig index 216544e1df..0b5a21ce42 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -838,12 +838,100 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Ind const tracy = trace(@src()); defer tracy.end(); - const inst_data = sema.code.instructions.items(.data)[inst].pl_node; - const src = inst_data.src(); - const extra = sema.code.extraData(zir.Inst.Block, inst_data.payload_index); - const instrs = sema.code.extra[extra.end..][0..extra.data.body_len]; + const gpa = sema.gpa; + const mod = sema.mod; + const validate_inst = sema.code.instructions.items(.data)[inst].pl_node; + const struct_init_src = validate_inst.src(); + const validate_extra = sema.code.extraData(zir.Inst.Block, validate_inst.payload_index); + const instrs = sema.code.extra[validate_extra.end..][0..validate_extra.data.body_len]; - log.warn("TODO implement zirValidateStructInitPtr (compile errors for missing/dupe fields)", .{}); + const struct_obj: *Module.Struct = s: { + const field_ptr_data = sema.code.instructions.items(.data)[instrs[0]].pl_node; + const field_ptr_extra = sema.code.extraData(zir.Inst.Field, field_ptr_data.payload_index).data; + const object_ptr = try sema.resolveInst(field_ptr_extra.lhs); + break :s object_ptr.ty.elemType().castTag(.@"struct").?.data; + }; + + // Maps field index to field_ptr index of where it was already initialized. + const found_fields = try gpa.alloc(zir.Inst.Index, struct_obj.fields.entries.items.len); + defer gpa.free(found_fields); + + mem.set(zir.Inst.Index, found_fields, 0); + + for (instrs) |field_ptr| { + const field_ptr_data = sema.code.instructions.items(.data)[field_ptr].pl_node; + const field_src: LazySrcLoc = .{ .node_offset_back2tok = field_ptr_data.src_node }; + const field_ptr_extra = sema.code.extraData(zir.Inst.Field, field_ptr_data.payload_index).data; + const field_name = sema.code.nullTerminatedString(field_ptr_extra.field_name_start); + const field_index = struct_obj.fields.getIndex(field_name) orelse + return sema.failWithBadFieldAccess(block, struct_obj, field_src, field_name); + if (found_fields[field_index] != 0) { + const other_field_ptr = found_fields[field_index]; + const other_field_ptr_data = sema.code.instructions.items(.data)[other_field_ptr].pl_node; + const other_field_src: LazySrcLoc = .{ .node_offset_back2tok = other_field_ptr_data.src_node }; + const msg = msg: { + const msg = try mod.errMsg(&block.base, field_src, "duplicate field", .{}); + errdefer msg.destroy(gpa); + try mod.errNote(&block.base, other_field_src, msg, "other field here", .{}); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); + } + found_fields[field_index] = field_ptr; + } + + var root_msg: ?*Module.ErrorMsg = null; + + for (found_fields) |field_ptr, i| { + if (field_ptr != 0) continue; + + const field_name = struct_obj.fields.entries.items[i].key; + const template = "mising struct field: {s}"; + const args = .{field_name}; + if (root_msg) |msg| { + try mod.errNote(&block.base, struct_init_src, msg, template, args); + } else { + root_msg = try mod.errMsg(&block.base, struct_init_src, template, args); + } + } + if (root_msg) |msg| { + const fqn = try struct_obj.getFullyQualifiedName(gpa); + defer gpa.free(fqn); + try mod.errNoteNonLazy( + struct_obj.srcLoc(), + msg, + "'{s}' declared here", + .{fqn}, + ); + return mod.failWithOwnedErrorMsg(&block.base, msg); + } +} + +fn failWithBadFieldAccess( + sema: *Sema, + block: *Scope.Block, + struct_obj: *Module.Struct, + field_src: LazySrcLoc, + field_name: []const u8, +) InnerError { + const mod = sema.mod; + const gpa = sema.gpa; + + const fqn = try struct_obj.getFullyQualifiedName(gpa); + defer gpa.free(fqn); + + const msg = msg: { + const msg = try mod.errMsg( + &block.base, + field_src, + "no field named '{s}' in struct '{s}'", + .{ field_name, fqn }, + ); + errdefer msg.destroy(gpa); + try mod.errNoteNonLazy(struct_obj.srcLoc(), msg, "'{s}' declared here", .{fqn}); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); } fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!void { @@ -4245,12 +4333,8 @@ fn analyzeStructFieldPtr( const struct_obj = elem_ty.castTag(.@"struct").?.data; - const field_index = struct_obj.fields.getIndex(field_name) orelse { - // TODO note: struct S declared here - return mod.fail(&block.base, field_name_src, "no field named '{s}' in struct '{}'", .{ - field_name, elem_ty, - }); - }; + const field_index = struct_obj.fields.getIndex(field_name) orelse + return sema.failWithBadFieldAccess(block, struct_obj, field_name_src, field_name); const field = struct_obj.fields.entries.items[field_index].value; const ptr_field_ty = try mod.simplePtrType(arena, field.ty, true, .One); // TODO comptime field access diff --git a/src/zir.zig b/src/zir.zig index 92d155618e..c70ef17fcd 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -660,6 +660,8 @@ pub const Inst = struct { /// Given a set of `field_ptr` instructions, assumes they are all part of a struct /// initialization expression, and emits compile errors for duplicate fields /// as well as missing fields, if applicable. + /// This instruction asserts that there is at least one field_ptr instruction, + /// because it must use one of them to find out the struct type. /// Uses the `pl_node` field. Payload is `Block`. validate_struct_init_ptr, /// A struct literal with a specified type, with no fields. diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index a80b904ae4..6efb5a5e7f 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -481,6 +481,51 @@ pub fn addCases(ctx: *TestContext) !void { \\} , ""); } + + { + var case = ctx.exeFromCompiledC("structs", .{}); + case.addError( + \\const Point = struct { x: i32, y: i32 }; + \\export fn main() c_int { + \\ var p: Point = .{ + \\ .y = 24, + \\ .x = 12, + \\ .y = 24, + \\ }; + \\ return p.y - p.x - p.x; + \\} + , &.{ + ":6:10: error: duplicate field", + ":4:10: note: other field here", + }); + case.addError( + \\const Point = struct { x: i32, y: i32 }; + \\export fn main() c_int { + \\ var p: Point = .{ + \\ .y = 24, + \\ }; + \\ return p.y - p.x - p.x; + \\} + , &.{ + ":3:21: error: mising struct field: x", + ":1:15: note: 'Point' declared here", + }); + case.addError( + \\const Point = struct { x: i32, y: i32 }; + \\export fn main() c_int { + \\ var p: Point = .{ + \\ .x = 12, + \\ .y = 24, + \\ .z = 48, + \\ }; + \\ return p.y - p.x - p.x; + \\} + , &.{ + ":6:10: error: no field named 'z' in struct 'Point'", + ":1:15: note: 'Point' declared here", + }); + } + ctx.c("empty start function", linux_x64, \\export fn _start() noreturn { \\ unreachable; From 2f07d76eee37442f53c294f53b38b11dfb1cd4da Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Apr 2021 21:17:23 -0700 Subject: [PATCH 005/101] stage2: implement Type.onePossibleValue for structs --- src/type.zig | 10 ++++++++-- test/stage2/cbe.zig | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/type.zig b/src/type.zig index 2086567b8a..f5ce296e4d 100644 --- a/src/type.zig +++ b/src/type.zig @@ -3118,8 +3118,14 @@ pub const Type = extern union { => return null, .@"struct" => { - log.warn("TODO implement Type.onePossibleValue for structs", .{}); - return null; + const s = ty.castTag(.@"struct").?.data; + for (s.fields.entries.items) |entry| { + const field_ty = entry.value.ty; + if (field_ty.onePossibleValue() == null) { + return null; + } + } + return Value.initTag(.empty_struct_value); }, .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 6efb5a5e7f..bfab645323 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -524,6 +524,16 @@ pub fn addCases(ctx: *TestContext) !void { ":6:10: error: no field named 'z' in struct 'Point'", ":1:15: note: 'Point' declared here", }); + case.addCompareOutput( + \\const Point = struct { x: i32, y: i32 }; + \\export fn main() c_int { + \\ var p: Point = .{ + \\ .x = 12, + \\ .y = 24, + \\ }; + \\ return p.y - p.x - p.x; + \\} + , ""); } ctx.c("empty start function", linux_x64, From d4dc2eb8076a5aa5cf2eb94c7b8407c94337bff8 Mon Sep 17 00:00:00 2001 From: antlilja Date: Fri, 2 Apr 2021 14:52:47 +0200 Subject: [PATCH 006/101] Compile error for signed integer math Output compile errors when signed integer types are used on functions where the answer might've been a complex number but that functionality hasn't been implemented. This applies to sqrt, log, log2, log10 and ln. A test which used a signed integer was also changed to use an unsigned integer instead. --- lib/std/math/ln.zig | 5 +++-- lib/std/math/log.zig | 10 ++++++---- lib/std/math/log10.zig | 5 +++-- lib/std/math/log2.zig | 5 +++-- lib/std/math/sqrt.zig | 5 ++++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/std/math/ln.zig b/lib/std/math/ln.zig index e0ce32a7e1..ce7cb3d882 100644 --- a/lib/std/math/ln.zig +++ b/lib/std/math/ln.zig @@ -36,8 +36,9 @@ pub fn ln(x: anytype) @TypeOf(x) { .ComptimeInt => { return @as(comptime_int, math.floor(ln_64(@as(f64, x)))); }, - .Int => { - return @as(T, math.floor(ln_64(@as(f64, x)))); + .Int => |IntType| switch (IntType.signedness) { + .signed => return @compileError("ln not implemented for signed integers"), + .unsigned => return @as(T, math.floor(ln_64(@as(f64, x)))), }, else => @compileError("ln not implemented for " ++ @typeName(T)), } diff --git a/lib/std/math/log.zig b/lib/std/math/log.zig index ef4d4bbb97..1a8101e67a 100644 --- a/lib/std/math/log.zig +++ b/lib/std/math/log.zig @@ -31,9 +31,11 @@ pub fn log(comptime T: type, base: T, x: T) T { .ComptimeInt => { return @as(comptime_int, math.floor(math.ln(@as(f64, x)) / math.ln(float_base))); }, - .Int => { - // TODO implement integer log without using float math - return @floatToInt(T, math.floor(math.ln(@intToFloat(f64, x)) / math.ln(float_base))); + + // TODO implement integer log without using float math + .Int => |IntType| switch (IntType.signedness) { + .signed => return @compileError("log not implemented for signed integers"), + .unsigned => return @floatToInt(T, math.floor(math.ln(@intToFloat(f64, x)) / math.ln(float_base))), }, .Float => { @@ -53,7 +55,7 @@ pub fn log(comptime T: type, base: T, x: T) T { test "math.log integer" { expect(log(u8, 2, 0x1) == 0); expect(log(u8, 2, 0x2) == 1); - expect(log(i16, 2, 0x72) == 6); + expect(log(u16, 2, 0x72) == 6); expect(log(u32, 2, 0xFFFFFF) == 23); expect(log(u64, 2, 0x7FF0123456789ABC) == 62); } diff --git a/lib/std/math/log10.zig b/lib/std/math/log10.zig index 719e0cf51d..a8211a7270 100644 --- a/lib/std/math/log10.zig +++ b/lib/std/math/log10.zig @@ -37,8 +37,9 @@ pub fn log10(x: anytype) @TypeOf(x) { .ComptimeInt => { return @as(comptime_int, math.floor(log10_64(@as(f64, x)))); }, - .Int => { - return @floatToInt(T, math.floor(log10_64(@intToFloat(f64, x)))); + .Int => |IntType| switch (IntType.signedness) { + .signed => return @compileError("log10 not implemented for signed integers"), + .unsigned => return @floatToInt(T, math.floor(log10_64(@intToFloat(f64, x)))), }, else => @compileError("log10 not implemented for " ++ @typeName(T)), } diff --git a/lib/std/math/log2.zig b/lib/std/math/log2.zig index c44672751e..76bc79407c 100644 --- a/lib/std/math/log2.zig +++ b/lib/std/math/log2.zig @@ -43,8 +43,9 @@ pub fn log2(x: anytype) @TypeOf(x) { }) : (result += 1) {} return result; }, - .Int => { - return math.log2_int(T, x); + .Int => |IntType| switch (IntType.signedness) { + .signed => return @compileError("log2 not implemented for signed integers"), + .unsigned => return math.log2_int(T, x), }, else => @compileError("log2 not implemented for " ++ @typeName(T)), } diff --git a/lib/std/math/sqrt.zig b/lib/std/math/sqrt.zig index 38609115d8..394164ff54 100644 --- a/lib/std/math/sqrt.zig +++ b/lib/std/math/sqrt.zig @@ -31,7 +31,10 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) { } return @as(T, sqrt_int(u128, x)); }, - .Int => return sqrt_int(T, x), + .Int => |IntType| switch (IntType.signedness) { + .signed => return @compileError("sqrt not implemented for signed integers"), + .unsigned => return sqrt_int(T, x), + }, else => @compileError("sqrt not implemented for " ++ @typeName(T)), } } From 74fd7107e85e19412c4b5d2c55d230844f22f372 Mon Sep 17 00:00:00 2001 From: Lewis Gaul Date: Sun, 4 Apr 2021 09:16:59 +0100 Subject: [PATCH 007/101] Switch std.json to use an ordered hashmap --- lib/std/json.zig | 4 +-- lib/std/json/test.zig | 66 +++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/lib/std/json.zig b/lib/std/json.zig index 96ad066db3..7596631ea2 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -1234,7 +1234,7 @@ test "json.validate" { const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const ArrayList = std.ArrayList; -const StringHashMap = std.StringHashMap; +const StringArrayHashMap = std.StringArrayHashMap; pub const ValueTree = struct { arena: ArenaAllocator, @@ -1245,7 +1245,7 @@ pub const ValueTree = struct { } }; -pub const ObjectMap = StringHashMap(Value); +pub const ObjectMap = StringArrayHashMap(Value); pub const Array = ArrayList(Value); /// Represents a JSON value diff --git a/lib/std/json/test.zig b/lib/std/json/test.zig index 897e2e3364..3945c3a8db 100644 --- a/lib/std/json/test.zig +++ b/lib/std/json/test.zig @@ -52,12 +52,28 @@ fn anyStreamingErrNonStreaming(comptime s: []const u8) void { testing.expect(false); } +fn roundTrip(s: []const u8) !void { + testing.expect(json.validate(s)); + + var p = json.Parser.init(testing.allocator, false); + defer p.deinit(); + + var tree = try p.parse(s); + defer tree.deinit(); + + var buf: [256]u8 = undefined; + var fbs = std.io.fixedBufferStream(&buf); + try tree.root.jsonStringify(.{}, fbs.writer()); + + testing.expectEqualStrings(s, fbs.getWritten()); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // // Additional tests not part of test JSONTestSuite. test "y_trailing_comma_after_empty" { - ok( + try roundTrip( \\{"1":[],"2":{},"3":"4"} ); } @@ -71,25 +87,25 @@ test "y_array_arraysWithSpaces" { } test "y_array_empty" { - ok( + try roundTrip( \\[] ); } test "y_array_empty-string" { - ok( + try roundTrip( \\[""] ); } test "y_array_ending_with_newline" { - ok( + try roundTrip( \\["a"] ); } test "y_array_false" { - ok( + try roundTrip( \\[false] ); } @@ -101,7 +117,7 @@ test "y_array_heterogeneous" { } test "y_array_null" { - ok( + try roundTrip( \\[null] ); } @@ -120,7 +136,7 @@ test "y_array_with_leading_space" { } test "y_array_with_several_null" { - ok( + try roundTrip( \\[1,null,null,null,2] ); } @@ -172,13 +188,13 @@ test "y_number_minus_zero" { } test "y_number_negative_int" { - ok( + try roundTrip( \\[-123] ); } test "y_number_negative_one" { - ok( + try roundTrip( \\[-1] ); } @@ -232,7 +248,7 @@ test "y_number_real_pos_exponent" { } test "y_number_simple_int" { - ok( + try roundTrip( \\[123] ); } @@ -244,7 +260,7 @@ test "y_number_simple_real" { } test "y_object_basic" { - ok( + try roundTrip( \\{"asd":"sdf"} ); } @@ -262,13 +278,13 @@ test "y_object_duplicated_key" { } test "y_object_empty" { - ok( + try roundTrip( \\{} ); } test "y_object_empty_key" { - ok( + try roundTrip( \\{"":0} ); } @@ -298,7 +314,7 @@ test "y_object_long_strings" { } test "y_object_simple" { - ok( + try roundTrip( \\{"a":[]} ); } @@ -348,7 +364,7 @@ test "y_string_backslash_and_u_escaped_zero" { } test "y_string_backslash_doublequotes" { - ok( + try roundTrip( \\["\""] ); } @@ -366,7 +382,7 @@ test "y_string_double_escape_a" { } test "y_string_double_escape_n" { - ok( + try roundTrip( \\["\\n"] ); } @@ -450,7 +466,7 @@ test "y_string_simple_ascii" { } test "y_string_space" { - ok( + try roundTrip( \\" " ); } @@ -568,13 +584,13 @@ test "y_string_with_del_character" { } test "y_structure_lonely_false" { - ok( + try roundTrip( \\false ); } test "y_structure_lonely_int" { - ok( + try roundTrip( \\42 ); } @@ -586,37 +602,37 @@ test "y_structure_lonely_negative_real" { } test "y_structure_lonely_null" { - ok( + try roundTrip( \\null ); } test "y_structure_lonely_string" { - ok( + try roundTrip( \\"asd" ); } test "y_structure_lonely_true" { - ok( + try roundTrip( \\true ); } test "y_structure_string_empty" { - ok( + try roundTrip( \\"" ); } test "y_structure_trailing_newline" { - ok( + try roundTrip( \\["a"] ); } test "y_structure_true_in_array" { - ok( + try roundTrip( \\[true] ); } From e4563860feba97626630d15f481c6ad19348b81f Mon Sep 17 00:00:00 2001 From: xackus <14938807+xackus@users.noreply.github.com> Date: Sun, 4 Apr 2021 00:15:22 +0200 Subject: [PATCH 008/101] translate-c: fix calls with no args in macros --- src/translate_c.zig | 31 ++++++++++++++++++------------- test/translate_c.zig | 8 ++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/translate_c.zig b/src/translate_c.zig index 9ad90a5320..4c6d9ccee1 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -5211,21 +5211,26 @@ fn parseCPostfixExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { } }, .LParen => { - var args = std.ArrayList(Node).init(c.gpa); - defer args.deinit(); - while (true) { - const arg = try parseCCondExpr(c, m, scope); - try args.append(arg); - switch (m.next().?) { - .Comma => {}, - .RParen => break, - else => { - try m.fail(c, "unable to translate C expr: expected ',' or ')'", .{}); - return error.ParseError; - }, + if (m.peek().? == .RParen) { + m.i += 1; + node = try Tag.call.create(c.arena, .{ .lhs = node, .args = &[0]Node{} }); + } else { + var args = std.ArrayList(Node).init(c.gpa); + defer args.deinit(); + while (true) { + const arg = try parseCCondExpr(c, m, scope); + try args.append(arg); + switch (m.next().?) { + .Comma => {}, + .RParen => break, + else => { + try m.fail(c, "unable to translate C expr: expected ',' or ')'", .{}); + return error.ParseError; + }, + } } + node = try Tag.call.create(c.arena, .{ .lhs = node, .args = try c.arena.dupe(Node, args.items) }); } - node = try Tag.call.create(c.arena, .{ .lhs = node, .args = try c.arena.dupe(Node, args.items) }); }, .LBrace => { var init_vals = std.ArrayList(Node).init(c.gpa); diff --git a/test/translate_c.zig b/test/translate_c.zig index 54bb468cf9..e2f974ff89 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -2529,6 +2529,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\} }); + cases.add("macro call with no args", + \\#define CALL(arg) bar() + , &[_][]const u8{ + \\pub fn CALL(arg: anytype) callconv(.Inline) @TypeOf(bar()) { + \\ return bar(); + \\} + }); + cases.add("logical and, logical or", \\int max(int a, int b) { \\ if (a < b || a == b) From 5ce45240277a6383731ef5e371e5dcbb36ada343 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sun, 4 Apr 2021 00:44:32 +0200 Subject: [PATCH 009/101] os/bits/linux: add IPv6 socket options --- lib/std/os/bits/linux.zig | 86 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig index 21fa058aef..e255d0e362 100644 --- a/lib/std/os/bits/linux.zig +++ b/lib/std/os/bits/linux.zig @@ -586,6 +586,92 @@ pub const IP_DEFAULT_MULTICAST_TTL = 1; pub const IP_DEFAULT_MULTICAST_LOOP = 1; pub const IP_MAX_MEMBERSHIPS = 20; +// IPv6 socket options + +pub const IPV6_ADDRFORM = 1; +pub const IPV6_2292PKTINFO = 2; +pub const IPV6_2292HOPOPTS = 3; +pub const IPV6_2292DSTOPTS = 4; +pub const IPV6_2292RTHDR = 5; +pub const IPV6_2292PKTOPTIONS = 6; +pub const IPV6_CHECKSUM = 7; +pub const IPV6_2292HOPLIMIT = 8; +pub const IPV6_NEXTHOP = 9; +pub const IPV6_AUTHHDR = 10; +pub const IPV6_FLOWINFO = 11; + +pub const IPV6_UNICAST_HOPS = 16; +pub const IPV6_MULTICAST_IF = 17; +pub const IPV6_MULTICAST_HOPS = 18; +pub const IPV6_MULTICAST_LOOP = 19; +pub const IPV6_ADD_MEMBERSHIP = 20; +pub const IPV6_DROP_MEMBERSHIP = 21; +pub const IPV6_ROUTER_ALERT = 22; +pub const IPV6_MTU_DISCOVER = 23; +pub const IPV6_MTU = 24; +pub const IPV6_RECVERR = 25; +pub const IPV6_V6ONLY = 26; +pub const IPV6_JOIN_ANYCAST = 27; +pub const IPV6_LEAVE_ANYCAST = 28; + +// IPV6_MTU_DISCOVER values +pub const IPV6_PMTUDISC_DONT = 0; +pub const IPV6_PMTUDISC_WANT = 1; +pub const IPV6_PMTUDISC_DO = 2; +pub const IPV6_PMTUDISC_PROBE = 3; +pub const IPV6_PMTUDISC_INTERFACE = 4; +pub const IPV6_PMTUDISC_OMIT = 5; + +// Flowlabel +pub const IPV6_FLOWLABEL_MGR = 32; +pub const IPV6_FLOWINFO_SEND = 33; +pub const IPV6_IPSEC_POLICY = 34; +pub const IPV6_XFRM_POLICY = 35; +pub const IPV6_HDRINCL = 36; + +// Advanced API (RFC3542) (1) +pub const IPV6_RECVPKTINFO = 49; +pub const IPV6_PKTINFO = 50; +pub const IPV6_RECVHOPLIMIT = 51; +pub const IPV6_HOPLIMIT = 52; +pub const IPV6_RECVHOPOPTS = 53; +pub const IPV6_HOPOPTS = 54; +pub const IPV6_RTHDRDSTOPTS = 55; +pub const IPV6_RECVRTHDR = 56; +pub const IPV6_RTHDR = 57; +pub const IPV6_RECVDSTOPTS = 58; +pub const IPV6_DSTOPTS = 59; +pub const IPV6_RECVPATHMTU = 60; +pub const IPV6_PATHMTU = 61; +pub const IPV6_DONTFRAG = 62; + +// Advanced API (RFC3542) (2) +pub const IPV6_RECVTCLASS = 66; +pub const IPV6_TCLASS = 67; + +pub const IPV6_AUTOFLOWLABEL = 70; + +// RFC5014: Source address selection +pub const IPV6_ADDR_PREFERENCES = 72; + +pub const IPV6_PREFER_SRC_TMP = 0x0001; +pub const IPV6_PREFER_SRC_PUBLIC = 0x0002; +pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x0100; +pub const IPV6_PREFER_SRC_COA = 0x0004; +pub const IPV6_PREFER_SRC_HOME = 0x0400; +pub const IPV6_PREFER_SRC_CGA = 0x0008; +pub const IPV6_PREFER_SRC_NONCGA = 0x0800; + +// RFC5082: Generalized Ttl Security Mechanism +pub const IPV6_MINHOPCOUNT = 73; + +pub const IPV6_ORIGDSTADDR = 74; +pub const IPV6_RECVORIGDSTADDR = IPV6_ORIGDSTADDR; +pub const IPV6_TRANSPARENT = 75; +pub const IPV6_UNICAST_IF = 76; +pub const IPV6_RECVFRAGSIZE = 77; +pub const IPV6_FREEBIND = 78; + pub const MSG_OOB = 0x0001; pub const MSG_PEEK = 0x0002; pub const MSG_DONTROUTE = 0x0004; From 0e2da1137980d31b1a1e4577dbd697d4a41cfa9b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 4 Apr 2021 11:54:47 -0700 Subject: [PATCH 010/101] glibc: update headers to 2.33 This introduces csky support. --- .../include/aarch64-linux-gnu/bits/fcntl.h | 2 +- .../include/aarch64-linux-gnu/bits/fenv.h | 2 +- .../include/aarch64-linux-gnu/bits/fp-fast.h | 2 +- .../include/aarch64-linux-gnu/bits/hwcap.h | 5 +- .../include/aarch64-linux-gnu/bits/link.h | 2 +- .../aarch64-linux-gnu/bits/local_lim.h | 2 +- .../aarch64-linux-gnu/bits/long-double.h | 2 +- .../include/aarch64-linux-gnu/bits/mman.h | 3 +- .../include/aarch64-linux-gnu/bits/procfs.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../aarch64-linux-gnu/bits/semaphore.h | 2 +- .../include/aarch64-linux-gnu/bits/setjmp.h | 2 +- .../include/aarch64-linux-gnu/bits/sigstack.h | 2 +- .../include/aarch64-linux-gnu/bits/statfs.h | 2 +- .../aarch64-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 59 +---- .../aarch64-linux-gnu/bits/typesizes.h | 2 +- .../include/aarch64-linux-gnu/bits/wordsize.h | 2 +- .../include/aarch64-linux-gnu/fpu_control.h | 2 +- lib/libc/include/aarch64-linux-gnu/ieee754.h | 2 +- lib/libc/include/aarch64-linux-gnu/sys/elf.h | 2 +- .../include/aarch64-linux-gnu/sys/ptrace.h | 2 +- .../include/aarch64-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/aarch64-linux-gnu/sys/user.h | 2 +- .../include/aarch64_be-linux-gnu/bits/fcntl.h | 2 +- .../include/aarch64_be-linux-gnu/bits/fenv.h | 2 +- .../aarch64_be-linux-gnu/bits/fp-fast.h | 2 +- .../include/aarch64_be-linux-gnu/bits/hwcap.h | 5 +- .../include/aarch64_be-linux-gnu/bits/link.h | 2 +- .../aarch64_be-linux-gnu/bits/local_lim.h | 2 +- .../aarch64_be-linux-gnu/bits/long-double.h | 2 +- .../include/aarch64_be-linux-gnu/bits/mman.h | 3 +- .../aarch64_be-linux-gnu/bits/procfs.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../aarch64_be-linux-gnu/bits/semaphore.h | 2 +- .../aarch64_be-linux-gnu/bits/setjmp.h | 2 +- .../aarch64_be-linux-gnu/bits/sigstack.h | 2 +- .../aarch64_be-linux-gnu/bits/statfs.h | 2 +- .../aarch64_be-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 59 +---- .../aarch64_be-linux-gnu/bits/typesizes.h | 2 +- .../aarch64_be-linux-gnu/bits/wordsize.h | 2 +- .../aarch64_be-linux-gnu/fpu_control.h | 2 +- .../include/aarch64_be-linux-gnu/ieee754.h | 2 +- .../include/aarch64_be-linux-gnu/sys/elf.h | 2 +- .../include/aarch64_be-linux-gnu/sys/ptrace.h | 2 +- .../aarch64_be-linux-gnu/sys/ucontext.h | 2 +- .../include/aarch64_be-linux-gnu/sys/user.h | 2 +- .../include/arm-linux-gnueabi/bits/fcntl.h | 2 +- .../include/arm-linux-gnueabi/bits/fenv.h | 2 +- .../include/arm-linux-gnueabi/bits/floatn.h | 2 +- .../include/arm-linux-gnueabi/bits/hwcap.h | 2 +- .../include/arm-linux-gnueabi/bits/link.h | 2 +- .../arm-linux-gnueabi/bits/long-double.h | 2 +- .../arm-linux-gnueabi/bits/procfs-id.h | 2 +- .../include/arm-linux-gnueabi/bits/procfs.h | 2 +- .../include/arm-linux-gnueabi/bits/setjmp.h | 2 +- .../include/arm-linux-gnueabi/bits/shmlba.h | 2 +- .../arm-linux-gnueabi/bits/struct_rwlock.h | 2 +- .../bits/struct_stat.h} | 59 +---- .../include/arm-linux-gnueabi/bits/wordsize.h | 2 +- .../include/arm-linux-gnueabi/fpu_control.h | 2 +- .../include/arm-linux-gnueabi/sys/ptrace.h | 2 +- .../include/arm-linux-gnueabi/sys/ucontext.h | 2 +- lib/libc/include/arm-linux-gnueabi/sys/user.h | 2 +- .../include/arm-linux-gnueabihf/bits/fcntl.h | 2 +- .../include/arm-linux-gnueabihf/bits/fenv.h | 2 +- .../include/arm-linux-gnueabihf/bits/floatn.h | 2 +- .../include/arm-linux-gnueabihf/bits/hwcap.h | 2 +- .../include/arm-linux-gnueabihf/bits/link.h | 2 +- .../arm-linux-gnueabihf/bits/long-double.h | 2 +- .../arm-linux-gnueabihf/bits/procfs-id.h | 2 +- .../include/arm-linux-gnueabihf/bits/procfs.h | 2 +- .../include/arm-linux-gnueabihf/bits/setjmp.h | 2 +- .../include/arm-linux-gnueabihf/bits/shmlba.h | 2 +- .../arm-linux-gnueabihf/bits/struct_rwlock.h | 2 +- .../bits/struct_stat.h} | 59 +---- .../arm-linux-gnueabihf/bits/wordsize.h | 2 +- .../include/arm-linux-gnueabihf/fpu_control.h | 2 +- .../include/arm-linux-gnueabihf/sys/ptrace.h | 2 +- .../arm-linux-gnueabihf/sys/ucontext.h | 2 +- .../include/arm-linux-gnueabihf/sys/user.h | 2 +- .../include/armeb-linux-gnueabi/bits/fcntl.h | 2 +- .../include/armeb-linux-gnueabi/bits/fenv.h | 2 +- .../include/armeb-linux-gnueabi/bits/floatn.h | 2 +- .../include/armeb-linux-gnueabi/bits/hwcap.h | 2 +- .../include/armeb-linux-gnueabi/bits/link.h | 2 +- .../armeb-linux-gnueabi/bits/long-double.h | 2 +- .../armeb-linux-gnueabi/bits/procfs-id.h | 2 +- .../include/armeb-linux-gnueabi/bits/procfs.h | 2 +- .../include/armeb-linux-gnueabi/bits/setjmp.h | 2 +- .../include/armeb-linux-gnueabi/bits/shmlba.h | 2 +- .../armeb-linux-gnueabi/bits/struct_rwlock.h | 2 +- .../bits/struct_stat.h} | 59 +---- .../armeb-linux-gnueabi/bits/wordsize.h | 2 +- .../include/armeb-linux-gnueabi/fpu_control.h | 2 +- .../include/armeb-linux-gnueabi/sys/ptrace.h | 2 +- .../armeb-linux-gnueabi/sys/ucontext.h | 2 +- .../include/armeb-linux-gnueabi/sys/user.h | 2 +- .../armeb-linux-gnueabihf/bits/fcntl.h | 2 +- .../include/armeb-linux-gnueabihf/bits/fenv.h | 2 +- .../armeb-linux-gnueabihf/bits/floatn.h | 2 +- .../armeb-linux-gnueabihf/bits/hwcap.h | 2 +- .../include/armeb-linux-gnueabihf/bits/link.h | 2 +- .../armeb-linux-gnueabihf/bits/long-double.h | 2 +- .../armeb-linux-gnueabihf/bits/procfs-id.h | 2 +- .../armeb-linux-gnueabihf/bits/procfs.h | 2 +- .../armeb-linux-gnueabihf/bits/setjmp.h | 2 +- .../armeb-linux-gnueabihf/bits/shmlba.h | 2 +- .../bits/struct_rwlock.h | 2 +- .../bits/struct_stat.h} | 59 +---- .../armeb-linux-gnueabihf/bits/wordsize.h | 2 +- .../armeb-linux-gnueabihf/fpu_control.h | 2 +- .../armeb-linux-gnueabihf/sys/ptrace.h | 2 +- .../armeb-linux-gnueabihf/sys/ucontext.h | 2 +- .../include/armeb-linux-gnueabihf/sys/user.h | 2 +- .../csky-linux-gnueabi/bits/endianness.h | 14 ++ .../include/csky-linux-gnueabi/bits/fcntl.h | 56 +++++ .../include/csky-linux-gnueabi/bits/fenv.h | 111 +++++++++ .../include/csky-linux-gnueabi/bits/floatn.h | 52 +++++ .../include/csky-linux-gnueabi/bits/link.h | 55 +++++ .../csky-linux-gnueabi/bits/long-double.h | 53 +++++ .../include/csky-linux-gnueabi/bits/procfs.h | 37 +++ .../include/csky-linux-gnueabi/bits/setjmp.h | 34 +++ .../include/csky-linux-gnueabi/bits/shmlba.h | 29 +++ .../include/csky-linux-gnueabi/bits/statfs.h | 86 +++++++ .../csky-linux-gnueabi/bits/struct_rwlock.h | 61 +++++ .../bits/struct_stat.h} | 59 +---- .../csky-linux-gnueabi/bits/typesizes.h | 108 +++++++++ .../csky-linux-gnueabi/bits/wordsize.h | 21 ++ .../include/csky-linux-gnueabi/fpu_control.h | 148 ++++++++++++ .../csky-linux-gnueabi/gnu/lib-names.h | 32 +++ .../include/csky-linux-gnueabi/gnu/stubs.h | 38 +++ .../include/csky-linux-gnueabi/sys/cachectl.h | 36 +++ .../include/csky-linux-gnueabi/sys/ucontext.h | 89 +++++++ .../include/csky-linux-gnueabi/sys/user.h | 23 ++ .../csky-linux-gnueabihf/bits/endianness.h | 14 ++ .../include/csky-linux-gnueabihf/bits/fcntl.h | 56 +++++ .../include/csky-linux-gnueabihf/bits/fenv.h | 111 +++++++++ .../csky-linux-gnueabihf/bits/floatn.h | 52 +++++ .../include/csky-linux-gnueabihf/bits/link.h | 55 +++++ .../csky-linux-gnueabihf/bits/long-double.h | 53 +++++ .../csky-linux-gnueabihf/bits/procfs.h | 37 +++ .../csky-linux-gnueabihf/bits/setjmp.h | 34 +++ .../csky-linux-gnueabihf/bits/shmlba.h | 29 +++ .../csky-linux-gnueabihf/bits/statfs.h | 86 +++++++ .../csky-linux-gnueabihf/bits/struct_rwlock.h | 61 +++++ .../csky-linux-gnueabihf/bits/struct_stat.h | 127 ++++++++++ .../csky-linux-gnueabihf/bits/typesizes.h | 108 +++++++++ .../csky-linux-gnueabihf/bits/wordsize.h | 21 ++ .../csky-linux-gnueabihf/fpu_control.h | 148 ++++++++++++ .../csky-linux-gnueabihf/gnu/lib-names.h | 32 +++ .../include/csky-linux-gnueabihf/gnu/stubs.h | 21 ++ .../csky-linux-gnueabihf/sys/cachectl.h | 36 +++ .../csky-linux-gnueabihf/sys/ucontext.h | 89 +++++++ .../include/csky-linux-gnueabihf/sys/user.h | 23 ++ lib/libc/include/generic-glibc/aio.h | 15 +- lib/libc/include/generic-glibc/aliases.h | 10 +- lib/libc/include/generic-glibc/alloca.h | 4 +- lib/libc/include/generic-glibc/ar.h | 2 +- lib/libc/include/generic-glibc/argp.h | 8 +- lib/libc/include/generic-glibc/argz.h | 2 +- lib/libc/include/generic-glibc/arpa/inet.h | 2 +- lib/libc/include/generic-glibc/assert.h | 2 +- .../include/generic-glibc/bits/argp-ldbl.h | 2 +- .../include/generic-glibc/bits/byteswap.h | 2 +- .../include/generic-glibc/bits/cmathcalls.h | 2 +- .../include/generic-glibc/bits/confname.h | 2 +- lib/libc/include/generic-glibc/bits/cpu-set.h | 2 +- lib/libc/include/generic-glibc/bits/dirent.h | 2 +- .../include/generic-glibc/bits/dirent_ext.h | 2 +- lib/libc/include/generic-glibc/bits/dlfcn.h | 2 +- lib/libc/include/generic-glibc/bits/endian.h | 2 +- .../include/generic-glibc/bits/environments.h | 2 +- lib/libc/include/generic-glibc/bits/epoll.h | 2 +- .../include/generic-glibc/bits/err-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/errno.h | 2 +- .../include/generic-glibc/bits/error-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/error.h | 2 +- lib/libc/include/generic-glibc/bits/eventfd.h | 2 +- .../include/generic-glibc/bits/fcntl-linux.h | 2 +- lib/libc/include/generic-glibc/bits/fcntl.h | 2 +- lib/libc/include/generic-glibc/bits/fcntl2.h | 2 +- lib/libc/include/generic-glibc/bits/fenv.h | 2 +- .../generic-glibc/bits/floatn-common.h | 2 +- lib/libc/include/generic-glibc/bits/floatn.h | 2 +- .../generic-glibc/bits/flt-eval-method.h | 2 +- lib/libc/include/generic-glibc/bits/fp-fast.h | 2 +- lib/libc/include/generic-glibc/bits/fp-logb.h | 2 +- .../include/generic-glibc/bits/getopt_core.h | 2 +- .../include/generic-glibc/bits/getopt_ext.h | 2 +- .../include/generic-glibc/bits/getopt_posix.h | 2 +- lib/libc/include/generic-glibc/bits/hwcap.h | 2 +- lib/libc/include/generic-glibc/bits/in.h | 4 +- .../generic-glibc/bits/indirect-return.h | 2 +- lib/libc/include/generic-glibc/bits/inotify.h | 2 +- .../include/generic-glibc/bits/ioctl-types.h | 2 +- lib/libc/include/generic-glibc/bits/ioctls.h | 2 +- .../include/generic-glibc/bits/ipc-perm.h | 2 +- lib/libc/include/generic-glibc/bits/ipc.h | 2 +- .../include/generic-glibc/bits/ipctypes.h | 2 +- .../include/generic-glibc/bits/iscanonical.h | 2 +- .../generic-glibc/bits/libc-header-start.h | 2 +- .../generic-glibc/bits/libm-simd-decl-stubs.h | 2 +- lib/libc/include/generic-glibc/bits/link.h | 2 +- .../include/generic-glibc/bits/local_lim.h | 2 +- lib/libc/include/generic-glibc/bits/locale.h | 2 +- .../include/generic-glibc/bits/long-double.h | 2 +- .../include/generic-glibc/bits/math-vector.h | 2 +- .../bits/mathcalls-helper-functions.h | 2 +- .../generic-glibc/bits/mathcalls-narrow.h | 2 +- .../include/generic-glibc/bits/mathcalls.h | 2 +- lib/libc/include/generic-glibc/bits/mathdef.h | 2 +- .../include/generic-glibc/bits/mman-linux.h | 2 +- .../bits/mman-map-flags-generic.h | 2 +- .../include/generic-glibc/bits/mman-shared.h | 2 +- lib/libc/include/generic-glibc/bits/mman.h | 2 +- .../generic-glibc/bits/monetary-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/mqueue.h | 2 +- lib/libc/include/generic-glibc/bits/mqueue2.h | 2 +- lib/libc/include/generic-glibc/bits/msq.h | 2 +- lib/libc/include/generic-glibc/bits/netdb.h | 2 +- lib/libc/include/generic-glibc/bits/param.h | 2 +- lib/libc/include/generic-glibc/bits/poll.h | 2 +- lib/libc/include/generic-glibc/bits/poll2.h | 20 +- .../include/generic-glibc/bits/posix1_lim.h | 2 +- .../include/generic-glibc/bits/posix2_lim.h | 2 +- .../include/generic-glibc/bits/posix_opt.h | 2 +- lib/libc/include/generic-glibc/bits/ppc.h | 2 +- .../include/generic-glibc/bits/printf-ldbl.h | 2 +- .../include/generic-glibc/bits/procfs-extra.h | 2 +- .../include/generic-glibc/bits/procfs-id.h | 2 +- .../generic-glibc/bits/procfs-prregset.h | 2 +- lib/libc/include/generic-glibc/bits/procfs.h | 2 +- .../generic-glibc/bits/pthreadtypes-arch.h | 2 +- .../include/generic-glibc/bits/pthreadtypes.h | 2 +- .../generic-glibc/bits/ptrace-shared.h | 2 +- .../include/generic-glibc/bits/resource.h | 2 +- lib/libc/include/generic-glibc/bits/sched.h | 2 +- lib/libc/include/generic-glibc/bits/select.h | 2 +- lib/libc/include/generic-glibc/bits/select2.h | 2 +- lib/libc/include/generic-glibc/bits/sem.h | 2 +- .../include/generic-glibc/bits/semaphore.h | 2 +- lib/libc/include/generic-glibc/bits/setjmp.h | 2 +- lib/libc/include/generic-glibc/bits/setjmp2.h | 2 +- lib/libc/include/generic-glibc/bits/shm.h | 2 +- lib/libc/include/generic-glibc/bits/shmlba.h | 2 +- .../include/generic-glibc/bits/sigaction.h | 2 +- .../include/generic-glibc/bits/sigcontext.h | 2 +- .../generic-glibc/bits/sigevent-consts.h | 2 +- .../generic-glibc/bits/siginfo-consts.h | 8 +- .../include/generic-glibc/bits/signal_ext.h | 2 +- .../include/generic-glibc/bits/signalfd.h | 2 +- .../include/generic-glibc/bits/signum-arch.h | 2 +- .../generic-glibc/bits/signum-generic.h | 2 +- .../include/generic-glibc/bits/sigstack.h | 2 +- .../include/generic-glibc/bits/sigthread.h | 2 +- .../include/generic-glibc/bits/sockaddr.h | 2 +- .../generic-glibc/bits/socket-constants.h | 2 +- lib/libc/include/generic-glibc/bits/socket.h | 2 +- lib/libc/include/generic-glibc/bits/socket2.h | 24 +- .../include/generic-glibc/bits/socket_type.h | 2 +- .../include/generic-glibc/bits/ss_flags.h | 2 +- lib/libc/include/generic-glibc/bits/stab.def | 2 +- lib/libc/include/generic-glibc/bits/stat.h | 209 +---------------- lib/libc/include/generic-glibc/bits/statfs.h | 2 +- lib/libc/include/generic-glibc/bits/statvfs.h | 2 +- .../generic-glibc/bits/statx-generic.h | 5 +- lib/libc/include/generic-glibc/bits/statx.h | 2 +- .../include/generic-glibc/bits/stdint-intn.h | 2 +- .../include/generic-glibc/bits/stdint-uintn.h | 2 +- .../include/generic-glibc/bits/stdio-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/stdio.h | 8 +- lib/libc/include/generic-glibc/bits/stdio2.h | 64 ++--- .../include/generic-glibc/bits/stdio_lim.h | 2 +- .../generic-glibc/bits/stdlib-bsearch.h | 2 +- .../include/generic-glibc/bits/stdlib-float.h | 2 +- .../include/generic-glibc/bits/stdlib-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/stdlib.h | 44 ++-- .../generic-glibc/bits/string_fortified.h | 53 +++-- .../generic-glibc/bits/strings_fortified.h | 8 +- .../include/generic-glibc/bits/struct_mutex.h | 2 +- .../generic-glibc/bits/struct_rwlock.h | 2 +- .../include/generic-glibc/bits/struct_stat.h | 218 ++++++++++++++++++ lib/libc/include/generic-glibc/bits/syscall.h | 16 +- .../include/generic-glibc/bits/syslog-ldbl.h | 2 +- .../include/generic-glibc/bits/syslog-path.h | 2 +- lib/libc/include/generic-glibc/bits/syslog.h | 2 +- .../include/generic-glibc/bits/sysmacros.h | 2 +- .../include/generic-glibc/bits/termios-baud.h | 2 +- .../include/generic-glibc/bits/termios-c_cc.h | 2 +- .../generic-glibc/bits/termios-c_cflag.h | 2 +- .../generic-glibc/bits/termios-c_iflag.h | 2 +- .../generic-glibc/bits/termios-c_lflag.h | 2 +- .../generic-glibc/bits/termios-c_oflag.h | 2 +- .../include/generic-glibc/bits/termios-misc.h | 2 +- .../generic-glibc/bits/termios-struct.h | 2 +- .../generic-glibc/bits/termios-tcflow.h | 2 +- lib/libc/include/generic-glibc/bits/termios.h | 2 +- .../generic-glibc/bits/thread-shared-types.h | 2 +- lib/libc/include/generic-glibc/bits/time.h | 2 +- lib/libc/include/generic-glibc/bits/time64.h | 2 +- lib/libc/include/generic-glibc/bits/timerfd.h | 2 +- .../include/generic-glibc/bits/timesize.h | 2 +- lib/libc/include/generic-glibc/bits/timex.h | 2 +- lib/libc/include/generic-glibc/bits/types.h | 2 +- .../generic-glibc/bits/types/__locale_t.h | 2 +- .../generic-glibc/bits/types/__sigval_t.h | 2 +- .../bits/types/cookie_io_functions_t.h | 2 +- .../generic-glibc/bits/types/error_t.h | 2 +- .../generic-glibc/bits/types/locale_t.h | 2 +- .../generic-glibc/bits/types/stack_t.h | 2 +- .../generic-glibc/bits/types/struct_FILE.h | 2 +- .../bits/types/struct___jmp_buf_tag.h | 37 +++ .../generic-glibc/bits/types/struct_iovec.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../generic-glibc/bits/types/struct_rusage.h | 2 +- .../bits/types/struct_sched_param.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../bits/types/struct_sigstack.h | 2 +- .../generic-glibc/bits/types/struct_statx.h | 2 +- .../bits/types/struct_statx_timestamp.h | 2 +- .../generic-glibc/bits/types/struct_timeb.h | 15 ++ .../include/generic-glibc/bits/typesizes.h | 2 +- .../generic-glibc/bits/uintn-identity.h | 2 +- lib/libc/include/generic-glibc/bits/uio-ext.h | 2 +- lib/libc/include/generic-glibc/bits/uio_lim.h | 2 +- lib/libc/include/generic-glibc/bits/unistd.h | 122 +++++----- .../include/generic-glibc/bits/unistd_ext.h | 2 +- lib/libc/include/generic-glibc/bits/utmp.h | 2 +- lib/libc/include/generic-glibc/bits/utmpx.h | 2 +- lib/libc/include/generic-glibc/bits/utsname.h | 2 +- .../include/generic-glibc/bits/waitflags.h | 2 +- .../include/generic-glibc/bits/waitstatus.h | 2 +- .../include/generic-glibc/bits/wchar-ldbl.h | 2 +- lib/libc/include/generic-glibc/bits/wchar.h | 2 +- lib/libc/include/generic-glibc/bits/wchar2.h | 148 ++++++------ .../include/generic-glibc/bits/wctype-wchar.h | 2 +- .../include/generic-glibc/bits/wordsize.h | 2 +- .../include/generic-glibc/bits/xopen_lim.h | 2 +- lib/libc/include/generic-glibc/byteswap.h | 7 +- lib/libc/include/generic-glibc/complex.h | 2 +- lib/libc/include/generic-glibc/cpio.h | 2 +- lib/libc/include/generic-glibc/crypt.h | 2 +- lib/libc/include/generic-glibc/ctype.h | 2 +- lib/libc/include/generic-glibc/dirent.h | 2 +- lib/libc/include/generic-glibc/dlfcn.h | 4 +- lib/libc/include/generic-glibc/elf.h | 58 ++--- lib/libc/include/generic-glibc/endian.h | 2 +- lib/libc/include/generic-glibc/envz.h | 2 +- lib/libc/include/generic-glibc/err.h | 2 +- lib/libc/include/generic-glibc/errno.h | 2 +- lib/libc/include/generic-glibc/error.h | 2 +- lib/libc/include/generic-glibc/execinfo.h | 2 +- lib/libc/include/generic-glibc/fcntl.h | 2 +- lib/libc/include/generic-glibc/features.h | 12 +- lib/libc/include/generic-glibc/fenv.h | 2 +- .../finclude/math-vector-fortran.h | 2 +- lib/libc/include/generic-glibc/fmtmsg.h | 2 +- lib/libc/include/generic-glibc/fnmatch.h | 2 +- lib/libc/include/generic-glibc/fpregdef.h | 2 +- lib/libc/include/generic-glibc/fpu_control.h | 2 +- lib/libc/include/generic-glibc/fts.h | 2 +- lib/libc/include/generic-glibc/ftw.h | 2 +- lib/libc/include/generic-glibc/gconv.h | 2 +- lib/libc/include/generic-glibc/getopt.h | 2 +- lib/libc/include/generic-glibc/glob.h | 2 +- lib/libc/include/generic-glibc/gnu-versions.h | 2 +- .../include/generic-glibc/gnu/libc-version.h | 2 +- lib/libc/include/generic-glibc/grp.h | 2 +- lib/libc/include/generic-glibc/gshadow.h | 2 +- lib/libc/include/generic-glibc/iconv.h | 2 +- lib/libc/include/generic-glibc/ieee754.h | 2 +- lib/libc/include/generic-glibc/ifaddrs.h | 2 +- lib/libc/include/generic-glibc/inttypes.h | 120 +--------- lib/libc/include/generic-glibc/langinfo.h | 2 +- lib/libc/include/generic-glibc/libgen.h | 2 +- lib/libc/include/generic-glibc/libintl.h | 2 +- lib/libc/include/generic-glibc/limits.h | 14 +- lib/libc/include/generic-glibc/link.h | 2 +- lib/libc/include/generic-glibc/locale.h | 2 +- lib/libc/include/generic-glibc/malloc.h | 24 +- lib/libc/include/generic-glibc/math.h | 2 +- lib/libc/include/generic-glibc/mcheck.h | 2 +- lib/libc/include/generic-glibc/memory.h | 2 +- lib/libc/include/generic-glibc/mntent.h | 2 +- lib/libc/include/generic-glibc/monetary.h | 2 +- lib/libc/include/generic-glibc/mqueue.h | 2 +- lib/libc/include/generic-glibc/net/ethernet.h | 5 +- lib/libc/include/generic-glibc/net/if.h | 2 +- lib/libc/include/generic-glibc/net/if_arp.h | 2 +- .../include/generic-glibc/net/if_packet.h | 2 +- .../include/generic-glibc/net/if_shaper.h | 2 +- lib/libc/include/generic-glibc/net/if_slip.h | 2 +- lib/libc/include/generic-glibc/net/route.h | 2 +- lib/libc/include/generic-glibc/netash/ash.h | 2 +- lib/libc/include/generic-glibc/netatalk/at.h | 2 +- lib/libc/include/generic-glibc/netax25/ax25.h | 2 +- lib/libc/include/generic-glibc/netdb.h | 2 +- lib/libc/include/generic-glibc/neteconet/ec.h | 2 +- .../include/generic-glibc/netinet/ether.h | 2 +- .../include/generic-glibc/netinet/icmp6.h | 2 +- .../include/generic-glibc/netinet/if_ether.h | 2 +- .../include/generic-glibc/netinet/if_fddi.h | 2 +- .../include/generic-glibc/netinet/if_tr.h | 2 +- lib/libc/include/generic-glibc/netinet/igmp.h | 2 +- lib/libc/include/generic-glibc/netinet/in.h | 2 +- .../include/generic-glibc/netinet/in_systm.h | 2 +- lib/libc/include/generic-glibc/netinet/ip.h | 2 +- lib/libc/include/generic-glibc/netinet/ip6.h | 2 +- .../include/generic-glibc/netinet/ip_icmp.h | 2 +- lib/libc/include/generic-glibc/netinet/udp.h | 2 +- lib/libc/include/generic-glibc/netipx/ipx.h | 2 +- lib/libc/include/generic-glibc/netiucv/iucv.h | 2 +- .../include/generic-glibc/netpacket/packet.h | 2 +- .../include/generic-glibc/netrom/netrom.h | 2 +- lib/libc/include/generic-glibc/netrose/rose.h | 2 +- lib/libc/include/generic-glibc/nl_types.h | 2 +- lib/libc/include/generic-glibc/nss.h | 2 +- lib/libc/include/generic-glibc/obstack.h | 2 +- lib/libc/include/generic-glibc/printf.h | 2 +- lib/libc/include/generic-glibc/proc_service.h | 2 +- lib/libc/include/generic-glibc/pthread.h | 44 ++-- lib/libc/include/generic-glibc/pty.h | 2 +- lib/libc/include/generic-glibc/pwd.h | 2 +- lib/libc/include/generic-glibc/re_comp.h | 2 +- lib/libc/include/generic-glibc/regdef.h | 2 +- lib/libc/include/generic-glibc/regex.h | 21 +- lib/libc/include/generic-glibc/regexp.h | 2 +- lib/libc/include/generic-glibc/sched.h | 2 +- lib/libc/include/generic-glibc/scsi/scsi.h | 2 +- .../include/generic-glibc/scsi/scsi_ioctl.h | 2 +- lib/libc/include/generic-glibc/scsi/sg.h | 2 +- lib/libc/include/generic-glibc/search.h | 2 +- lib/libc/include/generic-glibc/semaphore.h | 2 +- lib/libc/include/generic-glibc/setjmp.h | 17 +- lib/libc/include/generic-glibc/sgidefs.h | 2 +- lib/libc/include/generic-glibc/sgtty.h | 2 +- lib/libc/include/generic-glibc/shadow.h | 2 +- lib/libc/include/generic-glibc/signal.h | 2 +- lib/libc/include/generic-glibc/spawn.h | 2 +- lib/libc/include/generic-glibc/stdc-predef.h | 2 +- lib/libc/include/generic-glibc/stdint.h | 2 +- lib/libc/include/generic-glibc/stdio.h | 2 +- lib/libc/include/generic-glibc/stdio_ext.h | 2 +- lib/libc/include/generic-glibc/stdlib.h | 2 +- lib/libc/include/generic-glibc/string.h | 2 +- lib/libc/include/generic-glibc/strings.h | 2 +- lib/libc/include/generic-glibc/sys/acct.h | 2 +- lib/libc/include/generic-glibc/sys/asm.h | 2 +- lib/libc/include/generic-glibc/sys/auxv.h | 2 +- lib/libc/include/generic-glibc/sys/cachectl.h | 2 +- lib/libc/include/generic-glibc/sys/cdefs.h | 38 ++- lib/libc/include/generic-glibc/sys/debugreg.h | 2 +- lib/libc/include/generic-glibc/sys/dir.h | 2 +- lib/libc/include/generic-glibc/sys/elf.h | 2 +- lib/libc/include/generic-glibc/sys/epoll.h | 2 +- lib/libc/include/generic-glibc/sys/eventfd.h | 2 +- lib/libc/include/generic-glibc/sys/fanotify.h | 2 +- lib/libc/include/generic-glibc/sys/file.h | 2 +- lib/libc/include/generic-glibc/sys/fpregdef.h | 2 +- lib/libc/include/generic-glibc/sys/fsuid.h | 2 +- lib/libc/include/generic-glibc/sys/gmon_out.h | 2 +- lib/libc/include/generic-glibc/sys/ifunc.h | 2 +- lib/libc/include/generic-glibc/sys/inotify.h | 2 +- lib/libc/include/generic-glibc/sys/io.h | 2 +- lib/libc/include/generic-glibc/sys/ioctl.h | 2 +- lib/libc/include/generic-glibc/sys/ipc.h | 2 +- lib/libc/include/generic-glibc/sys/kd.h | 2 +- lib/libc/include/generic-glibc/sys/klog.h | 2 +- lib/libc/include/generic-glibc/sys/mman.h | 2 +- lib/libc/include/generic-glibc/sys/mount.h | 2 +- lib/libc/include/generic-glibc/sys/msg.h | 2 +- lib/libc/include/generic-glibc/sys/mtio.h | 2 +- lib/libc/include/generic-glibc/sys/param.h | 2 +- lib/libc/include/generic-glibc/sys/pci.h | 2 +- lib/libc/include/generic-glibc/sys/perm.h | 2 +- .../include/generic-glibc/sys/personality.h | 2 +- .../include/generic-glibc/sys/platform/ppc.h | 2 +- .../include/generic-glibc/sys/platform/x86.h | 65 ++++++ lib/libc/include/generic-glibc/sys/poll.h | 2 +- lib/libc/include/generic-glibc/sys/prctl.h | 20 +- lib/libc/include/generic-glibc/sys/procfs.h | 2 +- lib/libc/include/generic-glibc/sys/profil.h | 2 +- lib/libc/include/generic-glibc/sys/ptrace.h | 2 +- lib/libc/include/generic-glibc/sys/quota.h | 2 +- lib/libc/include/generic-glibc/sys/random.h | 2 +- lib/libc/include/generic-glibc/sys/raw.h | 2 +- lib/libc/include/generic-glibc/sys/reboot.h | 2 +- lib/libc/include/generic-glibc/sys/reg.h | 2 +- lib/libc/include/generic-glibc/sys/regdef.h | 2 +- lib/libc/include/generic-glibc/sys/resource.h | 2 +- lib/libc/include/generic-glibc/sys/select.h | 2 +- lib/libc/include/generic-glibc/sys/sem.h | 2 +- lib/libc/include/generic-glibc/sys/sendfile.h | 2 +- lib/libc/include/generic-glibc/sys/shm.h | 2 +- lib/libc/include/generic-glibc/sys/signalfd.h | 2 +- .../generic-glibc/sys/single_threaded.h | 2 +- lib/libc/include/generic-glibc/sys/socket.h | 2 +- lib/libc/include/generic-glibc/sys/stat.h | 161 +------------ lib/libc/include/generic-glibc/sys/statfs.h | 2 +- lib/libc/include/generic-glibc/sys/statvfs.h | 2 +- lib/libc/include/generic-glibc/sys/swap.h | 2 +- lib/libc/include/generic-glibc/sys/syscall.h | 2 +- lib/libc/include/generic-glibc/sys/sysinfo.h | 2 +- .../include/generic-glibc/sys/sysmacros.h | 2 +- lib/libc/include/generic-glibc/sys/sysmips.h | 2 +- lib/libc/include/generic-glibc/sys/tas.h | 2 +- lib/libc/include/generic-glibc/sys/time.h | 2 +- lib/libc/include/generic-glibc/sys/timeb.h | 17 +- lib/libc/include/generic-glibc/sys/timerfd.h | 2 +- lib/libc/include/generic-glibc/sys/times.h | 2 +- lib/libc/include/generic-glibc/sys/timex.h | 2 +- lib/libc/include/generic-glibc/sys/types.h | 2 +- lib/libc/include/generic-glibc/sys/ucontext.h | 2 +- lib/libc/include/generic-glibc/sys/uio.h | 2 +- lib/libc/include/generic-glibc/sys/un.h | 2 +- lib/libc/include/generic-glibc/sys/user.h | 2 +- lib/libc/include/generic-glibc/sys/utsname.h | 2 +- lib/libc/include/generic-glibc/sys/vlimit.h | 2 +- lib/libc/include/generic-glibc/sys/vm86.h | 2 +- lib/libc/include/generic-glibc/sys/vtimes.h | 68 ------ lib/libc/include/generic-glibc/sys/wait.h | 2 +- lib/libc/include/generic-glibc/sys/xattr.h | 2 +- lib/libc/include/generic-glibc/tar.h | 2 +- lib/libc/include/generic-glibc/termios.h | 2 +- lib/libc/include/generic-glibc/tgmath.h | 2 +- lib/libc/include/generic-glibc/thread_db.h | 2 +- lib/libc/include/generic-glibc/threads.h | 2 +- lib/libc/include/generic-glibc/time.h | 2 +- lib/libc/include/generic-glibc/uchar.h | 2 +- lib/libc/include/generic-glibc/ucontext.h | 2 +- lib/libc/include/generic-glibc/ulimit.h | 2 +- lib/libc/include/generic-glibc/unistd.h | 4 +- lib/libc/include/generic-glibc/utime.h | 2 +- lib/libc/include/generic-glibc/utmp.h | 2 +- lib/libc/include/generic-glibc/utmpx.h | 2 +- lib/libc/include/generic-glibc/values.h | 2 +- lib/libc/include/generic-glibc/wchar.h | 2 +- lib/libc/include/generic-glibc/wctype.h | 2 +- lib/libc/include/generic-glibc/wordexp.h | 2 +- .../i386-linux-gnu/bits/environments.h | 2 +- lib/libc/include/i386-linux-gnu/bits/epoll.h | 2 +- lib/libc/include/i386-linux-gnu/bits/fcntl.h | 2 +- lib/libc/include/i386-linux-gnu/bits/fenv.h | 2 +- lib/libc/include/i386-linux-gnu/bits/floatn.h | 2 +- .../i386-linux-gnu/bits/flt-eval-method.h | 2 +- .../include/i386-linux-gnu/bits/fp-logb.h | 2 +- .../i386-linux-gnu/bits/indirect-return.h | 2 +- .../include/i386-linux-gnu/bits/ipctypes.h | 2 +- .../include/i386-linux-gnu/bits/iscanonical.h | 2 +- lib/libc/include/i386-linux-gnu/bits/link.h | 2 +- .../include/i386-linux-gnu/bits/long-double.h | 2 +- .../include/i386-linux-gnu/bits/math-vector.h | 2 +- lib/libc/include/i386-linux-gnu/bits/mman.h | 2 +- .../include/i386-linux-gnu/bits/procfs-id.h | 2 +- lib/libc/include/i386-linux-gnu/bits/procfs.h | 2 +- .../i386-linux-gnu/bits/pthreadtypes-arch.h | 2 +- lib/libc/include/i386-linux-gnu/bits/setjmp.h | 2 +- .../include/i386-linux-gnu/bits/sigcontext.h | 2 +- .../i386-linux-gnu/bits/struct_mutex.h | 2 +- .../i386-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 67 +----- .../include/i386-linux-gnu/bits/timesize.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../include/i386-linux-gnu/bits/typesizes.h | 2 +- .../finclude/math-vector-fortran.h | 2 +- lib/libc/include/i386-linux-gnu/fpu_control.h | 2 +- lib/libc/include/i386-linux-gnu/sys/elf.h | 2 +- lib/libc/include/i386-linux-gnu/sys/ptrace.h | 2 +- .../include/i386-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/i386-linux-gnu/sys/user.h | 2 +- lib/libc/include/mips-linux-gnu/bits/dlfcn.h | 2 +- lib/libc/include/mips-linux-gnu/bits/errno.h | 2 +- .../include/mips-linux-gnu/bits/eventfd.h | 2 +- lib/libc/include/mips-linux-gnu/bits/floatn.h | 2 +- .../include/mips-linux-gnu/bits/inotify.h | 2 +- .../include/mips-linux-gnu/bits/ioctl-types.h | 2 +- .../include/mips-linux-gnu/bits/ipctypes.h | 2 +- .../include/mips-linux-gnu/bits/local_lim.h | 2 +- lib/libc/include/mips-linux-gnu/bits/mman.h | 2 +- lib/libc/include/mips-linux-gnu/bits/poll.h | 2 +- .../mips-linux-gnu/bits/pthreadtypes-arch.h | 2 +- .../include/mips-linux-gnu/bits/resource.h | 2 +- .../include/mips-linux-gnu/bits/semaphore.h | 2 +- lib/libc/include/mips-linux-gnu/bits/shmlba.h | 2 +- .../include/mips-linux-gnu/bits/sigaction.h | 2 +- .../include/mips-linux-gnu/bits/sigcontext.h | 2 +- .../include/mips-linux-gnu/bits/signalfd.h | 2 +- .../include/mips-linux-gnu/bits/signum-arch.h | 2 +- .../mips-linux-gnu/bits/socket-constants.h | 2 +- .../include/mips-linux-gnu/bits/socket_type.h | 2 +- lib/libc/include/mips-linux-gnu/bits/statfs.h | 2 +- .../mips-linux-gnu/bits/struct_mutex.h | 2 +- .../mips-linux-gnu/bits/termios-c_cc.h | 2 +- .../mips-linux-gnu/bits/termios-c_lflag.h | 2 +- .../mips-linux-gnu/bits/termios-struct.h | 2 +- .../mips-linux-gnu/bits/termios-tcflow.h | 2 +- .../include/mips-linux-gnu/bits/timerfd.h | 2 +- .../mips-linux-gnu/bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- lib/libc/include/mips-linux-gnu/ieee754.h | 2 +- .../mips64-linux-gnuabi64/bits/dlfcn.h | 2 +- .../mips64-linux-gnuabi64/bits/errno.h | 2 +- .../mips64-linux-gnuabi64/bits/eventfd.h | 2 +- .../mips64-linux-gnuabi64/bits/floatn.h | 2 +- .../mips64-linux-gnuabi64/bits/inotify.h | 2 +- .../mips64-linux-gnuabi64/bits/ioctl-types.h | 2 +- .../mips64-linux-gnuabi64/bits/ipctypes.h | 2 +- .../mips64-linux-gnuabi64/bits/local_lim.h | 2 +- .../include/mips64-linux-gnuabi64/bits/mman.h | 2 +- .../include/mips64-linux-gnuabi64/bits/poll.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../mips64-linux-gnuabi64/bits/resource.h | 2 +- .../mips64-linux-gnuabi64/bits/semaphore.h | 2 +- .../mips64-linux-gnuabi64/bits/shmlba.h | 2 +- .../mips64-linux-gnuabi64/bits/sigaction.h | 2 +- .../mips64-linux-gnuabi64/bits/sigcontext.h | 2 +- .../mips64-linux-gnuabi64/bits/signalfd.h | 2 +- .../mips64-linux-gnuabi64/bits/signum-arch.h | 2 +- .../bits/socket-constants.h | 2 +- .../mips64-linux-gnuabi64/bits/socket_type.h | 2 +- .../mips64-linux-gnuabi64/bits/statfs.h | 2 +- .../mips64-linux-gnuabi64/bits/struct_mutex.h | 2 +- .../mips64-linux-gnuabi64/bits/termios-c_cc.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-struct.h | 2 +- .../bits/termios-tcflow.h | 2 +- .../mips64-linux-gnuabi64/bits/timerfd.h | 2 +- .../bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/mips64-linux-gnuabi64/ieee754.h | 2 +- .../mips64-linux-gnuabin32/bits/dlfcn.h | 2 +- .../mips64-linux-gnuabin32/bits/errno.h | 2 +- .../mips64-linux-gnuabin32/bits/eventfd.h | 2 +- .../mips64-linux-gnuabin32/bits/floatn.h | 2 +- .../mips64-linux-gnuabin32/bits/inotify.h | 2 +- .../mips64-linux-gnuabin32/bits/ioctl-types.h | 2 +- .../mips64-linux-gnuabin32/bits/ipctypes.h | 2 +- .../mips64-linux-gnuabin32/bits/local_lim.h | 2 +- .../mips64-linux-gnuabin32/bits/mman.h | 2 +- .../mips64-linux-gnuabin32/bits/poll.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../mips64-linux-gnuabin32/bits/resource.h | 2 +- .../mips64-linux-gnuabin32/bits/semaphore.h | 2 +- .../mips64-linux-gnuabin32/bits/shmlba.h | 2 +- .../mips64-linux-gnuabin32/bits/sigaction.h | 2 +- .../mips64-linux-gnuabin32/bits/sigcontext.h | 2 +- .../mips64-linux-gnuabin32/bits/signalfd.h | 2 +- .../mips64-linux-gnuabin32/bits/signum-arch.h | 2 +- .../bits/socket-constants.h | 2 +- .../mips64-linux-gnuabin32/bits/socket_type.h | 2 +- .../mips64-linux-gnuabin32/bits/statfs.h | 2 +- .../bits/struct_mutex.h | 2 +- .../bits/termios-c_cc.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-struct.h | 2 +- .../bits/termios-tcflow.h | 2 +- .../mips64-linux-gnuabin32/bits/timerfd.h | 2 +- .../bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/mips64-linux-gnuabin32/ieee754.h | 2 +- .../mips64el-linux-gnuabi64/bits/dlfcn.h | 2 +- .../mips64el-linux-gnuabi64/bits/errno.h | 2 +- .../mips64el-linux-gnuabi64/bits/eventfd.h | 2 +- .../mips64el-linux-gnuabi64/bits/floatn.h | 2 +- .../mips64el-linux-gnuabi64/bits/inotify.h | 2 +- .../bits/ioctl-types.h | 2 +- .../mips64el-linux-gnuabi64/bits/ipctypes.h | 2 +- .../mips64el-linux-gnuabi64/bits/local_lim.h | 2 +- .../mips64el-linux-gnuabi64/bits/mman.h | 2 +- .../mips64el-linux-gnuabi64/bits/poll.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../mips64el-linux-gnuabi64/bits/resource.h | 2 +- .../mips64el-linux-gnuabi64/bits/semaphore.h | 2 +- .../mips64el-linux-gnuabi64/bits/shmlba.h | 2 +- .../mips64el-linux-gnuabi64/bits/sigaction.h | 2 +- .../mips64el-linux-gnuabi64/bits/sigcontext.h | 2 +- .../mips64el-linux-gnuabi64/bits/signalfd.h | 2 +- .../bits/signum-arch.h | 2 +- .../bits/socket-constants.h | 2 +- .../bits/socket_type.h | 2 +- .../mips64el-linux-gnuabi64/bits/statfs.h | 2 +- .../bits/struct_mutex.h | 2 +- .../bits/termios-c_cc.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-struct.h | 2 +- .../bits/termios-tcflow.h | 2 +- .../mips64el-linux-gnuabi64/bits/timerfd.h | 2 +- .../bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/mips64el-linux-gnuabi64/ieee754.h | 2 +- .../mips64el-linux-gnuabin32/bits/dlfcn.h | 2 +- .../mips64el-linux-gnuabin32/bits/errno.h | 2 +- .../mips64el-linux-gnuabin32/bits/eventfd.h | 2 +- .../mips64el-linux-gnuabin32/bits/floatn.h | 2 +- .../mips64el-linux-gnuabin32/bits/inotify.h | 2 +- .../bits/ioctl-types.h | 2 +- .../mips64el-linux-gnuabin32/bits/ipctypes.h | 2 +- .../mips64el-linux-gnuabin32/bits/local_lim.h | 2 +- .../mips64el-linux-gnuabin32/bits/mman.h | 2 +- .../mips64el-linux-gnuabin32/bits/poll.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../mips64el-linux-gnuabin32/bits/resource.h | 2 +- .../mips64el-linux-gnuabin32/bits/semaphore.h | 2 +- .../mips64el-linux-gnuabin32/bits/shmlba.h | 2 +- .../mips64el-linux-gnuabin32/bits/sigaction.h | 2 +- .../bits/sigcontext.h | 2 +- .../mips64el-linux-gnuabin32/bits/signalfd.h | 2 +- .../bits/signum-arch.h | 2 +- .../bits/socket-constants.h | 2 +- .../bits/socket_type.h | 2 +- .../mips64el-linux-gnuabin32/bits/statfs.h | 2 +- .../bits/struct_mutex.h | 2 +- .../bits/termios-c_cc.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-struct.h | 2 +- .../bits/termios-tcflow.h | 2 +- .../mips64el-linux-gnuabin32/bits/timerfd.h | 2 +- .../bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../mips64el-linux-gnuabin32/ieee754.h | 2 +- .../include/mipsel-linux-gnu/bits/dlfcn.h | 2 +- .../include/mipsel-linux-gnu/bits/errno.h | 2 +- .../include/mipsel-linux-gnu/bits/eventfd.h | 2 +- .../include/mipsel-linux-gnu/bits/floatn.h | 2 +- .../include/mipsel-linux-gnu/bits/inotify.h | 2 +- .../mipsel-linux-gnu/bits/ioctl-types.h | 2 +- .../include/mipsel-linux-gnu/bits/ipctypes.h | 2 +- .../include/mipsel-linux-gnu/bits/local_lim.h | 2 +- lib/libc/include/mipsel-linux-gnu/bits/mman.h | 2 +- lib/libc/include/mipsel-linux-gnu/bits/poll.h | 2 +- .../mipsel-linux-gnu/bits/pthreadtypes-arch.h | 2 +- .../include/mipsel-linux-gnu/bits/resource.h | 2 +- .../include/mipsel-linux-gnu/bits/semaphore.h | 2 +- .../include/mipsel-linux-gnu/bits/shmlba.h | 2 +- .../include/mipsel-linux-gnu/bits/sigaction.h | 2 +- .../mipsel-linux-gnu/bits/sigcontext.h | 2 +- .../include/mipsel-linux-gnu/bits/signalfd.h | 2 +- .../mipsel-linux-gnu/bits/signum-arch.h | 2 +- .../mipsel-linux-gnu/bits/socket-constants.h | 2 +- .../mipsel-linux-gnu/bits/socket_type.h | 2 +- .../include/mipsel-linux-gnu/bits/statfs.h | 2 +- .../mipsel-linux-gnu/bits/struct_mutex.h | 2 +- .../mipsel-linux-gnu/bits/termios-c_cc.h | 2 +- .../mipsel-linux-gnu/bits/termios-c_lflag.h | 2 +- .../mipsel-linux-gnu/bits/termios-struct.h | 2 +- .../mipsel-linux-gnu/bits/termios-tcflow.h | 2 +- .../include/mipsel-linux-gnu/bits/timerfd.h | 2 +- .../mipsel-linux-gnu/bits/types/stack_t.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- lib/libc/include/mipsel-linux-gnu/ieee754.h | 2 +- .../powerpc-linux-gnu/bits/environments.h | 2 +- .../include/powerpc-linux-gnu/bits/fcntl.h | 2 +- .../include/powerpc-linux-gnu/bits/fenv.h | 2 +- .../include/powerpc-linux-gnu/bits/floatn.h | 2 +- .../include/powerpc-linux-gnu/bits/fp-fast.h | 2 +- .../include/powerpc-linux-gnu/bits/hwcap.h | 2 +- .../powerpc-linux-gnu/bits/ioctl-types.h | 2 +- .../include/powerpc-linux-gnu/bits/ipc-perm.h | 2 +- .../powerpc-linux-gnu/bits/iscanonical.h | 2 +- .../include/powerpc-linux-gnu/bits/link.h | 2 +- .../powerpc-linux-gnu/bits/local_lim.h | 2 +- .../powerpc-linux-gnu/bits/long-double.h | 2 +- .../include/powerpc-linux-gnu/bits/mman.h | 2 +- .../include/powerpc-linux-gnu/bits/procfs.h | 2 +- .../include/powerpc-linux-gnu/bits/setjmp.h | 2 +- .../include/powerpc-linux-gnu/bits/sigstack.h | 2 +- .../powerpc-linux-gnu/bits/socket-constants.h | 2 +- .../powerpc-linux-gnu/bits/struct_mutex.h | 2 +- .../powerpc-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 64 +---- .../powerpc-linux-gnu/bits/termios-baud.h | 2 +- .../powerpc-linux-gnu/bits/termios-c_cc.h | 2 +- .../powerpc-linux-gnu/bits/termios-c_cflag.h | 2 +- .../powerpc-linux-gnu/bits/termios-c_iflag.h | 2 +- .../powerpc-linux-gnu/bits/termios-c_lflag.h | 2 +- .../powerpc-linux-gnu/bits/termios-c_oflag.h | 2 +- .../powerpc-linux-gnu/bits/termios-misc.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/powerpc-linux-gnu/fpu_control.h | 2 +- lib/libc/include/powerpc-linux-gnu/ieee754.h | 2 +- .../include/powerpc-linux-gnu/sys/ptrace.h | 2 +- .../include/powerpc-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/powerpc-linux-gnu/sys/user.h | 2 +- .../powerpc64-linux-gnu/bits/environments.h | 2 +- .../include/powerpc64-linux-gnu/bits/fcntl.h | 2 +- .../include/powerpc64-linux-gnu/bits/fenv.h | 2 +- .../include/powerpc64-linux-gnu/bits/floatn.h | 2 +- .../powerpc64-linux-gnu/bits/fp-fast.h | 2 +- .../include/powerpc64-linux-gnu/bits/hwcap.h | 2 +- .../powerpc64-linux-gnu/bits/ioctl-types.h | 2 +- .../powerpc64-linux-gnu/bits/ipc-perm.h | 2 +- .../powerpc64-linux-gnu/bits/iscanonical.h | 2 +- .../include/powerpc64-linux-gnu/bits/link.h | 2 +- .../powerpc64-linux-gnu/bits/local_lim.h | 2 +- .../powerpc64-linux-gnu/bits/long-double.h | 2 +- .../include/powerpc64-linux-gnu/bits/mman.h | 2 +- .../include/powerpc64-linux-gnu/bits/procfs.h | 2 +- .../include/powerpc64-linux-gnu/bits/setjmp.h | 2 +- .../powerpc64-linux-gnu/bits/sigstack.h | 2 +- .../bits/socket-constants.h | 2 +- .../powerpc64-linux-gnu/bits/struct_mutex.h | 2 +- .../powerpc64-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 64 +---- .../powerpc64-linux-gnu/bits/termios-baud.h | 2 +- .../powerpc64-linux-gnu/bits/termios-c_cc.h | 2 +- .../bits/termios-c_cflag.h | 2 +- .../bits/termios-c_iflag.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-c_oflag.h | 2 +- .../powerpc64-linux-gnu/bits/termios-misc.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/powerpc64-linux-gnu/fpu_control.h | 2 +- .../include/powerpc64-linux-gnu/ieee754.h | 2 +- .../include/powerpc64-linux-gnu/sys/ptrace.h | 2 +- .../powerpc64-linux-gnu/sys/ucontext.h | 2 +- .../include/powerpc64-linux-gnu/sys/user.h | 2 +- .../powerpc64le-linux-gnu/bits/environments.h | 2 +- .../powerpc64le-linux-gnu/bits/fcntl.h | 2 +- .../include/powerpc64le-linux-gnu/bits/fenv.h | 2 +- .../powerpc64le-linux-gnu/bits/floatn.h | 2 +- .../powerpc64le-linux-gnu/bits/fp-fast.h | 2 +- .../powerpc64le-linux-gnu/bits/hwcap.h | 2 +- .../powerpc64le-linux-gnu/bits/ioctl-types.h | 2 +- .../powerpc64le-linux-gnu/bits/ipc-perm.h | 2 +- .../powerpc64le-linux-gnu/bits/iscanonical.h | 2 +- .../include/powerpc64le-linux-gnu/bits/link.h | 2 +- .../powerpc64le-linux-gnu/bits/local_lim.h | 2 +- .../powerpc64le-linux-gnu/bits/long-double.h | 2 +- .../include/powerpc64le-linux-gnu/bits/mman.h | 2 +- .../powerpc64le-linux-gnu/bits/procfs.h | 2 +- .../powerpc64le-linux-gnu/bits/setjmp.h | 2 +- .../powerpc64le-linux-gnu/bits/sigstack.h | 2 +- .../bits/socket-constants.h | 2 +- .../powerpc64le-linux-gnu/bits/struct_mutex.h | 2 +- .../bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 64 +---- .../powerpc64le-linux-gnu/bits/termios-baud.h | 2 +- .../powerpc64le-linux-gnu/bits/termios-c_cc.h | 2 +- .../bits/termios-c_cflag.h | 2 +- .../bits/termios-c_iflag.h | 2 +- .../bits/termios-c_lflag.h | 2 +- .../bits/termios-c_oflag.h | 2 +- .../powerpc64le-linux-gnu/bits/termios-misc.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../powerpc64le-linux-gnu/fpu_control.h | 2 +- .../include/powerpc64le-linux-gnu/ieee754.h | 2 +- .../powerpc64le-linux-gnu/sys/ptrace.h | 2 +- .../powerpc64le-linux-gnu/sys/ucontext.h | 2 +- .../include/powerpc64le-linux-gnu/sys/user.h | 2 +- .../riscv64-linux-gnu/bits/environments.h | 81 +++++++ .../include/riscv64-linux-gnu/bits/fcntl.h | 2 +- .../include/riscv64-linux-gnu/bits/fenv.h | 2 +- .../include/riscv64-linux-gnu/bits/link.h | 2 +- .../riscv64-linux-gnu/bits/long-double.h | 2 +- .../include/riscv64-linux-gnu/bits/procfs.h | 2 +- .../bits/pthreadtypes-arch.h | 28 ++- .../include/riscv64-linux-gnu/bits/setjmp.h | 2 +- .../riscv64-linux-gnu/bits/sigcontext.h | 2 +- .../include/riscv64-linux-gnu/bits/statfs.h | 2 +- .../riscv64-linux-gnu/bits/struct_rwlock.h | 29 ++- .../riscv64-linux-gnu/bits/struct_stat.h | 127 ++++++++++ .../include/riscv64-linux-gnu/bits/time64.h | 36 +++ .../bits/timesize.h} | 12 +- .../riscv64-linux-gnu/bits/typesizes.h | 2 +- .../include/riscv64-linux-gnu/bits/wordsize.h | 11 +- .../include/riscv64-linux-gnu/fpu_control.h | 2 +- .../include/riscv64-linux-gnu/gnu/lib-names.h | 10 +- .../include/riscv64-linux-gnu/gnu/stubs.h | 10 +- lib/libc/include/riscv64-linux-gnu/ieee754.h | 2 +- lib/libc/include/riscv64-linux-gnu/sys/asm.h | 9 +- .../include/riscv64-linux-gnu/sys/cachectl.h | 2 +- .../include/riscv64-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/riscv64-linux-gnu/sys/user.h | 2 +- .../include/s390x-linux-gnu/bits/elfclass.h | 2 +- .../s390x-linux-gnu/bits/environments.h | 2 +- lib/libc/include/s390x-linux-gnu/bits/fcntl.h | 2 +- lib/libc/include/s390x-linux-gnu/bits/fenv.h | 2 +- lib/libc/include/s390x-linux-gnu/bits/hwcap.h | 5 +- lib/libc/include/s390x-linux-gnu/bits/link.h | 2 +- .../s390x-linux-gnu/bits/long-double.h | 2 +- .../s390x-linux-gnu/bits/procfs-extra.h | 2 +- .../include/s390x-linux-gnu/bits/procfs-id.h | 2 +- .../include/s390x-linux-gnu/bits/procfs.h | 2 +- .../include/s390x-linux-gnu/bits/setjmp.h | 2 +- .../include/s390x-linux-gnu/bits/sigaction.h | 2 +- .../include/s390x-linux-gnu/bits/statfs.h | 2 +- .../s390x-linux-gnu/bits/struct_mutex.h | 2 +- .../s390x-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 68 +----- .../include/s390x-linux-gnu/bits/typesizes.h | 2 +- lib/libc/include/s390x-linux-gnu/bits/utmp.h | 2 +- lib/libc/include/s390x-linux-gnu/bits/utmpx.h | 2 +- .../include/s390x-linux-gnu/fpu_control.h | 2 +- lib/libc/include/s390x-linux-gnu/ieee754.h | 2 +- lib/libc/include/s390x-linux-gnu/sys/elf.h | 2 +- lib/libc/include/s390x-linux-gnu/sys/ptrace.h | 2 +- .../include/s390x-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/s390x-linux-gnu/sys/user.h | 2 +- .../sparc-linux-gnu/bits/environments.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/epoll.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/errno.h | 2 +- .../include/sparc-linux-gnu/bits/eventfd.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/fcntl.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/fenv.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/hwcap.h | 2 +- .../include/sparc-linux-gnu/bits/inotify.h | 2 +- .../include/sparc-linux-gnu/bits/ioctls.h | 2 +- .../include/sparc-linux-gnu/bits/ipc-perm.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/link.h | 2 +- .../include/sparc-linux-gnu/bits/local_lim.h | 2 +- .../sparc-linux-gnu/bits/long-double.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/mman.h | 2 +- lib/libc/include/sparc-linux-gnu/bits/poll.h | 2 +- .../sparc-linux-gnu/bits/procfs-extra.h | 2 +- .../include/sparc-linux-gnu/bits/procfs-id.h | 2 +- .../include/sparc-linux-gnu/bits/procfs.h | 2 +- .../include/sparc-linux-gnu/bits/resource.h | 2 +- .../include/sparc-linux-gnu/bits/setjmp.h | 2 +- .../include/sparc-linux-gnu/bits/shmlba.h | 2 +- .../include/sparc-linux-gnu/bits/sigaction.h | 2 +- .../include/sparc-linux-gnu/bits/sigcontext.h | 2 +- .../include/sparc-linux-gnu/bits/signalfd.h | 2 +- .../sparc-linux-gnu/bits/signum-arch.h | 2 +- .../include/sparc-linux-gnu/bits/sigstack.h | 2 +- .../sparc-linux-gnu/bits/socket-constants.h | 2 +- .../sparc-linux-gnu/bits/socket_type.h | 2 +- .../sparc-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 60 +---- .../sparc-linux-gnu/bits/termios-baud.h | 2 +- .../sparc-linux-gnu/bits/termios-c_cc.h | 2 +- .../sparc-linux-gnu/bits/termios-c_oflag.h | 2 +- .../sparc-linux-gnu/bits/termios-struct.h | 2 +- .../include/sparc-linux-gnu/bits/timerfd.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../include/sparc-linux-gnu/bits/typesizes.h | 2 +- .../include/sparc-linux-gnu/fpu_control.h | 2 +- lib/libc/include/sparc-linux-gnu/ieee754.h | 2 +- lib/libc/include/sparc-linux-gnu/sys/ptrace.h | 2 +- .../include/sparc-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/sparc-linux-gnu/sys/user.h | 2 +- .../sparcv9-linux-gnu/bits/environments.h | 2 +- .../include/sparcv9-linux-gnu/bits/epoll.h | 2 +- .../include/sparcv9-linux-gnu/bits/errno.h | 2 +- .../include/sparcv9-linux-gnu/bits/eventfd.h | 2 +- .../include/sparcv9-linux-gnu/bits/fcntl.h | 2 +- .../include/sparcv9-linux-gnu/bits/fenv.h | 2 +- .../include/sparcv9-linux-gnu/bits/hwcap.h | 2 +- .../include/sparcv9-linux-gnu/bits/inotify.h | 2 +- .../include/sparcv9-linux-gnu/bits/ioctls.h | 2 +- .../include/sparcv9-linux-gnu/bits/ipc-perm.h | 2 +- .../include/sparcv9-linux-gnu/bits/link.h | 2 +- .../sparcv9-linux-gnu/bits/local_lim.h | 2 +- .../sparcv9-linux-gnu/bits/long-double.h | 2 +- .../include/sparcv9-linux-gnu/bits/mman.h | 2 +- .../include/sparcv9-linux-gnu/bits/poll.h | 2 +- .../sparcv9-linux-gnu/bits/procfs-extra.h | 2 +- .../sparcv9-linux-gnu/bits/procfs-id.h | 2 +- .../include/sparcv9-linux-gnu/bits/procfs.h | 2 +- .../include/sparcv9-linux-gnu/bits/resource.h | 2 +- .../include/sparcv9-linux-gnu/bits/setjmp.h | 2 +- .../include/sparcv9-linux-gnu/bits/shmlba.h | 2 +- .../sparcv9-linux-gnu/bits/sigaction.h | 2 +- .../sparcv9-linux-gnu/bits/sigcontext.h | 2 +- .../include/sparcv9-linux-gnu/bits/signalfd.h | 2 +- .../sparcv9-linux-gnu/bits/signum-arch.h | 2 +- .../include/sparcv9-linux-gnu/bits/sigstack.h | 2 +- .../sparcv9-linux-gnu/bits/socket-constants.h | 2 +- .../sparcv9-linux-gnu/bits/socket_type.h | 2 +- .../sparcv9-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 60 +---- .../sparcv9-linux-gnu/bits/termios-baud.h | 2 +- .../sparcv9-linux-gnu/bits/termios-c_cc.h | 2 +- .../sparcv9-linux-gnu/bits/termios-c_oflag.h | 2 +- .../sparcv9-linux-gnu/bits/termios-struct.h | 2 +- .../include/sparcv9-linux-gnu/bits/timerfd.h | 2 +- .../bits/types/struct_msqid_ds.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../bits/types/struct_shmid_ds.h | 2 +- .../sparcv9-linux-gnu/bits/typesizes.h | 2 +- .../include/sparcv9-linux-gnu/fpu_control.h | 2 +- lib/libc/include/sparcv9-linux-gnu/ieee754.h | 2 +- .../include/sparcv9-linux-gnu/sys/ptrace.h | 2 +- .../include/sparcv9-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/sparcv9-linux-gnu/sys/user.h | 2 +- .../x86_64-linux-gnu/bits/environments.h | 2 +- .../include/x86_64-linux-gnu/bits/epoll.h | 2 +- .../include/x86_64-linux-gnu/bits/fcntl.h | 2 +- lib/libc/include/x86_64-linux-gnu/bits/fenv.h | 2 +- .../include/x86_64-linux-gnu/bits/floatn.h | 2 +- .../x86_64-linux-gnu/bits/flt-eval-method.h | 2 +- .../include/x86_64-linux-gnu/bits/fp-logb.h | 2 +- .../x86_64-linux-gnu/bits/indirect-return.h | 2 +- .../include/x86_64-linux-gnu/bits/ipctypes.h | 2 +- .../x86_64-linux-gnu/bits/iscanonical.h | 2 +- lib/libc/include/x86_64-linux-gnu/bits/link.h | 2 +- .../x86_64-linux-gnu/bits/long-double.h | 2 +- .../x86_64-linux-gnu/bits/math-vector.h | 2 +- lib/libc/include/x86_64-linux-gnu/bits/mman.h | 2 +- .../include/x86_64-linux-gnu/bits/procfs-id.h | 2 +- .../include/x86_64-linux-gnu/bits/procfs.h | 2 +- .../x86_64-linux-gnu/bits/pthreadtypes-arch.h | 2 +- .../include/x86_64-linux-gnu/bits/setjmp.h | 2 +- .../x86_64-linux-gnu/bits/sigcontext.h | 2 +- .../x86_64-linux-gnu/bits/struct_mutex.h | 2 +- .../x86_64-linux-gnu/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 67 +----- .../include/x86_64-linux-gnu/bits/timesize.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../include/x86_64-linux-gnu/bits/typesizes.h | 2 +- .../finclude/math-vector-fortran.h | 2 +- .../include/x86_64-linux-gnu/fpu_control.h | 2 +- lib/libc/include/x86_64-linux-gnu/sys/elf.h | 2 +- .../include/x86_64-linux-gnu/sys/ptrace.h | 2 +- .../include/x86_64-linux-gnu/sys/ucontext.h | 2 +- lib/libc/include/x86_64-linux-gnu/sys/user.h | 2 +- .../x86_64-linux-gnux32/bits/environments.h | 2 +- .../include/x86_64-linux-gnux32/bits/epoll.h | 2 +- .../include/x86_64-linux-gnux32/bits/fcntl.h | 2 +- .../include/x86_64-linux-gnux32/bits/fenv.h | 2 +- .../include/x86_64-linux-gnux32/bits/floatn.h | 2 +- .../bits/flt-eval-method.h | 2 +- .../x86_64-linux-gnux32/bits/fp-logb.h | 2 +- .../bits/indirect-return.h | 2 +- .../x86_64-linux-gnux32/bits/ipctypes.h | 2 +- .../x86_64-linux-gnux32/bits/iscanonical.h | 2 +- .../include/x86_64-linux-gnux32/bits/link.h | 2 +- .../x86_64-linux-gnux32/bits/long-double.h | 2 +- .../x86_64-linux-gnux32/bits/math-vector.h | 2 +- .../include/x86_64-linux-gnux32/bits/mman.h | 2 +- .../x86_64-linux-gnux32/bits/procfs-id.h | 2 +- .../include/x86_64-linux-gnux32/bits/procfs.h | 2 +- .../bits/pthreadtypes-arch.h | 2 +- .../include/x86_64-linux-gnux32/bits/setjmp.h | 2 +- .../x86_64-linux-gnux32/bits/sigcontext.h | 2 +- .../x86_64-linux-gnux32/bits/struct_mutex.h | 2 +- .../x86_64-linux-gnux32/bits/struct_rwlock.h | 2 +- .../bits/{stat.h => struct_stat.h} | 67 +----- .../x86_64-linux-gnux32/bits/timesize.h | 2 +- .../bits/types/struct_semid_ds.h | 2 +- .../x86_64-linux-gnux32/bits/typesizes.h | 2 +- .../finclude/math-vector-fortran.h | 2 +- .../include/x86_64-linux-gnux32/fpu_control.h | 2 +- .../include/x86_64-linux-gnux32/sys/elf.h | 2 +- .../include/x86_64-linux-gnux32/sys/ptrace.h | 2 +- .../x86_64-linux-gnux32/sys/ucontext.h | 2 +- .../include/x86_64-linux-gnux32/sys/user.h | 2 +- 1069 files changed, 4521 insertions(+), 2782 deletions(-) rename lib/libc/include/aarch64-linux-gnu/bits/{stat.h => struct_stat.h} (70%) rename lib/libc/include/aarch64_be-linux-gnu/bits/{stat.h => struct_stat.h} (70%) rename lib/libc/include/{armeb-linux-gnueabi/bits/stat.h => arm-linux-gnueabi/bits/struct_stat.h} (72%) rename lib/libc/include/{armeb-linux-gnueabihf/bits/stat.h => arm-linux-gnueabihf/bits/struct_stat.h} (72%) rename lib/libc/include/{arm-linux-gnueabi/bits/stat.h => armeb-linux-gnueabi/bits/struct_stat.h} (72%) rename lib/libc/include/{arm-linux-gnueabihf/bits/stat.h => armeb-linux-gnueabihf/bits/struct_stat.h} (72%) create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/endianness.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/fcntl.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/fenv.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/floatn.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/link.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/long-double.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/procfs.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/setjmp.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/shmlba.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/statfs.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h rename lib/libc/include/{riscv64-linux-gnu/bits/stat.h => csky-linux-gnueabi/bits/struct_stat.h} (70%) create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/typesizes.h create mode 100644 lib/libc/include/csky-linux-gnueabi/bits/wordsize.h create mode 100644 lib/libc/include/csky-linux-gnueabi/fpu_control.h create mode 100644 lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h create mode 100644 lib/libc/include/csky-linux-gnueabi/gnu/stubs.h create mode 100644 lib/libc/include/csky-linux-gnueabi/sys/cachectl.h create mode 100644 lib/libc/include/csky-linux-gnueabi/sys/ucontext.h create mode 100644 lib/libc/include/csky-linux-gnueabi/sys/user.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/endianness.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/fcntl.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/fenv.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/floatn.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/link.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/long-double.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/procfs.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/setjmp.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/shmlba.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/statfs.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/struct_stat.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/typesizes.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/fpu_control.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/gnu/stubs.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/sys/cachectl.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/sys/ucontext.h create mode 100644 lib/libc/include/csky-linux-gnueabihf/sys/user.h create mode 100644 lib/libc/include/generic-glibc/bits/struct_stat.h create mode 100644 lib/libc/include/generic-glibc/bits/types/struct___jmp_buf_tag.h create mode 100644 lib/libc/include/generic-glibc/bits/types/struct_timeb.h create mode 100644 lib/libc/include/generic-glibc/sys/platform/x86.h delete mode 100644 lib/libc/include/generic-glibc/sys/vtimes.h rename lib/libc/include/i386-linux-gnu/bits/{stat.h => struct_stat.h} (73%) rename lib/libc/include/powerpc-linux-gnu/bits/{stat.h => struct_stat.h} (82%) rename lib/libc/include/powerpc64-linux-gnu/bits/{stat.h => struct_stat.h} (82%) rename lib/libc/include/powerpc64le-linux-gnu/bits/{stat.h => struct_stat.h} (82%) create mode 100644 lib/libc/include/riscv64-linux-gnu/bits/environments.h create mode 100644 lib/libc/include/riscv64-linux-gnu/bits/struct_stat.h create mode 100644 lib/libc/include/riscv64-linux-gnu/bits/time64.h rename lib/libc/include/{s390x-linux-gnu/bits/flt-eval-method.h => riscv64-linux-gnu/bits/timesize.h} (70%) rename lib/libc/include/s390x-linux-gnu/bits/{stat.h => struct_stat.h} (80%) rename lib/libc/include/sparc-linux-gnu/bits/{stat.h => struct_stat.h} (72%) rename lib/libc/include/sparcv9-linux-gnu/bits/{stat.h => struct_stat.h} (72%) rename lib/libc/include/x86_64-linux-gnu/bits/{stat.h => struct_stat.h} (73%) rename lib/libc/include/x86_64-linux-gnux32/bits/{stat.h => struct_stat.h} (73%) diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h index ccf39f29d3..796d505b47 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for the AArch64 Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fenv.h b/lib/libc/include/aarch64-linux-gnu/bits/fenv.h index de4e9fb758..9483c26b54 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/fenv.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h b/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h index 0cf198e478..da438c6d3f 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. AArch64 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h b/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h index 9f3cadf056..7545867126 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. AArch64 Linux version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -72,4 +72,5 @@ #define HWCAP2_BF16 (1 << 14) #define HWCAP2_DGH (1 << 15) #define HWCAP2_RNG (1 << 16) -#define HWCAP2_BTI (1 << 17) \ No newline at end of file +#define HWCAP2_BTI (1 << 17) +#define HWCAP2_MTE (1 << 18) \ No newline at end of file diff --git a/lib/libc/include/aarch64-linux-gnu/bits/link.h b/lib/libc/include/aarch64-linux-gnu/bits/link.h index bf9953595f..2fb29eb0b7 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/link.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h index 155d60e416..61e25c0bcc 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/long-double.h b/lib/libc/include/aarch64-linux-gnu/bits/long-double.h index f95b24f8e7..ec1a0674e8 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/long-double.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-128 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64-linux-gnu/bits/mman.h b/lib/libc/include/aarch64-linux-gnu/bits/mman.h index da9c3b862f..4cd40a67d3 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/mman.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/AArch64 version. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,7 @@ arch/arm64/include/uapi/asm/mman.h. */ #define PROT_BTI 0x10 +#define PROT_MTE 0x20 #include diff --git a/lib/libc/include/aarch64-linux-gnu/bits/procfs.h b/lib/libc/include/aarch64-linux-gnu/bits/procfs.h index efb589274b..a9bfca08c3 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/procfs.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. AArch64 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h index e64b19346e..d246576aee 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h index 64a56cc2f9..f229b05d95 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h b/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h index 2b63e21916..eceaa97a4f 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h b/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h index 7294db7d4c..0cb5583fde 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 2015-2020 Free Software Foundation, Inc. + Copyright (C) 2015-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64-linux-gnu/bits/statfs.h index 61c27388e9..94a6e610fb 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h index 1f6f86e910..e89dc26963 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* AArch64 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/stat.h b/lib/libc/include/aarch64-linux-gnu/bits/struct_stat.h similarity index 70% rename from lib/libc/include/aarch64-linux-gnu/bits/stat.h rename to lib/libc/include/aarch64-linux-gnu/bits/struct_stat.h index 2df73d11e3..0549e9d97f 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/stat.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/struct_stat.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,29 +17,15 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include #include -/* 64-bit libc uses the kernel's 'struct stat', accessed via the - stat() syscall; 32-bit libc uses the kernel's 'struct stat64' - and accesses it via the stat64() syscall. All the various - APIs offered by libc use the kernel shape for their struct stat - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (specifically st_ino, st_size, and st_blocks). */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 0 -#define _STAT_VER _STAT_VER_KERNEL - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T @@ -138,37 +124,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h b/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h index a5f4c78b94..4156f352ad 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h index 68b28bf2d7..6b9114f8ab 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h @@ -1,6 +1,6 @@ /* Determine the wordsize from the preprocessor defines. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64-linux-gnu/fpu_control.h b/lib/libc/include/aarch64-linux-gnu/fpu_control.h index ba2e530b10..db73fa0b1d 100644 --- a/lib/libc/include/aarch64-linux-gnu/fpu_control.h +++ b/lib/libc/include/aarch64-linux-gnu/fpu_control.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/ieee754.h b/lib/libc/include/aarch64-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/aarch64-linux-gnu/ieee754.h +++ b/lib/libc/include/aarch64-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64-linux-gnu/sys/elf.h b/lib/libc/include/aarch64-linux-gnu/sys/elf.h index e3e2bac7b2..9aa4973466 100644 --- a/lib/libc/include/aarch64-linux-gnu/sys/elf.h +++ b/lib/libc/include/aarch64-linux-gnu/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h index ce7f6bf7c0..40f59658ab 100644 --- a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/AArch64 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h b/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h index a3ede3eb97..7e3b484f96 100644 --- a/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64-linux-gnu/sys/user.h b/lib/libc/include/aarch64-linux-gnu/sys/user.h index ce78f80471..3379256a9c 100644 --- a/lib/libc/include/aarch64-linux-gnu/sys/user.h +++ b/lib/libc/include/aarch64-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2020 Free Software Foundation, Inc. +/* Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h index ccf39f29d3..796d505b47 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for the AArch64 Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h index de4e9fb758..9483c26b54 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h index 0cf198e478..da438c6d3f 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. AArch64 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h b/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h index 9f3cadf056..7545867126 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. AArch64 Linux version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -72,4 +72,5 @@ #define HWCAP2_BF16 (1 << 14) #define HWCAP2_DGH (1 << 15) #define HWCAP2_RNG (1 << 16) -#define HWCAP2_BTI (1 << 17) \ No newline at end of file +#define HWCAP2_BTI (1 << 17) +#define HWCAP2_MTE (1 << 18) \ No newline at end of file diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/link.h b/lib/libc/include/aarch64_be-linux-gnu/bits/link.h index bf9953595f..2fb29eb0b7 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/link.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h index 155d60e416..61e25c0bcc 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h b/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h index f95b24f8e7..ec1a0674e8 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-128 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/mman.h b/lib/libc/include/aarch64_be-linux-gnu/bits/mman.h index da9c3b862f..4cd40a67d3 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/mman.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/AArch64 version. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,7 @@ arch/arm64/include/uapi/asm/mman.h. */ #define PROT_BTI 0x10 +#define PROT_MTE 0x20 #include diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h b/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h index efb589274b..a9bfca08c3 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. AArch64 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h index e64b19346e..d246576aee 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h b/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h index 64a56cc2f9..f229b05d95 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h b/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h index 2b63e21916..eceaa97a4f 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h b/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h index 7294db7d4c..0cb5583fde 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 2015-2020 Free Software Foundation, Inc. + Copyright (C) 2015-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h index 61c27388e9..94a6e610fb 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h index 1f6f86e910..e89dc26963 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* AArch64 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_stat.h similarity index 70% rename from lib/libc/include/aarch64_be-linux-gnu/bits/stat.h rename to lib/libc/include/aarch64_be-linux-gnu/bits/struct_stat.h index 2df73d11e3..0549e9d97f 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_stat.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,29 +17,15 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include #include -/* 64-bit libc uses the kernel's 'struct stat', accessed via the - stat() syscall; 32-bit libc uses the kernel's 'struct stat64' - and accesses it via the stat64() syscall. All the various - APIs offered by libc use the kernel shape for their struct stat - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (specifically st_ino, st_size, and st_blocks). */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 0 -#define _STAT_VER _STAT_VER_KERNEL - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T @@ -138,37 +124,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h b/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h index a5f4c78b94..4156f352ad 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h b/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h index 68b28bf2d7..6b9114f8ab 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h @@ -1,6 +1,6 @@ /* Determine the wordsize from the preprocessor defines. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h b/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h index ba2e530b10..db73fa0b1d 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h +++ b/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/ieee754.h b/lib/libc/include/aarch64_be-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/ieee754.h +++ b/lib/libc/include/aarch64_be-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h b/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h index e3e2bac7b2..9aa4973466 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h +++ b/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h index ce7f6bf7c0..40f59658ab 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/AArch64 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h b/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h index a3ede3eb97..7e3b484f96 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/user.h b/lib/libc/include/aarch64_be-linux-gnu/sys/user.h index ce78f80471..3379256a9c 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/sys/user.h +++ b/lib/libc/include/aarch64_be-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2020 Free Software Foundation, Inc. +/* Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h b/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h index fdb169449b..29e75898be 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/fenv.h b/lib/libc/include/arm-linux-gnueabi/bits/fenv.h index 654776420e..30c3cfdd47 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/fenv.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/floatn.h b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h index 2900001e82..18018fa9f8 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/floatn.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h b/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h index b626008612..944e1ab5e2 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. ARM Linux version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/link.h b/lib/libc/include/arm-linux-gnueabi/bits/link.h index 7ebb2785d6..2daf7c37cd 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/link.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/long-double.h b/lib/libc/include/arm-linux-gnueabi/bits/long-double.h index 088c7a2a06..5d6d6c86af 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/long-double.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h b/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h index 48da66726b..680018e8f9 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/arm-linux-gnueabi/bits/procfs.h b/lib/libc/include/arm-linux-gnueabi/bits/procfs.h index 8a92b69bd4..378aadb89f 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/procfs.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. Arm version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h b/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h index 0912578792..ad79830ae5 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h b/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h index 75efb7ce50..cfd529afe2 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. ARM version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h index f6c7499dab..7431c5597f 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* Default read-write lock implementation struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/stat.h b/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h similarity index 72% rename from lib/libc/include/armeb-linux-gnueabi/bits/stat.h rename to lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h index f6c3b7a3fa..94f0282059 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/stat.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -136,37 +127,5 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h index f0838f9108..6561e924f5 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/fpu_control.h b/lib/libc/include/arm-linux-gnueabi/fpu_control.h index ad74992218..496937215b 100644 --- a/lib/libc/include/arm-linux-gnueabi/fpu_control.h +++ b/lib/libc/include/arm-linux-gnueabi/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. ARM VFP version. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h b/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h index 34be509f32..178de8b3c7 100644 --- a/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h +++ b/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/ARM version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h b/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h index 53ffc36a6c..48bcd9f6fc 100644 --- a/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h +++ b/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/sys/user.h b/lib/libc/include/arm-linux-gnueabi/sys/user.h index 2b901bfba3..89a14c7b48 100644 --- a/lib/libc/include/arm-linux-gnueabi/sys/user.h +++ b/lib/libc/include/arm-linux-gnueabi/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h index fdb169449b..29e75898be 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h b/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h index 654776420e..30c3cfdd47 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h index 2900001e82..18018fa9f8 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h b/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h index b626008612..944e1ab5e2 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. ARM Linux version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/link.h b/lib/libc/include/arm-linux-gnueabihf/bits/link.h index 7ebb2785d6..2daf7c37cd 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/link.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h b/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h index 088c7a2a06..5d6d6c86af 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h b/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h index 48da66726b..680018e8f9 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h b/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h index 8a92b69bd4..378aadb89f 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. Arm version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h index 0912578792..ad79830ae5 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h index 75efb7ce50..cfd529afe2 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. ARM version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h index f6c7499dab..7431c5597f 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* Default read-write lock implementation struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h b/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h similarity index 72% rename from lib/libc/include/armeb-linux-gnueabihf/bits/stat.h rename to lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h index f6c3b7a3fa..94f0282059 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -136,37 +127,5 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h index f0838f9108..6561e924f5 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/fpu_control.h b/lib/libc/include/arm-linux-gnueabihf/fpu_control.h index ad74992218..496937215b 100644 --- a/lib/libc/include/arm-linux-gnueabihf/fpu_control.h +++ b/lib/libc/include/arm-linux-gnueabihf/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. ARM VFP version. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h b/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h index 34be509f32..178de8b3c7 100644 --- a/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h +++ b/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/ARM version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h index 53ffc36a6c..48bcd9f6fc 100644 --- a/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h +++ b/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/user.h b/lib/libc/include/arm-linux-gnueabihf/sys/user.h index 2b901bfba3..89a14c7b48 100644 --- a/lib/libc/include/arm-linux-gnueabihf/sys/user.h +++ b/lib/libc/include/arm-linux-gnueabihf/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h b/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h index fdb169449b..29e75898be 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h b/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h index 654776420e..30c3cfdd47 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h index 2900001e82..18018fa9f8 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h b/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h index b626008612..944e1ab5e2 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. ARM Linux version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/link.h b/lib/libc/include/armeb-linux-gnueabi/bits/link.h index 7ebb2785d6..2daf7c37cd 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/link.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h b/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h index 088c7a2a06..5d6d6c86af 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h b/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h index 48da66726b..680018e8f9 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h b/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h index 8a92b69bd4..378aadb89f 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. Arm version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h b/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h index 0912578792..ad79830ae5 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h b/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h index 75efb7ce50..cfd529afe2 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. ARM version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h index f6c7499dab..7431c5597f 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* Default read-write lock implementation struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabi/bits/stat.h b/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h similarity index 72% rename from lib/libc/include/arm-linux-gnueabi/bits/stat.h rename to lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h index f6c3b7a3fa..94f0282059 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/stat.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -136,37 +127,5 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h index f0838f9108..6561e924f5 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/fpu_control.h b/lib/libc/include/armeb-linux-gnueabi/fpu_control.h index ad74992218..496937215b 100644 --- a/lib/libc/include/armeb-linux-gnueabi/fpu_control.h +++ b/lib/libc/include/armeb-linux-gnueabi/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. ARM VFP version. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h b/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h index 34be509f32..178de8b3c7 100644 --- a/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h +++ b/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/ARM version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h b/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h index 53ffc36a6c..48bcd9f6fc 100644 --- a/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h +++ b/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/user.h b/lib/libc/include/armeb-linux-gnueabi/sys/user.h index 2b901bfba3..89a14c7b48 100644 --- a/lib/libc/include/armeb-linux-gnueabi/sys/user.h +++ b/lib/libc/include/armeb-linux-gnueabi/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h index fdb169449b..29e75898be 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h b/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h index 654776420e..30c3cfdd47 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h index 2900001e82..18018fa9f8 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h b/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h index b626008612..944e1ab5e2 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. ARM Linux version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/link.h b/lib/libc/include/armeb-linux-gnueabihf/bits/link.h index 7ebb2785d6..2daf7c37cd 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/link.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h b/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h index 088c7a2a06..5d6d6c86af 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h index 48da66726b..680018e8f9 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h index 8a92b69bd4..378aadb89f 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. Arm version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h index 0912578792..ad79830ae5 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h index 75efb7ce50..cfd529afe2 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. ARM version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h index f6c7499dab..7431c5597f 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* Default read-write lock implementation struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/stat.h b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h similarity index 72% rename from lib/libc/include/arm-linux-gnueabihf/bits/stat.h rename to lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h index f6c3b7a3fa..94f0282059 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/stat.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -136,37 +127,5 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h index f0838f9108..6561e924f5 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h b/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h index ad74992218..496937215b 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h +++ b/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. ARM VFP version. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h b/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h index 34be509f32..178de8b3c7 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h +++ b/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/ARM version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h index 53ffc36a6c..48bcd9f6fc 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h +++ b/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/user.h b/lib/libc/include/armeb-linux-gnueabihf/sys/user.h index 2b901bfba3..89a14c7b48 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/sys/user.h +++ b/lib/libc/include/armeb-linux-gnueabihf/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/csky-linux-gnueabi/bits/endianness.h b/lib/libc/include/csky-linux-gnueabi/bits/endianness.h new file mode 100644 index 0000000000..471d2828bf --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/endianness.h @@ -0,0 +1,14 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef __CSKYBE__ +# error "Big endian not supported for C-SKY." +#else +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/fcntl.h b/lib/libc/include/csky-linux-gnueabi/bits/fcntl.h new file mode 100644 index 0000000000..8241dc7482 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/fcntl.h @@ -0,0 +1,56 @@ +/* O_*, F_*, FD_* bit values for the generic Linux ABI. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include + +#if __WORDSIZE == 64 +# define __O_LARGEFILE 0 +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/fenv.h b/lib/libc/include/csky-linux-gnueabi/bits/fenv.h new file mode 100644 index 0000000000..f544eb6f8f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/fenv.h @@ -0,0 +1,111 @@ +/* Floating point environment. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + +#ifdef __csky_hard_float__ +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INVALID = +#define FE_INVALID 0x01 + FE_INVALID, + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x02 + FE_DIVBYZERO, + FE_OVERFLOW = +#define FE_OVERFLOW 0x04 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x08 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 0x10 + FE_INEXACT, + __FE_DENORMAL = 0x20 + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The C-SKY FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = +#define FE_TONEAREST (0x0 << 24) + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO (0x1 << 24) + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD (0x2 << 24) + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD (0x3 << 24) + FE_DOWNWARD, + __FE_ROUND_MASK = (0x3 << 24) + }; + +#else + +/* In the soft-float case, only rounding to nearest is supported, with + no exceptions. */ + +enum + { + __FE_UNDEFINED = -1, + + FE_TONEAREST = +# define FE_TONEAREST 0x0 + FE_TONEAREST + }; + +# define FE_ALL_EXCEPT 0 + +#endif + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t; + +/* Type representing floating-point environment. */ +typedef struct +{ + unsigned int __fpcr; + unsigned int __fpsr; +} fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((const fenv_t *) -1) + +#if defined __USE_GNU && defined __csky_hard_float__ +/* Floating-point environment where none of the exceptions are masked. */ +# define FE_NOMASK_ENV ((const fenv_t *) -2) +#endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) +/* Type representing floating-point control modes. */ +typedef unsigned int femode_t; + +/* Default floating-point control modes. */ +# define FE_DFL_MODE ((const femode_t *) -1L) +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/floatn.h b/lib/libc/include/csky-linux-gnueabi/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + Copyright (C) 2017-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/link.h b/lib/libc/include/csky-linux-gnueabi/bits/link.h new file mode 100644 index 0000000000..df280b4c81 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/link.h @@ -0,0 +1,55 @@ +/* Machine-specific declarations for dynamic linker interface. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _LINK_H +# error "Never include directly; use instead." +#endif + +/* Registers for entry into PLT on C-SKY. */ +typedef struct La_csky_regs +{ + uint32_t lr_reg[4]; + uint32_t lr_sp; + uint32_t lr_lr; +} La_csky_regs; + +/* Return values for calls from PLT on C-SKY. */ +typedef struct La_csky_retval +{ + /* Up to four integer registers can be used for a return value. */ + uint32_t lrv_reg[4]; + uint32_t lrv_v0; +} La_csky_retval; + +__BEGIN_DECLS + +extern Elf32_Addr la_csky_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_csky_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_csky_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_csky_regs *__inregs, + La_csky_retval *__outregs, + const char *__symname); + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/long-double.h b/lib/libc/include/csky-linux-gnueabi/bits/long-double.h new file mode 100644 index 0000000000..5d6d6c86af --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/long-double.h @@ -0,0 +1,53 @@ +/* Properties of long double type. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This header is included by . + + If long double is ABI-compatible with double, it should define + __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave + __NO_LONG_DOUBLE_MATH undefined. + + If this build of the GNU C Library supports both long double + ABI-compatible with double and some other long double format not + ABI-compatible with double, it should define + __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave + __LONG_DOUBLE_MATH_OPTIONAL undefined. + + If __NO_LONG_DOUBLE_MATH is already defined, this header must not + define anything; this is needed to work with the definition of + __NO_LONG_DOUBLE_MATH in nldbl-compat.h. */ + +/* In the default version of this header, long double is + ABI-compatible with double. */ +#ifndef __NO_LONG_DOUBLE_MATH +# define __NO_LONG_DOUBLE_MATH 1 +#endif + +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the + choice of the underlying ABI of long double. It will always assume + a constant value for each translation unit. + + If the value is non-zero, any API which is parameterized by the long + double type (i.e the scanf/printf family of functions or the explicitly + parameterized math.h functions) will be redirected to a compatible + implementation using _Float128 ABI via symbols suffixed with ieee128. + + The mechanism this macro uses to acquire may be a function + of architecture, or target specific options used to invoke the + compiler. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/procfs.h b/lib/libc/include/csky-linux-gnueabi/bits/procfs.h new file mode 100644 index 0000000000..e2da19ccf7 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/procfs.h @@ -0,0 +1,37 @@ +/* Types for registers for sys/procfs.h. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#include + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; +/* Type for a floating-point registers. */ +typedef unsigned long elf_fpreg_t; + +/* In gdb/bfd elf32-csky.c, csky_elf_grok_prstatus() use fixed size of + elf_prstatus. It's 148 for abiv1 and 220 for abiv2, the size is enough + for coredump and no need full sizeof (struct pt_regs). */ +#define ELF_NGREG ((sizeof (struct pt_regs) / sizeof (elf_greg_t)) - 2) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +#define ELF_NFPREG (sizeof (struct user_fp) / sizeof (elf_fpreg_t)) +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/setjmp.h b/lib/libc/include/csky-linux-gnueabi/bits/setjmp.h new file mode 100644 index 0000000000..c0b6623ddc --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/setjmp.h @@ -0,0 +1,34 @@ +/* Define the machine-dependent type `jmp_buf'. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _CSKY_BITS_SETJMP_H +#define _CSKY_BITS_SETJMP_H 1 + +typedef struct __jmp_buf_str + { + /* Stack pointer. */ + int __sp; + int __lr; + /* The actual core defines which registers should be saved. The + buffer contains 32 words, keep space for future growth. + Callee-saved registers: + r4 ~ r11, r16 ~ r17, r26 ~r31 for abiv2; r8 ~ r14 for abiv1. */ + int __regs[32]; + } __jmp_buf[1]; + +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/shmlba.h b/lib/libc/include/csky-linux-gnueabi/bits/shmlba.h new file mode 100644 index 0000000000..15e78caf71 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/shmlba.h @@ -0,0 +1,29 @@ +/* Define SHMLBA. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SHM_H +# error "Never use directly; include instead." +#endif + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize () << 2) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/statfs.h b/lib/libc/include/csky-linux-gnueabi/bits/statfs.h new file mode 100644 index 0000000000..94a6e610fb --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/statfs.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + +/* 64-bit libc uses the kernel's 'struct statfs', accessed via the + statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' + and accesses it via the statfs64() syscall. All the various + APIs offered by libc use the kernel shape for their struct statfs + structure; the only difference is that 32-bit programs not + using __USE_FILE_OFFSET64 only see the low 32 bits of some + of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 +# define __field64(type, type64, name) type name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct statfs + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE +#define _STATFS_F_FLAGS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + Copyright (C) 2019-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +struct __pthread_rwlock_arch_t +{ + unsigned int __readers; + unsigned int __writers; + unsigned int __wrphase_futex; + unsigned int __writers_futex; + unsigned int __pad3; + unsigned int __pad4; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/bits/stat.h b/lib/libc/include/csky-linux-gnueabi/bits/struct_stat.h similarity index 70% rename from lib/libc/include/riscv64-linux-gnu/bits/stat.h rename to lib/libc/include/csky-linux-gnueabi/bits/struct_stat.h index 2df73d11e3..0549e9d97f 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/stat.h +++ b/lib/libc/include/csky-linux-gnueabi/bits/struct_stat.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,29 +17,15 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include #include -/* 64-bit libc uses the kernel's 'struct stat', accessed via the - stat() syscall; 32-bit libc uses the kernel's 'struct stat64' - and accesses it via the stat64() syscall. All the various - APIs offered by libc use the kernel shape for their struct stat - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (specifically st_ino, st_size, and st_blocks). */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 0 -#define _STAT_VER _STAT_VER_KERNEL - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T @@ -138,37 +124,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/typesizes.h b/lib/libc/include/csky-linux-gnueabi/bits/typesizes.h new file mode 100644 index 0000000000..4156f352ad --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/typesizes.h @@ -0,0 +1,108 @@ +/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ +#if __TIMESIZE == 64 && __WORDSIZE == 32 +/* These are the "new" y2038 types defined for architectures added after + the 5.1 kernel. */ +# define __INO_T_TYPE __UQUAD_TYPE +# define __OFF_T_TYPE __SQUAD_TYPE +# define __RLIM_T_TYPE __UQUAD_TYPE +# define __BLKCNT_T_TYPE __SQUAD_TYPE +# define __FSBLKCNT_T_TYPE __UQUAD_TYPE +# define __FSFILCNT_T_TYPE __UQUAD_TYPE +# define __TIME_T_TYPE __SQUAD_TYPE +# define __SUSECONDS_T_TYPE __SQUAD_TYPE +#else +# define __INO_T_TYPE __ULONGWORD_TYPE +# define __OFF_T_TYPE __SLONGWORD_TYPE +# define __RLIM_T_TYPE __ULONGWORD_TYPE +# define __BLKCNT_T_TYPE __SLONGWORD_TYPE +# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +# define __TIME_T_TYPE __SLONGWORD_TYPE +# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#endif + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __U32_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSWORD_T_TYPE __SWORD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __S32_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE +#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +#define __CPU_MASK_TYPE __ULONGWORD_TYPE + +#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* Same for ino_t and ino64_t. */ +# define __INO_T_MATCHES_INO64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) +#else +# define __RLIM_T_MATCHES_RLIM64_T 0 + +# define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 +#endif + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h b/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/fpu_control.h b/lib/libc/include/csky-linux-gnueabi/fpu_control.h new file mode 100644 index 0000000000..e2ff490723 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/fpu_control.h @@ -0,0 +1,148 @@ +/* FPU control word bits. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +/* C-SKY FPU floating point control register bits. + + 31-28 -> Reserved (read as 0, write with 0). + 27 -> 0: Flush denormalized results to zero. + 1: Flush denormalized results to signed minimal normal number. + 26 -> Reserved (read as 0, write with 0). + 25-24 -> Rounding control. + 23-6 -> Reserved (read as 0, write with 0). + 5 -> Enable exception for input denormalized exception. + 4 -> Enable exception for inexact exception. + 3 -> Enable exception for underflow exception. + 2 -> Enable exception for overflow exception. + 1 -> Enable exception for division by zero exception. + 0 -> Enable exception for invalid operation exception. + + Rounding Control: + 00 - Rounding to nearest (RN). + 01 - Rounding toward zero (RZ). + 10 - Rounding (up) toward plus infinity (RP). + 11 - Rounding (down)toward minus infinity (RM). + + C-SKY FPU floating point exception status register bits. + + 15 -> Accumulate bit for any exception. + 14 -> Reserved (read as 0, write with 0). + 13 -> Cause bit for input denormalized exception. + 12 -> Cause bit for inexact exception. + 11 -> Cause bit for underflow exception. + 10 -> Cause bit for overflow exception. + 9 -> Cause bit for division by zero exception. + 8 -> Cause bit for invalid operation exception. + 7 -> Flag bit for any exception. + 6 -> Reserved (read as 0, write with 0). + 5 -> Flag exception for input denormalized exception. + 4 -> Flag exception for inexact exception. + 3 -> Flag exception for underflow exception. + 2 -> Flag exception for overflow exception. + 1 -> Flag exception for division by zero exception. + 0 -> Flag exception for invalid operation exception. */ + +#include + +#ifdef __csky_soft_float__ + +# define _FPU_RESERVED 0xffffffff +# define _FPU_DEFAULT 0x00000000 +typedef unsigned int fpu_control_t; +# define _FPU_GETCW(cw) (cw) = 0 +# define _FPU_SETCW(cw) (void) (cw) +# define _FPU_GETFPSR(cw) (cw) = 0 +# define _FPU_SETFPSR(cw) (void) (cw) +extern fpu_control_t __fpu_control; + +#else /* __csky_soft_float__ */ + +/* Masking of interrupts. */ +# define _FPU_MASK_IDE (1 << 5) /* Input denormalized exception. */ +# define _FPU_MASK_IXE (1 << 4) /* Inexact exception. */ +# define _FPU_MASK_UFE (1 << 3) /* Underflow exception. */ +# define _FPU_MASK_OFE (1 << 2) /* Overflow exception. */ +# define _FPU_MASK_DZE (1 << 1) /* Division by zero exception. */ +# define _FPU_MASK_IOE (1 << 0) /* Invalid operation exception. */ + +# define _FPU_MASK_FEA (1 << 15) /* Case for any exception. */ +# define _FPU_MASK_FEC (1 << 7) /* Flag for any exception. */ + +/* Flush denormalized numbers to zero. */ +# define _FPU_FLUSH_TZ 0x8000000 + +/* Rounding control. */ +# define _FPU_RC_NEAREST (0x0 << 24) /* RECOMMENDED. */ +# define _FPU_RC_ZERO (0x1 << 24) +# define _FPU_RC_UP (0x2 << 24) +# define _FPU_RC_DOWN (0x3 << 24) + +# define _FPU_RESERVED 0xf460ffc0 /* Reserved bits in cw. */ +# define _FPU_FPSR_RESERVED 0xffff4040 + +/* The fdlibm code requires strict IEEE double precision arithmetic, + and no interrupts for exceptions, rounding to nearest. */ + +# define _FPU_DEFAULT 0x00000000 +# define _FPU_FPSR_DEFAULT 0x00000000 + +/* IEEE: same as above, but exceptions. */ +# define _FPU_FPCR_IEEE 0x0000001F +# define _FPU_FPSR_IEEE 0x00000000 + +/* Type of the control word. */ +typedef unsigned int fpu_control_t; + +/* Macros for accessing the hardware control word. */ +# if (__CSKY__ == 2) +# define _FPU_GETCW(cw) __asm__ volatile ("mfcr %0, cr<1, 2>" : "=a" (cw)) +# define _FPU_SETCW(cw) __asm__ volatile ("mtcr %0, cr<1, 2>" : : "a" (cw)) +# define _FPU_GETFPSR(cw) __asm__ volatile ("mfcr %0, cr<2, 2>" : "=a" (cw)) +# define _FPU_SETFPSR(cw) __asm__ volatile ("mtcr %0, cr<2, 2>" : : "a" (cw)) +# else +# define _FPU_GETCW(cw) __asm__ volatile ("1: cprcr %0, cpcr2 \n" \ + " btsti %0, 31 \n" \ + " bt 1b \n" \ + " cprcr %0, cpcr1\n" : "=b" (cw)) + +# define _FPU_SETCW(cw) __asm__ volatile ("1: cprcr r7, cpcr2 \n" \ + " btsti r7, 31 \n" \ + " bt 1b \n" \ + " cpwcr %0, cpcr1 \n" \ + : : "b" (cw) : "r7") + +# define _FPU_GETFPSR(cw) __asm__ volatile ("1: cprcr %0, cpcr2 \n" \ + " btsti %0, 31 \n" \ + " bt 1b \n" \ + " cprcr %0, cpcr4\n" : "=b" (cw)) + +# define _FPU_SETFPSR(cw) __asm__ volatile ("1: cprcr r7, cpcr2 \n" \ + " btsti r7, 31 \n" \ + " bt 1b \n" \ + " cpwcr %0, cpcr4 \n" \ + : : "b" (cw) : "r7") +# endif /* __CSKY__ != 2 */ + +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; + +#endif /* !__csky_soft_float__ */ + +#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h b/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h new file mode 100644 index 0000000000..21c8322d29 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h @@ -0,0 +1,32 @@ +/* This file is automatically generated. + It defines macros to allow user program to find the shared + library files which come as part of GNU libc. */ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#define LD_LINUX_CSKYV2_SO "ld-linux-cskyv2.so.1" +#define LD_SO "ld-linux-cskyv2.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" + +#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/gnu/stubs.h b/lib/libc/include/csky-linux-gnueabi/gnu/stubs.h new file mode 100644 index 0000000000..6ce02418e6 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/gnu/stubs.h @@ -0,0 +1,38 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_feclearexcept +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetenv +#define __stub_fegetexcept +#define __stub_fegetexceptflag +#define __stub_fegetmode +#define __stub_fegetround +#define __stub_feholdexcept +#define __stub_feraiseexcept +#define __stub_fesetenv +#define __stub_fesetexcept +#define __stub_fesetexceptflag +#define __stub_fesetmode +#define __stub_fesetround +#define __stub_fetestexcept +#define __stub_feupdateenv +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/sys/cachectl.h b/lib/libc/include/csky-linux-gnueabi/sys/cachectl.h new file mode 100644 index 0000000000..d3a06ce16e --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/sys/cachectl.h @@ -0,0 +1,36 @@ +/* C-SKY cache flushing interface. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* Get the kernel definition for the op bits. */ +#include + +__BEGIN_DECLS + +#ifdef __USE_MISC +extern int cacheflush (void *__addr, const int __nbytes, + const int __op) __THROW; +#endif + +__END_DECLS + +#endif /* sys/cachectl.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/sys/ucontext.h b/lib/libc/include/csky-linux-gnueabi/sys/ucontext.h new file mode 100644 index 0000000000..afce26d796 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/sys/ucontext.h @@ -0,0 +1,89 @@ +/* struct ucontext definition, C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include + +typedef struct + { + unsigned long __tls; + unsigned long __lr; + unsigned long __pc; + unsigned long __sr; + unsigned long __usp; + + /* + * a0, a1, a2, a3: + * abiv1: r2, r3, r4, r5 + * abiv2: r0, r1, r2, r3 + */ + + unsigned long __orig_a0; + unsigned long __a0; + unsigned long __a1; + unsigned long __a2; + unsigned long __a3; + + /* + * ABIV2: r4 ~ r13 + */ + unsigned long __regs[10]; + + /* r16 ~ r30 */ + unsigned long __exregs[15]; + + unsigned long __rhi; + unsigned long __rlo; + unsigned long __glibc_reserved; + } gregset_t; + +typedef struct + { + unsigned long __vr[64]; + unsigned long __fcr; + unsigned long __fesr; + unsigned long __fid; + unsigned long __glibc_reserved; + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __gregs; + fpregset_t __fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __uc_flags; + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + } ucontext_t; + +#undef __ctx + + +#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/sys/user.h b/lib/libc/include/csky-linux-gnueabi/sys/user.h new file mode 100644 index 0000000000..c0d07c7883 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/sys/user.h @@ -0,0 +1,23 @@ +/* This file is not used by C-SKY GDB. ptrace can use pt_regs definition + from linux kernel directly. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/endianness.h b/lib/libc/include/csky-linux-gnueabihf/bits/endianness.h new file mode 100644 index 0000000000..471d2828bf --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/endianness.h @@ -0,0 +1,14 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef __CSKYBE__ +# error "Big endian not supported for C-SKY." +#else +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/csky-linux-gnueabihf/bits/fcntl.h new file mode 100644 index 0000000000..8241dc7482 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/fcntl.h @@ -0,0 +1,56 @@ +/* O_*, F_*, FD_* bit values for the generic Linux ABI. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include + +#if __WORDSIZE == 64 +# define __O_LARGEFILE 0 +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/fenv.h b/lib/libc/include/csky-linux-gnueabihf/bits/fenv.h new file mode 100644 index 0000000000..f544eb6f8f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/fenv.h @@ -0,0 +1,111 @@ +/* Floating point environment. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + +#ifdef __csky_hard_float__ +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INVALID = +#define FE_INVALID 0x01 + FE_INVALID, + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x02 + FE_DIVBYZERO, + FE_OVERFLOW = +#define FE_OVERFLOW 0x04 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x08 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 0x10 + FE_INEXACT, + __FE_DENORMAL = 0x20 + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The C-SKY FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = +#define FE_TONEAREST (0x0 << 24) + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO (0x1 << 24) + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD (0x2 << 24) + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD (0x3 << 24) + FE_DOWNWARD, + __FE_ROUND_MASK = (0x3 << 24) + }; + +#else + +/* In the soft-float case, only rounding to nearest is supported, with + no exceptions. */ + +enum + { + __FE_UNDEFINED = -1, + + FE_TONEAREST = +# define FE_TONEAREST 0x0 + FE_TONEAREST + }; + +# define FE_ALL_EXCEPT 0 + +#endif + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t; + +/* Type representing floating-point environment. */ +typedef struct +{ + unsigned int __fpcr; + unsigned int __fpsr; +} fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((const fenv_t *) -1) + +#if defined __USE_GNU && defined __csky_hard_float__ +/* Floating-point environment where none of the exceptions are masked. */ +# define FE_NOMASK_ENV ((const fenv_t *) -2) +#endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) +/* Type representing floating-point control modes. */ +typedef unsigned int femode_t; + +/* Default floating-point control modes. */ +# define FE_DFL_MODE ((const femode_t *) -1L) +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h b/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + Copyright (C) 2017-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/link.h b/lib/libc/include/csky-linux-gnueabihf/bits/link.h new file mode 100644 index 0000000000..df280b4c81 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/link.h @@ -0,0 +1,55 @@ +/* Machine-specific declarations for dynamic linker interface. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _LINK_H +# error "Never include directly; use instead." +#endif + +/* Registers for entry into PLT on C-SKY. */ +typedef struct La_csky_regs +{ + uint32_t lr_reg[4]; + uint32_t lr_sp; + uint32_t lr_lr; +} La_csky_regs; + +/* Return values for calls from PLT on C-SKY. */ +typedef struct La_csky_retval +{ + /* Up to four integer registers can be used for a return value. */ + uint32_t lrv_reg[4]; + uint32_t lrv_v0; +} La_csky_retval; + +__BEGIN_DECLS + +extern Elf32_Addr la_csky_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_csky_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_csky_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_csky_regs *__inregs, + La_csky_retval *__outregs, + const char *__symname); + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/long-double.h b/lib/libc/include/csky-linux-gnueabihf/bits/long-double.h new file mode 100644 index 0000000000..5d6d6c86af --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/long-double.h @@ -0,0 +1,53 @@ +/* Properties of long double type. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This header is included by . + + If long double is ABI-compatible with double, it should define + __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave + __NO_LONG_DOUBLE_MATH undefined. + + If this build of the GNU C Library supports both long double + ABI-compatible with double and some other long double format not + ABI-compatible with double, it should define + __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave + __LONG_DOUBLE_MATH_OPTIONAL undefined. + + If __NO_LONG_DOUBLE_MATH is already defined, this header must not + define anything; this is needed to work with the definition of + __NO_LONG_DOUBLE_MATH in nldbl-compat.h. */ + +/* In the default version of this header, long double is + ABI-compatible with double. */ +#ifndef __NO_LONG_DOUBLE_MATH +# define __NO_LONG_DOUBLE_MATH 1 +#endif + +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the + choice of the underlying ABI of long double. It will always assume + a constant value for each translation unit. + + If the value is non-zero, any API which is parameterized by the long + double type (i.e the scanf/printf family of functions or the explicitly + parameterized math.h functions) will be redirected to a compatible + implementation using _Float128 ABI via symbols suffixed with ieee128. + + The mechanism this macro uses to acquire may be a function + of architecture, or target specific options used to invoke the + compiler. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/procfs.h b/lib/libc/include/csky-linux-gnueabihf/bits/procfs.h new file mode 100644 index 0000000000..e2da19ccf7 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/procfs.h @@ -0,0 +1,37 @@ +/* Types for registers for sys/procfs.h. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#include + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; +/* Type for a floating-point registers. */ +typedef unsigned long elf_fpreg_t; + +/* In gdb/bfd elf32-csky.c, csky_elf_grok_prstatus() use fixed size of + elf_prstatus. It's 148 for abiv1 and 220 for abiv2, the size is enough + for coredump and no need full sizeof (struct pt_regs). */ +#define ELF_NGREG ((sizeof (struct pt_regs) / sizeof (elf_greg_t)) - 2) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +#define ELF_NFPREG (sizeof (struct user_fp) / sizeof (elf_fpreg_t)) +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/csky-linux-gnueabihf/bits/setjmp.h new file mode 100644 index 0000000000..c0b6623ddc --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/setjmp.h @@ -0,0 +1,34 @@ +/* Define the machine-dependent type `jmp_buf'. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _CSKY_BITS_SETJMP_H +#define _CSKY_BITS_SETJMP_H 1 + +typedef struct __jmp_buf_str + { + /* Stack pointer. */ + int __sp; + int __lr; + /* The actual core defines which registers should be saved. The + buffer contains 32 words, keep space for future growth. + Callee-saved registers: + r4 ~ r11, r16 ~ r17, r26 ~r31 for abiv2; r8 ~ r14 for abiv1. */ + int __regs[32]; + } __jmp_buf[1]; + +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/csky-linux-gnueabihf/bits/shmlba.h new file mode 100644 index 0000000000..15e78caf71 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/shmlba.h @@ -0,0 +1,29 @@ +/* Define SHMLBA. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SHM_H +# error "Never use directly; include instead." +#endif + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize () << 2) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h b/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h new file mode 100644 index 0000000000..94a6e610fb --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + +/* 64-bit libc uses the kernel's 'struct statfs', accessed via the + statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' + and accesses it via the statfs64() syscall. All the various + APIs offered by libc use the kernel shape for their struct statfs + structure; the only difference is that 32-bit programs not + using __USE_FILE_OFFSET64 only see the low 32 bits of some + of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 +# define __field64(type, type64, name) type name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct statfs + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE +#define _STATFS_F_FLAGS \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + Copyright (C) 2019-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +struct __pthread_rwlock_arch_t +{ + unsigned int __readers; + unsigned int __writers; + unsigned int __wrphase_futex; + unsigned int __writers_futex; + unsigned int __pad3; + unsigned int __pad4; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/struct_stat.h b/lib/libc/include/csky-linux-gnueabihf/bits/struct_stat.h new file mode 100644 index 0000000000..0549e9d97f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/struct_stat.h @@ -0,0 +1,127 @@ +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include +#include + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T +# error "ino_t and off_t must both be the same type" +# endif +# define __field64(type, type64, name) type name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct stat + { + __dev_t st_dev; /* Device. */ + __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/typesizes.h b/lib/libc/include/csky-linux-gnueabihf/bits/typesizes.h new file mode 100644 index 0000000000..4156f352ad --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/typesizes.h @@ -0,0 +1,108 @@ +/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ +#if __TIMESIZE == 64 && __WORDSIZE == 32 +/* These are the "new" y2038 types defined for architectures added after + the 5.1 kernel. */ +# define __INO_T_TYPE __UQUAD_TYPE +# define __OFF_T_TYPE __SQUAD_TYPE +# define __RLIM_T_TYPE __UQUAD_TYPE +# define __BLKCNT_T_TYPE __SQUAD_TYPE +# define __FSBLKCNT_T_TYPE __UQUAD_TYPE +# define __FSFILCNT_T_TYPE __UQUAD_TYPE +# define __TIME_T_TYPE __SQUAD_TYPE +# define __SUSECONDS_T_TYPE __SQUAD_TYPE +#else +# define __INO_T_TYPE __ULONGWORD_TYPE +# define __OFF_T_TYPE __SLONGWORD_TYPE +# define __RLIM_T_TYPE __ULONGWORD_TYPE +# define __BLKCNT_T_TYPE __SLONGWORD_TYPE +# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +# define __TIME_T_TYPE __SLONGWORD_TYPE +# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#endif + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __U32_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSWORD_T_TYPE __SWORD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __S32_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE +#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +#define __CPU_MASK_TYPE __ULONGWORD_TYPE + +#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* Same for ino_t and ino64_t. */ +# define __INO_T_MATCHES_INO64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) +#else +# define __RLIM_T_MATCHES_RLIM64_T 0 + +# define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 +#endif + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/fpu_control.h b/lib/libc/include/csky-linux-gnueabihf/fpu_control.h new file mode 100644 index 0000000000..e2ff490723 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/fpu_control.h @@ -0,0 +1,148 @@ +/* FPU control word bits. C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +/* C-SKY FPU floating point control register bits. + + 31-28 -> Reserved (read as 0, write with 0). + 27 -> 0: Flush denormalized results to zero. + 1: Flush denormalized results to signed minimal normal number. + 26 -> Reserved (read as 0, write with 0). + 25-24 -> Rounding control. + 23-6 -> Reserved (read as 0, write with 0). + 5 -> Enable exception for input denormalized exception. + 4 -> Enable exception for inexact exception. + 3 -> Enable exception for underflow exception. + 2 -> Enable exception for overflow exception. + 1 -> Enable exception for division by zero exception. + 0 -> Enable exception for invalid operation exception. + + Rounding Control: + 00 - Rounding to nearest (RN). + 01 - Rounding toward zero (RZ). + 10 - Rounding (up) toward plus infinity (RP). + 11 - Rounding (down)toward minus infinity (RM). + + C-SKY FPU floating point exception status register bits. + + 15 -> Accumulate bit for any exception. + 14 -> Reserved (read as 0, write with 0). + 13 -> Cause bit for input denormalized exception. + 12 -> Cause bit for inexact exception. + 11 -> Cause bit for underflow exception. + 10 -> Cause bit for overflow exception. + 9 -> Cause bit for division by zero exception. + 8 -> Cause bit for invalid operation exception. + 7 -> Flag bit for any exception. + 6 -> Reserved (read as 0, write with 0). + 5 -> Flag exception for input denormalized exception. + 4 -> Flag exception for inexact exception. + 3 -> Flag exception for underflow exception. + 2 -> Flag exception for overflow exception. + 1 -> Flag exception for division by zero exception. + 0 -> Flag exception for invalid operation exception. */ + +#include + +#ifdef __csky_soft_float__ + +# define _FPU_RESERVED 0xffffffff +# define _FPU_DEFAULT 0x00000000 +typedef unsigned int fpu_control_t; +# define _FPU_GETCW(cw) (cw) = 0 +# define _FPU_SETCW(cw) (void) (cw) +# define _FPU_GETFPSR(cw) (cw) = 0 +# define _FPU_SETFPSR(cw) (void) (cw) +extern fpu_control_t __fpu_control; + +#else /* __csky_soft_float__ */ + +/* Masking of interrupts. */ +# define _FPU_MASK_IDE (1 << 5) /* Input denormalized exception. */ +# define _FPU_MASK_IXE (1 << 4) /* Inexact exception. */ +# define _FPU_MASK_UFE (1 << 3) /* Underflow exception. */ +# define _FPU_MASK_OFE (1 << 2) /* Overflow exception. */ +# define _FPU_MASK_DZE (1 << 1) /* Division by zero exception. */ +# define _FPU_MASK_IOE (1 << 0) /* Invalid operation exception. */ + +# define _FPU_MASK_FEA (1 << 15) /* Case for any exception. */ +# define _FPU_MASK_FEC (1 << 7) /* Flag for any exception. */ + +/* Flush denormalized numbers to zero. */ +# define _FPU_FLUSH_TZ 0x8000000 + +/* Rounding control. */ +# define _FPU_RC_NEAREST (0x0 << 24) /* RECOMMENDED. */ +# define _FPU_RC_ZERO (0x1 << 24) +# define _FPU_RC_UP (0x2 << 24) +# define _FPU_RC_DOWN (0x3 << 24) + +# define _FPU_RESERVED 0xf460ffc0 /* Reserved bits in cw. */ +# define _FPU_FPSR_RESERVED 0xffff4040 + +/* The fdlibm code requires strict IEEE double precision arithmetic, + and no interrupts for exceptions, rounding to nearest. */ + +# define _FPU_DEFAULT 0x00000000 +# define _FPU_FPSR_DEFAULT 0x00000000 + +/* IEEE: same as above, but exceptions. */ +# define _FPU_FPCR_IEEE 0x0000001F +# define _FPU_FPSR_IEEE 0x00000000 + +/* Type of the control word. */ +typedef unsigned int fpu_control_t; + +/* Macros for accessing the hardware control word. */ +# if (__CSKY__ == 2) +# define _FPU_GETCW(cw) __asm__ volatile ("mfcr %0, cr<1, 2>" : "=a" (cw)) +# define _FPU_SETCW(cw) __asm__ volatile ("mtcr %0, cr<1, 2>" : : "a" (cw)) +# define _FPU_GETFPSR(cw) __asm__ volatile ("mfcr %0, cr<2, 2>" : "=a" (cw)) +# define _FPU_SETFPSR(cw) __asm__ volatile ("mtcr %0, cr<2, 2>" : : "a" (cw)) +# else +# define _FPU_GETCW(cw) __asm__ volatile ("1: cprcr %0, cpcr2 \n" \ + " btsti %0, 31 \n" \ + " bt 1b \n" \ + " cprcr %0, cpcr1\n" : "=b" (cw)) + +# define _FPU_SETCW(cw) __asm__ volatile ("1: cprcr r7, cpcr2 \n" \ + " btsti r7, 31 \n" \ + " bt 1b \n" \ + " cpwcr %0, cpcr1 \n" \ + : : "b" (cw) : "r7") + +# define _FPU_GETFPSR(cw) __asm__ volatile ("1: cprcr %0, cpcr2 \n" \ + " btsti %0, 31 \n" \ + " bt 1b \n" \ + " cprcr %0, cpcr4\n" : "=b" (cw)) + +# define _FPU_SETFPSR(cw) __asm__ volatile ("1: cprcr r7, cpcr2 \n" \ + " btsti r7, 31 \n" \ + " bt 1b \n" \ + " cpwcr %0, cpcr4 \n" \ + : : "b" (cw) : "r7") +# endif /* __CSKY__ != 2 */ + +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; + +#endif /* !__csky_soft_float__ */ + +#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h b/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h new file mode 100644 index 0000000000..a2d4ba2f42 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h @@ -0,0 +1,32 @@ +/* This file is automatically generated. + It defines macros to allow user program to find the shared + library files which come as part of GNU libc. */ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#define LD_LINUX_CSKYV2_HF_SO "ld-linux-cskyv2-hf.so.1" +#define LD_SO "ld-linux-cskyv2-hf.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" + +#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/gnu/stubs.h b/lib/libc/include/csky-linux-gnueabihf/gnu/stubs.h new file mode 100644 index 0000000000..4c2911dd6d --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/gnu/stubs.h @@ -0,0 +1,21 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/sys/cachectl.h b/lib/libc/include/csky-linux-gnueabihf/sys/cachectl.h new file mode 100644 index 0000000000..d3a06ce16e --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/sys/cachectl.h @@ -0,0 +1,36 @@ +/* C-SKY cache flushing interface. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* Get the kernel definition for the op bits. */ +#include + +__BEGIN_DECLS + +#ifdef __USE_MISC +extern int cacheflush (void *__addr, const int __nbytes, + const int __op) __THROW; +#endif + +__END_DECLS + +#endif /* sys/cachectl.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/csky-linux-gnueabihf/sys/ucontext.h new file mode 100644 index 0000000000..afce26d796 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/sys/ucontext.h @@ -0,0 +1,89 @@ +/* struct ucontext definition, C-SKY version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include + +typedef struct + { + unsigned long __tls; + unsigned long __lr; + unsigned long __pc; + unsigned long __sr; + unsigned long __usp; + + /* + * a0, a1, a2, a3: + * abiv1: r2, r3, r4, r5 + * abiv2: r0, r1, r2, r3 + */ + + unsigned long __orig_a0; + unsigned long __a0; + unsigned long __a1; + unsigned long __a2; + unsigned long __a3; + + /* + * ABIV2: r4 ~ r13 + */ + unsigned long __regs[10]; + + /* r16 ~ r30 */ + unsigned long __exregs[15]; + + unsigned long __rhi; + unsigned long __rlo; + unsigned long __glibc_reserved; + } gregset_t; + +typedef struct + { + unsigned long __vr[64]; + unsigned long __fcr; + unsigned long __fesr; + unsigned long __fid; + unsigned long __glibc_reserved; + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __gregs; + fpregset_t __fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __uc_flags; + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + } ucontext_t; + +#undef __ctx + + +#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/sys/user.h b/lib/libc/include/csky-linux-gnueabihf/sys/user.h new file mode 100644 index 0000000000..c0d07c7883 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/sys/user.h @@ -0,0 +1,23 @@ +/* This file is not used by C-SKY GDB. ptrace can use pt_regs definition + from linux kernel directly. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/aio.h b/lib/libc/include/generic-glibc/aio.h index 7028917727..9ffd31d991 100644 --- a/lib/libc/include/generic-glibc/aio.h +++ b/lib/libc/include/generic-glibc/aio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,7 +33,7 @@ __BEGIN_DECLS /* Asynchronous I/O control block. */ struct aiocb { - int aio_fildes; /* File desriptor. */ + int aio_fildes; /* File descriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ @@ -61,7 +61,7 @@ struct aiocb #ifdef __USE_LARGEFILE64 struct aiocb64 { - int aio_fildes; /* File desriptor. */ + int aio_fildes; /* File descriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ @@ -82,12 +82,11 @@ struct aiocb64 #ifdef __USE_GNU -/* To customize the implementation one can use the following struct. - This implementation follows the one in Irix. */ +/* To optimize the implementation one can use the following struct. */ struct aioinit { - int aio_threads; /* Maximal number of threads. */ - int aio_num; /* Number of expected simultanious requests. */ + int aio_threads; /* Maximum number of threads. */ + int aio_num; /* Number of expected simultaneous requests. */ int aio_locks; /* Not used. */ int aio_usedba; /* Not used. */ int aio_debug; /* Not used. */ @@ -99,7 +98,7 @@ struct aioinit #endif -/* Return values of cancelation function. */ +/* Return values of the aio_cancel function. */ enum { AIO_CANCELED, diff --git a/lib/libc/include/generic-glibc/aliases.h b/lib/libc/include/generic-glibc/aliases.h index ead8562ace..28a60fd59c 100644 --- a/lib/libc/include/generic-glibc/aliases.h +++ b/lib/libc/include/generic-glibc/aliases.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ __BEGIN_DECLS -/* Structure to represent one entry of the alias data base. */ +/* Structure to represent one entry of the alias database. */ struct aliasent { char *alias_name; @@ -38,13 +38,13 @@ struct aliasent /* Open alias data base files. */ extern void setaliasent (void) __THROW; -/* Close alias data base files. */ +/* Close alias database files. */ extern void endaliasent (void) __THROW; -/* Get the next entry from the alias data base. */ +/* Get the next entry from the alias database. */ extern struct aliasent *getaliasent (void) __THROW; -/* Get the next entry from the alias data base and put it in RESULT_BUF. */ +/* Get the next entry from the alias database and put it in RESULT_BUF. */ extern int getaliasent_r (struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) __THROW; diff --git a/lib/libc/include/generic-glibc/alloca.h b/lib/libc/include/generic-glibc/alloca.h index 9e8a986743..04189d469c 100644 --- a/lib/libc/include/generic-glibc/alloca.h +++ b/lib/libc/include/generic-glibc/alloca.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ __BEGIN_DECLS -/* Remove any previous definitions. */ +/* Remove any previous definition. */ #undef alloca /* Allocate a block that will be freed when the calling function exits. */ diff --git a/lib/libc/include/generic-glibc/ar.h b/lib/libc/include/generic-glibc/ar.h index 5accd0cf2d..24cd9d81bf 100644 --- a/lib/libc/include/generic-glibc/ar.h +++ b/lib/libc/include/generic-glibc/ar.h @@ -1,5 +1,5 @@ /* Header describing `ar' archive file format. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/argp.h b/lib/libc/include/generic-glibc/argp.h index 8101648163..a34f4ef623 100644 --- a/lib/libc/include/generic-glibc/argp.h +++ b/lib/libc/include/generic-glibc/argp.h @@ -1,5 +1,5 @@ -/* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Hierarchical argument parsing, layered over getopt. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -233,7 +233,7 @@ struct argp }; /* Possible KEY arguments to a help filter function. */ -#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ +#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; @@ -447,7 +447,7 @@ extern void __argp_help (const struct argp *__restrict __argp, parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for - them *not* to exit, and should return an appropiate error after calling + them *not* to exit, and should return an appropriate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ diff --git a/lib/libc/include/generic-glibc/argz.h b/lib/libc/include/generic-glibc/argz.h index d7a265c2a5..267c9aeb78 100644 --- a/lib/libc/include/generic-glibc/argz.h +++ b/lib/libc/include/generic-glibc/argz.h @@ -1,5 +1,5 @@ /* Routines for dealing with '\0' separated arg vectors. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/arpa/inet.h b/lib/libc/include/generic-glibc/arpa/inet.h index 7b83e763cc..4a6afd6da9 100644 --- a/lib/libc/include/generic-glibc/arpa/inet.h +++ b/lib/libc/include/generic-glibc/arpa/inet.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/assert.h b/lib/libc/include/generic-glibc/assert.h index 14aa2f9e21..f7ad8b710e 100644 --- a/lib/libc/include/generic-glibc/assert.h +++ b/lib/libc/include/generic-glibc/assert.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/argp-ldbl.h b/lib/libc/include/generic-glibc/bits/argp-ldbl.h index 2cf222648f..cf7a32117f 100644 --- a/lib/libc/include/generic-glibc/bits/argp-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/argp-ldbl.h @@ -1,5 +1,5 @@ /* Redirections for argp functions for -mlong-double-64. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/byteswap.h b/lib/libc/include/generic-glibc/bits/byteswap.h index 2c854c625a..70b22672af 100644 --- a/lib/libc/include/generic-glibc/bits/byteswap.h +++ b/lib/libc/include/generic-glibc/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros and inline functions to swap the order of bytes in integer values. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/cmathcalls.h b/lib/libc/include/generic-glibc/bits/cmathcalls.h index ed604e0fda..28d82b0960 100644 --- a/lib/libc/include/generic-glibc/bits/cmathcalls.h +++ b/lib/libc/include/generic-glibc/bits/cmathcalls.h @@ -1,6 +1,6 @@ /* Prototype declarations for complex math functions; helper file for . - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/confname.h b/lib/libc/include/generic-glibc/bits/confname.h index 710a92730f..b6bcdd460d 100644 --- a/lib/libc/include/generic-glibc/bits/confname.h +++ b/lib/libc/include/generic-glibc/bits/confname.h @@ -1,5 +1,5 @@ /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/cpu-set.h b/lib/libc/include/generic-glibc/bits/cpu-set.h index a8bd65bae1..b90b3089fc 100644 --- a/lib/libc/include/generic-glibc/bits/cpu-set.h +++ b/lib/libc/include/generic-glibc/bits/cpu-set.h @@ -1,6 +1,6 @@ /* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/dirent.h b/lib/libc/include/generic-glibc/bits/dirent.h index a18b453fd3..a5ade18b86 100644 --- a/lib/libc/include/generic-glibc/bits/dirent.h +++ b/lib/libc/include/generic-glibc/bits/dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/dirent_ext.h b/lib/libc/include/generic-glibc/bits/dirent_ext.h index f5c3fb34fd..50c8bd123a 100644 --- a/lib/libc/include/generic-glibc/bits/dirent_ext.h +++ b/lib/libc/include/generic-glibc/bits/dirent_ext.h @@ -1,5 +1,5 @@ /* System-specific extensions of . Linux version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/dlfcn.h b/lib/libc/include/generic-glibc/bits/dlfcn.h index 8339ace845..02487a2de7 100644 --- a/lib/libc/include/generic-glibc/bits/dlfcn.h +++ b/lib/libc/include/generic-glibc/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/endian.h b/lib/libc/include/generic-glibc/bits/endian.h index dae5221e81..926d47b869 100644 --- a/lib/libc/include/generic-glibc/bits/endian.h +++ b/lib/libc/include/generic-glibc/bits/endian.h @@ -1,5 +1,5 @@ /* Endian macros for string.h functions - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/environments.h b/lib/libc/include/generic-glibc/bits/environments.h index 1b5e74a08e..0cd2b0dd2e 100644 --- a/lib/libc/include/generic-glibc/bits/environments.h +++ b/lib/libc/include/generic-glibc/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/epoll.h b/lib/libc/include/generic-glibc/bits/epoll.h index 6d92d7ce11..32e2f7c379 100644 --- a/lib/libc/include/generic-glibc/bits/epoll.h +++ b/lib/libc/include/generic-glibc/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/err-ldbl.h b/lib/libc/include/generic-glibc/bits/err-ldbl.h index 7c928e438b..165399078d 100644 --- a/lib/libc/include/generic-glibc/bits/err-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/err-ldbl.h @@ -1,5 +1,5 @@ /* Redirections for err.h functions for -mlong-double-64. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/errno.h b/lib/libc/include/generic-glibc/bits/errno.h index 1bee63136a..5129d4d927 100644 --- a/lib/libc/include/generic-glibc/bits/errno.h +++ b/lib/libc/include/generic-glibc/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/error-ldbl.h b/lib/libc/include/generic-glibc/bits/error-ldbl.h index 9962b3226e..1514bd77f5 100644 --- a/lib/libc/include/generic-glibc/bits/error-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/error-ldbl.h @@ -1,5 +1,5 @@ /* Redirections for error.h functions for -mlong-double-64. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/error.h b/lib/libc/include/generic-glibc/bits/error.h index 3189e24da8..fe5e0ebeed 100644 --- a/lib/libc/include/generic-glibc/bits/error.h +++ b/lib/libc/include/generic-glibc/bits/error.h @@ -1,5 +1,5 @@ /* Specializations for error functions. - Copyright (C) 2007-2020 Free Software Foundation, Inc. + Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/eventfd.h b/lib/libc/include/generic-glibc/bits/eventfd.h index 0fb055c37c..7b6538dff9 100644 --- a/lib/libc/include/generic-glibc/bits/eventfd.h +++ b/lib/libc/include/generic-glibc/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fcntl-linux.h b/lib/libc/include/generic-glibc/bits/fcntl-linux.h index 14d7e72f01..ededca4eb2 100644 --- a/lib/libc/include/generic-glibc/bits/fcntl-linux.h +++ b/lib/libc/include/generic-glibc/bits/fcntl-linux.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fcntl.h b/lib/libc/include/generic-glibc/bits/fcntl.h index b9fa29e200..ba82a90a59 100644 --- a/lib/libc/include/generic-glibc/bits/fcntl.h +++ b/lib/libc/include/generic-glibc/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fcntl2.h b/lib/libc/include/generic-glibc/bits/fcntl2.h index 800012c354..1e5e2d6a5f 100644 --- a/lib/libc/include/generic-glibc/bits/fcntl2.h +++ b/lib/libc/include/generic-glibc/bits/fcntl2.h @@ -1,5 +1,5 @@ /* Checking macros for fcntl functions. - Copyright (C) 2007-2020 Free Software Foundation, Inc. + Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fenv.h b/lib/libc/include/generic-glibc/bits/fenv.h index cdf79211de..d99c7da1c0 100644 --- a/lib/libc/include/generic-glibc/bits/fenv.h +++ b/lib/libc/include/generic-glibc/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/floatn-common.h b/lib/libc/include/generic-glibc/bits/floatn-common.h index 9cccf45064..7432380a23 100644 --- a/lib/libc/include/generic-glibc/bits/floatn-common.h +++ b/lib/libc/include/generic-glibc/bits/floatn-common.h @@ -1,6 +1,6 @@ /* Macros to control TS 18661-3 glibc features where the same definitions are appropriate for all platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/floatn.h b/lib/libc/include/generic-glibc/bits/floatn.h index a4045e43a3..0b1b5d444d 100644 --- a/lib/libc/include/generic-glibc/bits/floatn.h +++ b/lib/libc/include/generic-glibc/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on ldbl-128 platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/flt-eval-method.h b/lib/libc/include/generic-glibc/bits/flt-eval-method.h index 11297d9c17..671c39a3ba 100644 --- a/lib/libc/include/generic-glibc/bits/flt-eval-method.h +++ b/lib/libc/include/generic-glibc/bits/flt-eval-method.h @@ -1,5 +1,5 @@ /* Define __GLIBC_FLT_EVAL_METHOD. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fp-fast.h b/lib/libc/include/generic-glibc/bits/fp-fast.h index 5fceb7e29a..b06a22fc8b 100644 --- a/lib/libc/include/generic-glibc/bits/fp-fast.h +++ b/lib/libc/include/generic-glibc/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/fp-logb.h b/lib/libc/include/generic-glibc/bits/fp-logb.h index efc488bc27..bcb800097d 100644 --- a/lib/libc/include/generic-glibc/bits/fp-logb.h +++ b/lib/libc/include/generic-glibc/bits/fp-logb.h @@ -1,5 +1,5 @@ /* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/getopt_core.h b/lib/libc/include/generic-glibc/bits/getopt_core.h index c509e0e328..d681779d99 100644 --- a/lib/libc/include/generic-glibc/bits/getopt_core.h +++ b/lib/libc/include/generic-glibc/bits/getopt_core.h @@ -1,5 +1,5 @@ /* Declarations for getopt (basic, portable features only). - Copyright (C) 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/libc/include/generic-glibc/bits/getopt_ext.h b/lib/libc/include/generic-glibc/bits/getopt_ext.h index 7d6a578db9..01a5991464 100644 --- a/lib/libc/include/generic-glibc/bits/getopt_ext.h +++ b/lib/libc/include/generic-glibc/bits/getopt_ext.h @@ -1,5 +1,5 @@ /* Declarations for getopt (GNU extensions). - Copyright (C) 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. diff --git a/lib/libc/include/generic-glibc/bits/getopt_posix.h b/lib/libc/include/generic-glibc/bits/getopt_posix.h index 322dc96daf..af5764650b 100644 --- a/lib/libc/include/generic-glibc/bits/getopt_posix.h +++ b/lib/libc/include/generic-glibc/bits/getopt_posix.h @@ -1,5 +1,5 @@ /* Declarations for getopt (POSIX compatibility shim). - Copyright (C) 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1989-2021 Free Software Foundation, Inc. Unlike the bulk of the getopt implementation, this file is NOT part of gnulib. diff --git a/lib/libc/include/generic-glibc/bits/hwcap.h b/lib/libc/include/generic-glibc/bits/hwcap.h index 0d01bf6514..9e621f83de 100644 --- a/lib/libc/include/generic-glibc/bits/hwcap.h +++ b/lib/libc/include/generic-glibc/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/in.h b/lib/libc/include/generic-glibc/bits/in.h index 654c5adabe..316fd888d9 100644 --- a/lib/libc/include/generic-glibc/bits/in.h +++ b/lib/libc/include/generic-glibc/bits/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -102,6 +102,7 @@ #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 #define IP_RECVFRAGSIZE 25 +#define IP_RECVERR_RFC4884 26 /* IP_MTU_DISCOVER arguments. */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ @@ -193,6 +194,7 @@ struct in_pktinfo #define IPV6_LEAVE_ANYCAST 28 #define IPV6_MULTICAST_ALL 29 #define IPV6_ROUTER_ALERT_ISOLATE 30 +#define IPV6_RECVERR_RFC4884 31 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_HDRINCL 36 diff --git a/lib/libc/include/generic-glibc/bits/indirect-return.h b/lib/libc/include/generic-glibc/bits/indirect-return.h index 5a7beddda9..d6112e6fe1 100644 --- a/lib/libc/include/generic-glibc/bits/indirect-return.h +++ b/lib/libc/include/generic-glibc/bits/indirect-return.h @@ -1,5 +1,5 @@ /* Definition of __INDIRECT_RETURN. Generic version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/inotify.h b/lib/libc/include/generic-glibc/bits/inotify.h index e019e25212..167d55beb4 100644 --- a/lib/libc/include/generic-glibc/bits/inotify.h +++ b/lib/libc/include/generic-glibc/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ioctl-types.h b/lib/libc/include/generic-glibc/bits/ioctl-types.h index 876311a6ce..312ec1c125 100644 --- a/lib/libc/include/generic-glibc/bits/ioctl-types.h +++ b/lib/libc/include/generic-glibc/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ioctls.h b/lib/libc/include/generic-glibc/bits/ioctls.h index 790e50b7fa..9b604b9c48 100644 --- a/lib/libc/include/generic-glibc/bits/ioctls.h +++ b/lib/libc/include/generic-glibc/bits/ioctls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ipc-perm.h b/lib/libc/include/generic-glibc/bits/ipc-perm.h index 295a0ea3cf..eed58f2ff6 100644 --- a/lib/libc/include/generic-glibc/bits/ipc-perm.h +++ b/lib/libc/include/generic-glibc/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ipc.h b/lib/libc/include/generic-glibc/bits/ipc.h index 714f766b29..0681d1a86e 100644 --- a/lib/libc/include/generic-glibc/bits/ipc.h +++ b/lib/libc/include/generic-glibc/bits/ipc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ipctypes.h b/lib/libc/include/generic-glibc/bits/ipctypes.h index 2fce70dab0..1c913e88f5 100644 --- a/lib/libc/include/generic-glibc/bits/ipctypes.h +++ b/lib/libc/include/generic-glibc/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Generic. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/iscanonical.h b/lib/libc/include/generic-glibc/bits/iscanonical.h index 446a24d01b..2a97d3cdd8 100644 --- a/lib/libc/include/generic-glibc/bits/iscanonical.h +++ b/lib/libc/include/generic-glibc/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/libc-header-start.h b/lib/libc/include/generic-glibc/bits/libc-header-start.h index ddc705f0f2..402725f4b2 100644 --- a/lib/libc/include/generic-glibc/bits/libc-header-start.h +++ b/lib/libc/include/generic-glibc/bits/libc-header-start.h @@ -1,5 +1,5 @@ /* Handle feature test macros at the start of a header. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h index f49d3ddb62..f5fe338a6a 100644 --- a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h +++ b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h @@ -1,5 +1,5 @@ /* Empty definitions required for __MATHCALL_VEC unfolding in mathcalls.h. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/link.h b/lib/libc/include/generic-glibc/bits/link.h index 9fc3255bf9..ab974d6a47 100644 --- a/lib/libc/include/generic-glibc/bits/link.h +++ b/lib/libc/include/generic-glibc/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/local_lim.h b/lib/libc/include/generic-glibc/bits/local_lim.h index c29492034c..af2e6b3471 100644 --- a/lib/libc/include/generic-glibc/bits/local_lim.h +++ b/lib/libc/include/generic-glibc/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/locale.h b/lib/libc/include/generic-glibc/bits/locale.h index e2b34ee888..5ab3184a2a 100644 --- a/lib/libc/include/generic-glibc/bits/locale.h +++ b/lib/libc/include/generic-glibc/bits/locale.h @@ -1,5 +1,5 @@ /* Definition of locale category symbol values. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/long-double.h b/lib/libc/include/generic-glibc/bits/long-double.h index 2ce9aaebd9..93a6e96059 100644 --- a/lib/libc/include/generic-glibc/bits/long-double.h +++ b/lib/libc/include/generic-glibc/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. MIPS version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/math-vector.h b/lib/libc/include/generic-glibc/bits/math-vector.h index da37ee7bff..c817f744da 100644 --- a/lib/libc/include/generic-glibc/bits/math-vector.h +++ b/lib/libc/include/generic-glibc/bits/math-vector.h @@ -1,5 +1,5 @@ /* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mathcalls-helper-functions.h b/lib/libc/include/generic-glibc/bits/mathcalls-helper-functions.h index 29808be75a..01fc8eb212 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls-helper-functions.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls-helper-functions.h @@ -1,5 +1,5 @@ /* Prototype declarations for math classification macros helpers. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mathcalls-narrow.h b/lib/libc/include/generic-glibc/bits/mathcalls-narrow.h index 6943772db8..27a7987604 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls-narrow.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls-narrow.h @@ -1,5 +1,5 @@ /* Declare functions returning a narrower type. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mathcalls.h b/lib/libc/include/generic-glibc/bits/mathcalls.h index 28d936113e..61796cb512 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls.h @@ -1,5 +1,5 @@ /* Prototype declarations for math functions; helper file for . - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mathdef.h b/lib/libc/include/generic-glibc/bits/mathdef.h index 2b43561f9f..f73024e1ff 100644 --- a/lib/libc/include/generic-glibc/bits/mathdef.h +++ b/lib/libc/include/generic-glibc/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mman-linux.h b/lib/libc/include/generic-glibc/bits/mman-linux.h index a97f10212b..209a8678d5 100644 --- a/lib/libc/include/generic-glibc/bits/mman-linux.h +++ b/lib/libc/include/generic-glibc/bits/mman-linux.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux generic version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mman-map-flags-generic.h b/lib/libc/include/generic-glibc/bits/mman-map-flags-generic.h index 0cd335bd8c..0b07c14a77 100644 --- a/lib/libc/include/generic-glibc/bits/mman-map-flags-generic.h +++ b/lib/libc/include/generic-glibc/bits/mman-map-flags-generic.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/generic version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mman-shared.h b/lib/libc/include/generic-glibc/bits/mman-shared.h index 45862663e3..5f2d11b307 100644 --- a/lib/libc/include/generic-glibc/bits/mman-shared.h +++ b/lib/libc/include/generic-glibc/bits/mman-shared.h @@ -1,5 +1,5 @@ /* Memory-mapping-related declarations/definitions, not architecture-specific. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mman.h b/lib/libc/include/generic-glibc/bits/mman.h index dc24c1d773..0eefbf5fb5 100644 --- a/lib/libc/include/generic-glibc/bits/mman.h +++ b/lib/libc/include/generic-glibc/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/generic version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/monetary-ldbl.h b/lib/libc/include/generic-glibc/bits/monetary-ldbl.h index 9942df4357..312338cb02 100644 --- a/lib/libc/include/generic-glibc/bits/monetary-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/monetary-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for monetary functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mqueue.h b/lib/libc/include/generic-glibc/bits/mqueue.h index 67b62ab802..87ef1ccf9a 100644 --- a/lib/libc/include/generic-glibc/bits/mqueue.h +++ b/lib/libc/include/generic-glibc/bits/mqueue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/mqueue2.h b/lib/libc/include/generic-glibc/bits/mqueue2.h index b621163449..63f84158e2 100644 --- a/lib/libc/include/generic-glibc/bits/mqueue2.h +++ b/lib/libc/include/generic-glibc/bits/mqueue2.h @@ -1,5 +1,5 @@ /* Checking macros for mq functions. - Copyright (C) 2007-2020 Free Software Foundation, Inc. + Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/msq.h b/lib/libc/include/generic-glibc/bits/msq.h index 7c8dba0eca..f770dba088 100644 --- a/lib/libc/include/generic-glibc/bits/msq.h +++ b/lib/libc/include/generic-glibc/bits/msq.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/netdb.h b/lib/libc/include/generic-glibc/bits/netdb.h index 58ecfd8814..9bb0a26493 100644 --- a/lib/libc/include/generic-glibc/bits/netdb.h +++ b/lib/libc/include/generic-glibc/bits/netdb.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/param.h b/lib/libc/include/generic-glibc/bits/param.h index c206eb422a..77a458a394 100644 --- a/lib/libc/include/generic-glibc/bits/param.h +++ b/lib/libc/include/generic-glibc/bits/param.h @@ -1,5 +1,5 @@ /* Old-style Unix parameters and limits. Linux version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/poll.h b/lib/libc/include/generic-glibc/bits/poll.h index 2a83587069..bcfddcac4d 100644 --- a/lib/libc/include/generic-glibc/bits/poll.h +++ b/lib/libc/include/generic-glibc/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/poll2.h b/lib/libc/include/generic-glibc/bits/poll2.h index 5306616d95..b7b5ca466c 100644 --- a/lib/libc/include/generic-glibc/bits/poll2.h +++ b/lib/libc/include/generic-glibc/bits/poll2.h @@ -1,5 +1,5 @@ /* Checking macros for poll functions. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,12 +35,13 @@ extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, __fortify_function int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) { - if (__bos (__fds) != (__SIZE_TYPE__) -1) + if (__glibc_objsize (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) - return __poll_chk (__fds, __nfds, __timeout, __bos (__fds)); - else if (__bos (__fds) / sizeof (*__fds) < __nfds) - return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds)); + return __poll_chk (__fds, __nfds, __timeout, __glibc_objsize (__fds)); + else if (__glibc_objsize (__fds) / sizeof (*__fds) < __nfds) + return __poll_chk_warn (__fds, __nfds, __timeout, + __glibc_objsize (__fds)); } return __poll_alias (__fds, __nfds, __timeout); @@ -65,13 +66,14 @@ __fortify_function int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss) { - if (__bos (__fds) != (__SIZE_TYPE__) -1) + if (__glibc_objsize (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) - return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); - else if (__bos (__fds) / sizeof (*__fds) < __nfds) + return __ppoll_chk (__fds, __nfds, __timeout, __ss, + __glibc_objsize (__fds)); + else if (__glibc_objsize (__fds) / sizeof (*__fds) < __nfds) return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss, - __bos (__fds)); + __glibc_objsize (__fds)); } return __ppoll_alias (__fds, __nfds, __timeout, __ss); diff --git a/lib/libc/include/generic-glibc/bits/posix1_lim.h b/lib/libc/include/generic-glibc/bits/posix1_lim.h index d4eae0536a..a6a8178b01 100644 --- a/lib/libc/include/generic-glibc/bits/posix1_lim.h +++ b/lib/libc/include/generic-glibc/bits/posix1_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/posix2_lim.h b/lib/libc/include/generic-glibc/bits/posix2_lim.h index 35e658e6a8..259ba04141 100644 --- a/lib/libc/include/generic-glibc/bits/posix2_lim.h +++ b/lib/libc/include/generic-glibc/bits/posix2_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/posix_opt.h b/lib/libc/include/generic-glibc/bits/posix_opt.h index e81fe4a14f..14338737d8 100644 --- a/lib/libc/include/generic-glibc/bits/posix_opt.h +++ b/lib/libc/include/generic-glibc/bits/posix_opt.h @@ -1,5 +1,5 @@ /* Define POSIX options for Linux. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ppc.h b/lib/libc/include/generic-glibc/bits/ppc.h index b2fe880d1f..f2cf29b94c 100644 --- a/lib/libc/include/generic-glibc/bits/ppc.h +++ b/lib/libc/include/generic-glibc/bits/ppc.h @@ -1,5 +1,5 @@ /* Facilities specific to the PowerPC architecture on Linux - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/printf-ldbl.h b/lib/libc/include/generic-glibc/bits/printf-ldbl.h index 98af417aa3..bbcd0facb3 100644 --- a/lib/libc/include/generic-glibc/bits/printf-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/printf-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/procfs-extra.h b/lib/libc/include/generic-glibc/bits/procfs-extra.h index 732fafb83e..e22e0c3277 100644 --- a/lib/libc/include/generic-glibc/bits/procfs-extra.h +++ b/lib/libc/include/generic-glibc/bits/procfs-extra.h @@ -1,5 +1,5 @@ /* Extra sys/procfs.h definitions. Generic Linux version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/bits/procfs-id.h b/lib/libc/include/generic-glibc/bits/procfs-id.h index 38906b6303..898230c97d 100644 --- a/lib/libc/include/generic-glibc/bits/procfs-id.h +++ b/lib/libc/include/generic-glibc/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. Generic Linux version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/bits/procfs-prregset.h b/lib/libc/include/generic-glibc/bits/procfs-prregset.h index 310acb9290..10f855a560 100644 --- a/lib/libc/include/generic-glibc/bits/procfs-prregset.h +++ b/lib/libc/include/generic-glibc/bits/procfs-prregset.h @@ -1,5 +1,5 @@ /* Types of prgregset_t and prfpregset_t. Generic Linux version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/bits/procfs.h b/lib/libc/include/generic-glibc/bits/procfs.h index 66a5f6726b..d309e36489 100644 --- a/lib/libc/include/generic-glibc/bits/procfs.h +++ b/lib/libc/include/generic-glibc/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. MIPS version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/pthreadtypes-arch.h b/lib/libc/include/generic-glibc/bits/pthreadtypes-arch.h index 549deac37b..645c708f13 100644 --- a/lib/libc/include/generic-glibc/bits/pthreadtypes-arch.h +++ b/lib/libc/include/generic-glibc/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. Generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/bits/pthreadtypes.h b/lib/libc/include/generic-glibc/bits/pthreadtypes.h index 7125b6aeb4..0f8308ca31 100644 --- a/lib/libc/include/generic-glibc/bits/pthreadtypes.h +++ b/lib/libc/include/generic-glibc/bits/pthreadtypes.h @@ -1,5 +1,5 @@ /* Declaration of common pthread types for all architectures. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ptrace-shared.h b/lib/libc/include/generic-glibc/bits/ptrace-shared.h index 3b729fc7e4..19b127b7e1 100644 --- a/lib/libc/include/generic-glibc/bits/ptrace-shared.h +++ b/lib/libc/include/generic-glibc/bits/ptrace-shared.h @@ -1,6 +1,6 @@ /* `ptrace' debugger support interface. Linux version, not architecture-specific. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/bits/resource.h b/lib/libc/include/generic-glibc/bits/resource.h index f5b55f6a7c..613360fe29 100644 --- a/lib/libc/include/generic-glibc/bits/resource.h +++ b/lib/libc/include/generic-glibc/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sched.h b/lib/libc/include/generic-glibc/bits/sched.h index fb1f1b5971..41bf119703 100644 --- a/lib/libc/include/generic-glibc/bits/sched.h +++ b/lib/libc/include/generic-glibc/bits/sched.h @@ -1,6 +1,6 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/select.h b/lib/libc/include/generic-glibc/bits/select.h index d71b5e4ce2..f2581c2045 100644 --- a/lib/libc/include/generic-glibc/bits/select.h +++ b/lib/libc/include/generic-glibc/bits/select.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/select2.h b/lib/libc/include/generic-glibc/bits/select2.h index 052223de2d..53d894ceb0 100644 --- a/lib/libc/include/generic-glibc/bits/select2.h +++ b/lib/libc/include/generic-glibc/bits/select2.h @@ -1,5 +1,5 @@ /* Checking macros for select functions. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sem.h b/lib/libc/include/generic-glibc/bits/sem.h index 67c394015a..9189fceda4 100644 --- a/lib/libc/include/generic-glibc/bits/sem.h +++ b/lib/libc/include/generic-glibc/bits/sem.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/semaphore.h b/lib/libc/include/generic-glibc/bits/semaphore.h index 97292723c8..5524131756 100644 --- a/lib/libc/include/generic-glibc/bits/semaphore.h +++ b/lib/libc/include/generic-glibc/bits/semaphore.h @@ -1,5 +1,5 @@ /* Generic POSIX semaphore type layout - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/setjmp.h b/lib/libc/include/generic-glibc/bits/setjmp.h index 7fefe88f62..1eba8c81fa 100644 --- a/lib/libc/include/generic-glibc/bits/setjmp.h +++ b/lib/libc/include/generic-glibc/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. MIPS version. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/setjmp2.h b/lib/libc/include/generic-glibc/bits/setjmp2.h index ba46b5ad27..a0dbc65c28 100644 --- a/lib/libc/include/generic-glibc/bits/setjmp2.h +++ b/lib/libc/include/generic-glibc/bits/setjmp2.h @@ -1,5 +1,5 @@ /* Checking macros for setjmp functions. - Copyright (C) 2009-2020 Free Software Foundation, Inc. + Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/shm.h b/lib/libc/include/generic-glibc/bits/shm.h index e5de42e2ab..56d36a3d66 100644 --- a/lib/libc/include/generic-glibc/bits/shm.h +++ b/lib/libc/include/generic-glibc/bits/shm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/shmlba.h b/lib/libc/include/generic-glibc/bits/shmlba.h index 796377719d..1519a2965c 100644 --- a/lib/libc/include/generic-glibc/bits/shmlba.h +++ b/lib/libc/include/generic-glibc/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. Generic version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sigaction.h b/lib/libc/include/generic-glibc/bits/sigaction.h index 33e922806f..c568105691 100644 --- a/lib/libc/include/generic-glibc/bits/sigaction.h +++ b/lib/libc/include/generic-glibc/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sigcontext.h b/lib/libc/include/generic-glibc/bits/sigcontext.h index 4496148619..b10a18865f 100644 --- a/lib/libc/include/generic-glibc/bits/sigcontext.h +++ b/lib/libc/include/generic-glibc/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sigevent-consts.h b/lib/libc/include/generic-glibc/bits/sigevent-consts.h index af2d93c491..5b2041601f 100644 --- a/lib/libc/include/generic-glibc/bits/sigevent-consts.h +++ b/lib/libc/include/generic-glibc/bits/sigevent-consts.h @@ -1,5 +1,5 @@ /* sigevent constants. Linux version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/siginfo-consts.h b/lib/libc/include/generic-glibc/bits/siginfo-consts.h index c3ce77428b..d7f1c8feb2 100644 --- a/lib/libc/include/generic-glibc/bits/siginfo-consts.h +++ b/lib/libc/include/generic-glibc/bits/siginfo-consts.h @@ -1,5 +1,5 @@ /* siginfo constants. Linux version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -130,8 +130,12 @@ enum # define SEGV_ACCADI SEGV_ACCADI SEGV_ADIDERR, /* Disrupting MCD error. */ # define SEGV_ADIDERR SEGV_ADIDERR - SEGV_ADIPERR /* Precise MCD exception. */ + SEGV_ADIPERR, /* Precise MCD exception. */ # define SEGV_ADIPERR SEGV_ADIPERR + SEGV_MTEAERR, /* Asynchronous ARM MTE error. */ +# define SEGV_MTEAERR SEGV_MTEAERR + SEGV_MTESERR /* Synchronous ARM MTE exception. */ +# define SEGV_MTESERR SEGV_MTESERR }; /* `si_code' values for SIGBUS signal. */ diff --git a/lib/libc/include/generic-glibc/bits/signal_ext.h b/lib/libc/include/generic-glibc/bits/signal_ext.h index bbcabd03b6..310f52bebc 100644 --- a/lib/libc/include/generic-glibc/bits/signal_ext.h +++ b/lib/libc/include/generic-glibc/bits/signal_ext.h @@ -1,5 +1,5 @@ /* System-specific extensions of , Linux version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/signalfd.h b/lib/libc/include/generic-glibc/bits/signalfd.h index 632c233631..2851f61fa5 100644 --- a/lib/libc/include/generic-glibc/bits/signalfd.h +++ b/lib/libc/include/generic-glibc/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/signum-arch.h b/lib/libc/include/generic-glibc/bits/signum-arch.h index e6d32d64f2..36a3d33827 100644 --- a/lib/libc/include/generic-glibc/bits/signum-arch.h +++ b/lib/libc/include/generic-glibc/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/signum-generic.h b/lib/libc/include/generic-glibc/bits/signum-generic.h index eddb633837..2a3247ebd6 100644 --- a/lib/libc/include/generic-glibc/bits/signum-generic.h +++ b/lib/libc/include/generic-glibc/bits/signum-generic.h @@ -1,5 +1,5 @@ /* Signal number constants. Generic template. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sigstack.h b/lib/libc/include/generic-glibc/bits/sigstack.h index e8cd667816..7e6cf36d8e 100644 --- a/lib/libc/include/generic-glibc/bits/sigstack.h +++ b/lib/libc/include/generic-glibc/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sigthread.h b/lib/libc/include/generic-glibc/bits/sigthread.h index 759c294e8f..2d7fac43eb 100644 --- a/lib/libc/include/generic-glibc/bits/sigthread.h +++ b/lib/libc/include/generic-glibc/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sockaddr.h b/lib/libc/include/generic-glibc/bits/sockaddr.h index 29d95bec86..056b5e3f27 100644 --- a/lib/libc/include/generic-glibc/bits/sockaddr.h +++ b/lib/libc/include/generic-glibc/bits/sockaddr.h @@ -1,5 +1,5 @@ /* Definition of struct sockaddr_* common members and sizes, generic version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/socket-constants.h b/lib/libc/include/generic-glibc/bits/socket-constants.h index 93fd5d7548..1f67ca36fb 100644 --- a/lib/libc/include/generic-glibc/bits/socket-constants.h +++ b/lib/libc/include/generic-glibc/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/socket.h b/lib/libc/include/generic-glibc/bits/socket.h index 44ff857923..30d74fa214 100644 --- a/lib/libc/include/generic-glibc/bits/socket.h +++ b/lib/libc/include/generic-glibc/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/socket2.h b/lib/libc/include/generic-glibc/bits/socket2.h index 1550ff0091..8f6980bd67 100644 --- a/lib/libc/include/generic-glibc/bits/socket2.h +++ b/lib/libc/include/generic-glibc/bits/socket2.h @@ -1,5 +1,5 @@ /* Checking macros for socket functions. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,13 +33,15 @@ extern ssize_t __REDIRECT (__recv_chk_warn, __fortify_function ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) - return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags); + return __recv_chk (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags); - if (__n > __bos0 (__buf)) - return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags); + if (__n > __glibc_objsize0 (__buf)) + return __recv_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags); } return __recv_alias (__fd, __buf, __n, __flags); } @@ -64,14 +66,14 @@ __fortify_function ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) - return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); - if (__n > __bos0 (__buf)) - return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); + return __recvfrom_chk (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags, __addr, __addr_len); + if (__n > __glibc_objsize0 (__buf)) + return __recvfrom_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags, __addr, __addr_len); } return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); } \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/socket_type.h b/lib/libc/include/generic-glibc/bits/socket_type.h index 9c444f0d10..d906ebbaf0 100644 --- a/lib/libc/include/generic-glibc/bits/socket_type.h +++ b/lib/libc/include/generic-glibc/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for generic Linux. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/ss_flags.h b/lib/libc/include/generic-glibc/bits/ss_flags.h index 302984b22b..a24d1e66d2 100644 --- a/lib/libc/include/generic-glibc/bits/ss_flags.h +++ b/lib/libc/include/generic-glibc/bits/ss_flags.h @@ -1,5 +1,5 @@ /* ss_flags values for stack_t. Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stab.def b/lib/libc/include/generic-glibc/bits/stab.def index 1730bce0ad..d1b7c98745 100644 --- a/lib/libc/include/generic-glibc/bits/stab.def +++ b/lib/libc/include/generic-glibc/bits/stab.def @@ -1,5 +1,5 @@ /* Table of DBX symbol codes for the GNU system. - Copyright (C) 1988, 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1988, 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stat.h b/lib/libc/include/generic-glibc/bits/stat.h index b298b3f336..ddcdcb957e 100644 --- a/lib/libc/include/generic-glibc/bits/stat.h +++ b/lib/libc/include/generic-glibc/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,7 +12,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see + License along with the GNU C Library; if not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H @@ -22,210 +22,7 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -#include - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -#if _MIPS_SIM == _ABIO32 -/* Structure describing file characteristics. */ -struct stat - { - unsigned long int st_dev; - long int st_pad1[3]; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - unsigned long int st_rdev; /* Device number, if device. */ -#ifndef __USE_FILE_OFFSET64 - long int st_pad2[2]; - __off_t st_size; /* Size of file, in bytes. */ - /* SVR4 added this extra long to allow for expansion of off_t. */ - long int st_pad3; -#else - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ -#else - long int st_pad4; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ -#endif - long int st_pad5[14]; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - unsigned long int st_dev; - long int st_pad1[3]; - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - unsigned long int st_rdev; /* Device number, if device. */ - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - long int st_pad3; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ - long int st_pad4[14]; - }; -#endif -#else -struct stat - { - __dev_t st_dev; - int st_pad1[3]; /* Reserved for st_dev expansion */ -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; -#else - __ino64_t st_ino; -#endif - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; -#if !defined __USE_FILE_OFFSET64 - unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ - __off_t st_size; - int st_pad3; -#else - unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ - __off64_t st_size; -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; - unsigned int st_pad4; -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; -#else - __blkcnt64_t st_blocks; -#endif - int st_pad5[14]; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; - unsigned int st_pad1[3]; /* Reserved for st_dev expansion */ - __ino64_t st_ino; - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; - unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ - __off64_t st_size; -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __blksize_t st_blksize; - unsigned int st_pad3; - __blkcnt64_t st_blocks; - int st_pad4[14]; -}; -#endif -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV +#include /* Encoding of the file mode. */ diff --git a/lib/libc/include/generic-glibc/bits/statfs.h b/lib/libc/include/generic-glibc/bits/statfs.h index d4be118bd8..9d651f397c 100644 --- a/lib/libc/include/generic-glibc/bits/statfs.h +++ b/lib/libc/include/generic-glibc/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/statvfs.h b/lib/libc/include/generic-glibc/bits/statvfs.h index 3518719603..da2c1fd007 100644 --- a/lib/libc/include/generic-glibc/bits/statvfs.h +++ b/lib/libc/include/generic-glibc/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/statx-generic.h b/lib/libc/include/generic-glibc/bits/statx-generic.h index f0d8e4d846..52709c2465 100644 --- a/lib/libc/include/generic-glibc/bits/statx-generic.h +++ b/lib/libc/include/generic-glibc/bits/statx-generic.h @@ -1,5 +1,5 @@ /* Generic statx-related definitions and declarations. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,6 +40,7 @@ # define STATX_BASIC_STATS 0x07ffU # define STATX_ALL 0x0fffU # define STATX_BTIME 0x0800U +# define STATX_MNT_ID 0x1000U # define STATX__RESERVED 0x80000000U # define STATX_ATTR_COMPRESSED 0x0004 @@ -48,7 +49,9 @@ # define STATX_ATTR_NODUMP 0x0040 # define STATX_ATTR_ENCRYPTED 0x0800 # define STATX_ATTR_AUTOMOUNT 0x1000 +# define STATX_ATTR_MOUNT_ROOT 0x2000 # define STATX_ATTR_VERITY 0x100000 +# define STATX_ATTR_DAX 0x200000 #endif /* !STATX_TYPE */ __BEGIN_DECLS diff --git a/lib/libc/include/generic-glibc/bits/statx.h b/lib/libc/include/generic-glibc/bits/statx.h index 93333e8df9..a0af9c6246 100644 --- a/lib/libc/include/generic-glibc/bits/statx.h +++ b/lib/libc/include/generic-glibc/bits/statx.h @@ -1,5 +1,5 @@ /* statx-related definitions and declarations. Linux version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdint-intn.h b/lib/libc/include/generic-glibc/bits/stdint-intn.h index 25e6c5f964..70e25ae1a9 100644 --- a/lib/libc/include/generic-glibc/bits/stdint-intn.h +++ b/lib/libc/include/generic-glibc/bits/stdint-intn.h @@ -1,5 +1,5 @@ /* Define intN_t types. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdint-uintn.h b/lib/libc/include/generic-glibc/bits/stdint-uintn.h index 171f824b85..a683f414aa 100644 --- a/lib/libc/include/generic-glibc/bits/stdint-uintn.h +++ b/lib/libc/include/generic-glibc/bits/stdint-uintn.h @@ -1,5 +1,5 @@ /* Define uintN_t types. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdio-ldbl.h b/lib/libc/include/generic-glibc/bits/stdio-ldbl.h index f74840c8b6..fea9a9906c 100644 --- a/lib/libc/include/generic-glibc/bits/stdio-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/stdio-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for stdio functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdio.h b/lib/libc/include/generic-glibc/bits/stdio.h index 656db408de..1e9685797b 100644 --- a/lib/libc/include/generic-glibc/bits/stdio.h +++ b/lib/libc/include/generic-glibc/bits/stdio.h @@ -1,5 +1,5 @@ /* Optimizing macros and inline functions for stdio functions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,7 +31,7 @@ #ifdef __USE_EXTERN_INLINES -/* For -D_FORTIFY_SOURCE{,=2} bits/stdio2.h will define a different +/* For -D_FORTIFY_SOURCE{,=2,=3} bits/stdio2.h will define a different inline. */ # if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function) /* Write formatted output to stdout from argument list ARG. */ @@ -60,7 +60,7 @@ fgetc_unlocked (FILE *__fp) # endif /* misc */ -# ifdef __USE_POSIX +# ifdef __USE_POSIX199506 /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int getc_unlocked (FILE *__fp) @@ -95,7 +95,7 @@ fputc_unlocked (int __c, FILE *__stream) # endif /* misc */ -# ifdef __USE_POSIX +# ifdef __USE_POSIX199506 /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int putc_unlocked (int __c, FILE *__stream) diff --git a/lib/libc/include/generic-glibc/bits/stdio2.h b/lib/libc/include/generic-glibc/bits/stdio2.h index b6b568ad96..5608dfd198 100644 --- a/lib/libc/include/generic-glibc/bits/stdio2.h +++ b/lib/libc/include/generic-glibc/bits/stdio2.h @@ -1,5 +1,5 @@ /* Checking macros for stdio functions. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,12 +36,13 @@ __fortify_function int __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) { return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __va_arg_pack ()); + __glibc_objsize (__s), __fmt, + __va_arg_pack ()); } #elif !defined __cplusplus # define sprintf(str, ...) \ - __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), \ - __VA_ARGS__) + __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, \ + __glibc_objsize (str), __VA_ARGS__) #endif __fortify_function int @@ -49,7 +50,7 @@ __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __ap); + __glibc_objsize (__s), __fmt, __ap); } #if defined __USE_ISOC99 || defined __USE_UNIX98 @@ -68,12 +69,13 @@ __NTH (snprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, ...)) { return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __va_arg_pack ()); + __glibc_objsize (__s), __fmt, + __va_arg_pack ()); } # elif !defined __cplusplus # define snprintf(str, len, ...) \ - __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \ - __VA_ARGS__) + __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, \ + __glibc_objsize (str), __VA_ARGS__) # endif __fortify_function int @@ -81,7 +83,7 @@ __NTH (vsnprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s), __fmt, __ap); + __glibc_objsize (__s), __fmt, __ap); } #endif @@ -237,8 +239,8 @@ extern char *__REDIRECT (__gets_warn, (char *__str), gets) __fortify_function __wur char * gets (char *__str) { - if (__bos (__str) != (size_t) -1) - return __gets_chk (__str, __bos (__str)); + if (__glibc_objsize (__str) != (size_t) -1) + return __gets_chk (__str, __glibc_objsize (__str)); return __gets_warn (__str); } #endif @@ -259,13 +261,13 @@ extern char *__REDIRECT (__fgets_chk_warn, __fortify_function __wur __attr_access ((__write_only__, 1, 2)) char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { - if (__bos (__s) != (size_t) -1) + if (__glibc_objsize (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) - return __fgets_chk (__s, __bos (__s), __n, __stream); + return __fgets_chk (__s, __glibc_objsize (__s), __n, __stream); - if ((size_t) __n > __bos (__s)) - return __fgets_chk_warn (__s, __bos (__s), __n, __stream); + if ((size_t) __n > __glibc_objsize (__s)) + return __fgets_chk_warn (__s, __glibc_objsize (__s), __n, __stream); } return __fgets_alias (__s, __n, __stream); } @@ -289,15 +291,17 @@ __fortify_function __wur size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { - if (__bos0 (__ptr) != (size_t) -1) + if (__glibc_objsize0 (__ptr) != (size_t) -1) { if (!__builtin_constant_p (__size) || !__builtin_constant_p (__n) || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) - return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream); + return __fread_chk (__ptr, __glibc_objsize0 (__ptr), __size, __n, + __stream); - if (__size * __n > __bos0 (__ptr)) - return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream); + if (__size * __n > __glibc_objsize0 (__ptr)) + return __fread_chk_warn (__ptr, __glibc_objsize0 (__ptr), __size, __n, + __stream); } return __fread_alias (__ptr, __size, __n, __stream); } @@ -319,13 +323,15 @@ extern char *__REDIRECT (__fgets_unlocked_chk_warn, __fortify_function __wur __attr_access ((__write_only__, 1, 2)) char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { - if (__bos (__s) != (size_t) -1) + if (__glibc_objsize (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) - return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream); + return __fgets_unlocked_chk (__s, __glibc_objsize (__s), __n, + __stream); - if ((size_t) __n > __bos (__s)) - return __fgets_unlocked_chk_warn (__s, __bos (__s), __n, __stream); + if ((size_t) __n > __glibc_objsize (__s)) + return __fgets_unlocked_chk_warn (__s, __glibc_objsize (__s), __n, + __stream); } return __fgets_unlocked_alias (__s, __n, __stream); } @@ -352,17 +358,17 @@ __fortify_function __wur size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { - if (__bos0 (__ptr) != (size_t) -1) + if (__glibc_objsize0 (__ptr) != (size_t) -1) { if (!__builtin_constant_p (__size) || !__builtin_constant_p (__n) || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2))) - return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n, - __stream); + return __fread_unlocked_chk (__ptr, __glibc_objsize0 (__ptr), __size, + __n, __stream); - if (__size * __n > __bos0 (__ptr)) - return __fread_unlocked_chk_warn (__ptr, __bos0 (__ptr), __size, __n, - __stream); + if (__size * __n > __glibc_objsize0 (__ptr)) + return __fread_unlocked_chk_warn (__ptr, __glibc_objsize0 (__ptr), + __size, __n, __stream); } # ifdef __USE_EXTERN_INLINES diff --git a/lib/libc/include/generic-glibc/bits/stdio_lim.h b/lib/libc/include/generic-glibc/bits/stdio_lim.h index 8e9de1e070..bcb352b466 100644 --- a/lib/libc/include/generic-glibc/bits/stdio_lim.h +++ b/lib/libc/include/generic-glibc/bits/stdio_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2020 Free Software Foundation, Inc. +/* Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdlib-bsearch.h b/lib/libc/include/generic-glibc/bits/stdlib-bsearch.h index 4c6189dd73..843ba7ac69 100644 --- a/lib/libc/include/generic-glibc/bits/stdlib-bsearch.h +++ b/lib/libc/include/generic-glibc/bits/stdlib-bsearch.h @@ -1,5 +1,5 @@ /* Perform binary search - inline version. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdlib-float.h b/lib/libc/include/generic-glibc/bits/stdlib-float.h index e42e0e5d91..5dd603e7ad 100644 --- a/lib/libc/include/generic-glibc/bits/stdlib-float.h +++ b/lib/libc/include/generic-glibc/bits/stdlib-float.h @@ -1,5 +1,5 @@ /* Floating-point inline functions for stdlib.h. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdlib-ldbl.h b/lib/libc/include/generic-glibc/bits/stdlib-ldbl.h index 185b83dde3..6921e99522 100644 --- a/lib/libc/include/generic-glibc/bits/stdlib-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/stdlib-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/stdlib.h b/lib/libc/include/generic-glibc/bits/stdlib.h index 92b27c5534..95c3fc66cf 100644 --- a/lib/libc/include/generic-glibc/bits/stdlib.h +++ b/lib/libc/include/generic-glibc/bits/stdlib.h @@ -1,5 +1,5 @@ /* Checking macros for stdlib functions. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,13 +36,14 @@ extern char *__REDIRECT_NTH (__realpath_chk_warn, __fortify_function __wur char * __NTH (realpath (const char *__restrict __name, char *__restrict __resolved)) { - if (__bos (__resolved) != (size_t) -1) + if (__glibc_objsize (__resolved) != (size_t) -1) { #if defined _LIBC_LIMITS_H_ && defined PATH_MAX - if (__bos (__resolved) < PATH_MAX) - return __realpath_chk_warn (__name, __resolved, __bos (__resolved)); + if (__glibc_objsize (__resolved) < PATH_MAX) + return __realpath_chk_warn (__name, __resolved, + __glibc_objsize (__resolved)); #endif - return __realpath_chk (__name, __resolved, __bos (__resolved)); + return __realpath_chk (__name, __resolved, __glibc_objsize (__resolved)); } return __realpath_alias (__name, __resolved); @@ -64,12 +65,14 @@ extern int __REDIRECT_NTH (__ptsname_r_chk_warn, __fortify_function int __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) - return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf)); - if (__buflen > __bos (__buf)) - return __ptsname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); + return __ptsname_r_chk (__fd, __buf, __buflen, + __glibc_objsize (__buf)); + if (__buflen > __glibc_objsize (__buf)) + return __ptsname_r_chk_warn (__fd, __buf, __buflen, + __glibc_objsize (__buf)); } return __ptsname_r_alias (__fd, __buf, __buflen); } @@ -90,8 +93,9 @@ __NTH (wctomb (char *__s, wchar_t __wchar)) #if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif - if (__bos (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __bos (__s)) - return __wctomb_chk (__s, __wchar, __bos (__s)); + if (__glibc_objsize (__s) != (size_t) -1 + && __STDLIB_MB_LEN_MAX > __glibc_objsize (__s)) + return __wctomb_chk (__s, __wchar, __glibc_objsize (__s)); return __wctomb_alias (__s, __wchar); } @@ -116,15 +120,16 @@ __fortify_function size_t __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbstowcs_chk (__dst, __src, __len, - __bos (__dst) / sizeof (wchar_t)); + __glibc_objsize (__dst) / sizeof (wchar_t)); - if (__len > __bos (__dst) / sizeof (wchar_t)) + if (__len > __glibc_objsize (__dst) / sizeof (wchar_t)) return __mbstowcs_chk_warn (__dst, __src, __len, - __bos (__dst) / sizeof (wchar_t)); + (__glibc_objsize (__dst) + / sizeof (wchar_t))); } return __mbstowcs_alias (__dst, __src, __len); } @@ -149,12 +154,13 @@ __fortify_function size_t __NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) - return __wcstombs_chk (__dst, __src, __len, __bos (__dst)); - if (__len > __bos (__dst)) - return __wcstombs_chk_warn (__dst, __src, __len, __bos (__dst)); + return __wcstombs_chk (__dst, __src, __len, __glibc_objsize (__dst)); + if (__len > __glibc_objsize (__dst)) + return __wcstombs_chk_warn (__dst, __src, __len, + __glibc_objsize (__dst)); } return __wcstombs_alias (__dst, __src, __len); } \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/string_fortified.h b/lib/libc/include/generic-glibc/bits/string_fortified.h index 0ec88c36a4..ba7b8700e1 100644 --- a/lib/libc/include/generic-glibc/bits/string_fortified.h +++ b/lib/libc/include/generic-glibc/bits/string_fortified.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,22 +22,19 @@ # error "Never use directly; include instead." #endif -#if !__GNUC_PREREQ (5,0) -__warndecl (__warn_memset_zero_len, - "memset used with constant zero length parameter; this could be due to transposed parameters"); -#endif - __fortify_function void * __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { - return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); + return __builtin___memcpy_chk (__dest, __src, __len, + __glibc_objsize0 (__dest)); } __fortify_function void * __NTH (memmove (void *__dest, const void *__src, size_t __len)) { - return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); + return __builtin___memmove_chk (__dest, __src, __len, + __glibc_objsize0 (__dest)); } #ifdef __USE_GNU @@ -45,7 +42,8 @@ __fortify_function void * __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { - return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); + return __builtin___mempcpy_chk (__dest, __src, __len, + __glibc_objsize0 (__dest)); } #endif @@ -58,17 +56,8 @@ __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, __fortify_function void * __NTH (memset (void *__dest, int __ch, size_t __len)) { - /* GCC-5.0 and newer implements these checks in the compiler, so we don't - need them here. */ -#if !__GNUC_PREREQ (5,0) - if (__builtin_constant_p (__len) && __len == 0 - && (!__builtin_constant_p (__ch) || __ch != 0)) - { - __warn_memset_zero_len (); - return __dest; - } -#endif - return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); + return __builtin___memset_chk (__dest, __ch, __len, + __glibc_objsize0 (__dest)); } #ifdef __USE_MISC @@ -80,21 +69,21 @@ void __explicit_bzero_chk (void *__dest, size_t __len, size_t __destlen) __fortify_function void __NTH (explicit_bzero (void *__dest, size_t __len)) { - __explicit_bzero_chk (__dest, __len, __bos0 (__dest)); + __explicit_bzero_chk (__dest, __len, __glibc_objsize0 (__dest)); } #endif __fortify_function char * __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) { - return __builtin___strcpy_chk (__dest, __src, __bos (__dest)); + return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest)); } #ifdef __USE_GNU __fortify_function char * __NTH (stpcpy (char *__restrict __dest, const char *__restrict __src)) { - return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); + return __builtin___stpcpy_chk (__dest, __src, __glibc_objsize (__dest)); } #endif @@ -103,10 +92,18 @@ __fortify_function char * __NTH (strncpy (char *__restrict __dest, const char *__restrict __src, size_t __len)) { - return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); + return __builtin___strncpy_chk (__dest, __src, __len, + __glibc_objsize (__dest)); } -/* XXX We have no corresponding builtin yet. */ +#if __GNUC_PREREQ (4, 7) || __glibc_clang_prereq (2, 6) +__fortify_function char * +__NTH (stpncpy (char *__dest, const char *__src, size_t __n)) +{ + return __builtin___stpncpy_chk (__dest, __src, __n, + __glibc_objsize (__dest)); +} +#else extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, size_t __destlen) __THROW __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2)); @@ -121,12 +118,13 @@ __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) return __stpncpy_chk (__dest, __src, __n, __bos (__dest)); return __stpncpy_alias (__dest, __src, __n); } +#endif __fortify_function char * __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) { - return __builtin___strcat_chk (__dest, __src, __bos (__dest)); + return __builtin___strcat_chk (__dest, __src, __glibc_objsize (__dest)); } @@ -134,7 +132,8 @@ __fortify_function char * __NTH (strncat (char *__restrict __dest, const char *__restrict __src, size_t __len)) { - return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); + return __builtin___strncat_chk (__dest, __src, __len, + __glibc_objsize (__dest)); } #endif /* bits/string_fortified.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/strings_fortified.h b/lib/libc/include/generic-glibc/bits/strings_fortified.h index fae5c6754d..5e41ef68f0 100644 --- a/lib/libc/include/generic-glibc/bits/strings_fortified.h +++ b/lib/libc/include/generic-glibc/bits/strings_fortified.h @@ -1,5 +1,5 @@ /* Fortify macros for strings.h functions. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,13 +22,15 @@ __fortify_function void __NTH (bcopy (const void *__src, void *__dest, size_t __len)) { - (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); + (void) __builtin___memmove_chk (__dest, __src, __len, + __glibc_objsize0 (__dest)); } __fortify_function void __NTH (bzero (void *__dest, size_t __len)) { - (void) __builtin___memset_chk (__dest, '\0', __len, __bos0 (__dest)); + (void) __builtin___memset_chk (__dest, '\0', __len, + __glibc_objsize0 (__dest)); } #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/struct_mutex.h b/lib/libc/include/generic-glibc/bits/struct_mutex.h index 092f4ee080..26f2cf4f99 100644 --- a/lib/libc/include/generic-glibc/bits/struct_mutex.h +++ b/lib/libc/include/generic-glibc/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* Default mutex implementation struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/struct_rwlock.h b/lib/libc/include/generic-glibc/bits/struct_rwlock.h index e1e54e75bb..6355f539b9 100644 --- a/lib/libc/include/generic-glibc/bits/struct_rwlock.h +++ b/lib/libc/include/generic-glibc/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* MIPS internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/struct_stat.h b/lib/libc/include/generic-glibc/bits/struct_stat.h new file mode 100644 index 0000000000..29d304519a --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/struct_stat.h @@ -0,0 +1,218 @@ +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include + +#if _MIPS_SIM == _ABIO32 +/* Structure describing file characteristics. */ +struct stat + { + unsigned long int st_dev; + long int st_pad1[3]; +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino64_t st_ino; /* File serial number. */ +#endif + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + unsigned long int st_rdev; /* Device number, if device. */ +#ifndef __USE_FILE_OFFSET64 + long int st_pad2[2]; + __off_t st_size; /* Size of file, in bytes. */ + /* SVR4 added this extra long to allow for expansion of off_t. */ + long int st_pad3; +#else + long int st_pad2[3]; + __off64_t st_size; /* Size of file, in bytes. */ +#endif +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ +#else + long int st_pad4; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ +#endif + long int st_pad5[14]; + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + unsigned long int st_dev; + long int st_pad1[3]; + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + unsigned long int st_rdev; /* Device number, if device. */ + long int st_pad2[3]; + __off64_t st_size; /* Size of file, in bytes. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + long int st_pad3; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ + long int st_pad4[14]; + }; +#endif +#else +struct stat + { + __dev_t st_dev; + int st_pad1[3]; /* Reserved for st_dev expansion */ +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; +#else + __ino64_t st_ino; +#endif + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; +#if !defined __USE_FILE_OFFSET64 + unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ + __off_t st_size; + int st_pad3; +#else + unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ + __off64_t st_size; +#endif +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + __blksize_t st_blksize; + unsigned int st_pad4; +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; +#else + __blkcnt64_t st_blocks; +#endif + int st_pad5[14]; + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; + unsigned int st_pad1[3]; /* Reserved for st_dev expansion */ + __ino64_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ + __off64_t st_size; +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + __blksize_t st_blksize; + unsigned int st_pad3; + __blkcnt64_t st_blocks; + int st_pad4[14]; +}; +#endif +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV + +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/syscall.h b/lib/libc/include/generic-glibc/bits/syscall.h index 561be5ac16..f418df3294 100644 --- a/lib/libc/include/generic-glibc/bits/syscall.h +++ b/lib/libc/include/generic-glibc/bits/syscall.h @@ -1,11 +1,11 @@ /* Generated at libc build time from syscall list. */ -/* The system call list corresponds to kernel 5.7. */ +/* The system call list corresponds to kernel 5.10. */ #ifndef _SYSCALL_H # error "Never use directly; include instead." #endif -#define __GLIBC_LINUX_VERSION_CODE 329472 +#define __GLIBC_LINUX_VERSION_CODE 330240 #ifdef __NR_FAST_atomic_update # define SYS_FAST_atomic_update __NR_FAST_atomic_update @@ -227,6 +227,10 @@ # define SYS_close __NR_close #endif +#ifdef __NR_close_range +# define SYS_close_range __NR_close_range +#endif + #ifdef __NR_cmpxchg_badaddr # define SYS_cmpxchg_badaddr __NR_cmpxchg_badaddr #endif @@ -331,6 +335,10 @@ # define SYS_faccessat __NR_faccessat #endif +#ifdef __NR_faccessat2 +# define SYS_faccessat2 __NR_faccessat2 +#endif + #ifdef __NR_fadvise64 # define SYS_fadvise64 __NR_fadvise64 #endif @@ -1635,6 +1643,10 @@ # define SYS_prlimit64 __NR_prlimit64 #endif +#ifdef __NR_process_madvise +# define SYS_process_madvise __NR_process_madvise +#endif + #ifdef __NR_process_vm_readv # define SYS_process_vm_readv __NR_process_vm_readv #endif diff --git a/lib/libc/include/generic-glibc/bits/syslog-ldbl.h b/lib/libc/include/generic-glibc/bits/syslog-ldbl.h index a6527d038f..b75903b0bc 100644 --- a/lib/libc/include/generic-glibc/bits/syslog-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/syslog-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for syslog functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/syslog-path.h b/lib/libc/include/generic-glibc/bits/syslog-path.h index 6f733fa528..90cabe160d 100644 --- a/lib/libc/include/generic-glibc/bits/syslog-path.h +++ b/lib/libc/include/generic-glibc/bits/syslog-path.h @@ -1,5 +1,5 @@ /* -- _PATH_LOG definition - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/syslog.h b/lib/libc/include/generic-glibc/bits/syslog.h index b36025933f..00bfac8fbf 100644 --- a/lib/libc/include/generic-glibc/bits/syslog.h +++ b/lib/libc/include/generic-glibc/bits/syslog.h @@ -1,5 +1,5 @@ /* Checking macros for syslog functions. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/sysmacros.h b/lib/libc/include/generic-glibc/bits/sysmacros.h index 9f8c82a7e4..a236fdd12c 100644 --- a/lib/libc/include/generic-glibc/bits/sysmacros.h +++ b/lib/libc/include/generic-glibc/bits/sysmacros.h @@ -1,5 +1,5 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-baud.h b/lib/libc/include/generic-glibc/bits/termios-baud.h index 5a1af58d8d..8e73d65bd3 100644 --- a/lib/libc/include/generic-glibc/bits/termios-baud.h +++ b/lib/libc/include/generic-glibc/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-c_cc.h b/lib/libc/include/generic-glibc/bits/termios-c_cc.h index d3bd2f43d0..6f3513bc12 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_cc.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-c_cflag.h b/lib/libc/include/generic-glibc/bits/termios-c_cflag.h index 941ce42cf1..174882f621 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_cflag.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_cflag.h @@ -1,5 +1,5 @@ /* termios control mode definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-c_iflag.h b/lib/libc/include/generic-glibc/bits/termios-c_iflag.h index a5d02f772d..cd3bec9a48 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_iflag.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_iflag.h @@ -1,5 +1,5 @@ /* termios input mode definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-c_lflag.h b/lib/libc/include/generic-glibc/bits/termios-c_lflag.h index a8f7c3013a..84ffa74d77 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_lflag.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-c_oflag.h b/lib/libc/include/generic-glibc/bits/termios-c_oflag.h index 053d357ff4..7bc565cd22 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_oflag.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-misc.h b/lib/libc/include/generic-glibc/bits/termios-misc.h index 517bc6bd02..eca54813c0 100644 --- a/lib/libc/include/generic-glibc/bits/termios-misc.h +++ b/lib/libc/include/generic-glibc/bits/termios-misc.h @@ -1,5 +1,5 @@ /* termios baud platform specific definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-struct.h b/lib/libc/include/generic-glibc/bits/termios-struct.h index 9d95c8c579..9b65f635db 100644 --- a/lib/libc/include/generic-glibc/bits/termios-struct.h +++ b/lib/libc/include/generic-glibc/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios-tcflow.h b/lib/libc/include/generic-glibc/bits/termios-tcflow.h index 76d26c48bf..6cc64868e6 100644 --- a/lib/libc/include/generic-glibc/bits/termios-tcflow.h +++ b/lib/libc/include/generic-glibc/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios tcflag symbolic contants definitions. Linux/generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/termios.h b/lib/libc/include/generic-glibc/bits/termios.h index 9dc4df22fe..352469d7aa 100644 --- a/lib/libc/include/generic-glibc/bits/termios.h +++ b/lib/libc/include/generic-glibc/bits/termios.h @@ -1,5 +1,5 @@ /* termios type and macro definitions. Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/thread-shared-types.h b/lib/libc/include/generic-glibc/bits/thread-shared-types.h index 43efbedb1b..ffc86742ca 100644 --- a/lib/libc/include/generic-glibc/bits/thread-shared-types.h +++ b/lib/libc/include/generic-glibc/bits/thread-shared-types.h @@ -1,5 +1,5 @@ /* Common threading primitives definitions for both POSIX and C11. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/time.h b/lib/libc/include/generic-glibc/bits/time.h index f26ca4c52e..2665b86352 100644 --- a/lib/libc/include/generic-glibc/bits/time.h +++ b/lib/libc/include/generic-glibc/bits/time.h @@ -1,5 +1,5 @@ /* System-dependent timing definitions. Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/time64.h b/lib/libc/include/generic-glibc/bits/time64.h index a985244493..7359231806 100644 --- a/lib/libc/include/generic-glibc/bits/time64.h +++ b/lib/libc/include/generic-glibc/bits/time64.h @@ -1,5 +1,5 @@ /* bits/time64.h -- underlying types for __time64_t. Generic version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/timerfd.h b/lib/libc/include/generic-glibc/bits/timerfd.h index 56def31a3f..58fef8da71 100644 --- a/lib/libc/include/generic-glibc/bits/timerfd.h +++ b/lib/libc/include/generic-glibc/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/timesize.h b/lib/libc/include/generic-glibc/bits/timesize.h index 5260dbb5aa..eea3ce6396 100644 --- a/lib/libc/include/generic-glibc/bits/timesize.h +++ b/lib/libc/include/generic-glibc/bits/timesize.h @@ -1,5 +1,5 @@ /* Bit size of the time_t type at glibc build time, general case. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/timex.h b/lib/libc/include/generic-glibc/bits/timex.h index 2eadd1de42..9042996de3 100644 --- a/lib/libc/include/generic-glibc/bits/timex.h +++ b/lib/libc/include/generic-glibc/bits/timex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types.h b/lib/libc/include/generic-glibc/bits/types.h index 1f37c9eec8..5e93f78e7c 100644 --- a/lib/libc/include/generic-glibc/bits/types.h +++ b/lib/libc/include/generic-glibc/bits/types.h @@ -1,5 +1,5 @@ /* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/__locale_t.h b/lib/libc/include/generic-glibc/bits/types/__locale_t.h index 32601b1906..72ce88a440 100644 --- a/lib/libc/include/generic-glibc/bits/types/__locale_t.h +++ b/lib/libc/include/generic-glibc/bits/types/__locale_t.h @@ -1,5 +1,5 @@ /* Definition of struct __locale_struct and __locale_t. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. diff --git a/lib/libc/include/generic-glibc/bits/types/__sigval_t.h b/lib/libc/include/generic-glibc/bits/types/__sigval_t.h index 514e46667b..3ca534a19d 100644 --- a/lib/libc/include/generic-glibc/bits/types/__sigval_t.h +++ b/lib/libc/include/generic-glibc/bits/types/__sigval_t.h @@ -1,5 +1,5 @@ /* Define __sigval_t. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/cookie_io_functions_t.h b/lib/libc/include/generic-glibc/bits/types/cookie_io_functions_t.h index e96dd46f5e..62185e2014 100644 --- a/lib/libc/include/generic-glibc/bits/types/cookie_io_functions_t.h +++ b/lib/libc/include/generic-glibc/bits/types/cookie_io_functions_t.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/error_t.h b/lib/libc/include/generic-glibc/bits/types/error_t.h index ddf3d52bd3..73ed5b3a2f 100644 --- a/lib/libc/include/generic-glibc/bits/types/error_t.h +++ b/lib/libc/include/generic-glibc/bits/types/error_t.h @@ -1,5 +1,5 @@ /* Define error_t. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/locale_t.h b/lib/libc/include/generic-glibc/bits/types/locale_t.h index 8e89ef26ab..0292481bdb 100644 --- a/lib/libc/include/generic-glibc/bits/types/locale_t.h +++ b/lib/libc/include/generic-glibc/bits/types/locale_t.h @@ -1,5 +1,5 @@ /* Definition of locale_t. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/stack_t.h b/lib/libc/include/generic-glibc/bits/types/stack_t.h index 884afcf179..aa1bdf930b 100644 --- a/lib/libc/include/generic-glibc/bits/types/stack_t.h +++ b/lib/libc/include/generic-glibc/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_FILE.h b/lib/libc/include/generic-glibc/bits/types/struct_FILE.h index 57103e93d9..85e4542492 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_FILE.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_FILE.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct___jmp_buf_tag.h b/lib/libc/include/generic-glibc/bits/types/struct___jmp_buf_tag.h new file mode 100644 index 0000000000..de11e2ad5c --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct___jmp_buf_tag.h @@ -0,0 +1,37 @@ +/* Define struct __jmp_buf_tag. + Copyright (C) 1991-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __jmp_buf_tag_defined +#define __jmp_buf_tag_defined 1 + +#include /* Get `__jmp_buf'. */ +#include + +/* Calling environment, plus possibly a saved signal mask. */ +struct __jmp_buf_tag + { + /* NOTE: The machine-dependent definitions of `__sigsetjmp' + assume that a `jmp_buf' begins with a `__jmp_buf' and that + `__mask_was_saved' follows it. Do not move these members + or add others before it. */ + __jmp_buf __jmpbuf; /* Calling environment. */ + int __mask_was_saved; /* Saved the signal mask? */ + __sigset_t __saved_mask; /* Saved signal mask. */ + }; + +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_iovec.h b/lib/libc/include/generic-glibc/bits/types/struct_iovec.h index 4eff4361ac..71faeb358d 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_iovec.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_iovec.h @@ -1,5 +1,5 @@ /* Define struct iovec. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h index fa4f23c16b..9ccafc23d6 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Generic implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_rusage.h b/lib/libc/include/generic-glibc/bits/types/struct_rusage.h index 2f221efc93..4a1a5eb58d 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_rusage.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_rusage.h @@ -1,5 +1,5 @@ /* Define struct rusage. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_sched_param.h b/lib/libc/include/generic-glibc/bits/types/struct_sched_param.h index 4bb70691dc..3e80d75038 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_sched_param.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_sched_param.h @@ -1,5 +1,5 @@ /* Sched parameter structure. Generic version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h index 932c18daeb..b7b46007a1 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* Generic implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h index 9c3a7677c0..4c4670b47b 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Generic implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_sigstack.h b/lib/libc/include/generic-glibc/bits/types/struct_sigstack.h index ae11f9aa6a..986c599b6c 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_sigstack.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_sigstack.h @@ -1,5 +1,5 @@ /* Define struct sigstack. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_statx.h b/lib/libc/include/generic-glibc/bits/types/struct_statx.h index 37e91e85ec..fd9ccf9e1e 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_statx.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_statx.h @@ -1,5 +1,5 @@ /* Definition of the generic version of struct statx. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_statx_timestamp.h b/lib/libc/include/generic-glibc/bits/types/struct_statx_timestamp.h index 129078d44a..4957626c73 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_statx_timestamp.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_statx_timestamp.h @@ -1,5 +1,5 @@ /* Definition of the generic version of struct statx_timestamp. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/types/struct_timeb.h b/lib/libc/include/generic-glibc/bits/types/struct_timeb.h new file mode 100644 index 0000000000..28d239b051 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_timeb.h @@ -0,0 +1,15 @@ +#ifndef __timeb_defined +#define __timeb_defined 1 + +#include + +/* Structure returned by the 'ftime' function. */ +struct timeb + { + time_t time; /* Seconds since epoch, as from 'time'. */ + unsigned short int millitm; /* Additional milliseconds. */ + short int timezone; /* Minutes west of GMT. */ + short int dstflag; /* Nonzero if Daylight Savings Time used. */ + }; + +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/typesizes.h b/lib/libc/include/generic-glibc/bits/typesizes.h index 07b9a875b0..47d2bc9c45 100644 --- a/lib/libc/include/generic-glibc/bits/typesizes.h +++ b/lib/libc/include/generic-glibc/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Generic version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/uintn-identity.h b/lib/libc/include/generic-glibc/bits/uintn-identity.h index c5fa8c5a13..7cdf181da6 100644 --- a/lib/libc/include/generic-glibc/bits/uintn-identity.h +++ b/lib/libc/include/generic-glibc/bits/uintn-identity.h @@ -1,5 +1,5 @@ /* Inline functions to return unsigned integer values unchanged. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/uio-ext.h b/lib/libc/include/generic-glibc/bits/uio-ext.h index 5bac34c7cb..9290927a03 100644 --- a/lib/libc/include/generic-glibc/bits/uio-ext.h +++ b/lib/libc/include/generic-glibc/bits/uio-ext.h @@ -1,5 +1,5 @@ /* Operating system-specific extensions to sys/uio.h - Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/uio_lim.h b/lib/libc/include/generic-glibc/bits/uio_lim.h index 52da2737ea..d5a3319e31 100644 --- a/lib/libc/include/generic-glibc/bits/uio_lim.h +++ b/lib/libc/include/generic-glibc/bits/uio_lim.h @@ -1,5 +1,5 @@ /* Implementation limits related to sys/uio.h - Linux version. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/unistd.h b/lib/libc/include/generic-glibc/bits/unistd.h index 729afdf23e..76791bf936 100644 --- a/lib/libc/include/generic-glibc/bits/unistd.h +++ b/lib/libc/include/generic-glibc/bits/unistd.h @@ -1,5 +1,5 @@ /* Checking macros for unistd functions. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,13 +35,14 @@ extern ssize_t __REDIRECT (__read_chk_warn, __fortify_function __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) - return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); + return __read_chk (__fd, __buf, __nbytes, __glibc_objsize0 (__buf)); - if (__nbytes > __bos0 (__buf)) - return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf)); + if (__nbytes > __glibc_objsize0 (__buf)) + return __read_chk_warn (__fd, __buf, __nbytes, + __glibc_objsize0 (__buf)); } return __read_alias (__fd, __buf, __nbytes); } @@ -77,14 +78,15 @@ extern ssize_t __REDIRECT (__pread64_chk_warn, __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) - return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); + return __pread_chk (__fd, __buf, __nbytes, __offset, + __glibc_objsize0 (__buf)); - if ( __nbytes > __bos0 (__buf)) + if ( __nbytes > __glibc_objsize0 (__buf)) return __pread_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); + __glibc_objsize0 (__buf)); } return __pread_alias (__fd, __buf, __nbytes, __offset); } @@ -92,14 +94,15 @@ pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); + return __pread64_chk (__fd, __buf, __nbytes, __offset, + __glibc_objsize0 (__buf)); - if ( __nbytes > __bos0 (__buf)) + if ( __nbytes > __glibc_objsize0 (__buf)) return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); + __glibc_objsize0 (__buf)); } return __pread64_alias (__fd, __buf, __nbytes, __offset); @@ -110,14 +113,15 @@ pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __fortify_function __wur ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__nbytes)) - return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf)); + return __pread64_chk (__fd, __buf, __nbytes, __offset, + __glibc_objsize0 (__buf)); - if ( __nbytes > __bos0 (__buf)) + if ( __nbytes > __glibc_objsize0 (__buf)) return __pread64_chk_warn (__fd, __buf, __nbytes, __offset, - __bos0 (__buf)); + __glibc_objsize0 (__buf)); } return __pread64_alias (__fd, __buf, __nbytes, __offset); @@ -145,13 +149,14 @@ __fortify_function __nonnull ((1, 2)) __wur ssize_t __NTH (readlink (const char *__restrict __path, char *__restrict __buf, size_t __len)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) - return __readlink_chk (__path, __buf, __len, __bos (__buf)); + return __readlink_chk (__path, __buf, __len, __glibc_objsize (__buf)); - if ( __len > __bos (__buf)) - return __readlink_chk_warn (__path, __buf, __len, __bos (__buf)); + if ( __len > __glibc_objsize (__buf)) + return __readlink_chk_warn (__path, __buf, __len, + __glibc_objsize (__buf)); } return __readlink_alias (__path, __buf, __len); } @@ -179,14 +184,15 @@ __fortify_function __nonnull ((2, 3)) __wur ssize_t __NTH (readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) - return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf)); + return __readlinkat_chk (__fd, __path, __buf, __len, + __glibc_objsize (__buf)); - if (__len > __bos (__buf)) + if (__len > __glibc_objsize (__buf)) return __readlinkat_chk_warn (__fd, __path, __buf, __len, - __bos (__buf)); + __glibc_objsize (__buf)); } return __readlinkat_alias (__fd, __path, __buf, __len); } @@ -206,13 +212,13 @@ extern char *__REDIRECT_NTH (__getcwd_chk_warn, __fortify_function __wur char * __NTH (getcwd (char *__buf, size_t __size)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__size)) - return __getcwd_chk (__buf, __size, __bos (__buf)); + return __getcwd_chk (__buf, __size, __glibc_objsize (__buf)); - if (__size > __bos (__buf)) - return __getcwd_chk_warn (__buf, __size, __bos (__buf)); + if (__size > __glibc_objsize (__buf)) + return __getcwd_chk_warn (__buf, __size, __glibc_objsize (__buf)); } return __getcwd_alias (__buf, __size); } @@ -227,8 +233,8 @@ extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd) __fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * __NTH (getwd (char *__buf)) { - if (__bos (__buf) != (size_t) -1) - return __getwd_chk (__buf, __bos (__buf)); + if (__glibc_objsize (__buf) != (size_t) -1) + return __getwd_chk (__buf, __glibc_objsize (__buf)); return __getwd_warn (__buf); } #endif @@ -248,13 +254,14 @@ extern size_t __REDIRECT_NTH (__confstr_chk_warn, __fortify_function size_t __NTH (confstr (int __name, char *__buf, size_t __len)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__len)) - return __confstr_chk (__name, __buf, __len, __bos (__buf)); + return __confstr_chk (__name, __buf, __len, __glibc_objsize (__buf)); - if (__bos (__buf) < __len) - return __confstr_chk_warn (__name, __buf, __len, __bos (__buf)); + if (__glibc_objsize (__buf) < __len) + return __confstr_chk_warn (__name, __buf, __len, + __glibc_objsize (__buf)); } return __confstr_alias (__name, __buf, __len); } @@ -273,13 +280,13 @@ extern int __REDIRECT_NTH (__getgroups_chk_warn, __fortify_function int __NTH (getgroups (int __size, __gid_t __list[])) { - if (__bos (__list) != (size_t) -1) + if (__glibc_objsize (__list) != (size_t) -1) { if (!__builtin_constant_p (__size) || __size < 0) - return __getgroups_chk (__size, __list, __bos (__list)); + return __getgroups_chk (__size, __list, __glibc_objsize (__list)); - if (__size * sizeof (__gid_t) > __bos (__list)) - return __getgroups_chk_warn (__size, __list, __bos (__list)); + if (__size * sizeof (__gid_t) > __glibc_objsize (__list)) + return __getgroups_chk_warn (__size, __list, __glibc_objsize (__list)); } return __getgroups_alias (__size, __list); } @@ -300,13 +307,15 @@ extern int __REDIRECT_NTH (__ttyname_r_chk_warn, __fortify_function int __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) - return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); + return __ttyname_r_chk (__fd, __buf, __buflen, + __glibc_objsize (__buf)); - if (__buflen > __bos (__buf)) - return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf)); + if (__buflen > __glibc_objsize (__buf)) + return __ttyname_r_chk_warn (__fd, __buf, __buflen, + __glibc_objsize (__buf)); } return __ttyname_r_alias (__fd, __buf, __buflen); } @@ -326,13 +335,14 @@ extern int __REDIRECT (__getlogin_r_chk_warn, __fortify_function int getlogin_r (char *__buf, size_t __buflen) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) - return __getlogin_r_chk (__buf, __buflen, __bos (__buf)); + return __getlogin_r_chk (__buf, __buflen, __glibc_objsize (__buf)); - if (__buflen > __bos (__buf)) - return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf)); + if (__buflen > __glibc_objsize (__buf)) + return __getlogin_r_chk_warn (__buf, __buflen, + __glibc_objsize (__buf)); } return __getlogin_r_alias (__buf, __buflen); } @@ -354,13 +364,14 @@ extern int __REDIRECT_NTH (__gethostname_chk_warn, __fortify_function int __NTH (gethostname (char *__buf, size_t __buflen)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) - return __gethostname_chk (__buf, __buflen, __bos (__buf)); + return __gethostname_chk (__buf, __buflen, __glibc_objsize (__buf)); - if (__buflen > __bos (__buf)) - return __gethostname_chk_warn (__buf, __buflen, __bos (__buf)); + if (__buflen > __glibc_objsize (__buf)) + return __gethostname_chk_warn (__buf, __buflen, + __glibc_objsize (__buf)); } return __gethostname_alias (__buf, __buflen); } @@ -384,13 +395,14 @@ extern int __REDIRECT_NTH (__getdomainname_chk_warn, __fortify_function int __NTH (getdomainname (char *__buf, size_t __buflen)) { - if (__bos (__buf) != (size_t) -1) + if (__glibc_objsize (__buf) != (size_t) -1) { if (!__builtin_constant_p (__buflen)) - return __getdomainname_chk (__buf, __buflen, __bos (__buf)); + return __getdomainname_chk (__buf, __buflen, __glibc_objsize (__buf)); - if (__buflen > __bos (__buf)) - return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf)); + if (__buflen > __glibc_objsize (__buf)) + return __getdomainname_chk_warn (__buf, __buflen, + __glibc_objsize (__buf)); } return __getdomainname_alias (__buf, __buflen); } diff --git a/lib/libc/include/generic-glibc/bits/unistd_ext.h b/lib/libc/include/generic-glibc/bits/unistd_ext.h index ab15da337a..94ad5474d2 100644 --- a/lib/libc/include/generic-glibc/bits/unistd_ext.h +++ b/lib/libc/include/generic-glibc/bits/unistd_ext.h @@ -1,5 +1,5 @@ /* System-specific extensions of , Linux version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/utmp.h b/lib/libc/include/generic-glibc/bits/utmp.h index afb073a7c0..bf103669e7 100644 --- a/lib/libc/include/generic-glibc/bits/utmp.h +++ b/lib/libc/include/generic-glibc/bits/utmp.h @@ -1,5 +1,5 @@ /* The `struct utmp' type, describing entries in the utmp file. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/utmpx.h b/lib/libc/include/generic-glibc/bits/utmpx.h index 84f0ed6ae4..ea2179fb4d 100644 --- a/lib/libc/include/generic-glibc/bits/utmpx.h +++ b/lib/libc/include/generic-glibc/bits/utmpx.h @@ -1,5 +1,5 @@ /* Structures and definitions for the user accounting database. GNU version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/utsname.h b/lib/libc/include/generic-glibc/bits/utsname.h index 9aec7b5b0b..dc073157cb 100644 --- a/lib/libc/include/generic-glibc/bits/utsname.h +++ b/lib/libc/include/generic-glibc/bits/utsname.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/waitflags.h b/lib/libc/include/generic-glibc/bits/waitflags.h index 8df47ef1f4..6f00f8b551 100644 --- a/lib/libc/include/generic-glibc/bits/waitflags.h +++ b/lib/libc/include/generic-glibc/bits/waitflags.h @@ -1,5 +1,5 @@ /* Definitions of flag bits for `waitpid' et al. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/waitstatus.h b/lib/libc/include/generic-glibc/bits/waitstatus.h index 8d5cd9fa89..a7735631c1 100644 --- a/lib/libc/include/generic-glibc/bits/waitstatus.h +++ b/lib/libc/include/generic-glibc/bits/waitstatus.h @@ -1,5 +1,5 @@ /* Definitions of status bits for `wait' et al. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/wchar-ldbl.h b/lib/libc/include/generic-glibc/bits/wchar-ldbl.h index 7067a9c3e3..47e0347493 100644 --- a/lib/libc/include/generic-glibc/bits/wchar-ldbl.h +++ b/lib/libc/include/generic-glibc/bits/wchar-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for functions. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/wchar.h b/lib/libc/include/generic-glibc/bits/wchar.h index 19a6b96a2e..ad8b4e2664 100644 --- a/lib/libc/include/generic-glibc/bits/wchar.h +++ b/lib/libc/include/generic-glibc/bits/wchar.h @@ -1,5 +1,5 @@ /* wchar_t type related definitions. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/wchar2.h b/lib/libc/include/generic-glibc/bits/wchar2.h index c3d6975342..0e15ea3923 100644 --- a/lib/libc/include/generic-glibc/bits/wchar2.h +++ b/lib/libc/include/generic-glibc/bits/wchar2.h @@ -1,5 +1,5 @@ /* Checking macros for wchar functions. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,15 +39,15 @@ __fortify_function wchar_t * __NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { - if (__bos0 (__s1) != (size_t) -1) + if (__glibc_objsize0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmemcpy_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + __glibc_objsize0 (__s1) / sizeof (wchar_t)); - if (__n > __bos0 (__s1) / sizeof (wchar_t)) + if (__n > __glibc_objsize0 (__s1) / sizeof (wchar_t)) return __wmemcpy_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + __glibc_objsize0 (__s1) / sizeof (wchar_t)); } return __wmemcpy_alias (__s1, __s2, __n); } @@ -67,15 +67,16 @@ extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn, __fortify_function wchar_t * __NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) { - if (__bos0 (__s1) != (size_t) -1) + if (__glibc_objsize0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmemmove_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + __glibc_objsize0 (__s1) / sizeof (wchar_t)); - if (__n > __bos0 (__s1) / sizeof (wchar_t)) + if (__n > __glibc_objsize0 (__s1) / sizeof (wchar_t)) return __wmemmove_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + (__glibc_objsize0 (__s1) + / sizeof (wchar_t))); } return __wmemmove_alias (__s1, __s2, __n); } @@ -100,15 +101,16 @@ __fortify_function wchar_t * __NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { - if (__bos0 (__s1) != (size_t) -1) + if (__glibc_objsize0 (__s1) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wmempcpy_chk (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + __glibc_objsize0 (__s1) / sizeof (wchar_t)); - if (__n > __bos0 (__s1) / sizeof (wchar_t)) + if (__n > __glibc_objsize0 (__s1) / sizeof (wchar_t)) return __wmempcpy_chk_warn (__s1, __s2, __n, - __bos0 (__s1) / sizeof (wchar_t)); + (__glibc_objsize0 (__s1) + / sizeof (wchar_t))); } return __wmempcpy_alias (__s1, __s2, __n); } @@ -128,14 +130,15 @@ extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn, __fortify_function wchar_t * __NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) { - if (__bos0 (__s) != (size_t) -1) + if (__glibc_objsize0 (__s) != (size_t) -1) { if (!__builtin_constant_p (__n)) - return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); + return __wmemset_chk (__s, __c, __n, + __glibc_objsize0 (__s) / sizeof (wchar_t)); - if (__n > __bos0 (__s) / sizeof (wchar_t)) + if (__n > __glibc_objsize0 (__s) / sizeof (wchar_t)) return __wmemset_chk_warn (__s, __c, __n, - __bos0 (__s) / sizeof (wchar_t)); + __glibc_objsize0 (__s) / sizeof (wchar_t)); } return __wmemset_alias (__s, __c, __n); } @@ -151,8 +154,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, __fortify_function wchar_t * __NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - if (__bos (__dest) != (size_t) -1) - return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); + if (__glibc_objsize (__dest) != (size_t) -1) + return __wcscpy_chk (__dest, __src, + __glibc_objsize (__dest) / sizeof (wchar_t)); return __wcscpy_alias (__dest, __src); } @@ -167,8 +171,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, __fortify_function wchar_t * __NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - if (__bos (__dest) != (size_t) -1) - return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); + if (__glibc_objsize (__dest) != (size_t) -1) + return __wcpcpy_chk (__dest, __src, + __glibc_objsize (__dest) / sizeof (wchar_t)); return __wcpcpy_alias (__dest, __src); } @@ -191,14 +196,15 @@ __fortify_function wchar_t * __NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { - if (__bos (__dest) != (size_t) -1) + if (__glibc_objsize (__dest) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wcsncpy_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - if (__n > __bos (__dest) / sizeof (wchar_t)) + __glibc_objsize (__dest) / sizeof (wchar_t)); + if (__n > __glibc_objsize (__dest) / sizeof (wchar_t)) return __wcsncpy_chk_warn (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); + (__glibc_objsize (__dest) + / sizeof (wchar_t))); } return __wcsncpy_alias (__dest, __src, __n); } @@ -222,14 +228,15 @@ __fortify_function wchar_t * __NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { - if (__bos (__dest) != (size_t) -1) + if (__glibc_objsize (__dest) != (size_t) -1) { if (!__builtin_constant_p (__n)) return __wcpncpy_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); - if (__n > __bos (__dest) / sizeof (wchar_t)) + __glibc_objsize (__dest) / sizeof (wchar_t)); + if (__n > __glibc_objsize (__dest) / sizeof (wchar_t)) return __wcpncpy_chk_warn (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); + (__glibc_objsize (__dest) + / sizeof (wchar_t))); } return __wcpncpy_alias (__dest, __src, __n); } @@ -245,8 +252,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias, __fortify_function wchar_t * __NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - if (__bos (__dest) != (size_t) -1) - return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); + if (__glibc_objsize (__dest) != (size_t) -1) + return __wcscat_chk (__dest, __src, + __glibc_objsize (__dest) / sizeof (wchar_t)); return __wcscat_alias (__dest, __src); } @@ -263,9 +271,9 @@ __fortify_function wchar_t * __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { - if (__bos (__dest) != (size_t) -1) + if (__glibc_objsize (__dest) != (size_t) -1) return __wcsncat_chk (__dest, __src, __n, - __bos (__dest) / sizeof (wchar_t)); + __glibc_objsize (__dest) / sizeof (wchar_t)); return __wcsncat_alias (__dest, __src, __n); } @@ -285,18 +293,18 @@ __fortify_function int __NTH (swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...)) { - if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) + if (__glibc_objsize (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s) / sizeof (wchar_t), + __glibc_objsize (__s) / sizeof (wchar_t), __fmt, __va_arg_pack ()); return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus /* XXX We might want to have support in gcc for swprintf. */ # define swprintf(s, n, ...) \ - (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \ + (__glibc_objsize (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \ ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \ - __bos (s) / sizeof (wchar_t), __VA_ARGS__) \ + __glibc_objsize (s) / sizeof (wchar_t), __VA_ARGS__) \ : swprintf (s, n, __VA_ARGS__)) #endif @@ -315,9 +323,10 @@ __fortify_function int __NTH (vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) { - if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) + if (__glibc_objsize (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - __bos (__s) / sizeof (wchar_t), __fmt, __ap); + __glibc_objsize (__s) / sizeof (wchar_t), __fmt, + __ap); return __vswprintf_alias (__s, __n, __fmt, __ap); } @@ -383,14 +392,15 @@ extern wchar_t *__REDIRECT (__fgetws_chk_warn, __fortify_function __wur wchar_t * fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { - if (__bos (__s) != (size_t) -1) + if (__glibc_objsize (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) - return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), + return __fgetws_chk (__s, __glibc_objsize (__s) / sizeof (wchar_t), __n, __stream); - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) - return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t), + if ((size_t) __n > __glibc_objsize (__s) / sizeof (wchar_t)) + return __fgetws_chk_warn (__s, + __glibc_objsize (__s) / sizeof (wchar_t), __n, __stream); } return __fgetws_alias (__s, __n, __stream); @@ -414,14 +424,17 @@ extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn, __fortify_function __wur wchar_t * fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { - if (__bos (__s) != (size_t) -1) + if (__glibc_objsize (__s) != (size_t) -1) { if (!__builtin_constant_p (__n) || __n <= 0) - return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t), + return __fgetws_unlocked_chk (__s, + __glibc_objsize (__s) / sizeof (wchar_t), __n, __stream); - if ((size_t) __n > __bos (__s) / sizeof (wchar_t)) - return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t), + if ((size_t) __n > __glibc_objsize (__s) / sizeof (wchar_t)) + return __fgetws_unlocked_chk_warn (__s, + (__glibc_objsize (__s) + / sizeof (wchar_t)), __n, __stream); } return __fgetws_unlocked_alias (__s, __n, __stream); @@ -447,8 +460,9 @@ __NTH (wcrtomb (char *__restrict __s, wchar_t __wchar, #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif - if (__bos (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __bos (__s)) - return __wcrtomb_chk (__s, __wchar, __ps, __bos (__s)); + if (__glibc_objsize (__s) != (size_t) -1 + && __WCHAR_MB_LEN_MAX > __glibc_objsize (__s)) + return __wcrtomb_chk (__s, __wchar, __ps, __glibc_objsize (__s)); return __wcrtomb_alias (__s, __wchar, __ps); } @@ -474,15 +488,16 @@ __fortify_function size_t __NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbsrtowcs_chk (__dst, __src, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); + __glibc_objsize (__dst) / sizeof (wchar_t)); - if (__len > __bos (__dst) / sizeof (wchar_t)) + if (__len > __glibc_objsize (__dst) / sizeof (wchar_t)) return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); + (__glibc_objsize (__dst) + / sizeof (wchar_t))); } return __mbsrtowcs_alias (__dst, __src, __len, __ps); } @@ -508,13 +523,15 @@ __fortify_function size_t __NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) - return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst)); + return __wcsrtombs_chk (__dst, __src, __len, __ps, + __glibc_objsize (__dst)); - if (__len > __bos (__dst)) - return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst)); + if (__len > __glibc_objsize (__dst)) + return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, + __glibc_objsize (__dst)); } return __wcsrtombs_alias (__dst, __src, __len, __ps); } @@ -542,15 +559,16 @@ __fortify_function size_t __NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); + __glibc_objsize (__dst) / sizeof (wchar_t)); - if (__len > __bos (__dst) / sizeof (wchar_t)) + if (__len > __glibc_objsize (__dst) / sizeof (wchar_t)) return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps, - __bos (__dst) / sizeof (wchar_t)); + (__glibc_objsize (__dst) + / sizeof (wchar_t))); } return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps); } @@ -578,15 +596,15 @@ __fortify_function size_t __NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) { - if (__bos (__dst) != (size_t) -1) + if (__glibc_objsize (__dst) != (size_t) -1) { if (!__builtin_constant_p (__len)) return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, - __bos (__dst)); + __glibc_objsize (__dst)); - if (__len > __bos (__dst)) + if (__len > __glibc_objsize (__dst)) return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps, - __bos (__dst)); + __glibc_objsize (__dst)); } return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps); } diff --git a/lib/libc/include/generic-glibc/bits/wctype-wchar.h b/lib/libc/include/generic-glibc/bits/wctype-wchar.h index 90f3927265..942d11a140 100644 --- a/lib/libc/include/generic-glibc/bits/wctype-wchar.h +++ b/lib/libc/include/generic-glibc/bits/wctype-wchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/wordsize.h b/lib/libc/include/generic-glibc/bits/wordsize.h index d5ed6b4522..9e405e4e4e 100644 --- a/lib/libc/include/generic-glibc/bits/wordsize.h +++ b/lib/libc/include/generic-glibc/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/bits/xopen_lim.h b/lib/libc/include/generic-glibc/bits/xopen_lim.h index b3d0958bbd..c99f352113 100644 --- a/lib/libc/include/generic-glibc/bits/xopen_lim.h +++ b/lib/libc/include/generic-glibc/bits/xopen_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/byteswap.h b/lib/libc/include/generic-glibc/byteswap.h index ab236221f2..075ee64046 100644 --- a/lib/libc/include/generic-glibc/byteswap.h +++ b/lib/libc/include/generic-glibc/byteswap.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Swap byte order for 16, 32 and 64 bit values + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,10 +25,10 @@ #include -/* The following definitions must all be macros since otherwise some +/* The following definitions must all be macros, otherwise some of the possible optimizations are not possible. */ -/* Return a value with all bytes in the 16 bit argument swapped. */ +/* Return a value with both bytes in the 16 bit argument swapped. */ #define bswap_16(x) __bswap_16 (x) /* Return a value with all bytes in the 32 bit argument swapped. */ diff --git a/lib/libc/include/generic-glibc/complex.h b/lib/libc/include/generic-glibc/complex.h index 9510f64101..04fc55d55c 100644 --- a/lib/libc/include/generic-glibc/complex.h +++ b/lib/libc/include/generic-glibc/complex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/cpio.h b/lib/libc/include/generic-glibc/cpio.h index 10c1f91b8f..45b38af0aa 100644 --- a/lib/libc/include/generic-glibc/cpio.h +++ b/lib/libc/include/generic-glibc/cpio.h @@ -1,6 +1,6 @@ /* Extended cpio format from POSIX.1. This file is part of the GNU C Library. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU cpio. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/crypt.h b/lib/libc/include/generic-glibc/crypt.h index a2e9f11432..baa5549666 100644 --- a/lib/libc/include/generic-glibc/crypt.h +++ b/lib/libc/include/generic-glibc/crypt.h @@ -1,7 +1,7 @@ /* * UFC-crypt: ultra fast crypt(3) implementation * - * Copyright (C) 1991-2020 Free Software Foundation, Inc. + * Copyright (C) 1991-2021 Free Software Foundation, Inc. * * The GNU C Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/generic-glibc/ctype.h b/lib/libc/include/generic-glibc/ctype.h index 47e7d3a9c3..7417f91a32 100644 --- a/lib/libc/include/generic-glibc/ctype.h +++ b/lib/libc/include/generic-glibc/ctype.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/dirent.h b/lib/libc/include/generic-glibc/dirent.h index 749982ada9..5b094807a5 100644 --- a/lib/libc/include/generic-glibc/dirent.h +++ b/lib/libc/include/generic-glibc/dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/dlfcn.h b/lib/libc/include/generic-glibc/dlfcn.h index 8154e47d1a..8fa3a090b0 100644 --- a/lib/libc/include/generic-glibc/dlfcn.h +++ b/lib/libc/include/generic-glibc/dlfcn.h @@ -1,5 +1,5 @@ /* User functions for run-time dynamic loading. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,7 +40,7 @@ # define RTLD_DEFAULT ((void *) 0) -/* Type for namespace indeces. */ +/* Type for namespace indices. */ typedef long int Lmid_t; /* Special namespace ID values. */ diff --git a/lib/libc/include/generic-glibc/elf.h b/lib/libc/include/generic-glibc/elf.h index 58b7bc8e2b..4cf698fa9f 100644 --- a/lib/libc/include/generic-glibc/elf.h +++ b/lib/libc/include/generic-glibc/elf.h @@ -1,5 +1,5 @@ /* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +19,6 @@ #ifndef _ELF_H #define _ELF_H 1 -#include - -__BEGIN_DECLS - /* Standard ELF types. */ #include @@ -322,7 +318,7 @@ typedef struct /* reserved 184 */ #define EM_AVR32 185 /* Amtel 32-bit microprocessor */ #define EM_STM8 186 /* STMicroelectronics STM8 */ -#define EM_TILE64 187 /* Tileta TILE64 */ +#define EM_TILE64 187 /* Tilera TILE64 */ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ #define EM_CUDA 190 /* NVIDIA CUDA */ @@ -445,7 +441,7 @@ typedef struct #define SHT_FINI_ARRAY 15 /* Array of destructors */ #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ #define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific. */ #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ @@ -482,6 +478,7 @@ typedef struct #define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ #define SHF_MASKOS 0x0ff00000 /* OS-specific. */ #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ +#define SHF_GNU_RETAIN (1 << 21) /* Not to be GCed by linker. */ #define SHF_ORDERED (1 << 30) /* Special ordering requirement (Solaris). */ #define SHF_EXCLUDE (1U << 31) /* Section is excluded unless @@ -1050,7 +1047,7 @@ typedef struct #define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ #define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -/* Auxialiary version information. */ +/* Auxiliary version information. */ typedef struct { @@ -1327,31 +1324,26 @@ typedef struct /* The x86 instruction sets indicated by the corresponding bits are used in program. Their support in the hardware is optional. */ -#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 +#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002 /* The x86 instruction sets indicated by the corresponding bits are used in program and they must be supported by the hardware. */ -#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 +#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002 /* X86 processor-specific features used in program. */ #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 -#define GNU_PROPERTY_X86_ISA_1_486 (1U << 0) -#define GNU_PROPERTY_X86_ISA_1_586 (1U << 1) -#define GNU_PROPERTY_X86_ISA_1_686 (1U << 2) -#define GNU_PROPERTY_X86_ISA_1_SSE (1U << 3) -#define GNU_PROPERTY_X86_ISA_1_SSE2 (1U << 4) -#define GNU_PROPERTY_X86_ISA_1_SSE3 (1U << 5) -#define GNU_PROPERTY_X86_ISA_1_SSSE3 (1U << 6) -#define GNU_PROPERTY_X86_ISA_1_SSE4_1 (1U << 7) -#define GNU_PROPERTY_X86_ISA_1_SSE4_2 (1U << 8) -#define GNU_PROPERTY_X86_ISA_1_AVX (1U << 9) -#define GNU_PROPERTY_X86_ISA_1_AVX2 (1U << 10) -#define GNU_PROPERTY_X86_ISA_1_AVX512F (1U << 11) -#define GNU_PROPERTY_X86_ISA_1_AVX512CD (1U << 12) -#define GNU_PROPERTY_X86_ISA_1_AVX512ER (1U << 13) -#define GNU_PROPERTY_X86_ISA_1_AVX512PF (1U << 14) -#define GNU_PROPERTY_X86_ISA_1_AVX512VL (1U << 15) -#define GNU_PROPERTY_X86_ISA_1_AVX512DQ (1U << 16) -#define GNU_PROPERTY_X86_ISA_1_AVX512BW (1U << 17) +/* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld), + MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2. */ +#define GNU_PROPERTY_X86_ISA_1_BASELINE (1U << 0) +/* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE, + CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3, + SSSE3, SSE4.1 and SSE4.2. */ +#define GNU_PROPERTY_X86_ISA_1_V2 (1U << 1) +/* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1, + BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE. */ +#define GNU_PROPERTY_X86_ISA_1_V3 (1U << 2) +/* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F, + AVX512BW, AVX512CD, AVX512DQ and AVX512VL. */ +#define GNU_PROPERTY_X86_ISA_1_V4 (1U << 3) /* This indicates that all executable sections are compatible with IBT. */ @@ -2143,9 +2135,9 @@ enum #define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ #define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -/* Additional section indeces. */ +/* Additional section indices. */ -#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared +#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared symbols in ANSI C. */ #define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ @@ -2875,6 +2867,8 @@ enum #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */ /* AArch64 specific values for the Dyn d_tag field. */ +#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1) +#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3) #define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5) #define DT_AARCH64_NUM 6 @@ -3972,7 +3966,7 @@ enum #define R_METAG_RELBRANCH 4 #define R_METAG_GETSETOFF 5 -/* Backward compatability */ +/* Backward compatibility */ #define R_METAG_REG32OP1 6 #define R_METAG_REG32OP2 7 #define R_METAG_REG32OP3 8 @@ -4103,6 +4097,4 @@ enum #define R_ARC_TLS_LE_S9 0x4a #define R_ARC_TLS_LE_32 0x4b -__END_DECLS - #endif /* elf.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/endian.h b/lib/libc/include/generic-glibc/endian.h index efc23f0df5..b72d888f34 100644 --- a/lib/libc/include/generic-glibc/endian.h +++ b/lib/libc/include/generic-glibc/endian.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/envz.h b/lib/libc/include/generic-glibc/envz.h index 6f4e67063f..f58aae10ee 100644 --- a/lib/libc/include/generic-glibc/envz.h +++ b/lib/libc/include/generic-glibc/envz.h @@ -1,5 +1,5 @@ /* Routines for dealing with '\0' separated environment vectors - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/err.h b/lib/libc/include/generic-glibc/err.h index f505f646b2..8dc0d54bf1 100644 --- a/lib/libc/include/generic-glibc/err.h +++ b/lib/libc/include/generic-glibc/err.h @@ -1,5 +1,5 @@ /* 4.4BSD utility functions for error messages. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/errno.h b/lib/libc/include/generic-glibc/errno.h index 203c04a9a0..2fe78325ac 100644 --- a/lib/libc/include/generic-glibc/errno.h +++ b/lib/libc/include/generic-glibc/errno.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/error.h b/lib/libc/include/generic-glibc/error.h index dfd1623e1a..4b024e0b9e 100644 --- a/lib/libc/include/generic-glibc/error.h +++ b/lib/libc/include/generic-glibc/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/execinfo.h b/lib/libc/include/generic-glibc/execinfo.h index 47e9befbc9..efee46f766 100644 --- a/lib/libc/include/generic-glibc/execinfo.h +++ b/lib/libc/include/generic-glibc/execinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fcntl.h b/lib/libc/include/generic-glibc/fcntl.h index a1cecb55c4..d84aefa62f 100644 --- a/lib/libc/include/generic-glibc/fcntl.h +++ b/lib/libc/include/generic-glibc/fcntl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/features.h b/lib/libc/include/generic-glibc/features.h index ed3e1cd728..47b1935cb3 100644 --- a/lib/libc/include/generic-glibc/features.h +++ b/lib/libc/include/generic-glibc/features.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -397,7 +397,15 @@ # warning _FORTIFY_SOURCE requires compiling with optimization (-O) # elif !__GNUC_PREREQ (4, 1) # warning _FORTIFY_SOURCE requires GCC 4.1 or later +# elif _FORTIFY_SOURCE > 2 && __glibc_clang_prereq (9, 0) +# if _FORTIFY_SOURCE > 3 +# warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform +# endif +# define __USE_FORTIFY_LEVEL 3 # elif _FORTIFY_SOURCE > 1 +# if _FORTIFY_SOURCE > 2 +# warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform +# endif # define __USE_FORTIFY_LEVEL 2 # else # define __USE_FORTIFY_LEVEL 1 @@ -454,7 +462,7 @@ /* Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. */ #define __GLIBC__ 2 -#define __GLIBC_MINOR__ 32 +#define __GLIBC_MINOR__ 33 #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) diff --git a/lib/libc/include/generic-glibc/fenv.h b/lib/libc/include/generic-glibc/fenv.h index 833583f5b9..978d81009d 100644 --- a/lib/libc/include/generic-glibc/fenv.h +++ b/lib/libc/include/generic-glibc/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/finclude/math-vector-fortran.h b/lib/libc/include/generic-glibc/finclude/math-vector-fortran.h index d348de2ba8..0f2ebfeba3 100644 --- a/lib/libc/include/generic-glibc/finclude/math-vector-fortran.h +++ b/lib/libc/include/generic-glibc/finclude/math-vector-fortran.h @@ -1,5 +1,5 @@ ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- -! Copyright (C) 2019-2020 Free Software Foundation, Inc. +! Copyright (C) 2019-2021 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fmtmsg.h b/lib/libc/include/generic-glibc/fmtmsg.h index d5a747857a..6bdb421cd6 100644 --- a/lib/libc/include/generic-glibc/fmtmsg.h +++ b/lib/libc/include/generic-glibc/fmtmsg.h @@ -1,5 +1,5 @@ /* Message display handling. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fnmatch.h b/lib/libc/include/generic-glibc/fnmatch.h index a3db95e9ce..acea08c1d8 100644 --- a/lib/libc/include/generic-glibc/fnmatch.h +++ b/lib/libc/include/generic-glibc/fnmatch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fpregdef.h b/lib/libc/include/generic-glibc/fpregdef.h index 5729b54a90..7c670560e0 100644 --- a/lib/libc/include/generic-glibc/fpregdef.h +++ b/lib/libc/include/generic-glibc/fpregdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fpu_control.h b/lib/libc/include/generic-glibc/fpu_control.h index d5aa21113b..729526935e 100644 --- a/lib/libc/include/generic-glibc/fpu_control.h +++ b/lib/libc/include/generic-glibc/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. Mips version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/fts.h b/lib/libc/include/generic-glibc/fts.h index 3ae4e30544..88183efb90 100644 --- a/lib/libc/include/generic-glibc/fts.h +++ b/lib/libc/include/generic-glibc/fts.h @@ -1,5 +1,5 @@ /* File tree traversal functions declarations. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/ftw.h b/lib/libc/include/generic-glibc/ftw.h index 498b96a5d0..6f7b312bd3 100644 --- a/lib/libc/include/generic-glibc/ftw.h +++ b/lib/libc/include/generic-glibc/ftw.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/gconv.h b/lib/libc/include/generic-glibc/gconv.h index 0999ee4ee7..8c7b942227 100644 --- a/lib/libc/include/generic-glibc/gconv.h +++ b/lib/libc/include/generic-glibc/gconv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/getopt.h b/lib/libc/include/generic-glibc/getopt.h index 64dde19021..7b879b96ef 100644 --- a/lib/libc/include/generic-glibc/getopt.h +++ b/lib/libc/include/generic-glibc/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Unlike the bulk of the getopt implementation, this file is NOT part of gnulib; gnulib also has a getopt.h but it is different. diff --git a/lib/libc/include/generic-glibc/glob.h b/lib/libc/include/generic-glibc/glob.h index 1de9742bc0..07645f1229 100644 --- a/lib/libc/include/generic-glibc/glob.h +++ b/lib/libc/include/generic-glibc/glob.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/gnu-versions.h b/lib/libc/include/generic-glibc/gnu-versions.h index 557411b4c2..4f5206c97e 100644 --- a/lib/libc/include/generic-glibc/gnu-versions.h +++ b/lib/libc/include/generic-glibc/gnu-versions.h @@ -1,5 +1,5 @@ /* Header with interface version macros for library pieces copied elsewhere. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/gnu/libc-version.h b/lib/libc/include/generic-glibc/gnu/libc-version.h index 3b0b2c8f37..76852fcb24 100644 --- a/lib/libc/include/generic-glibc/gnu/libc-version.h +++ b/lib/libc/include/generic-glibc/gnu/libc-version.h @@ -1,5 +1,5 @@ /* Interface to GNU libc specific functions for version information. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/grp.h b/lib/libc/include/generic-glibc/grp.h index f0edfc67d9..b7c890f673 100644 --- a/lib/libc/include/generic-glibc/grp.h +++ b/lib/libc/include/generic-glibc/grp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/gshadow.h b/lib/libc/include/generic-glibc/gshadow.h index b71866ae13..d784c8ce53 100644 --- a/lib/libc/include/generic-glibc/gshadow.h +++ b/lib/libc/include/generic-glibc/gshadow.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2020 Free Software Foundation, Inc. +/* Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/iconv.h b/lib/libc/include/generic-glibc/iconv.h index cec0ffd235..8a5722ae93 100644 --- a/lib/libc/include/generic-glibc/iconv.h +++ b/lib/libc/include/generic-glibc/iconv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/ieee754.h b/lib/libc/include/generic-glibc/ieee754.h index 714f12c300..e25e6187cc 100644 --- a/lib/libc/include/generic-glibc/ieee754.h +++ b/lib/libc/include/generic-glibc/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/ifaddrs.h b/lib/libc/include/generic-glibc/ifaddrs.h index 0cee010fa4..6f866c018f 100644 --- a/lib/libc/include/generic-glibc/ifaddrs.h +++ b/lib/libc/include/generic-glibc/ifaddrs.h @@ -1,5 +1,5 @@ /* ifaddrs.h -- declarations for getting network interface addresses - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/inttypes.h b/lib/libc/include/generic-glibc/inttypes.h index 7734ebce74..86bbd004fa 100644 --- a/lib/libc/include/generic-glibc/inttypes.h +++ b/lib/libc/include/generic-glibc/inttypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -311,124 +311,6 @@ extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, __gwchar_t ** __restrict __endptr, int __base) __THROW; -#ifdef __USE_EXTERN_INLINES - -# if __WORDSIZE == 64 - -extern long int __strtol_internal (const char *__restrict __nptr, - char **__restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `strtol' but convert to `intmax_t'. */ -__extern_inline intmax_t -__NTH (strtoimax (const char *__restrict __nptr, char **__restrict __endptr, - int __base)) -{ - return __strtol_internal (__nptr, __endptr, __base, 0); -} - -extern unsigned long int __strtoul_internal (const char *__restrict __nptr, - char ** __restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `strtoul' but convert to `uintmax_t'. */ -__extern_inline uintmax_t -__NTH (strtoumax (const char *__restrict __nptr, char **__restrict __endptr, - int __base)) -{ - return __strtoul_internal (__nptr, __endptr, __base, 0); -} - -extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr, - __gwchar_t **__restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `wcstol' but convert to `intmax_t'. */ -__extern_inline intmax_t -__NTH (wcstoimax (const __gwchar_t *__restrict __nptr, - __gwchar_t **__restrict __endptr, int __base)) -{ - return __wcstol_internal (__nptr, __endptr, __base, 0); -} - -extern unsigned long int __wcstoul_internal (const __gwchar_t * - __restrict __nptr, - __gwchar_t ** - __restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `wcstoul' but convert to `uintmax_t'. */ -__extern_inline uintmax_t -__NTH (wcstoumax (const __gwchar_t *__restrict __nptr, - __gwchar_t **__restrict __endptr, int __base)) -{ - return __wcstoul_internal (__nptr, __endptr, __base, 0); -} - -# else /* __WORDSIZE == 32 */ - -__extension__ -extern long long int __strtoll_internal (const char *__restrict __nptr, - char **__restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `strtol' but convert to `intmax_t'. */ -__extern_inline intmax_t -__NTH (strtoimax (const char *__restrict __nptr, char **__restrict __endptr, - int __base)) -{ - return __strtoll_internal (__nptr, __endptr, __base, 0); -} - -__extension__ -extern unsigned long long int __strtoull_internal (const char * - __restrict __nptr, - char ** - __restrict __endptr, - int __base, - int __group) - __THROW __nonnull ((1)) __wur; -/* Like `strtoul' but convert to `uintmax_t'. */ -__extern_inline uintmax_t -__NTH (strtoumax (const char *__restrict __nptr, char **__restrict __endptr, - int __base)) -{ - return __strtoull_internal (__nptr, __endptr, __base, 0); -} - -__extension__ -extern long long int __wcstoll_internal (const __gwchar_t *__restrict __nptr, - __gwchar_t **__restrict __endptr, - int __base, int __group) - __THROW __nonnull ((1)) __wur; -/* Like `wcstol' but convert to `intmax_t'. */ -__extern_inline intmax_t -__NTH (wcstoimax (const __gwchar_t *__restrict __nptr, - __gwchar_t **__restrict __endptr, int __base)) -{ - return __wcstoll_internal (__nptr, __endptr, __base, 0); -} - - -__extension__ -extern unsigned long long int __wcstoull_internal (const __gwchar_t * - __restrict __nptr, - __gwchar_t ** - __restrict __endptr, - int __base, - int __group) - __THROW __nonnull ((1)) __wur; -/* Like `wcstoul' but convert to `uintmax_t'. */ -__extern_inline uintmax_t -__NTH (wcstoumax (const __gwchar_t *__restrict __nptr, - __gwchar_t **__restrict __endptr, int __base)) -{ - return __wcstoull_internal (__nptr, __endptr, __base, 0); -} - -# endif /* __WORDSIZE == 32 */ -#endif /* Use extern inlines. */ - __END_DECLS #endif /* inttypes.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/langinfo.h b/lib/libc/include/generic-glibc/langinfo.h index 58136e3c87..5c04c86774 100644 --- a/lib/libc/include/generic-glibc/langinfo.h +++ b/lib/libc/include/generic-glibc/langinfo.h @@ -1,5 +1,5 @@ /* Access to locale-dependent parameters. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/libgen.h b/lib/libc/include/generic-glibc/libgen.h index 8cab6ad40b..de85144d8d 100644 --- a/lib/libc/include/generic-glibc/libgen.h +++ b/lib/libc/include/generic-glibc/libgen.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/libintl.h b/lib/libc/include/generic-glibc/libintl.h index ace47b01ab..5c3eb1e8ad 100644 --- a/lib/libc/include/generic-glibc/libintl.h +++ b/lib/libc/include/generic-glibc/libintl.h @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. diff --git a/lib/libc/include/generic-glibc/limits.h b/lib/libc/include/generic-glibc/limits.h index 96ad92cc80..a5a9f317ac 100644 --- a/lib/libc/include/generic-glibc/limits.h +++ b/lib/libc/include/generic-glibc/limits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -178,6 +178,18 @@ # endif #endif /* Use IEC_60559_BFP_EXT. */ +/* The macros for _Bool are not defined by GCC's before GCC + 11, or if _GNU_SOURCE is defined rather than enabling C2x support + with -std. */ +#if __GLIBC_USE (ISOC2X) +# ifndef BOOL_MAX +# define BOOL_MAX 1 +# endif +# ifndef BOOL_WIDTH +# define BOOL_WIDTH 1 +# endif +#endif + #ifdef __USE_POSIX /* POSIX adds things to . */ # include diff --git a/lib/libc/include/generic-glibc/link.h b/lib/libc/include/generic-glibc/link.h index 1f4e089dd6..a32d10ede9 100644 --- a/lib/libc/include/generic-glibc/link.h +++ b/lib/libc/include/generic-glibc/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/locale.h b/lib/libc/include/generic-glibc/locale.h index 02ef91c937..f54d4240af 100644 --- a/lib/libc/include/generic-glibc/locale.h +++ b/lib/libc/include/generic-glibc/locale.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/malloc.h b/lib/libc/include/generic-glibc/malloc.h index fd73ea1c79..893014fc39 100644 --- a/lib/libc/include/generic-glibc/malloc.h +++ b/lib/libc/include/generic-glibc/malloc.h @@ -1,5 +1,5 @@ /* Prototypes and definition for malloc implementation. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -97,8 +97,28 @@ struct mallinfo int keepcost; /* top-most, releasable (via malloc_trim) space */ }; +/* SVID2/XPG mallinfo2 structure which can handle allocations + bigger than 4GB. */ + +struct mallinfo2 +{ + size_t arena; /* non-mmapped space allocated from system */ + size_t ordblks; /* number of free chunks */ + size_t smblks; /* number of fastbin blocks */ + size_t hblks; /* number of mmapped regions */ + size_t hblkhd; /* space in mmapped regions */ + size_t usmblks; /* always 0, preserved for backwards compatibility */ + size_t fsmblks; /* space available in freed fastbin blocks */ + size_t uordblks; /* total allocated space */ + size_t fordblks; /* total free space */ + size_t keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + /* Returns a copy of the updated current mallinfo. */ -extern struct mallinfo mallinfo (void) __THROW; +extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED; + +/* Returns a copy of the updated current mallinfo. */ +extern struct mallinfo2 mallinfo2 (void) __THROW; /* SVID2/XPG mallopt options */ #ifndef M_MXFAST diff --git a/lib/libc/include/generic-glibc/math.h b/lib/libc/include/generic-glibc/math.h index 1956311cb8..99c89c05ef 100644 --- a/lib/libc/include/generic-glibc/math.h +++ b/lib/libc/include/generic-glibc/math.h @@ -1,5 +1,5 @@ /* Declarations for math functions. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/mcheck.h b/lib/libc/include/generic-glibc/mcheck.h index 9814deb4f3..fe26edad9f 100644 --- a/lib/libc/include/generic-glibc/mcheck.h +++ b/lib/libc/include/generic-glibc/mcheck.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/memory.h b/lib/libc/include/generic-glibc/memory.h index 7b2abf85e4..2280d14666 100644 --- a/lib/libc/include/generic-glibc/memory.h +++ b/lib/libc/include/generic-glibc/memory.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/mntent.h b/lib/libc/include/generic-glibc/mntent.h index d258606765..f974d0b7bd 100644 --- a/lib/libc/include/generic-glibc/mntent.h +++ b/lib/libc/include/generic-glibc/mntent.h @@ -1,5 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/monetary.h b/lib/libc/include/generic-glibc/monetary.h index e8142d7b07..94fd5f87dd 100644 --- a/lib/libc/include/generic-glibc/monetary.h +++ b/lib/libc/include/generic-glibc/monetary.h @@ -1,5 +1,5 @@ /* Header file for monetary value formatting functions. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/mqueue.h b/lib/libc/include/generic-glibc/mqueue.h index 9aa3a28bbf..b2d0257f58 100644 --- a/lib/libc/include/generic-glibc/mqueue.h +++ b/lib/libc/include/generic-glibc/mqueue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/net/ethernet.h b/lib/libc/include/generic-glibc/net/ethernet.h index bc4b0d44a7..e5b5f86097 100644 --- a/lib/libc/include/generic-glibc/net/ethernet.h +++ b/lib/libc/include/generic-glibc/net/ethernet.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,7 +56,6 @@ struct ether_header #define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */ #define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ - #define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */ #define ETHER_TYPE_LEN 2 /* bytes in type field */ #define ETHER_CRC_LEN 4 /* bytes in CRC field */ @@ -64,7 +63,7 @@ struct ether_header #define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */ #define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */ -/* make sure ethenet length is valid */ +/* make sure ethernet length is valid */ #define ETHER_IS_VALID_LEN(foo) \ ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) diff --git a/lib/libc/include/generic-glibc/net/if.h b/lib/libc/include/generic-glibc/net/if.h index 799d254b99..592dfaf274 100644 --- a/lib/libc/include/generic-glibc/net/if.h +++ b/lib/libc/include/generic-glibc/net/if.h @@ -1,5 +1,5 @@ /* net/if.h -- declarations for inquiring about network interfaces - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/net/if_arp.h b/lib/libc/include/generic-glibc/net/if_arp.h index df31965129..a52d2e6209 100644 --- a/lib/libc/include/generic-glibc/net/if_arp.h +++ b/lib/libc/include/generic-glibc/net/if_arp.h @@ -1,5 +1,5 @@ /* Definitions for Address Resolution Protocol. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. diff --git a/lib/libc/include/generic-glibc/net/if_packet.h b/lib/libc/include/generic-glibc/net/if_packet.h index 599694a607..91ccf109ba 100644 --- a/lib/libc/include/generic-glibc/net/if_packet.h +++ b/lib/libc/include/generic-glibc/net/if_packet.h @@ -1,5 +1,5 @@ /* Definitions for use with Linux SOCK_PACKET sockets. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/net/if_shaper.h b/lib/libc/include/generic-glibc/net/if_shaper.h index 09ecbc2880..c27d10a414 100644 --- a/lib/libc/include/generic-glibc/net/if_shaper.h +++ b/lib/libc/include/generic-glibc/net/if_shaper.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/net/if_slip.h b/lib/libc/include/generic-glibc/net/if_slip.h index ca4571e906..fac229eff2 100644 --- a/lib/libc/include/generic-glibc/net/if_slip.h +++ b/lib/libc/include/generic-glibc/net/if_slip.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/net/route.h b/lib/libc/include/generic-glibc/net/route.h index 7e8361b292..699d1d1341 100644 --- a/lib/libc/include/generic-glibc/net/route.h +++ b/lib/libc/include/generic-glibc/net/route.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netash/ash.h b/lib/libc/include/generic-glibc/netash/ash.h index 86d1a0c1b6..a0d7be567d 100644 --- a/lib/libc/include/generic-glibc/netash/ash.h +++ b/lib/libc/include/generic-glibc/netash/ash.h @@ -1,5 +1,5 @@ /* Definitions for use with Linux AF_ASH sockets. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netatalk/at.h b/lib/libc/include/generic-glibc/netatalk/at.h index 8c4d89817f..51e36ba84f 100644 --- a/lib/libc/include/generic-glibc/netatalk/at.h +++ b/lib/libc/include/generic-glibc/netatalk/at.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netax25/ax25.h b/lib/libc/include/generic-glibc/netax25/ax25.h index c4abe6ee36..c636f2a345 100644 --- a/lib/libc/include/generic-glibc/netax25/ax25.h +++ b/lib/libc/include/generic-glibc/netax25/ax25.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netdb.h b/lib/libc/include/generic-glibc/netdb.h index 6f0b628d3b..1fe8f37e8f 100644 --- a/lib/libc/include/generic-glibc/netdb.h +++ b/lib/libc/include/generic-glibc/netdb.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/neteconet/ec.h b/lib/libc/include/generic-glibc/neteconet/ec.h index 79488deab2..06f0d1a456 100644 --- a/lib/libc/include/generic-glibc/neteconet/ec.h +++ b/lib/libc/include/generic-glibc/neteconet/ec.h @@ -1,5 +1,5 @@ /* Definitions for use with Linux AF_ECONET sockets. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/ether.h b/lib/libc/include/generic-glibc/netinet/ether.h index 8d89555cfa..e59ed7644d 100644 --- a/lib/libc/include/generic-glibc/netinet/ether.h +++ b/lib/libc/include/generic-glibc/netinet/ether.h @@ -1,5 +1,5 @@ /* Functions for storing Ethernet addresses in ASCII and mapping to hostnames. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/icmp6.h b/lib/libc/include/generic-glibc/netinet/icmp6.h index 8f030dd8f9..df2aadac34 100644 --- a/lib/libc/include/generic-glibc/netinet/icmp6.h +++ b/lib/libc/include/generic-glibc/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/if_ether.h b/lib/libc/include/generic-glibc/netinet/if_ether.h index 7373ee35f3..e7cc24e570 100644 --- a/lib/libc/include/generic-glibc/netinet/if_ether.h +++ b/lib/libc/include/generic-glibc/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/if_fddi.h b/lib/libc/include/generic-glibc/netinet/if_fddi.h index 5f1ecd7504..582578e5a1 100644 --- a/lib/libc/include/generic-glibc/netinet/if_fddi.h +++ b/lib/libc/include/generic-glibc/netinet/if_fddi.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/if_tr.h b/lib/libc/include/generic-glibc/netinet/if_tr.h index 33f70bcc7f..a1836e5822 100644 --- a/lib/libc/include/generic-glibc/netinet/if_tr.h +++ b/lib/libc/include/generic-glibc/netinet/if_tr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/igmp.h b/lib/libc/include/generic-glibc/netinet/igmp.h index eea3f6cdb9..d44693cf4f 100644 --- a/lib/libc/include/generic-glibc/netinet/igmp.h +++ b/lib/libc/include/generic-glibc/netinet/igmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/in.h b/lib/libc/include/generic-glibc/netinet/in.h index ae09a54121..03a1f43192 100644 --- a/lib/libc/include/generic-glibc/netinet/in.h +++ b/lib/libc/include/generic-glibc/netinet/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/in_systm.h b/lib/libc/include/generic-glibc/netinet/in_systm.h index d24e9ecbc8..2956aadffa 100644 --- a/lib/libc/include/generic-glibc/netinet/in_systm.h +++ b/lib/libc/include/generic-glibc/netinet/in_systm.h @@ -1,5 +1,5 @@ /* System specific type definitions for networking code. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/ip.h b/lib/libc/include/generic-glibc/netinet/ip.h index 27703025d0..603a7ea680 100644 --- a/lib/libc/include/generic-glibc/netinet/ip.h +++ b/lib/libc/include/generic-glibc/netinet/ip.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/ip6.h b/lib/libc/include/generic-glibc/netinet/ip6.h index 12ee883e48..4d1e162577 100644 --- a/lib/libc/include/generic-glibc/netinet/ip6.h +++ b/lib/libc/include/generic-glibc/netinet/ip6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/ip_icmp.h b/lib/libc/include/generic-glibc/netinet/ip_icmp.h index 5937dd614b..0d19d729f2 100644 --- a/lib/libc/include/generic-glibc/netinet/ip_icmp.h +++ b/lib/libc/include/generic-glibc/netinet/ip_icmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netinet/udp.h b/lib/libc/include/generic-glibc/netinet/udp.h index 50fcbf1e20..a7e84ddb4a 100644 --- a/lib/libc/include/generic-glibc/netinet/udp.h +++ b/lib/libc/include/generic-glibc/netinet/udp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netipx/ipx.h b/lib/libc/include/generic-glibc/netipx/ipx.h index 3808131607..dc236e1964 100644 --- a/lib/libc/include/generic-glibc/netipx/ipx.h +++ b/lib/libc/include/generic-glibc/netipx/ipx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netiucv/iucv.h b/lib/libc/include/generic-glibc/netiucv/iucv.h index 05be5b78b0..fef3b453df 100644 --- a/lib/libc/include/generic-glibc/netiucv/iucv.h +++ b/lib/libc/include/generic-glibc/netiucv/iucv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netpacket/packet.h b/lib/libc/include/generic-glibc/netpacket/packet.h index 84866bea75..629da0133e 100644 --- a/lib/libc/include/generic-glibc/netpacket/packet.h +++ b/lib/libc/include/generic-glibc/netpacket/packet.h @@ -1,5 +1,5 @@ /* Definitions for use with Linux AF_PACKET sockets. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netrom/netrom.h b/lib/libc/include/generic-glibc/netrom/netrom.h index 6852343cd0..d44cfaca06 100644 --- a/lib/libc/include/generic-glibc/netrom/netrom.h +++ b/lib/libc/include/generic-glibc/netrom/netrom.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/netrose/rose.h b/lib/libc/include/generic-glibc/netrose/rose.h index 411b2dd558..e5068aa4f1 100644 --- a/lib/libc/include/generic-glibc/netrose/rose.h +++ b/lib/libc/include/generic-glibc/netrose/rose.h @@ -1,5 +1,5 @@ /* Definitions for Rose packet radio address family. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/nl_types.h b/lib/libc/include/generic-glibc/nl_types.h index bd2de64903..d2950ae247 100644 --- a/lib/libc/include/generic-glibc/nl_types.h +++ b/lib/libc/include/generic-glibc/nl_types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/nss.h b/lib/libc/include/generic-glibc/nss.h index f17defc30f..09c496fb38 100644 --- a/lib/libc/include/generic-glibc/nss.h +++ b/lib/libc/include/generic-glibc/nss.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/obstack.h b/lib/libc/include/generic-glibc/obstack.h index d1188b9d45..e79294a431 100644 --- a/lib/libc/include/generic-glibc/obstack.h +++ b/lib/libc/include/generic-glibc/obstack.h @@ -1,5 +1,5 @@ /* obstack.h - object stack macros - Copyright (C) 1988-2020 Free Software Foundation, Inc. + Copyright (C) 1988-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/printf.h b/lib/libc/include/generic-glibc/printf.h index ac8ae173af..0931bd4d55 100644 --- a/lib/libc/include/generic-glibc/printf.h +++ b/lib/libc/include/generic-glibc/printf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/proc_service.h b/lib/libc/include/generic-glibc/proc_service.h index ec3c29113f..19142e890d 100644 --- a/lib/libc/include/generic-glibc/proc_service.h +++ b/lib/libc/include/generic-glibc/proc_service.h @@ -1,5 +1,5 @@ /* Callback interface for libthread_db, functions users must define. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/pthread.h b/lib/libc/include/generic-glibc/pthread.h index efa17507b6..28ba72711d 100644 --- a/lib/libc/include/generic-glibc/pthread.h +++ b/lib/libc/include/generic-glibc/pthread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,6 +28,7 @@ #include #include #include +#include /* Detach state. */ @@ -511,13 +512,15 @@ extern void pthread_testcancel (void); /* Cancellation handling with integration into exception handling. */ +struct __cancel_jmp_buf_tag +{ + __jmp_buf __cancel_jmp_buf; + int __mask_was_saved; +}; + typedef struct { - struct - { - __jmp_buf __cancel_jmp_buf; - int __mask_was_saved; - } __cancel_jmp_buf[1]; + struct __cancel_jmp_buf_tag __cancel_jmp_buf[1]; void *__pad[4]; } __pthread_unwind_buf_t __attribute__ ((__aligned__)); @@ -657,8 +660,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ @@ -692,8 +695,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ @@ -729,9 +732,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) ; #endif -/* Function used in the macros. */ -struct __jmp_buf_tag; -extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; +/* Function used in the macros. Calling __sigsetjmp, with its first + argument declared as an array, results in a -Wstringop-overflow + warning from GCC 11 because struct pthread_unwind_buf is smaller + than jmp_buf. The calls from the macros have __SAVEMASK set to 0, + so nothing beyond the common prefix is used and this warning is a + false positive. Use an alias with its first argument declared to + use the type in the macros if possible to avoid this warning. */ +#if __GNUC_PREREQ (11, 0) +extern int __REDIRECT_NTHNL (__sigsetjmp_cancel, + (struct __cancel_jmp_buf_tag __env[1], + int __savemask), + __sigsetjmp) __attribute_returns_twice__; +#else +# define __sigsetjmp_cancel(env, savemask) \ + __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask)) +extern int __sigsetjmp (struct __jmp_buf_tag __env[1], + int __savemask) __THROWNL; +#endif /* Mutex handling. */ diff --git a/lib/libc/include/generic-glibc/pty.h b/lib/libc/include/generic-glibc/pty.h index 3de99240b5..ccbd8d8aff 100644 --- a/lib/libc/include/generic-glibc/pty.h +++ b/lib/libc/include/generic-glibc/pty.h @@ -1,5 +1,5 @@ /* Functions for pseudo TTY handling. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/pwd.h b/lib/libc/include/generic-glibc/pwd.h index 31490f7e54..1d8329440a 100644 --- a/lib/libc/include/generic-glibc/pwd.h +++ b/lib/libc/include/generic-glibc/pwd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/re_comp.h b/lib/libc/include/generic-glibc/re_comp.h index 17d76d286d..f5b9b74eff 100644 --- a/lib/libc/include/generic-glibc/re_comp.h +++ b/lib/libc/include/generic-glibc/re_comp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/regdef.h b/lib/libc/include/generic-glibc/regdef.h index 70b10f9878..0110b20cc1 100644 --- a/lib/libc/include/generic-glibc/regdef.h +++ b/lib/libc/include/generic-glibc/regdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2020 Free Software Foundation, Inc. +/* Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/regex.h b/lib/libc/include/generic-glibc/regex.h index 289d4ee036..ef5937f67b 100644 --- a/lib/libc/include/generic-glibc/regex.h +++ b/lib/libc/include/generic-glibc/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1985, 1989-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -600,11 +600,9 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer, #endif /* Use GNU */ #if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC) -# ifndef _CRAY /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); extern int re_exec (const char *); -# endif #endif /* For plain 'restrict', use glibc's __restrict if defined. @@ -614,7 +612,9 @@ extern int re_exec (const char *); 'configure' might #define 'restrict' to those words, so pick a different name. */ #ifndef _Restrict_ -# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 # define _Restrict_ __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _Restrict_ restrict @@ -622,13 +622,18 @@ extern int re_exec (const char *); # define _Restrict_ # endif #endif -/* For [restrict], use glibc's __restrict_arr if available. - Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict]. */ +/* For the ISO C99 syntax + array_name[restrict] + use glibc's __restrict_arr if available. + Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). + Other ISO C99 compilers support it as well. */ #ifndef _Restrict_arr_ # ifdef __restrict_arr # define _Restrict_arr_ __restrict_arr -# elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \ - && !defined __GNUG__) +# elif ((199901L <= __STDC_VERSION__ \ + || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3) \ + && !defined __cplusplus) # define _Restrict_arr_ _Restrict_ # else # define _Restrict_arr_ diff --git a/lib/libc/include/generic-glibc/regexp.h b/lib/libc/include/generic-glibc/regexp.h index 6b9fd00707..a76c0a0dde 100644 --- a/lib/libc/include/generic-glibc/regexp.h +++ b/lib/libc/include/generic-glibc/regexp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. diff --git a/lib/libc/include/generic-glibc/sched.h b/lib/libc/include/generic-glibc/sched.h index 61a8a3d6ca..cea5f6874c 100644 --- a/lib/libc/include/generic-glibc/sched.h +++ b/lib/libc/include/generic-glibc/sched.h @@ -1,5 +1,5 @@ /* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/scsi/scsi.h b/lib/libc/include/generic-glibc/scsi/scsi.h index c46d0aef31..f5207b3e26 100644 --- a/lib/libc/include/generic-glibc/scsi/scsi.h +++ b/lib/libc/include/generic-glibc/scsi/scsi.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/scsi/scsi_ioctl.h b/lib/libc/include/generic-glibc/scsi/scsi_ioctl.h index d8e56c5398..4039089307 100644 --- a/lib/libc/include/generic-glibc/scsi/scsi_ioctl.h +++ b/lib/libc/include/generic-glibc/scsi/scsi_ioctl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/scsi/sg.h b/lib/libc/include/generic-glibc/scsi/sg.h index 4061126ae0..94c44f7d0a 100644 --- a/lib/libc/include/generic-glibc/scsi/sg.h +++ b/lib/libc/include/generic-glibc/scsi/sg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/search.h b/lib/libc/include/generic-glibc/search.h index 45983e9a32..8c514ff23f 100644 --- a/lib/libc/include/generic-glibc/search.h +++ b/lib/libc/include/generic-glibc/search.h @@ -1,5 +1,5 @@ /* Declarations for System V style searching functions. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/semaphore.h b/lib/libc/include/generic-glibc/semaphore.h index 2ac9a183f2..2eff18a327 100644 --- a/lib/libc/include/generic-glibc/semaphore.h +++ b/lib/libc/include/generic-glibc/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/setjmp.h b/lib/libc/include/generic-glibc/setjmp.h index 0087a1b231..bf6929df03 100644 --- a/lib/libc/include/generic-glibc/setjmp.h +++ b/lib/libc/include/generic-glibc/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,20 +27,7 @@ __BEGIN_DECLS #include /* Get `__jmp_buf'. */ -#include - -/* Calling environment, plus possibly a saved signal mask. */ -struct __jmp_buf_tag - { - /* NOTE: The machine-dependent definitions of `__sigsetjmp' - assume that a `jmp_buf' begins with a `__jmp_buf' and that - `__mask_was_saved' follows it. Do not move these members - or add others before it. */ - __jmp_buf __jmpbuf; /* Calling environment. */ - int __mask_was_saved; /* Saved the signal mask? */ - __sigset_t __saved_mask; /* Saved signal mask. */ - }; - +#include typedef struct __jmp_buf_tag jmp_buf[1]; diff --git a/lib/libc/include/generic-glibc/sgidefs.h b/lib/libc/include/generic-glibc/sgidefs.h index 269d4e781e..2e0e9017e5 100644 --- a/lib/libc/include/generic-glibc/sgidefs.h +++ b/lib/libc/include/generic-glibc/sgidefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sgtty.h b/lib/libc/include/generic-glibc/sgtty.h index 1aec65ced9..1e624e7d77 100644 --- a/lib/libc/include/generic-glibc/sgtty.h +++ b/lib/libc/include/generic-glibc/sgtty.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/shadow.h b/lib/libc/include/generic-glibc/shadow.h index 78f019b70f..da913a5f42 100644 --- a/lib/libc/include/generic-glibc/shadow.h +++ b/lib/libc/include/generic-glibc/shadow.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/signal.h b/lib/libc/include/generic-glibc/signal.h index 91b7be3621..b3ac843ae6 100644 --- a/lib/libc/include/generic-glibc/signal.h +++ b/lib/libc/include/generic-glibc/signal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/spawn.h b/lib/libc/include/generic-glibc/spawn.h index 565b802d26..466dab6970 100644 --- a/lib/libc/include/generic-glibc/spawn.h +++ b/lib/libc/include/generic-glibc/spawn.h @@ -1,5 +1,5 @@ /* Definitions for POSIX spawn interface. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/stdc-predef.h b/lib/libc/include/generic-glibc/stdc-predef.h index 35c821b2c2..64eb92f881 100644 --- a/lib/libc/include/generic-glibc/stdc-predef.h +++ b/lib/libc/include/generic-glibc/stdc-predef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/stdint.h b/lib/libc/include/generic-glibc/stdint.h index 3d1358c219..876c3327c8 100644 --- a/lib/libc/include/generic-glibc/stdint.h +++ b/lib/libc/include/generic-glibc/stdint.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/stdio.h b/lib/libc/include/generic-glibc/stdio.h index f83759406f..7381342f71 100644 --- a/lib/libc/include/generic-glibc/stdio.h +++ b/lib/libc/include/generic-glibc/stdio.h @@ -1,5 +1,5 @@ /* Define ISO C stdio on top of C++ iostreams. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/stdio_ext.h b/lib/libc/include/generic-glibc/stdio_ext.h index bc5282abee..cd08f537ce 100644 --- a/lib/libc/include/generic-glibc/stdio_ext.h +++ b/lib/libc/include/generic-glibc/stdio_ext.h @@ -1,5 +1,5 @@ /* Functions to access FILE structure internals. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/stdlib.h b/lib/libc/include/generic-glibc/stdlib.h index 3ffc3703d4..cbafd640e9 100644 --- a/lib/libc/include/generic-glibc/stdlib.h +++ b/lib/libc/include/generic-glibc/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/string.h b/lib/libc/include/generic-glibc/string.h index 99d5158b5a..7e1b510185 100644 --- a/lib/libc/include/generic-glibc/string.h +++ b/lib/libc/include/generic-glibc/string.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/strings.h b/lib/libc/include/generic-glibc/strings.h index 4fea1d0242..3959e62e5f 100644 --- a/lib/libc/include/generic-glibc/strings.h +++ b/lib/libc/include/generic-glibc/strings.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/acct.h b/lib/libc/include/generic-glibc/sys/acct.h index 40ba0adb93..ecfb8f60e9 100644 --- a/lib/libc/include/generic-glibc/sys/acct.h +++ b/lib/libc/include/generic-glibc/sys/acct.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/asm.h b/lib/libc/include/generic-glibc/sys/asm.h index b87759216a..70de7df1a3 100644 --- a/lib/libc/include/generic-glibc/sys/asm.h +++ b/lib/libc/include/generic-glibc/sys/asm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/auxv.h b/lib/libc/include/generic-glibc/sys/auxv.h index e94fc7ce26..6dd2888056 100644 --- a/lib/libc/include/generic-glibc/sys/auxv.h +++ b/lib/libc/include/generic-glibc/sys/auxv.h @@ -1,5 +1,5 @@ /* Access to the auxiliary vector. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/cachectl.h b/lib/libc/include/generic-glibc/sys/cachectl.h index 798a6819da..47396f51e2 100644 --- a/lib/libc/include/generic-glibc/sys/cachectl.h +++ b/lib/libc/include/generic-glibc/sys/cachectl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/cdefs.h b/lib/libc/include/generic-glibc/sys/cdefs.h index cee62de938..fc2e4be563 100644 --- a/lib/libc/include/generic-glibc/sys/cdefs.h +++ b/lib/libc/include/generic-glibc/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not - anymore supported. */ + supported anymore. */ #if defined __GNUC__ && !defined __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif @@ -47,7 +47,7 @@ # endif /* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with + to help it optimize the function calls. But this only works with gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions as non-throwing using a function attribute since programs can use the -fexceptions options for C code as well. */ @@ -58,10 +58,14 @@ # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () -# define __NTHNL(fct) fct throw () +# if __cplusplus >= 201103L +# define __THROW noexcept (true) +# else +# define __THROW throw () +# endif +# define __THROWNL __THROW +# define __NTH(fct) __LEAF_ATTR fct __THROW +# define __NTHNL(fct) fct __THROW # else # define __THROW # define __THROWNL @@ -123,14 +127,20 @@ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) +/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ +#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) +# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) +# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) +#else +# define __glibc_objsize0(__o) __bos0 (__o) +# define __glibc_objsize(__o) __bos (__o) +#endif + #if __GNUC_PREREQ (4,3) -# define __warndecl(name, msg) \ - extern void name (void) __attribute__((__warning__ (msg))) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ extern void name (void) __attribute__((__error__ (msg))) #else -# define __warndecl(name, msg) extern void name (void) # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif @@ -559,4 +569,12 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __attr_access(x) #endif +/* Specify that a function such as setjmp or vfork may return + twice. */ +#if __GNUC_PREREQ (4, 1) +# define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) +#else +# define __attribute_returns_twice__ /* Ignore. */ +#endif + #endif /* sys/cdefs.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/sys/debugreg.h b/lib/libc/include/generic-glibc/sys/debugreg.h index b62d0a1ed0..73f6c1adce 100644 --- a/lib/libc/include/generic-glibc/sys/debugreg.h +++ b/lib/libc/include/generic-glibc/sys/debugreg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/dir.h b/lib/libc/include/generic-glibc/sys/dir.h index 6aa2cd8afc..27369aa4e5 100644 --- a/lib/libc/include/generic-glibc/sys/dir.h +++ b/lib/libc/include/generic-glibc/sys/dir.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/elf.h b/lib/libc/include/generic-glibc/sys/elf.h index 134b815f4c..da0ac260ac 100644 --- a/lib/libc/include/generic-glibc/sys/elf.h +++ b/lib/libc/include/generic-glibc/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/epoll.h b/lib/libc/include/generic-glibc/sys/epoll.h index b5cad81b0d..780a3eac51 100644 --- a/lib/libc/include/generic-glibc/sys/epoll.h +++ b/lib/libc/include/generic-glibc/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/eventfd.h b/lib/libc/include/generic-glibc/sys/eventfd.h index 656184d634..901128e326 100644 --- a/lib/libc/include/generic-glibc/sys/eventfd.h +++ b/lib/libc/include/generic-glibc/sys/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/fanotify.h b/lib/libc/include/generic-glibc/sys/fanotify.h index 184c16c3f0..b32190e21d 100644 --- a/lib/libc/include/generic-glibc/sys/fanotify.h +++ b/lib/libc/include/generic-glibc/sys/fanotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2020 Free Software Foundation, Inc. +/* Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/file.h b/lib/libc/include/generic-glibc/sys/file.h index 1de9d6f256..798f5c0dca 100644 --- a/lib/libc/include/generic-glibc/sys/file.h +++ b/lib/libc/include/generic-glibc/sys/file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/fpregdef.h b/lib/libc/include/generic-glibc/sys/fpregdef.h index 6f5c97519f..10628e068c 100644 --- a/lib/libc/include/generic-glibc/sys/fpregdef.h +++ b/lib/libc/include/generic-glibc/sys/fpregdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/fsuid.h b/lib/libc/include/generic-glibc/sys/fsuid.h index 14ce7bebc6..1661cc729e 100644 --- a/lib/libc/include/generic-glibc/sys/fsuid.h +++ b/lib/libc/include/generic-glibc/sys/fsuid.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/gmon_out.h b/lib/libc/include/generic-glibc/sys/gmon_out.h index 9a8f34a2ff..2eed473000 100644 --- a/lib/libc/include/generic-glibc/sys/gmon_out.h +++ b/lib/libc/include/generic-glibc/sys/gmon_out.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger . diff --git a/lib/libc/include/generic-glibc/sys/ifunc.h b/lib/libc/include/generic-glibc/sys/ifunc.h index 4f1aeda818..9dd2353772 100644 --- a/lib/libc/include/generic-glibc/sys/ifunc.h +++ b/lib/libc/include/generic-glibc/sys/ifunc.h @@ -1,5 +1,5 @@ /* Definitions used by AArch64 indirect function resolvers. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/inotify.h b/lib/libc/include/generic-glibc/sys/inotify.h index d175d6c302..647b8f8ccc 100644 --- a/lib/libc/include/generic-glibc/sys/inotify.h +++ b/lib/libc/include/generic-glibc/sys/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/io.h b/lib/libc/include/generic-glibc/sys/io.h index 06c4abd8c2..d3da86c34c 100644 --- a/lib/libc/include/generic-glibc/sys/io.h +++ b/lib/libc/include/generic-glibc/sys/io.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/ioctl.h b/lib/libc/include/generic-glibc/sys/ioctl.h index ba33a3969f..f74a78b3c3 100644 --- a/lib/libc/include/generic-glibc/sys/ioctl.h +++ b/lib/libc/include/generic-glibc/sys/ioctl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/ipc.h b/lib/libc/include/generic-glibc/sys/ipc.h index 3815ee9809..6b0657e836 100644 --- a/lib/libc/include/generic-glibc/sys/ipc.h +++ b/lib/libc/include/generic-glibc/sys/ipc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/kd.h b/lib/libc/include/generic-glibc/sys/kd.h index 322a646e1f..6247131af9 100644 --- a/lib/libc/include/generic-glibc/sys/kd.h +++ b/lib/libc/include/generic-glibc/sys/kd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/klog.h b/lib/libc/include/generic-glibc/sys/klog.h index ded0fc563c..eb7e738da8 100644 --- a/lib/libc/include/generic-glibc/sys/klog.h +++ b/lib/libc/include/generic-glibc/sys/klog.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/mman.h b/lib/libc/include/generic-glibc/sys/mman.h index a6c19dba79..0ffdf75dbb 100644 --- a/lib/libc/include/generic-glibc/sys/mman.h +++ b/lib/libc/include/generic-glibc/sys/mman.h @@ -1,5 +1,5 @@ /* Definitions for BSD-style memory management. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/mount.h b/lib/libc/include/generic-glibc/sys/mount.h index 7e1e32bb73..1eb8f0d067 100644 --- a/lib/libc/include/generic-glibc/sys/mount.h +++ b/lib/libc/include/generic-glibc/sys/mount.h @@ -1,5 +1,5 @@ /* Header file for mounting/unmount Linux filesystems. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/msg.h b/lib/libc/include/generic-glibc/sys/msg.h index d1b4fbe18b..6e421f1d22 100644 --- a/lib/libc/include/generic-glibc/sys/msg.h +++ b/lib/libc/include/generic-glibc/sys/msg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/mtio.h b/lib/libc/include/generic-glibc/sys/mtio.h index 6ddb4c80d0..cad8b36f6d 100644 --- a/lib/libc/include/generic-glibc/sys/mtio.h +++ b/lib/libc/include/generic-glibc/sys/mtio.h @@ -1,5 +1,5 @@ /* Structures and definitions for magnetic tape I/O control commands. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/param.h b/lib/libc/include/generic-glibc/sys/param.h index 763994015e..255cb0d700 100644 --- a/lib/libc/include/generic-glibc/sys/param.h +++ b/lib/libc/include/generic-glibc/sys/param.h @@ -1,5 +1,5 @@ /* Compatibility header for old-style Unix parameters and limits. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/pci.h b/lib/libc/include/generic-glibc/sys/pci.h index 08944792a0..923022cbfb 100644 --- a/lib/libc/include/generic-glibc/sys/pci.h +++ b/lib/libc/include/generic-glibc/sys/pci.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/perm.h b/lib/libc/include/generic-glibc/sys/perm.h index 9bb49a8dec..a7da5ed46b 100644 --- a/lib/libc/include/generic-glibc/sys/perm.h +++ b/lib/libc/include/generic-glibc/sys/perm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/personality.h b/lib/libc/include/generic-glibc/sys/personality.h index bfb7c50dea..540473f1ee 100644 --- a/lib/libc/include/generic-glibc/sys/personality.h +++ b/lib/libc/include/generic-glibc/sys/personality.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/platform/ppc.h b/lib/libc/include/generic-glibc/sys/platform/ppc.h index 235ac48d82..7e019db369 100644 --- a/lib/libc/include/generic-glibc/sys/platform/ppc.h +++ b/lib/libc/include/generic-glibc/sys/platform/ppc.h @@ -1,5 +1,5 @@ /* Facilities specific to the PowerPC architecture - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/platform/x86.h b/lib/libc/include/generic-glibc/sys/platform/x86.h new file mode 100644 index 0000000000..4ff21517be --- /dev/null +++ b/lib/libc/include/generic-glibc/sys/platform/x86.h @@ -0,0 +1,65 @@ +/* Data structure for x86 CPU features. + This file is part of the GNU C Library. + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_PLATFORM_X86_H +#define _SYS_PLATFORM_X86_H + +#include +#include +#include + +__BEGIN_DECLS + +/* Get a pointer to the CPU feature structure. */ +extern const struct cpuid_feature *__x86_get_cpuid_feature_leaf (unsigned int) + __attribute__ ((pure)); + +static __inline__ _Bool +x86_cpu_has_feature (unsigned int __index) +{ + const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf + (__index / (8 * sizeof (unsigned int) * 4)); + unsigned int __reg + = __index & (8 * sizeof (unsigned int) * 4 - 1); + unsigned int __bit = __reg & (8 * sizeof (unsigned int) - 1); + __reg /= 8 * sizeof (unsigned int); + + return __ptr->cpuid_array[__reg] & (1 << __bit); +} + +static __inline__ _Bool +x86_cpu_is_usable (unsigned int __index) +{ + const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf + (__index / (8 * sizeof (unsigned int) * 4)); + unsigned int __reg + = __index & (8 * sizeof (unsigned int) * 4 - 1); + unsigned int __bit = __reg & (8 * sizeof (unsigned int) - 1); + __reg /= 8 * sizeof (unsigned int); + + return __ptr->usable_array[__reg] & (1 << __bit); +} + +/* HAS_CPU_FEATURE evaluates to true if CPU supports the feature. */ +#define HAS_CPU_FEATURE(name) x86_cpu_has_feature (x86_cpu_##name) +/* CPU_FEATURE_USABLE evaluates to true if the feature is usable. */ +#define CPU_FEATURE_USABLE(name) x86_cpu_is_usable (x86_cpu_##name) + +__END_DECLS + +#endif /* _SYS_PLATFORM_X86_H */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/sys/poll.h b/lib/libc/include/generic-glibc/sys/poll.h index 7df2e2e464..b5947952ff 100644 --- a/lib/libc/include/generic-glibc/sys/poll.h +++ b/lib/libc/include/generic-glibc/sys/poll.h @@ -1,5 +1,5 @@ /* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/prctl.h b/lib/libc/include/generic-glibc/sys/prctl.h index 086ebd2828..b22bbe264b 100644 --- a/lib/libc/include/generic-glibc/sys/prctl.h +++ b/lib/libc/include/generic-glibc/sys/prctl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,24 @@ #include #include /* The magic values come from here */ +/* Recent extensions to linux which may post-date the kernel headers + we're picking up... */ + +/* Memory tagging control operations (for AArch64). */ +#ifndef PR_TAGGED_ADDR_ENABLE +# define PR_TAGGED_ADDR_ENABLE (1UL << 8) +#endif + +#ifndef PR_MTE_TCF_SHIFT +# define PR_MTE_TCF_SHIFT 1 +# define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TAG_SHIFT 3 +# define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) +#endif + __BEGIN_DECLS /* Control process execution. */ diff --git a/lib/libc/include/generic-glibc/sys/procfs.h b/lib/libc/include/generic-glibc/sys/procfs.h index f76491c2e4..3449597af6 100644 --- a/lib/libc/include/generic-glibc/sys/procfs.h +++ b/lib/libc/include/generic-glibc/sys/procfs.h @@ -1,5 +1,5 @@ /* Definitions for core files and libthread_db. Generic Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/sys/profil.h b/lib/libc/include/generic-glibc/sys/profil.h index 364c88cca4..b282f2c76a 100644 --- a/lib/libc/include/generic-glibc/sys/profil.h +++ b/lib/libc/include/generic-glibc/sys/profil.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/ptrace.h b/lib/libc/include/generic-glibc/sys/ptrace.h index b420fa1cbc..c2df853b06 100644 --- a/lib/libc/include/generic-glibc/sys/ptrace.h +++ b/lib/libc/include/generic-glibc/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/generic-glibc/sys/quota.h b/lib/libc/include/generic-glibc/sys/quota.h index fda0a82f92..0efe772681 100644 --- a/lib/libc/include/generic-glibc/sys/quota.h +++ b/lib/libc/include/generic-glibc/sys/quota.h @@ -1,5 +1,5 @@ /* This just represents the non-kernel parts of . - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/random.h b/lib/libc/include/generic-glibc/sys/random.h index 690a5234cf..78e588f4b5 100644 --- a/lib/libc/include/generic-glibc/sys/random.h +++ b/lib/libc/include/generic-glibc/sys/random.h @@ -1,5 +1,5 @@ /* Interfaces for obtaining random bytes. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/raw.h b/lib/libc/include/generic-glibc/sys/raw.h index d6cbab03e2..15d48c9728 100644 --- a/lib/libc/include/generic-glibc/sys/raw.h +++ b/lib/libc/include/generic-glibc/sys/raw.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/reboot.h b/lib/libc/include/generic-glibc/sys/reboot.h index f5f4f0ccbb..0fc5dcc29f 100644 --- a/lib/libc/include/generic-glibc/sys/reboot.h +++ b/lib/libc/include/generic-glibc/sys/reboot.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/reg.h b/lib/libc/include/generic-glibc/sys/reg.h index f470369646..ed08d66504 100644 --- a/lib/libc/include/generic-glibc/sys/reg.h +++ b/lib/libc/include/generic-glibc/sys/reg.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/regdef.h b/lib/libc/include/generic-glibc/sys/regdef.h index a0dd8d1cd9..60d5eebddf 100644 --- a/lib/libc/include/generic-glibc/sys/regdef.h +++ b/lib/libc/include/generic-glibc/sys/regdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/resource.h b/lib/libc/include/generic-glibc/sys/resource.h index 2c03a09032..52ea01a148 100644 --- a/lib/libc/include/generic-glibc/sys/resource.h +++ b/lib/libc/include/generic-glibc/sys/resource.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/select.h b/lib/libc/include/generic-glibc/sys/select.h index a08b500e77..ecf5c60674 100644 --- a/lib/libc/include/generic-glibc/sys/select.h +++ b/lib/libc/include/generic-glibc/sys/select.h @@ -1,5 +1,5 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/sem.h b/lib/libc/include/generic-glibc/sys/sem.h index dde24cc033..a1ba6ef73d 100644 --- a/lib/libc/include/generic-glibc/sys/sem.h +++ b/lib/libc/include/generic-glibc/sys/sem.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/sendfile.h b/lib/libc/include/generic-glibc/sys/sendfile.h index 76d4f4dcc4..af8058691f 100644 --- a/lib/libc/include/generic-glibc/sys/sendfile.h +++ b/lib/libc/include/generic-glibc/sys/sendfile.h @@ -1,5 +1,5 @@ /* sendfile -- copy data directly from one file descriptor to another - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/shm.h b/lib/libc/include/generic-glibc/sys/shm.h index fdab282b74..bd4d8e9703 100644 --- a/lib/libc/include/generic-glibc/sys/shm.h +++ b/lib/libc/include/generic-glibc/sys/shm.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/signalfd.h b/lib/libc/include/generic-glibc/sys/signalfd.h index 0f47e089c8..be2a580927 100644 --- a/lib/libc/include/generic-glibc/sys/signalfd.h +++ b/lib/libc/include/generic-glibc/sys/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/single_threaded.h b/lib/libc/include/generic-glibc/sys/single_threaded.h index 0ea9034f8f..17638fcc42 100644 --- a/lib/libc/include/generic-glibc/sys/single_threaded.h +++ b/lib/libc/include/generic-glibc/sys/single_threaded.h @@ -1,5 +1,5 @@ /* Support for single-thread optimizations. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/socket.h b/lib/libc/include/generic-glibc/sys/socket.h index 36871ba0fe..b2ed8b968c 100644 --- a/lib/libc/include/generic-glibc/sys/socket.h +++ b/lib/libc/include/generic-glibc/sys/socket.h @@ -1,5 +1,5 @@ /* Declarations of socket constants, types, and functions. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/stat.h b/lib/libc/include/generic-glibc/sys/stat.h index efb35dc1e5..77e0e23e08 100644 --- a/lib/libc/include/generic-glibc/sys/stat.h +++ b/lib/libc/include/generic-glibc/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -367,170 +367,11 @@ extern int utimensat (int __fd, const char *__path, /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif - -/* To allow the `struct stat' structure and the file type `mode_t' - bits to vary without changing shared library major version number, - the `stat' family of functions and `mknod' are in fact inline - wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', - which all take a leading version-number argument designating the - data structure and bits used. defines _STAT_VER with - the version number corresponding to `struct stat' as defined in - that file; and _MKNOD_VER with the version number corresponding to - the S_IF* macros defined therein. It is arranged that when not - inlined these function are always statically linked; that way a - dynamically-linked executable always encodes the version number - corresponding to the data structures it uses, so the `x' functions - in the shared library can adapt without needing to recompile all - callers. */ - -#ifndef _STAT_VER -# define _STAT_VER 0 -#endif -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -/* Wrappers for stat and mknod system calls. */ -#ifndef __USE_FILE_OFFSET64 -extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat (int __ver, int __fildes, const char *__filename, - struct stat *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf), __fxstat64) - __nonnull ((3)); -extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __xstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __lxstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, - const char *__filename, - struct stat *__stat_buf, int __flag), - __fxstatat64) __nonnull ((3, 4)); - -# else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 -# endif -#endif - -#ifdef __USE_LARGEFILE64 -extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, - struct stat64 *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#endif -extern int __xmknod (int __ver, const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW __nonnull ((2, 4)); - -extern int __xmknodat (int __ver, int __fd, const char *__path, - __mode_t __mode, __dev_t *__dev) - __THROW __nonnull ((3, 5)); #ifdef __USE_GNU # include #endif -#ifdef __USE_EXTERN_INLINES -/* Inlined versions of the real stat and mknod functions. */ - -__extern_inline int -__NTH (stat (const char *__path, struct stat *__statbuf)) -{ - return __xstat (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat (const char *__path, struct stat *__statbuf)) -{ - return __lxstat (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat (int __fd, struct stat *__statbuf)) -{ - return __fxstat (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, - int __flag)) -{ - return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - -# ifdef __USE_MISC -__extern_inline int -__NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) -{ - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); -} -# endif - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (mknodat (int __fd, const char *__path, __mode_t __mode, - __dev_t __dev)) -{ - return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); -} -# endif - -# if defined __USE_LARGEFILE64 \ - && (! defined __USE_FILE_OFFSET64 \ - || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) -__extern_inline int -__NTH (stat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __xstat64 (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __lxstat64 (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat64 (int __fd, struct stat64 *__statbuf)) -{ - return __fxstat64 (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, - int __flag)) -{ - return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - -# endif - -#endif - __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/statfs.h b/lib/libc/include/generic-glibc/sys/statfs.h index 98e4d90612..2202707873 100644 --- a/lib/libc/include/generic-glibc/sys/statfs.h +++ b/lib/libc/include/generic-glibc/sys/statfs.h @@ -1,5 +1,5 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/statvfs.h b/lib/libc/include/generic-glibc/sys/statvfs.h index e5798e4295..bcb73bc191 100644 --- a/lib/libc/include/generic-glibc/sys/statvfs.h +++ b/lib/libc/include/generic-glibc/sys/statvfs.h @@ -1,5 +1,5 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/swap.h b/lib/libc/include/generic-glibc/sys/swap.h index a60b3018bd..c739fdb00d 100644 --- a/lib/libc/include/generic-glibc/sys/swap.h +++ b/lib/libc/include/generic-glibc/sys/swap.h @@ -1,5 +1,5 @@ /* Calls to enable and disable swapping on specified locations. Linux version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/syscall.h b/lib/libc/include/generic-glibc/sys/syscall.h index bb77d6427a..23e1b29758 100644 --- a/lib/libc/include/generic-glibc/sys/syscall.h +++ b/lib/libc/include/generic-glibc/sys/syscall.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/sysinfo.h b/lib/libc/include/generic-glibc/sys/sysinfo.h index fb4e42c494..fa622ec23d 100644 --- a/lib/libc/include/generic-glibc/sys/sysinfo.h +++ b/lib/libc/include/generic-glibc/sys/sysinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/sysmacros.h b/lib/libc/include/generic-glibc/sys/sysmacros.h index 9914343411..314e21d5d2 100644 --- a/lib/libc/include/generic-glibc/sys/sysmacros.h +++ b/lib/libc/include/generic-glibc/sys/sysmacros.h @@ -1,5 +1,5 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/sysmips.h b/lib/libc/include/generic-glibc/sys/sysmips.h index c24b8ebccb..71e01aa98f 100644 --- a/lib/libc/include/generic-glibc/sys/sysmips.h +++ b/lib/libc/include/generic-glibc/sys/sysmips.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/tas.h b/lib/libc/include/generic-glibc/sys/tas.h index 0f8974544a..545278a89a 100644 --- a/lib/libc/include/generic-glibc/sys/tas.h +++ b/lib/libc/include/generic-glibc/sys/tas.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Maciej W. Rozycki , 2000. diff --git a/lib/libc/include/generic-glibc/sys/time.h b/lib/libc/include/generic-glibc/sys/time.h index 59a5298c02..4f935c1cae 100644 --- a/lib/libc/include/generic-glibc/sys/time.h +++ b/lib/libc/include/generic-glibc/sys/time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/timeb.h b/lib/libc/include/generic-glibc/sys/timeb.h index 3134096ea3..7180adc662 100644 --- a/lib/libc/include/generic-glibc/sys/timeb.h +++ b/lib/libc/include/generic-glibc/sys/timeb.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2020 Free Software Foundation, Inc. +/* Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,24 +20,15 @@ #include -#include - __BEGIN_DECLS -/* Structure returned by the `ftime' function. */ - -struct timeb - { - time_t time; /* Seconds since epoch, as from `time'. */ - unsigned short int millitm; /* Additional milliseconds. */ - short int timezone; /* Minutes west of GMT. */ - short int dstflag; /* Nonzero if Daylight Savings Time used. */ - }; +# include /* Fill in TIMEBUF with information about the current time. */ extern int ftime (struct timeb *__timebuf) - __nonnull ((1)) __attribute_deprecated__; + __nonnull ((1)) + __attribute_deprecated_msg__ ("Use gettimeofday or clock_gettime instead"); __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/timerfd.h b/lib/libc/include/generic-glibc/sys/timerfd.h index 8d06ea7450..18acd489ea 100644 --- a/lib/libc/include/generic-glibc/sys/timerfd.h +++ b/lib/libc/include/generic-glibc/sys/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/times.h b/lib/libc/include/generic-glibc/sys/times.h index 00cb60f139..5bd2a0b761 100644 --- a/lib/libc/include/generic-glibc/sys/times.h +++ b/lib/libc/include/generic-glibc/sys/times.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/timex.h b/lib/libc/include/generic-glibc/sys/timex.h index 04f8ee5e5c..0e82ddced7 100644 --- a/lib/libc/include/generic-glibc/sys/timex.h +++ b/lib/libc/include/generic-glibc/sys/timex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/types.h b/lib/libc/include/generic-glibc/sys/types.h index d27b28f769..a604bba497 100644 --- a/lib/libc/include/generic-glibc/sys/types.h +++ b/lib/libc/include/generic-glibc/sys/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/ucontext.h b/lib/libc/include/generic-glibc/sys/ucontext.h index dfd6641750..1b0186693a 100644 --- a/lib/libc/include/generic-glibc/sys/ucontext.h +++ b/lib/libc/include/generic-glibc/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/generic-glibc/sys/uio.h b/lib/libc/include/generic-glibc/sys/uio.h index 57a7abdd37..7d14d63881 100644 --- a/lib/libc/include/generic-glibc/sys/uio.h +++ b/lib/libc/include/generic-glibc/sys/uio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/un.h b/lib/libc/include/generic-glibc/sys/un.h index 9f8f35dd2f..76b80cfa9d 100644 --- a/lib/libc/include/generic-glibc/sys/un.h +++ b/lib/libc/include/generic-glibc/sys/un.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/user.h b/lib/libc/include/generic-glibc/sys/user.h index bfe83781cd..552a40bd26 100644 --- a/lib/libc/include/generic-glibc/sys/user.h +++ b/lib/libc/include/generic-glibc/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/utsname.h b/lib/libc/include/generic-glibc/sys/utsname.h index 8ecc09263a..4321db26ce 100644 --- a/lib/libc/include/generic-glibc/sys/utsname.h +++ b/lib/libc/include/generic-glibc/sys/utsname.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/vlimit.h b/lib/libc/include/generic-glibc/sys/vlimit.h index a7fd78a61a..6844873042 100644 --- a/lib/libc/include/generic-glibc/sys/vlimit.h +++ b/lib/libc/include/generic-glibc/sys/vlimit.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/vm86.h b/lib/libc/include/generic-glibc/sys/vm86.h index dfc5c5311b..a245bfd2ff 100644 --- a/lib/libc/include/generic-glibc/sys/vm86.h +++ b/lib/libc/include/generic-glibc/sys/vm86.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/vtimes.h b/lib/libc/include/generic-glibc/sys/vtimes.h deleted file mode 100644 index 048270d4dd..0000000000 --- a/lib/libc/include/generic-glibc/sys/vtimes.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_VTIMES_H -#define _SYS_VTIMES_H 1 - -#include - -__BEGIN_DECLS - -/* This interface is obsolete; use `getrusage' instead. */ - -/* Granularity of the `vm_utime' and `vm_stime' fields of a `struct vtimes'. - (This is the frequency of the machine's power supply, in Hz.) */ -#define VTIMES_UNITS_PER_SECOND 60 - -struct vtimes -{ - /* User time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ - int vm_utime; - /* System time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ - int vm_stime; - - /* Amount of data and stack memory used (kilobyte-seconds). */ - unsigned int vm_idsrss; - /* Amount of text memory used (kilobyte-seconds). */ - unsigned int vm_ixrss; - /* Maximum resident set size (text, data, and stack) (kilobytes). */ - int vm_maxrss; - - /* Number of hard page faults (i.e. those that required I/O). */ - int vm_majflt; - /* Number of soft page faults (i.e. those serviced by reclaiming - a page from the list of pages awaiting reallocation. */ - int vm_minflt; - - /* Number of times a process was swapped out of physical memory. */ - int vm_nswap; - - /* Number of input operations via the file system. Note: This - and `ru_oublock' do not include operations with the cache. */ - int vm_inblk; - /* Number of output operations via the file system. */ - int vm_oublk; -}; - -/* If CURRENT is not NULL, write statistics for the current process into - *CURRENT. If CHILD is not NULL, write statistics for all terminated child - processes into *CHILD. Returns 0 for success, -1 for failure. */ -extern int vtimes (struct vtimes * __current, struct vtimes * __child) __THROW; - -__END_DECLS - -#endif /* sys/vtimes.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/sys/wait.h b/lib/libc/include/generic-glibc/sys/wait.h index 2437614922..8a0a954eb7 100644 --- a/lib/libc/include/generic-glibc/sys/wait.h +++ b/lib/libc/include/generic-glibc/sys/wait.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/sys/xattr.h b/lib/libc/include/generic-glibc/sys/xattr.h index 608d956b20..43eaa7f42b 100644 --- a/lib/libc/include/generic-glibc/sys/xattr.h +++ b/lib/libc/include/generic-glibc/sys/xattr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/tar.h b/lib/libc/include/generic-glibc/tar.h index 4b4d5b7e51..5cd319e639 100644 --- a/lib/libc/include/generic-glibc/tar.h +++ b/lib/libc/include/generic-glibc/tar.h @@ -1,5 +1,5 @@ /* Extended tar format from POSIX.1. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by David J. MacKenzie. diff --git a/lib/libc/include/generic-glibc/termios.h b/lib/libc/include/generic-glibc/termios.h index ac8da1c731..a06c147e9c 100644 --- a/lib/libc/include/generic-glibc/termios.h +++ b/lib/libc/include/generic-glibc/termios.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/tgmath.h b/lib/libc/include/generic-glibc/tgmath.h index a5daa91c87..9be123c91e 100644 --- a/lib/libc/include/generic-glibc/tgmath.h +++ b/lib/libc/include/generic-glibc/tgmath.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/thread_db.h b/lib/libc/include/generic-glibc/thread_db.h index e26656953e..542d3c1dd8 100644 --- a/lib/libc/include/generic-glibc/thread_db.h +++ b/lib/libc/include/generic-glibc/thread_db.h @@ -1,5 +1,5 @@ /* thread_db.h -- interface to libthread_db.so library for debugging -lpthread - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/threads.h b/lib/libc/include/generic-glibc/threads.h index a176ad32cc..a6b2089453 100644 --- a/lib/libc/include/generic-glibc/threads.h +++ b/lib/libc/include/generic-glibc/threads.h @@ -1,5 +1,5 @@ /* ISO C11 Standard: 7.26 - Thread support library . - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/time.h b/lib/libc/include/generic-glibc/time.h index afaf50c1d6..878ba90789 100644 --- a/lib/libc/include/generic-glibc/time.h +++ b/lib/libc/include/generic-glibc/time.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/uchar.h b/lib/libc/include/generic-glibc/uchar.h index 1d42067d8f..d844d0f4c9 100644 --- a/lib/libc/include/generic-glibc/uchar.h +++ b/lib/libc/include/generic-glibc/uchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/ucontext.h b/lib/libc/include/generic-glibc/ucontext.h index 7e1b5a68bf..e2d207ba1a 100644 --- a/lib/libc/include/generic-glibc/ucontext.h +++ b/lib/libc/include/generic-glibc/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/ulimit.h b/lib/libc/include/generic-glibc/ulimit.h index 144e489ee6..cfc34eadd8 100644 --- a/lib/libc/include/generic-glibc/ulimit.h +++ b/lib/libc/include/generic-glibc/ulimit.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/unistd.h b/lib/libc/include/generic-glibc/unistd.h index 83a83213c0..59ac4a72d1 100644 --- a/lib/libc/include/generic-glibc/unistd.h +++ b/lib/libc/include/generic-glibc/unistd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd, /* Like readlink but a relative PATH is interpreted relative to FD. */ extern ssize_t readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) - __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, 4)); + __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4)); #endif /* Remove the link NAME. */ diff --git a/lib/libc/include/generic-glibc/utime.h b/lib/libc/include/generic-glibc/utime.h index 675138ca50..7f75dbf882 100644 --- a/lib/libc/include/generic-glibc/utime.h +++ b/lib/libc/include/generic-glibc/utime.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/utmp.h b/lib/libc/include/generic-glibc/utmp.h index bb62d1e7a1..29a2393f00 100644 --- a/lib/libc/include/generic-glibc/utmp.h +++ b/lib/libc/include/generic-glibc/utmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2020 Free Software Foundation, Inc. +/* Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/utmpx.h b/lib/libc/include/generic-glibc/utmpx.h index 5a407f1c4e..358133afe2 100644 --- a/lib/libc/include/generic-glibc/utmpx.h +++ b/lib/libc/include/generic-glibc/utmpx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/values.h b/lib/libc/include/generic-glibc/values.h index 00735b4d3b..2d8d94245e 100644 --- a/lib/libc/include/generic-glibc/values.h +++ b/lib/libc/include/generic-glibc/values.h @@ -1,5 +1,5 @@ /* Old compatibility names for and constants. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/wchar.h b/lib/libc/include/generic-glibc/wchar.h index f92623639b..2b4d5cfc49 100644 --- a/lib/libc/include/generic-glibc/wchar.h +++ b/lib/libc/include/generic-glibc/wchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/wctype.h b/lib/libc/include/generic-glibc/wctype.h index 4cd02bcf17..2ed2736dc1 100644 --- a/lib/libc/include/generic-glibc/wctype.h +++ b/lib/libc/include/generic-glibc/wctype.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/generic-glibc/wordexp.h b/lib/libc/include/generic-glibc/wordexp.h index fa198fba1f..e01d8512fa 100644 --- a/lib/libc/include/generic-glibc/wordexp.h +++ b/lib/libc/include/generic-glibc/wordexp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/environments.h b/lib/libc/include/i386-linux-gnu/bits/environments.h index 2b18837e58..72a871ff4d 100644 --- a/lib/libc/include/i386-linux-gnu/bits/environments.h +++ b/lib/libc/include/i386-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/epoll.h b/lib/libc/include/i386-linux-gnu/bits/epoll.h index 5f23749272..4bda3c54ef 100644 --- a/lib/libc/include/i386-linux-gnu/bits/epoll.h +++ b/lib/libc/include/i386-linux-gnu/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/fcntl.h b/lib/libc/include/i386-linux-gnu/bits/fcntl.h index 4eb8fa0b6f..de1b65f104 100644 --- a/lib/libc/include/i386-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/i386-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/x86. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/fenv.h b/lib/libc/include/i386-linux-gnu/bits/fenv.h index b504e27b15..dd01ba9442 100644 --- a/lib/libc/include/i386-linux-gnu/bits/fenv.h +++ b/lib/libc/include/i386-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/floatn.h b/lib/libc/include/i386-linux-gnu/bits/floatn.h index 36d64c23ec..5818af2001 100644 --- a/lib/libc/include/i386-linux-gnu/bits/floatn.h +++ b/lib/libc/include/i386-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on x86. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h b/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h index 9da0307897..c714d6ed23 100644 --- a/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h +++ b/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h @@ -1,5 +1,5 @@ /* Define __GLIBC_FLT_EVAL_METHOD. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/fp-logb.h b/lib/libc/include/i386-linux-gnu/bits/fp-logb.h index 5f2e2a9f88..7c1bfa72bd 100644 --- a/lib/libc/include/i386-linux-gnu/bits/fp-logb.h +++ b/lib/libc/include/i386-linux-gnu/bits/fp-logb.h @@ -1,5 +1,5 @@ /* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/indirect-return.h b/lib/libc/include/i386-linux-gnu/bits/indirect-return.h index e74139721c..4bf822a84c 100644 --- a/lib/libc/include/i386-linux-gnu/bits/indirect-return.h +++ b/lib/libc/include/i386-linux-gnu/bits/indirect-return.h @@ -1,5 +1,5 @@ /* Definition of __INDIRECT_RETURN. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/ipctypes.h b/lib/libc/include/i386-linux-gnu/bits/ipctypes.h index 7f6bb7662d..9c301e1a3c 100644 --- a/lib/libc/include/i386-linux-gnu/bits/ipctypes.h +++ b/lib/libc/include/i386-linux-gnu/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/iscanonical.h b/lib/libc/include/i386-linux-gnu/bits/iscanonical.h index ee0d8720f9..8e6c0d05f5 100644 --- a/lib/libc/include/i386-linux-gnu/bits/iscanonical.h +++ b/lib/libc/include/i386-linux-gnu/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/link.h b/lib/libc/include/i386-linux-gnu/bits/link.h index 68938e8e0c..9774e993a3 100644 --- a/lib/libc/include/i386-linux-gnu/bits/link.h +++ b/lib/libc/include/i386-linux-gnu/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/long-double.h b/lib/libc/include/i386-linux-gnu/bits/long-double.h index 75bc1fcce4..ef3832bc80 100644 --- a/lib/libc/include/i386-linux-gnu/bits/long-double.h +++ b/lib/libc/include/i386-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/math-vector.h b/lib/libc/include/i386-linux-gnu/bits/math-vector.h index f7571e827d..6e94f42ca8 100644 --- a/lib/libc/include/i386-linux-gnu/bits/math-vector.h +++ b/lib/libc/include/i386-linux-gnu/bits/math-vector.h @@ -1,5 +1,5 @@ /* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/mman.h b/lib/libc/include/i386-linux-gnu/bits/mman.h index 4319c54436..8c96873c86 100644 --- a/lib/libc/include/i386-linux-gnu/bits/mman.h +++ b/lib/libc/include/i386-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/procfs-id.h b/lib/libc/include/i386-linux-gnu/bits/procfs-id.h index 4f4cefeb4b..bada981489 100644 --- a/lib/libc/include/i386-linux-gnu/bits/procfs-id.h +++ b/lib/libc/include/i386-linux-gnu/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/i386-linux-gnu/bits/procfs.h b/lib/libc/include/i386-linux-gnu/bits/procfs.h index 1f4ca5a0f0..b670484f2a 100644 --- a/lib/libc/include/i386-linux-gnu/bits/procfs.h +++ b/lib/libc/include/i386-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. x86 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h index 147ce690db..89b363fb2c 100644 --- a/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/setjmp.h b/lib/libc/include/i386-linux-gnu/bits/setjmp.h index 18d620397d..9e96a2ff98 100644 --- a/lib/libc/include/i386-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/i386-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/sigcontext.h b/lib/libc/include/i386-linux-gnu/bits/sigcontext.h index 7498f87f91..4f03980c98 100644 --- a/lib/libc/include/i386-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/i386-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h b/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h index 44273158be..89c18f35e0 100644 --- a/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* x86 internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h index 863b185dc9..022106d66c 100644 --- a/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* x86 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/i386-linux-gnu/bits/stat.h b/lib/libc/include/i386-linux-gnu/bits/struct_stat.h similarity index 73% rename from lib/libc/include/i386-linux-gnu/bits/stat.h rename to lib/libc/include/i386-linux-gnu/bits/struct_stat.h index ab5378300a..4a34470345 100644 --- a/lib/libc/include/i386-linux-gnu/bits/stat.h +++ b/lib/libc/include/i386-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,36 +13,15 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#ifndef __x86_64__ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 - -/* i386 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -#else -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 - -/* x86-64 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 0 -#endif - -#define _STAT_VER _STAT_VER_LINUX +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -174,37 +154,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/timesize.h b/lib/libc/include/i386-linux-gnu/bits/timesize.h index ae0a502d0d..a1ca40d632 100644 --- a/lib/libc/include/i386-linux-gnu/bits/timesize.h +++ b/lib/libc/include/i386-linux-gnu/bits/timesize.h @@ -1,5 +1,5 @@ /* Bit size of the time_t type at glibc build time, x86-64 and x32 case. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h index ea9721c6bd..76ea9f63dc 100644 --- a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* x86 implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/bits/typesizes.h b/lib/libc/include/i386-linux-gnu/bits/typesizes.h index 53ae0bd5ef..654f1c7b87 100644 --- a/lib/libc/include/i386-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/i386-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h b/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h index c56f5fc16f..5fdbe52a3c 100644 --- a/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h +++ b/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h @@ -1,5 +1,5 @@ ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- -! Copyright (C) 2019-2020 Free Software Foundation, Inc. +! Copyright (C) 2019-2021 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/fpu_control.h b/lib/libc/include/i386-linux-gnu/fpu_control.h index fa0a861923..533e2da0d0 100644 --- a/lib/libc/include/i386-linux-gnu/fpu_control.h +++ b/lib/libc/include/i386-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. x86 version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. diff --git a/lib/libc/include/i386-linux-gnu/sys/elf.h b/lib/libc/include/i386-linux-gnu/sys/elf.h index d37502689d..3731950870 100644 --- a/lib/libc/include/i386-linux-gnu/sys/elf.h +++ b/lib/libc/include/i386-linux-gnu/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/sys/ptrace.h b/lib/libc/include/i386-linux-gnu/sys/ptrace.h index 0977a402d7..461e83ae9c 100644 --- a/lib/libc/include/i386-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/i386-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/x86 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/i386-linux-gnu/sys/ucontext.h b/lib/libc/include/i386-linux-gnu/sys/ucontext.h index 3244eab7c8..f961c6aef8 100644 --- a/lib/libc/include/i386-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/i386-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/i386-linux-gnu/sys/user.h b/lib/libc/include/i386-linux-gnu/sys/user.h index fe9d875789..0f64e565eb 100644 --- a/lib/libc/include/i386-linux-gnu/sys/user.h +++ b/lib/libc/include/i386-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/dlfcn.h b/lib/libc/include/mips-linux-gnu/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mips-linux-gnu/bits/dlfcn.h +++ b/lib/libc/include/mips-linux-gnu/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/errno.h b/lib/libc/include/mips-linux-gnu/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mips-linux-gnu/bits/errno.h +++ b/lib/libc/include/mips-linux-gnu/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/eventfd.h b/lib/libc/include/mips-linux-gnu/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mips-linux-gnu/bits/eventfd.h +++ b/lib/libc/include/mips-linux-gnu/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/floatn.h b/lib/libc/include/mips-linux-gnu/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mips-linux-gnu/bits/floatn.h +++ b/lib/libc/include/mips-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/inotify.h b/lib/libc/include/mips-linux-gnu/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mips-linux-gnu/bits/inotify.h +++ b/lib/libc/include/mips-linux-gnu/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h b/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/ipctypes.h b/lib/libc/include/mips-linux-gnu/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mips-linux-gnu/bits/ipctypes.h +++ b/lib/libc/include/mips-linux-gnu/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/local_lim.h b/lib/libc/include/mips-linux-gnu/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mips-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/mips-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/mman.h b/lib/libc/include/mips-linux-gnu/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mips-linux-gnu/bits/mman.h +++ b/lib/libc/include/mips-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/poll.h b/lib/libc/include/mips-linux-gnu/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mips-linux-gnu/bits/poll.h +++ b/lib/libc/include/mips-linux-gnu/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/resource.h b/lib/libc/include/mips-linux-gnu/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mips-linux-gnu/bits/resource.h +++ b/lib/libc/include/mips-linux-gnu/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/semaphore.h b/lib/libc/include/mips-linux-gnu/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mips-linux-gnu/bits/semaphore.h +++ b/lib/libc/include/mips-linux-gnu/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/shmlba.h b/lib/libc/include/mips-linux-gnu/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mips-linux-gnu/bits/shmlba.h +++ b/lib/libc/include/mips-linux-gnu/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/sigaction.h b/lib/libc/include/mips-linux-gnu/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mips-linux-gnu/bits/sigaction.h +++ b/lib/libc/include/mips-linux-gnu/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/sigcontext.h b/lib/libc/include/mips-linux-gnu/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mips-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/mips-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mips-linux-gnu/bits/signalfd.h b/lib/libc/include/mips-linux-gnu/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mips-linux-gnu/bits/signalfd.h +++ b/lib/libc/include/mips-linux-gnu/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/signum-arch.h b/lib/libc/include/mips-linux-gnu/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mips-linux-gnu/bits/signum-arch.h +++ b/lib/libc/include/mips-linux-gnu/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/socket-constants.h b/lib/libc/include/mips-linux-gnu/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mips-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/mips-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/socket_type.h b/lib/libc/include/mips-linux-gnu/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mips-linux-gnu/bits/socket_type.h +++ b/lib/libc/include/mips-linux-gnu/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/statfs.h b/lib/libc/include/mips-linux-gnu/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mips-linux-gnu/bits/statfs.h +++ b/lib/libc/include/mips-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/struct_mutex.h b/lib/libc/include/mips-linux-gnu/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mips-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/mips-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h +++ b/lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-struct.h b/lib/libc/include/mips-linux-gnu/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mips-linux-gnu/bits/termios-struct.h +++ b/lib/libc/include/mips-linux-gnu/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h b/lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h +++ b/lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/timerfd.h b/lib/libc/include/mips-linux-gnu/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mips-linux-gnu/bits/timerfd.h +++ b/lib/libc/include/mips-linux-gnu/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/types/stack_t.h b/lib/libc/include/mips-linux-gnu/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/stack_t.h +++ b/lib/libc/include/mips-linux-gnu/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips-linux-gnu/ieee754.h b/lib/libc/include/mips-linux-gnu/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mips-linux-gnu/ieee754.h +++ b/lib/libc/include/mips-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/dlfcn.h b/lib/libc/include/mips64-linux-gnuabi64/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/dlfcn.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/errno.h b/lib/libc/include/mips64-linux-gnuabi64/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/errno.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/eventfd.h b/lib/libc/include/mips64-linux-gnuabi64/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/eventfd.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h b/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/inotify.h b/lib/libc/include/mips64-linux-gnuabi64/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/inotify.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/ioctl-types.h b/lib/libc/include/mips64-linux-gnuabi64/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/ioctl-types.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/ipctypes.h b/lib/libc/include/mips64-linux-gnuabi64/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/ipctypes.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h b/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/mman.h b/lib/libc/include/mips64-linux-gnuabi64/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/mman.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/poll.h b/lib/libc/include/mips64-linux-gnuabi64/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/poll.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/pthreadtypes-arch.h b/lib/libc/include/mips64-linux-gnuabi64/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/resource.h b/lib/libc/include/mips64-linux-gnuabi64/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/resource.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/semaphore.h b/lib/libc/include/mips64-linux-gnuabi64/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/semaphore.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/shmlba.h b/lib/libc/include/mips64-linux-gnuabi64/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/shmlba.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/sigaction.h b/lib/libc/include/mips64-linux-gnuabi64/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/sigaction.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/sigcontext.h b/lib/libc/include/mips64-linux-gnuabi64/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/sigcontext.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/signalfd.h b/lib/libc/include/mips64-linux-gnuabi64/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/signalfd.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/signum-arch.h b/lib/libc/include/mips64-linux-gnuabi64/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/signum-arch.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h b/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/socket_type.h b/lib/libc/include/mips64-linux-gnuabi64/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/socket_type.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/statfs.h b/lib/libc/include/mips64-linux-gnuabi64/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/statfs.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/struct_mutex.h b/lib/libc/include/mips64-linux-gnuabi64/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/struct_mutex.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_cc.h b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_cc.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_lflag.h b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_lflag.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-struct.h b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-struct.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-tcflow.h b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/termios-tcflow.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/timerfd.h b/lib/libc/include/mips64-linux-gnuabi64/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/timerfd.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/stack_t.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/stack_t.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabi64/ieee754.h b/lib/libc/include/mips64-linux-gnuabi64/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/ieee754.h +++ b/lib/libc/include/mips64-linux-gnuabi64/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/dlfcn.h b/lib/libc/include/mips64-linux-gnuabin32/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/dlfcn.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/errno.h b/lib/libc/include/mips64-linux-gnuabin32/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/errno.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/eventfd.h b/lib/libc/include/mips64-linux-gnuabin32/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/eventfd.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h b/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/inotify.h b/lib/libc/include/mips64-linux-gnuabin32/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/inotify.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/ioctl-types.h b/lib/libc/include/mips64-linux-gnuabin32/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/ioctl-types.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/ipctypes.h b/lib/libc/include/mips64-linux-gnuabin32/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/ipctypes.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h b/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/mman.h b/lib/libc/include/mips64-linux-gnuabin32/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/mman.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/poll.h b/lib/libc/include/mips64-linux-gnuabin32/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/poll.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/pthreadtypes-arch.h b/lib/libc/include/mips64-linux-gnuabin32/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/resource.h b/lib/libc/include/mips64-linux-gnuabin32/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/resource.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/semaphore.h b/lib/libc/include/mips64-linux-gnuabin32/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/semaphore.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/shmlba.h b/lib/libc/include/mips64-linux-gnuabin32/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/shmlba.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/sigaction.h b/lib/libc/include/mips64-linux-gnuabin32/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/sigaction.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/sigcontext.h b/lib/libc/include/mips64-linux-gnuabin32/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/sigcontext.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/signalfd.h b/lib/libc/include/mips64-linux-gnuabin32/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/signalfd.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/signum-arch.h b/lib/libc/include/mips64-linux-gnuabin32/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/signum-arch.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h b/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/socket_type.h b/lib/libc/include/mips64-linux-gnuabin32/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/socket_type.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/statfs.h b/lib/libc/include/mips64-linux-gnuabin32/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/statfs.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/struct_mutex.h b/lib/libc/include/mips64-linux-gnuabin32/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/struct_mutex.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_cc.h b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_cc.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_lflag.h b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_lflag.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-struct.h b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-struct.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-tcflow.h b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/termios-tcflow.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/timerfd.h b/lib/libc/include/mips64-linux-gnuabin32/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/timerfd.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/stack_t.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/stack_t.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64-linux-gnuabin32/ieee754.h b/lib/libc/include/mips64-linux-gnuabin32/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/ieee754.h +++ b/lib/libc/include/mips64-linux-gnuabin32/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/dlfcn.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/dlfcn.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/errno.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/errno.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/eventfd.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/eventfd.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/inotify.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/inotify.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/ioctl-types.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/ioctl-types.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/ipctypes.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/ipctypes.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/mman.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/mman.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/poll.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/poll.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/pthreadtypes-arch.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/resource.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/resource.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/semaphore.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/semaphore.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/shmlba.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/shmlba.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/sigaction.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/sigaction.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/sigcontext.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/sigcontext.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/signalfd.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/signalfd.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/signum-arch.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/signum-arch.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket_type.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket_type.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/statfs.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/statfs.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_mutex.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_mutex.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_cc.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_cc.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_lflag.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_lflag.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-struct.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-struct.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-tcflow.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-tcflow.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/timerfd.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/timerfd.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/stack_t.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/stack_t.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabi64/ieee754.h b/lib/libc/include/mips64el-linux-gnuabi64/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/ieee754.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/dlfcn.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/dlfcn.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/errno.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/errno.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/eventfd.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/eventfd.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/inotify.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/inotify.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/ioctl-types.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/ioctl-types.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/ipctypes.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/ipctypes.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/mman.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/mman.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/poll.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/poll.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/pthreadtypes-arch.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/resource.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/resource.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/semaphore.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/semaphore.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/shmlba.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/shmlba.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/sigaction.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/sigaction.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/sigcontext.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/sigcontext.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/signalfd.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/signalfd.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/signum-arch.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/signum-arch.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket_type.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket_type.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/statfs.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/statfs.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_mutex.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_mutex.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_cc.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_cc.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_lflag.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_lflag.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-struct.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-struct.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-tcflow.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-tcflow.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/timerfd.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/timerfd.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/stack_t.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/stack_t.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mips64el-linux-gnuabin32/ieee754.h b/lib/libc/include/mips64el-linux-gnuabin32/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/ieee754.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h b/lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h index f0c7dabbcc..733090d634 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/errno.h b/lib/libc/include/mipsel-linux-gnu/bits/errno.h index a508c37d1c..0362f92048 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/errno.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. MIPS/Linux specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/eventfd.h b/lib/libc/include/mipsel-linux-gnu/bits/eventfd.h index f1bea57e19..a0f8f94d0c 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/eventfd.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/floatn.h b/lib/libc/include/mipsel-linux-gnu/bits/floatn.h index 68a17ab2c7..c05a5e55e0 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/floatn.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on MIPS platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/inotify.h b/lib/libc/include/mipsel-linux-gnu/bits/inotify.h index 5025b69e8a..f72c8dc639 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/inotify.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h b/lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h index 064494da76..84081f4bfd 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h b/lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h index a40b72c769..aa6d3772af 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h b/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h index 2f7a63a3dd..cf2974b434 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/mman.h b/lib/libc/include/mipsel-linux-gnu/bits/mman.h index ec9cc654ca..726689ddec 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/mman.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/poll.h b/lib/libc/include/mipsel-linux-gnu/bits/poll.h index e1901823ca..fd12b70920 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/poll.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h index 6fb6e1c0b0..b6894a757e 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/resource.h b/lib/libc/include/mipsel-linux-gnu/bits/resource.h index f2a2c48a9d..743dc1b9ad 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/resource.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/semaphore.h b/lib/libc/include/mipsel-linux-gnu/bits/semaphore.h index e28b319eb5..73abfb8078 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/semaphore.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/shmlba.h b/lib/libc/include/mipsel-linux-gnu/bits/shmlba.h index 9f61bc9247..357defb2ba 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/shmlba.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. MIPS version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/sigaction.h b/lib/libc/include/mipsel-linux-gnu/bits/sigaction.h index af27d0c0fc..f968c4d10d 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/sigaction.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/MIPS's sigaction. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h b/lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h index cb51a1980f..cdf767d48a 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/mipsel-linux-gnu/bits/signalfd.h b/lib/libc/include/mipsel-linux-gnu/bits/signalfd.h index 8bc180b1b8..10b69b2df4 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/signalfd.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h b/lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h index 5ca20ca480..a217ddd443 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/MIPS version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h b/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h index 6ed2492084..d696a579f6 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for MIPS. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/socket_type.h b/lib/libc/include/mipsel-linux-gnu/bits/socket_type.h index ad858e116a..f66bd0ea5f 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/socket_type.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/MIPS. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/statfs.h b/lib/libc/include/mipsel-linux-gnu/bits/statfs.h index fad668a7a3..0e18718b24 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/statfs.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h b/lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h index 025ccddc14..8ddb89ce24 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* MIPS internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h index 5b5850ca57..8e67783a9e 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h index cc1f2a0bd5..6ef207b1a2 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h b/lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h index f046eaaa80..3bae186f55 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h b/lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h index f21c02a389..a6a4e5719e 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/mips version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/timerfd.h b/lib/libc/include/mipsel-linux-gnu/bits/timerfd.h index 79ff9d0cc4..871792717b 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/timerfd.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h b/lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h index 03e800bd0c..005479e51a 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h @@ -1,5 +1,5 @@ /* Define stack_t. MIPS Linux version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h index d469ca5f18..d40f4ffc82 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h index a6ca82cbec..dfdf05cc71 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* MIPS implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h index 4398086812..c59e4e25b6 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/MIPS implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/mipsel-linux-gnu/ieee754.h b/lib/libc/include/mipsel-linux-gnu/ieee754.h index 86baeceab6..f3e3977ca3 100644 --- a/lib/libc/include/mipsel-linux-gnu/ieee754.h +++ b/lib/libc/include/mipsel-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/environments.h b/lib/libc/include/powerpc-linux-gnu/bits/environments.h index 9134837e15..81b109e9c7 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/environments.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fcntl.h b/lib/libc/include/powerpc-linux-gnu/bits/fcntl.h index e67c6530dd..abb1bd7083 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fenv.h b/lib/libc/include/powerpc-linux-gnu/bits/fenv.h index 65ef2f98a0..a1e1b6ba4b 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/fenv.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/floatn.h b/lib/libc/include/powerpc-linux-gnu/bits/floatn.h index bec17f1a7c..cb7f2fe5bc 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/floatn.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on powerpc. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h b/lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h index d8f3a7d003..e10d37d400 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. PowerPC version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/hwcap.h b/lib/libc/include/powerpc-linux-gnu/bits/hwcap.h index 5719e16ac2..9858baf991 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP and AT_HWCAP2. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h b/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h index 353daa482e..919610e5ca 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/powerpc version. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h b/lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h index 73e3a67f70..ff13f53218 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. Linux/powerpc version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h b/lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h index c94a446c49..288b2f2d8a 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-128ibm version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/link.h b/lib/libc/include/powerpc-linux-gnu/bits/link.h index 2bc9350201..fc234f741e 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/link.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific declarations for dynamic linker interface. PowerPC version - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h index 2178c8890c..5416e4d6cf 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/long-double.h b/lib/libc/include/powerpc-linux-gnu/bits/long-double.h index b37f1929bd..e3ec00d82b 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/long-double.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-opt version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/mman.h b/lib/libc/include/powerpc-linux-gnu/bits/mman.h index 40e853fef3..c920654b28 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/mman.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/procfs.h b/lib/libc/include/powerpc-linux-gnu/bits/procfs.h index 4afb90d85a..eabe87ff35 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/procfs.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/setjmp.h b/lib/libc/include/powerpc-linux-gnu/bits/setjmp.h index b0d5e53478..47eec4fe73 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/sigstack.h b/lib/libc/include/powerpc-linux-gnu/bits/sigstack.h index 7d28d61692..f2371950e2 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h index ad54f32304..64f96f535c 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for POWER. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h b/lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h index 40b5c891ec..708b22e85a 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* PowerPC internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h index 7ab9afe0ee..5d5bc3f894 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* PowerPC internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/powerpc-linux-gnu/bits/stat.h b/lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h similarity index 82% rename from lib/libc/include/powerpc-linux-gnu/bits/stat.h rename to lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h index 9daf5a5c56..805594defd 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/stat.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,35 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - #if __WORDSIZE == 32 struct stat @@ -232,44 +216,10 @@ struct stat64 # endif /* __USE_LARGEFILE64 */ #endif - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h index 45a0dd450d..4ee2f824bf 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h index f4c30c87d2..32283b153f 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h index d63f19296f..01c2a123b5 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h @@ -1,5 +1,5 @@ /* termios control mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h index 846bd192c4..4df494e6dc 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h @@ -1,5 +1,5 @@ /* termios input mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h index aa3d3fe584..ee2291cc56 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h index bdac69b5ad..a875d23d4f 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h index 1053139360..dc3fb15aa7 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h @@ -1,5 +1,5 @@ /* termios baud platform specific definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h index 41646497c8..65856a4231 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h index 95d8aaaee9..df168a5b57 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* PowerPC implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h index 1dfac82c03..82e25d77a9 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/fpu_control.h b/lib/libc/include/powerpc-linux-gnu/fpu_control.h index 06ef01bde1..7f66352f1a 100644 --- a/lib/libc/include/powerpc-linux-gnu/fpu_control.h +++ b/lib/libc/include/powerpc-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/ieee754.h b/lib/libc/include/powerpc-linux-gnu/ieee754.h index 9f9206f008..78bbb343c4 100644 --- a/lib/libc/include/powerpc-linux-gnu/ieee754.h +++ b/lib/libc/include/powerpc-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h index d88fdeb5f4..5c5d5addee 100644 --- a/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/PowerPC version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/sys/ucontext.h b/lib/libc/include/powerpc-linux-gnu/sys/ucontext.h index 4be8bb5385..a48adedb95 100644 --- a/lib/libc/include/powerpc-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/powerpc-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc-linux-gnu/sys/user.h b/lib/libc/include/powerpc-linux-gnu/sys/user.h index 0003f18811..c18c39983b 100644 --- a/lib/libc/include/powerpc-linux-gnu/sys/user.h +++ b/lib/libc/include/powerpc-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/environments.h b/lib/libc/include/powerpc64-linux-gnu/bits/environments.h index 9134837e15..81b109e9c7 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/environments.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/fcntl.h b/lib/libc/include/powerpc64-linux-gnu/bits/fcntl.h index e67c6530dd..abb1bd7083 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/fenv.h b/lib/libc/include/powerpc64-linux-gnu/bits/fenv.h index 65ef2f98a0..a1e1b6ba4b 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/fenv.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/floatn.h b/lib/libc/include/powerpc64-linux-gnu/bits/floatn.h index bec17f1a7c..cb7f2fe5bc 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/floatn.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on powerpc. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/fp-fast.h b/lib/libc/include/powerpc64-linux-gnu/bits/fp-fast.h index d8f3a7d003..e10d37d400 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/fp-fast.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. PowerPC version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/hwcap.h b/lib/libc/include/powerpc64-linux-gnu/bits/hwcap.h index 5719e16ac2..9858baf991 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP and AT_HWCAP2. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/ioctl-types.h b/lib/libc/include/powerpc64-linux-gnu/bits/ioctl-types.h index 353daa482e..919610e5ca 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/powerpc version. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/ipc-perm.h b/lib/libc/include/powerpc64-linux-gnu/bits/ipc-perm.h index 73e3a67f70..ff13f53218 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/ipc-perm.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. Linux/powerpc version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/iscanonical.h b/lib/libc/include/powerpc64-linux-gnu/bits/iscanonical.h index c94a446c49..288b2f2d8a 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/iscanonical.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-128ibm version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/link.h b/lib/libc/include/powerpc64-linux-gnu/bits/link.h index 2bc9350201..fc234f741e 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/link.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific declarations for dynamic linker interface. PowerPC version - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h index 2178c8890c..5416e4d6cf 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/long-double.h b/lib/libc/include/powerpc64-linux-gnu/bits/long-double.h index b37f1929bd..e3ec00d82b 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/long-double.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-opt version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/mman.h b/lib/libc/include/powerpc64-linux-gnu/bits/mman.h index 40e853fef3..c920654b28 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/mman.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/procfs.h b/lib/libc/include/powerpc64-linux-gnu/bits/procfs.h index 4afb90d85a..eabe87ff35 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/procfs.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/setjmp.h b/lib/libc/include/powerpc64-linux-gnu/bits/setjmp.h index b0d5e53478..47eec4fe73 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/sigstack.h b/lib/libc/include/powerpc64-linux-gnu/bits/sigstack.h index 7d28d61692..f2371950e2 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h index ad54f32304..64f96f535c 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for POWER. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/struct_mutex.h b/lib/libc/include/powerpc64-linux-gnu/bits/struct_mutex.h index 40b5c891ec..708b22e85a 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* PowerPC internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/powerpc64-linux-gnu/bits/struct_rwlock.h index 7ab9afe0ee..5d5bc3f894 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* PowerPC internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/stat.h b/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h similarity index 82% rename from lib/libc/include/powerpc64-linux-gnu/bits/stat.h rename to lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h index 9daf5a5c56..805594defd 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/stat.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,35 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - #if __WORDSIZE == 32 struct stat @@ -232,44 +216,10 @@ struct stat64 # endif /* __USE_LARGEFILE64 */ #endif - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-baud.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-baud.h index 45a0dd450d..4ee2f824bf 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cc.h index f4c30c87d2..32283b153f 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cflag.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cflag.h index d63f19296f..01c2a123b5 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cflag.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_cflag.h @@ -1,5 +1,5 @@ /* termios control mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_iflag.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_iflag.h index 846bd192c4..4df494e6dc 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_iflag.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_iflag.h @@ -1,5 +1,5 @@ /* termios input mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_lflag.h index aa3d3fe584..ee2291cc56 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_lflag.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_oflag.h index bdac69b5ad..a875d23d4f 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_oflag.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/termios-misc.h b/lib/libc/include/powerpc64-linux-gnu/bits/termios-misc.h index 1053139360..dc3fb15aa7 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/termios-misc.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/termios-misc.h @@ -1,5 +1,5 @@ /* termios baud platform specific definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h index 41646497c8..65856a4231 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h index 95d8aaaee9..df168a5b57 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* PowerPC implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h index 1dfac82c03..82e25d77a9 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/fpu_control.h b/lib/libc/include/powerpc64-linux-gnu/fpu_control.h index 06ef01bde1..7f66352f1a 100644 --- a/lib/libc/include/powerpc64-linux-gnu/fpu_control.h +++ b/lib/libc/include/powerpc64-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/ieee754.h b/lib/libc/include/powerpc64-linux-gnu/ieee754.h index 9f9206f008..78bbb343c4 100644 --- a/lib/libc/include/powerpc64-linux-gnu/ieee754.h +++ b/lib/libc/include/powerpc64-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h index d88fdeb5f4..5c5d5addee 100644 --- a/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/PowerPC version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/sys/ucontext.h b/lib/libc/include/powerpc64-linux-gnu/sys/ucontext.h index 4be8bb5385..a48adedb95 100644 --- a/lib/libc/include/powerpc64-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/powerpc64-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64-linux-gnu/sys/user.h b/lib/libc/include/powerpc64-linux-gnu/sys/user.h index 0003f18811..c18c39983b 100644 --- a/lib/libc/include/powerpc64-linux-gnu/sys/user.h +++ b/lib/libc/include/powerpc64-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/environments.h b/lib/libc/include/powerpc64le-linux-gnu/bits/environments.h index 9134837e15..81b109e9c7 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/environments.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/fcntl.h b/lib/libc/include/powerpc64le-linux-gnu/bits/fcntl.h index e67c6530dd..abb1bd7083 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/fenv.h b/lib/libc/include/powerpc64le-linux-gnu/bits/fenv.h index 65ef2f98a0..a1e1b6ba4b 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/fenv.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/floatn.h b/lib/libc/include/powerpc64le-linux-gnu/bits/floatn.h index bec17f1a7c..cb7f2fe5bc 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/floatn.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on powerpc. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/fp-fast.h b/lib/libc/include/powerpc64le-linux-gnu/bits/fp-fast.h index d8f3a7d003..e10d37d400 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/fp-fast.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/fp-fast.h @@ -1,5 +1,5 @@ /* Define FP_FAST_* macros. PowerPC version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/hwcap.h b/lib/libc/include/powerpc64le-linux-gnu/bits/hwcap.h index 5719e16ac2..9858baf991 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP and AT_HWCAP2. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/ioctl-types.h b/lib/libc/include/powerpc64le-linux-gnu/bits/ioctl-types.h index 353daa482e..919610e5ca 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/ioctl-types.h @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/powerpc version. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/ipc-perm.h b/lib/libc/include/powerpc64le-linux-gnu/bits/ipc-perm.h index 73e3a67f70..ff13f53218 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/ipc-perm.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. Linux/powerpc version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/iscanonical.h b/lib/libc/include/powerpc64le-linux-gnu/bits/iscanonical.h index c94a446c49..288b2f2d8a 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/iscanonical.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-128ibm version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/link.h b/lib/libc/include/powerpc64le-linux-gnu/bits/link.h index 2bc9350201..fc234f741e 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/link.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific declarations for dynamic linker interface. PowerPC version - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h index 2178c8890c..5416e4d6cf 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/long-double.h b/lib/libc/include/powerpc64le-linux-gnu/bits/long-double.h index bfeb899917..04806b1347 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/long-double.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-opt version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/mman.h b/lib/libc/include/powerpc64le-linux-gnu/bits/mman.h index 40e853fef3..c920654b28 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/mman.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/procfs.h b/lib/libc/include/powerpc64le-linux-gnu/bits/procfs.h index 4afb90d85a..eabe87ff35 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/procfs.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/setjmp.h b/lib/libc/include/powerpc64le-linux-gnu/bits/setjmp.h index b0d5e53478..47eec4fe73 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/sigstack.h b/lib/libc/include/powerpc64le-linux-gnu/bits/sigstack.h index 7d28d61692..f2371950e2 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h index ad54f32304..64f96f535c 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for POWER. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_mutex.h b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_mutex.h index 40b5c891ec..708b22e85a 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* PowerPC internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_rwlock.h index 7ab9afe0ee..5d5bc3f894 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* PowerPC internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/stat.h b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h similarity index 82% rename from lib/libc/include/powerpc64le-linux-gnu/bits/stat.h rename to lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h index 9daf5a5c56..805594defd 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/stat.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,35 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - #if __WORDSIZE == 32 struct stat @@ -232,44 +216,10 @@ struct stat64 # endif /* __USE_LARGEFILE64 */ #endif - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-baud.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-baud.h index 45a0dd450d..4ee2f824bf 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cc.h index f4c30c87d2..32283b153f 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cflag.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cflag.h index d63f19296f..01c2a123b5 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cflag.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_cflag.h @@ -1,5 +1,5 @@ /* termios control mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_iflag.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_iflag.h index 846bd192c4..4df494e6dc 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_iflag.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_iflag.h @@ -1,5 +1,5 @@ /* termios input mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_lflag.h index aa3d3fe584..ee2291cc56 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_lflag.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_lflag.h @@ -1,5 +1,5 @@ /* termios local mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_oflag.h index bdac69b5ad..a875d23d4f 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_oflag.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-misc.h b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-misc.h index 1053139360..dc3fb15aa7 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/termios-misc.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/termios-misc.h @@ -1,5 +1,5 @@ /* termios baud platform specific definitions. Linux/powerpc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h index 41646497c8..65856a4231 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h index 95d8aaaee9..df168a5b57 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* PowerPC implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h index 1dfac82c03..82e25d77a9 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/PowerPC implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/fpu_control.h b/lib/libc/include/powerpc64le-linux-gnu/fpu_control.h index 06ef01bde1..7f66352f1a 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/fpu_control.h +++ b/lib/libc/include/powerpc64le-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. PowerPC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/ieee754.h b/lib/libc/include/powerpc64le-linux-gnu/ieee754.h index 9f9206f008..78bbb343c4 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/ieee754.h +++ b/lib/libc/include/powerpc64le-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h index d88fdeb5f4..5c5d5addee 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/PowerPC version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/sys/ucontext.h b/lib/libc/include/powerpc64le-linux-gnu/sys/ucontext.h index 4be8bb5385..a48adedb95 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/powerpc64le-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/powerpc64le-linux-gnu/sys/user.h b/lib/libc/include/powerpc64le-linux-gnu/sys/user.h index 0003f18811..c18c39983b 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/sys/user.h +++ b/lib/libc/include/powerpc64le-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/environments.h b/lib/libc/include/riscv64-linux-gnu/bits/environments.h new file mode 100644 index 0000000000..11a6861955 --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/bits/environments.h @@ -0,0 +1,81 @@ +/* Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* We can never provide environments with 32-bit wide pointers. */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V7_ILP32_OFFBIG -1 +# define _POSIX_V6_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFFBIG -1 +# define _XBS5_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFFBIG -1 +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* RISC-V requires 64-bit off_t */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFF32 -1 + +# define _POSIX_V7_ILP32_OFFBIG 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We can never provide environments with 64-bit wide pointers. */ +# define _POSIX_V7_LP64_OFF64 -1 +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LP64_OFF64 -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LP64_OFF64 -1 +# define _XBS5_LPBIG_OFFBIG -1 + +#endif /* __WORDSIZE == 32 */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/bits/fcntl.h b/lib/libc/include/riscv64-linux-gnu/bits/fcntl.h index c72b6648aa..dfe78dc364 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux / RISC-V. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/riscv64-linux-gnu/bits/fenv.h b/lib/libc/include/riscv64-linux-gnu/bits/fenv.h index 1cfa3ad192..76d0a275ea 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/fenv.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/fenv.h @@ -1,5 +1,5 @@ /* Floating point environment, RISC-V version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/link.h b/lib/libc/include/riscv64-linux-gnu/bits/link.h index 5ffe4fc4c4..298feed149 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/link.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific declarations for dynamic linker interface. RISC-V version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/long-double.h b/lib/libc/include/riscv64-linux-gnu/bits/long-double.h index f95b24f8e7..ec1a0674e8 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/long-double.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-128 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/procfs.h b/lib/libc/include/riscv64-linux-gnu/bits/procfs.h index e967fb281d..f3d4811954 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/procfs.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. RISC-V version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/riscv64-linux-gnu/bits/pthreadtypes-arch.h index 3bb9234ed1..e1e7758a46 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. RISC-V version. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,18 +21,22 @@ #include -#if __riscv_xlen == 64 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -# define __SIZEOF_PTHREAD_COND_T 48 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#if __WORDSIZE == 64 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 #else -# error "rv32i-based systems are not supported" +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_RWLOCK_T 48 +# define __SIZEOF_PTHREAD_BARRIER_T 20 #endif #define __LOCK_ALIGNMENT diff --git a/lib/libc/include/riscv64-linux-gnu/bits/setjmp.h b/lib/libc/include/riscv64-linux-gnu/bits/setjmp.h index 9413cc01d2..1468211a4b 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. RISC-V version. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/bits/sigcontext.h b/lib/libc/include/riscv64-linux-gnu/bits/sigcontext.h index 65693f5954..3fb12ebdd4 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/sigcontext.h @@ -1,5 +1,5 @@ /* Machine-dependent signal context structure for Linux. RISC-V version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/lib/libc/include/riscv64-linux-gnu/bits/statfs.h b/lib/libc/include/riscv64-linux-gnu/bits/statfs.h index 61c27388e9..94a6e610fb 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/statfs.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/riscv64-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/riscv64-linux-gnu/bits/struct_rwlock.h index 46d00e138a..f5af7bd0da 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* RISC-V internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #ifndef _RWLOCK_INTERNAL_H #define _RWLOCK_INTERNAL_H @@ -32,14 +32,37 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; +#if __WORDSIZE == 64 int __cur_writer; int __shared; unsigned long int __pad1; unsigned long int __pad2; unsigned int __flags; +#else +# if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +# else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +# endif + int __cur_writer; +#endif }; -#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif #endif \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/bits/struct_stat.h b/lib/libc/include/riscv64-linux-gnu/bits/struct_stat.h new file mode 100644 index 0000000000..0549e9d97f --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/bits/struct_stat.h @@ -0,0 +1,127 @@ +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include +#include + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T +# error "ino_t and off_t must both be the same type" +# endif +# define __field64(type, type64, name) type name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct stat + { + __dev_t st_dev; /* Device. */ + __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/bits/time64.h b/lib/libc/include/riscv64-linux-gnu/bits/time64.h new file mode 100644 index 0000000000..ba5a262d12 --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/bits/time64.h @@ -0,0 +1,36 @@ +/* bits/time64.h -- underlying types for __time64_t. RISC-V version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TIME64_H +#define _BITS_TIME64_H 1 + +/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */ + +#if __WORDSIZE == 64 +/* If we already have 64-bit time type then use it. */ +# define __TIME64_T_TYPE __TIME_T_TYPE +#else +/* Define a 64-bit time type alongsize the 32-bit one. */ +# define __TIME64_T_TYPE __SQUAD_TYPE +#endif + +#endif /* bits/time64.h */ \ No newline at end of file diff --git a/lib/libc/include/s390x-linux-gnu/bits/flt-eval-method.h b/lib/libc/include/riscv64-linux-gnu/bits/timesize.h similarity index 70% rename from lib/libc/include/s390x-linux-gnu/bits/flt-eval-method.h rename to lib/libc/include/riscv64-linux-gnu/bits/timesize.h index 476c45e684..292bd5e181 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/flt-eval-method.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/timesize.h @@ -1,5 +1,5 @@ -/* Define __GLIBC_FLT_EVAL_METHOD. S/390 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. +/* Bit size of the time_t type at glibc build time, RISC-V case. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,9 +16,7 @@ License along with the GNU C Library; if not, see . */ -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif +#include -/* This value is used because of a historical mistake. */ -#define __GLIBC_FLT_EVAL_METHOD 1 \ No newline at end of file +/* RV32 and RV64 both use 64-bit time_t */ +#define __TIMESIZE 64 \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/bits/typesizes.h b/lib/libc/include/riscv64-linux-gnu/bits/typesizes.h index a5f4c78b94..4156f352ad 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. diff --git a/lib/libc/include/riscv64-linux-gnu/bits/wordsize.h b/lib/libc/include/riscv64-linux-gnu/bits/wordsize.h index 1c5e427762..c2bf0e7f80 100644 --- a/lib/libc/include/riscv64-linux-gnu/bits/wordsize.h +++ b/lib/libc/include/riscv64-linux-gnu/bits/wordsize.h @@ -1,5 +1,5 @@ /* Determine the wordsize from the preprocessor defines. RISC-V version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,9 @@ # error unsupported ABI #endif -#if __riscv_xlen == 64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# error "rv32i-based targets are not supported" +#define __WORDSIZE_TIME64_COMPAT32 1 + +#if __WORDSIZE == 32 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 #endif \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/fpu_control.h b/lib/libc/include/riscv64-linux-gnu/fpu_control.h index 4aeb6aa44b..c0b8528184 100644 --- a/lib/libc/include/riscv64-linux-gnu/fpu_control.h +++ b/lib/libc/include/riscv64-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. RISC-V version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names.h b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names.h index 0d4874b764..bd22593296 100644 --- a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names.h +++ b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names.h @@ -6,10 +6,16 @@ #include -#if defined __LP64__ && defined __riscv_float_abi_soft +#if __WORDSIZE == 32 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 32 && defined __riscv_float_abi_double +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_soft # include #endif -#if defined __LP64__ && defined __riscv_float_abi_double +#if __WORDSIZE == 64 && defined __riscv_float_abi_double # include #endif diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/stubs.h b/lib/libc/include/riscv64-linux-gnu/gnu/stubs.h index 94f9eb18be..833e9c3625 100644 --- a/lib/libc/include/riscv64-linux-gnu/gnu/stubs.h +++ b/lib/libc/include/riscv64-linux-gnu/gnu/stubs.h @@ -4,9 +4,15 @@ #include -#if defined __LP64__ && defined __riscv_float_abi_soft +#if __WORDSIZE == 32 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 32 && defined __riscv_float_abi_double +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_soft # include #endif -#if defined __LP64__ && defined __riscv_float_abi_double +#if __WORDSIZE == 64 && defined __riscv_float_abi_double # include #endif \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/ieee754.h b/lib/libc/include/riscv64-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/riscv64-linux-gnu/ieee754.h +++ b/lib/libc/include/riscv64-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/sys/asm.h b/lib/libc/include/riscv64-linux-gnu/sys/asm.h index 01c6095c69..494294c5a4 100644 --- a/lib/libc/include/riscv64-linux-gnu/sys/asm.h +++ b/lib/libc/include/riscv64-linux-gnu/sys/asm.h @@ -1,5 +1,5 @@ /* Miscellaneous macros. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,11 +22,14 @@ /* Macros to handle different pointer/register sizes for 32/64-bit code. */ #if __riscv_xlen == 64 # define PTRLOG 3 -# define SZREG 8 +# define SZREG 8 # define REG_S sd # define REG_L ld #elif __riscv_xlen == 32 -# error "rv32i-based targets are not supported" +# define PTRLOG 2 +# define SZREG 4 +# define REG_S sw +# define REG_L lw #else # error __riscv_xlen must equal 32 or 64 #endif diff --git a/lib/libc/include/riscv64-linux-gnu/sys/cachectl.h b/lib/libc/include/riscv64-linux-gnu/sys/cachectl.h index 7d627edf2c..563ef09109 100644 --- a/lib/libc/include/riscv64-linux-gnu/sys/cachectl.h +++ b/lib/libc/include/riscv64-linux-gnu/sys/cachectl.h @@ -1,5 +1,5 @@ /* RISC-V instruction cache flushing interface - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/riscv64-linux-gnu/sys/ucontext.h b/lib/libc/include/riscv64-linux-gnu/sys/ucontext.h index 5d7aeabad1..7a0d6ba212 100644 --- a/lib/libc/include/riscv64-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/riscv64-linux-gnu/sys/ucontext.h @@ -1,5 +1,5 @@ /* struct ucontext definition, RISC-V version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/riscv64-linux-gnu/sys/user.h b/lib/libc/include/riscv64-linux-gnu/sys/user.h index 6e235050f8..cf24a99aa5 100644 --- a/lib/libc/include/riscv64-linux-gnu/sys/user.h +++ b/lib/libc/include/riscv64-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/elfclass.h b/lib/libc/include/s390x-linux-gnu/bits/elfclass.h index 524c41cc78..1625466356 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/elfclass.h +++ b/lib/libc/include/s390x-linux-gnu/bits/elfclass.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/bits/environments.h b/lib/libc/include/s390x-linux-gnu/bits/environments.h index ceb249aa7f..b50535f91c 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/environments.h +++ b/lib/libc/include/s390x-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/fcntl.h b/lib/libc/include/s390x-linux-gnu/bits/fcntl.h index 1e8b1bdde6..0af7a3956b 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/s390x-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/fenv.h b/lib/libc/include/s390x-linux-gnu/bits/fenv.h index 5bf167975e..ab73cf6072 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/fenv.h +++ b/lib/libc/include/s390x-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow . diff --git a/lib/libc/include/s390x-linux-gnu/bits/hwcap.h b/lib/libc/include/s390x-linux-gnu/bits/hwcap.h index 02ed6bc98c..5031d2e6a7 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/s390x-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,8 +36,11 @@ #define HWCAP_S390_HIGH_GPRS 512 #define HWCAP_S390_TE 1024 #define HWCAP_S390_VX 2048 +#define HWCAP_S390_VXRS HWCAP_S390_VX #define HWCAP_S390_VXD 4096 +#define HWCAP_S390_VXRS_BCD HWCAP_S390_VXD #define HWCAP_S390_VXE 8192 +#define HWCAP_S390_VXRS_EXT HWCAP_S390_VXE #define HWCAP_S390_GS 16384 #define HWCAP_S390_VXRS_EXT2 32768 #define HWCAP_S390_VXRS_PDE 65536 diff --git a/lib/libc/include/s390x-linux-gnu/bits/link.h b/lib/libc/include/s390x-linux-gnu/bits/link.h index e9497e85b7..01f4f058d3 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/link.h +++ b/lib/libc/include/s390x-linux-gnu/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/long-double.h b/lib/libc/include/s390x-linux-gnu/bits/long-double.h index b37f1929bd..e3ec00d82b 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/long-double.h +++ b/lib/libc/include/s390x-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-opt version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/procfs-extra.h b/lib/libc/include/s390x-linux-gnu/bits/procfs-extra.h index b7893aa175..95af630aeb 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/procfs-extra.h +++ b/lib/libc/include/s390x-linux-gnu/bits/procfs-extra.h @@ -1,5 +1,5 @@ /* Extra sys/procfs.h definitions. S/390 version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/procfs-id.h b/lib/libc/include/s390x-linux-gnu/bits/procfs-id.h index 16f571fbce..4da8f1f843 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/procfs-id.h +++ b/lib/libc/include/s390x-linux-gnu/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. S/390 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/bits/procfs.h b/lib/libc/include/s390x-linux-gnu/bits/procfs.h index e992e8cc1b..924f6c6e36 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/procfs.h +++ b/lib/libc/include/s390x-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. S/390 version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/setjmp.h b/lib/libc/include/s390x-linux-gnu/bits/setjmp.h index 33f1db4708..42dbb2709f 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/s390x-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/sigaction.h b/lib/libc/include/s390x-linux-gnu/bits/sigaction.h index 9fceeaf6f7..566e083351 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/sigaction.h +++ b/lib/libc/include/s390x-linux-gnu/bits/sigaction.h @@ -1,5 +1,5 @@ /* Definitions for 31 & 64 bit S/390 sigaction. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/statfs.h b/lib/libc/include/s390x-linux-gnu/bits/statfs.h index d592a33352..202dc21d42 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/statfs.h +++ b/lib/libc/include/s390x-linux-gnu/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/struct_mutex.h b/lib/libc/include/s390x-linux-gnu/bits/struct_mutex.h index f81c2fbb3f..0a10aa1ef0 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/s390x-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* S390 internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/s390x-linux-gnu/bits/struct_rwlock.h index e0f5109d4f..0ca0d74890 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/s390x-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* S390 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/bits/stat.h b/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h similarity index 80% rename from lib/libc/include/s390x-linux-gnu/bits/stat.h rename to lib/libc/include/s390x-linux-gnu/bits/struct_stat.h index ef5b2504fc..47bee1f317 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/stat.h +++ b/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,40 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include -#if __WORDSIZE == 64 -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 -# define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 -#else -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 -# define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX -#endif - #if __WORDSIZE == 64 struct stat { @@ -229,37 +208,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/s390x-linux-gnu/bits/typesizes.h b/lib/libc/include/s390x-linux-gnu/bits/typesizes.h index fecd80e33a..c3c2d56c63 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/s390x-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/s390 version. - Copyright (C) 2003-2020 Free Software Foundation, Inc. + Copyright (C) 2003-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/utmp.h b/lib/libc/include/s390x-linux-gnu/bits/utmp.h index e74481f3cf..75bef50c8a 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/utmp.h +++ b/lib/libc/include/s390x-linux-gnu/bits/utmp.h @@ -1,5 +1,5 @@ /* The `struct utmp' type, describing entries in the utmp file. GNU version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/bits/utmpx.h b/lib/libc/include/s390x-linux-gnu/bits/utmpx.h index 9466c4b530..d2adcc3d3f 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/utmpx.h +++ b/lib/libc/include/s390x-linux-gnu/bits/utmpx.h @@ -1,5 +1,5 @@ /* Structures and definitions for the user accounting database. GNU version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/fpu_control.h b/lib/libc/include/s390x-linux-gnu/fpu_control.h index 3ca492fd63..ac2015aec3 100644 --- a/lib/libc/include/s390x-linux-gnu/fpu_control.h +++ b/lib/libc/include/s390x-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. Stub version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com) and Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/ieee754.h b/lib/libc/include/s390x-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/s390x-linux-gnu/ieee754.h +++ b/lib/libc/include/s390x-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/sys/elf.h b/lib/libc/include/s390x-linux-gnu/sys/elf.h index 3bdf93f1d0..b4c8f9f9ef 100644 --- a/lib/libc/include/s390x-linux-gnu/sys/elf.h +++ b/lib/libc/include/s390x-linux-gnu/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/s390x-linux-gnu/sys/ptrace.h b/lib/libc/include/s390x-linux-gnu/sys/ptrace.h index 50673a84a2..fc62cf8756 100644 --- a/lib/libc/include/s390x-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/s390x-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/S390 version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/sys/ucontext.h b/lib/libc/include/s390x-linux-gnu/sys/ucontext.h index fc83b2c8f2..1162f11926 100644 --- a/lib/libc/include/s390x-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/s390x-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/include/s390x-linux-gnu/sys/user.h b/lib/libc/include/s390x-linux-gnu/sys/user.h index 19bbd0c40b..7c9764f3ad 100644 --- a/lib/libc/include/s390x-linux-gnu/sys/user.h +++ b/lib/libc/include/s390x-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/environments.h b/lib/libc/include/sparc-linux-gnu/bits/environments.h index 9134837e15..81b109e9c7 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/environments.h +++ b/lib/libc/include/sparc-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/epoll.h b/lib/libc/include/sparc-linux-gnu/bits/epoll.h index b06a614334..298f3e8170 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/epoll.h +++ b/lib/libc/include/sparc-linux-gnu/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/errno.h b/lib/libc/include/sparc-linux-gnu/bits/errno.h index d190a76817..38a52e3599 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/errno.h +++ b/lib/libc/include/sparc-linux-gnu/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. Linux/Sparc specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/eventfd.h b/lib/libc/include/sparc-linux-gnu/bits/eventfd.h index a57ae6403d..71409f55ba 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/eventfd.h +++ b/lib/libc/include/sparc-linux-gnu/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/fcntl.h b/lib/libc/include/sparc-linux-gnu/bits/fcntl.h index 48e3da3472..d5009f1233 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/sparc-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/SPARC. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/fenv.h b/lib/libc/include/sparc-linux-gnu/bits/fenv.h index 7eba346aa7..2de6eb4eb3 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/fenv.h +++ b/lib/libc/include/sparc-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/hwcap.h b/lib/libc/include/sparc-linux-gnu/bits/hwcap.h index 679ae54a2f..3f9c7c7f1d 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/sparc-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/inotify.h b/lib/libc/include/sparc-linux-gnu/bits/inotify.h index 8d1caf93a2..e489d7406c 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/inotify.h +++ b/lib/libc/include/sparc-linux-gnu/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/ioctls.h b/lib/libc/include/sparc-linux-gnu/bits/ioctls.h index 46ae087fe6..9ed3b29627 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/ioctls.h +++ b/lib/libc/include/sparc-linux-gnu/bits/ioctls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/ipc-perm.h b/lib/libc/include/sparc-linux-gnu/bits/ipc-perm.h index 97839b1e72..d1761dca79 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/ipc-perm.h +++ b/lib/libc/include/sparc-linux-gnu/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. Linux/sparc version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/link.h b/lib/libc/include/sparc-linux-gnu/bits/link.h index 9ba62345c0..e6e0d275c4 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/link.h +++ b/lib/libc/include/sparc-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific audit interfaces for dynamic linker. SPARC version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/local_lim.h b/lib/libc/include/sparc-linux-gnu/bits/local_lim.h index b2c73b5ae5..0a1bc361e6 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/sparc-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux/SPARC version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/long-double.h b/lib/libc/include/sparc-linux-gnu/bits/long-double.h index de5e60beb8..c97d298d58 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/long-double.h +++ b/lib/libc/include/sparc-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. SPARC version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/mman.h b/lib/libc/include/sparc-linux-gnu/bits/mman.h index 8fec53b60f..f8a8c97804 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/mman.h +++ b/lib/libc/include/sparc-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SPARC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/poll.h b/lib/libc/include/sparc-linux-gnu/bits/poll.h index 892307ca0f..7883f85350 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/poll.h +++ b/lib/libc/include/sparc-linux-gnu/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/procfs-extra.h b/lib/libc/include/sparc-linux-gnu/bits/procfs-extra.h index 3e7691d5c3..570c5de206 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/procfs-extra.h +++ b/lib/libc/include/sparc-linux-gnu/bits/procfs-extra.h @@ -1,5 +1,5 @@ /* Extra sys/procfs.h definitions. SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/procfs-id.h b/lib/libc/include/sparc-linux-gnu/bits/procfs-id.h index df3f655ac8..3bdb35d0f9 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/procfs-id.h +++ b/lib/libc/include/sparc-linux-gnu/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. SPARC version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/sparc-linux-gnu/bits/procfs.h b/lib/libc/include/sparc-linux-gnu/bits/procfs.h index 7b3620640d..6217d6f2ff 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/procfs.h +++ b/lib/libc/include/sparc-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/resource.h b/lib/libc/include/sparc-linux-gnu/bits/resource.h index 3cfbfd381c..b13aaa86af 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/resource.h +++ b/lib/libc/include/sparc-linux-gnu/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/SPARC version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/setjmp.h b/lib/libc/include/sparc-linux-gnu/bits/setjmp.h index 1e1174bad1..e7c1964e13 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/sparc-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/shmlba.h b/lib/libc/include/sparc-linux-gnu/bits/shmlba.h index fc9e3e3669..0a04d45b51 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/shmlba.h +++ b/lib/libc/include/sparc-linux-gnu/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. SPARC version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/sigaction.h b/lib/libc/include/sparc-linux-gnu/bits/sigaction.h index 2a3f67242d..c81f76e78b 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/sigaction.h +++ b/lib/libc/include/sparc-linux-gnu/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/SPARC sigaction. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/sigcontext.h b/lib/libc/include/sparc-linux-gnu/bits/sigcontext.h index df187d5970..0176699a88 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/sparc-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/signalfd.h b/lib/libc/include/sparc-linux-gnu/bits/signalfd.h index 6cfcd8c574..c2c5bc4462 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/signalfd.h +++ b/lib/libc/include/sparc-linux-gnu/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/signum-arch.h b/lib/libc/include/sparc-linux-gnu/bits/signum-arch.h index 36a52c8e5a..f7a416223c 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/signum-arch.h +++ b/lib/libc/include/sparc-linux-gnu/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/sigstack.h b/lib/libc/include/sparc-linux-gnu/bits/sigstack.h index 7d28d61692..f2371950e2 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/sparc-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h b/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h index 94b8e65b3c..6d45cf834d 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for SPARC. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/socket_type.h b/lib/libc/include/sparc-linux-gnu/bits/socket_type.h index d25882e2a0..16f1604498 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/socket_type.h +++ b/lib/libc/include/sparc-linux-gnu/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/SPARC. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/sparc-linux-gnu/bits/struct_rwlock.h index 433d1f6f16..01b8d4b742 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/sparc-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* SPARC internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/sparc-linux-gnu/bits/stat.h b/lib/libc/include/sparc-linux-gnu/bits/struct_stat.h similarity index 72% rename from lib/libc/include/sparc-linux-gnu/bits/stat.h rename to lib/libc/include/sparc-linux-gnu/bits/struct_stat.h index cf6d4e2b07..5cf20aac06 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/stat.h +++ b/lib/libc/include/sparc-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -137,37 +128,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h b/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h index 9cb0c1f770..f12fccaa0b 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/sparc-linux-gnu/bits/termios-c_cc.h index ba7e520ead..c91028b519 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/sparc-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/sparc-linux-gnu/bits/termios-c_oflag.h index 05e6b54710..c20f5d876f 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-c_oflag.h +++ b/lib/libc/include/sparc-linux-gnu/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h b/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h index 2cb8e1c88f..3ba93c65ca 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h +++ b/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/timerfd.h b/lib/libc/include/sparc-linux-gnu/bits/timerfd.h index 411ed5208b..127510fa66 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/timerfd.h +++ b/lib/libc/include/sparc-linux-gnu/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h index 7f79bfadfa..50be147d4c 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/SPARC implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h index f0b03d63ad..0de6f97086 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* Sparc implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h index 3fc476b0d1..742891265a 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/SPARC implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/bits/typesizes.h b/lib/libc/include/sparc-linux-gnu/bits/typesizes.h index ebff4bdbcc..1035ac097b 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/sparc-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/fpu_control.h b/lib/libc/include/sparc-linux-gnu/fpu_control.h index 40690b5bf7..4dd8dc0c98 100644 --- a/lib/libc/include/sparc-linux-gnu/fpu_control.h +++ b/lib/libc/include/sparc-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. SPARC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza diff --git a/lib/libc/include/sparc-linux-gnu/ieee754.h b/lib/libc/include/sparc-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/sparc-linux-gnu/ieee754.h +++ b/lib/libc/include/sparc-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/sys/ptrace.h b/lib/libc/include/sparc-linux-gnu/sys/ptrace.h index 4f7fe458c2..9a7b58b46e 100644 --- a/lib/libc/include/sparc-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/sparc-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/sys/ucontext.h b/lib/libc/include/sparc-linux-gnu/sys/ucontext.h index 7d65864662..4c7f7a1493 100644 --- a/lib/libc/include/sparc-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/sparc-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparc-linux-gnu/sys/user.h b/lib/libc/include/sparc-linux-gnu/sys/user.h index 574a9a011c..7ea56205de 100644 --- a/lib/libc/include/sparc-linux-gnu/sys/user.h +++ b/lib/libc/include/sparc-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2020 Free Software Foundation, Inc. +/* Copyright (C) 2003-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/environments.h b/lib/libc/include/sparcv9-linux-gnu/bits/environments.h index 9134837e15..81b109e9c7 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/environments.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/epoll.h b/lib/libc/include/sparcv9-linux-gnu/bits/epoll.h index b06a614334..298f3e8170 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/epoll.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/errno.h b/lib/libc/include/sparcv9-linux-gnu/bits/errno.h index d190a76817..38a52e3599 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/errno.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/errno.h @@ -1,5 +1,5 @@ /* Error constants. Linux/Sparc specific version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/eventfd.h b/lib/libc/include/sparcv9-linux-gnu/bits/eventfd.h index a57ae6403d..71409f55ba 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/eventfd.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/fcntl.h b/lib/libc/include/sparcv9-linux-gnu/bits/fcntl.h index 48e3da3472..d5009f1233 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/SPARC. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/fenv.h b/lib/libc/include/sparcv9-linux-gnu/bits/fenv.h index 7eba346aa7..2de6eb4eb3 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/fenv.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/hwcap.h b/lib/libc/include/sparcv9-linux-gnu/bits/hwcap.h index 679ae54a2f..3f9c7c7f1d 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/inotify.h b/lib/libc/include/sparcv9-linux-gnu/bits/inotify.h index 8d1caf93a2..e489d7406c 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/inotify.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/ioctls.h b/lib/libc/include/sparcv9-linux-gnu/bits/ioctls.h index 46ae087fe6..9ed3b29627 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/ioctls.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/ioctls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/ipc-perm.h b/lib/libc/include/sparcv9-linux-gnu/bits/ipc-perm.h index 97839b1e72..d1761dca79 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/ipc-perm.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/ipc-perm.h @@ -1,5 +1,5 @@ /* struct ipc_perm definition. Linux/sparc version. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/link.h b/lib/libc/include/sparcv9-linux-gnu/bits/link.h index 9ba62345c0..e6e0d275c4 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/link.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific audit interfaces for dynamic linker. SPARC version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h b/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h index b2c73b5ae5..0a1bc361e6 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h @@ -1,5 +1,5 @@ /* Minimum guaranteed maximum values for system limits. Linux/SPARC version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/long-double.h b/lib/libc/include/sparcv9-linux-gnu/bits/long-double.h index de5e60beb8..c97d298d58 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/long-double.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. SPARC version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/mman.h b/lib/libc/include/sparcv9-linux-gnu/bits/mman.h index 8fec53b60f..f8a8c97804 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/mman.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SPARC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/poll.h b/lib/libc/include/sparcv9-linux-gnu/bits/poll.h index 892307ca0f..7883f85350 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/poll.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/poll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/procfs-extra.h b/lib/libc/include/sparcv9-linux-gnu/bits/procfs-extra.h index 3e7691d5c3..570c5de206 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/procfs-extra.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/procfs-extra.h @@ -1,5 +1,5 @@ /* Extra sys/procfs.h definitions. SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/procfs-id.h b/lib/libc/include/sparcv9-linux-gnu/bits/procfs-id.h index df3f655ac8..3bdb35d0f9 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/procfs-id.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. SPARC version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/procfs.h b/lib/libc/include/sparcv9-linux-gnu/bits/procfs.h index 7b3620640d..6217d6f2ff 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/procfs.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/resource.h b/lib/libc/include/sparcv9-linux-gnu/bits/resource.h index 3cfbfd381c..b13aaa86af 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/resource.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/SPARC version. - Copyright (C) 1994-2020 Free Software Foundation, Inc. + Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/setjmp.h b/lib/libc/include/sparcv9-linux-gnu/bits/setjmp.h index 1e1174bad1..e7c1964e13 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/shmlba.h b/lib/libc/include/sparcv9-linux-gnu/bits/shmlba.h index fc9e3e3669..0a04d45b51 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/shmlba.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/shmlba.h @@ -1,5 +1,5 @@ /* Define SHMLBA. SPARC version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/sigaction.h b/lib/libc/include/sparcv9-linux-gnu/bits/sigaction.h index 2a3f67242d..c81f76e78b 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/sigaction.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/sigaction.h @@ -1,5 +1,5 @@ /* The proper definitions for Linux/SPARC sigaction. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/sigcontext.h b/lib/libc/include/sparcv9-linux-gnu/bits/sigcontext.h index df187d5970..0176699a88 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/signalfd.h b/lib/libc/include/sparcv9-linux-gnu/bits/signalfd.h index 6cfcd8c574..c2c5bc4462 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/signalfd.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/signalfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2020 Free Software Foundation, Inc. +/* Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/signum-arch.h b/lib/libc/include/sparcv9-linux-gnu/bits/signum-arch.h index 36a52c8e5a..f7a416223c 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/signum-arch.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/signum-arch.h @@ -1,5 +1,5 @@ /* Signal number definitions. Linux/SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/sigstack.h b/lib/libc/include/sparcv9-linux-gnu/bits/sigstack.h index 7d28d61692..f2371950e2 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/sigstack.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/sigstack.h @@ -1,5 +1,5 @@ /* sigstack, sigaltstack definitions. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h b/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h index 94b8e65b3c..6d45cf834d 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h @@ -1,5 +1,5 @@ /* Socket constants which vary among Linux architectures. Version for SPARC. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/socket_type.h b/lib/libc/include/sparcv9-linux-gnu/bits/socket_type.h index d25882e2a0..16f1604498 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/socket_type.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/socket_type.h @@ -1,5 +1,5 @@ /* Define enum __socket_type for Linux/SPARC. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/sparcv9-linux-gnu/bits/struct_rwlock.h index 433d1f6f16..01b8d4b742 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* SPARC internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/stat.h b/lib/libc/include/sparcv9-linux-gnu/bits/struct_stat.h similarity index 72% rename from lib/libc/include/sparcv9-linux-gnu/bits/stat.h rename to lib/libc/include/sparcv9-linux-gnu/bits/struct_stat.h index cf6d4e2b07..5cf20aac06 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/stat.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,28 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 +#include +#include struct stat { @@ -137,37 +128,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/termios-baud.h b/lib/libc/include/sparcv9-linux-gnu/bits/termios-baud.h index 9cb0c1f770..f12fccaa0b 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/termios-baud.h @@ -1,5 +1,5 @@ /* termios baud rate selection definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_cc.h index ba7e520ead..c91028b519 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_cc.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_cc.h @@ -1,5 +1,5 @@ /* termios c_cc symbolic constant definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_oflag.h index 05e6b54710..c20f5d876f 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_oflag.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/termios-c_oflag.h @@ -1,5 +1,5 @@ /* termios output mode definitions. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/termios-struct.h b/lib/libc/include/sparcv9-linux-gnu/bits/termios-struct.h index 2cb8e1c88f..3ba93c65ca 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/termios-struct.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/termios-struct.h @@ -1,5 +1,5 @@ /* struct termios definition. Linux/sparc version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/timerfd.h b/lib/libc/include/sparcv9-linux-gnu/bits/timerfd.h index 411ed5208b..127510fa66 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/timerfd.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/timerfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2020 Free Software Foundation, Inc. +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h index 7f79bfadfa..50be147d4c 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h @@ -1,5 +1,5 @@ /* Linux/SPARC implementation of the SysV message struct msqid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h index f0b03d63ad..0de6f97086 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* Sparc implementation of the semaphore struct semid_ds - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h index 3fc476b0d1..742891265a 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h @@ -1,5 +1,5 @@ /* Linux/SPARC implementation of the shared memory struct shmid_ds. - Copyright (C) 2020 Free Software Foundation, Inc. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/typesizes.h b/lib/libc/include/sparcv9-linux-gnu/bits/typesizes.h index ebff4bdbcc..1035ac097b 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/fpu_control.h b/lib/libc/include/sparcv9-linux-gnu/fpu_control.h index 40690b5bf7..4dd8dc0c98 100644 --- a/lib/libc/include/sparcv9-linux-gnu/fpu_control.h +++ b/lib/libc/include/sparcv9-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. SPARC version. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza diff --git a/lib/libc/include/sparcv9-linux-gnu/ieee754.h b/lib/libc/include/sparcv9-linux-gnu/ieee754.h index 63fa9c5fce..e65600f742 100644 --- a/lib/libc/include/sparcv9-linux-gnu/ieee754.h +++ b/lib/libc/include/sparcv9-linux-gnu/ieee754.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/sys/ptrace.h b/lib/libc/include/sparcv9-linux-gnu/sys/ptrace.h index 4f7fe458c2..9a7b58b46e 100644 --- a/lib/libc/include/sparcv9-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/sparcv9-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/SPARC version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/sys/ucontext.h b/lib/libc/include/sparcv9-linux-gnu/sys/ucontext.h index 7d65864662..4c7f7a1493 100644 --- a/lib/libc/include/sparcv9-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/sparcv9-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/sparcv9-linux-gnu/sys/user.h b/lib/libc/include/sparcv9-linux-gnu/sys/user.h index 574a9a011c..7ea56205de 100644 --- a/lib/libc/include/sparcv9-linux-gnu/sys/user.h +++ b/lib/libc/include/sparcv9-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2020 Free Software Foundation, Inc. +/* Copyright (C) 2003-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/environments.h b/lib/libc/include/x86_64-linux-gnu/bits/environments.h index 2b18837e58..72a871ff4d 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/environments.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/epoll.h b/lib/libc/include/x86_64-linux-gnu/bits/epoll.h index 5f23749272..4bda3c54ef 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/epoll.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/fcntl.h b/lib/libc/include/x86_64-linux-gnu/bits/fcntl.h index 4eb8fa0b6f..de1b65f104 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/x86. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/fenv.h b/lib/libc/include/x86_64-linux-gnu/bits/fenv.h index b504e27b15..dd01ba9442 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/fenv.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/floatn.h b/lib/libc/include/x86_64-linux-gnu/bits/floatn.h index 36d64c23ec..5818af2001 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/floatn.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on x86. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/flt-eval-method.h b/lib/libc/include/x86_64-linux-gnu/bits/flt-eval-method.h index 9da0307897..c714d6ed23 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/flt-eval-method.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/flt-eval-method.h @@ -1,5 +1,5 @@ /* Define __GLIBC_FLT_EVAL_METHOD. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/fp-logb.h b/lib/libc/include/x86_64-linux-gnu/bits/fp-logb.h index 5f2e2a9f88..7c1bfa72bd 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/fp-logb.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/fp-logb.h @@ -1,5 +1,5 @@ /* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/indirect-return.h b/lib/libc/include/x86_64-linux-gnu/bits/indirect-return.h index e74139721c..4bf822a84c 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/indirect-return.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/indirect-return.h @@ -1,5 +1,5 @@ /* Definition of __INDIRECT_RETURN. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/ipctypes.h b/lib/libc/include/x86_64-linux-gnu/bits/ipctypes.h index 7f6bb7662d..9c301e1a3c 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/ipctypes.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/iscanonical.h b/lib/libc/include/x86_64-linux-gnu/bits/iscanonical.h index ee0d8720f9..8e6c0d05f5 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/iscanonical.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/link.h b/lib/libc/include/x86_64-linux-gnu/bits/link.h index 68938e8e0c..9774e993a3 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/link.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/long-double.h b/lib/libc/include/x86_64-linux-gnu/bits/long-double.h index 75bc1fcce4..ef3832bc80 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/long-double.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/math-vector.h b/lib/libc/include/x86_64-linux-gnu/bits/math-vector.h index f7571e827d..6e94f42ca8 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/math-vector.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/math-vector.h @@ -1,5 +1,5 @@ /* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/mman.h b/lib/libc/include/x86_64-linux-gnu/bits/mman.h index 4319c54436..8c96873c86 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/mman.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/procfs-id.h b/lib/libc/include/x86_64-linux-gnu/bits/procfs-id.h index 4f4cefeb4b..bada981489 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/procfs-id.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnu/bits/procfs.h b/lib/libc/include/x86_64-linux-gnu/bits/procfs.h index 1f4ca5a0f0..b670484f2a 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/procfs.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. x86 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h index 147ce690db..89b363fb2c 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/setjmp.h b/lib/libc/include/x86_64-linux-gnu/bits/setjmp.h index 18d620397d..9e96a2ff98 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/setjmp.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/sigcontext.h b/lib/libc/include/x86_64-linux-gnu/bits/sigcontext.h index 7498f87f91..4f03980c98 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/sigcontext.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/struct_mutex.h b/lib/libc/include/x86_64-linux-gnu/bits/struct_mutex.h index 44273158be..89c18f35e0 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/struct_mutex.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* x86 internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/x86_64-linux-gnu/bits/struct_rwlock.h index 863b185dc9..022106d66c 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* x86 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnu/bits/stat.h b/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h similarity index 73% rename from lib/libc/include/x86_64-linux-gnu/bits/stat.h rename to lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h index ab5378300a..4a34470345 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/stat.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,36 +13,15 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#ifndef __x86_64__ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 - -/* i386 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -#else -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 - -/* x86-64 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 0 -#endif - -#define _STAT_VER _STAT_VER_LINUX +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -174,37 +154,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-linux-gnu/bits/timesize.h b/lib/libc/include/x86_64-linux-gnu/bits/timesize.h index ae0a502d0d..a1ca40d632 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/timesize.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/timesize.h @@ -1,5 +1,5 @@ /* Bit size of the time_t type at glibc build time, x86-64 and x32 case. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h index ea9721c6bd..76ea9f63dc 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* x86 implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/bits/typesizes.h b/lib/libc/include/x86_64-linux-gnu/bits/typesizes.h index 53ae0bd5ef..654f1c7b87 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/typesizes.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/finclude/math-vector-fortran.h b/lib/libc/include/x86_64-linux-gnu/finclude/math-vector-fortran.h index c56f5fc16f..5fdbe52a3c 100644 --- a/lib/libc/include/x86_64-linux-gnu/finclude/math-vector-fortran.h +++ b/lib/libc/include/x86_64-linux-gnu/finclude/math-vector-fortran.h @@ -1,5 +1,5 @@ ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- -! Copyright (C) 2019-2020 Free Software Foundation, Inc. +! Copyright (C) 2019-2021 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/fpu_control.h b/lib/libc/include/x86_64-linux-gnu/fpu_control.h index fa0a861923..533e2da0d0 100644 --- a/lib/libc/include/x86_64-linux-gnu/fpu_control.h +++ b/lib/libc/include/x86_64-linux-gnu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. x86 version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. diff --git a/lib/libc/include/x86_64-linux-gnu/sys/elf.h b/lib/libc/include/x86_64-linux-gnu/sys/elf.h index d37502689d..3731950870 100644 --- a/lib/libc/include/x86_64-linux-gnu/sys/elf.h +++ b/lib/libc/include/x86_64-linux-gnu/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/sys/ptrace.h b/lib/libc/include/x86_64-linux-gnu/sys/ptrace.h index 0977a402d7..461e83ae9c 100644 --- a/lib/libc/include/x86_64-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/x86_64-linux-gnu/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/x86 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnu/sys/ucontext.h b/lib/libc/include/x86_64-linux-gnu/sys/ucontext.h index 3244eab7c8..f961c6aef8 100644 --- a/lib/libc/include/x86_64-linux-gnu/sys/ucontext.h +++ b/lib/libc/include/x86_64-linux-gnu/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnu/sys/user.h b/lib/libc/include/x86_64-linux-gnu/sys/user.h index fe9d875789..0f64e565eb 100644 --- a/lib/libc/include/x86_64-linux-gnu/sys/user.h +++ b/lib/libc/include/x86_64-linux-gnu/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/environments.h b/lib/libc/include/x86_64-linux-gnux32/bits/environments.h index 2b18837e58..72a871ff4d 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/environments.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/environments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/epoll.h b/lib/libc/include/x86_64-linux-gnux32/bits/epoll.h index 5f23749272..4bda3c54ef 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/epoll.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/fcntl.h b/lib/libc/include/x86_64-linux-gnux32/bits/fcntl.h index 4eb8fa0b6f..de1b65f104 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/fcntl.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/x86. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/fenv.h b/lib/libc/include/x86_64-linux-gnux32/bits/fenv.h index b504e27b15..dd01ba9442 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/fenv.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/floatn.h b/lib/libc/include/x86_64-linux-gnux32/bits/floatn.h index 36d64c23ec..5818af2001 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/floatn.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/floatn.h @@ -1,5 +1,5 @@ /* Macros to control TS 18661-3 glibc features on x86. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/flt-eval-method.h b/lib/libc/include/x86_64-linux-gnux32/bits/flt-eval-method.h index 9da0307897..c714d6ed23 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/flt-eval-method.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/flt-eval-method.h @@ -1,5 +1,5 @@ /* Define __GLIBC_FLT_EVAL_METHOD. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/fp-logb.h b/lib/libc/include/x86_64-linux-gnux32/bits/fp-logb.h index 5f2e2a9f88..7c1bfa72bd 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/fp-logb.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/fp-logb.h @@ -1,5 +1,5 @@ /* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/indirect-return.h b/lib/libc/include/x86_64-linux-gnux32/bits/indirect-return.h index e74139721c..4bf822a84c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/indirect-return.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/indirect-return.h @@ -1,5 +1,5 @@ /* Definition of __INDIRECT_RETURN. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/ipctypes.h b/lib/libc/include/x86_64-linux-gnux32/bits/ipctypes.h index 7f6bb7662d..9c301e1a3c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/ipctypes.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/ipctypes.h @@ -1,5 +1,5 @@ /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/iscanonical.h b/lib/libc/include/x86_64-linux-gnux32/bits/iscanonical.h index ee0d8720f9..8e6c0d05f5 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/iscanonical.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/iscanonical.h @@ -1,5 +1,5 @@ /* Define iscanonical macro. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/link.h b/lib/libc/include/x86_64-linux-gnux32/bits/link.h index 68938e8e0c..9774e993a3 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/link.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/link.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/long-double.h b/lib/libc/include/x86_64-linux-gnux32/bits/long-double.h index 75bc1fcce4..ef3832bc80 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/long-double.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. ldbl-96 version. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/math-vector.h b/lib/libc/include/x86_64-linux-gnux32/bits/math-vector.h index f7571e827d..6e94f42ca8 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/math-vector.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/math-vector.h @@ -1,5 +1,5 @@ /* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/mman.h b/lib/libc/include/x86_64-linux-gnux32/bits/mman.h index 4319c54436..8c96873c86 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/mman.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/procfs-id.h b/lib/libc/include/x86_64-linux-gnux32/bits/procfs-id.h index 4f4cefeb4b..bada981489 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/procfs-id.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/procfs-id.h @@ -1,5 +1,5 @@ /* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/procfs.h b/lib/libc/include/x86_64-linux-gnux32/bits/procfs.h index 1f4ca5a0f0..b670484f2a 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/procfs.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/procfs.h @@ -1,5 +1,5 @@ /* Types for registers for sys/procfs.h. x86 version. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/pthreadtypes-arch.h b/lib/libc/include/x86_64-linux-gnux32/bits/pthreadtypes-arch.h index 147ce690db..89b363fb2c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/pthreadtypes-arch.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/setjmp.h b/lib/libc/include/x86_64-linux-gnux32/bits/setjmp.h index 18d620397d..9e96a2ff98 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/setjmp.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/sigcontext.h b/lib/libc/include/x86_64-linux-gnux32/bits/sigcontext.h index 7498f87f91..4f03980c98 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/sigcontext.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/sigcontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/struct_mutex.h b/lib/libc/include/x86_64-linux-gnux32/bits/struct_mutex.h index 44273158be..89c18f35e0 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/struct_mutex.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/struct_mutex.h @@ -1,5 +1,5 @@ /* x86 internal mutex struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/struct_rwlock.h b/lib/libc/include/x86_64-linux-gnux32/bits/struct_rwlock.h index 863b185dc9..022106d66c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/struct_rwlock.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/struct_rwlock.h @@ -1,5 +1,5 @@ /* x86 internal rwlock struct definitions. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/stat.h b/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h similarity index 73% rename from lib/libc/include/x86_64-linux-gnux32/bits/stat.h rename to lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h index ab5378300a..4a34470345 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/stat.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,36 +13,15 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#ifndef __x86_64__ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 - -/* i386 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -#else -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 - -/* x86-64 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 0 -#endif - -#define _STAT_VER _STAT_VER_LINUX +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -174,37 +154,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ \ No newline at end of file +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/timesize.h b/lib/libc/include/x86_64-linux-gnux32/bits/timesize.h index ae0a502d0d..a1ca40d632 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/timesize.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/timesize.h @@ -1,5 +1,5 @@ /* Bit size of the time_t type at glibc build time, x86-64 and x32 case. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h b/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h index ea9721c6bd..76ea9f63dc 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h @@ -1,5 +1,5 @@ /* x86 implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/typesizes.h b/lib/libc/include/x86_64-linux-gnux32/bits/typesizes.h index 53ae0bd5ef..654f1c7b87 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/typesizes.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/finclude/math-vector-fortran.h b/lib/libc/include/x86_64-linux-gnux32/finclude/math-vector-fortran.h index c56f5fc16f..5fdbe52a3c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/finclude/math-vector-fortran.h +++ b/lib/libc/include/x86_64-linux-gnux32/finclude/math-vector-fortran.h @@ -1,5 +1,5 @@ ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- -! Copyright (C) 2019-2020 Free Software Foundation, Inc. +! Copyright (C) 2019-2021 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/fpu_control.h b/lib/libc/include/x86_64-linux-gnux32/fpu_control.h index fa0a861923..533e2da0d0 100644 --- a/lib/libc/include/x86_64-linux-gnux32/fpu_control.h +++ b/lib/libc/include/x86_64-linux-gnux32/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word bits. x86 version. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. diff --git a/lib/libc/include/x86_64-linux-gnux32/sys/elf.h b/lib/libc/include/x86_64-linux-gnux32/sys/elf.h index d37502689d..3731950870 100644 --- a/lib/libc/include/x86_64-linux-gnux32/sys/elf.h +++ b/lib/libc/include/x86_64-linux-gnux32/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/sys/ptrace.h b/lib/libc/include/x86_64-linux-gnux32/sys/ptrace.h index 0977a402d7..461e83ae9c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/sys/ptrace.h +++ b/lib/libc/include/x86_64-linux-gnux32/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/x86 version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/include/x86_64-linux-gnux32/sys/ucontext.h b/lib/libc/include/x86_64-linux-gnux32/sys/ucontext.h index 3244eab7c8..f961c6aef8 100644 --- a/lib/libc/include/x86_64-linux-gnux32/sys/ucontext.h +++ b/lib/libc/include/x86_64-linux-gnux32/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/include/x86_64-linux-gnux32/sys/user.h b/lib/libc/include/x86_64-linux-gnux32/sys/user.h index fe9d875789..0f64e565eb 100644 --- a/lib/libc/include/x86_64-linux-gnux32/sys/user.h +++ b/lib/libc/include/x86_64-linux-gnux32/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or From 0fee4b55a8c58791238efe6bf2da5ce3435a5cc1 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 4 Apr 2021 11:57:41 -0700 Subject: [PATCH 011/101] glibc: update ABI files to 2.33 --- lib/libc/glibc/abi.txt | 180 ++++++++++++++++++++++++++++++++++++++++ lib/libc/glibc/fns.txt | 12 +++ lib/libc/glibc/vers.txt | 1 + 3 files changed, 193 insertions(+) diff --git a/lib/libc/glibc/abi.txt b/lib/libc/glibc/abi.txt index 13053a9417..d0580cbfde 100644 --- a/lib/libc/glibc/abi.txt +++ b/lib/libc/glibc/abi.txt @@ -1195,6 +1195,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu 29 29 + 29 29 29 @@ -2097,6 +2098,10 @@ aarch64-linux-gnu aarch64_be-linux-gnu 29 29 29 +43 +43 +43 +43 29 29 29 @@ -2656,10 +2661,13 @@ aarch64-linux-gnu aarch64_be-linux-gnu 29 29 29 +43 +43 29 29 29 29 +43 29 29 29 @@ -2702,6 +2710,8 @@ aarch64-linux-gnu aarch64_be-linux-gnu 29 29 29 +43 +43 29 29 29 @@ -3440,6 +3450,8 @@ aarch64-linux-gnu aarch64_be-linux-gnu 29 29 29 +43 +43 29 29 29 @@ -5154,6 +5166,7 @@ s390x-linux-gnu 5 5 + 5 16 5 @@ -6056,6 +6069,10 @@ s390x-linux-gnu 5 5 12 +43 +43 +43 +43 5 5 5 @@ -6615,10 +6632,13 @@ s390x-linux-gnu 5 5 12 +43 +43 12 5 5 5 +43 5 5 22 @@ -6661,6 +6681,8 @@ s390x-linux-gnu 5 5 16 +43 +43 19 19 23 @@ -7399,6 +7421,8 @@ s390x-linux-gnu 5 16 5 5 +43 +43 5 5 5 @@ -9113,6 +9137,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf 16 16 + 16 16 16 @@ -10015,6 +10040,10 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf 16 16 16 +43 +43 +43 +43 16 16 16 @@ -10574,10 +10603,13 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf 16 16 16 +43 +43 16 16 16 16 +43 16 16 22 @@ -10620,6 +10652,8 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf 16 16 16 +43 +43 19 19 23 @@ -11358,6 +11392,8 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf 16 16 16 +43 +43 16 16 16 @@ -13072,6 +13108,7 @@ sparc-linux-gnu sparcel-linux-gnu 5 5 + 0 16 0 @@ -13974,6 +14011,10 @@ sparc-linux-gnu sparcel-linux-gnu 0 5 1 5 12 +43 +43 +43 +43 0 1 1 @@ -14533,10 +14574,13 @@ sparc-linux-gnu sparcel-linux-gnu 0 1 5 12 +43 +43 12 0 1 0 +43 0 0 22 @@ -14579,6 +14623,8 @@ sparc-linux-gnu sparcel-linux-gnu 5 0 16 +43 +43 19 19 23 @@ -15317,6 +15363,8 @@ sparc-linux-gnu sparcel-linux-gnu 0 16 0 0 +43 +43 0 1 1 @@ -17031,6 +17079,7 @@ sparcv9-linux-gnu 5 5 + 5 16 5 @@ -17933,6 +17982,10 @@ sparcv9-linux-gnu 5 5 12 +43 +43 +43 +43 5 5 5 @@ -18492,10 +18545,13 @@ sparcv9-linux-gnu 5 5 12 +43 +43 12 5 5 5 +43 5 5 22 @@ -18538,6 +18594,8 @@ sparcv9-linux-gnu 5 5 16 +43 +43 19 19 23 @@ -19276,6 +19334,8 @@ sparcv9-linux-gnu 5 5 5 +43 +43 5 5 5 @@ -20990,6 +21050,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 5 5 + 0 16 0 @@ -21892,6 +21953,10 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 0 5 5 12 +43 +43 +43 +43 0 5 5 @@ -22451,10 +22516,13 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 0 5 12 +43 +43 12 0 5 0 +43 0 0 22 @@ -22497,6 +22565,8 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 5 0 16 +43 +43 19 19 23 @@ -23235,6 +23305,8 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 0 0 0 +43 +43 0 5 5 @@ -24949,6 +25021,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 5 5 + 0 16 0 @@ -25851,6 +25924,10 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 0 5 5 12 +43 +43 +43 +43 0 5 5 @@ -26410,10 +26487,13 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 0 5 12 +43 +43 12 0 5 0 +43 0 0 22 @@ -26456,6 +26536,8 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 5 0 16 +43 +43 19 19 23 @@ -27194,6 +27276,8 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 0 0 0 +43 +43 0 5 5 @@ -28908,6 +28992,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf 5 5 + 0 16 0 @@ -29810,6 +29895,10 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf 0 5 5 12 +43 +43 +43 +43 0 5 5 @@ -30369,10 +30458,13 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf 0 5 12 +43 +43 12 0 5 0 +43 0 0 22 @@ -30415,6 +30507,8 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf 5 0 16 +43 +43 19 19 23 @@ -31153,6 +31247,8 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf 0 0 0 +43 +43 0 5 5 @@ -32867,6 +32963,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi 5 5 + 0 16 0 @@ -33769,6 +33866,10 @@ mipsel-linux-gnueabi mips-linux-gnueabi 0 5 5 12 +43 +43 +43 +43 0 5 5 @@ -34328,10 +34429,13 @@ mipsel-linux-gnueabi mips-linux-gnueabi 0 5 12 +43 +43 12 0 5 0 +43 0 0 22 @@ -34374,6 +34478,8 @@ mipsel-linux-gnueabi mips-linux-gnueabi 5 0 16 +43 +43 19 19 23 @@ -35112,6 +35218,8 @@ mipsel-linux-gnueabi mips-linux-gnueabi 0 0 0 +43 +43 0 5 5 @@ -36826,6 +36934,7 @@ x86_64-linux-gnu 10 10 +43 10 16 10 @@ -37728,6 +37837,10 @@ x86_64-linux-gnu 10 10 12 +43 +43 +43 +43 10 10 10 @@ -38287,10 +38400,13 @@ x86_64-linux-gnu 10 10 12 +43 +43 12 10 10 10 +43 10 10 22 @@ -38333,6 +38449,8 @@ x86_64-linux-gnu 10 10 16 +43 +43 19 19 23 @@ -39071,6 +39189,8 @@ x86_64-linux-gnu 10 10 10 +43 +43 10 10 10 @@ -40785,6 +40905,7 @@ x86_64-linux-gnux32 28 28 +43 28 28 28 @@ -41687,6 +41808,10 @@ x86_64-linux-gnux32 28 28 28 +43 +43 +43 +43 28 28 28 @@ -42246,10 +42371,13 @@ x86_64-linux-gnux32 28 28 28 +43 +43 28 28 28 28 +43 28 28 28 @@ -42292,6 +42420,8 @@ x86_64-linux-gnux32 28 28 28 +43 +43 28 28 28 @@ -43030,6 +43160,8 @@ x86_64-linux-gnux32 28 28 28 +43 +43 28 28 28 @@ -44744,6 +44876,7 @@ i386-linux-gnu 5 5 +43 0 16 0 @@ -45646,6 +45779,10 @@ i386-linux-gnu 0 5 1 5 12 +43 +43 +43 +43 0 1 1 @@ -46205,10 +46342,13 @@ i386-linux-gnu 0 1 5 12 +43 +43 12 0 1 0 +43 0 0 22 @@ -46251,6 +46391,8 @@ i386-linux-gnu 5 0 16 +43 +43 19 19 23 @@ -46989,6 +47131,8 @@ i386-linux-gnu 0 0 0 +43 +43 0 1 1 @@ -48703,6 +48847,7 @@ powerpc64le-linux-gnu 42 29 29 + 29 29 29 @@ -49605,6 +49750,10 @@ powerpc64le-linux-gnu 29 29 29 +43 +43 +43 +43 29 29 29 @@ -50164,10 +50313,13 @@ powerpc64le-linux-gnu 29 29 29 +43 +43 29 29 29 29 +43 29 29 29 @@ -50210,6 +50362,8 @@ powerpc64le-linux-gnu 29 29 29 +43 +43 29 29 29 @@ -50948,6 +51102,8 @@ powerpc64le-linux-gnu 29 29 29 +43 +43 29 29 29 @@ -52662,6 +52818,7 @@ powerpc64-linux-gnu 12 12 + 12 16 12 @@ -53564,6 +53721,10 @@ powerpc64-linux-gnu 12 12 12 +43 +43 +43 +43 12 12 12 @@ -54123,10 +54284,13 @@ powerpc64-linux-gnu 12 12 12 +43 +43 12 12 12 12 +43 12 12 22 @@ -54169,6 +54333,8 @@ powerpc64-linux-gnu 12 12 16 +43 +43 19 19 23 @@ -54907,6 +55073,8 @@ powerpc64-linux-gnu 12 16 12 12 +43 +43 12 12 12 @@ -56621,6 +56789,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf 5 5 + 0 16 0 @@ -57523,6 +57692,10 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf 0 5 1 5 12 +43 +43 +43 +43 0 1 1 @@ -58082,10 +58255,13 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf 0 1 5 12 +43 +43 12 0 1 14 15 0 +43 0 0 22 @@ -58128,6 +58304,8 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf 5 0 16 +43 +43 19 19 23 @@ -58866,6 +59044,8 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf 0 16 0 0 +43 +43 0 1 1 diff --git a/lib/libc/glibc/fns.txt b/lib/libc/glibc/fns.txt index 5d274d178e..b0ff26b1cd 100644 --- a/lib/libc/glibc/fns.txt +++ b/lib/libc/glibc/fns.txt @@ -1194,6 +1194,7 @@ __write c __wscanfieee128 c __wuflow c __wunderflow c +__x86_get_cpuid_feature_leaf c __xmknod c __xmknodat c __xpg_basename c @@ -2096,6 +2097,10 @@ fseeko64 c fsetpos c fsetpos64 c fsetxattr c +fstat c +fstat64 c +fstatat c +fstatat64 c fstatfs c fstatfs64 c fstatvfs c @@ -2655,10 +2660,13 @@ lsearch c lseek c lseek64 c lsetxattr c +lstat c +lstat64 c lutimes c madvise c makecontext c mallinfo c +mallinfo2 c malloc c malloc_get_state c malloc_info c @@ -2701,6 +2709,8 @@ mkdirat c mkdtemp c mkfifo c mkfifoat c +mknod c +mknodat c mkostemp c mkostemp64 c mkostemps c @@ -3439,6 +3449,8 @@ srandom_r c sscanf c ssignal c sstk c +stat c +stat64 c statfs c statfs64 c statvfs c diff --git a/lib/libc/glibc/vers.txt b/lib/libc/glibc/vers.txt index 185bd5195f..d0ed8d67d4 100644 --- a/lib/libc/glibc/vers.txt +++ b/lib/libc/glibc/vers.txt @@ -41,3 +41,4 @@ GLIBC_2.29 GLIBC_2.30 GLIBC_2.31 GLIBC_2.32 +GLIBC_2.33 From 545830c0fff449f219557b45911195b4a4026692 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 4 Apr 2021 16:10:54 -0700 Subject: [PATCH 012/101] LLVM sub-arch triple: remove TODO comment See #6542 for more details. Upon investigation, this change is not needed. --- src/codegen/llvm.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index cd601debda..af6c890861 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -74,7 +74,6 @@ pub fn targetTriple(allocator: *Allocator, target: std.Target) ![:0]u8 { .spirv32 => return error.LLVMBackendDoesNotSupportSPIRV, .spirv64 => return error.LLVMBackendDoesNotSupportSPIRV, }; - // TODO Add a sub-arch for some architectures depending on CPU features. const llvm_os = switch (target.os.tag) { .freestanding => "unknown", From c9ffb6f734567ecb2a368d0d8786e9d1365f42b8 Mon Sep 17 00:00:00 2001 From: Hannu Hartikainen Date: Fri, 2 Apr 2021 23:59:04 +0300 Subject: [PATCH 013/101] std docs: enhance search browser history UX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this change every keypress in the search field causes a browser history entry, which makes navigating back annoying. On first keypress in the search field, a new history entry is created. On subsequent keypresses, the most recent history entry is replaced. Therefore a typical history after searching and navigating to an entry might look like 1. documentation root 2. search page "print" 3. docs for `std.debug.print` Co-authored-by: Žiga Željko --- lib/std/special/docs/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js index b95a93d5dd..7305add9e3 100644 --- a/lib/std/special/docs/main.js +++ b/lib/std/special/docs/main.js @@ -1844,7 +1844,13 @@ var oldHash = location.hash; var parts = oldHash.split("?"); var newPart2 = (domSearch.value === "") ? "" : ("?" + domSearch.value); - location.hash = (parts.length === 1) ? (oldHash + newPart2) : (parts[0] + newPart2); + var newHash = (oldHash === "" ? "#" : parts[0]) + newPart2; + // create a history entry only once per search + if (parts.length === 1) { + location.assign(newHash); + } else { + location.replace(newHash); + } } function getSearchTerms() { var list = curNavSearch.trim().split(/[ \r\n\t]+/); From 7302b096bd6e4274080eab051f6f3e1ab49213b9 Mon Sep 17 00:00:00 2001 From: Lewis Gaul Date: Mon, 5 Apr 2021 00:27:47 +0100 Subject: [PATCH 014/101] Tidy-up in json test module (#8431) * Switch json testing 'roundTrip()' to use FixedBufferStream, improve error handling, remove comptime from param * Add 'try' to calls to roundTrip() that can now return an error * Remove comptime from params in json testing, replace expect(false) with letting error propagate * Add 'try' to calls to ok() that can now return an error Co-authored-by: Lewis Gaul --- lib/std/json/test.zig | 156 +++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/lib/std/json/test.zig b/lib/std/json/test.zig index 3945c3a8db..b6ff03350c 100644 --- a/lib/std/json/test.zig +++ b/lib/std/json/test.zig @@ -12,7 +12,7 @@ const std = @import("../std.zig"); const json = std.json; const testing = std.testing; -fn testNonStreaming(comptime s: []const u8) !void { +fn testNonStreaming(s: []const u8) !void { var p = json.Parser.init(testing.allocator, false); defer p.deinit(); @@ -20,32 +20,32 @@ fn testNonStreaming(comptime s: []const u8) !void { defer tree.deinit(); } -fn ok(comptime s: []const u8) void { +fn ok(s: []const u8) !void { testing.expect(json.validate(s)); - testNonStreaming(s) catch testing.expect(false); + try testNonStreaming(s); } -fn err(comptime s: []const u8) void { +fn err(s: []const u8) void { testing.expect(!json.validate(s)); testNonStreaming(s) catch return; testing.expect(false); } -fn utf8Error(comptime s: []const u8) void { +fn utf8Error(s: []const u8) void { testing.expect(!json.validate(s)); testing.expectError(error.InvalidUtf8Byte, testNonStreaming(s)); } -fn any(comptime s: []const u8) void { +fn any(s: []const u8) void { _ = json.validate(s); testNonStreaming(s) catch {}; } -fn anyStreamingErrNonStreaming(comptime s: []const u8) void { +fn anyStreamingErrNonStreaming(s: []const u8) void { _ = json.validate(s); testNonStreaming(s) catch return; @@ -81,7 +81,7 @@ test "y_trailing_comma_after_empty" { //////////////////////////////////////////////////////////////////////////////////////////////////// test "y_array_arraysWithSpaces" { - ok( + try ok( \\[[] ] ); } @@ -111,7 +111,7 @@ test "y_array_false" { } test "y_array_heterogeneous" { - ok( + try ok( \\[null, 1, "1", {}] ); } @@ -123,14 +123,14 @@ test "y_array_null" { } test "y_array_with_1_and_newline" { - ok( + try ok( \\[1 \\] ); } test "y_array_with_leading_space" { - ok( + try ok( \\ [1] ); } @@ -142,47 +142,47 @@ test "y_array_with_several_null" { } test "y_array_with_trailing_space" { - ok("[2] "); + try ok("[2] "); } test "y_number_0e+1" { - ok( + try ok( \\[0e+1] ); } test "y_number_0e1" { - ok( + try ok( \\[0e1] ); } test "y_number_after_space" { - ok( + try ok( \\[ 4] ); } test "y_number_double_close_to_zero" { - ok( + try ok( \\[-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] ); } test "y_number_int_with_exp" { - ok( + try ok( \\[20e1] ); } test "y_number" { - ok( + try ok( \\[123e65] ); } test "y_number_minus_zero" { - ok( + try ok( \\[-0] ); } @@ -200,49 +200,49 @@ test "y_number_negative_one" { } test "y_number_negative_zero" { - ok( + try ok( \\[-0] ); } test "y_number_real_capital_e" { - ok( + try ok( \\[1E22] ); } test "y_number_real_capital_e_neg_exp" { - ok( + try ok( \\[1E-2] ); } test "y_number_real_capital_e_pos_exp" { - ok( + try ok( \\[1E+2] ); } test "y_number_real_exponent" { - ok( + try ok( \\[123e45] ); } test "y_number_real_fraction_exponent" { - ok( + try ok( \\[123.456e78] ); } test "y_number_real_neg_exp" { - ok( + try ok( \\[1e-2] ); } test "y_number_real_pos_exponent" { - ok( + try ok( \\[1e+2] ); } @@ -254,7 +254,7 @@ test "y_number_simple_int" { } test "y_number_simple_real" { - ok( + try ok( \\[123.456789] ); } @@ -266,13 +266,13 @@ test "y_object_basic" { } test "y_object_duplicated_key_and_value" { - ok( + try ok( \\{"a":"b","a":"b"} ); } test "y_object_duplicated_key" { - ok( + try ok( \\{"a":"b","a":"c"} ); } @@ -290,25 +290,25 @@ test "y_object_empty_key" { } test "y_object_escaped_null_in_key" { - ok( + try ok( \\{"foo\u0000bar": 42} ); } test "y_object_extreme_numbers" { - ok( + try ok( \\{ "min": -1.0e+28, "max": 1.0e+28 } ); } test "y_object" { - ok( + try ok( \\{"asd":"sdf", "dfg":"fgh"} ); } test "y_object_long_strings" { - ok( + try ok( \\{"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} ); } @@ -320,13 +320,13 @@ test "y_object_simple" { } test "y_object_string_unicode" { - ok( + try ok( \\{"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" } ); } test "y_object_with_newlines" { - ok( + try ok( \\{ \\"a": "b" \\} @@ -334,31 +334,31 @@ test "y_object_with_newlines" { } test "y_string_1_2_3_bytes_UTF-8_sequences" { - ok( + try ok( \\["\u0060\u012a\u12AB"] ); } test "y_string_accepted_surrogate_pair" { - ok( + try ok( \\["\uD801\udc37"] ); } test "y_string_accepted_surrogate_pairs" { - ok( + try ok( \\["\ud83d\ude39\ud83d\udc8d"] ); } test "y_string_allowed_escapes" { - ok( + try ok( \\["\"\\\/\b\f\n\r\t"] ); } test "y_string_backslash_and_u_escaped_zero" { - ok( + try ok( \\["\\u0000"] ); } @@ -370,13 +370,13 @@ test "y_string_backslash_doublequotes" { } test "y_string_comments" { - ok( + try ok( \\["a/*b*/c/*d//e"] ); } test "y_string_double_escape_a" { - ok( + try ok( \\["\\a"] ); } @@ -388,79 +388,79 @@ test "y_string_double_escape_n" { } test "y_string_escaped_control_character" { - ok( + try ok( \\["\u0012"] ); } test "y_string_escaped_noncharacter" { - ok( + try ok( \\["\uFFFF"] ); } test "y_string_in_array" { - ok( + try ok( \\["asd"] ); } test "y_string_in_array_with_leading_space" { - ok( + try ok( \\[ "asd"] ); } test "y_string_last_surrogates_1_and_2" { - ok( + try ok( \\["\uDBFF\uDFFF"] ); } test "y_string_nbsp_uescaped" { - ok( + try ok( \\["new\u00A0line"] ); } test "y_string_nonCharacterInUTF-8_U+10FFFF" { - ok( + try ok( \\["􏿿"] ); } test "y_string_nonCharacterInUTF-8_U+FFFF" { - ok( + try ok( \\["￿"] ); } test "y_string_null_escape" { - ok( + try ok( \\["\u0000"] ); } test "y_string_one-byte-utf-8" { - ok( + try ok( \\["\u002c"] ); } test "y_string_pi" { - ok( + try ok( \\["π"] ); } test "y_string_reservedCharacterInUTF-8_U+1BFFF" { - ok( + try ok( \\["𛿿"] ); } test "y_string_simple_ascii" { - ok( + try ok( \\["asd "] ); } @@ -472,115 +472,115 @@ test "y_string_space" { } test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" { - ok( + try ok( \\["\uD834\uDd1e"] ); } test "y_string_three-byte-utf-8" { - ok( + try ok( \\["\u0821"] ); } test "y_string_two-byte-utf-8" { - ok( + try ok( \\["\u0123"] ); } test "y_string_u+2028_line_sep" { - ok("[\"\xe2\x80\xa8\"]"); + try ok("[\"\xe2\x80\xa8\"]"); } test "y_string_u+2029_par_sep" { - ok("[\"\xe2\x80\xa9\"]"); + try ok("[\"\xe2\x80\xa9\"]"); } test "y_string_uescaped_newline" { - ok( + try ok( \\["new\u000Aline"] ); } test "y_string_uEscape" { - ok( + try ok( \\["\u0061\u30af\u30EA\u30b9"] ); } test "y_string_unescaped_char_delete" { - ok("[\"\x7f\"]"); + try ok("[\"\x7f\"]"); } test "y_string_unicode_2" { - ok( + try ok( \\["⍂㈴⍂"] ); } test "y_string_unicodeEscapedBackslash" { - ok( + try ok( \\["\u005C"] ); } test "y_string_unicode_escaped_double_quote" { - ok( + try ok( \\["\u0022"] ); } test "y_string_unicode" { - ok( + try ok( \\["\uA66D"] ); } test "y_string_unicode_U+10FFFE_nonchar" { - ok( + try ok( \\["\uDBFF\uDFFE"] ); } test "y_string_unicode_U+1FFFE_nonchar" { - ok( + try ok( \\["\uD83F\uDFFE"] ); } test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" { - ok( + try ok( \\["\u200B"] ); } test "y_string_unicode_U+2064_invisible_plus" { - ok( + try ok( \\["\u2064"] ); } test "y_string_unicode_U+FDD0_nonchar" { - ok( + try ok( \\["\uFDD0"] ); } test "y_string_unicode_U+FFFE_nonchar" { - ok( + try ok( \\["\uFFFE"] ); } test "y_string_utf8" { - ok( + try ok( \\["€𝄞"] ); } test "y_string_with_del_character" { - ok("[\"a\x7fa\"]"); + try ok("[\"a\x7fa\"]"); } test "y_structure_lonely_false" { @@ -596,7 +596,7 @@ test "y_structure_lonely_int" { } test "y_structure_lonely_negative_real" { - ok( + try ok( \\-0.1 ); } @@ -638,7 +638,7 @@ test "y_structure_true_in_array" { } test "y_structure_whitespace_array" { - ok(" [] "); + try ok(" [] "); } //////////////////////////////////////////////////////////////////////////////////////////////////// From 83a2665772578f6262afc858613023738a7d25ef Mon Sep 17 00:00:00 2001 From: Edward Dean Date: Sun, 4 Apr 2021 10:34:34 +0100 Subject: [PATCH 015/101] Fixed error types for GetSeekPosError --- lib/std/fs/file.zig | 8 ++++---- lib/std/io/stream_source.zig | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index baea3b4e7f..3a8fd9e9a3 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -223,15 +223,15 @@ pub const File = struct { return os.lseek_SET(self.handle, offset); } - pub const GetPosError = os.SeekError || os.FStatError; + pub const GetSeekPosError = os.SeekError || os.FStatError; /// TODO: integrate with async I/O - pub fn getPos(self: File) GetPosError!u64 { + pub fn getPos(self: File) GetSeekPosError!u64 { return os.lseek_CUR_get(self.handle); } /// TODO: integrate with async I/O - pub fn getEndPos(self: File) GetPosError!u64 { + pub fn getEndPos(self: File) GetSeekPosError!u64 { if (builtin.os.tag == .windows) { return windows.GetFileSizeEx(self.handle); } @@ -819,7 +819,7 @@ pub const File = struct { pub const SeekableStream = io.SeekableStream( File, SeekError, - GetPosError, + GetSeekPosError, seekTo, seekBy, getPos, diff --git a/lib/std/io/stream_source.zig b/lib/std/io/stream_source.zig index df0d6cd352..0cfe346c6a 100644 --- a/lib/std/io/stream_source.zig +++ b/lib/std/io/stream_source.zig @@ -5,7 +5,6 @@ // and substantial portions of the software. const std = @import("../std.zig"); const io = std.io; -const testing = std.testing; /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as /// well as files. @@ -19,7 +18,7 @@ pub const StreamSource = union(enum) { pub const ReadError = std.fs.File.ReadError; pub const WriteError = std.fs.File.WriteError; pub const SeekError = std.fs.File.SeekError; - pub const GetSeekPosError = std.fs.File.GetPosError; + pub const GetSeekPosError = std.fs.File.GetSeekPosError; pub const Reader = io.Reader(*StreamSource, ReadError, read); pub const Writer = io.Writer(*StreamSource, WriteError, write); From d1244d3608361d416e9a2b58b58b67985650165c Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Fri, 2 Apr 2021 22:57:36 +0800 Subject: [PATCH 016/101] stage2 wasm: codegen `sub` op --- src/codegen/wasm.zig | 20 ++++++++++++++++++++ test/stage2/wasm.zig | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index 827f6c366a..2d69dc6bba 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -225,6 +225,7 @@ pub const Context = struct { .ret => self.genRet(inst.castTag(.ret).?), .retvoid => WValue.none, .store => self.genStore(inst.castTag(.store).?), + .sub => self.genSub(inst.castTag(.sub).?), .unreach => self.genUnreachable(inst.castTag(.unreach).?), else => self.fail(inst.src, "TODO: Implement wasm inst: {s}", .{inst.tag}), }; @@ -324,6 +325,25 @@ pub const Context = struct { return .none; } + fn genSub(self: *Context, inst: *Inst.BinOp) InnerError!WValue { + const lhs = self.resolveInst(inst.lhs); + const rhs = self.resolveInst(inst.rhs); + + try self.emitWValue(lhs); + try self.emitWValue(rhs); + + const opcode: wasm.Opcode = switch (inst.base.ty.tag()) { + .u32, .i32 => .i32_sub, + .u64, .i64 => .i64_sub, + .f32 => .f32_sub, + .f64 => .f64_sub, + else => return self.fail(inst.base.src, "TODO - Implement wasm genSub for type '{s}'", .{inst.base.ty.tag()}), + }; + + try self.code.append(wasm.opcode(opcode)); + return .none; + } + fn emitConstant(self: *Context, inst: *Inst.Constant) InnerError!void { const writer = self.code.writer(); switch (inst.base.ty.tag()) { diff --git a/test/stage2/wasm.zig b/test/stage2/wasm.zig index 51df6bccf0..d49598c855 100644 --- a/test/stage2/wasm.zig +++ b/test/stage2/wasm.zig @@ -121,6 +121,26 @@ pub fn addCases(ctx: *TestContext) !void { \\ return x + y; \\} , "35\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 20; + \\ i -= 5; + \\ return i; + \\} + , "15\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 5; + \\ i -= 3; + \\ var result: u32 = foo(i, 10); + \\ return result; + \\} + \\fn foo(x: u32, y: u32) u32 { + \\ return y - x; + \\} + , "8\n"); } { From 869fc06c57bca38f1af16f54453a9468603b22a0 Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Fri, 2 Apr 2021 22:57:44 +0800 Subject: [PATCH 017/101] stage2 wasm: codegen `mul` op --- src/codegen/wasm.zig | 20 ++++++++++++++++++++ test/stage2/wasm.zig | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index 2d69dc6bba..e720872f0e 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -221,6 +221,7 @@ pub const Context = struct { .dbg_stmt => WValue.none, .load => self.genLoad(inst.castTag(.load).?), .loop => self.genLoop(inst.castTag(.loop).?), + .mul => self.genMul(inst.castTag(.mul).?), .not => self.genNot(inst.castTag(.not).?), .ret => self.genRet(inst.castTag(.ret).?), .retvoid => WValue.none, @@ -344,6 +345,25 @@ pub const Context = struct { return .none; } + fn genMul(self: *Context, inst: *Inst.BinOp) InnerError!WValue { + const lhs = self.resolveInst(inst.lhs); + const rhs = self.resolveInst(inst.rhs); + + try self.emitWValue(lhs); + try self.emitWValue(rhs); + + const opcode: wasm.Opcode = switch (inst.base.ty.tag()) { + .u32, .i32 => .i32_mul, + .u64, .i64 => .i64_mul, + .f32 => .f32_mul, + .f64 => .f64_mul, + else => return self.fail(inst.base.src, "TODO - Implement wasm genMul for type '{s}'", .{inst.base.ty.tag()}), + }; + + try self.code.append(wasm.opcode(opcode)); + return .none; + } + fn emitConstant(self: *Context, inst: *Inst.Constant) InnerError!void { const writer = self.code.writer(); switch (inst.base.ty.tag()) { diff --git a/test/stage2/wasm.zig b/test/stage2/wasm.zig index d49598c855..b585ddc56b 100644 --- a/test/stage2/wasm.zig +++ b/test/stage2/wasm.zig @@ -141,6 +141,18 @@ pub fn addCases(ctx: *TestContext) !void { \\ return y - x; \\} , "8\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 5; + \\ i *= 7; + \\ var result: u32 = foo(i, 10); + \\ return result; + \\} + \\fn foo(x: u32, y: u32) u32 { + \\ return x * y; + \\} + , "350\n"); } { From 3648e43dda9b035bcc75ab98d690916e0667f985 Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:10:57 +0800 Subject: [PATCH 018/101] std/wasm: add buildOpcode to help construction of `Opcode`s --- lib/std/wasm.zig | 4 +- src/codegen/wasm.zig | 440 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 443 insertions(+), 1 deletion(-) diff --git a/lib/std/wasm.zig b/lib/std/wasm.zig index a04378d283..89ab9b6e12 100644 --- a/lib/std/wasm.zig +++ b/lib/std/wasm.zig @@ -5,6 +5,8 @@ // and substantial portions of the software. const testing = @import("std.zig").testing; +// TODO: Add support for multi-byte ops (e.g. table operations) + /// Wasm instruction opcodes /// /// All instructions are defined as per spec: @@ -175,7 +177,7 @@ pub const Opcode = enum(u8) { i32_reinterpret_f32 = 0xBC, i64_reinterpret_f64 = 0xBD, f32_reinterpret_i32 = 0xBE, - i64_reinterpret_i64 = 0xBF, + f64_reinterpret_i64 = 0xBF, i32_extend8_s = 0xC0, i32_extend16_s = 0xC1, i64_extend8_s = 0xC2, diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index e720872f0e..b420121ce1 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -2,6 +2,7 @@ const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; +const testing = std.testing; const leb = std.leb; const mem = std.mem; const wasm = std.wasm; @@ -29,6 +30,445 @@ const WValue = union(enum) { block_idx: u32, }; +/// Wasm ops, but without input/output/signedness information +/// Used for `buildOpcode` +const Op = enum { + @"unreachable", + nop, + block, + loop, + @"if", + @"else", + end, + br, + br_if, + br_table, + @"return", + call, + call_indirect, + drop, + select, + local_get, + local_set, + local_tee, + global_get, + global_set, + load, + store, + memory_size, + memory_grow, + @"const", + eqz, + eq, + ne, + lt, + gt, + le, + ge, + clz, + ctz, + popcnt, + add, + sub, + mul, + div, + rem, + @"and", + @"or", + xor, + shl, + shr, + rotl, + rotr, + abs, + neg, + ceil, + floor, + trunc, + nearest, + sqrt, + min, + max, + copysign, + wrap, + convert, + demote, + promote, + reinterpret, + extend, +}; + +/// Contains the settings needed to create an `Opcode` using `buildOpcode`. +/// +/// The fields correspond to the opcode name. Here is an example +/// i32_trunc_f32_s +/// ^ ^ ^ ^ +/// | | | | +/// valtype1 | | | +/// = .i32 | | | +/// | | | +/// op | | +/// = .trunc | | +/// | | +/// valtype2 | +/// = .f32 | +/// | +/// width | +/// = null | +/// | +/// signed +/// = true +/// +/// There can be missing fields, here are some more examples: +/// i64_load8_u +/// --> .{ .valtype1 = .i64, .op = .load, .width = 8, signed = false } +/// i32_mul +/// --> .{ .valtype1 = .i32, .op = .trunc } +/// nop +/// --> .{ .op = .nop } +const OpcodeBuildArguments = struct { + /// First valtype in the opcode (usually represents the type of the output) + valtype1: ?wasm.Valtype = null, + /// The operation (e.g. call, unreachable, div, min, sqrt, etc.) + op: Op, + /// Width of the operation (e.g. 8 for i32_load8_s, 16 for i64_extend16_i32_s) + width: ?u8 = null, + /// Second valtype in the opcode name (usually represents the type of the input) + valtype2: ?wasm.Valtype = null, + /// Signedness of the op + signedness: ?std.builtin.Signedness = null, +}; + +/// Helper function that builds an Opcode given the arguments needed +fn buildOpcode(args: OpcodeBuildArguments) wasm.Opcode { + switch (args.op) { + .@"unreachable" => return .@"unreachable", + .nop => return .nop, + .block => return .block, + .loop => return .loop, + .@"if" => return .@"if", + .@"else" => return .@"else", + .end => return .end, + .br => return .br, + .br_if => return .br_if, + .br_table => return .br_table, + .@"return" => return .@"return", + .call => return .call, + .call_indirect => return .call_indirect, + .drop => return .drop, + .select => return .select, + .local_get => return .local_get, + .local_set => return .local_set, + .local_tee => return .local_tee, + .global_get => return .global_get, + .global_set => return .global_set, + + .load => if (args.width) |width| + switch (width) { + 8 => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_load8_s else return .i32_load8_u, + .i64 => if (args.signedness.? == .signed) return .i64_load8_s else return .i64_load8_u, + .f32, .f64 => unreachable, + }, + 16 => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_load16_s else return .i32_load16_u, + .i64 => if (args.signedness.? == .signed) return .i64_load16_s else return .i64_load16_u, + .f32, .f64 => unreachable, + }, + 32 => switch (args.valtype1.?) { + .i64 => if (args.signedness.? == .signed) return .i64_load32_s else return .i64_load32_u, + .i32, .f32, .f64 => unreachable, + }, + else => unreachable, + } + else switch (args.valtype1.?) { + .i32 => return .i32_load, + .i64 => return .i64_load, + .f32 => return .f32_load, + .f64 => return .f64_load, + }, + .store => if (args.width) |width| { + switch (width) { + 8 => switch (args.valtype1.?) { + .i32 => return .i32_store8, + .i64 => return .i64_store8, + .f32, .f64 => unreachable, + }, + 16 => switch (args.valtype1.?) { + .i32 => return .i32_store16, + .i64 => return .i64_store16, + .f32, .f64 => unreachable, + }, + 32 => switch (args.valtype1.?) { + .i64 => return .i64_store32, + .i32, .f32, .f64 => unreachable, + }, + else => unreachable, + } + } else { + switch (args.valtype1.?) { + .i32 => return .i32_store, + .i64 => return .i64_store, + .f32 => return .f32_store, + .f64 => return .f64_store, + } + }, + + .memory_size => return .memory_size, + .memory_grow => return .memory_grow, + + .@"const" => switch (args.valtype1.?) { + .i32 => return .i32_const, + .i64 => return .i64_const, + .f32 => return .f32_const, + .f64 => return .f64_const, + }, + + .eqz => switch (args.valtype1.?) { + .i32 => return .i32_eqz, + .i64 => return .i64_eqz, + .f32, .f64 => unreachable, + }, + .eq => switch (args.valtype1.?) { + .i32 => return .i32_eq, + .i64 => return .i64_eq, + .f32 => return .f32_eq, + .f64 => return .f64_eq, + }, + .ne => switch (args.valtype1.?) { + .i32 => return .i32_ne, + .i64 => return .i64_ne, + .f32 => return .f32_ne, + .f64 => return .f64_ne, + }, + + .lt => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_lt_s else return .i32_lt_u, + .i64 => if (args.signedness.? == .signed) return .i64_lt_s else return .i64_lt_u, + .f32 => return .f32_lt, + .f64 => return .f64_lt, + }, + .gt => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_gt_s else return .i32_gt_u, + .i64 => if (args.signedness.? == .signed) return .i64_gt_s else return .i64_gt_u, + .f32 => return .f32_gt, + .f64 => return .f64_gt, + }, + .le => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_le_s else return .i32_le_u, + .i64 => if (args.signedness.? == .signed) return .i64_le_s else return .i64_le_u, + .f32 => return .f32_le, + .f64 => return .f64_le, + }, + .ge => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_ge_s else return .i32_ge_u, + .i64 => if (args.signedness.? == .signed) return .i64_ge_s else return .i64_ge_u, + .f32 => return .f32_ge, + .f64 => return .f64_ge, + }, + + .clz => switch (args.valtype1.?) { + .i32 => return .i32_clz, + .i64 => return .i64_clz, + .f32, .f64 => unreachable, + }, + .ctz => switch (args.valtype1.?) { + .i32 => return .i32_ctz, + .i64 => return .i64_ctz, + .f32, .f64 => unreachable, + }, + .popcnt => switch (args.valtype1.?) { + .i32 => return .i32_popcnt, + .i64 => return .i64_popcnt, + .f32, .f64 => unreachable, + }, + + .add => switch (args.valtype1.?) { + .i32 => return .i32_add, + .i64 => return .i64_add, + .f32 => return .f32_add, + .f64 => return .f64_add, + }, + .sub => switch (args.valtype1.?) { + .i32 => return .i32_sub, + .i64 => return .i64_sub, + .f32 => return .f32_sub, + .f64 => return .f64_sub, + }, + .mul => switch (args.valtype1.?) { + .i32 => return .i32_mul, + .i64 => return .i64_mul, + .f32 => return .f32_mul, + .f64 => return .f64_mul, + }, + + .div => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_div_s else return .i32_div_u, + .i64 => if (args.signedness.? == .signed) return .i64_div_s else return .i64_div_u, + .f32 => return .f32_div, + .f64 => return .f64_div, + }, + .rem => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_rem_s else return .i32_rem_u, + .i64 => if (args.signedness.? == .signed) return .i64_rem_s else return .i64_rem_u, + .f32, .f64 => unreachable, + }, + + .@"and" => switch (args.valtype1.?) { + .i32 => return .i32_and, + .i64 => return .i64_and, + .f32, .f64 => unreachable, + }, + .@"or" => switch (args.valtype1.?) { + .i32 => return .i32_or, + .i64 => return .i64_or, + .f32, .f64 => unreachable, + }, + .xor => switch (args.valtype1.?) { + .i32 => return .i32_xor, + .i64 => return .i64_xor, + .f32, .f64 => unreachable, + }, + + .shl => switch (args.valtype1.?) { + .i32 => return .i32_shl, + .i64 => return .i64_shl, + .f32, .f64 => unreachable, + }, + .shr => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_shr_s else return .i32_shr_u, + .i64 => if (args.signedness.? == .signed) return .i64_shr_s else return .i64_shr_u, + .f32, .f64 => unreachable, + }, + .rotl => switch (args.valtype1.?) { + .i32 => return .i32_rotl, + .i64 => return .i64_rotl, + .f32, .f64 => unreachable, + }, + .rotr => switch (args.valtype1.?) { + .i32 => return .i32_rotr, + .i64 => return .i64_rotr, + .f32, .f64 => unreachable, + }, + + .abs => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_abs, + .f64 => return .f64_abs, + }, + .neg => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_neg, + .f64 => return .f64_neg, + }, + .ceil => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_ceil, + .f64 => return .f64_ceil, + }, + .floor => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_floor, + .f64 => return .f64_floor, + }, + .trunc => switch (args.valtype1.?) { + .i32 => switch (args.valtype2.?) { + .i32 => unreachable, + .i64 => unreachable, + .f32 => if (args.signedness.? == .signed) return .i32_trunc_f32_s else return .i32_trunc_f32_u, + .f64 => if (args.signedness.? == .signed) return .i32_trunc_f64_s else return .i32_trunc_f64_u, + }, + .i64 => unreachable, + .f32 => return .f32_trunc, + .f64 => return .f64_trunc, + }, + .nearest => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_nearest, + .f64 => return .f64_nearest, + }, + .sqrt => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_sqrt, + .f64 => return .f64_sqrt, + }, + .min => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_min, + .f64 => return .f64_min, + }, + .max => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_max, + .f64 => return .f64_max, + }, + .copysign => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => return .f32_copysign, + .f64 => return .f64_copysign, + }, + + .wrap => switch (args.valtype1.?) { + .i32 => switch (args.valtype2.?) { + .i32 => unreachable, + .i64 => return .i32_wrap_i64, + .f32, .f64 => unreachable, + }, + .i64, .f32, .f64 => unreachable, + }, + .convert => switch (args.valtype1.?) { + .i32, .i64 => unreachable, + .f32 => switch (args.valtype2.?) { + .i32 => if (args.signedness.? == .signed) return .f32_convert_i32_s else return .f32_convert_i32_u, + .i64 => if (args.signedness.? == .signed) return .f32_convert_i64_s else return .f32_convert_i64_u, + .f32, .f64 => unreachable, + }, + .f64 => switch (args.valtype2.?) { + .i32 => if (args.signedness.? == .signed) return .f64_convert_i32_s else return .f64_convert_i32_u, + .i64 => if (args.signedness.? == .signed) return .f64_convert_i64_s else return .f64_convert_i64_u, + .f32, .f64 => unreachable, + }, + }, + .demote => if (args.valtype1.? == .f32 and args.valtype2.? == .f64) return .f32_demote_f64 else unreachable, + .promote => if (args.valtype1.? == .f64 and args.valtype2.? == .f32) return .f64_promote_f32 else unreachable, + .reinterpret => switch (args.valtype1.?) { + .i32 => if (args.valtype2.? == .f32) return .i32_reinterpret_f32 else unreachable, + .i64 => if (args.valtype2.? == .f64) return .i64_reinterpret_f64 else unreachable, + .f32 => if (args.valtype2.? == .i32) return .f32_reinterpret_i32 else unreachable, + .f64 => if (args.valtype2.? == .i64) return .f64_reinterpret_i64 else unreachable, + }, + .extend => switch (args.valtype1.?) { + .i32 => switch (args.width.?) { + 8 => if (args.signedness.? == .signed) return .i32_extend8_s else unreachable, + 16 => if (args.signedness.? == .signed) return .i32_extend16_s else unreachable, + else => unreachable, + }, + .i64 => switch (args.width.?) { + 8 => if (args.signedness.? == .signed) return .i64_extend8_s else unreachable, + 16 => if (args.signedness.? == .signed) return .i64_extend16_s else unreachable, + 32 => if (args.signedness.? == .signed) return .i64_extend32_s else unreachable, + else => unreachable, + }, + .f32, .f64 => unreachable, + }, + } +} + +test "Wasm - buildOpcode" { + // Make sure buildOpcode is referenced, and test some examples + const i32_const = buildOpcode(.{ .op = .@"const", .valtype1 = .i32 }); + const end = buildOpcode(.{ .op = .end }); + const local_get = buildOpcode(.{ .op = .local_get }); + const i64_extend32_s = buildOpcode(.{ .op = .extend, .valtype1 = .i64, .width = 32, .signedness = .signed }); + const f64_reinterpret_i64 = buildOpcode(.{ .op = .reinterpret, .valtype1 = .f64, .valtype2 = .i64 }); + + testing.expectEqual(@as(wasm.Opcode, .i32_const), i32_const); + testing.expectEqual(@as(wasm.Opcode, .end), end); + testing.expectEqual(@as(wasm.Opcode, .local_get), local_get); + testing.expectEqual(@as(wasm.Opcode, .i64_extend32_s), i64_extend32_s); + testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64); +} + /// Hashmap to store generated `WValue` for each `Inst` pub const ValueTable = std.AutoHashMapUnmanaged(*Inst, WValue); From ec84742c89273424aab713d1ff4d55a499c85cbf Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:11:29 +0800 Subject: [PATCH 019/101] stage2 wasm codegen: refactor to use wasm.buildOpcode --- src/codegen/wasm.zig | 202 ++++++++++++++----------------------------- src/link/Wasm.zig | 1 + 2 files changed, 66 insertions(+), 137 deletions(-) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index b420121ce1..9372444f53 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -498,6 +498,8 @@ pub const Context = struct { /// List of all locals' types generated throughout this declaration /// used to emit locals count at start of 'code' section. locals: std.ArrayListUnmanaged(u8), + /// The Target we're emitting (used to call intInfo) + target: std.Target, const InnerError = error{ OutOfMemory, @@ -529,17 +531,22 @@ pub const Context = struct { return self.values.get(inst).?; // Instruction does not dominate all uses! } - /// Using a given `Type`, returns the corresponding wasm value type - fn genValtype(self: *Context, src: LazySrcLoc, ty: Type) InnerError!u8 { + /// Using a given `Type`, returns the corresponding wasm Valtype + fn typeToValtype(self: *Context, src: LazySrcLoc, ty: Type) InnerError!wasm.Valtype { return switch (ty.tag()) { - .f32 => wasm.valtype(.f32), - .f64 => wasm.valtype(.f64), - .u32, .i32, .bool => wasm.valtype(.i32), - .u64, .i64 => wasm.valtype(.i64), - else => self.fail(src, "TODO - Wasm genValtype for type '{s}'", .{ty.tag()}), + .f32 => .f32, + .f64 => .f64, + .u32, .i32, .bool => .i32, + .u64, .i64 => .i64, + else => self.fail(src, "TODO - Wasm valtype for type '{s}'", .{ty.tag()}), }; } + /// Using a given `Type`, returns the byte representation of its wasm value type + fn genValtype(self: *Context, src: LazySrcLoc, ty: Type) InnerError!u8 { + return wasm.valtype(try self.typeToValtype(src, ty)); + } + /// Using a given `Type`, returns the corresponding wasm value type /// Differently from `genValtype` this also allows `void` to create a block /// with no return type @@ -643,7 +650,7 @@ pub const Context = struct { fn genInst(self: *Context, inst: *Inst) InnerError!WValue { return switch (inst.tag) { - .add => self.genAdd(inst.castTag(.add).?), + .add => self.genBinOp(inst.castTag(.add).?, .add), .alloc => self.genAlloc(inst.castTag(.alloc).?), .arg => self.genArg(inst.castTag(.arg).?), .block => self.genBlock(inst.castTag(.block).?), @@ -661,12 +668,12 @@ pub const Context = struct { .dbg_stmt => WValue.none, .load => self.genLoad(inst.castTag(.load).?), .loop => self.genLoop(inst.castTag(.loop).?), - .mul => self.genMul(inst.castTag(.mul).?), + .mul => self.genBinOp(inst.castTag(.mul).?, .mul), .not => self.genNot(inst.castTag(.not).?), .ret => self.genRet(inst.castTag(.ret).?), .retvoid => WValue.none, .store => self.genStore(inst.castTag(.store).?), - .sub => self.genSub(inst.castTag(.sub).?), + .sub => self.genBinOp(inst.castTag(.sub).?, .sub), .unreach => self.genUnreachable(inst.castTag(.unreach).?), else => self.fail(inst.src, "TODO: Implement wasm inst: {s}", .{inst.tag}), }; @@ -747,94 +754,59 @@ pub const Context = struct { return WValue{ .local = self.local_index }; } - fn genAdd(self: *Context, inst: *Inst.BinOp) InnerError!WValue { + fn genBinOp(self: *Context, inst: *Inst.BinOp, op: Op) InnerError!WValue { const lhs = self.resolveInst(inst.lhs); const rhs = self.resolveInst(inst.rhs); try self.emitWValue(lhs); try self.emitWValue(rhs); - const opcode: wasm.Opcode = switch (inst.base.ty.tag()) { - .u32, .i32 => .i32_add, - .u64, .i64 => .i64_add, - .f32 => .f32_add, - .f64 => .f64_add, - else => return self.fail(inst.base.src, "TODO - Implement wasm genAdd for type '{s}'", .{inst.base.ty.tag()}), - }; - - try self.code.append(wasm.opcode(opcode)); - return .none; - } - - fn genSub(self: *Context, inst: *Inst.BinOp) InnerError!WValue { - const lhs = self.resolveInst(inst.lhs); - const rhs = self.resolveInst(inst.rhs); - - try self.emitWValue(lhs); - try self.emitWValue(rhs); - - const opcode: wasm.Opcode = switch (inst.base.ty.tag()) { - .u32, .i32 => .i32_sub, - .u64, .i64 => .i64_sub, - .f32 => .f32_sub, - .f64 => .f64_sub, - else => return self.fail(inst.base.src, "TODO - Implement wasm genSub for type '{s}'", .{inst.base.ty.tag()}), - }; - - try self.code.append(wasm.opcode(opcode)); - return .none; - } - - fn genMul(self: *Context, inst: *Inst.BinOp) InnerError!WValue { - const lhs = self.resolveInst(inst.lhs); - const rhs = self.resolveInst(inst.rhs); - - try self.emitWValue(lhs); - try self.emitWValue(rhs); - - const opcode: wasm.Opcode = switch (inst.base.ty.tag()) { - .u32, .i32 => .i32_mul, - .u64, .i64 => .i64_mul, - .f32 => .f32_mul, - .f64 => .f64_mul, - else => return self.fail(inst.base.src, "TODO - Implement wasm genMul for type '{s}'", .{inst.base.ty.tag()}), - }; - + const opcode: wasm.Opcode = buildOpcode(.{ + .op = op, + .valtype1 = try self.typeToValtype(inst.base.src, inst.base.ty), + }); try self.code.append(wasm.opcode(opcode)); return .none; } fn emitConstant(self: *Context, inst: *Inst.Constant) InnerError!void { const writer = self.code.writer(); - switch (inst.base.ty.tag()) { - .u32 => { - try writer.writeByte(wasm.opcode(.i32_const)); - try leb.writeILEB128(writer, inst.val.toUnsignedInt()); + switch (inst.base.ty.zigTypeTag()) { + .Int => { + // write opcode + const opcode: wasm.Opcode = buildOpcode(.{ + .op = .@"const", + .valtype1 = try self.typeToValtype(inst.base.src, inst.base.ty), + }); + try writer.writeByte(wasm.opcode(opcode)); + // write constant + switch (inst.base.ty.intInfo(self.target).signedness) { + .signed => try leb.writeILEB128(writer, inst.val.toSignedInt()), + .unsigned => try leb.writeILEB128(writer, inst.val.toUnsignedInt()), + } }, - .i32, .bool => { + .Bool => { + // write opcode try writer.writeByte(wasm.opcode(.i32_const)); + // write constant try leb.writeILEB128(writer, inst.val.toSignedInt()); }, - .u64 => { - try writer.writeByte(wasm.opcode(.i64_const)); - try leb.writeILEB128(writer, inst.val.toUnsignedInt()); + .Float => { + // write opcode + const opcode: wasm.Opcode = buildOpcode(.{ + .op = .@"const", + .valtype1 = try self.typeToValtype(inst.base.src, inst.base.ty), + }); + try writer.writeByte(wasm.opcode(opcode)); + // write constant + switch (inst.base.ty.floatBits(self.target)) { + 0...32 => try writer.writeIntLittle(u32, @bitCast(u32, inst.val.toFloat(f32))), + 64 => try writer.writeIntLittle(u64, @bitCast(u64, inst.val.toFloat(f64))), + else => |bits| return self.fail(inst.base.src, "Wasm TODO: emitConstant for float with {d} bits", .{bits}), + } }, - .i64 => { - try writer.writeByte(wasm.opcode(.i64_const)); - try leb.writeILEB128(writer, inst.val.toSignedInt()); - }, - .f32 => { - try writer.writeByte(wasm.opcode(.f32_const)); - // TODO: enforce LE byte order - try writer.writeAll(mem.asBytes(&inst.val.toFloat(f32))); - }, - .f64 => { - try writer.writeByte(wasm.opcode(.f64_const)); - // TODO: enforce LE byte order - try writer.writeAll(mem.asBytes(&inst.val.toFloat(f64))); - }, - .void => {}, - else => |ty| return self.fail(inst.base.src, "Wasm TODO: emitConstant for type {s}", .{ty}), + .Void => {}, + else => |ty| return self.fail(inst.base.src, "Wasm TODO: emitConstant for zigTypeTag {s}", .{ty}), } } @@ -935,62 +907,18 @@ pub const Context = struct { try self.emitWValue(lhs); try self.emitWValue(rhs); - const opcode_maybe: ?wasm.Opcode = switch (op) { - .lt => @as(?wasm.Opcode, switch (ty) { - .i32 => .i32_lt_s, - .u32 => .i32_lt_u, - .i64 => .i64_lt_s, - .u64 => .i64_lt_u, - .f32 => .f32_lt, - .f64 => .f64_lt, - else => null, - }), - .lte => @as(?wasm.Opcode, switch (ty) { - .i32 => .i32_le_s, - .u32 => .i32_le_u, - .i64 => .i64_le_s, - .u64 => .i64_le_u, - .f32 => .f32_le, - .f64 => .f64_le, - else => null, - }), - .eq => @as(?wasm.Opcode, switch (ty) { - .i32, .u32 => .i32_eq, - .i64, .u64 => .i64_eq, - .f32 => .f32_eq, - .f64 => .f64_eq, - else => null, - }), - .gte => @as(?wasm.Opcode, switch (ty) { - .i32 => .i32_ge_s, - .u32 => .i32_ge_u, - .i64 => .i64_ge_s, - .u64 => .i64_ge_u, - .f32 => .f32_ge, - .f64 => .f64_ge, - else => null, - }), - .gt => @as(?wasm.Opcode, switch (ty) { - .i32 => .i32_gt_s, - .u32 => .i32_gt_u, - .i64 => .i64_gt_s, - .u64 => .i64_gt_u, - .f32 => .f32_gt, - .f64 => .f64_gt, - else => null, - }), - .neq => @as(?wasm.Opcode, switch (ty) { - .i32, .u32 => .i32_ne, - .i64, .u64 => .i64_ne, - .f32 => .f32_ne, - .f64 => .f64_ne, - else => null, - }), - }; - - const opcode = opcode_maybe orelse - return self.fail(inst.base.src, "TODO - Wasm genCmp for type '{s}' and operator '{s}'", .{ ty, @tagName(op) }); - + const opcode: wasm.Opcode = buildOpcode(.{ + .valtype1 = try self.typeToValtype(inst.base.src, inst.lhs.ty), + .op = switch (op) { + .lt => .lt, + .lte => .le, + .eq => .eq, + .neq => .ne, + .gte => .ge, + .gt => .gt, + }, + .signedness = inst.lhs.ty.intInfo(self.target).signedness, + }); try self.code.append(wasm.opcode(opcode)); return WValue{ .code_offset = offset }; } diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 71cb171d98..523d4c8a64 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -127,6 +127,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { .decl = decl, .err_msg = undefined, .locals = .{}, + .target = self.base.options.target, }; defer context.deinit(); From 2bfc6d14d500dcaf66b8ee7d24637e25e3795a5e Mon Sep 17 00:00:00 2001 From: lithdew Date: Fri, 2 Apr 2021 05:28:25 +0900 Subject: [PATCH 020/101] os/linux: return error on EALREADY for connect() and getsockoptError() When a connected socket file descriptor on Linux is re-acquired after being closed, through fuzz testing, it appears that a subsequent attempt to establish a connection with the file descriptor causes EALREADY to be reported. Instead of panicking, choose to return error.ConnectionPending to allow for users to handle this fairly rare case. --- lib/std/os.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index e4bd96de05..9826ba46f1 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3254,6 +3254,9 @@ pub const ConnectError = error{ /// Connection was reset by peer before connect could complete. ConnectionResetByPeer, + + /// Socket is non-blocking and already has a pending connection in progress. + ConnectionPending, } || UnexpectedError; /// Initiate a connection on a socket. @@ -3294,7 +3297,7 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne EADDRNOTAVAIL => return error.AddressNotAvailable, EAFNOSUPPORT => return error.AddressFamilyNotSupported, EAGAIN, EINPROGRESS => return error.WouldBlock, - EALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed. + EALREADY => return error.ConnectionPending, EBADF => unreachable, // sockfd is not a valid open file descriptor. ECONNREFUSED => return error.ConnectionRefused, ECONNRESET => return error.ConnectionResetByPeer, @@ -3325,7 +3328,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { EADDRNOTAVAIL => return error.AddressNotAvailable, EAFNOSUPPORT => return error.AddressFamilyNotSupported, EAGAIN => return error.SystemResources, - EALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed. + EALREADY => return error.ConnectionPending, EBADF => unreachable, // sockfd is not a valid open file descriptor. ECONNREFUSED => return error.ConnectionRefused, EFAULT => unreachable, // The socket structure address is outside the user's address space. From 89df41e5d859fcd53863c9f707e8c697b794148c Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 6 Apr 2021 10:47:29 +0200 Subject: [PATCH 021/101] stage2: Default AVR generic cpu to avr2 The avr1 target is a very minimal subset of the AVR ISA, quoting the GCC manual: > This ISA is implemented by the minimal AVR core and supported for > assembler only. Default to avr2 as GCC and Clang do. --- lib/std/target.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/target.zig b/lib/std/target.zig index 7e05f35932..b3c417c348 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -1170,7 +1170,7 @@ pub const Target = struct { return switch (arch) { .arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic, .aarch64, .aarch64_be, .aarch64_32 => &aarch64.cpu.generic, - .avr => &avr.cpu.avr1, + .avr => &avr.cpu.avr2, .bpfel, .bpfeb => &bpf.cpu.generic, .hexagon => &hexagon.cpu.generic, .mips, .mipsel => &mips.cpu.mips32, From 38d8aab4d283efe2f43c7e18411f6df7e1c2d04b Mon Sep 17 00:00:00 2001 From: Michael Holmes Date: Mon, 5 Apr 2021 22:54:04 +0100 Subject: [PATCH 022/101] std/build: fix ?[:0]const u8 build options As per the other string types, `?[:0]const u8` needs its own case as otherwise it will raise an error about using `{}` with slices. There's no reasonable workaround for this, as you would have to either discount the use of the empty string value or manually rework the string to be sentinel-terminated at runtime. It's useful for passing build options to code making use of C libraries that make strong use of sentinel-terminated arrays for strings. --- lib/std/build.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/std/build.zig b/lib/std/build.zig index 825312755f..a652de9c12 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1939,6 +1939,15 @@ pub const LibExeObjStep = struct { out.print("pub const {}: []const u8 = \"{}\";\n", .{ std.zig.fmtId(name), std.zig.fmtEscapes(value) }) catch unreachable; return; }, + ?[:0]const u8 => { + out.print("pub const {}: ?[:0]const u8 = ", .{std.zig.fmtId(name)}) catch unreachable; + if (value) |payload| { + out.print("\"{}\";\n", .{std.zig.fmtEscapes(payload)}) catch unreachable; + } else { + out.writeAll("null;\n") catch unreachable; + } + return; + }, ?[]const u8 => { out.print("pub const {}: ?[]const u8 = ", .{std.zig.fmtId(name)}) catch unreachable; if (value) |payload| { From 8de14a98a68752cc834848343f2e7867ee8ca6c9 Mon Sep 17 00:00:00 2001 From: Evan Haas Date: Mon, 8 Mar 2021 07:01:19 -0800 Subject: [PATCH 023/101] translate-c: Add support for vector expressions Includes vector types, __builtin_shufflevector, and __builtin_convertvector --- lib/std/meta.zig | 32 ++++++ src/clang.zig | 27 +++++ src/translate_c.zig | 215 ++++++++++++++++++++++++++++++++++++++ src/translate_c/ast.zig | 103 ++++++++++++++++-- src/zig_clang.cpp | 34 ++++++ src/zig_clang.h | 10 ++ test/run_translated_c.zig | 102 ++++++++++++++++++ 7 files changed, 515 insertions(+), 8 deletions(-) diff --git a/lib/std/meta.zig b/lib/std/meta.zig index cdc93e5d33..2ed737cea3 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -1297,3 +1297,35 @@ pub fn globalOption(comptime name: []const u8, comptime T: type) ?T { return null; return @as(T, @field(root, name)); } + +/// This function is for translate-c and is not intended for general use. +/// Convert from clang __builtin_shufflevector index to Zig @shuffle index +/// clang requires __builtin_shufflevector index arguments to be integer constants. +/// negative values for `this_index` indicate "don't care" so we arbitrarily choose 0 +/// clang enforces that `this_index` is less than the total number of vector elements +/// See https://ziglang.org/documentation/master/#shuffle +/// See https://clang.llvm.org/docs/LanguageExtensions.html#langext-builtin-shufflevector +pub fn shuffleVectorIndex(comptime this_index: c_int, comptime source_vector_len: usize) i32 { + if (this_index <= 0) return 0; + + const positive_index = @intCast(usize, this_index); + if (positive_index < source_vector_len) return @intCast(i32, this_index); + const b_index = positive_index - source_vector_len; + return ~@intCast(i32, b_index); +} + +test "shuffleVectorIndex" { + const vector_len: usize = 4; + + testing.expect(shuffleVectorIndex(-1, vector_len) == 0); + + testing.expect(shuffleVectorIndex(0, vector_len) == 0); + testing.expect(shuffleVectorIndex(1, vector_len) == 1); + testing.expect(shuffleVectorIndex(2, vector_len) == 2); + testing.expect(shuffleVectorIndex(3, vector_len) == 3); + + testing.expect(shuffleVectorIndex(4, vector_len) == -1); + testing.expect(shuffleVectorIndex(5, vector_len) == -2); + testing.expect(shuffleVectorIndex(6, vector_len) == -3); + testing.expect(shuffleVectorIndex(7, vector_len) == -4); +} \ No newline at end of file diff --git a/src/clang.zig b/src/clang.zig index 0d18ae42b3..e87852e9ba 100644 --- a/src/clang.zig +++ b/src/clang.zig @@ -300,6 +300,14 @@ pub const ConstantExpr = opaque {}; pub const ContinueStmt = opaque {}; +pub const ConvertVectorExpr = opaque { + pub const getSrcExpr = ZigClangConvertVectorExpr_getSrcExpr; + extern fn ZigClangConvertVectorExpr_getSrcExpr(*const ConvertVectorExpr) *const Expr; + + pub const getTypeSourceInfo_getType = ZigClangConvertVectorExpr_getTypeSourceInfo_getType; + extern fn ZigClangConvertVectorExpr_getTypeSourceInfo_getType(*const ConvertVectorExpr) QualType; +}; + pub const DecayedType = opaque { pub const getDecayedType = ZigClangDecayedType_getDecayedType; extern fn ZigClangDecayedType_getDecayedType(*const DecayedType) QualType; @@ -748,6 +756,14 @@ pub const ReturnStmt = opaque { extern fn ZigClangReturnStmt_getRetValue(*const ReturnStmt) ?*const Expr; }; +pub const ShuffleVectorExpr = opaque { + pub const getNumSubExprs = ZigClangShuffleVectorExpr_getNumSubExprs; + extern fn ZigClangShuffleVectorExpr_getNumSubExprs(*const ShuffleVectorExpr) c_uint; + + pub const getExpr = ZigClangShuffleVectorExpr_getExpr; + extern fn ZigClangShuffleVectorExpr_getExpr(*const ShuffleVectorExpr, c_uint) *const Expr; +}; + pub const SourceManager = opaque { pub const getSpellingLoc = ZigClangSourceManager_getSpellingLoc; extern fn ZigClangSourceManager_getSpellingLoc(*const SourceManager, Loc: SourceLocation) SourceLocation; @@ -837,6 +853,9 @@ pub const Type = opaque { pub const isRecordType = ZigClangType_isRecordType; extern fn ZigClangType_isRecordType(*const Type) bool; + pub const isVectorType = ZigClangType_isVectorType; + extern fn ZigClangType_isVectorType(*const Type) bool; + pub const isIncompleteOrZeroLengthArrayType = ZigClangType_isIncompleteOrZeroLengthArrayType; extern fn ZigClangType_isIncompleteOrZeroLengthArrayType(*const Type, *const ASTContext) bool; @@ -937,6 +956,14 @@ pub const VarDecl = opaque { extern fn ZigClangVarDecl_getTypeSourceInfo_getType(*const VarDecl) QualType; }; +pub const VectorType = opaque { + pub const getElementType = ZigClangVectorType_getElementType; + extern fn ZigClangVectorType_getElementType(*const VectorType) QualType; + + pub const getNumElements = ZigClangVectorType_getNumElements; + extern fn ZigClangVectorType_getNumElements(*const VectorType) c_uint; +}; + pub const WhileStmt = opaque { pub const getCond = ZigClangWhileStmt_getCond; extern fn ZigClangWhileStmt_getCond(*const WhileStmt) *const Expr; diff --git a/src/translate_c.zig b/src/translate_c.zig index 4c6d9ccee1..5962b85a6b 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -1123,6 +1123,16 @@ fn transStmt( const gen_sel = @ptrCast(*const clang.GenericSelectionExpr, stmt); return transExpr(c, scope, gen_sel.getResultExpr(), result_used); }, + .ConvertVectorExprClass => { + const conv_vec = @ptrCast(*const clang.ConvertVectorExpr, stmt); + const conv_vec_node = try transConvertVectorExpr(c, scope, stmt.getBeginLoc(), conv_vec); + return maybeSuppressResult(c, scope, result_used, conv_vec_node); + }, + .ShuffleVectorExprClass => { + const shuffle_vec_expr = @ptrCast(*const clang.ShuffleVectorExpr, stmt); + const shuffle_vec_node = try transShuffleVectorExpr(c, scope, shuffle_vec_expr); + return maybeSuppressResult(c, scope, result_used, shuffle_vec_node); + }, // When adding new cases here, see comment for maybeBlockify() else => { return fail(c, error.UnsupportedTranslation, stmt.getBeginLoc(), "TODO implement translation of stmt class {s}", .{@tagName(sc)}); @@ -1130,6 +1140,128 @@ fn transStmt( } } +/// See https://clang.llvm.org/docs/LanguageExtensions.html#langext-builtin-convertvector +fn transConvertVectorExpr( + c: *Context, + scope: *Scope, + source_loc: clang.SourceLocation, + expr: *const clang.ConvertVectorExpr, +) TransError!Node { + const base_stmt = @ptrCast(*const clang.Stmt, expr); + + var block_scope = try Scope.Block.init(c, scope, true); + defer block_scope.deinit(); + + const src_expr = expr.getSrcExpr(); + const src_type = qualTypeCanon(src_expr.getType()); + const src_vector_ty = @ptrCast(*const clang.VectorType, src_type); + const src_element_qt = src_vector_ty.getElementType(); + const src_element_type_node = try transQualType(c, &block_scope.base, src_element_qt, base_stmt.getBeginLoc()); + + const src_expr_node = try transExpr(c, &block_scope.base, src_expr, .used); + + const dst_qt = expr.getTypeSourceInfo_getType(); + const dst_type_node = try transQualType(c, &block_scope.base, dst_qt, base_stmt.getBeginLoc()); + const dst_vector_ty = @ptrCast(*const clang.VectorType, qualTypeCanon(dst_qt)); + const num_elements = dst_vector_ty.getNumElements(); + const dst_element_qt = dst_vector_ty.getElementType(); + + // workaround for https://github.com/ziglang/zig/issues/8322 + // we store the casted results into temp variables and use those + // to initialize the vector. Eventually we can just directly + // construct the init_list from casted source members + var i: usize = 0; + while (i < num_elements) : (i += 1) { + const mangled_name = try block_scope.makeMangledName(c, "tmp"); + const value = try Tag.array_access.create(c.arena, .{ + .lhs = src_expr_node, + .rhs = try transCreateNodeNumber(c, i, .int), + }); + const tmp_decl_node = try Tag.var_simple.create(c.arena, .{ + .name = mangled_name, + .init = try transCCast(c, &block_scope.base, base_stmt.getBeginLoc(), dst_element_qt, src_element_qt, value), + }); + try block_scope.statements.append(tmp_decl_node); + } + + const init_list = try c.arena.alloc(Node, num_elements); + for (init_list) |*init, init_index| { + const tmp_decl = block_scope.statements.items[init_index]; + const name = tmp_decl.castTag(.var_simple).?.data.name; + init.* = try Tag.identifier.create(c.arena, name); + } + + const vec_init = try Tag.array_init.create(c.arena, .{ + .cond = dst_type_node, + .cases = init_list, + }); + + const break_node = try Tag.break_val.create(c.arena, .{ + .label = block_scope.label, + .val = vec_init, + }); + try block_scope.statements.append(break_node); + return block_scope.complete(c); +} + +fn makeShuffleMask(c: *Context, scope: *Scope, expr: *const clang.ShuffleVectorExpr, vector_len: Node) TransError!Node { + const num_subexprs = expr.getNumSubExprs(); + assert(num_subexprs >= 3); // two source vectors + at least 1 index expression + const mask_len = num_subexprs - 2; + + const mask_type = try Tag.std_meta_vector.create(c.arena, .{ + .lhs = try transCreateNodeNumber(c, mask_len, .int), + .rhs = try Tag.type.create(c.arena, "i32"), + }); + + const init_list = try c.arena.alloc(Node, mask_len); + + for (init_list) |*init, i| { + const index_expr = try transExprCoercing(c, scope, expr.getExpr(@intCast(c_uint, i + 2)), .used); + const converted_index = try Tag.std_meta_shuffle_vector_index.create(c.arena, .{ .lhs = index_expr, .rhs = vector_len }); + init.* = converted_index; + } + + const mask_init = try Tag.array_init.create(c.arena, .{ + .cond = mask_type, + .cases = init_list, + }); + return Tag.@"comptime".create(c.arena, mask_init); +} + +/// @typeInfo(@TypeOf(vec_node)).Vector. +fn vectorTypeInfo(arena: *mem.Allocator, vec_node: Node, field: []const u8) TransError!Node { + const typeof_call = try Tag.typeof.create(arena, vec_node); + const typeinfo_call = try Tag.typeinfo.create(arena, typeof_call); + const vector_type_info = try Tag.field_access.create(arena, .{ .lhs = typeinfo_call, .field_name = "Vector" }); + return Tag.field_access.create(arena, .{ .lhs = vector_type_info, .field_name = field }); +} + +fn transShuffleVectorExpr( + c: *Context, + scope: *Scope, + expr: *const clang.ShuffleVectorExpr, +) TransError!Node { + const base_expr = @ptrCast(*const clang.Expr, expr); + const num_subexprs = expr.getNumSubExprs(); + if (num_subexprs < 3) return fail(c, error.UnsupportedTranslation, base_expr.getBeginLoc(), "ShuffleVector needs at least 1 index", .{}); + + const a = try transExpr(c, scope, expr.getExpr(0), .used); + const b = try transExpr(c, scope, expr.getExpr(1), .used); + + // clang requires first two arguments to __builtin_shufflevector to be same type + const vector_child_type = try vectorTypeInfo(c.arena, a, "child"); + const vector_len = try vectorTypeInfo(c.arena, a, "len"); + const shuffle_mask = try makeShuffleMask(c, scope, expr, vector_len); + + return Tag.shuffle.create(c.arena, .{ + .element_type = vector_child_type, + .a = a, + .b = b, + .mask_vector = shuffle_mask, + }); +} + /// Translate a "simple" offsetof expression containing exactly one component, /// when that component is of kind .Field - e.g. offsetof(mytype, myfield) fn transSimpleOffsetOfExpr( @@ -1935,6 +2067,10 @@ fn cIsEnum(qt: clang.QualType) bool { return qt.getCanonicalType().getTypeClass() == .Enum; } +fn cIsVector(qt: clang.QualType) bool { + return qt.getCanonicalType().getTypeClass() == .Vector; +} + /// Get the underlying int type of an enum. The C compiler chooses a signed int /// type that is large enough to hold all of the enum's values. It is not required /// to be the smallest possible type that can hold all the values. @@ -1991,6 +2127,11 @@ fn transCCast( // @bitCast(dest_type, intermediate_value) return Tag.bit_cast.create(c.arena, .{ .lhs = dst_node, .rhs = src_int_expr }); } + if (cIsVector(src_type) or cIsVector(dst_type)) { + // C cast where at least 1 operand is a vector requires them to be same size + // @bitCast(dest_type, val) + return Tag.bit_cast.create(c.arena, .{ .lhs = dst_node, .rhs = expr }); + } if (cIsInteger(dst_type) and qualTypeIsPtr(src_type)) { // @intCast(dest_type, @ptrToInt(val)) const ptr_to_int = try Tag.ptr_to_int.create(c.arena, expr); @@ -2209,6 +2350,63 @@ fn transInitListExprArray( } } +fn transInitListExprVector( + c: *Context, + scope: *Scope, + loc: clang.SourceLocation, + expr: *const clang.InitListExpr, + ty: *const clang.Type, +) TransError!Node { + + const qt = getExprQualType(c, @ptrCast(*const clang.Expr, expr)); + const vector_type = try transQualType(c, scope, qt, loc); + const init_count = expr.getNumInits(); + + if (init_count == 0) { + return Tag.container_init.create(c.arena, .{ + .lhs = vector_type, + .inits = try c.arena.alloc(ast.Payload.ContainerInit.Initializer, 0), + }); + } + + var block_scope = try Scope.Block.init(c, scope, true); + defer block_scope.deinit(); + + // workaround for https://github.com/ziglang/zig/issues/8322 + // we store the initializers in temp variables and use those + // to initialize the vector. Eventually we can just directly + // construct the init_list from casted source members + var i: usize = 0; + while (i < init_count) : (i += 1) { + const mangled_name = try block_scope.makeMangledName(c, "tmp"); + const init_expr = expr.getInit(@intCast(c_uint, i)); + const tmp_decl_node = try Tag.var_simple.create(c.arena, .{ + .name = mangled_name, + .init = try transExpr(c, &block_scope.base, init_expr, .used), + }); + try block_scope.statements.append(tmp_decl_node); + } + + const init_list = try c.arena.alloc(Node, init_count); + for (init_list) |*init, init_index| { + const tmp_decl = block_scope.statements.items[init_index]; + const name = tmp_decl.castTag(.var_simple).?.data.name; + init.* = try Tag.identifier.create(c.arena, name); + } + + const array_init = try Tag.array_init.create(c.arena, .{ + .cond = vector_type, + .cases = init_list, + }); + const break_node = try Tag.break_val.create(c.arena, .{ + .label = block_scope.label, + .val = array_init, + }); + try block_scope.statements.append(break_node); + + return block_scope.complete(c); +} + fn transInitListExpr( c: *Context, scope: *Scope, @@ -2235,6 +2433,14 @@ fn transInitListExpr( expr, qual_type, )); + } else if (qual_type.isVectorType()) { + return maybeSuppressResult(c, scope, used, try transInitListExprVector( + c, + scope, + source_loc, + expr, + qual_type, + )); } else { const type_name = c.str(qual_type.getTypeClassName()); return fail(c, error.UnsupportedType, source_loc, "unsupported initlist type: '{s}'", .{type_name}); @@ -4085,6 +4291,15 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan }; return Tag.typeof.create(c.arena, underlying_expr); }, + .Vector => { + const vector_ty = @ptrCast(*const clang.VectorType, ty); + const num_elements = vector_ty.getNumElements(); + const element_qt = vector_ty.getElementType(); + return Tag.std_meta_vector.create(c.arena, .{ + .lhs = try transCreateNodeNumber(c, num_elements, .int), + .rhs = try transQualType(c, scope, element_qt, source_loc), + }); + }, else => { const type_name = c.str(ty.getTypeClassName()); return fail(c, error.UnsupportedType, source_loc, "unsupported type: '{s}'", .{type_name}); diff --git a/src/translate_c/ast.zig b/src/translate_c/ast.zig index 4b595a7940..4be0fead97 100644 --- a/src/translate_c/ast.zig +++ b/src/translate_c/ast.zig @@ -66,6 +66,7 @@ pub const Node = extern union { @"enum", @"struct", @"union", + @"comptime", array_init, tuple, container_init, @@ -154,6 +155,8 @@ pub const Node = extern union { div_exact, /// @byteOffsetOf(lhs, rhs) byte_offset_of, + /// @shuffle(type, a, b, mask) + shuffle, negate, negate_wrap, @@ -172,6 +175,7 @@ pub const Node = extern union { sizeof, alignof, typeof, + typeinfo, type, optional_type, @@ -182,6 +186,10 @@ pub const Node = extern union { /// @import("std").meta.sizeof(operand) std_meta_sizeof, + /// @import("std").meta.shuffleVectorIndex(lhs, rhs) + std_meta_shuffle_vector_index, + /// @import("std").meta.Vector(lhs, rhs) + std_meta_vector, /// @import("std").mem.zeroes(operand) std_mem_zeroes, /// @import("std").mem.zeroInit(lhs, rhs) @@ -233,6 +241,7 @@ pub const Node = extern union { .std_mem_zeroes, .@"return", + .@"comptime", .discard, .std_math_Log2Int, .negate, @@ -255,6 +264,7 @@ pub const Node = extern union { .sizeof, .alignof, .typeof, + .typeinfo, => Payload.UnOp, .add, @@ -308,6 +318,8 @@ pub const Node = extern union { .align_cast, .array_access, .std_mem_zeroinit, + .std_meta_shuffle_vector_index, + .std_meta_vector, .ptr_cast, .div_exact, .byte_offset_of, @@ -346,6 +358,7 @@ pub const Node = extern union { .pub_inline_fn => Payload.PubInlineFn, .field_access => Payload.FieldAccess, .string_slice => Payload.StringSlice, + .shuffle => Payload.Shuffle, }; } @@ -678,6 +691,16 @@ pub const Payload = struct { end: usize, }, }; + + pub const Shuffle = struct { + base: Payload, + data: struct { + element_type: Node, + a: Node, + b: Node, + mask_vector: Node, + }, + }; }; /// Converts the nodes into a Zig ast. @@ -868,6 +891,16 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { const import_node = try renderStdImport(c, "mem", "zeroInit"); return renderCall(c, import_node, &.{ payload.lhs, payload.rhs }); }, + .std_meta_shuffle_vector_index => { + const payload = node.castTag(.std_meta_shuffle_vector_index).?.data; + const import_node = try renderStdImport(c, "meta", "shuffleVectorIndex"); + return renderCall(c, import_node, &.{ payload.lhs, payload.rhs }); + }, + .std_meta_vector => { + const payload = node.castTag(.std_meta_vector).?.data; + const import_node = try renderStdImport(c, "meta", "Vector"); + return renderCall(c, import_node, &.{ payload.lhs, payload.rhs }); + }, .call => { const payload = node.castTag(.call).?.data; const lhs = try renderNode(c, payload.lhs); @@ -964,6 +997,17 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { }, }); }, + .@"comptime" => { + const payload = node.castTag(.@"comptime").?.data; + return c.addNode(.{ + .tag = .@"comptime", + .main_token = try c.addToken(.keyword_comptime, "comptime"), + .data = .{ + .lhs = try renderNode(c, payload), + .rhs = undefined, + }, + }); + }, .type => { const payload = node.castTag(.type).?.data; return c.addNode(.{ @@ -1217,6 +1261,15 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { const payload = node.castTag(.sizeof).?.data; return renderBuiltinCall(c, "@sizeOf", &.{payload}); }, + .shuffle => { + const payload = node.castTag(.shuffle).?.data; + return renderBuiltinCall(c, "@shuffle", &.{ + payload.element_type, + payload.a, + payload.b, + payload.mask_vector, + }); + }, .alignof => { const payload = node.castTag(.alignof).?.data; return renderBuiltinCall(c, "@alignOf", &.{payload}); @@ -1225,6 +1278,10 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { const payload = node.castTag(.typeof).?.data; return renderBuiltinCall(c, "@TypeOf", &.{payload}); }, + .typeinfo => { + const payload = node.castTag(.typeinfo).?.data; + return renderBuiltinCall(c, "@typeInfo", &.{payload}); + }, .negate => return renderPrefixOp(c, node, .negation, .minus, "-"), .negate_wrap => return renderPrefixOp(c, node, .negation_wrap, .minus_percent, "-%"), .bit_not => return renderPrefixOp(c, node, .bit_not, .tilde, "~"), @@ -2085,9 +2142,12 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { .sizeof, .alignof, .typeof, + .typeinfo, .std_meta_sizeof, .std_meta_cast, .std_meta_promoteIntLiteral, + .std_meta_vector, + .std_meta_shuffle_vector_index, .std_mem_zeroinit, .integer_literal, .float_literal, @@ -2118,6 +2178,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { .bool_to_int, .div_exact, .byte_offset_of, + .shuffle, => { // no grouping needed return renderNode(c, node); @@ -2185,6 +2246,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { .discard, .@"continue", .@"return", + .@"comptime", .usingnamespace_builtins, .while_true, .if_not_break, @@ -2327,6 +2389,8 @@ fn renderBuiltinCall(c: *Context, builtin: []const u8, args: []const Node) !Node _ = try c.addToken(.l_paren, "("); var arg_1: NodeIndex = 0; var arg_2: NodeIndex = 0; + var arg_3: NodeIndex = 0; + var arg_4: NodeIndex = 0; switch (args.len) { 0 => {}, 1 => { @@ -2337,18 +2401,41 @@ fn renderBuiltinCall(c: *Context, builtin: []const u8, args: []const Node) !Node _ = try c.addToken(.comma, ","); arg_2 = try renderNode(c, args[1]); }, + 4 => { + arg_1 = try renderNode(c, args[0]); + _ = try c.addToken(.comma, ","); + arg_2 = try renderNode(c, args[1]); + _ = try c.addToken(.comma, ","); + arg_3 = try renderNode(c, args[2]); + _ = try c.addToken(.comma, ","); + arg_4 = try renderNode(c, args[3]); + }, else => unreachable, // expand this function as needed. } _ = try c.addToken(.r_paren, ")"); - return c.addNode(.{ - .tag = .builtin_call_two, - .main_token = builtin_tok, - .data = .{ - .lhs = arg_1, - .rhs = arg_2, - }, - }); + if (args.len <= 2) { + return c.addNode(.{ + .tag = .builtin_call_two, + .main_token = builtin_tok, + .data = .{ + .lhs = arg_1, + .rhs = arg_2, + }, + }); + } else { + std.debug.assert(args.len == 4); + + const params = try c.listToSpan(&.{ arg_1, arg_2, arg_3, arg_4 }); + return c.addNode(.{ + .tag = .builtin_call, + .main_token = builtin_tok, + .data = .{ + .lhs = params.start, + .rhs = params.end, + }, + }); + } } fn renderVar(c: *Context, node: Node) !NodeIndex { diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp index 95e9e390a1..526371b792 100644 --- a/src/zig_clang.cpp +++ b/src/zig_clang.cpp @@ -2046,6 +2046,11 @@ bool ZigClangType_isRecordType(const ZigClangType *self) { return casted->isRecordType(); } +bool ZigClangType_isVectorType(const ZigClangType *self) { + auto casted = reinterpret_cast(self); + return casted->isVectorType(); +} + bool ZigClangType_isIncompleteOrZeroLengthArrayType(const ZigClangQualType *self, const struct ZigClangASTContext *ctx) { @@ -2738,6 +2743,16 @@ struct ZigClangQualType ZigClangBinaryOperator_getType(const struct ZigClangBina return bitcast(casted->getType()); } +const struct ZigClangExpr *ZigClangConvertVectorExpr_getSrcExpr(const struct ZigClangConvertVectorExpr *self) { + auto casted = reinterpret_cast(self); + return reinterpret_cast(casted->getSrcExpr()); +} + +struct ZigClangQualType ZigClangConvertVectorExpr_getTypeSourceInfo_getType(const struct ZigClangConvertVectorExpr *self) { + auto casted = reinterpret_cast(self); + return bitcast(casted->getTypeSourceInfo()->getType()); +} + struct ZigClangQualType ZigClangDecayedType_getDecayedType(const struct ZigClangDecayedType *self) { auto casted = reinterpret_cast(self); return bitcast(casted->getDecayedType()); @@ -2843,6 +2858,16 @@ struct ZigClangQualType ZigClangValueDecl_getType(const struct ZigClangValueDecl return bitcast(casted->getType()); } +struct ZigClangQualType ZigClangVectorType_getElementType(const struct ZigClangVectorType *self) { + auto casted = reinterpret_cast(self); + return bitcast(casted->getElementType()); +} + +unsigned ZigClangVectorType_getNumElements(const struct ZigClangVectorType *self) { + auto casted = reinterpret_cast(self); + return casted->getNumElements(); +} + const struct ZigClangExpr *ZigClangWhileStmt_getCond(const struct ZigClangWhileStmt *self) { auto casted = reinterpret_cast(self); return reinterpret_cast(casted->getCond()); @@ -2922,6 +2947,15 @@ struct ZigClangSourceLocation ZigClangUnaryExprOrTypeTraitExpr_getBeginLoc( return bitcast(casted->getBeginLoc()); } +unsigned ZigClangShuffleVectorExpr_getNumSubExprs(const ZigClangShuffleVectorExpr *self) { + auto casted = reinterpret_cast(self); + return casted->getNumSubExprs(); +} + +const struct ZigClangExpr *ZigClangShuffleVectorExpr_getExpr(const struct ZigClangShuffleVectorExpr *self, unsigned idx) { + auto casted = reinterpret_cast(self); + return reinterpret_cast(casted->getExpr(idx)); +} enum ZigClangUnaryExprOrTypeTrait_Kind ZigClangUnaryExprOrTypeTraitExpr_getKind( const struct ZigClangUnaryExprOrTypeTraitExpr *self) diff --git a/src/zig_clang.h b/src/zig_clang.h index 59eacf7587..b9d875c61a 100644 --- a/src/zig_clang.h +++ b/src/zig_clang.h @@ -1064,6 +1064,7 @@ ZIG_EXTERN_C bool ZigClangType_isBooleanType(const struct ZigClangType *self); ZIG_EXTERN_C bool ZigClangType_isVoidType(const struct ZigClangType *self); ZIG_EXTERN_C bool ZigClangType_isArrayType(const struct ZigClangType *self); ZIG_EXTERN_C bool ZigClangType_isRecordType(const struct ZigClangType *self); +ZIG_EXTERN_C bool ZigClangType_isVectorType(const struct ZigClangType *self); ZIG_EXTERN_C bool ZigClangType_isIncompleteOrZeroLengthArrayType(const ZigClangQualType *self, const struct ZigClangASTContext *ctx); ZIG_EXTERN_C bool ZigClangType_isConstantArrayType(const ZigClangType *self); ZIG_EXTERN_C const char *ZigClangType_getTypeClassName(const struct ZigClangType *self); @@ -1199,6 +1200,9 @@ ZIG_EXTERN_C const struct ZigClangExpr *ZigClangBinaryOperator_getLHS(const stru ZIG_EXTERN_C const struct ZigClangExpr *ZigClangBinaryOperator_getRHS(const struct ZigClangBinaryOperator *); ZIG_EXTERN_C struct ZigClangQualType ZigClangBinaryOperator_getType(const struct ZigClangBinaryOperator *); +ZIG_EXTERN_C const struct ZigClangExpr *ZigClangConvertVectorExpr_getSrcExpr(const struct ZigClangConvertVectorExpr *); +ZIG_EXTERN_C struct ZigClangQualType ZigClangConvertVectorExpr_getTypeSourceInfo_getType(const struct ZigClangConvertVectorExpr *); + ZIG_EXTERN_C struct ZigClangQualType ZigClangDecayedType_getDecayedType(const struct ZigClangDecayedType *); ZIG_EXTERN_C const struct ZigClangCompoundStmt *ZigClangStmtExpr_getSubStmt(const struct ZigClangStmtExpr *); @@ -1228,6 +1232,9 @@ ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangUnaryOperator_getBeginLoc(con ZIG_EXTERN_C struct ZigClangQualType ZigClangValueDecl_getType(const struct ZigClangValueDecl *); +ZIG_EXTERN_C struct ZigClangQualType ZigClangVectorType_getElementType(const struct ZigClangVectorType *); +ZIG_EXTERN_C unsigned ZigClangVectorType_getNumElements(const struct ZigClangVectorType *); + ZIG_EXTERN_C const struct ZigClangExpr *ZigClangWhileStmt_getCond(const struct ZigClangWhileStmt *); ZIG_EXTERN_C const struct ZigClangStmt *ZigClangWhileStmt_getBody(const struct ZigClangWhileStmt *); @@ -1252,6 +1259,9 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangUnaryExprOrTypeTraitExpr_getTypeOfA ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangUnaryExprOrTypeTraitExpr_getBeginLoc(const struct ZigClangUnaryExprOrTypeTraitExpr *); ZIG_EXTERN_C enum ZigClangUnaryExprOrTypeTrait_Kind ZigClangUnaryExprOrTypeTraitExpr_getKind(const struct ZigClangUnaryExprOrTypeTraitExpr *); +ZIG_EXTERN_C unsigned ZigClangShuffleVectorExpr_getNumSubExprs(const struct ZigClangShuffleVectorExpr *); +ZIG_EXTERN_C const struct ZigClangExpr *ZigClangShuffleVectorExpr_getExpr(const struct ZigClangShuffleVectorExpr *, unsigned); + ZIG_EXTERN_C const struct ZigClangStmt *ZigClangDoStmt_getBody(const struct ZigClangDoStmt *); ZIG_EXTERN_C const struct ZigClangExpr *ZigClangDoStmt_getCond(const struct ZigClangDoStmt *); diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig index 6cac9cd79d..8f4c568aa2 100644 --- a/test/run_translated_c.zig +++ b/test/run_translated_c.zig @@ -1308,4 +1308,106 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { \\ ufoo = (uval += 100000000); // compile error if @truncate() not inserted \\} , ""); + + cases.add("basic vector expressions", + \\#include + \\#include + \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); + \\int main(int argc, char**argv) { + \\ __v8hi uninitialized; + \\ __v8hi empty_init = {}; + \\ __v8hi partial_init = {0, 1, 2, 3}; + \\ + \\ __v8hi a = {0, 1, 2, 3, 4, 5, 6, 7}; + \\ __v8hi b = (__v8hi) {100, 200, 300, 400, 500, 600, 700, 800}; + \\ + \\ __v8hi sum = a + b; + \\ for (int i = 0; i < 8; i++) { + \\ if (sum[i] != a[i] + b[i]) abort(); + \\ } + \\ return 0; + \\} + , ""); + + cases.add("__builtin_shufflevector", + \\#include + \\#include + \\typedef int16_t __v4hi __attribute__((__vector_size__(8))); + \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); + \\int main(int argc, char**argv) { + \\ __v8hi v8_a = {0, 1, 2, 3, 4, 5, 6, 7}; + \\ __v8hi v8_b = {100, 200, 300, 400, 500, 600, 700, 800}; + \\ __v8hi shuffled = __builtin_shufflevector(v8_a, v8_b, 0, 1, 2, 3, 8, 9, 10, 11); + \\ for (int i = 0; i < 8; i++) { + \\ if (i < 4) { + \\ if (shuffled[i] != v8_a[i]) abort(); + \\ } else { + \\ if (shuffled[i] != v8_b[i - 4]) abort(); + \\ } + \\ } + \\ shuffled = __builtin_shufflevector( + \\ (__v8hi) {-1, -1, -1, -1, -1, -1, -1, -1}, + \\ (__v8hi) {42, 42, 42, 42, 42, 42, 42, 42}, + \\ 0, 1, 2, 3, 8, 9, 10, 11 + \\ ); + \\ for (int i = 0; i < 8; i++) { + \\ if (i < 4) { + \\ if (shuffled[i] != -1) abort(); + \\ } else { + \\ if (shuffled[i] != 42) abort(); + \\ } + \\ } + \\ __v4hi shuffled_to_fewer_elements = __builtin_shufflevector(v8_a, v8_b, 0, 1, 8, 9); + \\ for (int i = 0; i < 4; i++) { + \\ if (i < 2) { + \\ if (shuffled_to_fewer_elements[i] != v8_a[i]) abort(); + \\ } else { + \\ if (shuffled_to_fewer_elements[i] != v8_b[i - 2]) abort(); + \\ } + \\ } + \\ __v4hi v4_a = {0, 1, 2, 3}; + \\ __v4hi v4_b = {100, 200, 300, 400}; + \\ __v8hi shuffled_to_more_elements = __builtin_shufflevector(v4_a, v4_b, 0, 1, 2, 3, 4, 5, 6, 7); + \\ for (int i = 0; i < 4; i++) { + \\ if (shuffled_to_more_elements[i] != v4_a[i]) abort(); + \\ if (shuffled_to_more_elements[i + 4] != v4_b[i]) abort(); + \\ } + \\ return 0; + \\} + , ""); + + cases.add("__builtin_convertvector", + \\#include + \\#include + \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); + \\typedef uint16_t __v8hu __attribute__((__vector_size__(16))); + \\int main(int argc, char**argv) { + \\ __v8hi signed_vector = { 1, 2, 3, 4, -1, -2, -3,-4}; + \\ __v8hu unsigned_vector = __builtin_convertvector(signed_vector, __v8hu); + \\ + \\ for (int i = 0; i < 8; i++) { + \\ if (unsigned_vector[i] != (uint16_t)signed_vector[i]) abort(); + \\ } + \\ return 0; + \\} + , ""); + + cases.add("vector casting", + \\#include + \\#include + \\typedef int8_t __v8qi __attribute__((__vector_size__(8))); + \\typedef uint8_t __v8qu __attribute__((__vector_size__(8))); + \\int main(int argc, char**argv) { + \\ __v8qi signed_vector = { 1, 2, 3, 4, -1, -2, -3,-4}; + \\ + \\ uint64_t big_int = (uint64_t) signed_vector; + \\ if (big_int != 0x01020304FFFEFDFCULL && big_int != 0xFCFDFEFF04030201ULL) abort(); + \\ __v8qu unsigned_vector = (__v8qu) big_int; + \\ for (int i = 0; i < 8; i++) { + \\ if (unsigned_vector[i] != (uint8_t)signed_vector[i] && unsigned_vector[i] != (uint8_t)signed_vector[7 - i]) abort(); + \\ } + \\ return 0; + \\} + , ""); + } From ac2211118fe9030aa8a524549c9bb7caf8795f4d Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Tue, 6 Apr 2021 21:14:00 +0200 Subject: [PATCH 024/101] stage2 regalloc: Add getReg and getRegWithoutTracking --- src/codegen.zig | 36 ++++++++++++++++++--------- src/register_manager.zig | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/codegen.zig b/src/codegen.zig index fbd412ceba..cacf51730a 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -1783,8 +1783,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { switch (mc_arg) { .none => continue, .register => |reg| { + try self.register_manager.getRegWithoutTracking(reg); try self.genSetReg(arg.src, arg.ty, reg, arg_mcv); - // TODO interact with the register allocator to mark the instruction as moved. }, .stack_offset => { // Here we need to emit instructions like this: @@ -1925,8 +1925,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { .compare_flags_signed => unreachable, .compare_flags_unsigned => unreachable, .register => |reg| { + try self.register_manager.getRegWithoutTracking(reg); try self.genSetReg(arg.src, arg.ty, reg, arg_mcv); - // TODO interact with the register allocator to mark the instruction as moved. }, .stack_offset => { return self.fail(inst.base.src, "TODO implement calling with parameters in memory", .{}); @@ -1988,8 +1988,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { .compare_flags_signed => unreachable, .compare_flags_unsigned => unreachable, .register => |reg| { + try self.register_manager.getRegWithoutTracking(reg); try self.genSetReg(arg.src, arg.ty, reg, arg_mcv); - // TODO interact with the register allocator to mark the instruction as moved. }, .stack_offset => { return self.fail(inst.base.src, "TODO implement calling with parameters in memory", .{}); @@ -2039,8 +2039,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { switch (mc_arg) { .none => continue, .register => |reg| { + try self.register_manager.getRegWithoutTracking(reg); try self.genSetReg(arg.src, arg.ty, reg, arg_mcv); - // TODO interact with the register allocator to mark the instruction as moved. }, .stack_offset => { // Here we need to emit instructions like this: @@ -2704,8 +2704,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { const reg_name = input[1 .. input.len - 1]; const reg = parseRegName(reg_name) orelse return self.fail(inst.base.src, "unrecognized register: '{s}'", .{reg_name}); - const arg = try self.resolveInst(inst.args[i]); - try self.genSetReg(inst.base.src, inst.args[i].ty, reg, arg); + + const arg = inst.args[i]; + const arg_mcv = try self.resolveInst(arg); + try self.register_manager.getRegWithoutTracking(reg); + try self.genSetReg(inst.base.src, arg.ty, reg, arg_mcv); } if (mem.eql(u8, inst.asm_source, "svc #0")) { @@ -2734,8 +2737,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { const reg_name = input[1 .. input.len - 1]; const reg = parseRegName(reg_name) orelse return self.fail(inst.base.src, "unrecognized register: '{s}'", .{reg_name}); - const arg = try self.resolveInst(inst.args[i]); - try self.genSetReg(inst.base.src, inst.args[i].ty, reg, arg); + + const arg = inst.args[i]; + const arg_mcv = try self.resolveInst(arg); + try self.register_manager.getRegWithoutTracking(reg); + try self.genSetReg(inst.base.src, arg.ty, reg, arg_mcv); } if (mem.eql(u8, inst.asm_source, "svc #0")) { @@ -2766,8 +2772,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { const reg_name = input[1 .. input.len - 1]; const reg = parseRegName(reg_name) orelse return self.fail(inst.base.src, "unrecognized register: '{s}'", .{reg_name}); - const arg = try self.resolveInst(inst.args[i]); - try self.genSetReg(inst.base.src, inst.args[i].ty, reg, arg); + + const arg = inst.args[i]; + const arg_mcv = try self.resolveInst(arg); + try self.register_manager.getRegWithoutTracking(reg); + try self.genSetReg(inst.base.src, arg.ty, reg, arg_mcv); } if (mem.eql(u8, inst.asm_source, "ecall")) { @@ -2796,8 +2805,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { const reg_name = input[1 .. input.len - 1]; const reg = parseRegName(reg_name) orelse return self.fail(inst.base.src, "unrecognized register: '{s}'", .{reg_name}); - const arg = try self.resolveInst(inst.args[i]); - try self.genSetReg(inst.base.src, inst.args[i].ty, reg, arg); + + const arg = inst.args[i]; + const arg_mcv = try self.resolveInst(arg); + try self.register_manager.getRegWithoutTracking(reg); + try self.genSetReg(inst.base.src, arg.ty, reg, arg_mcv); } if (mem.eql(u8, inst.asm_source, "syscall")) { diff --git a/src/register_manager.zig b/src/register_manager.zig index abb1632165..356251eed8 100644 --- a/src/register_manager.zig +++ b/src/register_manager.zig @@ -35,6 +35,10 @@ pub fn RegisterManager( self.registers.deinit(allocator); } + fn isTracked(reg: Register) bool { + return std.mem.indexOfScalar(Register, callee_preserved_regs, reg) != null; + } + fn markRegUsed(self: *Self, reg: Register) void { if (FreeRegInt == u0) return; const index = reg.allocIndex() orelse return; @@ -51,6 +55,13 @@ pub fn RegisterManager( self.free_registers |= @as(FreeRegInt, 1) << shift; } + pub fn isRegFree(self: Self, reg: Register) bool { + if (FreeRegInt == u0) return true; + const index = reg.allocIndex() orelse return true; + const shift = @intCast(ShiftInt, index); + return self.free_registers & @as(FreeRegInt, 1) << shift != 0; + } + /// Returns whether this register was allocated in the course /// of this function pub fn isRegAllocated(self: Self, reg: Register) bool { @@ -117,17 +128,59 @@ pub fn RegisterManager( const regs_entry = self.registers.remove(reg).?; const spilled_inst = regs_entry.value; try self.getFunction().spillInstruction(spilled_inst.src, reg, spilled_inst); + self.markRegFree(reg); break :b reg; }; } + /// Allocates the specified register with the specified + /// instruction. Spills the register if it is currently + /// allocated. + pub fn getReg(self: *Self, reg: Register, inst: *ir.Inst) !void { + if (!isTracked(reg)) return; + + if (!self.isRegFree(reg)) { + // Move the instruction that was previously there to a + // stack allocation. + const regs_entry = self.registers.getEntry(reg).?; + const spilled_inst = regs_entry.value; + regs_entry.value = inst; + try self.getFunction().spillInstruction(spilled_inst.src, reg, spilled_inst); + } else { + try self.getRegAssumeFree(reg, inst); + } + } + + /// Spills the register if it is currently allocated. + /// Does not track the register. + pub fn getRegWithoutTracking(self: *Self, reg: Register) !void { + if (!isTracked(reg)) return; + + if (!self.isRegFree(reg)) { + // Move the instruction that was previously there to a + // stack allocation. + const regs_entry = self.registers.getEntry(reg).?; + const spilled_inst = regs_entry.value; + try self.getFunction().spillInstruction(spilled_inst.src, reg, spilled_inst); + self.markRegFree(reg); + } + } + + /// Allocates the specified register with the specified + /// instruction. Assumes that the register is free and no + /// spilling is necessary. pub fn getRegAssumeFree(self: *Self, reg: Register, inst: *ir.Inst) !void { + if (!isTracked(reg)) return; + try self.registers.putNoClobber(self.getFunction().gpa, reg, inst); self.markRegUsed(reg); } + /// Marks the specified register as free pub fn freeReg(self: *Self, reg: Register) void { + if (!isTracked(reg)) return; + _ = self.registers.remove(reg); self.markRegFree(reg); } From b40d36c90ba894a12f2de4e6c881642edffad3ed Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Apr 2021 17:43:56 -0700 Subject: [PATCH 025/101] stage2: implement simple enums A simple enum is an enum which has an automatic integer tag type, all tag values automatically assigned, and no top level declarations. Such enums are created directly in AstGen and shared by all the generic/comptime instantiations of the surrounding ZIR code. This commit implements, but does not yet add any test cases for, simple enums. A full enum is an enum for which any of the above conditions are not true. Full enums are created in Sema, and therefore will create a unique type per generic/comptime instantiation. This commit does not implement full enums. However the `enum_decl_nonexhaustive` ZIR instruction is added and the respective Type functions are filled out. This commit makes an improvement to ZIR code, removing the decls array and removing the decl_map from AstGen. Instead, decl_ref and decl_val ZIR instructions index into the `owner_decl.dependencies` ArrayHashMap. We already need this dependencies array for incremental compilation purposes, and so repurposing it to also use it for ZIR decl indexes makes for efficient memory usage. Similarly, this commit fixes up incorrect memory management by removing the `const` ZIR instruction. The two places it was used stored memory in the AstGen arena, which may get freed after Sema. Now it properly sets up a new anonymous Decl for error sets and uses a normal decl_val instruction. The other usage of `const` ZIR instruction was float literals. These are now changed to use `float` ZIR instruction when the value fits inside `zir.Inst.Data` and `float128` otherwise. AstGen + Sema: implement int_to_enum and enum_to_int. No tests yet; I expect to have to make some fixes before they will pass tests. Will do that in the branch before merging. AstGen: fix struct astgen incorrectly counting decls as fields. Type/Value: give up on trying to exhaustively list every tag all the time. This makes the file more manageable. Also found a bug with i128/u128 this way, since the name of the function was more obvious when looking at the tag values. Type: implement abiAlignment and abiSize for structs. This will need to get more sophisticated at some point, but for now it is progress. Value: add new `enum_field_index` tag. Value: add hash_u32, needed when using ArrayHashMap. --- src/AstGen.zig | 290 ++++++-- src/BuiltinFn.zig | 2 +- src/Module.zig | 96 ++- src/Sema.zig | 172 ++++- src/type.zig | 1785 +++++++-------------------------------------- src/value.zig | 837 ++------------------- src/zir.zig | 87 ++- 7 files changed, 862 insertions(+), 2407 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 6c3ce1251c..af9938d425 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -28,8 +28,6 @@ const BuiltinFn = @import("BuiltinFn.zig"); instructions: std.MultiArrayList(zir.Inst) = .{}, string_bytes: ArrayListUnmanaged(u8) = .{}, extra: ArrayListUnmanaged(u32) = .{}, -decl_map: std.StringArrayHashMapUnmanaged(void) = .{}, -decls: ArrayListUnmanaged(*Decl) = .{}, /// The end of special indexes. `zir.Inst.Ref` subtracts against this number to convert /// to `zir.Inst.Index`. The default here is correct if there are 0 parameters. ref_start_index: u32 = zir.Inst.Ref.typed_value_map.len, @@ -110,8 +108,6 @@ pub fn deinit(astgen: *AstGen) void { astgen.instructions.deinit(gpa); astgen.extra.deinit(gpa); astgen.string_bytes.deinit(gpa); - astgen.decl_map.deinit(gpa); - astgen.decls.deinit(gpa); } pub const ResultLoc = union(enum) { @@ -1183,13 +1179,6 @@ fn blockExprStmts( // in the above while loop. const zir_tags = gz.astgen.instructions.items(.tag); switch (zir_tags[inst]) { - .@"const" => { - const tv = gz.astgen.instructions.items(.data)[inst].@"const"; - break :b switch (tv.ty.zigTypeTag()) { - .NoReturn, .Void => true, - else => false, - }; - }, // For some instructions, swap in a slightly different ZIR tag // so we can avoid a separate ensure_result_used instruction. .call_none_chkused => unreachable, @@ -1257,6 +1246,8 @@ fn blockExprStmts( .fn_type_cc, .fn_type_cc_var_args, .int, + .float, + .float128, .intcast, .int_type, .is_non_null, @@ -1334,7 +1325,10 @@ fn blockExprStmts( .struct_decl_extern, .union_decl, .enum_decl, + .enum_decl_nonexhaustive, .opaque_decl, + .int_to_enum, + .enum_to_int, => break :b false, // ZIR instructions that are always either `noreturn` or `void`. @@ -1823,15 +1817,18 @@ fn containerDecl( defer bit_bag.deinit(gpa); var cur_bit_bag: u32 = 0; - var member_index: usize = 0; - while (true) { - const member_node = container_decl.ast.members[member_index]; + var field_index: usize = 0; + for (container_decl.ast.members) |member_node| { const member = switch (node_tags[member_node]) { .container_field_init => tree.containerFieldInit(member_node), .container_field_align => tree.containerFieldAlign(member_node), .container_field => tree.containerField(member_node), - else => unreachable, + else => continue, }; + if (field_index % 16 == 0 and field_index != 0) { + try bit_bag.append(gpa, cur_bit_bag); + cur_bit_bag = 0; + } if (member.comptime_token) |comptime_token| { return mod.failTok(scope, comptime_token, "TODO implement comptime struct fields", .{}); } @@ -1858,17 +1855,9 @@ fn containerDecl( fields_data.appendAssumeCapacity(@enumToInt(default_inst)); } - member_index += 1; - if (member_index < container_decl.ast.members.len) { - if (member_index % 16 == 0) { - try bit_bag.append(gpa, cur_bit_bag); - cur_bit_bag = 0; - } - } else { - break; - } + field_index += 1; } - const empty_slot_count = 16 - ((member_index - 1) % 16); + const empty_slot_count = 16 - ((field_index - 1) % 16); cur_bit_bag >>= @intCast(u5, empty_slot_count * 2); const result = try gz.addPlNode(tag, node, zir.Inst.StructDecl{ @@ -1885,7 +1874,172 @@ fn containerDecl( return mod.failTok(scope, container_decl.ast.main_token, "TODO AstGen for union decl", .{}); }, .keyword_enum => { - return mod.failTok(scope, container_decl.ast.main_token, "TODO AstGen for enum decl", .{}); + if (container_decl.layout_token) |t| { + return mod.failTok(scope, t, "enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", .{}); + } + // Count total fields as well as how many have explicitly provided tag values. + const counts = blk: { + var values: usize = 0; + var total_fields: usize = 0; + var decls: usize = 0; + var nonexhaustive_node: ast.Node.Index = 0; + for (container_decl.ast.members) |member_node| { + const member = switch (node_tags[member_node]) { + .container_field_init => tree.containerFieldInit(member_node), + .container_field_align => tree.containerFieldAlign(member_node), + .container_field => tree.containerField(member_node), + else => { + decls += 1; + continue; + }, + }; + if (member.comptime_token) |comptime_token| { + return mod.failTok(scope, comptime_token, "enum fields cannot be marked comptime", .{}); + } + if (member.ast.type_expr != 0) { + return mod.failNode(scope, member.ast.type_expr, "enum fields do not have types", .{}); + } + if (member.ast.align_expr != 0) { + return mod.failNode(scope, member.ast.align_expr, "enum fields do not have alignments", .{}); + } + const name_token = member.ast.name_token; + if (mem.eql(u8, tree.tokenSlice(name_token), "_")) { + if (nonexhaustive_node != 0) { + const msg = msg: { + const msg = try mod.errMsg( + scope, + gz.nodeSrcLoc(member_node), + "redundant non-exhaustive enum mark", + .{}, + ); + errdefer msg.destroy(gpa); + const other_src = gz.nodeSrcLoc(nonexhaustive_node); + try mod.errNote(scope, other_src, msg, "other mark here", .{}); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(scope, msg); + } + nonexhaustive_node = member_node; + if (member.ast.value_expr != 0) { + return mod.failNode(scope, member.ast.value_expr, "'_' is used to mark an enum as non-exhaustive and cannot be assigned a value", .{}); + } + continue; + } + total_fields += 1; + if (member.ast.value_expr != 0) { + values += 1; + } + } + break :blk .{ + .total_fields = total_fields, + .values = values, + .decls = decls, + .nonexhaustive_node = nonexhaustive_node, + }; + }; + if (counts.total_fields == 0) { + // One can construct an enum with no tags, and it functions the same as `noreturn`. But + // this is only useful for generic code; when explicitly using `enum {}` syntax, there + // must be at least one tag. + return mod.failNode(scope, node, "enum declarations must have at least one tag", .{}); + } + if (counts.nonexhaustive_node != 0 and arg_inst == .none) { + const msg = msg: { + const msg = try mod.errMsg( + scope, + gz.nodeSrcLoc(node), + "non-exhaustive enum missing integer tag type", + .{}, + ); + errdefer msg.destroy(gpa); + const other_src = gz.nodeSrcLoc(counts.nonexhaustive_node); + try mod.errNote(scope, other_src, msg, "marked non-exhaustive here", .{}); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(scope, msg); + } + if (counts.values == 0 and counts.decls == 0 and arg_inst == .none) { + // No explicitly provided tag values and no top level declarations! In this case, + // we can construct the enum type in AstGen and it will be correctly shared by all + // generic function instantiations and comptime function calls. + var new_decl_arena = std.heap.ArenaAllocator.init(gpa); + errdefer new_decl_arena.deinit(); + const arena = &new_decl_arena.allocator; + + var fields_map: std.StringArrayHashMapUnmanaged(void) = .{}; + try fields_map.ensureCapacity(arena, counts.total_fields); + for (container_decl.ast.members) |member_node| { + if (member_node == counts.nonexhaustive_node) + continue; + const member = switch (node_tags[member_node]) { + .container_field_init => tree.containerFieldInit(member_node), + .container_field_align => tree.containerFieldAlign(member_node), + .container_field => tree.containerField(member_node), + else => unreachable, // We checked earlier. + }; + const name_token = member.ast.name_token; + const tag_name = try mod.identifierTokenStringTreeArena( + scope, + name_token, + tree, + arena, + ); + const gop = fields_map.getOrPutAssumeCapacity(tag_name); + if (gop.found_existing) { + const msg = msg: { + const msg = try mod.errMsg( + scope, + gz.tokSrcLoc(name_token), + "duplicate enum tag", + .{}, + ); + errdefer msg.destroy(gpa); + // Iterate to find the other tag. We don't eagerly store it in a hash + // map because in the hot path there will be no compile error and we + // don't need to waste time with a hash map. + const bad_node = for (container_decl.ast.members) |other_member_node| { + const other_member = switch (node_tags[other_member_node]) { + .container_field_init => tree.containerFieldInit(member_node), + .container_field_align => tree.containerFieldAlign(member_node), + .container_field => tree.containerField(member_node), + else => unreachable, // We checked earlier. + }; + const other_tag_name = try mod.identifierTokenStringTreeArena( + scope, + name_token, + tree, + arena, + ); + if (mem.eql(u8, tag_name, other_tag_name)) + break other_member_node; + } else unreachable; + const other_src = gz.nodeSrcLoc(bad_node); + try mod.errNote(scope, other_src, msg, "other tag here", .{}); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(scope, msg); + } + } + const enum_simple = try arena.create(Module.EnumSimple); + enum_simple.* = .{ + .owner_decl = astgen.decl, + .node_offset = astgen.decl.nodeIndexToRelative(node), + .fields = fields_map, + }; + const enum_ty = try Type.Tag.enum_simple.create(arena, enum_simple); + const enum_val = try Value.Tag.ty.create(arena, enum_ty); + const new_decl = try mod.createAnonymousDecl(scope, &new_decl_arena, .{ + .ty = Type.initTag(.type), + .val = enum_val, + }); + const decl_index = try mod.declareDeclDependency(astgen.decl, new_decl); + const result = try gz.addDecl(.decl_val, decl_index, node); + return rvalue(gz, scope, rl, result, node); + } + // In this case we must generate ZIR code for the tag values, similar to + // how structs are handled above. The new anonymous Decl will be created in + // Sema, not AstGen. + return mod.failNode(scope, node, "TODO AstGen for enum decl with decls or explicitly provided field values", .{}); }, .keyword_opaque => { const result = try gz.addNode(.opaque_decl, node); @@ -1901,11 +2055,11 @@ fn errorSetDecl( rl: ResultLoc, node: ast.Node.Index, ) InnerError!zir.Inst.Ref { - const mod = gz.astgen.mod; + const astgen = gz.astgen; + const mod = astgen.mod; const tree = gz.tree(); const main_tokens = tree.nodes.items(.main_token); const token_tags = tree.tokens.items(.tag); - const arena = gz.astgen.arena; // Count how many fields there are. const error_token = main_tokens[node]; @@ -1922,6 +2076,11 @@ fn errorSetDecl( } else unreachable; // TODO should not need else unreachable here }; + const gpa = mod.gpa; + var new_decl_arena = std.heap.ArenaAllocator.init(gpa); + errdefer new_decl_arena.deinit(); + const arena = &new_decl_arena.allocator; + const fields = try arena.alloc([]const u8, count); { var tok_i = error_token + 2; @@ -1930,7 +2089,7 @@ fn errorSetDecl( switch (token_tags[tok_i]) { .doc_comment, .comma => {}, .identifier => { - fields[field_i] = try mod.identifierTokenString(scope, tok_i); + fields[field_i] = try mod.identifierTokenStringTreeArena(scope, tok_i, tree, arena); field_i += 1; }, .r_brace => break, @@ -1940,18 +2099,19 @@ fn errorSetDecl( } const error_set = try arena.create(Module.ErrorSet); error_set.* = .{ - .owner_decl = gz.astgen.decl, - .node_offset = gz.astgen.decl.nodeIndexToRelative(node), + .owner_decl = astgen.decl, + .node_offset = astgen.decl.nodeIndexToRelative(node), .names_ptr = fields.ptr, .names_len = @intCast(u32, fields.len), }; const error_set_ty = try Type.Tag.error_set.create(arena, error_set); - const typed_value = try arena.create(TypedValue); - typed_value.* = .{ + const error_set_val = try Value.Tag.ty.create(arena, error_set_ty); + const new_decl = try mod.createAnonymousDecl(scope, &new_decl_arena, .{ .ty = Type.initTag(.type), - .val = try Value.Tag.ty.create(arena, error_set_ty), - }; - const result = try gz.addConst(typed_value); + .val = error_set_val, + }); + const decl_index = try mod.declareDeclDependency(astgen.decl, new_decl); + const result = try gz.addDecl(.decl_val, decl_index, node); return rvalue(gz, scope, rl, result, node); } @@ -3426,7 +3586,8 @@ fn identifier( const tracy = trace(@src()); defer tracy.end(); - const mod = gz.astgen.mod; + const astgen = gz.astgen; + const mod = astgen.mod; const tree = gz.tree(); const main_tokens = tree.nodes.items(.main_token); @@ -3459,7 +3620,7 @@ fn identifier( const result = try gz.add(.{ .tag = .int_type, .data = .{ .int_type = .{ - .src_node = gz.astgen.decl.nodeIndexToRelative(ident), + .src_node = astgen.decl.nodeIndexToRelative(ident), .signedness = signedness, .bit_count = bit_count, } }, @@ -3497,13 +3658,13 @@ fn identifier( }; } - const gop = try gz.astgen.decl_map.getOrPut(mod.gpa, ident_name); - if (!gop.found_existing) { - const decl = mod.lookupDeclName(scope, ident_name) orelse - return mod.failNode(scope, ident, "use of undeclared identifier '{s}'", .{ident_name}); - try gz.astgen.decls.append(mod.gpa, decl); - } - const decl_index = @intCast(u32, gop.index); + const decl = mod.lookupDeclName(scope, ident_name) orelse { + // TODO insert a "dependency on the non-existence of a decl" here to make this + // compile error go away when the decl is introduced. This data should be in a global + // sparse map since it is only relevant when a compile error occurs. + return mod.failNode(scope, ident, "use of undeclared identifier '{s}'", .{ident_name}); + }; + const decl_index = try mod.declareDeclDependency(astgen.decl, decl); switch (rl) { .ref, .none_or_ref => return gz.addDecl(.decl_ref, decl_index, ident), else => return rvalue(gz, scope, rl, try gz.addDecl(.decl_val, decl_index, ident), ident), @@ -3638,12 +3799,23 @@ fn floatLiteral( const float_number = std.fmt.parseFloat(f128, bytes) catch |e| switch (e) { error.InvalidCharacter => unreachable, // validated by tokenizer }; - const typed_value = try arena.create(TypedValue); - typed_value.* = .{ - .ty = Type.initTag(.comptime_float), - .val = try Value.Tag.float_128.create(arena, float_number), - }; - const result = try gz.addConst(typed_value); + // If the value fits into a f32 without losing any precision, store it that way. + @setFloatMode(.Strict); + const smaller_float = @floatCast(f32, float_number); + const bigger_again: f128 = smaller_float; + if (bigger_again == float_number) { + const result = try gz.addFloat(smaller_float, node); + return rvalue(gz, scope, rl, result, node); + } + // We need to use 128 bits. Break the float into 4 u32 values so we can + // put it into the `extra` array. + const int_bits = @bitCast(u128, float_number); + const result = try gz.addPlNode(.float128, node, zir.Inst.Float128{ + .piece0 = @truncate(u32, int_bits), + .piece1 = @truncate(u32, int_bits >> 32), + .piece2 = @truncate(u32, int_bits >> 64), + .piece3 = @truncate(u32, int_bits >> 96), + }); return rvalue(gz, scope, rl, result, node); } @@ -3955,6 +4127,20 @@ fn builtinCall( .bit_cast => return bitCast(gz, scope, rl, node, params[0], params[1]), .TypeOf => return typeOf(gz, scope, rl, node, params), + .int_to_enum => { + const result = try gz.addPlNode(.int_to_enum, node, zir.Inst.Bin{ + .lhs = try typeExpr(gz, scope, params[0]), + .rhs = try expr(gz, scope, .none, params[1]), + }); + return rvalue(gz, scope, rl, result, node); + }, + + .enum_to_int => { + const operand = try expr(gz, scope, .none, params[0]); + const result = try gz.addUnNode(.enum_to_int, operand, node); + return rvalue(gz, scope, rl, result, node); + }, + .add_with_overflow, .align_cast, .align_of, @@ -3981,7 +4167,6 @@ fn builtinCall( .div_floor, .div_trunc, .embed_file, - .enum_to_int, .error_name, .error_return_trace, .err_set_cast, @@ -3991,7 +4176,6 @@ fn builtinCall( .float_to_int, .has_decl, .has_field, - .int_to_enum, .int_to_float, .int_to_ptr, .memcpy, diff --git a/src/BuiltinFn.zig b/src/BuiltinFn.zig index 1710169dc7..a5d15554af 100644 --- a/src/BuiltinFn.zig +++ b/src/BuiltinFn.zig @@ -484,7 +484,7 @@ pub const list = list: { "@intToEnum", .{ .tag = .int_to_enum, - .param_count = 1, + .param_count = 2, }, }, .{ diff --git a/src/Module.zig b/src/Module.zig index bab61730e5..8c58b63995 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -290,6 +290,18 @@ pub const Decl = struct { return decl.container.fullyQualifiedNameHash(mem.spanZ(decl.name)); } + pub fn renderFullyQualifiedName(decl: Decl, writer: anytype) !void { + const unqualified_name = mem.spanZ(decl.name); + return decl.container.renderFullyQualifiedName(unqualified_name, writer); + } + + pub fn getFullyQualifiedName(decl: Decl, gpa: *Allocator) ![]u8 { + var buffer = std.ArrayList(u8).init(gpa); + defer buffer.deinit(); + try decl.renderFullyQualifiedName(buffer.writer()); + return buffer.toOwnedSlice(); + } + pub fn typedValue(decl: *Decl) error{AnalysisFail}!TypedValue { const tvm = decl.typedValueManaged() orelse return error.AnalysisFail; return tvm.typed_value; @@ -375,8 +387,7 @@ pub const Struct = struct { }; pub fn getFullyQualifiedName(s: *Struct, gpa: *Allocator) ![]u8 { - // TODO this should return e.g. "std.fs.Dir.OpenOptions" - return gpa.dupe(u8, mem.spanZ(s.owner_decl.name)); + return s.owner_decl.getFullyQualifiedName(gpa); } pub fn srcLoc(s: Struct) SrcLoc { @@ -387,6 +398,39 @@ pub const Struct = struct { } }; +/// Represents the data that an enum declaration provides, when the fields +/// are auto-numbered, and there are no declarations. The integer tag type +/// is inferred to be the smallest power of two unsigned int that fits +/// the number of fields. +pub const EnumSimple = struct { + owner_decl: *Decl, + /// Set of field names in declaration order. + fields: std.StringArrayHashMapUnmanaged(void), + /// Offset from `owner_decl`, points to the enum decl AST node. + node_offset: i32, +}; + +/// Represents the data that an enum declaration provides, when there is +/// at least one tag value explicitly specified, or at least one declaration. +pub const EnumFull = struct { + owner_decl: *Decl, + /// An integer type which is used for the numerical value of the enum. + /// Whether zig chooses this type or the user specifies it, it is stored here. + tag_ty: Type, + /// Set of field names in declaration order. + fields: std.StringArrayHashMapUnmanaged(void), + /// Maps integer tag value to field index. + /// Entries are in declaration order, same as `fields`. + /// If this hash map is empty, it means the enum tags are auto-numbered. + values: ValueMap, + /// Represents the declarations inside this struct. + container: Scope.Container, + /// Offset from `owner_decl`, points to the enum decl AST node. + node_offset: i32, + + pub const ValueMap = std.ArrayHashMapUnmanaged(Value, void, Value.hash_u32, Value.eql, false); +}; + /// Some Fn struct memory is owned by the Decl's TypedValue.Managed arena allocator. /// Extern functions do not have this data structure; they are represented by /// the `Decl` only, with a `Value` tag of `extern_fn`. @@ -634,6 +678,11 @@ pub const Scope = struct { // TODO container scope qualified names. return std.zig.hashSrc(name); } + + pub fn renderFullyQualifiedName(cont: Container, name: []const u8, writer: anytype) !void { + // TODO this should render e.g. "std.fs.Dir.OpenOptions" + return writer.writeAll(name); + } }; pub const File = struct { @@ -1030,7 +1079,6 @@ pub const Scope = struct { .instructions = gz.astgen.instructions.toOwnedSlice(), .string_bytes = gz.astgen.string_bytes.toOwnedSlice(gpa), .extra = gz.astgen.extra.toOwnedSlice(gpa), - .decls = gz.astgen.decls.toOwnedSlice(gpa), }; } @@ -1242,6 +1290,16 @@ pub const Scope = struct { }); } + pub fn addFloat(gz: *GenZir, number: f32, src_node: ast.Node.Index) !zir.Inst.Ref { + return gz.add(.{ + .tag = .float, + .data = .{ .float = .{ + .src_node = gz.astgen.decl.nodeIndexToRelative(src_node), + .number = number, + } }, + }); + } + pub fn addUnNode( gz: *GenZir, tag: zir.Inst.Tag, @@ -1450,13 +1508,6 @@ pub const Scope = struct { return new_index; } - pub fn addConst(gz: *GenZir, typed_value: *TypedValue) !zir.Inst.Ref { - return gz.add(.{ - .tag = .@"const", - .data = .{ .@"const" = typed_value }, - }); - } - pub fn add(gz: *GenZir, inst: zir.Inst) !zir.Inst.Ref { return gz.astgen.indexToRef(try gz.addAsIndex(inst)); } @@ -3120,12 +3171,14 @@ fn astgenAndSemaVarDecl( return type_changed; } -pub fn declareDeclDependency(mod: *Module, depender: *Decl, dependee: *Decl) !void { - try depender.dependencies.ensureCapacity(mod.gpa, depender.dependencies.items().len + 1); - try dependee.dependants.ensureCapacity(mod.gpa, dependee.dependants.items().len + 1); +/// Returns the depender's index of the dependee. +pub fn declareDeclDependency(mod: *Module, depender: *Decl, dependee: *Decl) !u32 { + try depender.dependencies.ensureCapacity(mod.gpa, depender.dependencies.count() + 1); + try dependee.dependants.ensureCapacity(mod.gpa, dependee.dependants.count() + 1); - depender.dependencies.putAssumeCapacity(dependee, {}); dependee.dependants.putAssumeCapacity(depender, {}); + const gop = depender.dependencies.getOrPutAssumeCapacity(dependee); + return @intCast(u32, gop.index); } pub fn getAstTree(mod: *Module, root_scope: *Scope.File) !*const ast.Tree { @@ -4445,7 +4498,17 @@ pub fn optimizeMode(mod: Module) std.builtin.Mode { /// Otherwise, returns a reference to the source code bytes directly. /// See also `appendIdentStr` and `parseStrLit`. pub fn identifierTokenString(mod: *Module, scope: *Scope, token: ast.TokenIndex) InnerError![]const u8 { - const tree = scope.tree(); + return mod.identifierTokenStringTreeArena(scope, token, scope.tree(), scope.arena()); +} + +/// `scope` is only used for error reporting. +pub fn identifierTokenStringTreeArena( + mod: *Module, + scope: *Scope, + token: ast.TokenIndex, + tree: *const ast.Tree, + arena: *Allocator, +) InnerError![]const u8 { const token_tags = tree.tokens.items(.tag); assert(token_tags[token] == .identifier); const ident_name = tree.tokenSlice(token); @@ -4455,7 +4518,8 @@ pub fn identifierTokenString(mod: *Module, scope: *Scope, token: ast.TokenIndex) var buf: ArrayListUnmanaged(u8) = .{}; defer buf.deinit(mod.gpa); try parseStrLit(mod, scope, token, &buf, ident_name, 1); - return buf.toOwnedSlice(mod.gpa); + const duped = try arena.dupe(u8, buf.items); + return duped; } /// Given an identifier token, obtain the string for it (possibly parsing as a string diff --git a/src/Sema.zig b/src/Sema.zig index 0b5a21ce42..771da877b4 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -168,7 +168,6 @@ pub fn analyzeBody( .cmp_lte => try sema.zirCmp(block, inst, .lte), .cmp_neq => try sema.zirCmp(block, inst, .neq), .coerce_result_ptr => try sema.zirCoerceResultPtr(block, inst), - .@"const" => try sema.zirConst(block, inst), .decl_ref => try sema.zirDeclRef(block, inst), .decl_val => try sema.zirDeclVal(block, inst), .load => try sema.zirLoad(block, inst), @@ -179,6 +178,8 @@ pub fn analyzeBody( .elem_val_node => try sema.zirElemValNode(block, inst), .enum_literal => try sema.zirEnumLiteral(block, inst), .enum_literal_small => try sema.zirEnumLiteralSmall(block, inst), + .enum_to_int => try sema.zirEnumToInt(block, inst), + .int_to_enum => try sema.zirIntToEnum(block, inst), .err_union_code => try sema.zirErrUnionCode(block, inst), .err_union_code_ptr => try sema.zirErrUnionCodePtr(block, inst), .err_union_payload_safe => try sema.zirErrUnionPayload(block, inst, true), @@ -201,6 +202,8 @@ pub fn analyzeBody( .import => try sema.zirImport(block, inst), .indexable_ptr_len => try sema.zirIndexablePtrLen(block, inst), .int => try sema.zirInt(block, inst), + .float => try sema.zirFloat(block, inst), + .float128 => try sema.zirFloat128(block, inst), .int_type => try sema.zirIntType(block, inst), .intcast => try sema.zirIntcast(block, inst), .is_err => try sema.zirIsErr(block, inst), @@ -264,7 +267,8 @@ pub fn analyzeBody( .struct_decl => try sema.zirStructDecl(block, inst, .Auto), .struct_decl_packed => try sema.zirStructDecl(block, inst, .Packed), .struct_decl_extern => try sema.zirStructDecl(block, inst, .Extern), - .enum_decl => try sema.zirEnumDecl(block, inst), + .enum_decl => try sema.zirEnumDecl(block, inst, false), + .enum_decl_nonexhaustive => try sema.zirEnumDecl(block, inst, true), .union_decl => try sema.zirUnionDecl(block, inst), .opaque_decl => try sema.zirOpaqueDecl(block, inst), @@ -498,18 +502,6 @@ fn resolveInstConst( }; } -fn zirConst(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { - const tracy = trace(@src()); - defer tracy.end(); - - const tv_ptr = sema.code.instructions.items(.data)[inst].@"const"; - // Move the TypedValue from old memory to new memory. This allows freeing the ZIR instructions - // after analysis. This happens, for example, with variable declaration initialization - // expressions. - const typed_value_copy = try tv_ptr.copy(sema.arena); - return sema.mod.constInst(sema.arena, .unneeded, typed_value_copy); -} - fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { const tracy = trace(@src()); defer tracy.end(); @@ -617,7 +609,12 @@ fn zirStructDecl( return sema.analyzeDeclVal(block, src, new_decl); } -fn zirEnumDecl(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { +fn zirEnumDecl( + sema: *Sema, + block: *Scope.Block, + inst: zir.Inst.Index, + nonexhaustive: bool, +) InnerError!*Inst { const tracy = trace(@src()); defer tracy.end(); @@ -1070,6 +1067,31 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*In return sema.mod.constIntUnsigned(sema.arena, .unneeded, Type.initTag(.comptime_int), int); } +fn zirFloat(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { + const arena = sema.arena; + const inst_data = sema.code.instructions.items(.data)[inst].float; + const src = inst_data.src(); + const number = inst_data.number; + + return sema.mod.constInst(arena, src, .{ + .ty = Type.initTag(.comptime_float), + .val = try Value.Tag.float_32.create(arena, number), + }); +} + +fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { + const arena = sema.arena; + const inst_data = sema.code.instructions.items(.data)[inst].pl_node; + const extra = sema.code.extraData(zir.Inst.Float128, inst_data.payload_index).data; + const src = inst_data.src(); + const number = extra.get(); + + return sema.mod.constInst(arena, src, .{ + .ty = Type.initTag(.comptime_float), + .val = try Value.Tag.float_128.create(arena, number), + }); +} + fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!zir.Inst.Index { const tracy = trace(@src()); defer tracy.end(); @@ -1385,7 +1407,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError const inst_data = sema.code.instructions.items(.data)[inst].pl_node; const src = inst_data.src(); - const decl = sema.code.decls[inst_data.payload_index]; + const decl = sema.owner_decl.dependencies.entries.items[inst_data.payload_index].key; return sema.analyzeDeclRef(block, src, decl); } @@ -1395,7 +1417,7 @@ fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError const inst_data = sema.code.instructions.items(.data)[inst].pl_node; const src = inst_data.src(); - const decl = sema.code.decls[inst_data.payload_index]; + const decl = sema.owner_decl.dependencies.entries.items[inst_data.payload_index].key; return sema.analyzeDeclVal(block, src, decl); } @@ -1852,6 +1874,120 @@ fn zirEnumLiteralSmall(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) I }); } +fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { + const mod = sema.mod; + const arena = sema.arena; + const inst_data = sema.code.instructions.items(.data)[inst].un_node; + const src = inst_data.src(); + const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; + const operand = try sema.resolveInst(inst_data.operand); + + const enum_tag: *Inst = switch (operand.ty.zigTypeTag()) { + .Enum => operand, + .Union => { + //if (!operand.ty.unionHasTag()) { + // return mod.fail( + // &block.base, + // operand_src, + // "untagged union '{}' cannot be converted to integer", + // .{dest_ty_src}, + // ); + //} + return mod.fail(&block.base, operand_src, "TODO zirEnumToInt for tagged unions", .{}); + }, + else => { + return mod.fail(&block.base, operand_src, "expected enum or tagged union, found {}", .{ + operand.ty, + }); + }, + }; + + var int_tag_type_buffer: Type.Payload.Bits = undefined; + const int_tag_ty = try enum_tag.ty.intTagType(&int_tag_type_buffer).copy(arena); + + if (enum_tag.ty.onePossibleValue()) |opv| { + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = opv, + }); + } + + if (enum_tag.value()) |enum_tag_val| { + if (enum_tag_val.castTag(.enum_field_index)) |enum_field_payload| { + const field_index = enum_field_payload.data; + switch (enum_tag.ty.tag()) { + .enum_full => { + const enum_full = enum_tag.ty.castTag(.enum_full).?.data; + const val = enum_full.values.entries.items[field_index].key; + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = val, + }); + }, + .enum_simple => { + // Field index and integer values are the same. + const val = try Value.Tag.int_u64.create(arena, field_index); + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = val, + }); + }, + else => unreachable, + } + } else { + // Assume it is already an integer and return it directly. + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = enum_tag_val, + }); + } + } + + try sema.requireRuntimeBlock(block, src); + return block.addUnOp(src, int_tag_ty, .bitcast, enum_tag); +} + +fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { + const mod = sema.mod; + const target = mod.getTarget(); + const arena = sema.arena; + const inst_data = sema.code.instructions.items(.data)[inst].pl_node; + const extra = sema.code.extraData(zir.Inst.Bin, inst_data.payload_index).data; + const src = inst_data.src(); + const dest_ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; + const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; + const dest_ty = try sema.resolveType(block, dest_ty_src, extra.lhs); + const operand = try sema.resolveInst(extra.rhs); + + if (dest_ty.zigTypeTag() != .Enum) { + return mod.fail(&block.base, dest_ty_src, "expected enum, found {}", .{dest_ty}); + } + + if (!dest_ty.isExhaustiveEnum()) { + if (operand.value()) |int_val| { + return mod.constInst(arena, src, .{ + .ty = dest_ty, + .val = int_val, + }); + } + } + + if (try sema.resolveDefinedValue(block, operand_src, operand)) |int_val| { + if (!dest_ty.enumHasInt(int_val, target)) { + return mod.fail(&block.base, src, "enum '{}' has no tag with value {}", .{ + dest_ty, int_val, + }); + } + return mod.constInst(arena, src, .{ + .ty = dest_ty, + .val = int_val, + }); + } + + try sema.requireRuntimeBlock(block, src); + return block.addUnOp(src, dest_ty, .bitcast, operand); +} + /// Pointer in, pointer out. fn zirOptionalPayloadPtr( sema: *Sema, @@ -4630,7 +4766,7 @@ fn analyzeDeclVal(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl } fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) InnerError!*Inst { - try sema.mod.declareDeclDependency(sema.owner_decl, decl); + _ = try sema.mod.declareDeclDependency(sema.owner_decl, decl); sema.mod.ensureDeclAnalyzed(decl) catch |err| { if (sema.func) |func| { func.state = .dependency_failure; diff --git a/src/type.zig b/src/type.zig index f5ce296e4d..c338072c15 100644 --- a/src/type.zig +++ b/src/type.zig @@ -93,9 +93,15 @@ pub const Type = extern union { .anyerror_void_error_union, .error_union => return .ErrorUnion, - .empty_struct => return .Struct, - .empty_struct_literal => return .Struct, - .@"struct" => return .Struct, + .empty_struct, + .empty_struct_literal, + .@"struct", + => return .Struct, + + .enum_full, + .enum_nonexhaustive, + .enum_simple, + => return .Enum, .var_args_param => unreachable, // can be any type } @@ -614,6 +620,8 @@ pub const Type = extern union { .error_set_single => return self.copyPayloadShallow(allocator, Payload.Name), .empty_struct => return self.copyPayloadShallow(allocator, Payload.ContainerScope), .@"struct" => return self.copyPayloadShallow(allocator, Payload.Struct), + .enum_simple => return self.copyPayloadShallow(allocator, Payload.EnumSimple), + .enum_full, .enum_nonexhaustive => return self.copyPayloadShallow(allocator, Payload.EnumFull), .@"opaque" => return self.copyPayloadShallow(allocator, Payload.Opaque), } } @@ -629,8 +637,8 @@ pub const Type = extern union { self: Type, comptime fmt: []const u8, options: std.fmt.FormatOptions, - out_stream: anytype, - ) @TypeOf(out_stream).Error!void { + writer: anytype, + ) @TypeOf(writer).Error!void { comptime assert(fmt.len == 0); var ty = self; while (true) { @@ -670,132 +678,149 @@ pub const Type = extern union { .comptime_float, .noreturn, .var_args_param, - => return out_stream.writeAll(@tagName(t)), + => return writer.writeAll(@tagName(t)), - .enum_literal => return out_stream.writeAll("@Type(.EnumLiteral)"), - .@"null" => return out_stream.writeAll("@Type(.Null)"), - .@"undefined" => return out_stream.writeAll("@Type(.Undefined)"), + .enum_literal => return writer.writeAll("@Type(.EnumLiteral)"), + .@"null" => return writer.writeAll("@Type(.Null)"), + .@"undefined" => return writer.writeAll("@Type(.Undefined)"), - .empty_struct, .empty_struct_literal => return out_stream.writeAll("struct {}"), - .@"struct" => return out_stream.writeAll("(struct)"), - .anyerror_void_error_union => return out_stream.writeAll("anyerror!void"), - .const_slice_u8 => return out_stream.writeAll("[]const u8"), - .fn_noreturn_no_args => return out_stream.writeAll("fn() noreturn"), - .fn_void_no_args => return out_stream.writeAll("fn() void"), - .fn_naked_noreturn_no_args => return out_stream.writeAll("fn() callconv(.Naked) noreturn"), - .fn_ccc_void_no_args => return out_stream.writeAll("fn() callconv(.C) void"), - .single_const_pointer_to_comptime_int => return out_stream.writeAll("*const comptime_int"), + .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"), + + .@"struct" => { + const struct_obj = self.castTag(.@"struct").?.data; + return struct_obj.owner_decl.renderFullyQualifiedName(writer); + }, + .enum_full, .enum_nonexhaustive => { + const enum_full = self.castTag(.enum_full).?.data; + return enum_full.owner_decl.renderFullyQualifiedName(writer); + }, + .enum_simple => { + const enum_simple = self.castTag(.enum_simple).?.data; + return enum_simple.owner_decl.renderFullyQualifiedName(writer); + }, + .@"opaque" => { + // TODO use declaration name + return writer.writeAll("opaque {}"); + }, + + .anyerror_void_error_union => return writer.writeAll("anyerror!void"), + .const_slice_u8 => return writer.writeAll("[]const u8"), + .fn_noreturn_no_args => return writer.writeAll("fn() noreturn"), + .fn_void_no_args => return writer.writeAll("fn() void"), + .fn_naked_noreturn_no_args => return writer.writeAll("fn() callconv(.Naked) noreturn"), + .fn_ccc_void_no_args => return writer.writeAll("fn() callconv(.C) void"), + .single_const_pointer_to_comptime_int => return writer.writeAll("*const comptime_int"), .function => { const payload = ty.castTag(.function).?.data; - try out_stream.writeAll("fn("); + try writer.writeAll("fn("); for (payload.param_types) |param_type, i| { - if (i != 0) try out_stream.writeAll(", "); - try param_type.format("", .{}, out_stream); + if (i != 0) try writer.writeAll(", "); + try param_type.format("", .{}, writer); } if (payload.is_var_args) { if (payload.param_types.len != 0) { - try out_stream.writeAll(", "); + try writer.writeAll(", "); } - try out_stream.writeAll("..."); + try writer.writeAll("..."); } - try out_stream.writeAll(") callconv(."); - try out_stream.writeAll(@tagName(payload.cc)); - try out_stream.writeAll(")"); + try writer.writeAll(") callconv(."); + try writer.writeAll(@tagName(payload.cc)); + try writer.writeAll(")"); ty = payload.return_type; continue; }, .array_u8 => { const len = ty.castTag(.array_u8).?.data; - return out_stream.print("[{d}]u8", .{len}); + return writer.print("[{d}]u8", .{len}); }, .array_u8_sentinel_0 => { const len = ty.castTag(.array_u8_sentinel_0).?.data; - return out_stream.print("[{d}:0]u8", .{len}); + return writer.print("[{d}:0]u8", .{len}); }, .array => { const payload = ty.castTag(.array).?.data; - try out_stream.print("[{d}]", .{payload.len}); + try writer.print("[{d}]", .{payload.len}); ty = payload.elem_type; continue; }, .array_sentinel => { const payload = ty.castTag(.array_sentinel).?.data; - try out_stream.print("[{d}:{}]", .{ payload.len, payload.sentinel }); + try writer.print("[{d}:{}]", .{ payload.len, payload.sentinel }); ty = payload.elem_type; continue; }, .single_const_pointer => { const pointee_type = ty.castTag(.single_const_pointer).?.data; - try out_stream.writeAll("*const "); + try writer.writeAll("*const "); ty = pointee_type; continue; }, .single_mut_pointer => { const pointee_type = ty.castTag(.single_mut_pointer).?.data; - try out_stream.writeAll("*"); + try writer.writeAll("*"); ty = pointee_type; continue; }, .many_const_pointer => { const pointee_type = ty.castTag(.many_const_pointer).?.data; - try out_stream.writeAll("[*]const "); + try writer.writeAll("[*]const "); ty = pointee_type; continue; }, .many_mut_pointer => { const pointee_type = ty.castTag(.many_mut_pointer).?.data; - try out_stream.writeAll("[*]"); + try writer.writeAll("[*]"); ty = pointee_type; continue; }, .c_const_pointer => { const pointee_type = ty.castTag(.c_const_pointer).?.data; - try out_stream.writeAll("[*c]const "); + try writer.writeAll("[*c]const "); ty = pointee_type; continue; }, .c_mut_pointer => { const pointee_type = ty.castTag(.c_mut_pointer).?.data; - try out_stream.writeAll("[*c]"); + try writer.writeAll("[*c]"); ty = pointee_type; continue; }, .const_slice => { const pointee_type = ty.castTag(.const_slice).?.data; - try out_stream.writeAll("[]const "); + try writer.writeAll("[]const "); ty = pointee_type; continue; }, .mut_slice => { const pointee_type = ty.castTag(.mut_slice).?.data; - try out_stream.writeAll("[]"); + try writer.writeAll("[]"); ty = pointee_type; continue; }, .int_signed => { const bits = ty.castTag(.int_signed).?.data; - return out_stream.print("i{d}", .{bits}); + return writer.print("i{d}", .{bits}); }, .int_unsigned => { const bits = ty.castTag(.int_unsigned).?.data; - return out_stream.print("u{d}", .{bits}); + return writer.print("u{d}", .{bits}); }, .optional => { const child_type = ty.castTag(.optional).?.data; - try out_stream.writeByte('?'); + try writer.writeByte('?'); ty = child_type; continue; }, .optional_single_const_pointer => { const pointee_type = ty.castTag(.optional_single_const_pointer).?.data; - try out_stream.writeAll("?*const "); + try writer.writeAll("?*const "); ty = pointee_type; continue; }, .optional_single_mut_pointer => { const pointee_type = ty.castTag(.optional_single_mut_pointer).?.data; - try out_stream.writeAll("?*"); + try writer.writeAll("?*"); ty = pointee_type; continue; }, @@ -804,48 +829,46 @@ pub const Type = extern union { const payload = ty.castTag(.pointer).?.data; if (payload.sentinel) |some| switch (payload.size) { .One, .C => unreachable, - .Many => try out_stream.print("[*:{}]", .{some}), - .Slice => try out_stream.print("[:{}]", .{some}), + .Many => try writer.print("[*:{}]", .{some}), + .Slice => try writer.print("[:{}]", .{some}), } else switch (payload.size) { - .One => try out_stream.writeAll("*"), - .Many => try out_stream.writeAll("[*]"), - .C => try out_stream.writeAll("[*c]"), - .Slice => try out_stream.writeAll("[]"), + .One => try writer.writeAll("*"), + .Many => try writer.writeAll("[*]"), + .C => try writer.writeAll("[*c]"), + .Slice => try writer.writeAll("[]"), } if (payload.@"align" != 0) { - try out_stream.print("align({d}", .{payload.@"align"}); + try writer.print("align({d}", .{payload.@"align"}); if (payload.bit_offset != 0) { - try out_stream.print(":{d}:{d}", .{ payload.bit_offset, payload.host_size }); + try writer.print(":{d}:{d}", .{ payload.bit_offset, payload.host_size }); } - try out_stream.writeAll(") "); + try writer.writeAll(") "); } - if (!payload.mutable) try out_stream.writeAll("const "); - if (payload.@"volatile") try out_stream.writeAll("volatile "); - if (payload.@"allowzero") try out_stream.writeAll("allowzero "); + if (!payload.mutable) try writer.writeAll("const "); + if (payload.@"volatile") try writer.writeAll("volatile "); + if (payload.@"allowzero") try writer.writeAll("allowzero "); ty = payload.pointee_type; continue; }, .error_union => { const payload = ty.castTag(.error_union).?.data; - try payload.error_set.format("", .{}, out_stream); - try out_stream.writeAll("!"); + try payload.error_set.format("", .{}, writer); + try writer.writeAll("!"); ty = payload.payload; continue; }, .error_set => { const error_set = ty.castTag(.error_set).?.data; - return out_stream.writeAll(std.mem.spanZ(error_set.owner_decl.name)); + return writer.writeAll(std.mem.spanZ(error_set.owner_decl.name)); }, .error_set_single => { const name = ty.castTag(.error_set_single).?.data; - return out_stream.print("error{{{s}}}", .{name}); + return writer.print("error{{{s}}}", .{name}); }, - .inferred_alloc_const => return out_stream.writeAll("(inferred_alloc_const)"), - .inferred_alloc_mut => return out_stream.writeAll("(inferred_alloc_mut)"), - // TODO use declaration name - .@"opaque" => return out_stream.writeAll("opaque {}"), + .inferred_alloc_const => return writer.writeAll("(inferred_alloc_const)"), + .inferred_alloc_mut => return writer.writeAll("(inferred_alloc_mut)"), } unreachable; } @@ -954,6 +977,19 @@ pub const Type = extern union { return false; } }, + .enum_full => { + const enum_full = self.castTag(.enum_full).?.data; + return enum_full.fields.count() >= 2; + }, + .enum_simple => { + const enum_simple = self.castTag(.enum_simple).?.data; + return enum_simple.fields.count() >= 2; + }, + .enum_nonexhaustive => { + var buffer: Payload.Bits = undefined; + const int_tag_ty = self.intTagType(&buffer); + return int_tag_ty.hasCodeGenBits(); + }, // TODO lazy types .array => self.elemType().hasCodeGenBits() and self.arrayLen() != 0, @@ -1112,13 +1148,37 @@ pub const Type = extern union { } else if (!payload.payload.hasCodeGenBits()) { return payload.error_set.abiAlignment(target); } - @panic("TODO abiAlignment error union"); + return std.math.max( + payload.payload.abiAlignment(target), + payload.error_set.abiAlignment(target), + ); }, .@"struct" => { - @panic("TODO abiAlignment struct"); + // TODO take into account field alignment + // also make this possible to fail, and lazy + // I think we need to move all the functions from type.zig which can + // fail into Sema. + // Probably will need to introduce multi-stage struct resolution just + // like we have in stage1. + const struct_obj = self.castTag(.@"struct").?.data; + var biggest: u32 = 0; + for (struct_obj.fields.entries.items) |entry| { + const field_ty = entry.value.ty; + if (!field_ty.hasCodeGenBits()) continue; + const field_align = field_ty.abiAlignment(target); + if (field_align > biggest) { + return field_align; + } + } + assert(biggest != 0); + return biggest; + }, + .enum_full, .enum_nonexhaustive, .enum_simple => { + var buffer: Payload.Bits = undefined; + const int_tag_ty = self.intTagType(&buffer); + return int_tag_ty.abiAlignment(target); }, - .c_void, .void, .type, @@ -1166,6 +1226,11 @@ pub const Type = extern union { .@"struct" => { @panic("TODO abiSize struct"); }, + .enum_simple, .enum_full, .enum_nonexhaustive => { + var buffer: Payload.Bits = undefined; + const int_tag_ty = self.intTagType(&buffer); + return int_tag_ty.abiSize(target); + }, .u8, .i8, @@ -1276,76 +1341,25 @@ pub const Type = extern union { }; } + /// Asserts the type is an enum. + pub fn intTagType(self: Type, buffer: *Payload.Bits) Type { + switch (self.tag()) { + .enum_full, .enum_nonexhaustive => return self.castTag(.enum_full).?.data.tag_ty, + .enum_simple => { + const enum_simple = self.castTag(.enum_simple).?.data; + const bits = std.math.log2_int_ceil(usize, enum_simple.fields.count()); + buffer.* = .{ + .base = .{ .tag = .int_unsigned }, + .data = bits, + }; + return Type.initPayload(&buffer.base); + }, + else => unreachable, + } + } + pub fn isSinglePointer(self: Type) bool { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .const_slice_u8, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .@"opaque", - .var_args_param, - => false, - .single_const_pointer, .single_mut_pointer, .single_const_pointer_to_comptime_int, @@ -1354,73 +1368,14 @@ pub const Type = extern union { => true, .pointer => self.castTag(.pointer).?.data.size == .One, + + else => false, }; } /// Asserts the `Type` is a pointer. pub fn ptrSize(self: Type) std.builtin.TypeInfo.Pointer.Size { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .empty_struct, - .empty_struct_literal, - .@"opaque", - .@"struct", - .var_args_param, - => unreachable, - .const_slice, .mut_slice, .const_slice_u8, @@ -1442,159 +1397,26 @@ pub const Type = extern union { => .One, .pointer => self.castTag(.pointer).?.data.size, + + else => unreachable, }; } pub fn isSlice(self: Type) bool { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .single_const_pointer_to_comptime_int, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"struct", - .@"opaque", - .var_args_param, - => false, - .const_slice, .mut_slice, .const_slice_u8, => true, .pointer => self.castTag(.pointer).?.data.size == .Slice, + + else => false, }; } pub fn isConstPtr(self: Type) bool { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .single_mut_pointer, - .many_mut_pointer, - .c_mut_pointer, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .mut_slice, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"struct", - .@"opaque", - .var_args_param, - => false, - .single_const_pointer, .many_const_pointer, .c_const_pointer, @@ -1604,170 +1426,40 @@ pub const Type = extern union { => true, .pointer => !self.castTag(.pointer).?.data.mutable, + + else => false, }; } pub fn isVolatilePtr(self: Type) bool { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .single_mut_pointer, - .single_const_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"struct", - .@"opaque", - .var_args_param, - => false, - .pointer => { const payload = self.castTag(.pointer).?.data; return payload.@"volatile"; }, + else => false, }; } pub fn isAllowzeroPtr(self: Type) bool { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .int_unsigned, - .int_signed, - .single_mut_pointer, - .single_const_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"struct", - .@"opaque", - .var_args_param, - => false, - .pointer => { const payload = self.castTag(.pointer).?.data; return payload.@"allowzero"; }, + else => false, + }; + } + + pub fn isCPtr(self: Type) bool { + return switch (self.tag()) { + .c_const_pointer, + .c_mut_pointer, + => return true, + + .pointer => self.castTag(.pointer).?.data.size == .C, + + else => return false, }; } @@ -1833,64 +1525,6 @@ pub const Type = extern union { /// Asserts the type is a pointer or array type. pub fn elemType(self: Type) Type { return switch (self.tag()) { - .u8 => unreachable, - .i8 => unreachable, - .u16 => unreachable, - .i16 => unreachable, - .u32 => unreachable, - .i32 => unreachable, - .u64 => unreachable, - .i64 => unreachable, - .u128 => unreachable, - .i128 => unreachable, - .usize => unreachable, - .isize => unreachable, - .c_short => unreachable, - .c_ushort => unreachable, - .c_int => unreachable, - .c_uint => unreachable, - .c_long => unreachable, - .c_ulong => unreachable, - .c_longlong => unreachable, - .c_ulonglong => unreachable, - .c_longdouble => unreachable, - .f16 => unreachable, - .f32 => unreachable, - .f64 => unreachable, - .f128 => unreachable, - .c_void => unreachable, - .bool => unreachable, - .void => unreachable, - .type => unreachable, - .anyerror => unreachable, - .comptime_int => unreachable, - .comptime_float => unreachable, - .noreturn => unreachable, - .@"null" => unreachable, - .@"undefined" => unreachable, - .fn_noreturn_no_args => unreachable, - .fn_void_no_args => unreachable, - .fn_naked_noreturn_no_args => unreachable, - .fn_ccc_void_no_args => unreachable, - .function => unreachable, - .int_unsigned => unreachable, - .int_signed => unreachable, - .optional => unreachable, - .optional_single_const_pointer => unreachable, - .optional_single_mut_pointer => unreachable, - .enum_literal => unreachable, - .error_union => unreachable, - .anyerror_void_error_union => unreachable, - .error_set => unreachable, - .error_set_single => unreachable, - .@"struct" => unreachable, - .empty_struct => unreachable, - .empty_struct_literal => unreachable, - .inferred_alloc_const => unreachable, - .inferred_alloc_mut => unreachable, - .@"opaque" => unreachable, - .var_args_param => unreachable, - .array => self.castTag(.array).?.data.elem_type, .array_sentinel => self.castTag(.array_sentinel).?.data.elem_type, .single_const_pointer, @@ -1902,9 +1536,12 @@ pub const Type = extern union { .const_slice, .mut_slice, => self.castPointer().?.data, + .array_u8, .array_u8_sentinel_0, .const_slice_u8 => Type.initTag(.u8), .single_const_pointer_to_comptime_int => Type.initTag(.comptime_int), .pointer => self.castTag(.pointer).?.data.pointee_type, + + else => unreachable, }; } @@ -1972,148 +1609,18 @@ pub const Type = extern union { /// Asserts the type is an array or vector. pub fn arrayLen(self: Type) u64 { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, - .array => self.castTag(.array).?.data.len, .array_sentinel => self.castTag(.array_sentinel).?.data.len, .array_u8 => self.castTag(.array_u8).?.data, .array_u8_sentinel_0 => self.castTag(.array_u8_sentinel_0).?.data, + + else => unreachable, }; } /// Asserts the type is an array, pointer or vector. pub fn sentinel(self: Type) ?Value { return switch (self.tag()) { - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .c_longdouble, - .f16, - .f32, - .f64, - .f128, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .const_slice, - .mut_slice, - .const_slice_u8, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, - .single_const_pointer, .single_mut_pointer, .many_const_pointer, @@ -2128,6 +1635,8 @@ pub const Type = extern union { .pointer => return self.castTag(.pointer).?.data.sentinel, .array_sentinel => return self.castTag(.array_sentinel).?.data.sentinel, .array_u8_sentinel_0 => return Value.initTag(.zero), + + else => unreachable, }; } @@ -2139,68 +1648,6 @@ pub const Type = extern union { /// Returns true if and only if the type is a fixed-width, signed integer. pub fn isSignedInt(self: Type) bool { return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .int_unsigned, - .u8, - .usize, - .c_ushort, - .c_uint, - .c_ulong, - .c_ulonglong, - .u16, - .u32, - .u64, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => false, - .int_signed, .i8, .isize, @@ -2211,79 +1658,16 @@ pub const Type = extern union { .i16, .i32, .i64, - .u128, .i128, => true, + + else => false, }; } /// Returns true if and only if the type is a fixed-width, unsigned integer. pub fn isUnsignedInt(self: Type) bool { return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .int_signed, - .i8, - .isize, - .c_short, - .c_int, - .c_long, - .c_longlong, - .i16, - .i32, - .i64, - .u128, - .i128, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => false, - .int_unsigned, .u8, .usize, @@ -2294,65 +1678,16 @@ pub const Type = extern union { .u16, .u32, .u64, + .u128, => true, + + else => false, }; } /// Asserts the type is an integer. pub fn intInfo(self: Type, target: Target) struct { signedness: std.builtin.Signedness, bits: u16 } { return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, - .int_unsigned => .{ .signedness = .unsigned, .bits = self.castTag(.int_unsigned).?.data, @@ -2381,75 +1716,13 @@ pub const Type = extern union { .c_ulong => .{ .signedness = .unsigned, .bits = CType.ulong.sizeInBits(target) }, .c_longlong => .{ .signedness = .signed, .bits = CType.longlong.sizeInBits(target) }, .c_ulonglong => .{ .signedness = .unsigned, .bits = CType.ulonglong.sizeInBits(target) }, + + else => unreachable, }; } pub fn isNamedInt(self: Type) bool { return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .int_unsigned, - .int_signed, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => false, - .usize, .isize, .c_short, @@ -2461,6 +1734,8 @@ pub const Type = extern union { .c_longlong, .c_ulonglong, => true, + + else => false, }; } @@ -2499,74 +1774,7 @@ pub const Type = extern union { .fn_ccc_void_no_args => 0, .function => self.castTag(.function).?.data.param_types.len, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, }; } @@ -2583,74 +1791,7 @@ pub const Type = extern union { std.mem.copy(Type, types, payload.param_types); }, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, } } @@ -2662,78 +1803,7 @@ pub const Type = extern union { return payload.param_types[index]; }, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, } } @@ -2749,74 +1819,7 @@ pub const Type = extern union { .function => self.castTag(.function).?.data.return_type, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, }; } @@ -2829,74 +1832,7 @@ pub const Type = extern union { .fn_ccc_void_no_args => .C, .function => self.castTag(.function).?.data.cc, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, }; } @@ -2909,74 +1845,7 @@ pub const Type = extern union { .fn_ccc_void_no_args => false, .function => self.castTag(.function).?.data.is_var_args, - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .c_void, - .bool, - .void, - .type, - .anyerror, - .comptime_int, - .comptime_float, - .noreturn, - .@"null", - .@"undefined", - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .int_unsigned, - .int_signed, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => unreachable, + else => unreachable, }; } @@ -3013,50 +1882,7 @@ pub const Type = extern union { .int_signed, => true, - .c_void, - .bool, - .void, - .type, - .anyerror, - .noreturn, - .@"null", - .@"undefined", - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .pointer, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .c_const_pointer, - .c_mut_pointer, - .const_slice, - .mut_slice, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => false, + else => false, }; } @@ -3127,6 +1953,23 @@ pub const Type = extern union { } return Value.initTag(.empty_struct_value); }, + .enum_full => { + const enum_full = self.castTag(.enum_full).?.data; + if (enum_full.fields.count() == 1) { + return enum_full.values.entries.items[0].key; + } else { + return null; + } + }, + .enum_simple => { + const enum_simple = self.castTag(.enum_simple).?.data; + if (enum_simple.fields.count() == 1) { + return Value.initTag(.zero); + } else { + return null; + } + }, + .enum_nonexhaustive => return self.castTag(.enum_full).?.data.tag_ty.onePossibleValue(), .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), .void => return Value.initTag(.void_value), @@ -3166,87 +2009,6 @@ pub const Type = extern union { }; } - pub fn isCPtr(self: Type) bool { - return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .comptime_int, - .comptime_float, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .bool, - .type, - .anyerror, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .c_void, - .void, - .noreturn, - .@"null", - .@"undefined", - .int_unsigned, - .int_signed, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .const_slice, - .mut_slice, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .@"struct", - .empty_struct, - .empty_struct_literal, - .inferred_alloc_const, - .inferred_alloc_mut, - .@"opaque", - .var_args_param, - => return false, - - .c_const_pointer, - .c_mut_pointer, - => return true, - - .pointer => self.castTag(.pointer).?.data.size == .C, - }; - } - pub fn isIndexable(self: Type) bool { const zig_tag = self.zigTypeTag(); // TODO tuples are indexable @@ -3257,80 +2019,12 @@ pub const Type = extern union { /// Asserts that the type is a container. (note: ErrorSet is not a container). pub fn getContainerScope(self: Type) *Module.Scope.Container { return switch (self.tag()) { - .f16, - .f32, - .f64, - .f128, - .c_longdouble, - .comptime_int, - .comptime_float, - .u8, - .i8, - .u16, - .i16, - .u32, - .i32, - .u64, - .i64, - .u128, - .i128, - .usize, - .isize, - .c_short, - .c_ushort, - .c_int, - .c_uint, - .c_long, - .c_ulong, - .c_longlong, - .c_ulonglong, - .bool, - .type, - .anyerror, - .fn_noreturn_no_args, - .fn_void_no_args, - .fn_naked_noreturn_no_args, - .fn_ccc_void_no_args, - .function, - .single_const_pointer_to_comptime_int, - .const_slice_u8, - .c_void, - .void, - .noreturn, - .@"null", - .@"undefined", - .int_unsigned, - .int_signed, - .array, - .array_sentinel, - .array_u8, - .array_u8_sentinel_0, - .single_const_pointer, - .single_mut_pointer, - .many_const_pointer, - .many_mut_pointer, - .const_slice, - .mut_slice, - .optional, - .optional_single_mut_pointer, - .optional_single_const_pointer, - .enum_literal, - .error_union, - .anyerror_void_error_union, - .error_set, - .error_set_single, - .c_const_pointer, - .c_mut_pointer, - .pointer, - .inferred_alloc_const, - .inferred_alloc_mut, - .var_args_param, - .empty_struct_literal, - => unreachable, - .@"struct" => &self.castTag(.@"struct").?.data.container, + .enum_full => &self.castTag(.enum_full).?.data.container, .empty_struct => self.castTag(.empty_struct).?.data, .@"opaque" => &self.castTag(.@"opaque").?.data, + + else => unreachable, }; } @@ -3390,7 +2084,43 @@ pub const Type = extern union { } pub fn isExhaustiveEnum(ty: Type) bool { - return false; // TODO + return switch (ty.tag()) { + .enum_full, .enum_simple => true, + else => false, + }; + } + + /// Asserts the type is an enum. + pub fn enumHasInt(ty: Type, int: Value, target: Target) bool { + const S = struct { + fn intInRange(int_val: Value, end: usize) bool { + if (int_val.compareWithZero(.lt)) return false; + var end_payload: Value.Payload.U64 = .{ + .base = .{ .tag = .int_u64 }, + .data = end, + }; + const end_val = Value.initPayload(&end_payload.base); + if (int_val.compare(.gte, end_val)) return false; + return true; + } + }; + switch (ty.tag()) { + .enum_nonexhaustive => return int.intFitsInType(ty, target), + .enum_full => { + const enum_full = ty.castTag(.enum_full).?.data; + if (enum_full.values.count() == 0) { + return S.intInRange(int, enum_full.fields.count()); + } else { + return enum_full.values.contains(int); + } + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return S.intInRange(int, enum_simple.fields.count()); + }, + + else => unreachable, + } } /// This enum does not directly correspond to `std.builtin.TypeId` because @@ -3482,6 +2212,9 @@ pub const Type = extern union { empty_struct, @"opaque", @"struct", + enum_simple, + enum_full, + enum_nonexhaustive, pub const last_no_payload_tag = Tag.inferred_alloc_const; pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; @@ -3568,6 +2301,8 @@ pub const Type = extern union { .error_set_single => Payload.Name, .@"opaque" => Payload.Opaque, .@"struct" => Payload.Struct, + .enum_full, .enum_nonexhaustive => Payload.EnumFull, + .enum_simple => Payload.EnumSimple, .empty_struct => Payload.ContainerScope, }; } @@ -3705,6 +2440,16 @@ pub const Type = extern union { base: Payload = .{ .tag = .@"struct" }, data: *Module.Struct, }; + + pub const EnumFull = struct { + base: Payload, + data: *Module.EnumFull, + }; + + pub const EnumSimple = struct { + base: Payload = .{ .tag = .enum_simple }, + data: *Module.EnumSimple, + }; }; }; diff --git a/src/value.zig b/src/value.zig index 4170b005bf..66a23692c1 100644 --- a/src/value.zig +++ b/src/value.zig @@ -103,6 +103,8 @@ pub const Value = extern union { float_64, float_128, enum_literal, + /// A specific enum tag, indicated by the field index (declaration order). + enum_field_index, @"error", error_union, /// This is a special value that tracks a set of types that have been stored @@ -186,6 +188,8 @@ pub const Value = extern union { .enum_literal, => Payload.Bytes, + .enum_field_index => Payload.U32, + .ty => Payload.Ty, .int_type => Payload.IntType, .int_u64 => Payload.U64, @@ -394,6 +398,7 @@ pub const Value = extern union { }; return Value{ .ptr_otherwise = &new_payload.base }; }, + .enum_field_index => return self.copyPayloadShallow(allocator, Payload.U32), .@"error" => return self.copyPayloadShallow(allocator, Payload.Error), .error_union => { const payload = self.castTag(.error_union).?; @@ -416,6 +421,8 @@ pub const Value = extern union { return Value{ .ptr_otherwise = &new_payload.base }; } + /// TODO this should become a debug dump() function. In order to print values in a meaningful way + /// we also need access to the type. pub fn format( self: Value, comptime fmt: []const u8, @@ -506,6 +513,7 @@ pub const Value = extern union { }, .empty_array => return out_stream.writeAll(".{}"), .enum_literal => return out_stream.print(".{}", .{std.zig.fmtId(self.castTag(.enum_literal).?.data)}), + .enum_field_index => return out_stream.print("(enum field {d})", .{self.castTag(.enum_field_index).?.data}), .bytes => return out_stream.print("\"{}\"", .{std.zig.fmtEscapes(self.castTag(.bytes).?.data)}), .repeated => { try out_stream.writeAll("(repeated) "); @@ -626,6 +634,7 @@ pub const Value = extern union { .float_64, .float_128, .enum_literal, + .enum_field_index, .@"error", .error_union, .empty_struct_value, @@ -638,76 +647,6 @@ pub const Value = extern union { /// Asserts the value is an integer. pub fn toBigInt(self: Value, space: *BigIntSpace) BigIntConst { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .error_union, - .@"error", - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - - .undef => unreachable, - .zero, .bool_false, => return BigIntMutable.init(&space.limbs, 0).toConst(), @@ -720,82 +659,15 @@ pub const Value = extern union { .int_i64 => return BigIntMutable.init(&space.limbs, self.castTag(.int_i64).?.data).toConst(), .int_big_positive => return self.castTag(.int_big_positive).?.asBigInt(), .int_big_negative => return self.castTag(.int_big_negative).?.asBigInt(), + + .undef => unreachable, + else => unreachable, } } /// Asserts the value is an integer and it fits in a u64 pub fn toUnsignedInt(self: Value) u64 { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - - .undef => unreachable, - .zero, .bool_false, => return 0, @@ -808,82 +680,15 @@ pub const Value = extern union { .int_i64 => return @intCast(u64, self.castTag(.int_i64).?.data), .int_big_positive => return self.castTag(.int_big_positive).?.asBigInt().to(u64) catch unreachable, .int_big_negative => return self.castTag(.int_big_negative).?.asBigInt().to(u64) catch unreachable, + + .undef => unreachable, + else => unreachable, } } /// Asserts the value is an integer and it fits in a i64 pub fn toSignedInt(self: Value) i64 { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - - .undef => unreachable, - .zero, .bool_false, => return 0, @@ -896,6 +701,9 @@ pub const Value = extern union { .int_i64 => return self.castTag(.int_i64).?.data, .int_big_positive => return self.castTag(.int_big_positive).?.asBigInt().to(i64) catch unreachable, .int_big_negative => return self.castTag(.int_big_negative).?.asBigInt().to(i64) catch unreachable, + + .undef => unreachable, + else => unreachable, } } @@ -929,75 +737,6 @@ pub const Value = extern union { /// Returns the number of bits the value requires to represent stored in twos complement form. pub fn intBitCountTwosComp(self: Value) usize { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .undef, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .zero, .bool_false, => return 0, @@ -1016,80 +755,14 @@ pub const Value = extern union { }, .int_big_positive => return self.castTag(.int_big_positive).?.asBigInt().bitCountTwosComp(), .int_big_negative => return self.castTag(.int_big_negative).?.asBigInt().bitCountTwosComp(), + + else => unreachable, } } /// Asserts the value is an integer, and the destination type is ComptimeInt or Int. pub fn intFitsInType(self: Value, ty: Type, target: Target) bool { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .zero, .undef, .bool_false, @@ -1144,6 +817,8 @@ pub const Value = extern union { .ComptimeInt => return true, else => unreachable, }, + + else => unreachable, } } @@ -1180,77 +855,6 @@ pub const Value = extern union { /// Asserts the value is a float pub fn floatHasFraction(self: Value) bool { return switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .bool_true, - .bool_false, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .undef, - .int_u64, - .int_i64, - .int_big_positive, - .int_big_negative, - .empty_array, - .void_value, - .unreachable_value, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .zero, .one, => false, @@ -1260,76 +864,13 @@ pub const Value = extern union { .float_64 => @rem(self.castTag(.float_64).?.data, 1) != 0, // .float_128 => @rem(self.castTag(.float_128).?.data, 1) != 0, .float_128 => @panic("TODO lld: error: undefined symbol: fmodl"), + + else => unreachable, }; } pub fn orderAgainstZero(lhs: Value) std.math.Order { return switch (lhs.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .null_value, - .function, - .extern_fn, - .variable, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .undef, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .zero, .bool_false, => .eq, @@ -1347,6 +888,8 @@ pub const Value = extern union { .float_32 => std.math.order(lhs.castTag(.float_32).?.data, 0), .float_64 => std.math.order(lhs.castTag(.float_64).?.data, 0), .float_128 => std.math.order(lhs.castTag(.float_128).?.data, 0), + + else => unreachable, }; } @@ -1396,10 +939,12 @@ pub const Value = extern union { } pub fn eql(a: Value, b: Value) bool { - if (a.tag() == b.tag()) { - if (a.tag() == .void_value or a.tag() == .null_value) { + const a_tag = a.tag(); + const b_tag = b.tag(); + if (a_tag == b_tag) { + if (a_tag == .void_value or a_tag == .null_value) { return true; - } else if (a.tag() == .enum_literal) { + } else if (a_tag == .enum_literal) { const a_name = a.castTag(.enum_literal).?.data; const b_name = b.castTag(.enum_literal).?.data; return std.mem.eql(u8, a_name, b_name); @@ -1416,6 +961,10 @@ pub const Value = extern union { return compare(a, .eq, b); } + pub fn hash_u32(self: Value) u32 { + return @truncate(u32, self.hash()); + } + pub fn hash(self: Value) u64 { var hasher = std.hash.Wyhash.init(0); @@ -1493,11 +1042,18 @@ pub const Value = extern union { .zero, .bool_false => std.hash.autoHash(&hasher, @as(u64, 0)), .one, .bool_true => std.hash.autoHash(&hasher, @as(u64, 1)), - .float_16, .float_32, .float_64, .float_128 => {}, + .float_16, .float_32, .float_64, .float_128 => { + @panic("TODO implement Value.hash for floats"); + }, + .enum_literal => { const payload = self.castTag(.enum_literal).?; hasher.update(payload.data); }, + .enum_field_index => { + const payload = self.castTag(.enum_field_index).?; + std.hash.autoHash(&hasher, payload.data); + }, .bytes => { const payload = self.castTag(.bytes).?; hasher.update(payload.data); @@ -1573,80 +1129,6 @@ pub const Value = extern union { /// Returns error.AnalysisFail if the pointer points to a Decl that failed semantic analysis. pub fn pointerDeref(self: Value, allocator: *Allocator) error{ AnalysisFail, OutOfMemory }!Value { return switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .zero, - .one, - .bool_true, - .bool_false, - .null_value, - .function, - .extern_fn, - .variable, - .int_u64, - .int_i64, - .int_big_positive, - .int_big_negative, - .bytes, - .undef, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .empty_array, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .ref_val => self.castTag(.ref_val).?.data, .decl_ref => self.castTag(.decl_ref).?.data.value(), .elem_ptr => { @@ -1654,6 +1136,8 @@ pub const Value = extern union { const array_val = try elem_ptr.array_ptr.pointerDeref(allocator); return array_val.elemValue(allocator, elem_ptr.index); }, + + else => unreachable, }; } @@ -1661,86 +1145,14 @@ pub const Value = extern union { /// or an unknown-length pointer, and returns the element value at the index. pub fn elemValue(self: Value, allocator: *Allocator, index: usize) error{OutOfMemory}!Value { switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .zero, - .one, - .bool_true, - .bool_false, - .null_value, - .function, - .extern_fn, - .variable, - .int_u64, - .int_i64, - .int_big_positive, - .int_big_negative, - .undef, - .elem_ptr, - .ref_val, - .decl_ref, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .unreachable_value, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .inferred_alloc, - .abi_align_default, - => unreachable, - .empty_array => unreachable, // out of bounds array index .bytes => return Tag.int_u64.create(allocator, self.castTag(.bytes).?.data[index]), // No matter the index; all the elements are the same! .repeated => return self.castTag(.repeated).?.data, + + else => unreachable, } } @@ -1766,161 +1178,18 @@ pub const Value = extern union { /// Valid for all types. Asserts the value is not undefined and not unreachable. pub fn isNull(self: Value) bool { return switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .zero, - .one, - .empty_array, - .bool_true, - .bool_false, - .function, - .extern_fn, - .variable, - .int_u64, - .int_i64, - .int_big_positive, - .int_big_negative, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .enum_literal, - .@"error", - .error_union, - .empty_struct_value, - .abi_align_default, - => false, - .undef => unreachable, .unreachable_value => unreachable, .inferred_alloc => unreachable, .null_value => true, + + else => false, }; } /// Valid for all types. Asserts the value is not undefined and not unreachable. pub fn getError(self: Value) ?[]const u8 { return switch (self.tag()) { - .ty, - .int_type, - .u8_type, - .i8_type, - .u16_type, - .i16_type, - .u32_type, - .i32_type, - .u64_type, - .i64_type, - .u128_type, - .i128_type, - .usize_type, - .isize_type, - .c_short_type, - .c_ushort_type, - .c_int_type, - .c_uint_type, - .c_long_type, - .c_ulong_type, - .c_longlong_type, - .c_ulonglong_type, - .c_longdouble_type, - .f16_type, - .f32_type, - .f64_type, - .f128_type, - .c_void_type, - .bool_type, - .void_type, - .type_type, - .anyerror_type, - .comptime_int_type, - .comptime_float_type, - .noreturn_type, - .null_type, - .undefined_type, - .fn_noreturn_no_args_type, - .fn_void_no_args_type, - .fn_naked_noreturn_no_args_type, - .fn_ccc_void_no_args_type, - .single_const_pointer_to_comptime_int_type, - .const_slice_u8_type, - .enum_literal_type, - .zero, - .one, - .null_value, - .empty_array, - .bool_true, - .bool_false, - .function, - .extern_fn, - .variable, - .int_u64, - .int_i64, - .int_big_positive, - .int_big_negative, - .ref_val, - .decl_ref, - .elem_ptr, - .bytes, - .repeated, - .float_16, - .float_32, - .float_64, - .float_128, - .void_value, - .enum_literal, - .empty_struct_value, - .abi_align_default, - => null, - .error_union => { const data = self.castTag(.error_union).?.data; return if (data.tag() == .@"error") @@ -1932,6 +1201,8 @@ pub const Value = extern union { .undef => unreachable, .unreachable_value => unreachable, .inferred_alloc => unreachable, + + else => null, }; } /// Valid for all types. Asserts the value is not undefined. @@ -2021,6 +1292,7 @@ pub const Value = extern union { .float_128, .void_value, .enum_literal, + .enum_field_index, .@"error", .error_union, .empty_struct_value, @@ -2038,6 +1310,11 @@ pub const Value = extern union { pub const Payload = struct { tag: Tag, + pub const U32 = struct { + base: Payload, + data: u32, + }; + pub const U64 = struct { base: Payload, data: u64, diff --git a/src/zir.zig b/src/zir.zig index c70ef17fcd..e63d36bced 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -37,8 +37,6 @@ pub const Code = struct { string_bytes: []u8, /// The meaning of this data is determined by `Inst.Tag` value. extra: []u32, - /// Used for decl_val and decl_ref instructions. - decls: []*Module.Decl, /// Returns the requested data, as well as the new index which is at the start of the /// trailers for the object. @@ -78,7 +76,6 @@ pub const Code = struct { code.instructions.deinit(gpa); gpa.free(code.string_bytes); gpa.free(code.extra); - gpa.free(code.decls); code.* = undefined; } @@ -267,9 +264,6 @@ pub const Inst = struct { /// only the taken branch is analyzed. The then block and else block must /// terminate with an "inline" variant of a noreturn instruction. condbr_inline, - /// A comptime known value. - /// Uses the `const` union field. - @"const", /// A struct type definition. Contains references to ZIR instructions for /// the field types, defaults, and alignments. /// Uses the `pl_node` union field. Payload is `StructDecl`. @@ -286,6 +280,8 @@ pub const Inst = struct { /// the field value expressions and optional type tag expression. /// Uses the `pl_node` union field. Payload is `EnumDecl`. enum_decl, + /// Same as `enum_decl`, except the enum is non-exhaustive. + enum_decl_nonexhaustive, /// An opaque type definition. Provides an AST node only. /// Uses the `node` union field. opaque_decl, @@ -369,6 +365,11 @@ pub const Inst = struct { import, /// Integer literal that fits in a u64. Uses the int union value. int, + /// A float literal that fits in a f32. Uses the float union value. + float, + /// A float literal that fits in a f128. Uses the `pl_node` union value. + /// Payload is `Float128`. + float128, /// Convert an integer value to another integer type, asserting that the destination type /// can hold the same mathematical value. /// Uses the `pl_node` field. AST is the `@intCast` syntax. @@ -667,6 +668,12 @@ pub const Inst = struct { /// A struct literal with a specified type, with no fields. /// Uses the `un_node` field. struct_init_empty, + /// Converts an integer into an enum value. + /// Uses `pl_node` with payload `Bin`. `lhs` is enum type, `rhs` is operand. + int_to_enum, + /// Converts an enum value into an integer. Resulting type will be the tag type + /// of the enum. Uses `un_node`. + enum_to_int, /// Returns whether the instruction is one of the control flow "noreturn" types. /// Function calls do not count. @@ -712,12 +719,12 @@ pub const Inst = struct { .cmp_gt, .cmp_neq, .coerce_result_ptr, - .@"const", .struct_decl, .struct_decl_packed, .struct_decl_extern, .union_decl, .enum_decl, + .enum_decl_nonexhaustive, .opaque_decl, .dbg_stmt_node, .decl_ref, @@ -740,6 +747,8 @@ pub const Inst = struct { .fn_type_cc, .fn_type_cc_var_args, .int, + .float, + .float128, .intcast, .int_type, .is_non_null, @@ -822,6 +831,8 @@ pub const Inst = struct { .switch_block_ref_under_multi, .validate_struct_init_ptr, .struct_init_empty, + .int_to_enum, + .enum_to_int, => false, .@"break", @@ -1184,7 +1195,6 @@ pub const Inst = struct { } }, bin: Bin, - @"const": *TypedValue, /// For strings which may contain null bytes. str: struct { /// Offset into `string_bytes`. @@ -1226,6 +1236,16 @@ pub const Inst = struct { /// Offset from Decl AST node index. node: i32, int: u64, + float: struct { + /// Offset from Decl AST node index. + /// `Tag` determines which kind of AST node this points to. + src_node: i32, + number: f32, + + pub fn src(self: @This()) LazySrcLoc { + return .{ .node_offset = self.src_node }; + } + }, array_type_sentinel: struct { len: Ref, /// index into extra, points to an `ArrayTypeSentinel` @@ -1507,6 +1527,22 @@ pub const Inst = struct { tag_type: Ref, fields_len: u32, }; + + /// A f128 value, broken up into 4 u32 parts. + pub const Float128 = struct { + piece0: u32, + piece1: u32, + piece2: u32, + piece3: u32, + + pub fn get(self: Float128) f128 { + const int_bits = @as(u128, self.piece0) | + (@as(u128, self.piece1) << 32) | + (@as(u128, self.piece2) << 64) | + (@as(u128, self.piece3) << 96); + return @bitCast(f128, int_bits); + } + }; }; pub const SpecialProng = enum { none, @"else", under }; @@ -1581,6 +1617,7 @@ const Writer = struct { .typeof, .typeof_elem, .struct_init_empty, + .enum_to_int, => try self.writeUnNode(stream, inst), .ref, @@ -1594,11 +1631,12 @@ const Writer = struct { => try self.writeBoolBr(stream, inst), .array_type_sentinel => try self.writeArrayTypeSentinel(stream, inst), - .@"const" => try self.writeConst(stream, inst), .param_type => try self.writeParamType(stream, inst), .ptr_type_simple => try self.writePtrTypeSimple(stream, inst), .ptr_type => try self.writePtrType(stream, inst), .int => try self.writeInt(stream, inst), + .float => try self.writeFloat(stream, inst), + .float128 => try self.writeFloat128(stream, inst), .str => try self.writeStr(stream, inst), .elided => try stream.writeAll(")"), .int_type => try self.writeIntType(stream, inst), @@ -1619,6 +1657,7 @@ const Writer = struct { .slice_sentinel, .union_decl, .enum_decl, + .enum_decl_nonexhaustive, => try self.writePlNode(stream, inst), .add, @@ -1647,6 +1686,7 @@ const Writer = struct { .merge_error_sets, .bit_and, .bit_or, + .int_to_enum, => try self.writePlNodeBin(stream, inst), .call, @@ -1773,15 +1813,6 @@ const Writer = struct { try stream.writeAll("TODO)"); } - fn writeConst( - self: *Writer, - stream: anytype, - inst: Inst.Index, - ) (@TypeOf(stream).Error || error{OutOfMemory})!void { - const inst_data = self.code.instructions.items(.data)[inst].@"const"; - try stream.writeAll("TODO)"); - } - fn writeParamType( self: *Writer, stream: anytype, @@ -1819,6 +1850,23 @@ const Writer = struct { try stream.print("{d})", .{inst_data}); } + fn writeFloat(self: *Writer, stream: anytype, inst: Inst.Index) !void { + const inst_data = self.code.instructions.items(.data)[inst].float; + const src = inst_data.src(); + try stream.print("{d}) ", .{inst_data.number}); + try self.writeSrc(stream, src); + } + + fn writeFloat128(self: *Writer, stream: anytype, inst: Inst.Index) !void { + const inst_data = self.code.instructions.items(.data)[inst].pl_node; + const extra = self.code.extraData(Inst.Float128, inst_data.payload_index).data; + const src = inst_data.src(); + const number = extra.get(); + // TODO improve std.format to be able to print f128 values + try stream.print("{d}) ", .{@floatCast(f64, number)}); + try self.writeSrc(stream, src); + } + fn writeStr( self: *Writer, stream: anytype, @@ -2136,7 +2184,8 @@ const Writer = struct { fn writePlNodeDecl(self: *Writer, stream: anytype, inst: Inst.Index) !void { const inst_data = self.code.instructions.items(.data)[inst].pl_node; - const decl = self.code.decls[inst_data.payload_index]; + const owner_decl = self.scope.ownerDecl().?; + const decl = owner_decl.dependencies.entries.items[inst_data.payload_index].key; try stream.print("{s}) ", .{decl.name}); try self.writeSrc(stream, inst_data.src()); } From f253822415304fc069f68452f7f4abbded58a24e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Apr 2021 19:50:53 -0700 Subject: [PATCH 026/101] stage2: do not set clang_passthrough_mode for `zig run` Thanks to @g-w1 for discovering this bug. closes #8450 --- src/main.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index a40be84e56..5fb74db61f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1815,6 +1815,11 @@ fn buildOutputType( @import("codegen/llvm/bindings.zig").ParseCommandLineOptions(argv.len, &argv); } + const clang_passthrough_mode = switch (arg_mode) { + .cc, .cpp, .translate_c => true, + else => false, + }; + gimmeMoreOfThoseSweetSweetFileDescriptors(); const comp = Compilation.create(gpa, .{ @@ -1886,7 +1891,7 @@ fn buildOutputType( .function_sections = function_sections, .self_exe_path = self_exe_path, .thread_pool = &thread_pool, - .clang_passthrough_mode = arg_mode != .build, + .clang_passthrough_mode = clang_passthrough_mode, .clang_preprocessor_mode = clang_preprocessor_mode, .version = optional_version, .libc_installation = if (libc_installation) |*lci| lci else null, From 2adeace905d6c36e3a333647c21287493ab98485 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Apr 2021 22:34:48 -0700 Subject: [PATCH 027/101] std: modernize zig parser perf test use the file size formatting functions --- lib/std/zig/perf_test.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/std/zig/perf_test.zig b/lib/std/zig/perf_test.zig index b111170902..49a19a067c 100644 --- a/lib/std/zig/perf_test.zig +++ b/lib/std/zig/perf_test.zig @@ -9,6 +9,7 @@ const warn = std.debug.warn; const Tokenizer = std.zig.Tokenizer; const Parser = std.zig.Parser; const io = std.io; +const fmtIntSizeBin = std.fmt.fmtIntSizeBin; const source = @embedFile("../os.zig"); var fixed_buffer_mem: [10 * 1024 * 1024]u8 = undefined; @@ -25,12 +26,15 @@ pub fn main() !void { const end = timer.read(); memory_used /= iterations; const elapsed_s = @intToFloat(f64, end - start) / std.time.ns_per_s; - const bytes_per_sec = @intToFloat(f64, source.len * iterations) / elapsed_s; - const mb_per_sec = bytes_per_sec / (1024 * 1024); + const bytes_per_sec_float = @intToFloat(f64, source.len * iterations) / elapsed_s; + const bytes_per_sec = @floatToInt(u64, @floor(bytes_per_sec_float)); var stdout_file = std.io.getStdOut(); const stdout = stdout_file.writer(); - try stdout.print("{:.3} MiB/s, {} KiB used \n", .{ mb_per_sec, memory_used / 1024 }); + try stdout.print("parsing speed: {:.2}/s, {:.2} used \n", .{ + fmtIntSizeBin(bytes_per_sec), + fmtIntSizeBin(memory_used), + }); } fn testOnce() usize { From acf9151008d5a97e5d91b34cc29f73af79062b48 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Apr 2021 22:36:28 -0700 Subject: [PATCH 028/101] stage2: implement field access for `Enum.tag` syntax --- src/Sema.zig | 104 +++++++++++++++++++++++++++++++++++++-------------- src/type.zig | 26 ++++++------- src/zir.zig | 2 +- 3 files changed, 90 insertions(+), 42 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 771da877b4..8ff71ce8f2 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4351,22 +4351,25 @@ fn namedFieldPtr( field_name: []const u8, field_name_src: LazySrcLoc, ) InnerError!*Inst { + const mod = sema.mod; + const arena = sema.arena; + const elem_ty = switch (object_ptr.ty.zigTypeTag()) { .Pointer => object_ptr.ty.elemType(), - else => return sema.mod.fail(&block.base, object_ptr.src, "expected pointer, found '{}'", .{object_ptr.ty}), + else => return mod.fail(&block.base, object_ptr.src, "expected pointer, found '{}'", .{object_ptr.ty}), }; switch (elem_ty.zigTypeTag()) { .Array => { if (mem.eql(u8, field_name, "len")) { - return sema.mod.constInst(sema.arena, src, .{ + return mod.constInst(arena, src, .{ .ty = Type.initTag(.single_const_pointer_to_comptime_int), .val = try Value.Tag.ref_val.create( - sema.arena, - try Value.Tag.int_u64.create(sema.arena, elem_ty.arrayLen()), + arena, + try Value.Tag.int_u64.create(arena, elem_ty.arrayLen()), ), }); } else { - return sema.mod.fail( + return mod.fail( &block.base, field_name_src, "no member named '{s}' in '{}'", @@ -4379,15 +4382,15 @@ fn namedFieldPtr( switch (ptr_child.zigTypeTag()) { .Array => { if (mem.eql(u8, field_name, "len")) { - return sema.mod.constInst(sema.arena, src, .{ + return mod.constInst(arena, src, .{ .ty = Type.initTag(.single_const_pointer_to_comptime_int), .val = try Value.Tag.ref_val.create( - sema.arena, - try Value.Tag.int_u64.create(sema.arena, ptr_child.arrayLen()), + arena, + try Value.Tag.int_u64.create(arena, ptr_child.arrayLen()), ), }); } else { - return sema.mod.fail( + return mod.fail( &block.base, field_name_src, "no member named '{s}' in '{}'", @@ -4402,7 +4405,7 @@ fn namedFieldPtr( _ = try sema.resolveConstValue(block, object_ptr.src, object_ptr); const result = try sema.analyzeLoad(block, src, object_ptr, object_ptr.src); const val = result.value().?; - const child_type = try val.toType(sema.arena); + const child_type = try val.toType(arena); switch (child_type.zigTypeTag()) { .ErrorSet => { // TODO resolve inferred error sets @@ -4416,42 +4419,87 @@ fn namedFieldPtr( break :blk name; } } - return sema.mod.fail(&block.base, src, "no error named '{s}' in '{}'", .{ + return mod.fail(&block.base, src, "no error named '{s}' in '{}'", .{ field_name, child_type, }); - } else (try sema.mod.getErrorValue(field_name)).key; + } else (try mod.getErrorValue(field_name)).key; - return sema.mod.constInst(sema.arena, src, .{ - .ty = try sema.mod.simplePtrType(sema.arena, child_type, false, .One), + return mod.constInst(arena, src, .{ + .ty = try mod.simplePtrType(arena, child_type, false, .One), .val = try Value.Tag.ref_val.create( - sema.arena, - try Value.Tag.@"error".create(sema.arena, .{ + arena, + try Value.Tag.@"error".create(arena, .{ .name = name, }), ), }); }, - .Struct => { - const container_scope = child_type.getContainerScope(); - if (sema.mod.lookupDeclName(&container_scope.base, field_name)) |decl| { - // TODO if !decl.is_pub and inDifferentFiles() "{} is private" - return sema.analyzeDeclRef(block, src, decl); - } + .Struct, .Opaque, .Union => { + if (child_type.getContainerScope()) |container_scope| { + if (mod.lookupDeclName(&container_scope.base, field_name)) |decl| { + // TODO if !decl.is_pub and inDifferentFiles() "{} is private" + return sema.analyzeDeclRef(block, src, decl); + } - if (container_scope.file_scope == sema.mod.root_scope) { - return sema.mod.fail(&block.base, src, "root source file has no member called '{s}'", .{field_name}); - } else { - return sema.mod.fail(&block.base, src, "container '{}' has no member called '{s}'", .{ child_type, field_name }); + // TODO this will give false positives for structs inside the root file + if (container_scope.file_scope == mod.root_scope) { + return mod.fail( + &block.base, + src, + "root source file has no member named '{s}'", + .{field_name}, + ); + } } + // TODO add note: declared here + const kw_name = switch (child_type.zigTypeTag()) { + .Struct => "struct", + .Opaque => "opaque", + .Union => "union", + else => unreachable, + }; + return mod.fail(&block.base, src, "{s} '{}' has no member named '{s}'", .{ + kw_name, child_type, field_name, + }); }, - else => return sema.mod.fail(&block.base, src, "type '{}' does not support field access", .{child_type}), + .Enum => { + if (child_type.getContainerScope()) |container_scope| { + if (mod.lookupDeclName(&container_scope.base, field_name)) |decl| { + // TODO if !decl.is_pub and inDifferentFiles() "{} is private" + return sema.analyzeDeclRef(block, src, decl); + } + } + const maybe_field_index: ?usize = switch (child_type.tag()) { + .enum_full, .enum_nonexhaustive => blk: { + const enum_full = child_type.castTag(.enum_full).?.data; + break :blk enum_full.fields.getIndex(field_name); + }, + .enum_simple => blk: { + const enum_simple = child_type.castTag(.enum_simple).?.data; + break :blk enum_simple.fields.getIndex(field_name); + }, + else => unreachable, + }; + const field_index = maybe_field_index orelse { + return mod.fail(&block.base, src, "enum '{}' has no member named '{s}'", .{ + child_type, field_name, + }); + }; + const field_index_u32 = @intCast(u32, field_index); + const enum_val = try Value.Tag.enum_field_index.create(arena, field_index_u32); + return mod.constInst(arena, src, .{ + .ty = try mod.simplePtrType(arena, child_type, false, .One), + .val = try Value.Tag.ref_val.create(arena, enum_val), + }); + }, + else => return mod.fail(&block.base, src, "type '{}' has no members", .{child_type}), } }, .Struct => return sema.analyzeStructFieldPtr(block, src, object_ptr, field_name, field_name_src, elem_ty), else => {}, } - return sema.mod.fail(&block.base, src, "type '{}' does not support field access", .{elem_ty}); + return mod.fail(&block.base, src, "type '{}' does not support field access", .{elem_ty}); } fn analyzeStructFieldPtr( diff --git a/src/type.zig b/src/type.zig index c338072c15..576dc46e7e 100644 --- a/src/type.zig +++ b/src/type.zig @@ -634,13 +634,13 @@ pub const Type = extern union { } pub fn format( - self: Type, + start_type: Type, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void { comptime assert(fmt.len == 0); - var ty = self; + var ty = start_type; while (true) { const t = ty.tag(); switch (t) { @@ -687,15 +687,15 @@ pub const Type = extern union { .empty_struct, .empty_struct_literal => return writer.writeAll("struct {}"), .@"struct" => { - const struct_obj = self.castTag(.@"struct").?.data; + const struct_obj = ty.castTag(.@"struct").?.data; return struct_obj.owner_decl.renderFullyQualifiedName(writer); }, .enum_full, .enum_nonexhaustive => { - const enum_full = self.castTag(.enum_full).?.data; + const enum_full = ty.castTag(.enum_full).?.data; return enum_full.owner_decl.renderFullyQualifiedName(writer); }, .enum_simple => { - const enum_simple = self.castTag(.enum_simple).?.data; + const enum_simple = ty.castTag(.enum_simple).?.data; return enum_simple.owner_decl.renderFullyQualifiedName(writer); }, .@"opaque" => { @@ -1886,8 +1886,8 @@ pub const Type = extern union { }; } - pub fn onePossibleValue(self: Type) ?Value { - var ty = self; + pub fn onePossibleValue(starting_type: Type) ?Value { + var ty = starting_type; while (true) switch (ty.tag()) { .f16, .f32, @@ -1954,7 +1954,7 @@ pub const Type = extern union { return Value.initTag(.empty_struct_value); }, .enum_full => { - const enum_full = self.castTag(.enum_full).?.data; + const enum_full = ty.castTag(.enum_full).?.data; if (enum_full.fields.count() == 1) { return enum_full.values.entries.items[0].key; } else { @@ -1962,14 +1962,14 @@ pub const Type = extern union { } }, .enum_simple => { - const enum_simple = self.castTag(.enum_simple).?.data; + const enum_simple = ty.castTag(.enum_simple).?.data; if (enum_simple.fields.count() == 1) { return Value.initTag(.zero); } else { return null; } }, - .enum_nonexhaustive => return self.castTag(.enum_full).?.data.tag_ty.onePossibleValue(), + .enum_nonexhaustive => ty = ty.castTag(.enum_full).?.data.tag_ty, .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), .void => return Value.initTag(.void_value), @@ -2016,15 +2016,15 @@ pub const Type = extern union { (self.isSinglePointer() and self.elemType().zigTypeTag() == .Array); } - /// Asserts that the type is a container. (note: ErrorSet is not a container). - pub fn getContainerScope(self: Type) *Module.Scope.Container { + /// Returns null if the type has no container. + pub fn getContainerScope(self: Type) ?*Module.Scope.Container { return switch (self.tag()) { .@"struct" => &self.castTag(.@"struct").?.data.container, .enum_full => &self.castTag(.enum_full).?.data.container, .empty_struct => self.castTag(.empty_struct).?.data, .@"opaque" => &self.castTag(.@"opaque").?.data, - else => unreachable, + else => null, }; } diff --git a/src/zir.zig b/src/zir.zig index e63d36bced..00ff23acb0 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -1572,6 +1572,7 @@ const Writer = struct { .intcast, .store, .store_to_block_ptr, + .store_to_inferred_ptr, => try self.writeBin(stream, inst), .alloc, @@ -1769,7 +1770,6 @@ const Writer = struct { .bitcast, .bitcast_result_ptr, - .store_to_inferred_ptr, => try stream.writeAll("TODO)"), } } From 19cf987198ff4de0b1460263a62ff6c41e1e3915 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 6 Apr 2021 23:19:46 -0700 Subject: [PATCH 029/101] C backend: implement Enum types and values They are lowered directly as the integer tag type, with no typedef. --- src/Sema.zig | 19 ++++++++++++++----- src/codegen/c.zig | 37 ++++++++++++++++++++++++++++++++++++- src/type.zig | 6 +++--- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 8ff71ce8f2..115ca11858 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1918,11 +1918,20 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerErr switch (enum_tag.ty.tag()) { .enum_full => { const enum_full = enum_tag.ty.castTag(.enum_full).?.data; - const val = enum_full.values.entries.items[field_index].key; - return mod.constInst(arena, src, .{ - .ty = int_tag_ty, - .val = val, - }); + if (enum_full.values.count() != 0) { + const val = enum_full.values.entries.items[field_index].key; + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = val, + }); + } else { + // Field index and integer values are the same. + const val = try Value.Tag.int_u64.create(arena, field_index); + return mod.constInst(arena, src, .{ + .ty = int_tag_ty, + .val = val, + }); + } }, .enum_simple => { // Field index and integer values are the same. diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 876f86ed02..d5d18baa1c 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -172,7 +172,10 @@ pub const DeclGen = struct { val: Value, ) error{ OutOfMemory, AnalysisFail }!void { if (val.isUndef()) { - return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: properly handle undefined in all cases (with debug safety?)", .{}); + // This should lower to 0xaa bytes in safe modes, and for unsafe modes should + // lower to leaving variables uninitialized (that might need to be implemented + // outside of this function). + return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement renderValue undef", .{}); } switch (t.zigTypeTag()) { .Int => { @@ -288,6 +291,31 @@ pub const DeclGen = struct { try writer.writeAll(", .error = 0 }"); } }, + .Enum => { + switch (val.tag()) { + .enum_field_index => { + const field_index = val.castTag(.enum_field_index).?.data; + switch (t.tag()) { + .enum_simple => return writer.print("{d}", .{field_index}), + .enum_full, .enum_nonexhaustive => { + const enum_full = t.cast(Type.Payload.EnumFull).?.data; + if (enum_full.values.count() != 0) { + const tag_val = enum_full.values.entries.items[field_index].key; + return dg.renderValue(writer, enum_full.tag_ty, tag_val); + } else { + return writer.print("{d}", .{field_index}); + } + }, + else => unreachable, + } + }, + else => { + var int_tag_ty_buffer: Type.Payload.Bits = undefined; + const int_tag_ty = t.intTagType(&int_tag_ty_buffer); + return dg.renderValue(writer, int_tag_ty, val); + }, + } + }, else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement value {s}", .{ @tagName(e), }), @@ -472,6 +500,13 @@ pub const DeclGen = struct { try w.writeAll(name); dg.typedefs.putAssumeCapacityNoClobber(t, .{ .name = name, .rendered = rendered }); }, + .Enum => { + // For enums, we simply use the integer tag type. + var int_tag_ty_buffer: Type.Payload.Bits = undefined; + const int_tag_ty = t.intTagType(&int_tag_ty_buffer); + + try dg.renderType(w, int_tag_ty); + }, .Null, .Undefined => unreachable, // must be const or comptime else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{ @tagName(e), diff --git a/src/type.zig b/src/type.zig index 576dc46e7e..6173c0b800 100644 --- a/src/type.zig +++ b/src/type.zig @@ -691,7 +691,7 @@ pub const Type = extern union { return struct_obj.owner_decl.renderFullyQualifiedName(writer); }, .enum_full, .enum_nonexhaustive => { - const enum_full = ty.castTag(.enum_full).?.data; + const enum_full = ty.cast(Payload.EnumFull).?.data; return enum_full.owner_decl.renderFullyQualifiedName(writer); }, .enum_simple => { @@ -1344,7 +1344,7 @@ pub const Type = extern union { /// Asserts the type is an enum. pub fn intTagType(self: Type, buffer: *Payload.Bits) Type { switch (self.tag()) { - .enum_full, .enum_nonexhaustive => return self.castTag(.enum_full).?.data.tag_ty, + .enum_full, .enum_nonexhaustive => return self.cast(Payload.EnumFull).?.data.tag_ty, .enum_simple => { const enum_simple = self.castTag(.enum_simple).?.data; const bits = std.math.log2_int_ceil(usize, enum_simple.fields.count()); @@ -1969,7 +1969,7 @@ pub const Type = extern union { return null; } }, - .enum_nonexhaustive => ty = ty.castTag(.enum_full).?.data.tag_ty, + .enum_nonexhaustive => ty = ty.castTag(.enum_nonexhaustive).?.data.tag_ty, .empty_struct, .empty_struct_literal => return Value.initTag(.empty_struct_value), .void => return Value.initTag(.void_value), From 01a39fa1d4d0d2e3305af8e6d6af1079f020db7f Mon Sep 17 00:00:00 2001 From: jacob gw Date: Tue, 6 Apr 2021 22:38:25 -0400 Subject: [PATCH 030/101] stage2: coerce enum_literal -> enum --- src/Sema.zig | 54 ++++++++++++++++++++++++++++++++++++++++++++ test/stage2/test.zig | 41 ++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/src/Sema.zig b/src/Sema.zig index 115ca11858..0cd9837c3a 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4702,6 +4702,60 @@ fn coerce( } } }, + .Enum => { + if (inst.ty.zigTypeTag() == .EnumLiteral) { + const val = (try sema.resolveDefinedValue(block, inst_src, inst)).?; + const bytes = val.castTag(.enum_literal).?.data; + switch (dest_type.tag()) { + .enum_full => { + const enumeration = dest_type.castTag(.enum_full).?.data; + const enum_fields = enumeration.fields; + const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( + &block.base, + inst_src, + "enum '{s}' has no field named '{s}'", + .{ enumeration.owner_decl.name, bytes }, + ); + const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); + return sema.mod.constInst(sema.arena, inst_src, .{ + .ty = dest_type, + .val = val_pl, + }); + }, + .enum_simple => { + const enumeration = dest_type.castTag(.enum_simple).?.data; + const enum_fields = enumeration.fields; + const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( + &block.base, + inst_src, + "enum '{s}' has no field named '{s}'", + .{ enumeration.owner_decl.name, bytes }, + ); + const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); + return sema.mod.constInst(sema.arena, inst_src, .{ + .ty = dest_type, + .val = val_pl, + }); + }, + .enum_nonexhaustive => { + const enumeration = dest_type.castTag(.enum_nonexhaustive).?.data; + const enum_fields = enumeration.fields; + const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( + &block.base, + inst_src, + "enum '{s}' has no field named '{s}'", + .{ enumeration.owner_decl.name, bytes }, + ); + const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); + return sema.mod.constInst(sema.arena, inst_src, .{ + .ty = dest_type, + .val = val_pl, + }); + }, + else => unreachable, + } + } + }, else => {}, } diff --git a/test/stage2/test.zig b/test/stage2/test.zig index 4ef172e65d..2d3a445ca1 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -1022,7 +1022,7 @@ pub fn addCases(ctx: *TestContext) !void { "Hello, World!\n", ); try case.files.append(.{ - .src = + .src = \\pub fn print() void { \\ asm volatile ("syscall" \\ : @@ -1598,4 +1598,43 @@ pub fn addCases(ctx: *TestContext) !void { "", ); } + { + var case = ctx.exe("enum_literal -> enum", linux_x64); + + case.addCompareOutput( + \\const E = enum { a, b }; + \\export fn _start() noreturn { + \\ const a: E = .a; + \\ const b: E = .b; + \\ exit(); + \\} + \\fn exit() noreturn { + \\ asm volatile ("syscall" + \\ : + \\ : [number] "{rax}" (231), + \\ [arg1] "{rdi}" (0) + \\ : "rcx", "r11", "memory" + \\ ); + \\ unreachable; + \\} + , + "", + ); + case.addError( + \\const E = enum { a, b }; + \\export fn _start() noreturn { + \\ const a: E = .c; + \\ exit(); + \\} + \\fn exit() noreturn { + \\ asm volatile ("syscall" + \\ : + \\ : [number] "{rax}" (231), + \\ [arg1] "{rdi}" (0) + \\ : "rcx", "r11", "memory" + \\ ); + \\ unreachable; + \\} + , &.{":3:19: error: enum 'E' has no field named 'c'"}); + } } From 2871d32be727fc729ba4be0c615cb5fe97591391 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Wed, 7 Apr 2021 05:25:59 -0400 Subject: [PATCH 031/101] test: fix std.time timing tests to skip on failure --- lib/std/os/linux/io_uring.zig | 2 +- lib/std/time.zig | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig index 6ffee12bfd..fc5af34696 100644 --- a/lib/std/os/linux/io_uring.zig +++ b/lib/std/os/linux/io_uring.zig @@ -1354,7 +1354,7 @@ test "timeout (after a relative time)" { .flags = 0, }, cqe); - // Tests should not depend on timings: skip test (result) if outside margin. + // Tests should not depend on timings: skip test if outside margin. if (!std.math.approxEqAbs(f64, ms, @intToFloat(f64, stopped - started), margin)) return error.SkipZigTest; } diff --git a/lib/std/time.zig b/lib/std/time.zig index 7435a67e3d..f0118d2642 100644 --- a/lib/std/time.zig +++ b/lib/std/time.zig @@ -271,7 +271,9 @@ test "timestamp" { sleep(ns_per_ms); const time_1 = milliTimestamp(); const interval = time_1 - time_0; - testing.expect(interval > 0 and interval < margin); + testing.expect(interval > 0); + // Tests should not depend on timings: skip test if outside margin. + if (!(interval < margin)) return error.SkipZigTest; } test "Timer" { @@ -280,7 +282,9 @@ test "Timer" { var timer = try Timer.start(); sleep(10 * ns_per_ms); const time_0 = timer.read(); - testing.expect(time_0 > 0 and time_0 < margin); + testing.expect(time_0 > 0); + // Tests should not depend on timings: skip test if outside margin. + if (!(time_0 < margin)) return error.SkipZigTest; const time_1 = timer.lap(); testing.expect(time_1 >= time_0); From 4ff5a3cd94b0532f2cd713082948b00a8a36336f Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Wed, 7 Apr 2021 15:15:14 +0200 Subject: [PATCH 032/101] stage2 regalloc: Add unit test for getReg --- src/codegen.zig | 3 ++- src/register_manager.zig | 42 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/codegen.zig b/src/codegen.zig index cacf51730a..220a8fa374 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -1735,7 +1735,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { switch (result) { .register => |reg| { - try self.register_manager.getRegAssumeFree(toCanonicalReg(reg), &inst.base); + try self.register_manager.registers.ensureCapacity(self.gpa, self.register_manager.registers.count() + 1); + self.register_manager.getRegAssumeFree(toCanonicalReg(reg), &inst.base); }, else => {}, } diff --git a/src/register_manager.zig b/src/register_manager.zig index 356251eed8..e11f2c3111 100644 --- a/src/register_manager.zig +++ b/src/register_manager.zig @@ -137,6 +137,7 @@ pub fn RegisterManager( /// Allocates the specified register with the specified /// instruction. Spills the register if it is currently /// allocated. + /// Before calling, must ensureCapacity + 1 on self.registers. pub fn getReg(self: *Self, reg: Register, inst: *ir.Inst) !void { if (!isTracked(reg)) return; @@ -148,7 +149,7 @@ pub fn RegisterManager( regs_entry.value = inst; try self.getFunction().spillInstruction(spilled_inst.src, reg, spilled_inst); } else { - try self.getRegAssumeFree(reg, inst); + self.getRegAssumeFree(reg, inst); } } @@ -160,7 +161,7 @@ pub fn RegisterManager( if (!self.isRegFree(reg)) { // Move the instruction that was previously there to a // stack allocation. - const regs_entry = self.registers.getEntry(reg).?; + const regs_entry = self.registers.remove(reg).?; const spilled_inst = regs_entry.value; try self.getFunction().spillInstruction(spilled_inst.src, reg, spilled_inst); self.markRegFree(reg); @@ -170,10 +171,11 @@ pub fn RegisterManager( /// Allocates the specified register with the specified /// instruction. Assumes that the register is free and no /// spilling is necessary. - pub fn getRegAssumeFree(self: *Self, reg: Register, inst: *ir.Inst) !void { + /// Before calling, must ensureCapacity + 1 on self.registers. + pub fn getRegAssumeFree(self: *Self, reg: Register, inst: *ir.Inst) void { if (!isTracked(reg)) return; - try self.registers.putNoClobber(self.getFunction().gpa, reg, inst); + self.registers.putAssumeCapacityNoClobber(reg, inst); self.markRegUsed(reg); } @@ -279,3 +281,35 @@ test "allocReg: spilling" { std.testing.expectEqual(@as(?MockRegister, .r3), try function.register_manager.allocReg(&mock_instruction)); std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r2}, function.spilled.items); } + +test "getReg" { + const allocator = std.testing.allocator; + + var function = MockFunction{ + .allocator = allocator, + }; + defer function.deinit(); + + var mock_instruction = ir.Inst{ + .tag = .breakpoint, + .ty = Type.initTag(.void), + .src = .unneeded, + }; + + std.testing.expect(!function.register_manager.isRegAllocated(.r2)); + std.testing.expect(!function.register_manager.isRegAllocated(.r3)); + + try function.register_manager.registers.ensureCapacity(allocator, function.register_manager.registers.count() + 2); + try function.register_manager.getReg(.r3, &mock_instruction); + + std.testing.expect(!function.register_manager.isRegAllocated(.r2)); + std.testing.expect(function.register_manager.isRegAllocated(.r3)); + + // Spill r3 + try function.register_manager.registers.ensureCapacity(allocator, function.register_manager.registers.count() + 2); + try function.register_manager.getReg(.r3, &mock_instruction); + + std.testing.expect(!function.register_manager.isRegAllocated(.r2)); + std.testing.expect(function.register_manager.isRegAllocated(.r3)); + std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r3}, function.spilled.items); +} From bcc371618fd71185e71a889c09eb68733ca66842 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 10:24:57 -0700 Subject: [PATCH 033/101] AstGen: fix `@breakpoint` ZIR Previously it relied on the breakpoint ZIR instruction being void, but that's no longer how things work. --- src/AstGen.zig | 4 ++-- test/stage2/cbe.zig | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 6c3ce1251c..a059ab04cb 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -3894,11 +3894,11 @@ fn builtinCall( return rvalue(gz, scope, rl, result, node); }, .breakpoint => { - const result = try gz.add(.{ + _ = try gz.add(.{ .tag = .breakpoint, .data = .{ .node = gz.astgen.decl.nodeIndexToRelative(node) }, }); - return rvalue(gz, scope, rl, result, node); + return rvalue(gz, scope, rl, .void_value, node); }, .import => { const target = try expr(gz, scope, .none, params[0]); diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index bfab645323..a6d47b40a9 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -280,6 +280,15 @@ pub fn addCases(ctx: *TestContext) !void { \\} , ""); + // If expression with breakpoint that does not get hit + case.addCompareOutput( + \\export fn main() c_int { + \\ var x: i32 = 1; + \\ if (x != 1) @breakpoint(); + \\ return 0; + \\} + , ""); + // Switch expression case.addCompareOutput( \\export fn main() c_int { From 4e8fb9e6a5f9a65bbf6469e386e83ba469e7543b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 11:26:07 -0700 Subject: [PATCH 034/101] Sema: DRY up enum field analysis and add "declared here" notes --- src/Module.zig | 21 ++++++++ src/Sema.zig | 114 ++++++++++++++++++------------------------- src/type.zig | 36 ++++++++++++++ test/stage2/cbe.zig | 4 +- test/stage2/test.zig | 9 ++-- 5 files changed, 113 insertions(+), 71 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index 8c58b63995..9d26738e14 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -366,6 +366,13 @@ pub const ErrorSet = struct { /// The string bytes are stored in the owner Decl arena. /// They are in the same order they appear in the AST. names_ptr: [*]const []const u8, + + pub fn srcLoc(self: ErrorSet) SrcLoc { + return .{ + .container = .{ .decl = self.owner_decl }, + .lazy = .{ .node_offset = self.node_offset }, + }; + } }; /// Represents the data that a struct declaration provides. @@ -408,6 +415,13 @@ pub const EnumSimple = struct { fields: std.StringArrayHashMapUnmanaged(void), /// Offset from `owner_decl`, points to the enum decl AST node. node_offset: i32, + + pub fn srcLoc(self: EnumSimple) SrcLoc { + return .{ + .container = .{ .decl = self.owner_decl }, + .lazy = .{ .node_offset = self.node_offset }, + }; + } }; /// Represents the data that an enum declaration provides, when there is @@ -429,6 +443,13 @@ pub const EnumFull = struct { node_offset: i32, pub const ValueMap = std.ArrayHashMapUnmanaged(Value, void, Value.hash_u32, Value.eql, false); + + pub fn srcLoc(self: EnumFull) SrcLoc { + return .{ + .container = .{ .decl = self.owner_decl }, + .lazy = .{ .node_offset = self.node_offset }, + }; + } }; /// Some Fn struct memory is owned by the Decl's TypedValue.Managed arena allocator. diff --git a/src/Sema.zig b/src/Sema.zig index 0cd9837c3a..41544cdfe5 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -897,7 +897,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Ind try mod.errNoteNonLazy( struct_obj.srcLoc(), msg, - "'{s}' declared here", + "struct '{s}' declared here", .{fqn}, ); return mod.failWithOwnedErrorMsg(&block.base, msg); @@ -925,7 +925,7 @@ fn failWithBadFieldAccess( .{ field_name, fqn }, ); errdefer msg.destroy(gpa); - try mod.errNoteNonLazy(struct_obj.srcLoc(), msg, "'{s}' declared here", .{fqn}); + try mod.errNoteNonLazy(struct_obj.srcLoc(), msg, "struct declared here", .{}); break :msg msg; }; return mod.failWithOwnedErrorMsg(&block.base, msg); @@ -4479,21 +4479,24 @@ fn namedFieldPtr( return sema.analyzeDeclRef(block, src, decl); } } - const maybe_field_index: ?usize = switch (child_type.tag()) { - .enum_full, .enum_nonexhaustive => blk: { - const enum_full = child_type.castTag(.enum_full).?.data; - break :blk enum_full.fields.getIndex(field_name); - }, - .enum_simple => blk: { - const enum_simple = child_type.castTag(.enum_simple).?.data; - break :blk enum_simple.fields.getIndex(field_name); - }, - else => unreachable, - }; - const field_index = maybe_field_index orelse { - return mod.fail(&block.base, src, "enum '{}' has no member named '{s}'", .{ - child_type, field_name, - }); + const field_index = child_type.enumFieldIndex(field_name) orelse { + const msg = msg: { + const msg = try mod.errMsg( + &block.base, + src, + "enum '{}' has no member named '{s}'", + .{ child_type, field_name }, + ); + errdefer msg.destroy(sema.gpa); + try mod.errNoteNonLazy( + child_type.declSrcLoc(), + msg, + "enum declared here", + .{}, + ); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); }; const field_index_u32 = @intCast(u32, field_index); const enum_val = try Value.Tag.enum_field_index.create(arena, field_index_u32); @@ -4593,10 +4596,13 @@ fn coerce( return sema.bitcast(block, dest_type, inst); } + const mod = sema.mod; + const arena = sema.arena; + // undefined to anything if (inst.value()) |val| { if (val.isUndef() or inst.ty.zigTypeTag() == .Undefined) { - return sema.mod.constInst(sema.arena, inst_src, .{ .ty = dest_type, .val = val }); + return mod.constInst(arena, inst_src, .{ .ty = dest_type, .val = val }); } } assert(inst.ty.zigTypeTag() != .Undefined); @@ -4610,13 +4616,13 @@ fn coerce( if (try sema.coerceNum(block, dest_type, inst)) |some| return some; - const target = sema.mod.getTarget(); + const target = mod.getTarget(); switch (dest_type.zigTypeTag()) { .Optional => { // null to ?T if (inst.ty.zigTypeTag() == .Null) { - return sema.mod.constInst(sema.arena, inst_src, .{ .ty = dest_type, .val = Value.initTag(.null_value) }); + return mod.constInst(arena, inst_src, .{ .ty = dest_type, .val = Value.initTag(.null_value) }); } // T to ?T @@ -4703,63 +4709,39 @@ fn coerce( } }, .Enum => { + // enum literal to enum if (inst.ty.zigTypeTag() == .EnumLiteral) { - const val = (try sema.resolveDefinedValue(block, inst_src, inst)).?; + const val = try sema.resolveConstValue(block, inst_src, inst); const bytes = val.castTag(.enum_literal).?.data; - switch (dest_type.tag()) { - .enum_full => { - const enumeration = dest_type.castTag(.enum_full).?.data; - const enum_fields = enumeration.fields; - const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( + const field_index = dest_type.enumFieldIndex(bytes) orelse { + const msg = msg: { + const msg = try mod.errMsg( &block.base, inst_src, - "enum '{s}' has no field named '{s}'", - .{ enumeration.owner_decl.name, bytes }, + "enum '{}' has no field named '{s}'", + .{ dest_type, bytes }, ); - const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); - return sema.mod.constInst(sema.arena, inst_src, .{ - .ty = dest_type, - .val = val_pl, - }); - }, - .enum_simple => { - const enumeration = dest_type.castTag(.enum_simple).?.data; - const enum_fields = enumeration.fields; - const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( - &block.base, - inst_src, - "enum '{s}' has no field named '{s}'", - .{ enumeration.owner_decl.name, bytes }, + errdefer msg.destroy(sema.gpa); + try mod.errNoteNonLazy( + dest_type.declSrcLoc(), + msg, + "enum declared here", + .{}, ); - const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); - return sema.mod.constInst(sema.arena, inst_src, .{ - .ty = dest_type, - .val = val_pl, - }); - }, - .enum_nonexhaustive => { - const enumeration = dest_type.castTag(.enum_nonexhaustive).?.data; - const enum_fields = enumeration.fields; - const i = enum_fields.getIndex(bytes) orelse return sema.mod.fail( - &block.base, - inst_src, - "enum '{s}' has no field named '{s}'", - .{ enumeration.owner_decl.name, bytes }, - ); - const val_pl = try Value.Tag.enum_field_index.create(sema.arena, @intCast(u32, i)); - return sema.mod.constInst(sema.arena, inst_src, .{ - .ty = dest_type, - .val = val_pl, - }); - }, - else => unreachable, - } + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); + }; + return mod.constInst(arena, inst_src, .{ + .ty = dest_type, + .val = try Value.Tag.enum_field_index.create(arena, @intCast(u32, field_index)), + }); } }, else => {}, } - return sema.mod.fail(&block.base, inst_src, "expected {}, found {}", .{ dest_type, inst.ty }); + return mod.fail(&block.base, inst_src, "expected {}, found {}", .{ dest_type, inst.ty }); } const InMemoryCoercionResult = enum { diff --git a/src/type.zig b/src/type.zig index 6173c0b800..06e84c245b 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2090,6 +2090,42 @@ pub const Type = extern union { }; } + pub fn enumFieldIndex(ty: Type, field_name: []const u8) ?usize { + switch (ty.tag()) { + .enum_full, .enum_nonexhaustive => { + const enum_full = ty.cast(Payload.EnumFull).?.data; + return enum_full.fields.getIndex(field_name); + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return enum_simple.fields.getIndex(field_name); + }, + else => unreachable, + } + } + + pub fn declSrcLoc(ty: Type) Module.SrcLoc { + switch (ty.tag()) { + .enum_full, .enum_nonexhaustive => { + const enum_full = ty.cast(Payload.EnumFull).?.data; + return enum_full.srcLoc(); + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return enum_simple.srcLoc(); + }, + .@"struct" => { + const struct_obj = ty.castTag(.@"struct").?.data; + return struct_obj.srcLoc(); + }, + .error_set => { + const error_set = ty.castTag(.error_set).?.data; + return error_set.srcLoc(); + }, + else => unreachable, + } + } + /// Asserts the type is an enum. pub fn enumHasInt(ty: Type, int: Value, target: Target) bool { const S = struct { diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index bfab645323..3acbbdd0ae 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -508,7 +508,7 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &.{ ":3:21: error: mising struct field: x", - ":1:15: note: 'Point' declared here", + ":1:15: note: struct 'Point' declared here", }); case.addError( \\const Point = struct { x: i32, y: i32 }; @@ -522,7 +522,7 @@ pub fn addCases(ctx: *TestContext) !void { \\} , &.{ ":6:10: error: no field named 'z' in struct 'Point'", - ":1:15: note: 'Point' declared here", + ":1:15: note: struct declared here", }); case.addCompareOutput( \\const Point = struct { x: i32, y: i32 }; diff --git a/test/stage2/test.zig b/test/stage2/test.zig index 2d3a445ca1..fe0c5e5d9e 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -1022,7 +1022,7 @@ pub fn addCases(ctx: *TestContext) !void { "Hello, World!\n", ); try case.files.append(.{ - .src = + .src = \\pub fn print() void { \\ asm volatile ("syscall" \\ : @@ -1621,11 +1621,11 @@ pub fn addCases(ctx: *TestContext) !void { "", ); case.addError( - \\const E = enum { a, b }; \\export fn _start() noreturn { \\ const a: E = .c; \\ exit(); \\} + \\const E = enum { a, b }; \\fn exit() noreturn { \\ asm volatile ("syscall" \\ : @@ -1635,6 +1635,9 @@ pub fn addCases(ctx: *TestContext) !void { \\ ); \\ unreachable; \\} - , &.{":3:19: error: enum 'E' has no field named 'c'"}); + , &.{ + ":2:19: error: enum 'E' has no field named 'c'", + ":5:11: note: enum declared here", + }); } } From d9c25ec6720ecb0bc79fcab67659ee12ca6ad687 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 11:34:23 -0700 Subject: [PATCH 035/101] zir: use `node` union field for `alloc_inferred` Previously we used `un_node` and passed `undefined` for the operand, but this causes illegal behavior when printing ZIR code. --- src/AstGen.zig | 4 ++-- src/Sema.zig | 4 ++-- src/zir.zig | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index af9938d425..d6c2eea5a3 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1484,7 +1484,7 @@ fn varDecl( init_scope.rl_ptr = try init_scope.addUnNode(.alloc, type_inst, node); init_scope.rl_ty_inst = type_inst; } else { - const alloc = try init_scope.addUnNode(.alloc_inferred, undefined, node); + const alloc = try init_scope.addNode(.alloc_inferred, node); resolve_inferred_alloc = alloc; init_scope.rl_ptr = alloc; } @@ -1559,7 +1559,7 @@ fn varDecl( const alloc = try gz.addUnNode(.alloc_mut, type_inst, node); break :a .{ .alloc = alloc, .result_loc = .{ .ptr = alloc } }; } else a: { - const alloc = try gz.addUnNode(.alloc_inferred_mut, undefined, node); + const alloc = try gz.addNode(.alloc_inferred_mut, node); resolve_inferred_alloc = alloc; break :a .{ .alloc = alloc, .result_loc = .{ .inferred_ptr = alloc } }; }; diff --git a/src/Sema.zig b/src/Sema.zig index 41544cdfe5..80b9ae37c9 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -785,8 +785,8 @@ fn zirAllocInferred( const tracy = trace(@src()); defer tracy.end(); - const inst_data = sema.code.instructions.items(.data)[inst].un_node; - const src = inst_data.src(); + const src_node = sema.code.instructions.items(.data)[inst].node; + const src: LazySrcLoc = .{ .node_offset = src_node }; const val_payload = try sema.arena.create(Value.Payload.InferredAlloc); val_payload.* = .{ diff --git a/src/zir.zig b/src/zir.zig index 00ff23acb0..d3d9d56bfd 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -130,7 +130,7 @@ pub const Inst = struct { /// Same as `alloc` except mutable. alloc_mut, /// Same as `alloc` except the type is inferred. - /// The operand is unused. + /// Uses the `node` union field. alloc_inferred, /// Same as `alloc_inferred` except mutable. alloc_inferred_mut, @@ -1577,8 +1577,6 @@ const Writer = struct { .alloc, .alloc_mut, - .alloc_inferred, - .alloc_inferred_mut, .indexable_ptr_len, .bit_not, .bool_not, @@ -1745,6 +1743,8 @@ const Writer = struct { .ret_type, .repeat, .repeat_inline, + .alloc_inferred, + .alloc_inferred_mut, => try self.writeNode(stream, inst), .error_value, From 18119aae30660c27b088214319cfca396fdf04bf Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 12:15:05 -0700 Subject: [PATCH 036/101] Sema: implement comparison analysis for non-numeric types --- src/Sema.zig | 41 ++++++++++++++++++++++++++++++++--------- src/type.zig | 41 +++++++++++++++++++++++++++++++++++++++++ test/stage2/cbe.zig | 21 +++++++++++++++++++++ 3 files changed, 94 insertions(+), 9 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 80b9ae37c9..379d19fd9d 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -3776,9 +3776,13 @@ fn zirCmp( const tracy = trace(@src()); defer tracy.end(); + const mod = sema.mod; + const inst_data = sema.code.instructions.items(.data)[inst].pl_node; const extra = sema.code.extraData(zir.Inst.Bin, inst_data.payload_index).data; const src: LazySrcLoc = inst_data.src(); + const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node }; + const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; const lhs = try sema.resolveInst(extra.lhs); const rhs = try sema.resolveInst(extra.rhs); @@ -3790,7 +3794,7 @@ fn zirCmp( const rhs_ty_tag = rhs.ty.zigTypeTag(); if (is_equality_cmp and lhs_ty_tag == .Null and rhs_ty_tag == .Null) { // null == null, null != null - return sema.mod.constBool(sema.arena, src, op == .eq); + return mod.constBool(sema.arena, src, op == .eq); } else if (is_equality_cmp and ((lhs_ty_tag == .Null and rhs_ty_tag == .Optional) or rhs_ty_tag == .Null and lhs_ty_tag == .Optional)) @@ -3801,23 +3805,23 @@ fn zirCmp( } else if (is_equality_cmp and ((lhs_ty_tag == .Null and rhs.ty.isCPtr()) or (rhs_ty_tag == .Null and lhs.ty.isCPtr()))) { - return sema.mod.fail(&block.base, src, "TODO implement C pointer cmp", .{}); + return mod.fail(&block.base, src, "TODO implement C pointer cmp", .{}); } else if (lhs_ty_tag == .Null or rhs_ty_tag == .Null) { const non_null_type = if (lhs_ty_tag == .Null) rhs.ty else lhs.ty; - return sema.mod.fail(&block.base, src, "comparison of '{}' with null", .{non_null_type}); + return mod.fail(&block.base, src, "comparison of '{}' with null", .{non_null_type}); } else if (is_equality_cmp and ((lhs_ty_tag == .EnumLiteral and rhs_ty_tag == .Union) or (rhs_ty_tag == .EnumLiteral and lhs_ty_tag == .Union))) { - return sema.mod.fail(&block.base, src, "TODO implement equality comparison between a union's tag value and an enum literal", .{}); + return mod.fail(&block.base, src, "TODO implement equality comparison between a union's tag value and an enum literal", .{}); } else if (lhs_ty_tag == .ErrorSet and rhs_ty_tag == .ErrorSet) { if (!is_equality_cmp) { - return sema.mod.fail(&block.base, src, "{s} operator not allowed for errors", .{@tagName(op)}); + return mod.fail(&block.base, src, "{s} operator not allowed for errors", .{@tagName(op)}); } if (rhs.value()) |rval| { if (lhs.value()) |lval| { // TODO optimisation oppurtunity: evaluate if std.mem.eql is faster with the names, or calling to Module.getErrorValue to get the values and then compare them is faster - return sema.mod.constBool(sema.arena, src, std.mem.eql(u8, lval.castTag(.@"error").?.data.name, rval.castTag(.@"error").?.data.name) == (op == .eq)); + return mod.constBool(sema.arena, src, std.mem.eql(u8, lval.castTag(.@"error").?.data.name, rval.castTag(.@"error").?.data.name) == (op == .eq)); } } try sema.requireRuntimeBlock(block, src); @@ -3829,11 +3833,30 @@ fn zirCmp( return sema.cmpNumeric(block, src, lhs, rhs, op); } else if (lhs_ty_tag == .Type and rhs_ty_tag == .Type) { if (!is_equality_cmp) { - return sema.mod.fail(&block.base, src, "{s} operator not allowed for types", .{@tagName(op)}); + return mod.fail(&block.base, src, "{s} operator not allowed for types", .{@tagName(op)}); } - return sema.mod.constBool(sema.arena, src, lhs.value().?.eql(rhs.value().?) == (op == .eq)); + return mod.constBool(sema.arena, src, lhs.value().?.eql(rhs.value().?) == (op == .eq)); } - return sema.mod.fail(&block.base, src, "TODO implement more cmp analysis", .{}); + + const instructions = &[_]*Inst{ lhs, rhs }; + const resolved_type = try sema.resolvePeerTypes(block, src, instructions); + if (!resolved_type.isSelfComparable(is_equality_cmp)) { + return mod.fail(&block.base, src, "operator not allowed for type '{}'", .{resolved_type}); + } + + const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src); + const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs_src); + try sema.requireRuntimeBlock(block, src); // TODO try to do it at comptime + const bool_type = Type.initTag(.bool); // TODO handle vectors + const tag: Inst.Tag = switch (op) { + .lt => .cmp_lt, + .lte => .cmp_lte, + .eq => .cmp_eq, + .gte => .cmp_gte, + .gt => .cmp_gt, + .neq => .cmp_neq, + }; + return block.addBinOp(src, bool_type, tag, casted_lhs, casted_rhs); } fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { diff --git a/src/type.zig b/src/type.zig index 06e84c245b..dfd021617e 100644 --- a/src/type.zig +++ b/src/type.zig @@ -107,6 +107,42 @@ pub const Type = extern union { } } + pub fn isSelfComparable(ty: Type, is_equality_cmp: bool) bool { + return switch (ty.zigTypeTag()) { + .Int, + .Float, + .ComptimeFloat, + .ComptimeInt, + .Vector, // TODO some vectors require is_equality_cmp==true + => true, + + .Bool, + .Type, + .Void, + .ErrorSet, + .Fn, + .BoundFn, + .Opaque, + .AnyFrame, + .Enum, + .EnumLiteral, + => is_equality_cmp, + + .NoReturn, + .Array, + .Struct, + .Undefined, + .Null, + .ErrorUnion, + .Union, + .Frame, + => false, + + .Pointer => is_equality_cmp or ty.isCPtr(), + .Optional => is_equality_cmp and ty.isAbiPtr(), + }; + } + pub fn initTag(comptime small_tag: Tag) Type { comptime assert(@enumToInt(small_tag) < Tag.no_payload_count); return .{ .tag_if_small_enough = @enumToInt(small_tag) }; @@ -1583,6 +1619,11 @@ pub const Type = extern union { } } + /// Returns whether the type is represented as a pointer in the ABI. + pub fn isAbiPtr(self: Type) bool { + @panic("TODO implement this"); + } + /// Asserts that the type is an error union. pub fn errorUnionChild(self: Type) Type { return switch (self.tag()) { diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 3acbbdd0ae..870059629b 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -536,6 +536,27 @@ pub fn addCases(ctx: *TestContext) !void { , ""); } + { + var case = ctx.exeFromCompiledC("enums", .{}); + case.addCompareOutput( + \\const Number = enum { One, Two, Three }; + \\ + \\export fn main() c_int { + \\ var number1 = Number.One; + \\ var number2: Number = .Two; + \\ const number3 = @intToEnum(Number, 2); + \\ if (number1 == number2) return 1; + \\ if (number2 == number3) return 1; + \\ if (@enumToInt(number1) != 0) return 1; + \\ if (@enumToInt(number2) != 1) return 1; + \\ if (@enumToInt(number3) != 2) return 1; + \\ var x: Number = .Two; + \\ if (number2 != x) return 1; + \\ return 0; + \\} + , ""); + } + ctx.c("empty start function", linux_x64, \\export fn _start() noreturn { \\ unreachable; From e32898b0dedf1da13798f798d2825113b0be748b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 12:59:50 -0700 Subject: [PATCH 037/101] AstGen: fix switch expressions with all prongs noreturn --- src/AstGen.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index d6c2eea5a3..6149169c7f 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -3356,8 +3356,13 @@ fn switchExpr( switch (strat.tag) { .break_operand => { // Switch expressions return `true` for `nodeMayNeedMemoryLocation` thus - // this is always true. - assert(strat.elide_store_to_block_ptr_instructions); + // `elide_store_to_block_ptr_instructions` will either be true, + // or all prongs are noreturn. + if (!strat.elide_store_to_block_ptr_instructions) { + astgen.extra.appendSliceAssumeCapacity(scalar_cases_payload.items); + astgen.extra.appendSliceAssumeCapacity(multi_cases_payload.items); + return astgen.indexToRef(switch_block); + } // There will necessarily be a store_to_block_ptr for // all prongs, except for prongs that ended with a noreturn instruction. From 090834380cff9f2743f9c71e8e141ac5aceb747e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 13:06:21 -0700 Subject: [PATCH 038/101] Type: use isPtrLikeOptional instead of isAbiPtr Thanks @Vexu --- src/type.zig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/type.zig b/src/type.zig index dfd021617e..a542f9a6fa 100644 --- a/src/type.zig +++ b/src/type.zig @@ -139,7 +139,7 @@ pub const Type = extern union { => false, .Pointer => is_equality_cmp or ty.isCPtr(), - .Optional => is_equality_cmp and ty.isAbiPtr(), + .Optional => is_equality_cmp and ty.isPtrLikeOptional(), }; } @@ -1619,11 +1619,6 @@ pub const Type = extern union { } } - /// Returns whether the type is represented as a pointer in the ABI. - pub fn isAbiPtr(self: Type) bool { - @panic("TODO implement this"); - } - /// Asserts that the type is an error union. pub fn errorUnionChild(self: Type) Type { return switch (self.tag()) { From 015599d1ef1606e56c49118800a4c7ef36c038e6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 13:16:36 -0700 Subject: [PATCH 039/101] C backend: enumerate all the types in renderType Now that we're close to supporting all the types, get rid of the `else` prong and explicitly list out those types that are not yet implemented. Thanks @g-w1 --- src/codegen/c.zig | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/codegen/c.zig b/src/codegen/c.zig index d5d18baa1c..874baccf42 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -396,6 +396,9 @@ pub const DeclGen = struct { else => unreachable, } }, + + .Float => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Float", .{}), + .Pointer => { if (t.isSlice()) { return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement slices", .{}); @@ -507,10 +510,22 @@ pub const DeclGen = struct { try dg.renderType(w, int_tag_ty); }, - .Null, .Undefined => unreachable, // must be const or comptime - else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{ - @tagName(e), - }), + .Union => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Union", .{}), + .Fn => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Fn", .{}), + .Opaque => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Opaque", .{}), + .Frame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Frame", .{}), + .AnyFrame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type AnyFrame", .{}), + .Vector => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Vector", .{}), + + .Null, + .Undefined, + .EnumLiteral, + .ComptimeFloat, + .ComptimeInt, + .Type, + => unreachable, // must be const or comptime + + .BoundFn => unreachable, // this type will be deleted from the language } } From 4c71942f84261e9872cd27139c45b6d5fb1ab6c7 Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Thu, 8 Apr 2021 05:24:17 +0800 Subject: [PATCH 040/101] stage2: Add .div to ir.zig --- src/Sema.zig | 1 + src/codegen.zig | 10 ++++++++++ src/codegen/c.zig | 3 +++ src/ir.zig | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/src/Sema.zig b/src/Sema.zig index 0b5a21ce42..1a9c60a680 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -3540,6 +3540,7 @@ fn analyzeArithmetic( .subwrap => .subwrap, .mul => .mul, .mulwrap => .mulwrap, + .div => .div, else => return sema.mod.fail(&block.base, src, "TODO implement arithmetic for operand '{s}''", .{@tagName(zir_tag)}), }; diff --git a/src/codegen.zig b/src/codegen.zig index fbd412ceba..3958577d95 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -855,6 +855,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { .not => return self.genNot(inst.castTag(.not).?), .mul => return self.genMul(inst.castTag(.mul).?), .mulwrap => return self.genMulWrap(inst.castTag(.mulwrap).?), + .div => return self.genDiv(inst.castTag(.div).?), .ptrtoint => return self.genPtrToInt(inst.castTag(.ptrtoint).?), .ref => return self.genRef(inst.castTag(.ref).?), .ret => return self.genRet(inst.castTag(.ret).?), @@ -1092,6 +1093,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { } } + fn genDiv(self: *Self, inst: *ir.Inst.BinOp) !MCValue { + // No side effects, so if it's unreferenced, do nothing. + if (inst.base.isUnused()) + return MCValue.dead; + switch (arch) { + else => return self.fail(inst.base.src, "TODO implement div for {}", .{self.target.cpu.arch}), + } + } + fn genBitAnd(self: *Self, inst: *ir.Inst.BinOp) !MCValue { // No side effects, so if it's unreferenced, do nothing. if (inst.base.isUnused()) diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 876f86ed02..d3ddbdeef9 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -582,6 +582,9 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi .mul => try genBinOp(o, inst.castTag(.sub).?, " * "), // TODO make this do wrapping multiplication for signed ints .mulwrap => try genBinOp(o, inst.castTag(.sub).?, " * "), + // TODO use a different strategy for div that communicates to the optimizer + // that wrapping is UB. + .div => try genBinOp(o, inst.castTag(.div).?, " / "), .constant => unreachable, // excluded from function bodies .alloc => try genAlloc(o, inst.castTag(.alloc).?), diff --git a/src/ir.zig b/src/ir.zig index ab6fb29e03..85d4175c43 100644 --- a/src/ir.zig +++ b/src/ir.zig @@ -115,6 +115,7 @@ pub const Inst = struct { unreach, mul, mulwrap, + div, not, floatcast, intcast, @@ -181,6 +182,7 @@ pub const Inst = struct { .subwrap, .mul, .mulwrap, + .div, .cmp_lt, .cmp_lte, .cmp_eq, @@ -752,6 +754,7 @@ const DumpTzir = struct { .subwrap, .mul, .mulwrap, + .div, .cmp_lt, .cmp_lte, .cmp_eq, @@ -891,6 +894,7 @@ const DumpTzir = struct { .subwrap, .mul, .mulwrap, + .div, .cmp_lt, .cmp_lte, .cmp_eq, From e4a60b63f2c3551440f9b58e8c556545497827bc Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Thu, 8 Apr 2021 05:24:40 +0800 Subject: [PATCH 041/101] stage2 wasm: Add bitwise/boolean ops &, |, ^, and, or --- src/codegen/wasm.zig | 7 +++ test/stage2/wasm.zig | 100 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index 9372444f53..fbea02e0c3 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -657,6 +657,10 @@ pub const Context = struct { .breakpoint => self.genBreakpoint(inst.castTag(.breakpoint).?), .br => self.genBr(inst.castTag(.br).?), .call => self.genCall(inst.castTag(.call).?), + .bit_or => self.genBinOp(inst.castTag(.bit_or).?, .@"or"), + .bit_and => self.genBinOp(inst.castTag(.bit_and).?, .@"and"), + .bool_or => self.genBinOp(inst.castTag(.bool_or).?, .@"or"), + .bool_and => self.genBinOp(inst.castTag(.bool_and).?, .@"and"), .cmp_eq => self.genCmp(inst.castTag(.cmp_eq).?, .eq), .cmp_gte => self.genCmp(inst.castTag(.cmp_gte).?, .gte), .cmp_gt => self.genCmp(inst.castTag(.cmp_gt).?, .gt), @@ -669,6 +673,8 @@ pub const Context = struct { .load => self.genLoad(inst.castTag(.load).?), .loop => self.genLoop(inst.castTag(.loop).?), .mul => self.genBinOp(inst.castTag(.mul).?, .mul), + .div => self.genBinOp(inst.castTag(.div).?, .div), + .xor => self.genBinOp(inst.castTag(.xor).?, .xor), .not => self.genNot(inst.castTag(.not).?), .ret => self.genRet(inst.castTag(.ret).?), .retvoid => WValue.none, @@ -764,6 +770,7 @@ pub const Context = struct { const opcode: wasm.Opcode = buildOpcode(.{ .op = op, .valtype1 = try self.typeToValtype(inst.base.src, inst.base.ty), + .signedness = if (inst.base.ty.isSignedInt()) .signed else .unsigned, }); try self.code.append(wasm.opcode(opcode)); return .none; diff --git a/test/stage2/wasm.zig b/test/stage2/wasm.zig index b585ddc56b..ccf2661b44 100644 --- a/test/stage2/wasm.zig +++ b/test/stage2/wasm.zig @@ -153,6 +153,106 @@ pub fn addCases(ctx: *TestContext) !void { \\ return x * y; \\} , "350\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 352; + \\ i /= 7; // i = 50 + \\ var result: u32 = foo(i, 7); + \\ return result; + \\} + \\fn foo(x: u32, y: u32) u32 { + \\ return x / y; + \\} + , "7\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 5; + \\ i &= 6; + \\ return i; + \\} + , "4\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 5; + \\ i |= 6; + \\ return i; + \\} + , "7\n"); + + case.addCompareOutput( + \\export fn _start() u32 { + \\ var i: u32 = 5; + \\ i ^= 6; + \\ return i; + \\} + , "3\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = false; + \\ b = b or false; + \\ return b; + \\} + , "0\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = true; + \\ b = b or false; + \\ return b; + \\} + , "1\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = false; + \\ b = b or true; + \\ return b; + \\} + , "1\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = true; + \\ b = b or true; + \\ return b; + \\} + , "1\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = false; + \\ b = b and false; + \\ return b; + \\} + , "0\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = true; + \\ b = b and false; + \\ return b; + \\} + , "0\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = false; + \\ b = b and true; + \\ return b; + \\} + , "0\n"); + + case.addCompareOutput( + \\export fn _start() bool { + \\ var b: bool = true; + \\ b = b and true; + \\ return b; + \\} + , "1\n"); } { From 6dc35efe4958a0569c4d8576bca84d62264b1d1d Mon Sep 17 00:00:00 2001 From: gracefu <81774659+gracefuu@users.noreply.github.com> Date: Thu, 8 Apr 2021 05:25:29 +0800 Subject: [PATCH 042/101] Sema: fix typo bug for boolean ops (and, or) --- src/Sema.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sema.zig b/src/Sema.zig index 1a9c60a680..666c7b9858 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -3833,7 +3833,7 @@ fn zirBoolBr( _ = try rhs_block.addBr(src, block_inst, rhs_result); const tzir_then_body: ir.Body = .{ .instructions = try sema.arena.dupe(*Inst, then_block.instructions.items) }; - const tzir_else_body: ir.Body = .{ .instructions = try sema.arena.dupe(*Inst, rhs_block.instructions.items) }; + const tzir_else_body: ir.Body = .{ .instructions = try sema.arena.dupe(*Inst, else_block.instructions.items) }; _ = try child_block.addCondBr(src, lhs, tzir_then_body, tzir_else_body); block_inst.body = .{ From ccdba774c84e2b3c7f650e27f430c9a3eed78fd3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 15:02:46 -0700 Subject: [PATCH 043/101] AstGen: fix ZIR struct encoding off by one error in the bits that describe defaults/field alignments as soon as we have tests for struct field alignment and default values, there will be coverage for this. --- src/AstGen.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 6149169c7f..61174367c3 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1857,7 +1857,7 @@ fn containerDecl( field_index += 1; } - const empty_slot_count = 16 - ((field_index - 1) % 16); + const empty_slot_count = 16 - (field_index % 16); cur_bit_bag >>= @intCast(u5, empty_slot_count * 2); const result = try gz.addPlNode(tag, node, zir.Inst.StructDecl{ From 341dc03b638bc75bb8215dd2ad22231ebe106139 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Wed, 7 Apr 2021 19:20:55 -0400 Subject: [PATCH 044/101] netbsd: minor fixes to allow stage1 to build --- lib/std/c/netbsd.zig | 9 +++++---- lib/std/os/bits/netbsd.zig | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig index 7169095197..c988d25a7b 100644 --- a/lib/std/c/netbsd.zig +++ b/lib/std/c/netbsd.zig @@ -18,14 +18,14 @@ pub extern "c" fn _lwp_self() lwpid_t; pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int; pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; -pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; -pub extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; +pub extern "c" fn __fstat50(fd: fd_t, buf: *libc_stat) c_int; +pub extern "c" fn __stat50(path: [*:0]const u8, buf: *libc_stat) c_int; pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; pub extern "c" fn __clock_getres50(clk_id: c_int, tp: *timespec) c_int; pub extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; pub extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; pub extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int; -pub extern "c" fn __sigaction14(sig: c_int, noalias act: *const Sigaction, noalias oact: ?*Sigaction) c_int; +pub extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; pub extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; pub extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; pub extern "c" fn __gettimeofday50(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; @@ -34,7 +34,6 @@ pub extern "c" fn __getrusage50(who: c_int, usage: *rusage) c_int; pub extern "c" fn __libc_thr_yield() c_int; pub extern "c" fn posix_memalign(memptr: *?*c_void, alignment: usize, size: usize) c_int; -pub extern "c" fn malloc_usable_size(?*const c_void) usize; pub const pthread_mutex_t = extern struct { ptm_magic: u32 = 0x33330003, @@ -93,3 +92,5 @@ pub const pthread_attr_t = extern struct { pta_flags: i32, pta_private: ?*c_void, }; + +pub const sem_t = ?*opaque {}; diff --git a/lib/std/os/bits/netbsd.zig b/lib/std/os/bits/netbsd.zig index 57ae70ddbf..dfb6c3bdf9 100644 --- a/lib/std/os/bits/netbsd.zig +++ b/lib/std/os/bits/netbsd.zig @@ -813,10 +813,6 @@ pub const sigset_t = extern struct { __bits: [_SIG_WORDS]u32, }; -pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); -pub const SIG_DFL = @intToPtr(?Sigaction.sigaction_fn, 0); -pub const SIG_IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** _SIG_WORDS }; // XXX x86_64 specific @@ -1219,3 +1215,25 @@ pub const rlimit = extern struct { pub const SHUT_RD = 0; pub const SHUT_WR = 1; pub const SHUT_RDWR = 2; + +pub const nfds_t = u32; + +pub const pollfd = extern struct { + fd: fd_t, + events: i16, + revents: i16, +}; + +/// Testable events (may be specified in events field). +pub const POLLIN = 0x0001; +pub const POLLPRI = 0x0002; +pub const POLLOUT = 0x0004; +pub const POLLRDNORM = 0x0040; +pub const POLLWRNORM = POLLOUT; +pub const POLLRDBAND = 0x0080; +pub const POLLWRBAND = 0x0100; + +/// Non-testable events (may not be specified in events field). +pub const POLLERR = 0x0008; +pub const POLLHUP = 0x0010; +pub const POLLNVAL = 0x0020; From 8f28e26e7a4f770f8d8e700386e2ade111948891 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 16:39:10 -0700 Subject: [PATCH 045/101] Sema: implement switch validation for enums --- src/Sema.zig | 193 ++++++++++++++++++++++++++++++++++++++------ src/type.zig | 64 +++++++++++++++ test/stage2/cbe.zig | 6 +- 3 files changed, 238 insertions(+), 25 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 379d19fd9d..655fc4bd06 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2729,6 +2729,8 @@ fn analyzeSwitch( src_node_offset: i32, ) InnerError!*Inst { const gpa = sema.gpa; + const mod = sema.mod; + const special: struct { body: []const zir.Inst.Index, end: usize } = switch (special_prong) { .none => .{ .body = &.{}, .end = extra_end }, .under, .@"else" => blk: { @@ -2748,14 +2750,14 @@ fn analyzeSwitch( // Validate usage of '_' prongs. if (special_prong == .under and !operand.ty.isExhaustiveEnum()) { const msg = msg: { - const msg = try sema.mod.errMsg( + const msg = try mod.errMsg( &block.base, src, "'_' prong only allowed when switching on non-exhaustive enums", .{}, ); errdefer msg.destroy(gpa); - try sema.mod.errNote( + try mod.errNote( &block.base, special_prong_src, msg, @@ -2764,14 +2766,121 @@ fn analyzeSwitch( ); break :msg msg; }; - return sema.mod.failWithOwnedErrorMsg(&block.base, msg); + return mod.failWithOwnedErrorMsg(&block.base, msg); } // Validate for duplicate items, missing else prong, and invalid range. switch (operand.ty.zigTypeTag()) { - .Enum => return sema.mod.fail(&block.base, src, "TODO validate switch .Enum", .{}), - .ErrorSet => return sema.mod.fail(&block.base, src, "TODO validate switch .ErrorSet", .{}), - .Union => return sema.mod.fail(&block.base, src, "TODO validate switch .Union", .{}), + .Enum => { + var seen_fields = try gpa.alloc(?AstGen.SwitchProngSrc, operand.ty.enumFieldCount()); + defer gpa.free(seen_fields); + + var extra_index: usize = special.end; + { + var scalar_i: u32 = 0; + while (scalar_i < scalar_cases_len) : (scalar_i += 1) { + const item_ref = @intToEnum(zir.Inst.Ref, sema.code.extra[extra_index]); + extra_index += 1; + const body_len = sema.code.extra[extra_index]; + extra_index += 1; + const body = sema.code.extra[extra_index..][0..body_len]; + extra_index += body_len; + + try sema.validateSwitchItemEnum( + block, + seen_fields, + item_ref, + src_node_offset, + .{ .scalar = scalar_i }, + ); + } + } + { + var multi_i: u32 = 0; + while (multi_i < multi_cases_len) : (multi_i += 1) { + const items_len = sema.code.extra[extra_index]; + extra_index += 1; + const ranges_len = sema.code.extra[extra_index]; + extra_index += 1; + const body_len = sema.code.extra[extra_index]; + extra_index += 1; + const items = sema.code.refSlice(extra_index, items_len); + extra_index += items_len + body_len; + + for (items) |item_ref, item_i| { + try sema.validateSwitchItemEnum( + block, + seen_fields, + item_ref, + src_node_offset, + .{ .multi = .{ .prong = multi_i, .item = @intCast(u32, item_i) } }, + ); + } + + try sema.validateSwitchNoRange(block, ranges_len, operand.ty, src_node_offset); + } + } + const all_tags_handled = for (seen_fields) |seen_src| { + if (seen_src == null) break false; + } else true; + + switch (special_prong) { + .none => { + if (!all_tags_handled) { + const msg = msg: { + const msg = try mod.errMsg( + &block.base, + src, + "switch must handle all possibilities", + .{}, + ); + errdefer msg.destroy(sema.gpa); + try mod.errNoteNonLazy( + operand.ty.declSrcLoc(), + msg, + "enum '{}' declared here", + .{operand.ty}, + ); + for (seen_fields) |seen_src, i| { + if (seen_src != null) continue; + + const field_name = operand.ty.enumFieldName(i); + + // TODO have this point to the tag decl instead of here + try mod.errNote( + &block.base, + src, + msg, + "unhandled enumeration value: '{s}", + .{field_name}, + ); + } + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); + } + }, + .under => { + if (all_tags_handled) return mod.fail( + &block.base, + special_prong_src, + "unreachable '_' prong; all cases already handled", + .{}, + ); + }, + .@"else" => { + if (all_tags_handled) return mod.fail( + &block.base, + special_prong_src, + "unreachable else prong; all cases already handled", + .{}, + ); + }, + } + }, + + .ErrorSet => return mod.fail(&block.base, src, "TODO validate switch .ErrorSet", .{}), + .Union => return mod.fail(&block.base, src, "TODO validate switch .Union", .{}), .Int, .ComptimeInt => { var range_set = RangeSet.init(gpa); defer range_set.deinit(); @@ -2844,11 +2953,11 @@ fn analyzeSwitch( var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); - const min_int = try operand.ty.minInt(&arena, sema.mod.getTarget()); - const max_int = try operand.ty.maxInt(&arena, sema.mod.getTarget()); + const min_int = try operand.ty.minInt(&arena, mod.getTarget()); + const max_int = try operand.ty.maxInt(&arena, mod.getTarget()); if (try range_set.spans(min_int, max_int)) { if (special_prong == .@"else") { - return sema.mod.fail( + return mod.fail( &block.base, special_prong_src, "unreachable else prong; all cases already handled", @@ -2859,7 +2968,7 @@ fn analyzeSwitch( } } if (special_prong != .@"else") { - return sema.mod.fail( + return mod.fail( &block.base, src, "switch must handle all possibilities", @@ -2922,7 +3031,7 @@ fn analyzeSwitch( switch (special_prong) { .@"else" => { if (true_count + false_count == 2) { - return sema.mod.fail( + return mod.fail( &block.base, src, "unreachable else prong; all cases already handled", @@ -2932,7 +3041,7 @@ fn analyzeSwitch( }, .under, .none => { if (true_count + false_count < 2) { - return sema.mod.fail( + return mod.fail( &block.base, src, "switch must handle all possibilities", @@ -2944,7 +3053,7 @@ fn analyzeSwitch( }, .EnumLiteral, .Void, .Fn, .Pointer, .Type => { if (special_prong != .@"else") { - return sema.mod.fail( + return mod.fail( &block.base, src, "else prong required when switching on type '{}'", @@ -3016,7 +3125,7 @@ fn analyzeSwitch( .AnyFrame, .ComptimeFloat, .Float, - => return sema.mod.fail(&block.base, operand_src, "invalid switch operand type '{}'", .{ + => return mod.fail(&block.base, operand_src, "invalid switch operand type '{}'", .{ operand.ty, }), } @@ -3291,7 +3400,7 @@ fn resolveSwitchItemVal( switch_node_offset: i32, switch_prong_src: AstGen.SwitchProngSrc, range_expand: AstGen.SwitchProngSrc.RangeExpand, -) InnerError!Value { +) InnerError!TypedValue { const item = try sema.resolveInst(item_ref); // We have to avoid the other helper functions here because we cannot construct a LazySrcLoc // because we only have the switch AST node. Only if we know for sure we need to report @@ -3301,7 +3410,7 @@ fn resolveSwitchItemVal( const src = switch_prong_src.resolve(block.src_decl, switch_node_offset, range_expand); return sema.failWithUseOfUndef(block, src); } - return val; + return TypedValue{ .ty = item.ty, .val = val }; } const src = switch_prong_src.resolve(block.src_decl, switch_node_offset, range_expand); return sema.failWithNeededComptime(block, src); @@ -3316,8 +3425,8 @@ fn validateSwitchRange( src_node_offset: i32, switch_prong_src: AstGen.SwitchProngSrc, ) InnerError!void { - const first_val = try sema.resolveSwitchItemVal(block, first_ref, src_node_offset, switch_prong_src, .first); - const last_val = try sema.resolveSwitchItemVal(block, last_ref, src_node_offset, switch_prong_src, .last); + const first_val = (try sema.resolveSwitchItemVal(block, first_ref, src_node_offset, switch_prong_src, .first)).val; + const last_val = (try sema.resolveSwitchItemVal(block, last_ref, src_node_offset, switch_prong_src, .last)).val; const maybe_prev_src = try range_set.add(first_val, last_val, switch_prong_src); return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); } @@ -3330,11 +3439,46 @@ fn validateSwitchItem( src_node_offset: i32, switch_prong_src: AstGen.SwitchProngSrc, ) InnerError!void { - const item_val = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); + const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; const maybe_prev_src = try range_set.add(item_val, item_val, switch_prong_src); return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); } +fn validateSwitchItemEnum( + sema: *Sema, + block: *Scope.Block, + seen_fields: []?AstGen.SwitchProngSrc, + item_ref: zir.Inst.Ref, + src_node_offset: i32, + switch_prong_src: AstGen.SwitchProngSrc, +) InnerError!void { + const mod = sema.mod; + const item_tv = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); + const field_index = item_tv.ty.enumTagFieldIndex(item_tv.val) orelse { + const msg = msg: { + const src = switch_prong_src.resolve(block.src_decl, src_node_offset, .none); + const msg = try mod.errMsg( + &block.base, + src, + "enum '{}' has no tag with value '{}'", + .{ item_tv.ty, item_tv.val }, + ); + errdefer msg.destroy(sema.gpa); + try mod.errNoteNonLazy( + item_tv.ty.declSrcLoc(), + msg, + "enum declared here", + .{}, + ); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); + }; + const maybe_prev_src = seen_fields[field_index]; + seen_fields[field_index] = switch_prong_src; + return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); +} + fn validateSwitchDupe( sema: *Sema, block: *Scope.Block, @@ -3343,17 +3487,18 @@ fn validateSwitchDupe( src_node_offset: i32, ) InnerError!void { const prev_prong_src = maybe_prev_src orelse return; + const mod = sema.mod; const src = switch_prong_src.resolve(block.src_decl, src_node_offset, .none); const prev_src = prev_prong_src.resolve(block.src_decl, src_node_offset, .none); const msg = msg: { - const msg = try sema.mod.errMsg( + const msg = try mod.errMsg( &block.base, src, "duplicate switch value", .{}, ); errdefer msg.destroy(sema.gpa); - try sema.mod.errNote( + try mod.errNote( &block.base, prev_src, msg, @@ -3362,7 +3507,7 @@ fn validateSwitchDupe( ); break :msg msg; }; - return sema.mod.failWithOwnedErrorMsg(&block.base, msg); + return mod.failWithOwnedErrorMsg(&block.base, msg); } fn validateSwitchItemBool( @@ -3374,7 +3519,7 @@ fn validateSwitchItemBool( src_node_offset: i32, switch_prong_src: AstGen.SwitchProngSrc, ) InnerError!void { - const item_val = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); + const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; if (item_val.toBool()) { true_count.* += 1; } else { @@ -3396,7 +3541,7 @@ fn validateSwitchItemSparse( src_node_offset: i32, switch_prong_src: AstGen.SwitchProngSrc, ) InnerError!void { - const item_val = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); + const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; const entry = (try seen_values.fetchPut(item_val, switch_prong_src)) orelse return; return sema.validateSwitchDupe(block, entry.value, switch_prong_src, src_node_offset); } diff --git a/src/type.zig b/src/type.zig index a542f9a6fa..1e52d2eb74 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2126,6 +2126,34 @@ pub const Type = extern union { }; } + pub fn enumFieldCount(ty: Type) usize { + switch (ty.tag()) { + .enum_full, .enum_nonexhaustive => { + const enum_full = ty.cast(Payload.EnumFull).?.data; + return enum_full.fields.count(); + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return enum_simple.fields.count(); + }, + else => unreachable, + } + } + + pub fn enumFieldName(ty: Type, field_index: usize) []const u8 { + switch (ty.tag()) { + .enum_full, .enum_nonexhaustive => { + const enum_full = ty.cast(Payload.EnumFull).?.data; + return enum_full.fields.entries.items[field_index].key; + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return enum_simple.fields.entries.items[field_index].key; + }, + else => unreachable, + } + } + pub fn enumFieldIndex(ty: Type, field_name: []const u8) ?usize { switch (ty.tag()) { .enum_full, .enum_nonexhaustive => { @@ -2140,6 +2168,42 @@ pub const Type = extern union { } } + /// Asserts `ty` is an enum. `enum_tag` can either be `enum_field_index` or + /// an integer which represents the enum value. Returns the field index in + /// declaration order, or `null` if `enum_tag` does not match any field. + pub fn enumTagFieldIndex(ty: Type, enum_tag: Value) ?usize { + if (enum_tag.castTag(.enum_field_index)) |payload| { + return @as(usize, payload.data); + } + const S = struct { + fn fieldWithRange(int_val: Value, end: usize) ?usize { + if (int_val.compareWithZero(.lt)) return null; + var end_payload: Value.Payload.U64 = .{ + .base = .{ .tag = .int_u64 }, + .data = end, + }; + const end_val = Value.initPayload(&end_payload.base); + if (int_val.compare(.gte, end_val)) return null; + return int_val.toUnsignedInt(); + } + }; + switch (ty.tag()) { + .enum_full, .enum_nonexhaustive => { + const enum_full = ty.cast(Payload.EnumFull).?.data; + if (enum_full.values.count() == 0) { + return S.fieldWithRange(enum_tag, enum_full.fields.count()); + } else { + return enum_full.values.getIndex(enum_tag); + } + }, + .enum_simple => { + const enum_simple = ty.castTag(.enum_simple).?.data; + return S.fieldWithRange(enum_tag, enum_simple.fields.count()); + }, + else => unreachable, + } + } + pub fn declSrcLoc(ty: Type) Module.SrcLoc { switch (ty.tag()) { .enum_full, .enum_nonexhaustive => { diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 870059629b..f84872b6f7 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -552,7 +552,11 @@ pub fn addCases(ctx: *TestContext) !void { \\ if (@enumToInt(number3) != 2) return 1; \\ var x: Number = .Two; \\ if (number2 != x) return 1; - \\ return 0; + \\ switch (x) { + \\ .One => return 1, + \\ .Two => return 0, + \\ number3 => return 2, + \\ } \\} , ""); } From 4996c2b6a94b042d86b50eb61c9d8d98e63415af Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 19:38:00 -0700 Subject: [PATCH 046/101] stage2: fix incremental compilation Decl deletion logic * `analyzeContainer` now has an `outdated_decls` set as well as `deleted_decls`. Instead of queuing up outdated Decls for re-analysis right away, they are added to this new set. When processing the `deleted_decls` set, we remove deleted Decls from the `outdated_decls` set, to avoid deleted Decl pointers from being in the work_queue. Only after processing the deleted decls do we add analyze_decl work items to the queue. * Module.deletion_set is now an `AutoArrayHashMap` rather than `ArrayList`. `declareDeclDependency` will now remove a Decl from it as appropriate. When processing the `deletion_set` in `Compilation.performAllTheWork`, it now assumes all Decl in the set are to be deleted. * Fix crash when handling parse errors. Currently we unload the `ast.Tree` if any parse errors occur. Previously the code emitted a LazySrcLoc pointing to a token index, but then when we try to resolve the token index to a byte offset to create a compile error message, the ast.Tree` would be unloaded. Now we use `LazySrcLoc.byte_abs` instead of `token_abs` so the error message can be created even with the `ast.Tree` unloaded. Together, these changes solve a crash that happened with incremental compilation when Decls were added and removed in some combinations. --- src/AstGen.zig | 6 +-- src/Compilation.zig | 17 ++++---- src/Module.zig | 97 ++++++++++++++++++++++++++++++++++++-------- test/stage2/cbe.zig | 53 ++++++++++++++++++++++++ test/stage2/test.zig | 42 ------------------- 5 files changed, 145 insertions(+), 70 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 61174367c3..6aaa739a6f 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1899,9 +1899,9 @@ fn containerDecl( if (member.ast.type_expr != 0) { return mod.failNode(scope, member.ast.type_expr, "enum fields do not have types", .{}); } - if (member.ast.align_expr != 0) { - return mod.failNode(scope, member.ast.align_expr, "enum fields do not have alignments", .{}); - } + // Alignment expressions in enums are caught by the parser. + assert(member.ast.align_expr == 0); + const name_token = member.ast.name_token; if (mem.eql(u8, tree.tokenSlice(name_token), "_")) { if (nonexhaustive_node != 0) { diff --git a/src/Compilation.zig b/src/Compilation.zig index b086e513b9..6bf0e004f3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1377,14 +1377,17 @@ pub fn update(self: *Compilation) !void { if (!use_stage1) { if (self.bin_file.options.module) |module| { - // Process the deletion set. - while (module.deletion_set.popOrNull()) |decl| { - if (decl.dependants.items().len != 0) { - decl.deletion_flag = false; - continue; - } - try module.deleteDecl(decl); + // Process the deletion set. We use a while loop here because the + // deletion set may grow as we call `deleteDecl` within this loop, + // and more unreferenced Decls are revealed. + var entry_i: usize = 0; + while (entry_i < module.deletion_set.entries.items.len) : (entry_i += 1) { + const decl = module.deletion_set.entries.items[entry_i].key; + assert(decl.deletion_flag); + assert(decl.dependants.items().len == 0); + try module.deleteDecl(decl, null); } + module.deletion_set.shrinkRetainingCapacity(0); } } diff --git a/src/Module.zig b/src/Module.zig index 9d26738e14..98dad994bd 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -75,7 +75,7 @@ next_anon_name_index: usize = 0, /// Candidates for deletion. After a semantic analysis update completes, this list /// contains Decls that need to be deleted if they end up having no references to them. -deletion_set: ArrayListUnmanaged(*Decl) = .{}, +deletion_set: std.AutoArrayHashMapUnmanaged(*Decl, void) = .{}, /// Error tags and their values, tag names are duped with mod.gpa. /// Corresponds with `error_name_list`. @@ -192,7 +192,7 @@ pub const Decl = struct { /// to require re-analysis. outdated, }, - /// This flag is set when this Decl is added to a check_for_deletion set, and cleared + /// This flag is set when this Decl is added to `Module.deletion_set`, and cleared /// when removed. deletion_flag: bool, /// Whether the corresponding AST decl has a `pub` keyword. @@ -2393,7 +2393,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl: *Decl) InnerError!void { // We don't perform a deletion here, because this Decl or another one // may end up referencing it before the update is complete. dep.deletion_flag = true; - try mod.deletion_set.append(mod.gpa, dep); + try mod.deletion_set.put(mod.gpa, dep, {}); } } decl.dependencies.clearRetainingCapacity(); @@ -3197,6 +3197,11 @@ pub fn declareDeclDependency(mod: *Module, depender: *Decl, dependee: *Decl) !u3 try depender.dependencies.ensureCapacity(mod.gpa, depender.dependencies.count() + 1); try dependee.dependants.ensureCapacity(mod.gpa, dependee.dependants.count() + 1); + if (dependee.deletion_flag) { + dependee.deletion_flag = false; + mod.deletion_set.removeAssertDiscard(dependee); + } + dependee.dependants.putAssumeCapacity(depender, {}); const gop = depender.dependencies.getOrPutAssumeCapacity(dependee); return @intCast(u32, gop.index); @@ -3224,12 +3229,14 @@ pub fn getAstTree(mod: *Module, root_scope: *Scope.File) !*const ast.Tree { var msg = std.ArrayList(u8).init(mod.gpa); defer msg.deinit(); + const token_starts = tree.tokens.items(.start); + try tree.renderError(parse_err, msg.writer()); const err_msg = try mod.gpa.create(ErrorMsg); err_msg.* = .{ .src_loc = .{ .container = .{ .file_scope = root_scope }, - .lazy = .{ .token_abs = parse_err.token }, + .lazy = .{ .byte_abs = token_starts[parse_err.token] }, }, .msg = msg.toOwnedSlice(), }; @@ -3274,6 +3281,14 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { deleted_decls.putAssumeCapacityNoClobber(entry.key, {}); } + // Keep track of decls that are invalidated from the update. Ultimately, + // the goal is to queue up `analyze_decl` tasks in the work queue for + // the outdated decls, but we cannot queue up the tasks until after + // we find out which ones have been deleted, otherwise there would be + // deleted Decl pointers in the work queue. + var outdated_decls = std.AutoArrayHashMap(*Decl, void).init(mod.gpa); + defer outdated_decls.deinit(); + for (decls) |decl_node, decl_i| switch (node_tags[decl_node]) { .fn_decl => { const fn_proto = node_datas[decl_node].lhs; @@ -3284,6 +3299,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3294,6 +3310,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .fn_proto_multi => try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3305,6 +3322,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3315,6 +3333,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .fn_proto => try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3329,6 +3348,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3339,6 +3359,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .fn_proto_multi => try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3350,6 +3371,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3360,6 +3382,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .fn_proto => try mod.semaContainerFn( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3370,6 +3393,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .global_var_decl => try mod.semaContainerVar( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3378,6 +3402,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .local_var_decl => try mod.semaContainerVar( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3386,6 +3411,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .simple_var_decl => try mod.semaContainerVar( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3394,6 +3420,7 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { .aligned_var_decl => try mod.semaContainerVar( container_scope, &deleted_decls, + &outdated_decls, decl_node, decl_i, tree.*, @@ -3446,11 +3473,27 @@ pub fn analyzeContainer(mod: *Module, container_scope: *Scope.Container) !void { }, else => unreachable, }; - // Handle explicitly deleted decls from the source code. Not to be confused - // with when we delete decls because they are no longer referenced. + // Handle explicitly deleted decls from the source code. This is one of two + // places that Decl deletions happen. The other is in `Compilation`, after + // `performAllTheWork`, where we iterate over `Module.deletion_set` and + // delete Decls which are no longer referenced. + // If a Decl is explicitly deleted from source, and also no longer referenced, + // it may be both in this `deleted_decls` set, as well as in the + // `Module.deletion_set`. To avoid deleting it twice, we remove it from the + // deletion set at this time. for (deleted_decls.items()) |entry| { - log.debug("noticed '{s}' deleted from source", .{entry.key.name}); - try mod.deleteDecl(entry.key); + const decl = entry.key; + log.debug("'{s}' deleted from source", .{decl.name}); + if (decl.deletion_flag) { + log.debug("'{s}' redundantly in deletion set; removing", .{decl.name}); + mod.deletion_set.removeAssertDiscard(decl); + } + try mod.deleteDecl(decl, &outdated_decls); + } + // Finally we can queue up re-analysis tasks after we have processed + // the deleted decls. + for (outdated_decls.items()) |entry| { + try mod.markOutdatedDecl(entry.key); } } @@ -3458,6 +3501,7 @@ fn semaContainerFn( mod: *Module, container_scope: *Scope.Container, deleted_decls: *std.AutoArrayHashMap(*Decl, void), + outdated_decls: *std.AutoArrayHashMap(*Decl, void), decl_node: ast.Node.Index, decl_i: usize, tree: ast.Tree, @@ -3489,7 +3533,7 @@ fn semaContainerFn( try mod.failed_decls.putNoClobber(mod.gpa, decl, msg); } else { if (!srcHashEql(decl.contents_hash, contents_hash)) { - try mod.markOutdatedDecl(decl); + try outdated_decls.put(decl, {}); decl.contents_hash = contents_hash; } else switch (mod.comp.bin_file.tag) { .coff => { @@ -3524,6 +3568,7 @@ fn semaContainerVar( mod: *Module, container_scope: *Scope.Container, deleted_decls: *std.AutoArrayHashMap(*Decl, void), + outdated_decls: *std.AutoArrayHashMap(*Decl, void), decl_node: ast.Node.Index, decl_i: usize, tree: ast.Tree, @@ -3549,7 +3594,7 @@ fn semaContainerVar( errdefer err_msg.destroy(mod.gpa); try mod.failed_decls.putNoClobber(mod.gpa, decl, err_msg); } else if (!srcHashEql(decl.contents_hash, contents_hash)) { - try mod.markOutdatedDecl(decl); + try outdated_decls.put(decl, {}); decl.contents_hash = contents_hash; } } else { @@ -3579,17 +3624,27 @@ fn semaContainerField( log.err("TODO: analyze container field", .{}); } -pub fn deleteDecl(mod: *Module, decl: *Decl) !void { +pub fn deleteDecl( + mod: *Module, + decl: *Decl, + outdated_decls: ?*std.AutoArrayHashMap(*Decl, void), +) !void { const tracy = trace(@src()); defer tracy.end(); - try mod.deletion_set.ensureCapacity(mod.gpa, mod.deletion_set.items.len + decl.dependencies.items().len); + log.debug("deleting decl '{s}'", .{decl.name}); + + if (outdated_decls) |map| { + _ = map.swapRemove(decl); + try map.ensureCapacity(map.count() + decl.dependants.count()); + } + try mod.deletion_set.ensureCapacity(mod.gpa, mod.deletion_set.count() + + decl.dependencies.count()); // Remove from the namespace it resides in. In the case of an anonymous Decl it will // not be present in the set, and this does nothing. decl.container.removeDecl(decl); - log.debug("deleting decl '{s}'", .{decl.name}); const name_hash = decl.fullyQualifiedNameHash(); mod.decl_table.removeAssertDiscard(name_hash); // Remove itself from its dependencies, because we are about to destroy the decl pointer. @@ -3600,16 +3655,22 @@ pub fn deleteDecl(mod: *Module, decl: *Decl) !void { // We don't recursively perform a deletion here, because during the update, // another reference to it may turn up. dep.deletion_flag = true; - mod.deletion_set.appendAssumeCapacity(dep); + mod.deletion_set.putAssumeCapacity(dep, {}); } } - // Anything that depends on this deleted decl certainly needs to be re-analyzed. + // Anything that depends on this deleted decl needs to be re-analyzed. for (decl.dependants.items()) |entry| { const dep = entry.key; dep.removeDependency(decl); - if (dep.analysis != .outdated) { - // TODO Move this failure possibility to the top of the function. - try mod.markOutdatedDecl(dep); + if (outdated_decls) |map| { + map.putAssumeCapacity(dep, {}); + } else if (std.debug.runtime_safety) { + // If `outdated_decls` is `null`, it means we're being called from + // `Compilation` after `performAllTheWork` and we cannot queue up any + // more work. `dep` must necessarily be another Decl that is no longer + // being referenced, and will be in the `deletion_set`. Otherwise, + // something has gone wrong. + assert(mod.deletion_set.contains(dep)); } } if (mod.failed_decls.swapRemove(decl)) |entry| { diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index f84872b6f7..5f1689802f 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -538,6 +538,45 @@ pub fn addCases(ctx: *TestContext) !void { { var case = ctx.exeFromCompiledC("enums", .{}); + + case.addError( + \\const E1 = packed enum { a, b, c }; + \\const E2 = extern enum { a, b, c }; + \\export fn foo() void { + \\ const x = E1.a; + \\} + \\export fn bar() void { + \\ const x = E2.a; + \\} + , &.{ + ":1:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", + ":2:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", + }); + + // comptime and types are caught in AstGen. + case.addError( + \\const E1 = enum { + \\ a, + \\ comptime b, + \\ c, + \\}; + \\const E2 = enum { + \\ a, + \\ b: i32, + \\ c, + \\}; + \\export fn foo() void { + \\ const x = E1.a; + \\} + \\export fn bar() void { + \\ const x = E2.a; + \\} + , &.{ + ":3:5: error: enum fields cannot be marked comptime", + ":8:8: error: enum fields do not have types", + }); + + // @enumToInt, @intToEnum, enum literal coercion, field access syntax, comparison, switch case.addCompareOutput( \\const Number = enum { One, Two, Three }; \\ @@ -559,6 +598,20 @@ pub fn addCases(ctx: *TestContext) !void { \\ } \\} , ""); + + // Specifying alignment is a parse error. + case.addError( + \\const E1 = enum { + \\ a, + \\ b align(4), + \\ c, + \\}; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":3:7: error: expected ',', found 'align'", + }); } ctx.c("empty start function", linux_x64, diff --git a/test/stage2/test.zig b/test/stage2/test.zig index fe0c5e5d9e..4ef172e65d 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -1598,46 +1598,4 @@ pub fn addCases(ctx: *TestContext) !void { "", ); } - { - var case = ctx.exe("enum_literal -> enum", linux_x64); - - case.addCompareOutput( - \\const E = enum { a, b }; - \\export fn _start() noreturn { - \\ const a: E = .a; - \\ const b: E = .b; - \\ exit(); - \\} - \\fn exit() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (231), - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , - "", - ); - case.addError( - \\export fn _start() noreturn { - \\ const a: E = .c; - \\ exit(); - \\} - \\const E = enum { a, b }; - \\fn exit() noreturn { - \\ asm volatile ("syscall" - \\ : - \\ : [number] "{rax}" (231), - \\ [arg1] "{rdi}" (0) - \\ : "rcx", "r11", "memory" - \\ ); - \\ unreachable; - \\} - , &.{ - ":2:19: error: enum 'E' has no field named 'c'", - ":5:11: note: enum declared here", - }); - } } From 12087d4cbaab39acadc29716e92765c92b92e28c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 20:36:01 -0700 Subject: [PATCH 047/101] stage2: fix incremental compilation handling of parse errors Before, incremental compilation would crash when trying to emit compile errors for the update after introducing a parse error. Parse errors are handled by not invalidating any existing semantic analysis. However, only the parse error must be reported, with all the other errors suppressed. Once the parse error is fixed, the new file can be treated as an update to the previously-succeeded update. --- src/Compilation.zig | 38 +++++++++++++++++++++++++++++++------- src/Module.zig | 19 ++++++++++++++----- test/stage2/cbe.zig | 19 +++++++++++++++++++ 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 6bf0e004f3..080d4bddaa 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1346,9 +1346,9 @@ pub fn update(self: *Compilation) !void { module.generation += 1; // TODO Detect which source files changed. - // Until then we simulate a full cache miss. Source files could have been loaded for any reason; - // to force a refresh we unload now. - module.root_scope.unload(module.gpa); + // Until then we simulate a full cache miss. Source files could have been loaded + // for any reason; to force a refresh we unload now. + module.unloadFile(module.root_scope); module.failed_root_src_file = null; module.analyzeContainer(&module.root_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { @@ -1362,7 +1362,7 @@ pub fn update(self: *Compilation) !void { // TODO only analyze imports if they are still referenced for (module.import_table.items()) |entry| { - entry.value.unload(module.gpa); + module.unloadFile(entry.value); module.analyzeContainer(&entry.value.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(self.totalErrorCount() != 0); @@ -1432,11 +1432,25 @@ pub fn totalErrorCount(self: *Compilation) usize { var total: usize = self.failed_c_objects.items().len; if (self.bin_file.options.module) |module| { - total += module.failed_decls.count() + - module.emit_h_failed_decls.count() + - module.failed_exports.items().len + + total += module.failed_exports.items().len + module.failed_files.items().len + @boolToInt(module.failed_root_src_file != null); + // Skip errors for Decls within files that failed parsing. + // When a parse error is introduced, we keep all the semantic analysis for + // the previous parse success, including compile errors, but we cannot + // emit them until the file succeeds parsing. + for (module.failed_decls.items()) |entry| { + if (entry.key.container.file_scope.status == .unloaded_parse_failure) { + continue; + } + total += 1; + } + for (module.emit_h_failed_decls.items()) |entry| { + if (entry.key.container.file_scope.status == .unloaded_parse_failure) { + continue; + } + total += 1; + } } // The "no entry point found" error only counts if there are no other errors. @@ -1483,9 +1497,19 @@ pub fn getAllErrorsAlloc(self: *Compilation) !AllErrors { try AllErrors.add(module, &arena, &errors, entry.value.*); } for (module.failed_decls.items()) |entry| { + if (entry.key.container.file_scope.status == .unloaded_parse_failure) { + // Skip errors for Decls within files that had a parse failure. + // We'll try again once parsing succeeds. + continue; + } try AllErrors.add(module, &arena, &errors, entry.value.*); } for (module.emit_h_failed_decls.items()) |entry| { + if (entry.key.container.file_scope.status == .unloaded_parse_failure) { + // Skip errors for Decls within files that had a parse failure. + // We'll try again once parsing succeeds. + continue; + } try AllErrors.add(module, &arena, &errors, entry.value.*); } for (module.failed_exports.items()) |entry| { diff --git a/src/Module.zig b/src/Module.zig index 98dad994bd..ccf6996cae 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -65,8 +65,8 @@ emit_h_failed_decls: std.AutoArrayHashMapUnmanaged(*Decl, *ErrorMsg) = .{}, /// Keep track of one `@compileLog` callsite per owner Decl. compile_log_decls: std.AutoArrayHashMapUnmanaged(*Decl, SrcLoc) = .{}, /// Using a map here for consistency with the other fields here. -/// The ErrorMsg memory is owned by the `Scope`, using Module's general purpose allocator. -failed_files: std.AutoArrayHashMapUnmanaged(*Scope, *ErrorMsg) = .{}, +/// The ErrorMsg memory is owned by the `Scope.File`, using Module's general purpose allocator. +failed_files: std.AutoArrayHashMapUnmanaged(*Scope.File, *ErrorMsg) = .{}, /// Using a map here for consistency with the other fields here. /// The ErrorMsg memory is owned by the `Export`, using Module's general purpose allocator. failed_exports: std.AutoArrayHashMapUnmanaged(*Export, *ErrorMsg) = .{}, @@ -732,10 +732,12 @@ pub const Scope = struct { pub fn unload(file: *File, gpa: *Allocator) void { switch (file.status) { - .never_loaded, .unloaded_parse_failure, + .never_loaded, .unloaded_success, - => {}, + => { + file.status = .unloaded_success; + }, .loaded_success => { file.tree.deinit(gpa); @@ -3241,7 +3243,7 @@ pub fn getAstTree(mod: *Module, root_scope: *Scope.File) !*const ast.Tree { .msg = msg.toOwnedSlice(), }; - mod.failed_files.putAssumeCapacityNoClobber(&root_scope.base, err_msg); + mod.failed_files.putAssumeCapacityNoClobber(root_scope, err_msg); root_scope.status = .unloaded_parse_failure; return error.AnalysisFail; } @@ -4691,3 +4693,10 @@ pub fn parseStrLit( }, } } + +pub fn unloadFile(mod: *Module, file_scope: *Scope.File) void { + if (file_scope.status == .unloaded_parse_failure) { + mod.failed_files.swapRemove(file_scope).?.value.destroy(mod.gpa); + } + file_scope.unload(mod.gpa); +} diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 5f1689802f..a8b663c61e 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -600,6 +600,7 @@ pub fn addCases(ctx: *TestContext) !void { , ""); // Specifying alignment is a parse error. + // This also tests going from a successful build to a parse error. case.addError( \\const E1 = enum { \\ a, @@ -612,6 +613,24 @@ pub fn addCases(ctx: *TestContext) !void { , &.{ ":3:7: error: expected ',', found 'align'", }); + + // Redundant non-exhaustive enum mark. + // This also tests going from a parse error to an AstGen error. + case.addError( + \\const E1 = enum { + \\ a, + \\ _, + \\ b, + \\ c, + \\ _, + \\}; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":6:5: error: redundant non-exhaustive enum mark", + ":3:5: note: other mark here", + }); } ctx.c("empty start function", linux_x64, From a62e19ec8ea4afcaf31a27dd32fab195a12a4877 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 20:50:57 -0700 Subject: [PATCH 048/101] AstGen: fix incorrect source loc for duplicate enum tag --- src/AstGen.zig | 8 ++++---- test/stage2/cbe.zig | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 6aaa739a6f..a061f519ed 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1999,14 +1999,14 @@ fn containerDecl( // don't need to waste time with a hash map. const bad_node = for (container_decl.ast.members) |other_member_node| { const other_member = switch (node_tags[other_member_node]) { - .container_field_init => tree.containerFieldInit(member_node), - .container_field_align => tree.containerFieldAlign(member_node), - .container_field => tree.containerField(member_node), + .container_field_init => tree.containerFieldInit(other_member_node), + .container_field_align => tree.containerFieldAlign(other_member_node), + .container_field => tree.containerField(other_member_node), else => unreachable, // We checked earlier. }; const other_tag_name = try mod.identifierTokenStringTreeArena( scope, - name_token, + other_member.ast.name_token, tree, arena, ); diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index a8b663c61e..49a0ca686b 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -631,6 +631,49 @@ pub fn addCases(ctx: *TestContext) !void { ":6:5: error: redundant non-exhaustive enum mark", ":3:5: note: other mark here", }); + + case.addError( + \\const E1 = enum { + \\ a, + \\ b, + \\ c, + \\ _ = 10, + \\}; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", + }); + + case.addError( + \\const E1 = enum {}; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":1:12: error: enum declarations must have at least one tag", + }); + + case.addError( + \\const E1 = enum { a, b, _ }; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":1:12: error: non-exhaustive enum missing integer tag type", + ":1:25: note: marked non-exhaustive here", + }); + + case.addError( + \\const E1 = enum { a, b, c, b, d }; + \\export fn foo() void { + \\ const x = E1.a; + \\} + , &.{ + ":1:28: error: duplicate enum tag", + ":1:22: note: other tag here", + }); } ctx.c("empty start function", linux_x64, From b67378fb08fb3129b66385479a278a93940f09f5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 21:04:55 -0700 Subject: [PATCH 049/101] Sema: `@intToEnum` error msg includes a "declared here" hint --- src/Sema.zig | 20 +++++++++++++++++--- test/stage2/cbe.zig | 28 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 655fc4bd06..134e569948 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1983,9 +1983,23 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerErr if (try sema.resolveDefinedValue(block, operand_src, operand)) |int_val| { if (!dest_ty.enumHasInt(int_val, target)) { - return mod.fail(&block.base, src, "enum '{}' has no tag with value {}", .{ - dest_ty, int_val, - }); + const msg = msg: { + const msg = try mod.errMsg( + &block.base, + src, + "enum '{}' has no tag with value {}", + .{ dest_ty, int_val }, + ); + errdefer msg.destroy(sema.gpa); + try mod.errNoteNonLazy( + dest_ty.declSrcLoc(), + msg, + "enum declared here", + .{}, + ); + break :msg msg; + }; + return mod.failWithOwnedErrorMsg(&block.base, msg); } return mod.constInst(arena, src, .{ .ty = dest_ty, diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 49a0ca686b..b0386f6246 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -674,6 +674,34 @@ pub fn addCases(ctx: *TestContext) !void { ":1:28: error: duplicate enum tag", ":1:22: note: other tag here", }); + + case.addError( + \\export fn foo() void { + \\ const a = true; + \\ const b = @enumToInt(a); + \\} + , &.{ + ":3:26: error: expected enum or tagged union, found bool", + }); + + case.addError( + \\export fn foo() void { + \\ const a = 1; + \\ const b = @intToEnum(bool, a); + \\} + , &.{ + ":3:26: error: expected enum, found bool", + }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ const b = @intToEnum(E, 3); + \\} + , &.{ + ":3:15: error: enum 'E' has no tag with value 3", + ":1:11: note: enum declared here", + }); } ctx.c("empty start function", linux_x64, From e730172e47749db8a9d3be5949231bde95343b39 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 22:02:45 -0700 Subject: [PATCH 050/101] stage2: fix switch validation of handling all enum values There were several problems, all fixed: * AstGen was storing field names as references to the original source code bytes. However, that data would be destroyed when the source file is updated. Now, it correctly stores the field names in the Decl arena for the enum. The same fix applies to error set field names. * Sema was missing a memset inside `analyzeSwitch`, leaving the "seen enum fields" array with undefined memory. Now that they are all properly set to null, the validation works. * Moved the "enum declared here" note to the end. It looked weird interrupting the notes for which enum values were missing. --- src/Module.zig | 35 +++++++++++++++++++++++------------ src/Sema.zig | 16 +++++++++------- test/stage2/cbe.zig | 15 +++++++++++++++ 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index ccf6996cae..933917d948 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4582,17 +4582,7 @@ pub fn optimizeMode(mod: Module) std.builtin.Mode { /// Otherwise, returns a reference to the source code bytes directly. /// See also `appendIdentStr` and `parseStrLit`. pub fn identifierTokenString(mod: *Module, scope: *Scope, token: ast.TokenIndex) InnerError![]const u8 { - return mod.identifierTokenStringTreeArena(scope, token, scope.tree(), scope.arena()); -} - -/// `scope` is only used for error reporting. -pub fn identifierTokenStringTreeArena( - mod: *Module, - scope: *Scope, - token: ast.TokenIndex, - tree: *const ast.Tree, - arena: *Allocator, -) InnerError![]const u8 { + const tree = scope.tree(); const token_tags = tree.tokens.items(.tag); assert(token_tags[token] == .identifier); const ident_name = tree.tokenSlice(token); @@ -4602,10 +4592,31 @@ pub fn identifierTokenStringTreeArena( var buf: ArrayListUnmanaged(u8) = .{}; defer buf.deinit(mod.gpa); try parseStrLit(mod, scope, token, &buf, ident_name, 1); - const duped = try arena.dupe(u8, buf.items); + const duped = try scope.arena().dupe(u8, buf.items); return duped; } +/// `scope` is only used for error reporting. +/// The string is stored in `arena` regardless of whether it uses @"" syntax. +pub fn identifierTokenStringTreeArena( + mod: *Module, + scope: *Scope, + token: ast.TokenIndex, + tree: *const ast.Tree, + arena: *Allocator, +) InnerError![]u8 { + const token_tags = tree.tokens.items(.tag); + assert(token_tags[token] == .identifier); + const ident_name = tree.tokenSlice(token); + if (!mem.startsWith(u8, ident_name, "@")) { + return arena.dupe(u8, ident_name); + } + var buf: ArrayListUnmanaged(u8) = .{}; + defer buf.deinit(mod.gpa); + try parseStrLit(mod, scope, token, &buf, ident_name, 1); + return arena.dupe(u8, buf.items); +} + /// Given an identifier token, obtain the string for it (possibly parsing as a string /// literal if it is @"" syntax), and append the string to `buf`. /// See also `identifierTokenString` and `parseStrLit`. diff --git a/src/Sema.zig b/src/Sema.zig index 134e569948..a0be08ed71 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2789,6 +2789,8 @@ fn analyzeSwitch( var seen_fields = try gpa.alloc(?AstGen.SwitchProngSrc, operand.ty.enumFieldCount()); defer gpa.free(seen_fields); + mem.set(?AstGen.SwitchProngSrc, seen_fields, null); + var extra_index: usize = special.end; { var scalar_i: u32 = 0; @@ -2849,12 +2851,6 @@ fn analyzeSwitch( .{}, ); errdefer msg.destroy(sema.gpa); - try mod.errNoteNonLazy( - operand.ty.declSrcLoc(), - msg, - "enum '{}' declared here", - .{operand.ty}, - ); for (seen_fields) |seen_src, i| { if (seen_src != null) continue; @@ -2865,10 +2861,16 @@ fn analyzeSwitch( &block.base, src, msg, - "unhandled enumeration value: '{s}", + "unhandled enumeration value: '{s}'", .{field_name}, ); } + try mod.errNoteNonLazy( + operand.ty.declSrcLoc(), + msg, + "enum '{}' declared here", + .{operand.ty}, + ); break :msg msg; }; return mod.failWithOwnedErrorMsg(&block.base, msg); diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index b0386f6246..3cf95ab6d6 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -702,6 +702,21 @@ pub fn addCases(ctx: *TestContext) !void { ":3:15: error: enum 'E' has no tag with value 3", ":1:11: note: enum declared here", }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x: E = .a; + \\ switch (x) { + \\ .a => {}, + \\ .c => {}, + \\ } + \\} + , &.{ + ":4:5: error: switch must handle all possibilities", + ":4:5: note: unhandled enumeration value: 'b'", + ":1:11: note: enum 'E' declared here", + }); } ctx.c("empty start function", linux_x64, From 57aa289fdef543a507d8da039f5b7e7f2762c878 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 22:19:17 -0700 Subject: [PATCH 051/101] Sema: fix switch validation '_' prong on wrong type --- src/Sema.zig | 4 ++-- src/type.zig | 4 ++-- test/stage2/cbe.zig | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index a0be08ed71..519d5df401 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1972,7 +1972,7 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerErr return mod.fail(&block.base, dest_ty_src, "expected enum, found {}", .{dest_ty}); } - if (!dest_ty.isExhaustiveEnum()) { + if (dest_ty.isNonexhaustiveEnum()) { if (operand.value()) |int_val| { return mod.constInst(arena, src, .{ .ty = dest_ty, @@ -2762,7 +2762,7 @@ fn analyzeSwitch( const operand_src: LazySrcLoc = .{ .node_offset_switch_operand = src_node_offset }; // Validate usage of '_' prongs. - if (special_prong == .under and !operand.ty.isExhaustiveEnum()) { + if (special_prong == .under and !operand.ty.isNonexhaustiveEnum()) { const msg = msg: { const msg = try mod.errMsg( &block.base, diff --git a/src/type.zig b/src/type.zig index 1e52d2eb74..ab31991c36 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2119,9 +2119,9 @@ pub const Type = extern union { } } - pub fn isExhaustiveEnum(ty: Type) bool { + pub fn isNonexhaustiveEnum(ty: Type) bool { return switch (ty.tag()) { - .enum_full, .enum_simple => true, + .enum_nonexhaustive => true, else => false, }; } diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 3cf95ab6d6..1f590e2c47 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -717,6 +717,52 @@ pub fn addCases(ctx: *TestContext) !void { ":4:5: note: unhandled enumeration value: 'b'", ":1:11: note: enum 'E' declared here", }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x: E = .a; + \\ switch (x) { + \\ .a => {}, + \\ .b => {}, + \\ .b => {}, + \\ .c => {}, + \\ } + \\} + , &.{ + ":7:10: error: duplicate switch value", + ":6:10: note: previous value here", + }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x: E = .a; + \\ switch (x) { + \\ .a => {}, + \\ .b => {}, + \\ .c => {}, + \\ else => {}, + \\ } + \\} + , &.{ + ":8:14: error: unreachable else prong; all cases already handled", + }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x: E = .a; + \\ switch (x) { + \\ .a => {}, + \\ .b => {}, + \\ _ => {}, + \\ } + \\} + , &.{ + ":4:5: error: '_' prong only allowed when switching on non-exhaustive enums", + ":7:11: note: '_' prong here", + }); } ctx.c("empty start function", linux_x64, From 759591577518fcaf03fb90efca67d896d0806458 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 22:24:52 -0700 Subject: [PATCH 052/101] stage2: add remaining enum compile error test cases --- test/stage2/cbe.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 1f590e2c47..02c1e3d333 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -763,6 +763,26 @@ pub fn addCases(ctx: *TestContext) !void { ":4:5: error: '_' prong only allowed when switching on non-exhaustive enums", ":7:11: note: '_' prong here", }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x = E.d; + \\} + , &.{ + ":3:14: error: enum 'E' has no member named 'd'", + ":1:11: note: enum declared here", + }); + + case.addError( + \\const E = enum { a, b, c }; + \\export fn foo() void { + \\ var x: E = .d; + \\} + , &.{ + ":3:17: error: enum 'E' has no field named 'd'", + ":1:11: note: enum declared here", + }); } ctx.c("empty start function", linux_x64, From 2d2316f5c0087a610127883f0593e8e9c0e939b7 Mon Sep 17 00:00:00 2001 From: xackus <14938807+xackus@users.noreply.github.com> Date: Wed, 7 Apr 2021 17:30:12 +0200 Subject: [PATCH 053/101] translate-c: fix meta.cast to ?*c_void --- lib/std/meta.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 2ed737cea3..860b6874c0 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -970,12 +970,15 @@ fn castPtr(comptime DestType: type, target: anytype) DestType { if (source.is_const and !dest.is_const or source.is_volatile and !dest.is_volatile) return @intToPtr(DestType, @ptrToInt(target)) + else if (@typeInfo(dest.child) == .Opaque) + // dest.alignment would error out + return @ptrCast(DestType, target) else return @ptrCast(DestType, @alignCast(dest.alignment, target)); } fn ptrInfo(comptime PtrType: type) TypeInfo.Pointer { - return switch(@typeInfo(PtrType)){ + return switch (@typeInfo(PtrType)) { .Optional => |opt_info| @typeInfo(opt_info.child).Pointer, .Pointer => |ptr_info| ptr_info, else => unreachable, @@ -1010,6 +1013,8 @@ test "std.meta.cast" { testing.expectEqual(@intToPtr(*u8, 2), cast(*u8, @intToPtr(*const u8, 2))); testing.expectEqual(@intToPtr(*u8, 2), cast(*u8, @intToPtr(*volatile u8, 2))); + + testing.expectEqual(@intToPtr(?*c_void, 2), cast(?*c_void, @intToPtr(*u8, 2))); } /// Given a value returns its size as C's sizeof operator would. @@ -1328,4 +1333,4 @@ test "shuffleVectorIndex" { testing.expect(shuffleVectorIndex(5, vector_len) == -2); testing.expect(shuffleVectorIndex(6, vector_len) == -3); testing.expect(shuffleVectorIndex(7, vector_len) == -4); -} \ No newline at end of file +} From 272fe0cbfe4d59a307389e20b3bf57099b182ebe Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Thu, 8 Apr 2021 14:20:40 +0200 Subject: [PATCH 054/101] stage2: fix bug in ZIR gen of global comptime block A global comptime block did not end with a break_inline instruction which caused an assertion to be hit. --- src/Module.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Module.zig b/src/Module.zig index 933917d948..dc22b3fd3b 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -2513,6 +2513,7 @@ fn astgenAndSemaDecl(mod: *Module, decl: *Decl) !bool { const block_expr = node_datas[decl_node].lhs; _ = try AstGen.comptimeExpr(&gen_scope, &gen_scope.base, .none, block_expr); + _ = try gen_scope.addBreak(.break_inline, gen_scope.break_block, .void_value); const code = try gen_scope.finish(); if (std.builtin.mode == .Debug and mod.comp.verbose_ir) { From 91e416bbf049b875d090ba050081d9964ed4b452 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Thu, 8 Apr 2021 14:22:56 +0200 Subject: [PATCH 055/101] stage2: add a simplified export builtin call std.builtin.ExportOptions is not yet supported, thus the second argument of export is now a simple string that specifies the exported symbol name. --- src/AstGen.zig | 14 +++++++++++++- src/Sema.zig | 29 +++++++++++++++++++++++++++++ src/zir.zig | 6 ++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 8ee27b1658..364f76cc7a 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1336,6 +1336,7 @@ fn blockExprStmts( .dbg_stmt_node, .ensure_result_used, .ensure_result_non_error, + .@"export", .set_eval_branch_quota, .compile_log, .ensure_err_payload_void, @@ -4146,6 +4147,18 @@ fn builtinCall( return rvalue(gz, scope, rl, result, node); }, + .@"export" => { + const target_fn = try expr(gz, scope, .none, params[0]); + // FIXME: When structs work in stage2, actually implement this correctly! + // Currently the name is always signifies Strong linkage. + const export_name = try comptimeExpr(gz, scope, .{ .ty = .const_slice_u8_type }, params[1]); + _ = try gz.addPlNode(.@"export", node, zir.Inst.Bin{ + .lhs = target_fn, + .rhs = export_name, + }); + return rvalue(gz, scope, rl, .void_value, node); + }, + .add_with_overflow, .align_cast, .align_of, @@ -4175,7 +4188,6 @@ fn builtinCall( .error_name, .error_return_trace, .err_set_cast, - .@"export", .fence, .field_parent_ptr, .float_to_int, diff --git a/src/Sema.zig b/src/Sema.zig index 519d5df401..d2abaaf091 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -342,6 +342,10 @@ pub fn analyzeBody( try sema.zirValidateStructInitPtr(block, inst); continue; }, + .@"export" => { + try sema.zirExport(block, inst); + continue; + }, // Special case instructions to handle comptime control flow. .repeat_inline => { @@ -1333,6 +1337,31 @@ fn analyzeBlockBody( return &merges.block_inst.base; } +fn zirExport(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!void { + const tracy = trace(@src()); + defer tracy.end(); + + const inst_data = sema.code.instructions.items(.data)[inst].pl_node; + const extra = sema.code.extraData(zir.Inst.Bin, inst_data.payload_index).data; + const src = inst_data.src(); + + const target_fn = try sema.resolveInst(extra.lhs); + const target_fn_val = try sema.resolveConstValue( + block, + .{ .node_offset_builtin_call_arg0 = inst_data.src_node }, + target_fn, + ); + + const export_name = try sema.resolveConstString( + block, + .{ .node_offset_builtin_call_arg1 = inst_data.src_node }, + extra.rhs, + ); + + const actual_fn = target_fn_val.castTag(.function).?.data; + try sema.mod.analyzeExport(&block.base, src, export_name, actual_fn.owner_decl); +} + fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!void { const tracy = trace(@src()); defer tracy.end(); diff --git a/src/zir.zig b/src/zir.zig index d3d9d56bfd..ff402a9ddb 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -328,6 +328,10 @@ pub const Inst = struct { error_union_type, /// `error.Foo` syntax. Uses the `str_tok` field of the Data union. error_value, + /// Exports a function with a specified name. This can be used at comptime + /// to export a function conditionally. + /// Uses the `pl_node` union field. Payload is `Bin`. + @"export", /// Given a pointer to a struct or object that contains virtual fields, returns a pointer /// to the named field. The field name is stored in string_bytes. Used by a.b syntax. /// Uses `pl_node` field. The AST node is the a.b syntax. Payload is Field. @@ -737,6 +741,7 @@ pub const Inst = struct { .elem_val_node, .ensure_result_used, .ensure_result_non_error, + .@"export", .floatcast, .field_ptr, .field_val, @@ -1682,6 +1687,7 @@ const Writer = struct { .xor, .store_node, .error_union_type, + .@"export", .merge_error_sets, .bit_and, .bit_or, From fb16cb9183bfdf5db9448666803943127802317a Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 5 Apr 2021 20:44:33 +0200 Subject: [PATCH 056/101] stage2: add initial support for builtin pkg We currently emit a simplified builtin2.zig that is able to be parsed and correctly interpreted in stage2. --- src/Compilation.zig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Compilation.zig b/src/Compilation.zig index 080d4bddaa..95db5e78c6 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -906,6 +906,9 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { artifact_sub_dir, }; + const builtin_pkg = try Package.create(gpa, zig_cache_artifact_directory.path.?, "builtin2.zig"); + try root_pkg.add(gpa, "builtin", builtin_pkg); + // TODO when we implement serialization and deserialization of incremental compilation metadata, // this is where we would load it. We have open a handle to the directory where // the output either already is, or will be. @@ -2822,6 +2825,11 @@ fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void { const source = try comp.generateBuiltinZigSource(comp.gpa); defer comp.gpa.free(source); try mod.zig_cache_artifact_directory.handle.writeFile("builtin.zig", source); + + // FIXME: Remove builtin2.zig when stage2 can correctly generate code for builtin.zig! + const source2 = try comp.generateBuiltin2ZigSource(comp.gpa); + defer comp.gpa.free(source2); + try mod.zig_cache_artifact_directory.handle.writeFile("builtin2.zig", source2); } pub fn dump_argv(argv: []const []const u8) void { @@ -2831,6 +2839,26 @@ pub fn dump_argv(argv: []const []const u8) void { std.debug.print("{s}\n", .{argv[argv.len - 1]}); } +fn generateBuiltin2ZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 { + var buffer = std.ArrayList(u8).init(allocator); + defer buffer.deinit(); + + const target = comp.getTarget(); + + try buffer.writer().print( + \\pub const link_libc = {}; + \\pub const arch = {}; + \\pub const os = {}; + \\ + , .{ + comp.bin_file.options.link_libc, + @enumToInt(target.cpu.arch), + @enumToInt(target.os.tag), + }); + + return buffer.toOwnedSlice(); +} + pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 { const tracy = trace(@src()); defer tracy.end(); From a97efbd1850cbf12dbf9332f7da2652385a38cd6 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 5 Apr 2021 20:53:46 +0200 Subject: [PATCH 057/101] stage2: add support for root pkg Fix some infinite recursions, because the code assumed that packages cannot point to each other. But this assumption does not hold anymore. --- src/Compilation.zig | 12 +++++++----- src/Package.zig | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 95db5e78c6..c0409fcb3b 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -510,11 +510,11 @@ pub const InitOptions = struct { fn addPackageTableToCacheHash( hash: *Cache.HashHelper, arena: *std.heap.ArenaAllocator, - pkg_table: Package.Table, + package: *Package, hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, ) (error{OutOfMemory} || std.os.GetCwdError)!void { const allocator = &arena.allocator; - + const pkg_table = package.table; const packages = try allocator.alloc(Package.Table.Entry, pkg_table.count()); { // Copy over the hashmap entries to our slice @@ -547,7 +547,8 @@ fn addPackageTableToCacheHash( }, } // Recurse to handle the package's dependencies - try addPackageTableToCacheHash(hash, arena, pkg.value.table, hash_type); + if (package != pkg.value) + try addPackageTableToCacheHash(hash, arena, pkg.value, hash_type); } } @@ -885,7 +886,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { { var local_arena = std.heap.ArenaAllocator.init(gpa); defer local_arena.deinit(); - try addPackageTableToCacheHash(&hash, &local_arena, root_pkg.table, .path_bytes); + try addPackageTableToCacheHash(&hash, &local_arena, root_pkg, .path_bytes); } hash.add(valgrind); hash.add(single_threaded); @@ -908,6 +909,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { const builtin_pkg = try Package.create(gpa, zig_cache_artifact_directory.path.?, "builtin2.zig"); try root_pkg.add(gpa, "builtin", builtin_pkg); + try root_pkg.add(gpa, "root", root_pkg); // TODO when we implement serialization and deserialization of incremental compilation metadata, // this is where we would load it. We have open a handle to the directory where @@ -3203,7 +3205,7 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node { var local_arena = std.heap.ArenaAllocator.init(comp.gpa); defer local_arena.deinit(); - try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg.table, .{ .files = &man }); + try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg, .{ .files = &man }); } man.hash.add(comp.bin_file.options.valgrind); man.hash.add(comp.bin_file.options.single_threaded); diff --git a/src/Package.zig b/src/Package.zig index 33ff4766ca..03c9e9ea3d 100644 --- a/src/Package.zig +++ b/src/Package.zig @@ -58,7 +58,9 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void { { var it = pkg.table.iterator(); while (it.next()) |kv| { - kv.value.destroy(gpa); + if (pkg != kv.value) { + kv.value.destroy(gpa); + } gpa.free(kv.key); } } From e85cd616ef6439fdb9e7ac118251bb7c2296e553 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Wed, 7 Apr 2021 14:55:11 +0200 Subject: [PATCH 058/101] stage2: implement builtin function hasDecl --- src/AstGen.zig | 12 +++++++++++- src/Sema.zig | 34 ++++++++++++++++++++++++++++++++++ src/zir.zig | 5 +++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 364f76cc7a..20e52ea559 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1245,6 +1245,7 @@ fn blockExprStmts( .fn_type_var_args, .fn_type_cc, .fn_type_cc_var_args, + .has_decl, .int, .float, .float128, @@ -4159,6 +4160,16 @@ fn builtinCall( return rvalue(gz, scope, rl, .void_value, node); }, + .has_decl => { + const container_type = try typeExpr(gz, scope, params[0]); + const name = try comptimeExpr(gz, scope, .{ .ty = .const_slice_u8_type }, params[1]); + const result = try gz.addPlNode(.has_decl, node, zir.Inst.Bin{ + .lhs = container_type, + .rhs = name, + }); + return rvalue(gz, scope, rl, result, node); + }, + .add_with_overflow, .align_cast, .align_of, @@ -4191,7 +4202,6 @@ fn builtinCall( .fence, .field_parent_ptr, .float_to_int, - .has_decl, .has_field, .int_to_float, .int_to_ptr, diff --git a/src/Sema.zig b/src/Sema.zig index d2abaaf091..b4b4798850 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -199,6 +199,7 @@ pub fn analyzeBody( .fn_type_cc => try sema.zirFnTypeCc(block, inst, false), .fn_type_cc_var_args => try sema.zirFnTypeCc(block, inst, true), .fn_type_var_args => try sema.zirFnType(block, inst, true), + .has_decl => try sema.zirHasDecl(block, inst), .import => try sema.zirImport(block, inst), .indexable_ptr_len => try sema.zirIndexablePtrLen(block, inst), .int => try sema.zirInt(block, inst), @@ -3624,6 +3625,39 @@ fn validateSwitchNoRange( return sema.mod.failWithOwnedErrorMsg(&block.base, msg); } +fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { + const tracy = trace(@src()); + defer tracy.end(); + + const inst_data = sema.code.instructions.items(.data)[inst].pl_node; + const extra = sema.code.extraData(zir.Inst.Bin, inst_data.payload_index).data; + const src = inst_data.src(); + const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; + const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; + const container_type = try sema.resolveType(block, lhs_src, extra.lhs); + const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs); + + const maybe_scope = container_type.getContainerScope(); + if (maybe_scope == null) { + return sema.mod.fail( + &block.base, + src, + "expected container (struct, enum, or union), found '{}'", + .{container_type}, + ); + } + + const found = blk: { + for (maybe_scope.?.decls.items()) |kv| { + if (mem.eql(u8, mem.spanZ(kv.key.name), decl_name)) + break :blk true; + } + break :blk false; + }; + + return sema.mod.constBool(sema.arena, src, found); +} + fn zirImport(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { const tracy = trace(@src()); defer tracy.end(); diff --git a/src/zir.zig b/src/zir.zig index ff402a9ddb..40ad2b7844 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -364,6 +364,9 @@ pub const Inst = struct { fn_type_cc, /// Same as `fn_type_cc` but the function is variadic. fn_type_cc_var_args, + /// Determines whether a container has a declaration matching name. + /// Uses the `pl_node` union field. Payload is `Bin`. + has_decl, /// `@import(operand)`. /// Uses the `un_node` field. import, @@ -751,6 +754,7 @@ pub const Inst = struct { .fn_type_var_args, .fn_type_cc, .fn_type_cc_var_args, + .has_decl, .int, .float, .float128, @@ -1681,6 +1685,7 @@ const Writer = struct { .cmp_gt, .cmp_neq, .div, + .has_decl, .mod_rem, .shl, .shr, From ac14b52e85f857f7f70846d22ea18ea265acb91a Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 5 Apr 2021 22:50:54 +0200 Subject: [PATCH 059/101] stage2: add support for start.zig This adds a simplified start2.zig that the current stage2 compiler is able to generate code for. --- lib/std/start2.zig | 58 +++++++++++++++++++++++++++++++++++++ src/Compilation.zig | 70 ++++++++++++++++++++++++++------------------- src/Module.zig | 9 ++++-- src/Package.zig | 25 ++++++++++++++++ src/Sema.zig | 5 +++- src/main.zig | 3 +- 6 files changed, 136 insertions(+), 34 deletions(-) create mode 100644 lib/std/start2.zig diff --git a/lib/std/start2.zig b/lib/std/start2.zig new file mode 100644 index 0000000000..22f3578d98 --- /dev/null +++ b/lib/std/start2.zig @@ -0,0 +1,58 @@ +const root = @import("root"); +const builtin = @import("builtin"); + +comptime { + if (builtin.output_mode == 0) { // OutputMode.Exe + if (builtin.link_libc or builtin.object_format == 5) { // ObjectFormat.c + if (!@hasDecl(root, "main")) { + @export(otherMain, "main"); + } + } else { + if (!@hasDecl(root, "_start")) { + @export(otherStart, "_start"); + } + } + } +} + +// FIXME: Cannot call this function `main`, because `fully qualified names` +// have not been implemented yet. +fn otherMain() callconv(.C) c_int { + root.zigMain(); + return 0; +} + +// FIXME: Cannot call this function `_start`, because `fully qualified names` +// have not been implemented yet. +fn otherStart() callconv(.Naked) noreturn { + root.zigMain(); + otherExit(); +} + +// FIXME: Cannot call this function `exit`, because `fully qualified names` +// have not been implemented yet. +fn otherExit() noreturn { + if (builtin.arch == 31) { // x86_64 + asm volatile ("syscall" + : + : [number] "{rax}" (231), + [arg1] "{rdi}" (0) + : "rcx", "r11", "memory" + ); + } else if (builtin.arch == 0) { // arm + asm volatile ("svc #0" + : + : [number] "{r7}" (1), + [arg1] "{r0}" (0) + : "memory" + ); + } else if (builtin.arch == 2) { // aarch64 + asm volatile ("svc #0" + : + : [number] "{x8}" (93), + [arg1] "{x0}" (0) + : "memory", "cc" + ); + } else @compileError("not yet supported!"); + unreachable; +} diff --git a/src/Compilation.zig b/src/Compilation.zig index c0409fcb3b..2a3d9659b0 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -908,41 +908,45 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { }; const builtin_pkg = try Package.create(gpa, zig_cache_artifact_directory.path.?, "builtin2.zig"); + + const std_dir_path = try options.zig_lib_directory.join(gpa, &[_][]const u8{"std"}); + defer gpa.free(std_dir_path); + const start_pkg = try Package.create(gpa, std_dir_path, "start2.zig"); + try root_pkg.add(gpa, "builtin", builtin_pkg); try root_pkg.add(gpa, "root", root_pkg); + try start_pkg.add(gpa, "builtin", builtin_pkg); + try start_pkg.add(gpa, "root", root_pkg); + // TODO when we implement serialization and deserialization of incremental compilation metadata, // this is where we would load it. We have open a handle to the directory where // the output either already is, or will be. // However we currently do not have serialization of such metadata, so for now // we set up an empty Module that does the entire compilation fresh. - const root_scope = rs: { - if (mem.endsWith(u8, root_pkg.root_src_path, ".zig")) { - const root_scope = try gpa.create(Module.Scope.File); - const struct_ty = try Type.Tag.empty_struct.create( - gpa, - &root_scope.root_container, - ); - root_scope.* = .{ - // TODO this is duped so it can be freed in Container.deinit - .sub_file_path = try gpa.dupe(u8, root_pkg.root_src_path), - .source = .{ .unloaded = {} }, - .tree = undefined, - .status = .never_loaded, - .pkg = root_pkg, - .root_container = .{ - .file_scope = root_scope, - .decls = .{}, - .ty = struct_ty, - }, - }; - break :rs root_scope; - } else if (mem.endsWith(u8, root_pkg.root_src_path, ".zir")) { - return error.ZirFilesUnsupported; - } else { - unreachable; - } + if (mem.endsWith(u8, root_pkg.root_src_path, ".zir")) return error.ZirFilesUnsupported; + + const start_scope = ss: { + const start_scope = try gpa.create(Module.Scope.File); + const struct_ty = try Type.Tag.empty_struct.create( + gpa, + &start_scope.root_container, + ); + start_scope.* = .{ + // TODO this is duped so it can be freed in Container.deinit + .sub_file_path = try gpa.dupe(u8, start_pkg.root_src_path), + .source = .{ .unloaded = {} }, + .tree = undefined, + .status = .never_loaded, + .pkg = start_pkg, + .root_container = .{ + .file_scope = start_scope, + .decls = .{}, + .ty = struct_ty, + }, + }; + break :ss start_scope; }; const module = try arena.create(Module); @@ -951,7 +955,9 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { .gpa = gpa, .comp = comp, .root_pkg = root_pkg, - .root_scope = root_scope, + .root_scope = null, + .start_pkg = start_pkg, + .start_scope = start_scope, .zig_cache_artifact_directory = zig_cache_artifact_directory, .emit_h = options.emit_h, .error_name_list = try std.ArrayListUnmanaged([]const u8).initCapacity(gpa, 1), @@ -1353,9 +1359,9 @@ pub fn update(self: *Compilation) !void { // TODO Detect which source files changed. // Until then we simulate a full cache miss. Source files could have been loaded // for any reason; to force a refresh we unload now. - module.unloadFile(module.root_scope); + module.unloadFile(module.start_scope); module.failed_root_src_file = null; - module.analyzeContainer(&module.root_scope.root_container) catch |err| switch (err) { + module.analyzeContainer(&module.start_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(self.totalErrorCount() != 0); }, @@ -1416,7 +1422,7 @@ pub fn update(self: *Compilation) !void { // to report error messages. Otherwise we unload all source files to save memory. if (self.totalErrorCount() == 0 and !self.keep_source_files_loaded) { if (self.bin_file.options.module) |module| { - module.root_scope.unload(self.gpa); + module.start_scope.unload(self.gpa); } } } @@ -2851,11 +2857,15 @@ fn generateBuiltin2ZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 { \\pub const link_libc = {}; \\pub const arch = {}; \\pub const os = {}; + \\pub const output_mode = {}; + \\pub const object_format = {}; \\ , .{ comp.bin_file.options.link_libc, @enumToInt(target.cpu.arch), @enumToInt(target.os.tag), + @enumToInt(comp.bin_file.options.output_mode), + @enumToInt(comp.bin_file.options.object_format), }); return buffer.toOwnedSlice(); diff --git a/src/Module.zig b/src/Module.zig index dc22b3fd3b..18dfc6bae0 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -35,8 +35,11 @@ comp: *Compilation, zig_cache_artifact_directory: Compilation.Directory, /// Pointer to externally managed resource. `null` if there is no zig file being compiled. root_pkg: *Package, +/// This is populated when `@import("root")` is analysed. +root_scope: ?*Scope.File, +start_pkg: *Package, /// Module owns this resource. -root_scope: *Scope.File, +start_scope: *Scope.File, /// It's rare for a decl to be exported, so we save memory by having a sparse map of /// Decl pointers to details about them being exported. /// The Export memory is owned by the `export_owners` table; the slice itself is owned by this table. @@ -2341,7 +2344,9 @@ pub fn deinit(mod: *Module) void { mod.export_owners.deinit(gpa); mod.symbol_exports.deinit(gpa); - mod.root_scope.destroy(gpa); + + mod.start_scope.destroy(gpa); + mod.start_pkg.destroy(gpa); var it = mod.global_error_set.iterator(); while (it.next()) |entry| { diff --git a/src/Package.zig b/src/Package.zig index 03c9e9ea3d..d5960dcf9a 100644 --- a/src/Package.zig +++ b/src/Package.zig @@ -15,6 +15,9 @@ root_src_path: []const u8, table: Table = .{}, parent: ?*Package = null, +// Used when freeing packages +seen: bool = false, + /// Allocate a Package. No references to the slices passed are kept. pub fn create( gpa: *Allocator, @@ -55,6 +58,14 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void { pkg.root_src_directory.handle.close(); } + // First we recurse into all the packages and remove packages from the tables + // once we have seen it before. We do this to make sure that that + // a package can only be found once in the whole tree. + if (!pkg.seen) { + pkg.seen = true; + pkg.markSeen(gpa); + } + { var it = pkg.table.iterator(); while (it.next()) |kv| { @@ -69,6 +80,20 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void { gpa.destroy(pkg); } +fn markSeen(pkg: *Package, gpa: *Allocator) void { + var it = pkg.table.iterator(); + while (it.next()) |kv| { + if (pkg != kv.value) { + if (kv.value.seen) { + pkg.table.removeAssertDiscard(kv.key); + } else { + kv.value.seen = true; + kv.value.markSeen(gpa); + } + } + } +} + pub fn add(pkg: *Package, gpa: *Allocator, name: []const u8, package: *Package) !void { try pkg.table.ensureCapacity(gpa, pkg.table.count() + 1); const name_dupe = try mem.dupe(gpa, u8, name); diff --git a/src/Sema.zig b/src/Sema.zig index b4b4798850..d4c2592446 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4699,7 +4699,7 @@ fn namedFieldPtr( } // TODO this will give false positives for structs inside the root file - if (container_scope.file_scope == mod.root_scope) { + if (container_scope.file_scope == mod.root_scope.?) { return mod.fail( &block.base, src, @@ -5338,6 +5338,9 @@ fn analyzeImport(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, target_strin .ty = struct_ty, }, }; + if (mem.eql(u8, target_string, "root")) { + sema.mod.root_scope = file_scope; + } sema.mod.analyzeContainer(&file_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(sema.mod.comp.totalErrorCount() != 0); diff --git a/src/main.zig b/src/main.zig index 5fb74db61f..0f03813a36 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1732,6 +1732,8 @@ fn buildOutputType( }, } + // This gets cleaned up, because root_pkg becomes part of the + // package table of the start_pkg. const root_pkg: ?*Package = if (root_src_file) |src_path| blk: { if (main_pkg_path) |p| { const rel_src_path = try fs.path.relative(gpa, p, src_path); @@ -1741,7 +1743,6 @@ fn buildOutputType( break :blk try Package.create(gpa, fs.path.dirname(src_path), fs.path.basename(src_path)); } } else null; - defer if (root_pkg) |p| p.destroy(gpa); // Transfer packages added with --pkg-begin/--pkg-end to the root package if (root_pkg) |pkg| { From a483e38df62f73dc0cdadee6faf3e083094210d4 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Wed, 7 Apr 2021 13:27:36 +0200 Subject: [PATCH 060/101] stage2: fix bug where invalid ZIR was generated The following code caused an assertion to be hit: ``` pub fn main() void { var e: anyerror!c_int = error.Foo; const i = e catch 69; assert(69 - i == 0); } ``` --- src/Module.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index 18dfc6bae0..dab3319b2e 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -2863,8 +2863,9 @@ fn astgenAndSemaFn( _ = try AstGen.expr(&gen_scope, params_scope, .none, body_node); - if (gen_scope.instructions.items.len == 0 or - !astgen.instructions.items(.tag)[gen_scope.instructions.items.len - 1] + const inst_tags = astgen.instructions.items(.tag); + if (inst_tags.len == 0 or + !inst_tags[inst_tags.len - 1] .isNoReturn()) { // astgen uses result location semantics to coerce return operands. From b9e508c410cd077d704a73418281f6d7839df241 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 8 Apr 2021 11:29:31 -0700 Subject: [PATCH 061/101] stage2: revert to only has_decl and export ZIR support Reverting most of the code from the previous commits in this branch. Will pull in the code with modifications bit by bit. --- src/AstGen.zig | 10 ++-- src/Compilation.zig | 110 ++++++++++++++------------------------------ src/Module.zig | 15 ++---- src/Package.zig | 29 +----------- src/Sema.zig | 59 ++++++++++-------------- src/main.zig | 3 +- src/zir.zig | 5 +- 7 files changed, 73 insertions(+), 158 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 20e52ea559..e269c4ab4f 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -4149,12 +4149,14 @@ fn builtinCall( }, .@"export" => { - const target_fn = try expr(gz, scope, .none, params[0]); - // FIXME: When structs work in stage2, actually implement this correctly! - // Currently the name is always signifies Strong linkage. + // TODO: @export is supposed to be able to export things other than functions. + // Instead of `comptimeExpr` here we need `decl_ref`. + const fn_to_export = try comptimeExpr(gz, scope, .none, params[0]); + // TODO: the second parameter here is supposed to be + // `std.builtin.ExportOptions`, not a string. const export_name = try comptimeExpr(gz, scope, .{ .ty = .const_slice_u8_type }, params[1]); _ = try gz.addPlNode(.@"export", node, zir.Inst.Bin{ - .lhs = target_fn, + .lhs = fn_to_export, .rhs = export_name, }); return rvalue(gz, scope, rl, .void_value, node); diff --git a/src/Compilation.zig b/src/Compilation.zig index 2a3d9659b0..080d4bddaa 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -510,11 +510,11 @@ pub const InitOptions = struct { fn addPackageTableToCacheHash( hash: *Cache.HashHelper, arena: *std.heap.ArenaAllocator, - package: *Package, + pkg_table: Package.Table, hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, ) (error{OutOfMemory} || std.os.GetCwdError)!void { const allocator = &arena.allocator; - const pkg_table = package.table; + const packages = try allocator.alloc(Package.Table.Entry, pkg_table.count()); { // Copy over the hashmap entries to our slice @@ -547,8 +547,7 @@ fn addPackageTableToCacheHash( }, } // Recurse to handle the package's dependencies - if (package != pkg.value) - try addPackageTableToCacheHash(hash, arena, pkg.value, hash_type); + try addPackageTableToCacheHash(hash, arena, pkg.value.table, hash_type); } } @@ -886,7 +885,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { { var local_arena = std.heap.ArenaAllocator.init(gpa); defer local_arena.deinit(); - try addPackageTableToCacheHash(&hash, &local_arena, root_pkg, .path_bytes); + try addPackageTableToCacheHash(&hash, &local_arena, root_pkg.table, .path_bytes); } hash.add(valgrind); hash.add(single_threaded); @@ -907,46 +906,38 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { artifact_sub_dir, }; - const builtin_pkg = try Package.create(gpa, zig_cache_artifact_directory.path.?, "builtin2.zig"); - - const std_dir_path = try options.zig_lib_directory.join(gpa, &[_][]const u8{"std"}); - defer gpa.free(std_dir_path); - const start_pkg = try Package.create(gpa, std_dir_path, "start2.zig"); - - try root_pkg.add(gpa, "builtin", builtin_pkg); - try root_pkg.add(gpa, "root", root_pkg); - - try start_pkg.add(gpa, "builtin", builtin_pkg); - try start_pkg.add(gpa, "root", root_pkg); - // TODO when we implement serialization and deserialization of incremental compilation metadata, // this is where we would load it. We have open a handle to the directory where // the output either already is, or will be. // However we currently do not have serialization of such metadata, so for now // we set up an empty Module that does the entire compilation fresh. - if (mem.endsWith(u8, root_pkg.root_src_path, ".zir")) return error.ZirFilesUnsupported; - - const start_scope = ss: { - const start_scope = try gpa.create(Module.Scope.File); - const struct_ty = try Type.Tag.empty_struct.create( - gpa, - &start_scope.root_container, - ); - start_scope.* = .{ - // TODO this is duped so it can be freed in Container.deinit - .sub_file_path = try gpa.dupe(u8, start_pkg.root_src_path), - .source = .{ .unloaded = {} }, - .tree = undefined, - .status = .never_loaded, - .pkg = start_pkg, - .root_container = .{ - .file_scope = start_scope, - .decls = .{}, - .ty = struct_ty, - }, - }; - break :ss start_scope; + const root_scope = rs: { + if (mem.endsWith(u8, root_pkg.root_src_path, ".zig")) { + const root_scope = try gpa.create(Module.Scope.File); + const struct_ty = try Type.Tag.empty_struct.create( + gpa, + &root_scope.root_container, + ); + root_scope.* = .{ + // TODO this is duped so it can be freed in Container.deinit + .sub_file_path = try gpa.dupe(u8, root_pkg.root_src_path), + .source = .{ .unloaded = {} }, + .tree = undefined, + .status = .never_loaded, + .pkg = root_pkg, + .root_container = .{ + .file_scope = root_scope, + .decls = .{}, + .ty = struct_ty, + }, + }; + break :rs root_scope; + } else if (mem.endsWith(u8, root_pkg.root_src_path, ".zir")) { + return error.ZirFilesUnsupported; + } else { + unreachable; + } }; const module = try arena.create(Module); @@ -955,9 +946,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { .gpa = gpa, .comp = comp, .root_pkg = root_pkg, - .root_scope = null, - .start_pkg = start_pkg, - .start_scope = start_scope, + .root_scope = root_scope, .zig_cache_artifact_directory = zig_cache_artifact_directory, .emit_h = options.emit_h, .error_name_list = try std.ArrayListUnmanaged([]const u8).initCapacity(gpa, 1), @@ -1359,9 +1348,9 @@ pub fn update(self: *Compilation) !void { // TODO Detect which source files changed. // Until then we simulate a full cache miss. Source files could have been loaded // for any reason; to force a refresh we unload now. - module.unloadFile(module.start_scope); + module.unloadFile(module.root_scope); module.failed_root_src_file = null; - module.analyzeContainer(&module.start_scope.root_container) catch |err| switch (err) { + module.analyzeContainer(&module.root_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(self.totalErrorCount() != 0); }, @@ -1422,7 +1411,7 @@ pub fn update(self: *Compilation) !void { // to report error messages. Otherwise we unload all source files to save memory. if (self.totalErrorCount() == 0 and !self.keep_source_files_loaded) { if (self.bin_file.options.module) |module| { - module.start_scope.unload(self.gpa); + module.root_scope.unload(self.gpa); } } } @@ -2833,11 +2822,6 @@ fn updateBuiltinZigFile(comp: *Compilation, mod: *Module) !void { const source = try comp.generateBuiltinZigSource(comp.gpa); defer comp.gpa.free(source); try mod.zig_cache_artifact_directory.handle.writeFile("builtin.zig", source); - - // FIXME: Remove builtin2.zig when stage2 can correctly generate code for builtin.zig! - const source2 = try comp.generateBuiltin2ZigSource(comp.gpa); - defer comp.gpa.free(source2); - try mod.zig_cache_artifact_directory.handle.writeFile("builtin2.zig", source2); } pub fn dump_argv(argv: []const []const u8) void { @@ -2847,30 +2831,6 @@ pub fn dump_argv(argv: []const []const u8) void { std.debug.print("{s}\n", .{argv[argv.len - 1]}); } -fn generateBuiltin2ZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 { - var buffer = std.ArrayList(u8).init(allocator); - defer buffer.deinit(); - - const target = comp.getTarget(); - - try buffer.writer().print( - \\pub const link_libc = {}; - \\pub const arch = {}; - \\pub const os = {}; - \\pub const output_mode = {}; - \\pub const object_format = {}; - \\ - , .{ - comp.bin_file.options.link_libc, - @enumToInt(target.cpu.arch), - @enumToInt(target.os.tag), - @enumToInt(comp.bin_file.options.output_mode), - @enumToInt(comp.bin_file.options.object_format), - }); - - return buffer.toOwnedSlice(); -} - pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 { const tracy = trace(@src()); defer tracy.end(); @@ -3215,7 +3175,7 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node { var local_arena = std.heap.ArenaAllocator.init(comp.gpa); defer local_arena.deinit(); - try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg, .{ .files = &man }); + try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg.table, .{ .files = &man }); } man.hash.add(comp.bin_file.options.valgrind); man.hash.add(comp.bin_file.options.single_threaded); diff --git a/src/Module.zig b/src/Module.zig index dab3319b2e..933917d948 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -35,11 +35,8 @@ comp: *Compilation, zig_cache_artifact_directory: Compilation.Directory, /// Pointer to externally managed resource. `null` if there is no zig file being compiled. root_pkg: *Package, -/// This is populated when `@import("root")` is analysed. -root_scope: ?*Scope.File, -start_pkg: *Package, /// Module owns this resource. -start_scope: *Scope.File, +root_scope: *Scope.File, /// It's rare for a decl to be exported, so we save memory by having a sparse map of /// Decl pointers to details about them being exported. /// The Export memory is owned by the `export_owners` table; the slice itself is owned by this table. @@ -2344,9 +2341,7 @@ pub fn deinit(mod: *Module) void { mod.export_owners.deinit(gpa); mod.symbol_exports.deinit(gpa); - - mod.start_scope.destroy(gpa); - mod.start_pkg.destroy(gpa); + mod.root_scope.destroy(gpa); var it = mod.global_error_set.iterator(); while (it.next()) |entry| { @@ -2518,7 +2513,6 @@ fn astgenAndSemaDecl(mod: *Module, decl: *Decl) !bool { const block_expr = node_datas[decl_node].lhs; _ = try AstGen.comptimeExpr(&gen_scope, &gen_scope.base, .none, block_expr); - _ = try gen_scope.addBreak(.break_inline, gen_scope.break_block, .void_value); const code = try gen_scope.finish(); if (std.builtin.mode == .Debug and mod.comp.verbose_ir) { @@ -2863,9 +2857,8 @@ fn astgenAndSemaFn( _ = try AstGen.expr(&gen_scope, params_scope, .none, body_node); - const inst_tags = astgen.instructions.items(.tag); - if (inst_tags.len == 0 or - !inst_tags[inst_tags.len - 1] + if (gen_scope.instructions.items.len == 0 or + !astgen.instructions.items(.tag)[gen_scope.instructions.items.len - 1] .isNoReturn()) { // astgen uses result location semantics to coerce return operands. diff --git a/src/Package.zig b/src/Package.zig index d5960dcf9a..33ff4766ca 100644 --- a/src/Package.zig +++ b/src/Package.zig @@ -15,9 +15,6 @@ root_src_path: []const u8, table: Table = .{}, parent: ?*Package = null, -// Used when freeing packages -seen: bool = false, - /// Allocate a Package. No references to the slices passed are kept. pub fn create( gpa: *Allocator, @@ -58,20 +55,10 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void { pkg.root_src_directory.handle.close(); } - // First we recurse into all the packages and remove packages from the tables - // once we have seen it before. We do this to make sure that that - // a package can only be found once in the whole tree. - if (!pkg.seen) { - pkg.seen = true; - pkg.markSeen(gpa); - } - { var it = pkg.table.iterator(); while (it.next()) |kv| { - if (pkg != kv.value) { - kv.value.destroy(gpa); - } + kv.value.destroy(gpa); gpa.free(kv.key); } } @@ -80,20 +67,6 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void { gpa.destroy(pkg); } -fn markSeen(pkg: *Package, gpa: *Allocator) void { - var it = pkg.table.iterator(); - while (it.next()) |kv| { - if (pkg != kv.value) { - if (kv.value.seen) { - pkg.table.removeAssertDiscard(kv.key); - } else { - kv.value.seen = true; - kv.value.markSeen(gpa); - } - } - } -} - pub fn add(pkg: *Package, gpa: *Allocator, name: []const u8, package: *Package) !void { try pkg.table.ensureCapacity(gpa, pkg.table.count() + 1); const name_dupe = try mem.dupe(gpa, u8, name); diff --git a/src/Sema.zig b/src/Sema.zig index d4c2592446..51d350ea7c 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1345,21 +1345,18 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError! const inst_data = sema.code.instructions.items(.data)[inst].pl_node; const extra = sema.code.extraData(zir.Inst.Bin, inst_data.payload_index).data; const src = inst_data.src(); + const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; + const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; - const target_fn = try sema.resolveInst(extra.lhs); - const target_fn_val = try sema.resolveConstValue( - block, - .{ .node_offset_builtin_call_arg0 = inst_data.src_node }, - target_fn, - ); + // TODO (see corresponding TODO in AstGen) this is supposed to be a `decl_ref` + // instruction, which could reference any decl, which is then supposed to get + // exported, regardless of whether or not it is a function. + const target_fn = try sema.resolveInstConst(block, lhs_src, extra.lhs); + // TODO (see corresponding TODO in AstGen) this is supposed to be + // `std.builtin.ExportOptions`, not a string. + const export_name = try sema.resolveConstString(block, rhs_src, extra.rhs); - const export_name = try sema.resolveConstString( - block, - .{ .node_offset_builtin_call_arg1 = inst_data.src_node }, - extra.rhs, - ); - - const actual_fn = target_fn_val.castTag(.function).?.data; + const actual_fn = target_fn.val.castTag(.function).?.data; try sema.mod.analyzeExport(&block.base, src, export_name, actual_fn.owner_decl); } @@ -3636,26 +3633,21 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; const container_type = try sema.resolveType(block, lhs_src, extra.lhs); const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs); + const mod = sema.mod; + const arena = sema.arena; - const maybe_scope = container_type.getContainerScope(); - if (maybe_scope == null) { - return sema.mod.fail( - &block.base, - src, - "expected container (struct, enum, or union), found '{}'", - .{container_type}, - ); + const container_scope = container_type.getContainerScope() orelse return mod.fail( + &block.base, + lhs_src, + "expected struct, enum, union, or opaque, found '{}'", + .{container_type}, + ); + if (mod.lookupDeclName(&container_scope.base, decl_name)) |decl| { + // TODO if !decl.is_pub and inDifferentFiles() return false + return mod.constBool(arena, src, true); + } else { + return mod.constBool(arena, src, false); } - - const found = blk: { - for (maybe_scope.?.decls.items()) |kv| { - if (mem.eql(u8, mem.spanZ(kv.key.name), decl_name)) - break :blk true; - } - break :blk false; - }; - - return sema.mod.constBool(sema.arena, src, found); } fn zirImport(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst { @@ -4699,7 +4691,7 @@ fn namedFieldPtr( } // TODO this will give false positives for structs inside the root file - if (container_scope.file_scope == mod.root_scope.?) { + if (container_scope.file_scope == mod.root_scope) { return mod.fail( &block.base, src, @@ -5338,9 +5330,6 @@ fn analyzeImport(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, target_strin .ty = struct_ty, }, }; - if (mem.eql(u8, target_string, "root")) { - sema.mod.root_scope = file_scope; - } sema.mod.analyzeContainer(&file_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(sema.mod.comp.totalErrorCount() != 0); diff --git a/src/main.zig b/src/main.zig index 0f03813a36..5fb74db61f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1732,8 +1732,6 @@ fn buildOutputType( }, } - // This gets cleaned up, because root_pkg becomes part of the - // package table of the start_pkg. const root_pkg: ?*Package = if (root_src_file) |src_path| blk: { if (main_pkg_path) |p| { const rel_src_path = try fs.path.relative(gpa, p, src_path); @@ -1743,6 +1741,7 @@ fn buildOutputType( break :blk try Package.create(gpa, fs.path.dirname(src_path), fs.path.basename(src_path)); } } else null; + defer if (root_pkg) |p| p.destroy(gpa); // Transfer packages added with --pkg-begin/--pkg-end to the root package if (root_pkg) |pkg| { diff --git a/src/zir.zig b/src/zir.zig index 40ad2b7844..807e25e6b8 100644 --- a/src/zir.zig +++ b/src/zir.zig @@ -328,8 +328,7 @@ pub const Inst = struct { error_union_type, /// `error.Foo` syntax. Uses the `str_tok` field of the Data union. error_value, - /// Exports a function with a specified name. This can be used at comptime - /// to export a function conditionally. + /// Implements the `@export` builtin function. /// Uses the `pl_node` union field. Payload is `Bin`. @"export", /// Given a pointer to a struct or object that contains virtual fields, returns a pointer @@ -364,7 +363,7 @@ pub const Inst = struct { fn_type_cc, /// Same as `fn_type_cc` but the function is variadic. fn_type_cc_var_args, - /// Determines whether a container has a declaration matching name. + /// Implements the `@hasDecl` builtin. /// Uses the `pl_node` union field. Payload is `Bin`. has_decl, /// `@import(operand)`. From d7a89f98765381b4be2ce7626addad07ecfa7208 Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Thu, 8 Apr 2021 14:20:05 +0200 Subject: [PATCH 062/101] stage2 AArch64: Add conditional branch instructions --- src/codegen/aarch64.zig | 213 ++++++++++++++++++++++++++++++++-------- src/link/MachO.zig | 4 +- src/link/MachO/Zld.zig | 12 +-- 3 files changed, 179 insertions(+), 50 deletions(-) diff --git a/src/codegen/aarch64.zig b/src/codegen/aarch64.zig index 38d2842df9..b456465075 100644 --- a/src/codegen/aarch64.zig +++ b/src/codegen/aarch64.zig @@ -200,7 +200,7 @@ test "FloatingPointRegister.toX" { /// Represents an instruction in the AArch64 instruction set pub const Instruction = union(enum) { - MoveWideImmediate: packed struct { + move_wide_immediate: packed struct { rd: u5, imm16: u16, hw: u2, @@ -208,14 +208,14 @@ pub const Instruction = union(enum) { opc: u2, sf: u1, }, - PCRelativeAddress: packed struct { + pc_relative_address: packed struct { rd: u5, immhi: u19, fixed: u5 = 0b10000, immlo: u2, op: u1, }, - LoadStoreRegister: packed struct { + load_store_register: packed struct { rt: u5, rn: u5, offset: u12, @@ -225,7 +225,7 @@ pub const Instruction = union(enum) { fixed: u3 = 0b111, size: u2, }, - LoadStorePairOfRegisters: packed struct { + load_store_register_pair: packed struct { rt1: u5, rn: u5, rt2: u5, @@ -235,20 +235,20 @@ pub const Instruction = union(enum) { fixed: u5 = 0b101_0_0, opc: u2, }, - LoadLiteral: packed struct { + load_literal: packed struct { rt: u5, imm19: u19, fixed: u6 = 0b011_0_00, opc: u2, }, - ExceptionGeneration: packed struct { + exception_generation: packed struct { ll: u2, op2: u3, imm16: u16, opc: u3, fixed: u8 = 0b1101_0100, }, - UnconditionalBranchRegister: packed struct { + unconditional_branch_register: packed struct { op4: u5, rn: u5, op3: u6, @@ -256,15 +256,15 @@ pub const Instruction = union(enum) { opc: u4, fixed: u7 = 0b1101_011, }, - UnconditionalBranchImmediate: packed struct { + unconditional_branch_immediate: packed struct { imm26: u26, fixed: u5 = 0b00101, op: u1, }, - NoOperation: packed struct { + no_operation: packed struct { fixed: u32 = 0b1101010100_0_00_011_0010_0000_000_11111, }, - LogicalShiftedRegister: packed struct { + logical_shifted_register: packed struct { rd: u5, rn: u5, imm6: u6, @@ -275,7 +275,7 @@ pub const Instruction = union(enum) { opc: u2, sf: u1, }, - AddSubtractImmediate: packed struct { + add_subtract_immediate: packed struct { rd: u5, rn: u5, imm12: u12, @@ -285,6 +285,20 @@ pub const Instruction = union(enum) { op: u1, sf: u1, }, + conditional_branch: struct { + cond: u4, + o0: u1, + imm19: u19, + o1: u1, + fixed: u7 = 0b0101010, + }, + compare_and_branch: struct { + rt: u5, + imm19: u19, + op: u1, + fixed: u6 = 0b011010, + sf: u1, + }, pub const Shift = struct { shift: Type = .lsl, @@ -303,19 +317,73 @@ pub const Instruction = union(enum) { }; }; + pub const Condition = enum(u4) { + /// Integer: Equal + /// Floating point: Equal + eq, + /// Integer: Not equal + /// Floating point: Not equal or unordered + ne, + /// Integer: Carry set + /// Floating point: Greater than, equal, or unordered + cs, + /// Integer: Carry clear + /// Floating point: Less than + cc, + /// Integer: Minus, negative + /// Floating point: Less than + mi, + /// Integer: Plus, positive or zero + /// Floating point: Greater than, equal, or unordered + pl, + /// Integer: Overflow + /// Floating point: Unordered + vs, + /// Integer: No overflow + /// Floating point: Ordered + vc, + /// Integer: Unsigned higher + /// Floating point: Greater than, or unordered + hi, + /// Integer: Unsigned lower or same + /// Floating point: Less than or equal + ls, + /// Integer: Signed greater than or equal + /// Floating point: Greater than or equal + ge, + /// Integer: Signed less than + /// Floating point: Less than, or unordered + lt, + /// Integer: Signed greater than + /// Floating point: Greater than + gt, + /// Integer: Signed less than or equal + /// Floating point: Less than, equal, or unordered + le, + /// Integer: Always + /// Floating point: Always + al, + /// Integer: Always + /// Floating point: Always + nv, + }; + pub fn toU32(self: Instruction) u32 { return switch (self) { - .MoveWideImmediate => |v| @bitCast(u32, v), - .PCRelativeAddress => |v| @bitCast(u32, v), - .LoadStoreRegister => |v| @bitCast(u32, v), - .LoadStorePairOfRegisters => |v| @bitCast(u32, v), - .LoadLiteral => |v| @bitCast(u32, v), - .ExceptionGeneration => |v| @bitCast(u32, v), - .UnconditionalBranchRegister => |v| @bitCast(u32, v), - .UnconditionalBranchImmediate => |v| @bitCast(u32, v), - .NoOperation => |v| @bitCast(u32, v), - .LogicalShiftedRegister => |v| @bitCast(u32, v), - .AddSubtractImmediate => |v| @bitCast(u32, v), + .move_wide_immediate => |v| @bitCast(u32, v), + .pc_relative_address => |v| @bitCast(u32, v), + .load_store_register => |v| @bitCast(u32, v), + .load_store_register_pair => |v| @bitCast(u32, v), + .load_literal => |v| @bitCast(u32, v), + .exception_generation => |v| @bitCast(u32, v), + .unconditional_branch_register => |v| @bitCast(u32, v), + .unconditional_branch_immediate => |v| @bitCast(u32, v), + .no_operation => |v| @bitCast(u32, v), + .logical_shifted_register => |v| @bitCast(u32, v), + .add_subtract_immediate => |v| @bitCast(u32, v), + // TODO once packed structs work, this can be refactored + .conditional_branch => |v| @as(u32, v.cond) | (@as(u32, v.o0) << 4) | (@as(u32, v.imm19) << 5) | (@as(u32, v.o1) << 24) | (@as(u32, v.fixed) << 25), + .compare_and_branch => |v| @as(u32, v.rt) | (@as(u32, v.imm19) << 5) | (@as(u32, v.op) << 24) | (@as(u32, v.fixed) << 25) | (@as(u32, v.sf) << 31), }; } @@ -329,7 +397,7 @@ pub const Instruction = union(enum) { 32 => { assert(shift % 16 == 0 and shift <= 16); return Instruction{ - .MoveWideImmediate = .{ + .move_wide_immediate = .{ .rd = rd.id(), .imm16 = imm16, .hw = @intCast(u2, shift / 16), @@ -341,7 +409,7 @@ pub const Instruction = union(enum) { 64 => { assert(shift % 16 == 0 and shift <= 48); return Instruction{ - .MoveWideImmediate = .{ + .move_wide_immediate = .{ .rd = rd.id(), .imm16 = imm16, .hw = @intCast(u2, shift / 16), @@ -358,7 +426,7 @@ pub const Instruction = union(enum) { assert(rd.size() == 64); const imm21_u = @bitCast(u21, imm21); return Instruction{ - .PCRelativeAddress = .{ + .pc_relative_address = .{ .rd = rd.id(), .immlo = @truncate(u2, imm21_u), .immhi = @truncate(u19, imm21_u >> 2), @@ -522,7 +590,7 @@ pub const Instruction = union(enum) { .str, .strh, .strb => 0b00, }; return Instruction{ - .LoadStoreRegister = .{ + .load_store_register = .{ .rt = rt.id(), .rn = rn.id(), .offset = off, @@ -544,7 +612,7 @@ pub const Instruction = union(enum) { }; } - fn loadStorePairOfRegisters( + fn loadStoreRegisterPair( rt1: Register, rt2: Register, rn: Register, @@ -557,7 +625,7 @@ pub const Instruction = union(enum) { assert(-256 <= offset and offset <= 252); const imm7 = @truncate(u7, @bitCast(u9, offset >> 2)); return Instruction{ - .LoadStorePairOfRegisters = .{ + .load_store_register_pair = .{ .rt1 = rt1.id(), .rn = rn.id(), .rt2 = rt2.id(), @@ -572,7 +640,7 @@ pub const Instruction = union(enum) { assert(-512 <= offset and offset <= 504); const imm7 = @truncate(u7, @bitCast(u9, offset >> 3)); return Instruction{ - .LoadStorePairOfRegisters = .{ + .load_store_register_pair = .{ .rt1 = rt1.id(), .rn = rn.id(), .rt2 = rt2.id(), @@ -591,7 +659,7 @@ pub const Instruction = union(enum) { switch (rt.size()) { 32 => { return Instruction{ - .LoadLiteral = .{ + .load_literal = .{ .rt = rt.id(), .imm19 = imm19, .opc = 0b00, @@ -600,7 +668,7 @@ pub const Instruction = union(enum) { }, 64 => { return Instruction{ - .LoadLiteral = .{ + .load_literal = .{ .rt = rt.id(), .imm19 = imm19, .opc = 0b01, @@ -618,7 +686,7 @@ pub const Instruction = union(enum) { imm16: u16, ) Instruction { return Instruction{ - .ExceptionGeneration = .{ + .exception_generation = .{ .ll = ll, .op2 = op2, .imm16 = imm16, @@ -637,7 +705,7 @@ pub const Instruction = union(enum) { assert(rn.size() == 64); return Instruction{ - .UnconditionalBranchRegister = .{ + .unconditional_branch_register = .{ .op4 = op4, .rn = rn.id(), .op3 = op3, @@ -652,7 +720,7 @@ pub const Instruction = union(enum) { offset: i28, ) Instruction { return Instruction{ - .UnconditionalBranchImmediate = .{ + .unconditional_branch_immediate = .{ .imm26 = @bitCast(u26, @intCast(i26, offset >> 2)), .op = op, }, @@ -671,7 +739,7 @@ pub const Instruction = union(enum) { 32 => { assert(shift.amount < 32); return Instruction{ - .LogicalShiftedRegister = .{ + .logical_shifted_register = .{ .rd = rd.id(), .rn = rn.id(), .imm6 = shift.amount, @@ -685,7 +753,7 @@ pub const Instruction = union(enum) { }, 64 => { return Instruction{ - .LogicalShiftedRegister = .{ + .logical_shifted_register = .{ .rd = rd.id(), .rn = rn.id(), .imm6 = shift.amount, @@ -710,7 +778,7 @@ pub const Instruction = union(enum) { shift: bool, ) Instruction { return Instruction{ - .AddSubtractImmediate = .{ + .add_subtract_immediate = .{ .rd = rd.id(), .rn = rn.id(), .imm12 = imm12, @@ -726,6 +794,43 @@ pub const Instruction = union(enum) { }; } + fn conditionalBranch( + o0: u1, + o1: u1, + cond: Condition, + offset: i21, + ) Instruction { + assert(offset & 0b11 == 0b00); + return Instruction{ + .conditional_branch = .{ + .cond = @enumToInt(cond), + .o0 = o0, + .imm19 = @bitCast(u19, @intCast(i19, offset >> 2)), + .o1 = o1, + }, + }; + } + + fn compareAndBranch( + op: u1, + rt: Register, + offset: i21, + ) Instruction { + assert(offset & 0b11 == 0b00); + return Instruction{ + .compare_and_branch = .{ + .rt = rt.id(), + .imm19 = @bitCast(u19, @intCast(i19, offset >> 2)), + .op = op, + .sf = switch (rt.size()) { + 32 => 0b0, + 64 => 0b1, + else => unreachable, // unexpected register size + }, + }, + }; + } + // Helper functions for assembly syntax functions // Move wide (immediate) @@ -821,19 +926,19 @@ pub const Instruction = union(enum) { }; pub fn ldp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { - return loadStorePairOfRegisters(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), true); + return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), true); } pub fn ldnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { - return loadStorePairOfRegisters(rt1, rt2, rn, offset, 0, true); + return loadStoreRegisterPair(rt1, rt2, rn, offset, 0, true); } pub fn stp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { - return loadStorePairOfRegisters(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), false); + return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), false); } pub fn stnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { - return loadStorePairOfRegisters(rt1, rt2, rn, offset, 0, false); + return loadStoreRegisterPair(rt1, rt2, rn, offset, 0, false); } // Exception generation @@ -885,7 +990,7 @@ pub const Instruction = union(enum) { // Nop pub fn nop() Instruction { - return Instruction{ .NoOperation = .{} }; + return Instruction{ .no_operation = .{} }; } // Logical (shifted register) @@ -939,6 +1044,22 @@ pub const Instruction = union(enum) { pub fn subs(rd: Register, rn: Register, imm: u12, shift: bool) Instruction { return addSubtractImmediate(0b1, 0b1, rd, rn, imm, shift); } + + // Conditional branch + + pub fn bCond(cond: Condition, offset: i21) Instruction { + return conditionalBranch(0b0, 0b0, cond, offset); + } + + // Compare and branch + + pub fn cbz(rt: Register, offset: i21) Instruction { + return compareAndBranch(0b0, rt, offset); + } + + pub fn cbnz(rt: Register, offset: i21) Instruction { + return compareAndBranch(0b1, rt, offset); + } }; test { @@ -1092,6 +1213,14 @@ test "serialize instructions" { .inst = Instruction.subs(.x0, .x5, 11, true), .expected = 0b1_1_1_100010_1_0000_0000_1011_00101_00000, }, + .{ // b.hi #-4 + .inst = Instruction.bCond(.hi, -4), + .expected = 0b0101010_0_1111111111111111111_0_1000, + }, + .{ // cbz x10, #40 + .inst = Instruction.cbz(.x10, 40), + .expected = 0b1_011010_0_0000000000000001010_01010, + }, }; for (testcases) |case| { diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 761a4a8e1d..9968f05761 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -1256,7 +1256,7 @@ pub fn updateDecl(self: *MachO, module: *Module, decl: *Module.Decl) !void { const inst = code_buffer.items[fixup.offset..][0..4]; var parsed = mem.bytesAsValue(meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.PCRelativeAddress, + aarch64.Instruction.pc_relative_address, ), inst); const this_page = @intCast(i32, this_addr >> 12); const target_page = @intCast(i32, target_addr >> 12); @@ -1268,7 +1268,7 @@ pub fn updateDecl(self: *MachO, module: *Module, decl: *Module.Decl) !void { const inst = code_buffer.items[fixup.offset + 4 ..][0..4]; var parsed = mem.bytesAsValue(meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.LoadStoreRegister, + aarch64.Instruction.load_store_register, ), inst); const narrowed = @truncate(u12, target_addr); const offset = try math.divExact(u12, narrowed, 8); diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig index 9340474d19..559e2a346d 100644 --- a/src/link/MachO/Zld.zig +++ b/src/link/MachO/Zld.zig @@ -1668,7 +1668,7 @@ fn doRelocs(self: *Zld) !void { var parsed = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.UnconditionalBranchImmediate, + aarch64.Instruction.unconditional_branch_immediate, ), inst, ); @@ -1688,7 +1688,7 @@ fn doRelocs(self: *Zld) !void { var parsed = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.PCRelativeAddress, + aarch64.Instruction.pc_relative_address, ), inst, ); @@ -1706,7 +1706,7 @@ fn doRelocs(self: *Zld) !void { var parsed = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.AddSubtractImmediate, + aarch64.Instruction.add_subtract_immediate, ), inst, ); @@ -1719,7 +1719,7 @@ fn doRelocs(self: *Zld) !void { var parsed = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.LoadStoreRegister, + aarch64.Instruction.load_store_register, ), inst, ); @@ -1774,7 +1774,7 @@ fn doRelocs(self: *Zld) !void { const curr = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.AddSubtractImmediate, + aarch64.Instruction.add_subtract_immediate, ), inst, ); @@ -1783,7 +1783,7 @@ fn doRelocs(self: *Zld) !void { const curr = mem.bytesAsValue( meta.TagPayload( aarch64.Instruction, - aarch64.Instruction.LoadStoreRegister, + aarch64.Instruction.load_store_register, ), inst, ); From 00b2e31589b2f4c3f67ab2bf46e140e00df3f910 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sat, 27 Mar 2021 23:26:20 +0100 Subject: [PATCH 063/101] Basic "Hello world" working --- src/codegen/wasm.zig | 128 +++++++++++++++++++++++++------------------ src/link/Wasm.zig | 121 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 185 insertions(+), 64 deletions(-) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index fbea02e0c3..0b36e7cd9a 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -163,25 +163,23 @@ fn buildOpcode(args: OpcodeBuildArguments) wasm.Opcode { .global_get => return .global_get, .global_set => return .global_set, - .load => if (args.width) |width| - switch (width) { - 8 => switch (args.valtype1.?) { - .i32 => if (args.signedness.? == .signed) return .i32_load8_s else return .i32_load8_u, - .i64 => if (args.signedness.? == .signed) return .i64_load8_s else return .i64_load8_u, - .f32, .f64 => unreachable, - }, - 16 => switch (args.valtype1.?) { - .i32 => if (args.signedness.? == .signed) return .i32_load16_s else return .i32_load16_u, - .i64 => if (args.signedness.? == .signed) return .i64_load16_s else return .i64_load16_u, - .f32, .f64 => unreachable, - }, - 32 => switch (args.valtype1.?) { - .i64 => if (args.signedness.? == .signed) return .i64_load32_s else return .i64_load32_u, - .i32, .f32, .f64 => unreachable, - }, - else => unreachable, - } - else switch (args.valtype1.?) { + .load => if (args.width) |width| switch (width) { + 8 => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_load8_s else return .i32_load8_u, + .i64 => if (args.signedness.? == .signed) return .i64_load8_s else return .i64_load8_u, + .f32, .f64 => unreachable, + }, + 16 => switch (args.valtype1.?) { + .i32 => if (args.signedness.? == .signed) return .i32_load16_s else return .i32_load16_u, + .i64 => if (args.signedness.? == .signed) return .i64_load16_s else return .i64_load16_u, + .f32, .f64 => unreachable, + }, + 32 => switch (args.valtype1.?) { + .i64 => if (args.signedness.? == .signed) return .i64_load32_s else return .i64_load32_u, + .i32, .f32, .f64 => unreachable, + }, + else => unreachable, + } else switch (args.valtype1.?) { .i32 => return .i32_load, .i64 => return .i64_load, .f32 => return .f32_load, @@ -469,6 +467,13 @@ test "Wasm - buildOpcode" { testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64); } +pub const Result = union(enum) { + /// The codegen bytes have been appended to `Context.code` + appended: void, + /// The data is managed externally and are part of the `Result` + externally_managed: []const u8, +}; + /// Hashmap to store generated `WValue` for each `Inst` pub const ValueTable = std.AutoHashMapUnmanaged(*Inst, WValue); @@ -504,6 +509,8 @@ pub const Context = struct { const InnerError = error{ OutOfMemory, CodegenFail, + /// Can occur when dereferencing a pointer that points to a `Decl` of which the analysis has failed + AnalysisFail, }; pub fn deinit(self: *Context) void { @@ -604,48 +611,65 @@ pub const Context = struct { } /// Generates the wasm bytecode for the function declaration belonging to `Context` - pub fn gen(self: *Context) InnerError!void { + pub fn gen(self: *Context) InnerError!Result { assert(self.code.items.len == 0); - try self.genFunctype(); - // Write instructions - // TODO: check for and handle death of instructions const tv = self.decl.typed_value.most_recent.typed_value; - const mod_fn = blk: { - if (tv.val.castTag(.function)) |func| break :blk func.data; - if (tv.val.castTag(.extern_fn)) |ext_fn| return; // don't need codegen for extern functions - return self.fail(.{ .node_offset = 0 }, "TODO: Wasm codegen for decl type '{s}'", .{tv.ty.tag()}); - }; + switch (tv.ty.zigTypeTag()) { + .Fn => { + try self.genFunctype(); - // Reserve space to write the size after generating the code as well as space for locals count - try self.code.resize(10); + // Write instructions + // TODO: check for and handle death of instructions + const mod_fn = blk: { + if (tv.val.castTag(.function)) |func| break :blk func.data; + if (tv.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions + return self.fail(.{ .node_offset = 0 }, "TODO: Wasm codegen for decl type '{s}'", .{tv.ty.tag()}); + }; - try self.genBody(mod_fn.body); + // Reserve space to write the size after generating the code as well as space for locals count + try self.code.resize(10); - // finally, write our local types at the 'offset' position - { - leb.writeUnsignedFixed(5, self.code.items[5..10], @intCast(u32, self.locals.items.len)); + try self.genBody(mod_fn.body); - // offset into 'code' section where we will put our locals types - var local_offset: usize = 10; + // finally, write our local types at the 'offset' position + { + leb.writeUnsignedFixed(5, self.code.items[5..10], @intCast(u32, self.locals.items.len)); - // emit the actual locals amount - for (self.locals.items) |local| { - var buf: [6]u8 = undefined; - leb.writeUnsignedFixed(5, buf[0..5], @as(u32, 1)); - buf[5] = local; - try self.code.insertSlice(local_offset, &buf); - local_offset += 6; - } + // offset into 'code' section where we will put our locals types + var local_offset: usize = 10; + + // emit the actual locals amount + for (self.locals.items) |local| { + var buf: [6]u8 = undefined; + leb.writeUnsignedFixed(5, buf[0..5], @as(u32, 1)); + buf[5] = local; + try self.code.insertSlice(local_offset, &buf); + local_offset += 6; + } + } + + const writer = self.code.writer(); + try writer.writeByte(wasm.opcode(.end)); + + // Fill in the size of the generated code to the reserved space at the + // beginning of the buffer. + const size = self.code.items.len - 5 + self.decl.fn_link.wasm.?.idx_refs.items.len * 5; + leb.writeUnsignedFixed(5, self.code.items[0..5], @intCast(u32, size)); + + // codegen data has been appended to `code` + return Result.appended; + }, + .Array => { + if (tv.val.castTag(.bytes)) |payload| { + if (tv.ty.sentinel()) |sentinel| { + // TODO, handle sentinel correctly + } + return Result{ .externally_managed = payload.data }; + } else return self.fail(.{ .node_offset = 0 }, "TODO implement gen for more kinds of arrays", .{}); + }, + else => |tag| return self.fail(.{ .node_offset = 0 }, "TODO: Implement zig type codegen for type: '{s}'", .{tag}), } - - const writer = self.code.writer(); - try writer.writeByte(wasm.opcode(.end)); - - // Fill in the size of the generated code to the reserved space at the - // beginning of the buffer. - const size = self.code.items.len - 5 + self.decl.fn_link.wasm.?.idx_refs.items.len * 5; - leb.writeUnsignedFixed(5, self.code.items[0..5], @intCast(u32, size)); } fn genInst(self: *Context, inst: *Inst) InnerError!WValue { diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 523d4c8a64..b732915924 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -29,6 +29,32 @@ pub const FnData = struct { idx_refs: std.ArrayListUnmanaged(struct { offset: u32, decl: *Module.Decl }) = .{}, }; +/// Data section of the wasm binary +/// Each declaration will have its own 'data_segment' within the section +/// where the offset is calculated using the previous segments and the content length +/// of the data +pub const DataSection = struct { + segments: std.AutoArrayHashMapUnmanaged(*const Module.Decl, []const u8) = .{}, + + /// Returns the offset into the data segment based on a given `Decl` + pub fn offset(self: DataSection, decl: *const Module.Decl) u32 { + var cur_offset: u32 = 0; + return for (self.segments.items()) |entry| { + if (entry.key == decl) break cur_offset; + cur_offset += @intCast(u32, entry.value.len); + } else cur_offset; + } + + /// Returns the total payload size of the data section + pub fn size(self: DataSection) u32 { + var total: u32 = 0; + for (self.segments.items()) |entry| { + total += @intCast(u32, entry.value.len); + } + return total; + } +}; + base: link.File, /// List of all function Decls to be written to the output file. The index of @@ -45,6 +71,10 @@ ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, /// to support existing code. /// TODO: Allow setting this through a flag? host_name: []const u8 = "env", +/// Map of declarations with its bytes payload, used to keep track of all data segments +/// that needs to be emit when creating the wasm binary. +/// The `DataSection`'s lifetime must be kept alive until the linking stage. +data: DataSection = .{}, pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Options) !*Wasm { assert(options.object_format == .wasm); @@ -52,7 +82,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio if (options.use_llvm) return error.LLVM_BackendIsTODO_ForWasm; // TODO if (options.use_lld) return error.LLD_LinkingIsTODO_ForWasm; // TODO - // TODO: read the file and keep vaild parts instead of truncating + // TODO: read the file and keep valid parts instead of truncating const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); errdefer file.close(); @@ -92,14 +122,13 @@ pub fn deinit(self: *Wasm) void { } self.funcs.deinit(self.base.allocator); self.ext_funcs.deinit(self.base.allocator); + self.data.segments.deinit(self.base.allocator); } // Generate code for the Decl, storing it in memory to be later written to // the file on flush(). pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { const typed_value = decl.typed_value.most_recent.typed_value; - if (typed_value.ty.zigTypeTag() != .Fn) - return error.TODOImplementNonFnDeclsForWasm; if (decl.fn_link.wasm) |*fn_data| { fn_data.functype.items.len = 0; @@ -111,6 +140,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { switch (decl.typed_value.most_recent.typed_value.val.tag()) { .function => try self.funcs.append(self.base.allocator, decl), .extern_fn => try self.ext_funcs.append(self.base.allocator, decl), + .bytes => {}, else => return error.TODOImplementNonFnDeclsForWasm, } } @@ -132,7 +162,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { defer context.deinit(); // generate the 'code' section for the function declaration - context.gen() catch |err| switch (err) { + const result = context.gen() catch |err| switch (err) { error.CodegenFail => { decl.analysis = .codegen_failure; try module.failed_decls.put(module.gpa, decl, context.err_msg); @@ -141,15 +171,24 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { else => |e| return err, }; - // as locals are patched afterwards, the offsets of funcidx's are off, - // here we update them to correct them - for (decl.fn_link.wasm.?.idx_refs.items) |*func| { - // For each local, add 6 bytes (count + type) - func.offset += @intCast(u32, context.locals.items.len * 6); - } + switch (typed_value.ty.zigTypeTag()) { + .Fn => { + // as locals are patched afterwards, the offsets of funcidx's are off, + // here we update them to correct them + for (decl.fn_link.wasm.?.idx_refs.items) |*func| { + // For each local, add 6 bytes (count + type) + func.offset += @intCast(u32, context.locals.items.len * 6); + } - fn_data.functype = context.func_type_data.toUnmanaged(); - fn_data.code = context.code.toUnmanaged(); + fn_data.functype = context.func_type_data.toUnmanaged(); + fn_data.code = context.code.toUnmanaged(); + }, + .Array => switch (result) { + .appended => unreachable, + .externally_managed => |payload| try self.data.segments.put(self.base.allocator, decl, payload), + }, + else => return error.TODO, + } } pub fn updateDeclExports( @@ -257,6 +296,22 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { ); } + // Memory section + if (self.data.size() != 0) { + const header_offset = try reserveVecSectionHeader(file); + const writer = file.writer(); + + try leb.writeULEB128(writer, @as(u32, 0)); + try leb.writeULEB128(writer, @as(u32, 1)); + try writeVecSectionHeader( + file, + header_offset, + .memory, + @intCast(u32, (try file.getPos()) - header_offset - header_size), + @as(u32, 1), + ); + } + // Export section if (self.base.options.module) |module| { const header_offset = try reserveVecSectionHeader(file); @@ -281,6 +336,16 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { count += 1; } } + + // export memory if size is not 0 + if (self.data.size() != 0) { + try leb.writeULEB128(writer, @intCast(u32, "memory".len)); + try writer.writeAll("memory"); + try writer.writeByte(wasm.externalKind(.memory)); + try leb.writeULEB128(writer, @as(u32, 0)); // only 1 memory 'object' can exist + count += 1; + } + try writeVecSectionHeader( file, header_offset, @@ -320,6 +385,38 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { @intCast(u32, self.funcs.items.len), ); } + + // Data section + { + const header_offset = try reserveVecSectionHeader(file); + const writer = file.writer(); + var offset: i32 = 0; + for (self.data.segments.items()) |entry| { + // index to memory section (always 0 in current wasm version) + try leb.writeULEB128(writer, @as(u32, 0)); + + // offset into data section + try writer.writeByte(wasm.opcode(.i32_const)); + try leb.writeILEB128(writer, offset); + try writer.writeByte(wasm.opcode(.end)); + + // payload size + const len = @intCast(u32, entry.value.len); + try leb.writeULEB128(writer, len); + + // write payload + try writer.writeAll(entry.value); + offset += @bitCast(i32, len); + } + + try writeVecSectionHeader( + file, + header_offset, + .data, + @intCast(u32, (try file.getPos()) - header_offset - header_size), + @intCast(u32, self.data.segments.items().len), + ); + } } fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { From 1bd5552fc1a8fd2ddcb8f0c17f35662e4eb1cbcf Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Fri, 2 Apr 2021 20:59:40 +0200 Subject: [PATCH 064/101] Calculate data length to ensure correct pointer offsets --- src/Module.zig | 2 +- src/codegen/wasm.zig | 42 ++++++--- src/link.zig | 5 +- src/link/Wasm.zig | 197 ++++++++++++++++++++++++++++--------------- 4 files changed, 164 insertions(+), 82 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index 933917d948..8360b3245b 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -3842,7 +3842,7 @@ fn allocateNewDecl( .elf => .{ .elf = link.File.Elf.SrcFn.empty }, .macho => .{ .macho = link.File.MachO.SrcFn.empty }, .c => .{ .c = link.File.C.FnBlock.empty }, - .wasm => .{ .wasm = null }, + .wasm => .{ .wasm = .{} }, .spirv => .{ .spirv = .{} }, }, .generation = 0, diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index 0b36e7cd9a..3e20f94d6f 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -16,9 +16,12 @@ const Value = @import("../value.zig").Value; const Compilation = @import("../Compilation.zig"); const AnyMCValue = @import("../codegen.zig").AnyMCValue; const LazySrcLoc = Module.LazySrcLoc; +const link = @import("../link.zig"); +const TypedValue = @import("../TypedValue.zig"); /// Wasm Value, created when generating an instruction const WValue = union(enum) { + /// May be referenced but is unused none: void, /// Index of the local variable local: u32, @@ -611,11 +614,8 @@ pub const Context = struct { } /// Generates the wasm bytecode for the function declaration belonging to `Context` - pub fn gen(self: *Context) InnerError!Result { - assert(self.code.items.len == 0); - - const tv = self.decl.typed_value.most_recent.typed_value; - switch (tv.ty.zigTypeTag()) { + pub fn gen(self: *Context, typed_value: TypedValue) InnerError!Result { + switch (typed_value.ty.zigTypeTag()) { .Fn => { try self.genFunctype(); @@ -654,21 +654,41 @@ pub const Context = struct { // Fill in the size of the generated code to the reserved space at the // beginning of the buffer. - const size = self.code.items.len - 5 + self.decl.fn_link.wasm.?.idx_refs.items.len * 5; + const size = self.code.items.len - 5 + self.decl.fn_link.wasm.idx_refs.items.len * 5; leb.writeUnsignedFixed(5, self.code.items[0..5], @intCast(u32, size)); // codegen data has been appended to `code` return Result.appended; }, .Array => { - if (tv.val.castTag(.bytes)) |payload| { - if (tv.ty.sentinel()) |sentinel| { - // TODO, handle sentinel correctly + if (typed_value.val.castTag(.bytes)) |payload| { + if (typed_value.ty.sentinel()) |sentinel| { + try self.code.appendSlice(payload.data); + + switch (try self.gen(.{ + .ty = typed_value.ty.elemType(), + .val = sentinel, + })) { + .appended => return Result.appended, + .externally_managed => |data| { + try self.code.appendSlice(data); + return Result.appended; + }, + } } return Result{ .externally_managed = payload.data }; } else return self.fail(.{ .node_offset = 0 }, "TODO implement gen for more kinds of arrays", .{}); }, - else => |tag| return self.fail(.{ .node_offset = 0 }, "TODO: Implement zig type codegen for type: '{s}'", .{tag}), + .Int => { + const info = typed_value.ty.intInfo(self.bin_file.base.options.target); + if (info.bits == 8 and info.signedness == .unsigned) { + const int_byte = typed_value.val.toUnsignedInt(); + try self.code.append(@intCast(u8, int_byte)); + return Result.appended; + } + return self.fail(self.decl.src(), "TODO: Implement codegen for int type: '{}'", .{typed_value.ty}); + }, + else => |tag| return self.fail(self.decl.src(), "TODO: Implement zig type codegen for type: '{s}'", .{tag}), } } @@ -745,7 +765,7 @@ pub const Context = struct { // The function index immediate argument will be filled in using this data // in link.Wasm.flush(). - try self.decl.fn_link.wasm.?.idx_refs.append(self.gpa, .{ + try self.decl.fn_link.wasm.idx_refs.append(self.gpa, .{ .offset = @intCast(u32, self.code.items.len), .decl = target, }); diff --git a/src/link.zig b/src/link.zig index db3e973f84..162b55a0d0 100644 --- a/src/link.zig +++ b/src/link.zig @@ -147,7 +147,7 @@ pub const File = struct { coff: Coff.SrcFn, macho: MachO.SrcFn, c: C.FnBlock, - wasm: ?Wasm.FnData, + wasm: Wasm.FnData, spirv: SpirV.FnData, }; @@ -328,7 +328,8 @@ pub const File = struct { .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl), .macho => return @fieldParentPtr(MachO, "base", base).allocateDeclIndexes(decl), .c => return @fieldParentPtr(C, "base", base).allocateDeclIndexes(decl), - .wasm, .spirv => {}, + .wasm => return @fieldParentPtr(Wasm, "base", base).allocateDeclIndexes(decl), + .spirv => {}, } } diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index b732915924..37c9b02d9e 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -16,6 +16,7 @@ const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); const Cache = @import("../Cache.zig"); +const TypedValue = @import("../TypedValue.zig"); pub const base_tag = link.File.Tag.wasm; @@ -34,25 +35,33 @@ pub const FnData = struct { /// where the offset is calculated using the previous segments and the content length /// of the data pub const DataSection = struct { - segments: std.AutoArrayHashMapUnmanaged(*const Module.Decl, []const u8) = .{}, + segments: std.AutoArrayHashMapUnmanaged(*Module.Decl, struct { data: [*]const u8, len: u32 }) = .{}, /// Returns the offset into the data segment based on a given `Decl` pub fn offset(self: DataSection, decl: *const Module.Decl) u32 { var cur_offset: u32 = 0; return for (self.segments.items()) |entry| { if (entry.key == decl) break cur_offset; - cur_offset += @intCast(u32, entry.value.len); - } else cur_offset; + cur_offset += entry.value.len; + } else unreachable; // offset() called on declaration that does not live inside 'data' section } /// Returns the total payload size of the data section pub fn size(self: DataSection) u32 { var total: u32 = 0; for (self.segments.items()) |entry| { - total += @intCast(u32, entry.value.len); + total += entry.value.len; } return total; } + + /// Updates the data in the data segment belonging to the given decl. + /// It's illegal behaviour to call this before allocateDeclIndexes was called + /// `data` must be managed externally with a lifetime that last as long as codegen does. + pub fn updateData(self: DataSection, decl: *Module.Decl, data: []const u8) void { + const entry = self.segments.getEntry(decl).?; // called updateData before the declaration was added to data segments + entry.value.data = data.ptr; + } }; base: link.File, @@ -111,49 +120,92 @@ pub fn createEmpty(gpa: *Allocator, options: link.Options) !*Wasm { pub fn deinit(self: *Wasm) void { for (self.funcs.items) |decl| { - decl.fn_link.wasm.?.functype.deinit(self.base.allocator); - decl.fn_link.wasm.?.code.deinit(self.base.allocator); - decl.fn_link.wasm.?.idx_refs.deinit(self.base.allocator); + decl.fn_link.wasm.functype.deinit(self.base.allocator); + decl.fn_link.wasm.code.deinit(self.base.allocator); + decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } for (self.ext_funcs.items) |decl| { - decl.fn_link.wasm.?.functype.deinit(self.base.allocator); - decl.fn_link.wasm.?.code.deinit(self.base.allocator); - decl.fn_link.wasm.?.idx_refs.deinit(self.base.allocator); + decl.fn_link.wasm.functype.deinit(self.base.allocator); + decl.fn_link.wasm.code.deinit(self.base.allocator); + decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); + } + for (self.data.segments.items()) |entry| { + // data segments only use the code section + entry.key.fn_link.wasm.code.deinit(self.base.allocator); } self.funcs.deinit(self.base.allocator); self.ext_funcs.deinit(self.base.allocator); self.data.segments.deinit(self.base.allocator); } +pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { + std.debug.print("INIT: '{s}'\n", .{decl.name}); + const tv = decl.typed_value.most_recent.typed_value; + decl.fn_link.wasm = .{}; + + switch (tv.ty.zigTypeTag()) { + .Array => { + // if the codegen of the given decl contributes to the data segment + // we must calculate its data length now so that the data offsets are available + // to other decls when called + const data_len = calcDataLen(self, tv) catch return error.AnalysisFail; + try self.data.segments.putNoClobber(self.base.allocator, decl, .{ .data = undefined, .len = data_len }); + }, + .Fn => if (self.getFuncidx(decl) == null) switch (tv.val.tag()) { + // dependent on function type, appends it to the correct list + .function => try self.funcs.append(self.base.allocator, decl), + .extern_fn => try self.ext_funcs.append(self.base.allocator, decl), + else => unreachable, + }, + else => {}, + } +} + +// TODO, remove this and use the existing error mechanism +const DataLenError = error{ + TODO_WASM_CalcDataLenArray, + TODO_WASM_CalcDataLen, +}; +/// Calculates the length of the data segment that will be occupied by the given `TypedValue` +fn calcDataLen(bin_file: *Wasm, typed_value: TypedValue) DataLenError!u32 { + switch (typed_value.ty.zigTypeTag()) { + .Array => { + if (typed_value.val.castTag(.bytes)) |payload| { + if (typed_value.ty.sentinel()) |sentinel| { + return @intCast(u32, payload.data.len) + try calcDataLen(bin_file, .{ + .ty = typed_value.ty.elemType(), + .val = sentinel, + }); + } + return @intCast(u32, payload.data.len); + } + return error.TODO_WASM_CalcDataLenArray; + }, + .Int => { + const info = typed_value.ty.intInfo(bin_file.base.options.target); + return info.bits / 8; + }, + .Pointer => return 4, + else => return error.TODO_WASM_CalcDataLen, + } +} + // Generate code for the Decl, storing it in memory to be later written to // the file on flush(). pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { + std.debug.print("Updating '{s}'\n", .{decl.name}); const typed_value = decl.typed_value.most_recent.typed_value; - if (decl.fn_link.wasm) |*fn_data| { - fn_data.functype.items.len = 0; - fn_data.code.items.len = 0; - fn_data.idx_refs.items.len = 0; - } else { - decl.fn_link.wasm = .{}; - // dependent on function type, appends it to the correct list - switch (decl.typed_value.most_recent.typed_value.val.tag()) { - .function => try self.funcs.append(self.base.allocator, decl), - .extern_fn => try self.ext_funcs.append(self.base.allocator, decl), - .bytes => {}, - else => return error.TODOImplementNonFnDeclsForWasm, - } - } - const fn_data = &decl.fn_link.wasm.?; - - var managed_functype = fn_data.functype.toManaged(self.base.allocator); - var managed_code = fn_data.code.toManaged(self.base.allocator); + const fn_data = &decl.fn_link.wasm; + fn_data.functype.items.len = 0; + fn_data.code.items.len = 0; + fn_data.idx_refs.items.len = 0; var context = codegen.Context{ .gpa = self.base.allocator, .values = .{}, - .code = managed_code, - .func_type_data = managed_functype, + .code = fn_data.code.toManaged(self.base.allocator), + .func_type_data = fn_data.functype.toManaged(self.base.allocator), .decl = decl, .err_msg = undefined, .locals = .{}, @@ -162,7 +214,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { defer context.deinit(); // generate the 'code' section for the function declaration - const result = context.gen() catch |err| switch (err) { + const result = context.gen(typed_value) catch |err| switch (err) { error.CodegenFail => { decl.analysis = .codegen_failure; try module.failed_decls.put(module.gpa, decl, context.err_msg); @@ -175,7 +227,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { .Fn => { // as locals are patched afterwards, the offsets of funcidx's are off, // here we update them to correct them - for (decl.fn_link.wasm.?.idx_refs.items) |*func| { + for (decl.fn_link.wasm.idx_refs.items) |*func| { // For each local, add 6 bytes (count + type) func.offset += @intCast(u32, context.locals.items.len * 6); } @@ -184,8 +236,12 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { fn_data.code = context.code.toUnmanaged(); }, .Array => switch (result) { - .appended => unreachable, - .externally_managed => |payload| try self.data.segments.put(self.base.allocator, decl, payload), + .appended => { + fn_data.functype = context.func_type_data.toUnmanaged(); + fn_data.code = context.code.toUnmanaged(); + self.data.updateData(decl, fn_data.code.items); + }, + .externally_managed => |payload| self.data.updateData(decl, payload), }, else => return error.TODO, } @@ -199,18 +255,18 @@ pub fn updateDeclExports( ) !void {} pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { - // TODO: remove this assert when non-function Decls are implemented - assert(decl.typed_value.most_recent.typed_value.ty.zigTypeTag() == .Fn); - const func_idx = self.getFuncidx(decl).?; - switch (decl.typed_value.most_recent.typed_value.val.tag()) { - .function => _ = self.funcs.swapRemove(func_idx), - .extern_fn => _ = self.ext_funcs.swapRemove(func_idx), - else => unreachable, + if (self.getFuncidx(decl)) |func_idx| { + switch (decl.typed_value.most_recent.typed_value.val.tag()) { + .function => _ = self.funcs.swapRemove(func_idx), + .extern_fn => _ = self.ext_funcs.swapRemove(func_idx), + else => unreachable, + } } - decl.fn_link.wasm.?.functype.deinit(self.base.allocator); - decl.fn_link.wasm.?.code.deinit(self.base.allocator); - decl.fn_link.wasm.?.idx_refs.deinit(self.base.allocator); - decl.fn_link.wasm = null; + decl.fn_link.wasm.functype.deinit(self.base.allocator); + decl.fn_link.wasm.code.deinit(self.base.allocator); + decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); + _ = self.data.segments.orderedRemove(decl); + decl.fn_link.wasm = undefined; } pub fn flush(self: *Wasm, comp: *Compilation) !void { @@ -238,8 +294,8 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { // extern functions are defined in the wasm binary first through the `import` // section, so define their func types first - for (self.ext_funcs.items) |decl| try file.writeAll(decl.fn_link.wasm.?.functype.items); - for (self.funcs.items) |decl| try file.writeAll(decl.fn_link.wasm.?.functype.items); + for (self.ext_funcs.items) |decl| try file.writeAll(decl.fn_link.wasm.functype.items); + for (self.funcs.items) |decl| try file.writeAll(decl.fn_link.wasm.functype.items); try writeVecSectionHeader( file, @@ -302,13 +358,22 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { const writer = file.writer(); try leb.writeULEB128(writer, @as(u32, 0)); - try leb.writeULEB128(writer, @as(u32, 1)); + // Calculate the amount of memory pages are required and write them. + // Wasm uses 64kB page sizes. Round up to ensure the data segments fit into the memory + try leb.writeULEB128( + writer, + try std.math.divCeil( + u32, + self.data.size(), + std.mem.page_size, + ), + ); try writeVecSectionHeader( file, header_offset, .memory, @intCast(u32, (try file.getPos()) - header_offset - header_size), - @as(u32, 1), + @as(u32, 1), // wasm currently only supports 1 linear memory segment ); } @@ -360,7 +425,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { const header_offset = try reserveVecSectionHeader(file); const writer = file.writer(); for (self.funcs.items) |decl| { - const fn_data = &decl.fn_link.wasm.?; + const fn_data = &decl.fn_link.wasm; // Write the already generated code to the file, inserting // function indexes where required. @@ -387,34 +452,30 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { } // Data section - { + if (self.data.size() != 0) { const header_offset = try reserveVecSectionHeader(file); const writer = file.writer(); - var offset: i32 = 0; - for (self.data.segments.items()) |entry| { - // index to memory section (always 0 in current wasm version) - try leb.writeULEB128(writer, @as(u32, 0)); + var len: u32 = 0; + // index to memory section (currently, there can only be 1 memory section in wasm) + try leb.writeULEB128(writer, @as(u32, 0)); - // offset into data section - try writer.writeByte(wasm.opcode(.i32_const)); - try leb.writeILEB128(writer, offset); - try writer.writeByte(wasm.opcode(.end)); + // offset into data section + try writer.writeByte(wasm.opcode(.i32_const)); + try leb.writeILEB128(writer, @as(i32, 0)); + try writer.writeByte(wasm.opcode(.end)); - // payload size - const len = @intCast(u32, entry.value.len); - try leb.writeULEB128(writer, len); + // payload size + try leb.writeULEB128(writer, self.data.size()); - // write payload - try writer.writeAll(entry.value); - offset += @bitCast(i32, len); - } + // write payload + for (self.data.segments.items()) |entry| try writer.writeAll(entry.value.data[0..entry.value.len]); try writeVecSectionHeader( file, header_offset, .data, @intCast(u32, (try file.getPos()) - header_offset - header_size), - @intCast(u32, self.data.segments.items().len), + @intCast(u32, 1), ); } } @@ -681,7 +742,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { /// Get the current index of a given Decl in the function list /// This will correctly provide the index, regardless whether the function is extern or not /// TODO: we could maintain a hash map to potentially make this simpler -fn getFuncidx(self: Wasm, decl: *Module.Decl) ?u32 { +fn getFuncidx(self: Wasm, decl: *const Module.Decl) ?u32 { var offset: u32 = 0; const slice = switch (decl.typed_value.most_recent.typed_value.val.tag()) { .function => blk: { From 9fd1dab58230edae11e2798f30ec43704a0c2178 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sat, 3 Apr 2021 20:59:41 +0200 Subject: [PATCH 065/101] Handle incremental compilation correctly --- src/link/Wasm.zig | 65 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 37c9b02d9e..e94f61d54a 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -35,22 +35,28 @@ pub const FnData = struct { /// where the offset is calculated using the previous segments and the content length /// of the data pub const DataSection = struct { - segments: std.AutoArrayHashMapUnmanaged(*Module.Decl, struct { data: [*]const u8, len: u32 }) = .{}, + /// Every data object will be appended to this list, + /// containing its `Decl`, the data in bytes, and its length. + segments: std.ArrayListUnmanaged(struct { + decl: *Module.Decl, + data: [*]const u8, + len: u32, + }) = .{}, /// Returns the offset into the data segment based on a given `Decl` pub fn offset(self: DataSection, decl: *const Module.Decl) u32 { var cur_offset: u32 = 0; - return for (self.segments.items()) |entry| { - if (entry.key == decl) break cur_offset; - cur_offset += entry.value.len; + return for (self.segments.items) |entry| { + if (entry.decl == decl) break cur_offset; + cur_offset += entry.len; } else unreachable; // offset() called on declaration that does not live inside 'data' section } /// Returns the total payload size of the data section pub fn size(self: DataSection) u32 { var total: u32 = 0; - for (self.segments.items()) |entry| { - total += entry.value.len; + for (self.segments.items) |entry| { + total += entry.len; } return total; } @@ -59,8 +65,17 @@ pub const DataSection = struct { /// It's illegal behaviour to call this before allocateDeclIndexes was called /// `data` must be managed externally with a lifetime that last as long as codegen does. pub fn updateData(self: DataSection, decl: *Module.Decl, data: []const u8) void { - const entry = self.segments.getEntry(decl).?; // called updateData before the declaration was added to data segments - entry.value.data = data.ptr; + const entry = for (self.segments.items) |*item| { + if (item.decl == decl) break item; + } else unreachable; // called updateData before the declaration was added to data segments + entry.data = data.ptr; + } + + /// Returns the index of a declaration and `null` when not found + pub fn idx(self: DataSection, decl: *Module.Decl) ?usize { + return for (self.segments.items) |entry, i| { + if (entry.decl == decl) break i; + } else null; } }; @@ -129,9 +144,10 @@ pub fn deinit(self: *Wasm) void { decl.fn_link.wasm.code.deinit(self.base.allocator); decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } - for (self.data.segments.items()) |entry| { - // data segments only use the code section - entry.key.fn_link.wasm.code.deinit(self.base.allocator); + for (self.data.segments.items) |entry| { + entry.decl.fn_link.wasm.functype.deinit(self.base.allocator); + entry.decl.fn_link.wasm.code.deinit(self.base.allocator); + entry.decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } self.funcs.deinit(self.base.allocator); self.ext_funcs.deinit(self.base.allocator); @@ -139,7 +155,6 @@ pub fn deinit(self: *Wasm) void { } pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { - std.debug.print("INIT: '{s}'\n", .{decl.name}); const tv = decl.typed_value.most_recent.typed_value; decl.fn_link.wasm = .{}; @@ -149,7 +164,22 @@ pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { // we must calculate its data length now so that the data offsets are available // to other decls when called const data_len = calcDataLen(self, tv) catch return error.AnalysisFail; - try self.data.segments.putNoClobber(self.base.allocator, decl, .{ .data = undefined, .len = data_len }); + try self.data.segments.append(self.base.allocator, .{ + .decl = decl, + .data = undefined, + .len = data_len, + }); + + // detect if we can replace it into a to-be-deleted decl's spot to ensure no gaps are + // made in our data segment + const idx: ?usize = for (self.data.segments.items) |entry, i| { + if (entry.decl.deletion_flag) break i; + } else null; + if (idx) |id| { + const old_decl = self.data.segments.swapRemove(id); // current decl is now in to-be-deleted decl's spot + // re-append to end of list so it can be cleaned up by `freeDecl` + try self.data.segments.append(self.base.allocator, old_decl); + } }, .Fn => if (self.getFuncidx(decl) == null) switch (tv.val.tag()) { // dependent on function type, appends it to the correct list @@ -193,7 +223,6 @@ fn calcDataLen(bin_file: *Wasm, typed_value: TypedValue) DataLenError!u32 { // Generate code for the Decl, storing it in memory to be later written to // the file on flush(). pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { - std.debug.print("Updating '{s}'\n", .{decl.name}); const typed_value = decl.typed_value.most_recent.typed_value; const fn_data = &decl.fn_link.wasm; @@ -262,10 +291,12 @@ pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { else => unreachable, } } + if (self.data.idx(decl)) |idx| { + _ = self.data.segments.swapRemove(idx); + } decl.fn_link.wasm.functype.deinit(self.base.allocator); decl.fn_link.wasm.code.deinit(self.base.allocator); decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); - _ = self.data.segments.orderedRemove(decl); decl.fn_link.wasm = undefined; } @@ -468,7 +499,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { try leb.writeULEB128(writer, self.data.size()); // write payload - for (self.data.segments.items()) |entry| try writer.writeAll(entry.value.data[0..entry.value.len]); + for (self.data.segments.items) |entry| try writer.writeAll(entry.data[0..entry.len]); try writeVecSectionHeader( file, @@ -742,7 +773,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { /// Get the current index of a given Decl in the function list /// This will correctly provide the index, regardless whether the function is extern or not /// TODO: we could maintain a hash map to potentially make this simpler -fn getFuncidx(self: Wasm, decl: *const Module.Decl) ?u32 { +fn getFuncidx(self: Wasm, decl: *Module.Decl) ?u32 { var offset: u32 = 0; const slice = switch (decl.typed_value.most_recent.typed_value.val.tag()) { .function => blk: { From 47f36427887fc7d1646cfb7ed8eeeeb14cd3555b Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sun, 4 Apr 2021 20:31:35 +0200 Subject: [PATCH 066/101] Cleanup --- src/codegen/wasm.zig | 10 ++++---- src/link/Wasm.zig | 59 ++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index 3e20f94d6f..a5069de956 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -622,9 +622,9 @@ pub const Context = struct { // Write instructions // TODO: check for and handle death of instructions const mod_fn = blk: { - if (tv.val.castTag(.function)) |func| break :blk func.data; - if (tv.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions - return self.fail(.{ .node_offset = 0 }, "TODO: Wasm codegen for decl type '{s}'", .{tv.ty.tag()}); + if (typed_value.val.castTag(.function)) |func| break :blk func.data; + if (typed_value.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions + return self.fail(.{ .node_offset = 0 }, "TODO: Wasm codegen for decl type '{s}'", .{typed_value.ty.tag()}); }; // Reserve space to write the size after generating the code as well as space for locals count @@ -686,9 +686,9 @@ pub const Context = struct { try self.code.append(@intCast(u8, int_byte)); return Result.appended; } - return self.fail(self.decl.src(), "TODO: Implement codegen for int type: '{}'", .{typed_value.ty}); + return self.fail(.{ .node_offset = 0 }, "TODO: Implement codegen for int type: '{}'", .{typed_value.ty}); }, - else => |tag| return self.fail(self.decl.src(), "TODO: Implement zig type codegen for type: '{s}'", .{tag}), + else => |tag| return self.fail(.{ .node_offset = 0 }, "TODO: Implement zig type codegen for type: '{s}'", .{tag}), } } diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index e94f61d54a..5f878ca5ac 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -38,8 +38,11 @@ pub const DataSection = struct { /// Every data object will be appended to this list, /// containing its `Decl`, the data in bytes, and its length. segments: std.ArrayListUnmanaged(struct { + /// The decl that lives inside the 'data' section such as an array decl: *Module.Decl, + /// The contents of the data in bytes data: [*]const u8, + /// The length of the contents inside the 'data' section len: u32, }) = .{}, @@ -72,7 +75,7 @@ pub const DataSection = struct { } /// Returns the index of a declaration and `null` when not found - pub fn idx(self: DataSection, decl: *Module.Decl) ?usize { + pub fn getIdx(self: DataSection, decl: *Module.Decl) ?usize { return for (self.segments.items) |entry, i| { if (entry.decl == decl) break i; } else null; @@ -145,9 +148,8 @@ pub fn deinit(self: *Wasm) void { decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } for (self.data.segments.items) |entry| { - entry.decl.fn_link.wasm.functype.deinit(self.base.allocator); + // decl's that live in data section do not generate idx_refs or func types entry.decl.fn_link.wasm.code.deinit(self.base.allocator); - entry.decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } self.funcs.deinit(self.base.allocator); self.ext_funcs.deinit(self.base.allocator); @@ -155,15 +157,14 @@ pub fn deinit(self: *Wasm) void { } pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { - const tv = decl.typed_value.most_recent.typed_value; - decl.fn_link.wasm = .{}; + const typed_value = decl.typed_value.most_recent.typed_value; - switch (tv.ty.zigTypeTag()) { + switch (typed_value.ty.zigTypeTag()) { .Array => { // if the codegen of the given decl contributes to the data segment // we must calculate its data length now so that the data offsets are available // to other decls when called - const data_len = calcDataLen(self, tv) catch return error.AnalysisFail; + const data_len = self.calcDataLen(typed_value); try self.data.segments.append(self.base.allocator, .{ .decl = decl, .data = undefined, @@ -175,13 +176,18 @@ pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { const idx: ?usize = for (self.data.segments.items) |entry, i| { if (entry.decl.deletion_flag) break i; } else null; + if (idx) |id| { - const old_decl = self.data.segments.swapRemove(id); // current decl is now in to-be-deleted decl's spot - // re-append to end of list so it can be cleaned up by `freeDecl` - try self.data.segments.append(self.base.allocator, old_decl); + // swap to-be-removed decl with newly added to create a contigious valid data segment + const items = self.data.segments.items; + std.mem.swap( + std.meta.Child(@TypeOf(items)), + &items[id], + &items[items.len - 1], + ); } }, - .Fn => if (self.getFuncidx(decl) == null) switch (tv.val.tag()) { + .Fn => if (self.getFuncidx(decl) == null) switch (typed_value.val.tag()) { // dependent on function type, appends it to the correct list .function => try self.funcs.append(self.base.allocator, decl), .extern_fn => try self.ext_funcs.append(self.base.allocator, decl), @@ -191,32 +197,26 @@ pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { } } -// TODO, remove this and use the existing error mechanism -const DataLenError = error{ - TODO_WASM_CalcDataLenArray, - TODO_WASM_CalcDataLen, -}; /// Calculates the length of the data segment that will be occupied by the given `TypedValue` -fn calcDataLen(bin_file: *Wasm, typed_value: TypedValue) DataLenError!u32 { +fn calcDataLen(self: *Wasm, typed_value: TypedValue) u32 { switch (typed_value.ty.zigTypeTag()) { .Array => { if (typed_value.val.castTag(.bytes)) |payload| { if (typed_value.ty.sentinel()) |sentinel| { - return @intCast(u32, payload.data.len) + try calcDataLen(bin_file, .{ + return @intCast(u32, payload.data.len) + self.calcDataLen(.{ .ty = typed_value.ty.elemType(), .val = sentinel, }); } - return @intCast(u32, payload.data.len); } - return error.TODO_WASM_CalcDataLenArray; + return @intCast(u32, typed_value.ty.arrayLen()); }, .Int => { - const info = typed_value.ty.intInfo(bin_file.base.options.target); - return info.bits / 8; + const info = typed_value.ty.intInfo(self.base.options.target); + return std.math.divCeil(u32, info.bits, 8) catch unreachable; }, .Pointer => return 4, - else => return error.TODO_WASM_CalcDataLen, + else => unreachable, } } @@ -256,7 +256,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { .Fn => { // as locals are patched afterwards, the offsets of funcidx's are off, // here we update them to correct them - for (decl.fn_link.wasm.idx_refs.items) |*func| { + for (fn_data.idx_refs.items) |*func| { // For each local, add 6 bytes (count + type) func.offset += @intCast(u32, context.locals.items.len * 6); } @@ -291,7 +291,7 @@ pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { else => unreachable, } } - if (self.data.idx(decl)) |idx| { + if (self.data.getIdx(decl)) |idx| { _ = self.data.segments.swapRemove(idx); } decl.fn_link.wasm.functype.deinit(self.base.allocator); @@ -314,6 +314,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { const file = self.base.file.?; const header_size = 5 + 1; + const data_size = self.data.size(); // No need to rewrite the magic/version header try file.setEndPos(@sizeOf(@TypeOf(wasm.magic ++ wasm.version))); @@ -384,7 +385,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { } // Memory section - if (self.data.size() != 0) { + if (data_size != 0) { const header_offset = try reserveVecSectionHeader(file); const writer = file.writer(); @@ -434,7 +435,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { } // export memory if size is not 0 - if (self.data.size() != 0) { + if (data_size != 0) { try leb.writeULEB128(writer, @intCast(u32, "memory".len)); try writer.writeAll("memory"); try writer.writeByte(wasm.externalKind(.memory)); @@ -483,7 +484,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { } // Data section - if (self.data.size() != 0) { + if (data_size != 0) { const header_offset = try reserveVecSectionHeader(file); const writer = file.writer(); var len: u32 = 0; @@ -496,7 +497,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { try writer.writeByte(wasm.opcode(.end)); // payload size - try leb.writeULEB128(writer, self.data.size()); + try leb.writeULEB128(writer, data_size); // write payload for (self.data.segments.items) |entry| try writer.writeAll(entry.data[0..entry.len]); From ff5774d93d9d952a74fab3666d4480f534c770db Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Thu, 8 Apr 2021 22:44:29 +0200 Subject: [PATCH 067/101] Refactor link/wasm.zig to use offset table This refactor inserts an offset table into wasm's data section where each offset points to the actual data region. This means we can keep offset indexes consistant and do not have to perform any computer to determine where in the data section something like a static string exists. Instead during runtime it will load the data offset onto the stack. --- lib/std/wasm.zig | 3 + src/Module.zig | 13 +- src/codegen/wasm.zig | 39 ++++- src/link.zig | 2 +- src/link/Wasm.zig | 361 +++++++++++++++++++++++-------------------- 5 files changed, 240 insertions(+), 178 deletions(-) diff --git a/lib/std/wasm.zig b/lib/std/wasm.zig index 89ab9b6e12..ad6b947f67 100644 --- a/lib/std/wasm.zig +++ b/lib/std/wasm.zig @@ -280,3 +280,6 @@ pub const block_empty: u8 = 0x40; // binary constants pub const magic = [_]u8{ 0x00, 0x61, 0x73, 0x6D }; // \0asm pub const version = [_]u8{ 0x01, 0x00, 0x00, 0x00 }; // version 1 + +// Each wasm page size is 64kB +pub const page_size = 64 * 1024; diff --git a/src/Module.zig b/src/Module.zig index 8360b3245b..346760728e 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -3029,9 +3029,12 @@ fn astgenAndSemaVarDecl( }; defer gen_scope.instructions.deinit(mod.gpa); - const init_result_loc: AstGen.ResultLoc = if (var_decl.ast.type_node != 0) .{ - .ty = try AstGen.expr(&gen_scope, &gen_scope.base, .{ .ty = .type_type }, var_decl.ast.type_node), - } else .none; + const init_result_loc: AstGen.ResultLoc = if (var_decl.ast.type_node != 0) + .{ + .ty = try AstGen.expr(&gen_scope, &gen_scope.base, .{ .ty = .type_type }, var_decl.ast.type_node), + } + else + .none; const init_inst = try AstGen.comptimeExpr( &gen_scope, @@ -3834,7 +3837,7 @@ fn allocateNewDecl( .elf => .{ .elf = link.File.Elf.TextBlock.empty }, .macho => .{ .macho = link.File.MachO.TextBlock.empty }, .c => .{ .c = link.File.C.DeclBlock.empty }, - .wasm => .{ .wasm = {} }, + .wasm => .{ .wasm = link.File.Wasm.DeclBlock.empty }, .spirv => .{ .spirv = {} }, }, .fn_link = switch (mod.comp.bin_file.tag) { @@ -3842,7 +3845,7 @@ fn allocateNewDecl( .elf => .{ .elf = link.File.Elf.SrcFn.empty }, .macho => .{ .macho = link.File.MachO.SrcFn.empty }, .c => .{ .c = link.File.C.FnBlock.empty }, - .wasm => .{ .wasm = .{} }, + .wasm => .{ .wasm = link.File.Wasm.FnData.empty }, .spirv => .{ .spirv = .{} }, }, .generation = 0, diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index a5069de956..400a5cd1a3 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -543,11 +543,20 @@ pub const Context = struct { /// Using a given `Type`, returns the corresponding wasm Valtype fn typeToValtype(self: *Context, src: LazySrcLoc, ty: Type) InnerError!wasm.Valtype { - return switch (ty.tag()) { - .f32 => .f32, - .f64 => .f64, - .u32, .i32, .bool => .i32, - .u64, .i64 => .i64, + return switch (ty.zigTypeTag()) { + .Float => blk: { + const bits = ty.floatBits(self.target); + if (bits == 16 or bits == 32) break :blk wasm.Valtype.f32; + if (bits == 64) break :blk wasm.Valtype.f64; + return self.fail(src, "Float bit size not supported by wasm: '{d}'", .{bits}); + }, + .Int => blk: { + const info = ty.intInfo(self.target); + if (info.bits <= 32) break :blk wasm.Valtype.i32; + if (info.bits > 32 and info.bits <= 64) break :blk wasm.Valtype.i64; + return self.fail(src, "Integer bit size not supported by wasm: '{d}'", .{info.bits}); + }, + .Bool, .Pointer => wasm.Valtype.i32, else => self.fail(src, "TODO - Wasm valtype for type '{s}'", .{ty.tag()}), }; } @@ -624,7 +633,7 @@ pub const Context = struct { const mod_fn = blk: { if (typed_value.val.castTag(.function)) |func| break :blk func.data; if (typed_value.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions - return self.fail(.{ .node_offset = 0 }, "TODO: Wasm codegen for decl type '{s}'", .{typed_value.ty.tag()}); + unreachable; }; // Reserve space to write the size after generating the code as well as space for locals count @@ -680,7 +689,7 @@ pub const Context = struct { } else return self.fail(.{ .node_offset = 0 }, "TODO implement gen for more kinds of arrays", .{}); }, .Int => { - const info = typed_value.ty.intInfo(self.bin_file.base.options.target); + const info = typed_value.ty.intInfo(self.target); if (info.bits == 8 and info.signedness == .unsigned) { const int_byte = typed_value.val.toUnsignedInt(); try self.code.append(@intCast(u8, int_byte)); @@ -856,6 +865,22 @@ pub const Context = struct { else => |bits| return self.fail(inst.base.src, "Wasm TODO: emitConstant for float with {d} bits", .{bits}), } }, + .Pointer => { + if (inst.val.castTag(.decl_ref)) |payload| { + const decl = payload.data; + + // offset into the offset table within the 'data' section + const ptr_width = self.target.cpu.arch.ptrBitWidth() / 8; + try writer.writeByte(wasm.opcode(.i32_const)); + try leb.writeULEB128(writer, decl.link.wasm.offset_index * ptr_width); + + // memory instruction followed by their memarg immediate + // memarg ::== x:u32, y:u32 => {align x, offset y} + try writer.writeByte(wasm.opcode(.i32_load)); + try leb.writeULEB128(writer, @as(u32, 0)); + try leb.writeULEB128(writer, @as(u32, 0)); + } else return self.fail(inst.base.src, "Wasm TODO: emitConstant for other const pointer tag {s}", .{inst.val.tag()}); + }, .Void => {}, else => |ty| return self.fail(inst.base.src, "Wasm TODO: emitConstant for zigTypeTag {s}", .{ty}), } diff --git a/src/link.zig b/src/link.zig index 162b55a0d0..c0f9a50b2b 100644 --- a/src/link.zig +++ b/src/link.zig @@ -138,7 +138,7 @@ pub const File = struct { coff: Coff.TextBlock, macho: MachO.TextBlock, c: C.DeclBlock, - wasm: void, + wasm: Wasm.DeclBlock, spirv: void, }; diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 5f878ca5ac..2186afb4a6 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -20,70 +20,7 @@ const TypedValue = @import("../TypedValue.zig"); pub const base_tag = link.File.Tag.wasm; -pub const FnData = struct { - /// Generated code for the type of the function - functype: std.ArrayListUnmanaged(u8) = .{}, - /// Generated code for the body of the function - code: std.ArrayListUnmanaged(u8) = .{}, - /// Locations in the generated code where function indexes must be filled in. - /// This must be kept ordered by offset. - idx_refs: std.ArrayListUnmanaged(struct { offset: u32, decl: *Module.Decl }) = .{}, -}; - -/// Data section of the wasm binary -/// Each declaration will have its own 'data_segment' within the section -/// where the offset is calculated using the previous segments and the content length -/// of the data -pub const DataSection = struct { - /// Every data object will be appended to this list, - /// containing its `Decl`, the data in bytes, and its length. - segments: std.ArrayListUnmanaged(struct { - /// The decl that lives inside the 'data' section such as an array - decl: *Module.Decl, - /// The contents of the data in bytes - data: [*]const u8, - /// The length of the contents inside the 'data' section - len: u32, - }) = .{}, - - /// Returns the offset into the data segment based on a given `Decl` - pub fn offset(self: DataSection, decl: *const Module.Decl) u32 { - var cur_offset: u32 = 0; - return for (self.segments.items) |entry| { - if (entry.decl == decl) break cur_offset; - cur_offset += entry.len; - } else unreachable; // offset() called on declaration that does not live inside 'data' section - } - - /// Returns the total payload size of the data section - pub fn size(self: DataSection) u32 { - var total: u32 = 0; - for (self.segments.items) |entry| { - total += entry.len; - } - return total; - } - - /// Updates the data in the data segment belonging to the given decl. - /// It's illegal behaviour to call this before allocateDeclIndexes was called - /// `data` must be managed externally with a lifetime that last as long as codegen does. - pub fn updateData(self: DataSection, decl: *Module.Decl, data: []const u8) void { - const entry = for (self.segments.items) |*item| { - if (item.decl == decl) break item; - } else unreachable; // called updateData before the declaration was added to data segments - entry.data = data.ptr; - } - - /// Returns the index of a declaration and `null` when not found - pub fn getIdx(self: DataSection, decl: *Module.Decl) ?usize { - return for (self.segments.items) |entry, i| { - if (entry.decl == decl) break i; - } else null; - } -}; - base: link.File, - /// List of all function Decls to be written to the output file. The index of /// each Decl in this list at the time of writing the binary is used as the /// function index. In the event where ext_funcs' size is not 0, the index of @@ -98,10 +35,67 @@ ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, /// to support existing code. /// TODO: Allow setting this through a flag? host_name: []const u8 = "env", -/// Map of declarations with its bytes payload, used to keep track of all data segments -/// that needs to be emit when creating the wasm binary. -/// The `DataSection`'s lifetime must be kept alive until the linking stage. -data: DataSection = .{}, +/// The last `DeclBlock` that was initialized will be saved here. +last_block: ?*DeclBlock = null, +/// Table with offsets, each element represents an offset with the value being +/// the offset into the 'data' section where the data lives +offset_table: std.ArrayListUnmanaged(u32) = .{}, +/// List of offset indexes which are free to be used for new decl's. +/// Each element's value points to an index into the offset_table. +offset_table_free_list: std.ArrayListUnmanaged(u32) = .{}, +/// List of all `Decl` that are currently alive. +/// This is ment for bookkeeping so we can safely cleanup all codegen memory +/// when calling `deinit` +symbols: std.ArrayListUnmanaged(*Module.Decl) = .{}, +/// Contains indexes into `symbols` that are no longer used and can be populated instead, +/// removing the need to search for a symbol and remove it when it's dereferenced. +symbols_free_list: std.ArrayListUnmanaged(u32) = .{}, + +pub const FnData = struct { + /// Generated code for the type of the function + functype: std.ArrayListUnmanaged(u8), + /// Generated code for the body of the function + code: std.ArrayListUnmanaged(u8), + /// Locations in the generated code where function indexes must be filled in. + /// This must be kept ordered by offset. + idx_refs: std.ArrayListUnmanaged(struct { offset: u32, decl: *Module.Decl }), + + pub const empty: FnData = .{ + .functype = .{}, + .code = .{}, + .idx_refs = .{}, + }; +}; + +pub const DeclBlock = struct { + /// Determines whether the `DeclBlock` has been initialized for codegen. + init: bool, + /// Index into the `symbols` list. + symbol_index: u32, + /// Index into the offset table + offset_index: u32, + /// The size of the block and how large part of the data section it occupies. + /// Will be 0 when the Decl will not live inside the data section and `data` will be undefined. + size: u32, + /// Points to the previous and next blocks. + /// Can be used to find the total size, and used to calculate the `offset` based on the previous block. + prev: ?*DeclBlock, + next: ?*DeclBlock, + /// Pointer to data that will be written to the 'data' section. + /// This data either lives in `FnData.code` or is externally managed. + /// For data that does not live inside the 'data' section, this field will be undefined. (size == 0). + data: [*]const u8, + + pub const empty: DeclBlock = .{ + .init = false, + .symbol_index = 0, + .offset_index = 0, + .size = 0, + .prev = null, + .next = null, + .data = undefined, + }; +}; pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Options) !*Wasm { assert(options.object_format == .wasm); @@ -137,94 +131,66 @@ pub fn createEmpty(gpa: *Allocator, options: link.Options) !*Wasm { } pub fn deinit(self: *Wasm) void { - for (self.funcs.items) |decl| { + while (self.symbols_free_list.popOrNull()) |idx| { + //dead decl's so remove them from symbol list before trying to clean them up + _ = self.symbols.swapRemove(idx); + } + for (self.symbols.items) |decl| { decl.fn_link.wasm.functype.deinit(self.base.allocator); decl.fn_link.wasm.code.deinit(self.base.allocator); decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); } - for (self.ext_funcs.items) |decl| { - decl.fn_link.wasm.functype.deinit(self.base.allocator); - decl.fn_link.wasm.code.deinit(self.base.allocator); - decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); - } - for (self.data.segments.items) |entry| { - // decl's that live in data section do not generate idx_refs or func types - entry.decl.fn_link.wasm.code.deinit(self.base.allocator); - } + self.funcs.deinit(self.base.allocator); self.ext_funcs.deinit(self.base.allocator); - self.data.segments.deinit(self.base.allocator); + self.offset_table.deinit(self.base.allocator); + self.offset_table_free_list.deinit(self.base.allocator); + self.symbols.deinit(self.base.allocator); + self.symbols_free_list.deinit(self.base.allocator); } pub fn allocateDeclIndexes(self: *Wasm, decl: *Module.Decl) !void { + if (decl.link.wasm.init) return; + + try self.offset_table.ensureCapacity(self.base.allocator, self.offset_table.items.len + 1); + try self.symbols.ensureCapacity(self.base.allocator, self.symbols.items.len + 1); + + const block = &decl.link.wasm; + block.init = true; + + if (self.symbols_free_list.popOrNull()) |index| { + block.symbol_index = index; + } else { + block.symbol_index = @intCast(u32, self.symbols.items.len); + _ = self.symbols.addOneAssumeCapacity(); + } + + if (self.offset_table_free_list.popOrNull()) |index| { + block.offset_index = index; + } else { + block.offset_index = @intCast(u32, self.offset_table.items.len); + _ = self.offset_table.addOneAssumeCapacity(); + } + + self.offset_table.items[block.offset_index] = 0; + const typed_value = decl.typed_value.most_recent.typed_value; - - switch (typed_value.ty.zigTypeTag()) { - .Array => { - // if the codegen of the given decl contributes to the data segment - // we must calculate its data length now so that the data offsets are available - // to other decls when called - const data_len = self.calcDataLen(typed_value); - try self.data.segments.append(self.base.allocator, .{ - .decl = decl, - .data = undefined, - .len = data_len, - }); - - // detect if we can replace it into a to-be-deleted decl's spot to ensure no gaps are - // made in our data segment - const idx: ?usize = for (self.data.segments.items) |entry, i| { - if (entry.decl.deletion_flag) break i; - } else null; - - if (idx) |id| { - // swap to-be-removed decl with newly added to create a contigious valid data segment - const items = self.data.segments.items; - std.mem.swap( - std.meta.Child(@TypeOf(items)), - &items[id], - &items[items.len - 1], - ); - } - }, - .Fn => if (self.getFuncidx(decl) == null) switch (typed_value.val.tag()) { + if (typed_value.ty.zigTypeTag() == .Fn) { + switch (typed_value.val.tag()) { // dependent on function type, appends it to the correct list .function => try self.funcs.append(self.base.allocator, decl), .extern_fn => try self.ext_funcs.append(self.base.allocator, decl), else => unreachable, - }, - else => {}, - } -} - -/// Calculates the length of the data segment that will be occupied by the given `TypedValue` -fn calcDataLen(self: *Wasm, typed_value: TypedValue) u32 { - switch (typed_value.ty.zigTypeTag()) { - .Array => { - if (typed_value.val.castTag(.bytes)) |payload| { - if (typed_value.ty.sentinel()) |sentinel| { - return @intCast(u32, payload.data.len) + self.calcDataLen(.{ - .ty = typed_value.ty.elemType(), - .val = sentinel, - }); - } - } - return @intCast(u32, typed_value.ty.arrayLen()); - }, - .Int => { - const info = typed_value.ty.intInfo(self.base.options.target); - return std.math.divCeil(u32, info.bits, 8) catch unreachable; - }, - .Pointer => return 4, - else => unreachable, + } } } // Generate code for the Decl, storing it in memory to be later written to // the file on flush(). pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { - const typed_value = decl.typed_value.most_recent.typed_value; + std.debug.assert(decl.link.wasm.init); // Must call allocateDeclIndexes() + const typed_value = decl.typed_value.most_recent.typed_value; const fn_data = &decl.fn_link.wasm; fn_data.functype.items.len = 0; fn_data.code.items.len = 0; @@ -252,28 +218,43 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { else => |e| return err, }; - switch (typed_value.ty.zigTypeTag()) { - .Fn => { - // as locals are patched afterwards, the offsets of funcidx's are off, - // here we update them to correct them - for (fn_data.idx_refs.items) |*func| { - // For each local, add 6 bytes (count + type) - func.offset += @intCast(u32, context.locals.items.len * 6); - } + const code: []const u8 = switch (result) { + .appended => @as([]const u8, context.code.items), + .externally_managed => |payload| payload, + }; - fn_data.functype = context.func_type_data.toUnmanaged(); - fn_data.code = context.code.toUnmanaged(); - }, - .Array => switch (result) { - .appended => { - fn_data.functype = context.func_type_data.toUnmanaged(); - fn_data.code = context.code.toUnmanaged(); - self.data.updateData(decl, fn_data.code.items); - }, - .externally_managed => |payload| self.data.updateData(decl, payload), - }, - else => return error.TODO, + fn_data.code = context.code.toUnmanaged(); + fn_data.functype = context.func_type_data.toUnmanaged(); + + const block = &decl.link.wasm; + if (typed_value.ty.zigTypeTag() == .Fn) { + // as locals are patched afterwards, the offsets of funcidx's are off, + // here we update them to correct them + for (fn_data.idx_refs.items) |*func| { + // For each local, add 6 bytes (count + type) + func.offset += @intCast(u32, context.locals.items.len * 6); + } + } else { + block.size = @intCast(u32, code.len); + block.data = code.ptr; } + + // If we're updating an existing decl, unplug it first + // to avoid infinite loops due to earlier links + if (block.prev) |prev| { + prev.next = block.next; + } + if (block.next) |next| { + next.prev = block.prev; + } + + if (self.last_block) |last| { + if (last != block) { + last.next = block; + block.prev = last; + } + } + self.last_block = block; } pub fn updateDeclExports( @@ -291,9 +272,24 @@ pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { else => unreachable, } } - if (self.data.getIdx(decl)) |idx| { - _ = self.data.segments.swapRemove(idx); + const block = &decl.link.wasm; + + if (self.last_block == block) { + self.last_block = block.prev; } + + if (block.prev) |prev| { + prev.next = block.next; + } + + if (block.next) |next| { + next.prev = block.prev; + } + + self.offset_table_free_list.append(self.base.allocator, decl.link.wasm.offset_index) catch {}; + self.symbols_free_list.append(self.base.allocator, decl.link.wasm.symbol_index) catch {}; + block.init = false; + decl.fn_link.wasm.functype.deinit(self.base.allocator); decl.fn_link.wasm.code.deinit(self.base.allocator); decl.fn_link.wasm.idx_refs.deinit(self.base.allocator); @@ -314,7 +310,25 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { const file = self.base.file.?; const header_size = 5 + 1; - const data_size = self.data.size(); + // ptr_width in bytes + const ptr_width = self.base.options.target.cpu.arch.ptrBitWidth() / 8; + // The size of the offset table in bytes + // The table contains all decl's with its corresponding offset into + // the 'data' section + const offset_table_size = @intCast(u32, self.offset_table.items.len * ptr_width); + + // The size of the data, this together with `offset_table_size` amounts to the + // total size of the 'data' section + var first_decl: ?*DeclBlock = null; + const data_size: u32 = if (self.last_block) |last| blk: { + var size = last.size; + var cur = last; + while (cur.prev) |prev| : (cur = prev) { + size += prev.size; + } + first_decl = cur; + break :blk size; + } else 0; // No need to rewrite the magic/version header try file.setEndPos(@sizeOf(@TypeOf(wasm.magic ++ wasm.version))); @@ -396,8 +410,8 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { writer, try std.math.divCeil( u32, - self.data.size(), - std.mem.page_size, + offset_table_size + data_size, + std.wasm.page_size, ), ); try writeVecSectionHeader( @@ -496,18 +510,35 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void { try leb.writeILEB128(writer, @as(i32, 0)); try writer.writeByte(wasm.opcode(.end)); - // payload size - try leb.writeULEB128(writer, data_size); + const total_size = offset_table_size + data_size; - // write payload - for (self.data.segments.items) |entry| try writer.writeAll(entry.data[0..entry.len]); + // offset table + data size + try leb.writeULEB128(writer, total_size); + // fill in the offset table and the data segments + const file_offset = try file.getPos(); + var cur = first_decl; + var data_offset = offset_table_size; + while (cur) |cur_block| : (cur = cur_block.next) { + if (cur_block.size == 0) continue; + std.debug.assert(cur_block.init); + + const offset = (cur_block.offset_index) * ptr_width; + var buf: [4]u8 = undefined; + std.mem.writeIntLittle(u32, &buf, data_offset); + + try file.pwriteAll(&buf, file_offset + offset); + try file.pwriteAll(cur_block.data[0..cur_block.size], file_offset + data_offset); + data_offset += cur_block.size; + } + + try file.seekTo(file_offset + data_offset); try writeVecSectionHeader( file, header_offset, .data, - @intCast(u32, (try file.getPos()) - header_offset - header_size), - @intCast(u32, 1), + @intCast(u32, (file_offset + data_offset) - header_offset - header_size), + @intCast(u32, 1), // only 1 data section ); } } From c28d1fe1733eb150f956b1eb0d01d79496e7378c Mon Sep 17 00:00:00 2001 From: xackus <14938807+xackus@users.noreply.github.com> Date: Thu, 8 Apr 2021 22:38:48 +0200 Subject: [PATCH 068/101] std docs: fix layout broken by the banner --- lib/std/special/docs/index.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/std/special/docs/index.html b/lib/std/special/docs/index.html index 98f1938cc6..61e3bb4ed2 100644 --- a/lib/std/special/docs/index.html +++ b/lib/std/special/docs/index.html @@ -43,6 +43,8 @@ /* layout */ .canvas { + display: flex; + flex-direction: column; width: 100vw; height: 100vh; overflow: hidden; @@ -53,12 +55,21 @@ background-color: var(--bg-color); } + .banner { + background-color: darkred; + text-align: center; + color: white; + padding: 15px 5px; + } + + .banner a { + color: bisque; + text-decoration: underline; + } + .flex-main { display: flex; - width: 100%; - height: 100%; - justify-content: center; - + overflow-y: hidden; z-index: 100; } @@ -515,7 +526,7 @@ - +