| author | |
| committer | |
| log | 185cb1327806f073b91218ff2fd6f21d95060c00 |
| tree | 2b1ad839768962626689df3abd1434b59f43d96f |
| parent | 058050f22c5c72507cae57f27e83b2ad2e9afec3 |
| parent | ba4d83af3e58ce2a34ccb945a297211333fd904c |
| signature | Commit is signed but in an unrecognized format. |
171 files changed, 6231 insertions(+), 2802 deletions(-)
CMakeLists.txt+21-7| ... | ... | @@ -23,14 +23,18 @@ find_program(GIT_EXE NAMES git) |
| 23 | 23 | if(GIT_EXE) |
| 24 | 24 | execute_process( |
| 25 | 25 | COMMAND ${GIT_EXE} -C ${CMAKE_SOURCE_DIR} name-rev HEAD --tags --name-only --no-undefined --always |
| 26 | RESULT_VARIABLE EXIT_STATUS | |
| 26 | 27 | OUTPUT_VARIABLE ZIG_GIT_REV |
| 27 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
| 28 | if(ZIG_GIT_REV MATCHES "\\^0$") | |
| 29 | if(NOT("${ZIG_GIT_REV}" STREQUAL "${ZIG_VERSION}^0")) | |
| 30 | message("WARNING: Tag does not match configured Zig version") | |
| 28 | OUTPUT_STRIP_TRAILING_WHITESPACE | |
| 29 | ERROR_QUIET) | |
| 30 | if(EXIT_STATUS EQUAL "0") | |
| 31 | if(ZIG_GIT_REV MATCHES "\\^0$") | |
| 32 | if(NOT("${ZIG_GIT_REV}" STREQUAL "${ZIG_VERSION}^0")) | |
| 33 | message("WARNING: Tag does not match configured Zig version") | |
| 34 | endif() | |
| 35 | else() | |
| 36 | set(ZIG_VERSION "${ZIG_VERSION}+${ZIG_GIT_REV}") | |
| 31 | 37 | endif() |
| 32 | else() | |
| 33 | set(ZIG_VERSION "${ZIG_VERSION}+${ZIG_GIT_REV}") | |
| 34 | 38 | endif() |
| 35 | 39 | endif() |
| 36 | 40 | message("Configuring zig version ${ZIG_VERSION}") |
| ... | ... | @@ -448,6 +452,7 @@ set(ZIG_SOURCES |
| 448 | 452 | "${CMAKE_SOURCE_DIR}/src/os.cpp" |
| 449 | 453 | "${CMAKE_SOURCE_DIR}/src/parser.cpp" |
| 450 | 454 | "${CMAKE_SOURCE_DIR}/src/range_set.cpp" |
| 455 | "${CMAKE_SOURCE_DIR}/src/stack_report.cpp" | |
| 451 | 456 | "${CMAKE_SOURCE_DIR}/src/target.cpp" |
| 452 | 457 | "${CMAKE_SOURCE_DIR}/src/tokenizer.cpp" |
| 453 | 458 | "${CMAKE_SOURCE_DIR}/src/translate_c.cpp" |
| ... | ... | @@ -504,7 +509,7 @@ endif() |
| 504 | 509 | if(MSVC) |
| 505 | 510 | set(EXE_CFLAGS "${EXE_CFLAGS}") |
| 506 | 511 | else() |
| 507 | set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces") | |
| 512 | set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces") | |
| 508 | 513 | if(MINGW) |
| 509 | 514 | set(EXE_CFLAGS "${EXE_CFLAGS} -Wno-format") |
| 510 | 515 | endif() |
| ... | ... | @@ -515,6 +520,9 @@ set(OPTIMIZED_C_FLAGS "-std=c99 -O3") |
| 515 | 520 | set(EXE_LDFLAGS " ") |
| 516 | 521 | if(MSVC) |
| 517 | 522 | set(EXE_LDFLAGS "${EXE_LDFLAGS} /STACK:16777216") |
| 523 | if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") | |
| 524 | set(EXE_LDFLAGS "${EXE_LDFLAGS} /debug:fastlink") | |
| 525 | endif() | |
| 518 | 526 | elseif(MINGW) |
| 519 | 527 | set(EXE_LDFLAGS "${EXE_LDFLAGS} -Wl,--stack,16777216") |
| 520 | 528 | endif() |
| ... | ... | @@ -586,12 +594,18 @@ if(MSVC) |
| 586 | 594 | else() |
| 587 | 595 | set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a") |
| 588 | 596 | endif() |
| 597 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | |
| 598 | set(LIBUSERLAND_RELEASE_MODE "false") | |
| 599 | else() | |
| 600 | set(LIBUSERLAND_RELEASE_MODE "true") | |
| 601 | endif() | |
| 589 | 602 | add_custom_target(zig_build_libuserland ALL |
| 590 | 603 | COMMAND zig0 build |
| 591 | 604 | --override-std-dir std |
| 592 | 605 | --override-lib-dir "${CMAKE_SOURCE_DIR}" |
| 593 | 606 | libuserland install |
| 594 | 607 | "-Doutput-dir=${CMAKE_BINARY_DIR}" |
| 608 | "-Drelease=${LIBUSERLAND_RELEASE_MODE}" | |
| 595 | 609 | "-Dlib-files-only" |
| 596 | 610 | --prefix "${CMAKE_INSTALL_PREFIX}" |
| 597 | 611 | DEPENDS zig0 |
build.zig+8-3| ... | ... | @@ -63,7 +63,7 @@ pub fn build(b: *Builder) !void { |
| 63 | 63 | try configureStage2(b, test_stage2, ctx); |
| 64 | 64 | try configureStage2(b, exe, ctx); |
| 65 | 65 | |
| 66 | addLibUserlandStep(b); | |
| 66 | addLibUserlandStep(b, mode); | |
| 67 | 67 | |
| 68 | 68 | const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false; |
| 69 | 69 | const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release; |
| ... | ... | @@ -138,12 +138,13 @@ pub fn build(b: *Builder) !void { |
| 138 | 138 | |
| 139 | 139 | test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes)); |
| 140 | 140 | test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes)); |
| 141 | test_step.dependOn(tests.addStackTraceTests(b, test_filter, modes)); | |
| 141 | 142 | test_step.dependOn(tests.addCliTests(b, test_filter, modes)); |
| 142 | test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes)); | |
| 143 | 143 | test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes)); |
| 144 | 144 | test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes)); |
| 145 | 145 | test_step.dependOn(tests.addTranslateCTests(b, test_filter)); |
| 146 | 146 | test_step.dependOn(tests.addGenHTests(b, test_filter)); |
| 147 | test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes)); | |
| 147 | 148 | test_step.dependOn(docs_step); |
| 148 | 149 | } |
| 149 | 150 | |
| ... | ... | @@ -369,11 +370,15 @@ const Context = struct { |
| 369 | 370 | llvm: LibraryDep, |
| 370 | 371 | }; |
| 371 | 372 | |
| 372 | fn addLibUserlandStep(b: *Builder) void { | |
| 373 | fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void { | |
| 373 | 374 | const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig"); |
| 374 | 375 | artifact.disable_gen_h = true; |
| 375 | 376 | artifact.bundle_compiler_rt = true; |
| 376 | 377 | artifact.setTarget(builtin.arch, builtin.os, builtin.abi); |
| 378 | artifact.setBuildMode(mode); | |
| 379 | if (mode != .Debug) { | |
| 380 | artifact.strip = true; | |
| 381 | } | |
| 377 | 382 | artifact.linkSystemLibrary("c"); |
| 378 | 383 | if (builtin.os == .windows) { |
| 379 | 384 | artifact.linkSystemLibrary("ntdll"); |
doc/docgen.zig+28-4| ... | ... | @@ -307,7 +307,7 @@ const Node = union(enum) { |
| 307 | 307 | const Toc = struct { |
| 308 | 308 | nodes: []Node, |
| 309 | 309 | toc: []u8, |
| 310 | urls: std.HashMap([]const u8, Token, mem.hash_slice_u8, mem.eql_slice_u8), | |
| 310 | urls: std.StringHashMap(Token), | |
| 311 | 311 | }; |
| 312 | 312 | |
| 313 | 313 | const Action = enum { |
| ... | ... | @@ -316,11 +316,12 @@ const Action = enum { |
| 316 | 316 | }; |
| 317 | 317 | |
| 318 | 318 | fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 319 | var urls = std.HashMap([]const u8, Token, mem.hash_slice_u8, mem.eql_slice_u8).init(allocator); | |
| 319 | var urls = std.StringHashMap(Token).init(allocator); | |
| 320 | 320 | errdefer urls.deinit(); |
| 321 | 321 | |
| 322 | 322 | var header_stack_size: usize = 0; |
| 323 | 323 | var last_action = Action.Open; |
| 324 | var last_columns: ?u8 = null; | |
| 324 | 325 | |
| 325 | 326 | var toc_buf = try std.Buffer.initSize(allocator, 0); |
| 326 | 327 | defer toc_buf.deinit(); |
| ... | ... | @@ -361,7 +362,23 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 361 | 362 | _ = try eatToken(tokenizer, Token.Id.Separator); |
| 362 | 363 | const content_token = try eatToken(tokenizer, Token.Id.TagContent); |
| 363 | 364 | const content = tokenizer.buffer[content_token.start..content_token.end]; |
| 364 | _ = try eatToken(tokenizer, Token.Id.BracketClose); | |
| 365 | var columns: ?u8 = null; | |
| 366 | while (true) { | |
| 367 | const bracket_tok = tokenizer.next(); | |
| 368 | switch (bracket_tok.id) { | |
| 369 | .BracketClose => break, | |
| 370 | .Separator => continue, | |
| 371 | .TagContent => { | |
| 372 | const param = tokenizer.buffer[bracket_tok.start..bracket_tok.end]; | |
| 373 | if (mem.eql(u8, param, "3col")) { | |
| 374 | columns = 3; | |
| 375 | } else { | |
| 376 | return parseError(tokenizer, bracket_tok, "unrecognized header_open param: {}", param); | |
| 377 | } | |
| 378 | }, | |
| 379 | else => return parseError(tokenizer, bracket_tok, "invalid header_open token"), | |
| 380 | } | |
| 381 | } | |
| 365 | 382 | |
| 366 | 383 | header_stack_size += 1; |
| 367 | 384 | |
| ... | ... | @@ -381,10 +398,15 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 381 | 398 | if (last_action == Action.Open) { |
| 382 | 399 | try toc.writeByte('\n'); |
| 383 | 400 | try toc.writeByteNTimes(' ', header_stack_size * 4); |
| 384 | try toc.write("<ul>\n"); | |
| 401 | if (last_columns) |n| { | |
| 402 | try toc.print("<ul style=\"columns: {}\">\n", n); | |
| 403 | } else { | |
| 404 | try toc.write("<ul>\n"); | |
| 405 | } | |
| 385 | 406 | } else { |
| 386 | 407 | last_action = Action.Open; |
| 387 | 408 | } |
| 409 | last_columns = columns; | |
| 388 | 410 | try toc.writeByteNTimes(' ', 4 + header_stack_size * 4); |
| 389 | 411 | try toc.print("<li><a id=\"toc-{}\" href=\"#{}\">{}</a>", urlized, urlized, content); |
| 390 | 412 | } else if (mem.eql(u8, tag_name, "header_close")) { |
| ... | ... | @@ -766,6 +788,8 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 766 | 788 | .Keyword_inline, |
| 767 | 789 | .Keyword_nakedcc, |
| 768 | 790 | .Keyword_noalias, |
| 791 | .Keyword_noasync, | |
| 792 | .Keyword_noinline, | |
| 769 | 793 | .Keyword_or, |
| 770 | 794 | .Keyword_orelse, |
| 771 | 795 | .Keyword_packed, |
doc/langref.html.in+76-4| ... | ... | @@ -6323,7 +6323,7 @@ fn readFile(allocator: *Allocator, filename: []const u8) ![]u8 { |
| 6323 | 6323 | {#header_close#} |
| 6324 | 6324 | |
| 6325 | 6325 | {#header_close#} |
| 6326 | {#header_open|Builtin Functions#} | |
| 6326 | {#header_open|Builtin Functions|3col#} | |
| 6327 | 6327 | <p> |
| 6328 | 6328 | Builtin functions are provided by the compiler and are prefixed with <code>@</code>. |
| 6329 | 6329 | The {#syntax#}comptime{#endsyntax#} keyword on a parameter means that the parameter must be known |
| ... | ... | @@ -6976,10 +6976,28 @@ export fn @"A function name that is a complete sentence."() void {} |
| 6976 | 6976 | |
| 6977 | 6977 | {#header_open|@field#} |
| 6978 | 6978 | <pre>{#syntax#}@field(lhs: var, comptime field_name: []const u8) (field){#endsyntax#}</pre> |
| 6979 | <p>Preforms field access equivalent to {#syntax#}lhs.field_name{#endsyntax#}, except instead | |
| 6980 | of the field {#syntax#}"field_name"{#endsyntax#}, it accesses the field named by the string | |
| 6981 | value of {#syntax#}field_name{#endsyntax#}. | |
| 6979 | <p>Performs field access by a compile-time string. | |
| 6982 | 6980 | </p> |
| 6981 | {#code_begin|test#} | |
| 6982 | const std = @import("std"); | |
| 6983 | ||
| 6984 | const Point = struct { | |
| 6985 | x: u32, | |
| 6986 | y: u32 | |
| 6987 | }; | |
| 6988 | ||
| 6989 | test "field access by string" { | |
| 6990 | const assert = std.debug.assert; | |
| 6991 | var p = Point {.x = 0, .y = 0}; | |
| 6992 | ||
| 6993 | @field(p, "x") = 4; | |
| 6994 | @field(p, "y") = @field(p, "x") + 1; | |
| 6995 | ||
| 6996 | assert(@field(p, "x") == 4); | |
| 6997 | assert(@field(p, "y") == 5); | |
| 6998 | } | |
| 6999 | {#code_end#} | |
| 7000 | ||
| 6983 | 7001 | {#header_close#} |
| 6984 | 7002 | |
| 6985 | 7003 | {#header_open|@fieldParentPtr#} |
| ... | ... | @@ -7232,6 +7250,9 @@ fn add(a: i32, b: i32) i32 { return a + b; } |
| 7232 | 7250 | This function returns an integer type with the given signness and bit count. The maximum |
| 7233 | 7251 | bit count for an integer type is {#syntax#}65535{#endsyntax#}. |
| 7234 | 7252 | </p> |
| 7253 | <p> | |
| 7254 | Deprecated. Use {#link|@Type#}. | |
| 7255 | </p> | |
| 7235 | 7256 | {#header_close#} |
| 7236 | 7257 | |
| 7237 | 7258 | {#header_open|@memberCount#} |
| ... | ... | @@ -7871,6 +7892,57 @@ test "integer truncation" { |
| 7871 | 7892 | </p> |
| 7872 | 7893 | {#header_close#} |
| 7873 | 7894 | |
| 7895 | {#header_open|@Type#} | |
| 7896 | <pre>{#syntax#}@Type(comptime info: @import("builtin").TypeInfo) type{#endsyntax#}</pre> | |
| 7897 | <p> | |
| 7898 | This function is the inverse of {#link|@typeInfo#}. It reifies type information | |
| 7899 | into a {#syntax#}type{#endsyntax#}. | |
| 7900 | </p> | |
| 7901 | <p> | |
| 7902 | It is available for the following types: | |
| 7903 | </p> | |
| 7904 | <ul> | |
| 7905 | <li>{#syntax#}type{#endsyntax#}</li> | |
| 7906 | <li>{#syntax#}noreturn{#endsyntax#}</li> | |
| 7907 | <li>{#syntax#}void{#endsyntax#}</li> | |
| 7908 | <li>{#syntax#}bool{#endsyntax#}</li> | |
| 7909 | <li>{#link|Integers#}</li> - The maximum bit count for an integer type is {#syntax#}65535{#endsyntax#}. | |
| 7910 | <li>{#link|Floats#}</li> | |
| 7911 | <li>{#link|Pointers#}</li> | |
| 7912 | <li>{#syntax#}comptime_int{#endsyntax#}</li> | |
| 7913 | <li>{#syntax#}comptime_float{#endsyntax#}</li> | |
| 7914 | <li>{#syntax#}@typeOf(undefined){#endsyntax#}</li> | |
| 7915 | <li>{#syntax#}@typeOf(null){#endsyntax#}</li> | |
| 7916 | </ul> | |
| 7917 | <p> | |
| 7918 | For these types it is a | |
| 7919 | <a href="https://github.com/ziglang/zig/issues/2907">TODO in the compiler to implement</a>: | |
| 7920 | </p> | |
| 7921 | <ul> | |
| 7922 | <li>Array</li> | |
| 7923 | <li>Optional</li> | |
| 7924 | <li>ErrorUnion</li> | |
| 7925 | <li>ErrorSet</li> | |
| 7926 | <li>Enum</li> | |
| 7927 | <li>Opaque</li> | |
| 7928 | <li>FnFrame</li> | |
| 7929 | <li>AnyFrame</li> | |
| 7930 | <li>Vector</li> | |
| 7931 | <li>EnumLiteral</li> | |
| 7932 | </ul> | |
| 7933 | <p> | |
| 7934 | For these types, {#syntax#}@Type{#endsyntax#} is not available. | |
| 7935 | <a href="https://github.com/ziglang/zig/issues/383">There is an open proposal to allow unions and structs</a>. | |
| 7936 | </p> | |
| 7937 | <ul> | |
| 7938 | <li>{#link|union#}</li> | |
| 7939 | <li>{#link|Functions#}</li> | |
| 7940 | <li>BoundFn</li> | |
| 7941 | <li>ArgTuple</li> | |
| 7942 | <li>{#link|struct#}</li> | |
| 7943 | </ul> | |
| 7944 | {#header_close#} | |
| 7945 | ||
| 7874 | 7946 | {#header_open|@typeId#} |
| 7875 | 7947 | <pre>{#syntax#}@typeId(comptime T: type) @import("builtin").TypeId{#endsyntax#}</pre> |
| 7876 | 7948 | <p> |
lib/libc/glibc/abi.txt+330| ... | ... | @@ -514,6 +514,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 514 | 514 | 29 |
| 515 | 515 | 29 |
| 516 | 516 | 29 |
| 517 | ||
| 517 | 518 | 29 |
| 518 | 519 | |
| 519 | 520 | 29 |
| ... | ... | @@ -655,6 +656,18 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 655 | 656 | |
| 656 | 657 | |
| 657 | 658 | |
| 659 | ||
| 660 | ||
| 661 | ||
| 662 | ||
| 663 | ||
| 664 | ||
| 665 | ||
| 666 | ||
| 667 | ||
| 668 | ||
| 669 | ||
| 670 | ||
| 658 | 671 | |
| 659 | 672 | |
| 660 | 673 | |
| ... | ... | @@ -1928,6 +1941,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 1928 | 1941 | 29 |
| 1929 | 1942 | 29 |
| 1930 | 1943 | 29 |
| 1944 | 40 | |
| 1931 | 1945 | 29 |
| 1932 | 1946 | 29 |
| 1933 | 1947 | 29 |
| ... | ... | @@ -2048,6 +2062,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 2048 | 2062 | 29 |
| 2049 | 2063 | 29 |
| 2050 | 2064 | 29 |
| 2065 | 40 | |
| 2051 | 2066 | 29 |
| 2052 | 2067 | 29 |
| 2053 | 2068 | 29 |
| ... | ... | @@ -2721,6 +2736,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 2721 | 2736 | 29 |
| 2722 | 2737 | 29 |
| 2723 | 2738 | 29 |
| 2739 | 40 | |
| 2724 | 2740 | 29 |
| 2725 | 2741 | 29 |
| 2726 | 2742 | 29 |
| ... | ... | @@ -2749,6 +2765,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 2749 | 2765 | 29 |
| 2750 | 2766 | 29 |
| 2751 | 2767 | 29 |
| 2768 | 40 | |
| 2752 | 2769 | 29 |
| 2753 | 2770 | 29 |
| 2754 | 2771 | 29 |
| ... | ... | @@ -2776,6 +2793,8 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 2776 | 2793 | 29 |
| 2777 | 2794 | 29 |
| 2778 | 2795 | 29 |
| 2796 | 40 | |
| 2797 | 40 | |
| 2779 | 2798 | 29 |
| 2780 | 2799 | 29 |
| 2781 | 2800 | 29 |
| ... | ... | @@ -3002,6 +3021,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 3002 | 3021 | 29 |
| 3003 | 3022 | 29 |
| 3004 | 3023 | 29 |
| 3024 | 40 | |
| 3005 | 3025 | 29 |
| 3006 | 3026 | 29 |
| 3007 | 3027 | 29 |
| ... | ... | @@ -3370,6 +3390,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 3370 | 3390 | 37 |
| 3371 | 3391 | 37 |
| 3372 | 3392 | 29 |
| 3393 | 40 | |
| 3373 | 3394 | 38 |
| 3374 | 3395 | 38 |
| 3375 | 3396 | 38 |
| ... | ... | @@ -3443,6 +3464,7 @@ aarch64-linux-gnu aarch64_be-linux-gnu |
| 3443 | 3464 | 29 |
| 3444 | 3465 | 29 |
| 3445 | 3466 | 29 |
| 3467 | 40 | |
| 3446 | 3468 | 29 |
| 3447 | 3469 | 29 |
| 3448 | 3470 | 29 |
| ... | ... | @@ -4218,6 +4240,7 @@ s390x-linux-gnu |
| 4218 | 4240 | 5 |
| 4219 | 4241 | 5 |
| 4220 | 4242 | 5 |
| 4243 | ||
| 4221 | 4244 | 27 |
| 4222 | 4245 | |
| 4223 | 4246 | 27 |
| ... | ... | @@ -4330,12 +4353,18 @@ s390x-linux-gnu |
| 4330 | 4353 | 16 |
| 4331 | 4354 | 16 |
| 4332 | 4355 | 16 |
| 4356 | 40 | |
| 4357 | 40 | |
| 4333 | 4358 | 16 |
| 4334 | 4359 | 38 |
| 4335 | 4360 | 38 |
| 4336 | 4361 | 38 |
| 4337 | 4362 | 16 |
| 4338 | 4363 | 38 |
| 4364 | 40 | |
| 4365 | 40 | |
| 4366 | 40 | |
| 4367 | 40 | |
| 4339 | 4368 | 16 |
| 4340 | 4369 | 16 |
| 4341 | 4370 | 16 |
| ... | ... | @@ -4356,6 +4385,8 @@ s390x-linux-gnu |
| 4356 | 4385 | 16 |
| 4357 | 4386 | 16 |
| 4358 | 4387 | 16 |
| 4388 | 40 | |
| 4389 | 40 | |
| 4359 | 4390 | 16 |
| 4360 | 4391 | 16 |
| 4361 | 4392 | 16 |
| ... | ... | @@ -4368,8 +4399,12 @@ s390x-linux-gnu |
| 4368 | 4399 | 16 |
| 4369 | 4400 | 16 |
| 4370 | 4401 | 16 |
| 4402 | 40 | |
| 4403 | 40 | |
| 4371 | 4404 | 16 |
| 4372 | 4405 | 16 |
| 4406 | 40 | |
| 4407 | 40 | |
| 4373 | 4408 | 16 |
| 4374 | 4409 | 16 |
| 4375 | 4410 | 5 |
| ... | ... | @@ -5632,6 +5667,7 @@ s390x-linux-gnu |
| 5632 | 5667 | 5 |
| 5633 | 5668 | 5 |
| 5634 | 5669 | 5 |
| 5670 | 40 | |
| 5635 | 5671 | 5 |
| 5636 | 5672 | 5 |
| 5637 | 5673 | 5 |
| ... | ... | @@ -5752,6 +5788,7 @@ s390x-linux-gnu |
| 5752 | 5788 | 5 |
| 5753 | 5789 | 5 |
| 5754 | 5790 | 5 |
| 5791 | 40 | |
| 5755 | 5792 | 5 |
| 5756 | 5793 | 5 |
| 5757 | 5794 | 5 |
| ... | ... | @@ -6425,6 +6462,7 @@ s390x-linux-gnu |
| 6425 | 6462 | 5 |
| 6426 | 6463 | 5 |
| 6427 | 6464 | 5 13 |
| 6465 | 40 | |
| 6428 | 6466 | 5 13 |
| 6429 | 6467 | 5 13 |
| 6430 | 6468 | 5 13 |
| ... | ... | @@ -6453,6 +6491,7 @@ s390x-linux-gnu |
| 6453 | 6491 | 5 |
| 6454 | 6492 | 5 |
| 6455 | 6493 | 5 |
| 6494 | 40 | |
| 6456 | 6495 | 24 |
| 6457 | 6496 | 16 |
| 6458 | 6497 | 5 |
| ... | ... | @@ -6480,6 +6519,8 @@ s390x-linux-gnu |
| 6480 | 6519 | 16 |
| 6481 | 6520 | 5 |
| 6482 | 6521 | 5 |
| 6522 | 40 | |
| 6523 | 40 | |
| 6483 | 6524 | 5 |
| 6484 | 6525 | 5 |
| 6485 | 6526 | 5 |
| ... | ... | @@ -6706,6 +6747,7 @@ s390x-linux-gnu |
| 6706 | 6747 | 5 |
| 6707 | 6748 | 5 |
| 6708 | 6749 | 5 |
| 6750 | 40 | |
| 6709 | 6751 | 5 |
| 6710 | 6752 | 5 |
| 6711 | 6753 | 5 |
| ... | ... | @@ -7074,6 +7116,7 @@ s390x-linux-gnu |
| 7074 | 7116 | 37 |
| 7075 | 7117 | 37 |
| 7076 | 7118 | 5 16 |
| 7119 | 40 | |
| 7077 | 7120 | 38 |
| 7078 | 7121 | 38 |
| 7079 | 7122 | 38 |
| ... | ... | @@ -7147,6 +7190,7 @@ s390x-linux-gnu |
| 7147 | 7190 | 5 |
| 7148 | 7191 | 5 |
| 7149 | 7192 | 5 |
| 7193 | 40 | |
| 7150 | 7194 | 5 |
| 7151 | 7195 | 5 |
| 7152 | 7196 | 5 |
| ... | ... | @@ -7922,6 +7966,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 7922 | 7966 | 16 |
| 7923 | 7967 | 16 |
| 7924 | 7968 | 16 |
| 7969 | ||
| 7925 | 7970 | 27 |
| 7926 | 7971 | |
| 7927 | 7972 | 27 |
| ... | ... | @@ -8063,6 +8108,18 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 8063 | 8108 | |
| 8064 | 8109 | |
| 8065 | 8110 | |
| 8111 | ||
| 8112 | ||
| 8113 | ||
| 8114 | ||
| 8115 | ||
| 8116 | ||
| 8117 | ||
| 8118 | ||
| 8119 | ||
| 8120 | ||
| 8121 | ||
| 8122 | ||
| 8066 | 8123 | |
| 8067 | 8124 | |
| 8068 | 8125 | |
| ... | ... | @@ -9336,6 +9393,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 9336 | 9393 | 16 |
| 9337 | 9394 | 16 |
| 9338 | 9395 | 16 |
| 9396 | 40 | |
| 9339 | 9397 | 16 |
| 9340 | 9398 | 16 |
| 9341 | 9399 | 16 |
| ... | ... | @@ -9456,6 +9514,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 9456 | 9514 | 16 |
| 9457 | 9515 | 16 |
| 9458 | 9516 | 16 |
| 9517 | 40 | |
| 9459 | 9518 | 16 |
| 9460 | 9519 | 16 |
| 9461 | 9520 | 16 |
| ... | ... | @@ -10129,6 +10188,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10129 | 10188 | 16 |
| 10130 | 10189 | 16 |
| 10131 | 10190 | 16 |
| 10191 | 40 | |
| 10132 | 10192 | 16 |
| 10133 | 10193 | 16 |
| 10134 | 10194 | 16 |
| ... | ... | @@ -10157,6 +10217,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10157 | 10217 | 16 |
| 10158 | 10218 | 16 |
| 10159 | 10219 | 16 |
| 10220 | 40 | |
| 10160 | 10221 | 24 |
| 10161 | 10222 | 16 |
| 10162 | 10223 | 16 |
| ... | ... | @@ -10184,6 +10245,8 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10184 | 10245 | 16 |
| 10185 | 10246 | 16 |
| 10186 | 10247 | 16 |
| 10248 | 40 | |
| 10249 | 40 | |
| 10187 | 10250 | 16 |
| 10188 | 10251 | 16 |
| 10189 | 10252 | 16 |
| ... | ... | @@ -10410,6 +10473,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10410 | 10473 | 16 |
| 10411 | 10474 | 16 |
| 10412 | 10475 | 16 |
| 10476 | 40 | |
| 10413 | 10477 | 16 |
| 10414 | 10478 | 16 |
| 10415 | 10479 | 16 |
| ... | ... | @@ -10778,6 +10842,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10778 | 10842 | 37 |
| 10779 | 10843 | |
| 10780 | 10844 | 16 |
| 10845 | 40 | |
| 10781 | 10846 | 38 |
| 10782 | 10847 | 38 |
| 10783 | 10848 | 38 |
| ... | ... | @@ -10851,6 +10916,7 @@ arm-linux-gnueabi armeb-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf |
| 10851 | 10916 | 16 |
| 10852 | 10917 | 16 |
| 10853 | 10918 | 16 |
| 10919 | 40 | |
| 10854 | 10920 | 16 |
| 10855 | 10921 | 16 |
| 10856 | 10922 | 16 |
| ... | ... | @@ -11626,6 +11692,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 11626 | 11692 | 1 |
| 11627 | 11693 | 0 |
| 11628 | 11694 | 0 |
| 11695 | 3 | |
| 11629 | 11696 | 27 |
| 11630 | 11697 | |
| 11631 | 11698 | 27 |
| ... | ... | @@ -11738,12 +11805,18 @@ sparc-linux-gnu sparcel-linux-gnu |
| 11738 | 11805 | 16 |
| 11739 | 11806 | 16 |
| 11740 | 11807 | 16 |
| 11808 | 40 | |
| 11809 | 40 | |
| 11741 | 11810 | 16 |
| 11742 | 11811 | 38 |
| 11743 | 11812 | 38 |
| 11744 | 11813 | 38 |
| 11745 | 11814 | 16 |
| 11746 | 11815 | 38 |
| 11816 | 40 | |
| 11817 | 40 | |
| 11818 | 40 | |
| 11819 | 40 | |
| 11747 | 11820 | 16 |
| 11748 | 11821 | 16 |
| 11749 | 11822 | 16 |
| ... | ... | @@ -11764,6 +11837,8 @@ sparc-linux-gnu sparcel-linux-gnu |
| 11764 | 11837 | 16 |
| 11765 | 11838 | 16 |
| 11766 | 11839 | 16 |
| 11840 | 40 | |
| 11841 | 40 | |
| 11767 | 11842 | 16 |
| 11768 | 11843 | 16 |
| 11769 | 11844 | 16 |
| ... | ... | @@ -11776,8 +11851,12 @@ sparc-linux-gnu sparcel-linux-gnu |
| 11776 | 11851 | 16 |
| 11777 | 11852 | 16 |
| 11778 | 11853 | 16 |
| 11854 | 40 | |
| 11855 | 40 | |
| 11779 | 11856 | 16 |
| 11780 | 11857 | 16 |
| 11858 | 40 | |
| 11859 | 40 | |
| 11781 | 11860 | 16 |
| 11782 | 11861 | 16 |
| 11783 | 11862 | 0 |
| ... | ... | @@ -13040,6 +13119,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 13040 | 13119 | 1 |
| 13041 | 13120 | 1 |
| 13042 | 13121 | 0 |
| 13122 | 40 | |
| 13043 | 13123 | 0 |
| 13044 | 13124 | 5 |
| 13045 | 13125 | 0 |
| ... | ... | @@ -13160,6 +13240,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 13160 | 13240 | 0 3 |
| 13161 | 13241 | 0 |
| 13162 | 13242 | 0 |
| 13243 | 40 | |
| 13163 | 13244 | 0 |
| 13164 | 13245 | 0 |
| 13165 | 13246 | 0 |
| ... | ... | @@ -13833,6 +13914,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 13833 | 13914 | 5 |
| 13834 | 13915 | 0 |
| 13835 | 13916 | 0 13 |
| 13917 | 40 | |
| 13836 | 13918 | 0 13 |
| 13837 | 13919 | 0 13 |
| 13838 | 13920 | 0 13 |
| ... | ... | @@ -13861,6 +13943,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 13861 | 13943 | 0 |
| 13862 | 13944 | 0 |
| 13863 | 13945 | 0 |
| 13946 | 40 | |
| 13864 | 13947 | 24 |
| 13865 | 13948 | 16 |
| 13866 | 13949 | 0 |
| ... | ... | @@ -13888,6 +13971,8 @@ sparc-linux-gnu sparcel-linux-gnu |
| 13888 | 13971 | 16 |
| 13889 | 13972 | 1 |
| 13890 | 13973 | 0 |
| 13974 | 40 | |
| 13975 | 40 | |
| 13891 | 13976 | 1 |
| 13892 | 13977 | 1 |
| 13893 | 13978 | 1 |
| ... | ... | @@ -14114,6 +14199,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 14114 | 14199 | 0 |
| 14115 | 14200 | 0 |
| 14116 | 14201 | 0 |
| 14202 | 40 | |
| 14117 | 14203 | 2 |
| 14118 | 14204 | 0 1 |
| 14119 | 14205 | 0 1 |
| ... | ... | @@ -14482,6 +14568,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 14482 | 14568 | 37 |
| 14483 | 14569 | 37 |
| 14484 | 14570 | 1 16 |
| 14571 | 40 | |
| 14485 | 14572 | 38 |
| 14486 | 14573 | 38 |
| 14487 | 14574 | 38 |
| ... | ... | @@ -14555,6 +14642,7 @@ sparc-linux-gnu sparcel-linux-gnu |
| 14555 | 14642 | 0 |
| 14556 | 14643 | 0 |
| 14557 | 14644 | 0 |
| 14645 | 40 | |
| 14558 | 14646 | 0 |
| 14559 | 14647 | 0 |
| 14560 | 14648 | 0 |
| ... | ... | @@ -15330,6 +15418,7 @@ sparcv9-linux-gnu |
| 15330 | 15418 | 5 |
| 15331 | 15419 | 5 |
| 15332 | 15420 | 5 |
| 15421 | ||
| 15333 | 15422 | 27 |
| 15334 | 15423 | |
| 15335 | 15424 | 27 |
| ... | ... | @@ -15471,6 +15560,18 @@ sparcv9-linux-gnu |
| 15471 | 15560 | |
| 15472 | 15561 | |
| 15473 | 15562 | |
| 15563 | ||
| 15564 | ||
| 15565 | ||
| 15566 | ||
| 15567 | ||
| 15568 | ||
| 15569 | ||
| 15570 | ||
| 15571 | ||
| 15572 | ||
| 15573 | ||
| 15574 | ||
| 15474 | 15575 | |
| 15475 | 15576 | |
| 15476 | 15577 | |
| ... | ... | @@ -16744,6 +16845,7 @@ sparcv9-linux-gnu |
| 16744 | 16845 | 5 |
| 16745 | 16846 | 5 |
| 16746 | 16847 | 5 |
| 16848 | 40 | |
| 16747 | 16849 | 5 |
| 16748 | 16850 | 5 |
| 16749 | 16851 | 5 |
| ... | ... | @@ -16864,6 +16966,7 @@ sparcv9-linux-gnu |
| 16864 | 16966 | 5 |
| 16865 | 16967 | 5 |
| 16866 | 16968 | 5 |
| 16969 | 40 | |
| 16867 | 16970 | 5 |
| 16868 | 16971 | 5 |
| 16869 | 16972 | 5 |
| ... | ... | @@ -17537,6 +17640,7 @@ sparcv9-linux-gnu |
| 17537 | 17640 | 5 |
| 17538 | 17641 | 5 |
| 17539 | 17642 | 5 13 |
| 17643 | 40 | |
| 17540 | 17644 | 5 13 |
| 17541 | 17645 | 5 13 |
| 17542 | 17646 | 5 13 |
| ... | ... | @@ -17565,6 +17669,7 @@ sparcv9-linux-gnu |
| 17565 | 17669 | 5 |
| 17566 | 17670 | 5 |
| 17567 | 17671 | 5 |
| 17672 | 40 | |
| 17568 | 17673 | 24 |
| 17569 | 17674 | 16 |
| 17570 | 17675 | 5 |
| ... | ... | @@ -17592,6 +17697,8 @@ sparcv9-linux-gnu |
| 17592 | 17697 | 16 |
| 17593 | 17698 | 5 |
| 17594 | 17699 | 5 |
| 17700 | 40 | |
| 17701 | 40 | |
| 17595 | 17702 | 5 |
| 17596 | 17703 | 5 |
| 17597 | 17704 | 5 |
| ... | ... | @@ -17818,6 +17925,7 @@ sparcv9-linux-gnu |
| 17818 | 17925 | 5 |
| 17819 | 17926 | 5 |
| 17820 | 17927 | 5 |
| 17928 | 40 | |
| 17821 | 17929 | 5 |
| 17822 | 17930 | 5 |
| 17823 | 17931 | 5 |
| ... | ... | @@ -18186,6 +18294,7 @@ sparcv9-linux-gnu |
| 18186 | 18294 | 37 |
| 18187 | 18295 | 37 |
| 18188 | 18296 | 5 |
| 18297 | 40 | |
| 18189 | 18298 | 38 |
| 18190 | 18299 | 38 |
| 18191 | 18300 | 38 |
| ... | ... | @@ -18259,6 +18368,7 @@ sparcv9-linux-gnu |
| 18259 | 18368 | 5 |
| 18260 | 18369 | 5 |
| 18261 | 18370 | 5 |
| 18371 | 40 | |
| 18262 | 18372 | 5 |
| 18263 | 18373 | 5 |
| 18264 | 18374 | 5 |
| ... | ... | @@ -19034,6 +19144,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 19034 | 19144 | 5 |
| 19035 | 19145 | 0 |
| 19036 | 19146 | 0 |
| 19147 | ||
| 19037 | 19148 | 27 |
| 19038 | 19149 | |
| 19039 | 19150 | 27 |
| ... | ... | @@ -19175,6 +19286,18 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 19175 | 19286 | |
| 19176 | 19287 | |
| 19177 | 19288 | |
| 19289 | ||
| 19290 | ||
| 19291 | ||
| 19292 | ||
| 19293 | ||
| 19294 | ||
| 19295 | ||
| 19296 | ||
| 19297 | ||
| 19298 | ||
| 19299 | ||
| 19300 | ||
| 19178 | 19301 | |
| 19179 | 19302 | |
| 19180 | 19303 | |
| ... | ... | @@ -20448,6 +20571,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 20448 | 20571 | 5 |
| 20449 | 20572 | 5 |
| 20450 | 20573 | 0 |
| 20574 | 40 | |
| 20451 | 20575 | 0 |
| 20452 | 20576 | 5 |
| 20453 | 20577 | 0 |
| ... | ... | @@ -20568,6 +20692,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 20568 | 20692 | 0 5 |
| 20569 | 20693 | 0 |
| 20570 | 20694 | 0 |
| 20695 | 40 | |
| 20571 | 20696 | 0 |
| 20572 | 20697 | 0 |
| 20573 | 20698 | 0 |
| ... | ... | @@ -21241,6 +21366,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21241 | 21366 | 5 |
| 21242 | 21367 | 0 |
| 21243 | 21368 | 0 13 |
| 21369 | 40 | |
| 21244 | 21370 | 0 13 |
| 21245 | 21371 | 0 13 |
| 21246 | 21372 | 0 13 |
| ... | ... | @@ -21269,6 +21395,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21269 | 21395 | 0 |
| 21270 | 21396 | 0 |
| 21271 | 21397 | 0 |
| 21398 | 40 | |
| 21272 | 21399 | 24 |
| 21273 | 21400 | 16 |
| 21274 | 21401 | 0 |
| ... | ... | @@ -21296,6 +21423,8 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21296 | 21423 | 16 |
| 21297 | 21424 | 5 |
| 21298 | 21425 | 0 |
| 21426 | 40 | |
| 21427 | 40 | |
| 21299 | 21428 | 5 |
| 21300 | 21429 | 5 |
| 21301 | 21430 | 5 |
| ... | ... | @@ -21522,6 +21651,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21522 | 21651 | 0 |
| 21523 | 21652 | 0 |
| 21524 | 21653 | 0 |
| 21654 | 40 | |
| 21525 | 21655 | 5 |
| 21526 | 21656 | 0 5 |
| 21527 | 21657 | 0 5 |
| ... | ... | @@ -21890,6 +22020,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21890 | 22020 | 37 |
| 21891 | 22021 | 37 |
| 21892 | 22022 | 5 |
| 22023 | 40 | |
| 21893 | 22024 | 38 |
| 21894 | 22025 | 38 |
| 21895 | 22026 | 38 |
| ... | ... | @@ -21963,6 +22094,7 @@ mips64el-linux-gnuabi64 mips64-linux-gnuabi64 |
| 21963 | 22094 | 0 |
| 21964 | 22095 | 0 |
| 21965 | 22096 | 0 |
| 22097 | 40 | |
| 21966 | 22098 | 0 |
| 21967 | 22099 | 0 |
| 21968 | 22100 | 0 |
| ... | ... | @@ -22738,6 +22870,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 22738 | 22870 | 5 |
| 22739 | 22871 | 0 |
| 22740 | 22872 | 0 |
| 22873 | ||
| 22741 | 22874 | 27 |
| 22742 | 22875 | |
| 22743 | 22876 | 27 |
| ... | ... | @@ -22879,6 +23012,18 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 22879 | 23012 | |
| 22880 | 23013 | |
| 22881 | 23014 | |
| 23015 | ||
| 23016 | ||
| 23017 | ||
| 23018 | ||
| 23019 | ||
| 23020 | ||
| 23021 | ||
| 23022 | ||
| 23023 | ||
| 23024 | ||
| 23025 | ||
| 23026 | ||
| 22882 | 23027 | |
| 22883 | 23028 | |
| 22884 | 23029 | |
| ... | ... | @@ -24152,6 +24297,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 24152 | 24297 | 5 |
| 24153 | 24298 | 5 |
| 24154 | 24299 | 0 |
| 24300 | 40 | |
| 24155 | 24301 | 0 |
| 24156 | 24302 | 5 |
| 24157 | 24303 | 0 |
| ... | ... | @@ -24272,6 +24418,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 24272 | 24418 | 0 5 |
| 24273 | 24419 | 0 |
| 24274 | 24420 | 0 |
| 24421 | 40 | |
| 24275 | 24422 | 0 |
| 24276 | 24423 | 0 |
| 24277 | 24424 | 0 |
| ... | ... | @@ -24945,6 +25092,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 24945 | 25092 | 5 |
| 24946 | 25093 | 0 |
| 24947 | 25094 | 0 13 |
| 25095 | 40 | |
| 24948 | 25096 | 0 13 |
| 24949 | 25097 | 0 13 |
| 24950 | 25098 | 0 13 |
| ... | ... | @@ -24973,6 +25121,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 24973 | 25121 | 0 |
| 24974 | 25122 | 0 |
| 24975 | 25123 | 0 |
| 25124 | 40 | |
| 24976 | 25125 | 24 |
| 24977 | 25126 | 16 |
| 24978 | 25127 | 0 |
| ... | ... | @@ -25000,6 +25149,8 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 25000 | 25149 | 16 |
| 25001 | 25150 | 5 |
| 25002 | 25151 | 0 |
| 25152 | 40 | |
| 25153 | 40 | |
| 25003 | 25154 | 5 |
| 25004 | 25155 | 5 |
| 25005 | 25156 | 5 |
| ... | ... | @@ -25226,6 +25377,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 25226 | 25377 | 0 |
| 25227 | 25378 | 0 |
| 25228 | 25379 | 0 |
| 25380 | 40 | |
| 25229 | 25381 | 5 |
| 25230 | 25382 | 0 5 |
| 25231 | 25383 | 0 5 |
| ... | ... | @@ -25594,6 +25746,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 25594 | 25746 | 37 |
| 25595 | 25747 | 37 |
| 25596 | 25748 | 5 |
| 25749 | 40 | |
| 25597 | 25750 | 38 |
| 25598 | 25751 | 38 |
| 25599 | 25752 | 38 |
| ... | ... | @@ -25667,6 +25820,7 @@ mips64el-linux-gnuabin32 mips64-linux-gnuabin32 |
| 25667 | 25820 | 0 |
| 25668 | 25821 | 0 |
| 25669 | 25822 | 0 |
| 25823 | 40 | |
| 25670 | 25824 | 0 |
| 25671 | 25825 | 0 |
| 25672 | 25826 | 0 |
| ... | ... | @@ -26442,6 +26596,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 26442 | 26596 | 5 |
| 26443 | 26597 | 0 |
| 26444 | 26598 | 0 |
| 26599 | ||
| 26445 | 26600 | 27 |
| 26446 | 26601 | |
| 26447 | 26602 | 27 |
| ... | ... | @@ -26583,6 +26738,18 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 26583 | 26738 | |
| 26584 | 26739 | |
| 26585 | 26740 | |
| 26741 | ||
| 26742 | ||
| 26743 | ||
| 26744 | ||
| 26745 | ||
| 26746 | ||
| 26747 | ||
| 26748 | ||
| 26749 | ||
| 26750 | ||
| 26751 | ||
| 26752 | ||
| 26586 | 26753 | |
| 26587 | 26754 | |
| 26588 | 26755 | |
| ... | ... | @@ -27856,6 +28023,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 27856 | 28023 | 5 |
| 27857 | 28024 | 5 |
| 27858 | 28025 | 0 |
| 28026 | 40 | |
| 27859 | 28027 | 0 |
| 27860 | 28028 | 5 |
| 27861 | 28029 | 0 |
| ... | ... | @@ -27976,6 +28144,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 27976 | 28144 | 0 5 |
| 27977 | 28145 | 0 |
| 27978 | 28146 | 0 |
| 28147 | 40 | |
| 27979 | 28148 | 0 |
| 27980 | 28149 | 0 |
| 27981 | 28150 | 0 |
| ... | ... | @@ -28649,6 +28818,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 28649 | 28818 | 5 |
| 28650 | 28819 | 0 |
| 28651 | 28820 | 0 13 |
| 28821 | 40 | |
| 28652 | 28822 | 0 13 |
| 28653 | 28823 | 0 13 |
| 28654 | 28824 | 0 13 |
| ... | ... | @@ -28677,6 +28847,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 28677 | 28847 | 0 |
| 28678 | 28848 | 0 |
| 28679 | 28849 | 0 |
| 28850 | 40 | |
| 28680 | 28851 | 24 |
| 28681 | 28852 | 16 |
| 28682 | 28853 | 0 |
| ... | ... | @@ -28704,6 +28875,8 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 28704 | 28875 | 16 |
| 28705 | 28876 | 5 |
| 28706 | 28877 | 0 |
| 28878 | 40 | |
| 28879 | 40 | |
| 28707 | 28880 | 5 |
| 28708 | 28881 | 5 |
| 28709 | 28882 | 5 |
| ... | ... | @@ -28930,6 +29103,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 28930 | 29103 | 0 |
| 28931 | 29104 | 0 |
| 28932 | 29105 | 0 |
| 29106 | 40 | |
| 28933 | 29107 | 5 |
| 28934 | 29108 | 0 5 |
| 28935 | 29109 | 0 5 |
| ... | ... | @@ -29298,6 +29472,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 29298 | 29472 | 37 |
| 29299 | 29473 | |
| 29300 | 29474 | 5 |
| 29475 | 40 | |
| 29301 | 29476 | 38 |
| 29302 | 29477 | 38 |
| 29303 | 29478 | 38 |
| ... | ... | @@ -29371,6 +29546,7 @@ mipsel-linux-gnueabihf mips-linux-gnueabihf |
| 29371 | 29546 | 0 |
| 29372 | 29547 | 0 |
| 29373 | 29548 | 0 |
| 29549 | 40 | |
| 29374 | 29550 | 0 |
| 29375 | 29551 | 0 |
| 29376 | 29552 | 0 |
| ... | ... | @@ -30146,6 +30322,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 30146 | 30322 | 5 |
| 30147 | 30323 | 0 |
| 30148 | 30324 | 0 |
| 30325 | ||
| 30149 | 30326 | 27 |
| 30150 | 30327 | |
| 30151 | 30328 | 27 |
| ... | ... | @@ -30287,6 +30464,18 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 30287 | 30464 | |
| 30288 | 30465 | |
| 30289 | 30466 | |
| 30467 | ||
| 30468 | ||
| 30469 | ||
| 30470 | ||
| 30471 | ||
| 30472 | ||
| 30473 | ||
| 30474 | ||
| 30475 | ||
| 30476 | ||
| 30477 | ||
| 30478 | ||
| 30290 | 30479 | |
| 30291 | 30480 | |
| 30292 | 30481 | |
| ... | ... | @@ -31560,6 +31749,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 31560 | 31749 | 5 |
| 31561 | 31750 | 5 |
| 31562 | 31751 | 0 |
| 31752 | 40 | |
| 31563 | 31753 | 0 |
| 31564 | 31754 | 5 |
| 31565 | 31755 | 0 |
| ... | ... | @@ -31680,6 +31870,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 31680 | 31870 | 0 5 |
| 31681 | 31871 | 0 |
| 31682 | 31872 | 0 |
| 31873 | 40 | |
| 31683 | 31874 | 0 |
| 31684 | 31875 | 0 |
| 31685 | 31876 | 0 |
| ... | ... | @@ -32353,6 +32544,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 32353 | 32544 | 5 |
| 32354 | 32545 | 0 |
| 32355 | 32546 | 0 13 |
| 32547 | 40 | |
| 32356 | 32548 | 0 13 |
| 32357 | 32549 | 0 13 |
| 32358 | 32550 | 0 13 |
| ... | ... | @@ -32381,6 +32573,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 32381 | 32573 | 0 |
| 32382 | 32574 | 0 |
| 32383 | 32575 | 0 |
| 32576 | 40 | |
| 32384 | 32577 | 24 |
| 32385 | 32578 | 16 |
| 32386 | 32579 | 0 |
| ... | ... | @@ -32408,6 +32601,8 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 32408 | 32601 | 16 |
| 32409 | 32602 | 5 |
| 32410 | 32603 | 0 |
| 32604 | 40 | |
| 32605 | 40 | |
| 32411 | 32606 | 5 |
| 32412 | 32607 | 5 |
| 32413 | 32608 | 5 |
| ... | ... | @@ -32634,6 +32829,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 32634 | 32829 | 0 |
| 32635 | 32830 | 0 |
| 32636 | 32831 | 0 |
| 32832 | 40 | |
| 32637 | 32833 | 5 |
| 32638 | 32834 | 0 5 |
| 32639 | 32835 | 0 5 |
| ... | ... | @@ -33002,6 +33198,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 33002 | 33198 | 37 |
| 33003 | 33199 | |
| 33004 | 33200 | 5 |
| 33201 | 40 | |
| 33005 | 33202 | 38 |
| 33006 | 33203 | 38 |
| 33007 | 33204 | 38 |
| ... | ... | @@ -33075,6 +33272,7 @@ mipsel-linux-gnueabi mips-linux-gnueabi |
| 33075 | 33272 | 0 |
| 33076 | 33273 | 0 |
| 33077 | 33274 | 0 |
| 33275 | 40 | |
| 33078 | 33276 | 0 |
| 33079 | 33277 | 0 |
| 33080 | 33278 | 0 |
| ... | ... | @@ -33850,6 +34048,7 @@ x86_64-linux-gnu |
| 33850 | 34048 | 10 |
| 33851 | 34049 | 10 |
| 33852 | 34050 | 10 |
| 34051 | ||
| 33853 | 34052 | 27 |
| 33854 | 34053 | 36 |
| 33855 | 34054 | 27 |
| ... | ... | @@ -33991,6 +34190,18 @@ x86_64-linux-gnu |
| 33991 | 34190 | |
| 33992 | 34191 | |
| 33993 | 34192 | |
| 34193 | ||
| 34194 | ||
| 34195 | ||
| 34196 | ||
| 34197 | ||
| 34198 | ||
| 34199 | ||
| 34200 | ||
| 34201 | ||
| 34202 | ||
| 34203 | ||
| 34204 | ||
| 33994 | 34205 | |
| 33995 | 34206 | |
| 33996 | 34207 | |
| ... | ... | @@ -35264,6 +35475,7 @@ x86_64-linux-gnu |
| 35264 | 35475 | 10 |
| 35265 | 35476 | 10 |
| 35266 | 35477 | 10 |
| 35478 | 40 | |
| 35267 | 35479 | 10 |
| 35268 | 35480 | 10 |
| 35269 | 35481 | 10 |
| ... | ... | @@ -35384,6 +35596,7 @@ x86_64-linux-gnu |
| 35384 | 35596 | 10 |
| 35385 | 35597 | 10 |
| 35386 | 35598 | 10 |
| 35599 | 40 | |
| 35387 | 35600 | 10 |
| 35388 | 35601 | 10 |
| 35389 | 35602 | 10 |
| ... | ... | @@ -36057,6 +36270,7 @@ x86_64-linux-gnu |
| 36057 | 36270 | 10 |
| 36058 | 36271 | 10 |
| 36059 | 36272 | 10 13 |
| 36273 | 40 | |
| 36060 | 36274 | 10 13 |
| 36061 | 36275 | 10 13 |
| 36062 | 36276 | 10 13 |
| ... | ... | @@ -36085,6 +36299,7 @@ x86_64-linux-gnu |
| 36085 | 36299 | 10 |
| 36086 | 36300 | 10 |
| 36087 | 36301 | 10 |
| 36302 | 40 | |
| 36088 | 36303 | 24 |
| 36089 | 36304 | 16 |
| 36090 | 36305 | 10 |
| ... | ... | @@ -36112,6 +36327,8 @@ x86_64-linux-gnu |
| 36112 | 36327 | 16 |
| 36113 | 36328 | 10 |
| 36114 | 36329 | 10 |
| 36330 | 40 | |
| 36331 | 40 | |
| 36115 | 36332 | 10 |
| 36116 | 36333 | 10 |
| 36117 | 36334 | 10 |
| ... | ... | @@ -36338,6 +36555,7 @@ x86_64-linux-gnu |
| 36338 | 36555 | 10 |
| 36339 | 36556 | 10 |
| 36340 | 36557 | 10 |
| 36558 | 40 | |
| 36341 | 36559 | 10 |
| 36342 | 36560 | 10 |
| 36343 | 36561 | 10 |
| ... | ... | @@ -36706,6 +36924,7 @@ x86_64-linux-gnu |
| 36706 | 36924 | 37 |
| 36707 | 36925 | 37 |
| 36708 | 36926 | 10 |
| 36927 | 40 | |
| 36709 | 36928 | 38 |
| 36710 | 36929 | 38 |
| 36711 | 36930 | 38 |
| ... | ... | @@ -36779,6 +36998,7 @@ x86_64-linux-gnu |
| 36779 | 36998 | 10 |
| 36780 | 36999 | 10 |
| 36781 | 37000 | 10 |
| 37001 | 40 | |
| 36782 | 37002 | 10 |
| 36783 | 37003 | 10 |
| 36784 | 37004 | 10 |
| ... | ... | @@ -37554,6 +37774,7 @@ x86_64-linux-gnux32 |
| 37554 | 37774 | 28 |
| 37555 | 37775 | 28 |
| 37556 | 37776 | 28 |
| 37777 | ||
| 37557 | 37778 | 28 |
| 37558 | 37779 | 36 |
| 37559 | 37780 | 28 |
| ... | ... | @@ -37695,6 +37916,18 @@ x86_64-linux-gnux32 |
| 37695 | 37916 | |
| 37696 | 37917 | |
| 37697 | 37918 | |
| 37919 | ||
| 37920 | ||
| 37921 | ||
| 37922 | ||
| 37923 | ||
| 37924 | ||
| 37925 | ||
| 37926 | ||
| 37927 | ||
| 37928 | ||
| 37929 | ||
| 37930 | ||
| 37698 | 37931 | |
| 37699 | 37932 | |
| 37700 | 37933 | |
| ... | ... | @@ -38968,6 +39201,7 @@ x86_64-linux-gnux32 |
| 38968 | 39201 | 28 |
| 38969 | 39202 | 28 |
| 38970 | 39203 | 28 |
| 39204 | 40 | |
| 38971 | 39205 | 28 |
| 38972 | 39206 | 28 |
| 38973 | 39207 | 28 |
| ... | ... | @@ -39088,6 +39322,7 @@ x86_64-linux-gnux32 |
| 39088 | 39322 | 28 |
| 39089 | 39323 | 28 |
| 39090 | 39324 | 28 |
| 39325 | 40 | |
| 39091 | 39326 | 28 |
| 39092 | 39327 | 28 |
| 39093 | 39328 | 28 |
| ... | ... | @@ -39761,6 +39996,7 @@ x86_64-linux-gnux32 |
| 39761 | 39996 | 28 |
| 39762 | 39997 | 28 |
| 39763 | 39998 | 28 |
| 39999 | 40 | |
| 39764 | 40000 | 28 |
| 39765 | 40001 | 28 |
| 39766 | 40002 | 28 |
| ... | ... | @@ -39789,6 +40025,7 @@ x86_64-linux-gnux32 |
| 39789 | 40025 | 28 |
| 39790 | 40026 | 28 |
| 39791 | 40027 | 28 |
| 40028 | 40 | |
| 39792 | 40029 | 28 |
| 39793 | 40030 | 28 |
| 39794 | 40031 | 28 |
| ... | ... | @@ -39816,6 +40053,8 @@ x86_64-linux-gnux32 |
| 39816 | 40053 | 28 |
| 39817 | 40054 | 28 |
| 39818 | 40055 | 28 |
| 40056 | 40 | |
| 40057 | 40 | |
| 39819 | 40058 | 28 |
| 39820 | 40059 | 28 |
| 39821 | 40060 | 28 |
| ... | ... | @@ -40042,6 +40281,7 @@ x86_64-linux-gnux32 |
| 40042 | 40281 | 28 |
| 40043 | 40282 | 28 |
| 40044 | 40283 | 28 |
| 40284 | 40 | |
| 40045 | 40285 | 28 |
| 40046 | 40286 | 28 |
| 40047 | 40287 | 28 |
| ... | ... | @@ -40410,6 +40650,7 @@ x86_64-linux-gnux32 |
| 40410 | 40650 | 37 |
| 40411 | 40651 | 37 |
| 40412 | 40652 | 28 |
| 40653 | 40 | |
| 40413 | 40654 | 38 |
| 40414 | 40655 | 38 |
| 40415 | 40656 | 38 |
| ... | ... | @@ -40483,6 +40724,7 @@ x86_64-linux-gnux32 |
| 40483 | 40724 | 28 |
| 40484 | 40725 | 28 |
| 40485 | 40726 | 28 |
| 40727 | 40 | |
| 40486 | 40728 | 28 |
| 40487 | 40729 | 28 |
| 40488 | 40730 | 28 |
| ... | ... | @@ -41258,6 +41500,7 @@ i386-linux-gnu |
| 41258 | 41500 | 1 |
| 41259 | 41501 | 0 |
| 41260 | 41502 | 0 |
| 41503 | 3 | |
| 41261 | 41504 | 27 |
| 41262 | 41505 | 36 |
| 41263 | 41506 | 27 |
| ... | ... | @@ -41399,6 +41642,18 @@ i386-linux-gnu |
| 41399 | 41642 | |
| 41400 | 41643 | |
| 41401 | 41644 | |
| 41645 | ||
| 41646 | ||
| 41647 | ||
| 41648 | ||
| 41649 | ||
| 41650 | ||
| 41651 | ||
| 41652 | ||
| 41653 | ||
| 41654 | ||
| 41655 | ||
| 41656 | ||
| 41402 | 41657 | |
| 41403 | 41658 | |
| 41404 | 41659 | |
| ... | ... | @@ -42672,6 +42927,7 @@ i386-linux-gnu |
| 42672 | 42927 | 1 |
| 42673 | 42928 | 1 |
| 42674 | 42929 | 0 |
| 42930 | 40 | |
| 42675 | 42931 | 0 |
| 42676 | 42932 | 5 |
| 42677 | 42933 | 0 |
| ... | ... | @@ -42792,6 +43048,7 @@ i386-linux-gnu |
| 42792 | 43048 | 0 3 |
| 42793 | 43049 | 0 |
| 42794 | 43050 | 0 |
| 43051 | 40 | |
| 42795 | 43052 | 0 |
| 42796 | 43053 | 0 |
| 42797 | 43054 | 0 |
| ... | ... | @@ -43465,6 +43722,7 @@ i386-linux-gnu |
| 43465 | 43722 | 5 |
| 43466 | 43723 | 0 |
| 43467 | 43724 | 0 13 |
| 43725 | 40 | |
| 43468 | 43726 | 0 13 |
| 43469 | 43727 | 0 13 |
| 43470 | 43728 | 0 13 |
| ... | ... | @@ -43493,6 +43751,7 @@ i386-linux-gnu |
| 43493 | 43751 | 0 |
| 43494 | 43752 | 0 |
| 43495 | 43753 | 0 |
| 43754 | 40 | |
| 43496 | 43755 | 24 |
| 43497 | 43756 | 16 |
| 43498 | 43757 | 0 |
| ... | ... | @@ -43520,6 +43779,8 @@ i386-linux-gnu |
| 43520 | 43779 | 16 |
| 43521 | 43780 | 1 |
| 43522 | 43781 | 0 |
| 43782 | 40 | |
| 43783 | 40 | |
| 43523 | 43784 | 1 |
| 43524 | 43785 | 1 |
| 43525 | 43786 | 1 |
| ... | ... | @@ -43746,6 +44007,7 @@ i386-linux-gnu |
| 43746 | 44007 | 0 |
| 43747 | 44008 | 0 |
| 43748 | 44009 | 0 |
| 44010 | 40 | |
| 43749 | 44011 | 2 |
| 43750 | 44012 | 0 1 |
| 43751 | 44013 | 0 1 |
| ... | ... | @@ -44114,6 +44376,7 @@ i386-linux-gnu |
| 44114 | 44376 | 37 |
| 44115 | 44377 | 37 |
| 44116 | 44378 | 1 |
| 44379 | 40 | |
| 44117 | 44380 | 38 |
| 44118 | 44381 | 38 |
| 44119 | 44382 | 38 |
| ... | ... | @@ -44187,6 +44450,7 @@ i386-linux-gnu |
| 44187 | 44450 | 0 |
| 44188 | 44451 | 0 |
| 44189 | 44452 | 0 |
| 44453 | 40 | |
| 44190 | 44454 | 0 |
| 44191 | 44455 | 0 |
| 44192 | 44456 | 0 |
| ... | ... | @@ -44962,6 +45226,7 @@ powerpc64le-linux-gnu |
| 44962 | 45226 | 29 |
| 44963 | 45227 | 29 |
| 44964 | 45228 | 29 |
| 45229 | ||
| 44965 | 45230 | 29 |
| 44966 | 45231 | 36 |
| 44967 | 45232 | 29 |
| ... | ... | @@ -45074,12 +45339,18 @@ powerpc64le-linux-gnu |
| 45074 | 45339 | 29 |
| 45075 | 45340 | 29 |
| 45076 | 45341 | 29 |
| 45342 | 40 | |
| 45343 | 40 | |
| 45077 | 45344 | 29 |
| 45078 | 45345 | 38 |
| 45079 | 45346 | 38 |
| 45080 | 45347 | 38 |
| 45081 | 45348 | 29 |
| 45082 | 45349 | 38 |
| 45350 | 40 | |
| 45351 | 40 | |
| 45352 | 40 | |
| 45353 | 40 | |
| 45083 | 45354 | 29 |
| 45084 | 45355 | 29 |
| 45085 | 45356 | 29 |
| ... | ... | @@ -45100,6 +45371,8 @@ powerpc64le-linux-gnu |
| 45100 | 45371 | 29 |
| 45101 | 45372 | 29 |
| 45102 | 45373 | 29 |
| 45374 | 40 | |
| 45375 | 40 | |
| 45103 | 45376 | 29 |
| 45104 | 45377 | 29 |
| 45105 | 45378 | 29 |
| ... | ... | @@ -45112,8 +45385,12 @@ powerpc64le-linux-gnu |
| 45112 | 45385 | 29 |
| 45113 | 45386 | 29 |
| 45114 | 45387 | 29 |
| 45388 | 40 | |
| 45389 | 40 | |
| 45115 | 45390 | 29 |
| 45116 | 45391 | 29 |
| 45392 | 40 | |
| 45393 | 40 | |
| 45117 | 45394 | 29 |
| 45118 | 45395 | 29 |
| 45119 | 45396 | 29 |
| ... | ... | @@ -46376,6 +46653,7 @@ powerpc64le-linux-gnu |
| 46376 | 46653 | 29 |
| 46377 | 46654 | 29 |
| 46378 | 46655 | 29 |
| 46656 | 40 | |
| 46379 | 46657 | 29 |
| 46380 | 46658 | 29 |
| 46381 | 46659 | 29 |
| ... | ... | @@ -46496,6 +46774,7 @@ powerpc64le-linux-gnu |
| 46496 | 46774 | 29 |
| 46497 | 46775 | 29 |
| 46498 | 46776 | 29 |
| 46777 | 40 | |
| 46499 | 46778 | 29 |
| 46500 | 46779 | 29 |
| 46501 | 46780 | 29 |
| ... | ... | @@ -47169,6 +47448,7 @@ powerpc64le-linux-gnu |
| 47169 | 47448 | 29 |
| 47170 | 47449 | 29 |
| 47171 | 47450 | 29 |
| 47451 | 40 | |
| 47172 | 47452 | 29 |
| 47173 | 47453 | 29 |
| 47174 | 47454 | 29 |
| ... | ... | @@ -47197,6 +47477,7 @@ powerpc64le-linux-gnu |
| 47197 | 47477 | 29 |
| 47198 | 47478 | 29 |
| 47199 | 47479 | 29 |
| 47480 | 40 | |
| 47200 | 47481 | 29 |
| 47201 | 47482 | 29 |
| 47202 | 47483 | 29 |
| ... | ... | @@ -47224,6 +47505,8 @@ powerpc64le-linux-gnu |
| 47224 | 47505 | 29 |
| 47225 | 47506 | 29 |
| 47226 | 47507 | 29 |
| 47508 | 40 | |
| 47509 | 40 | |
| 47227 | 47510 | 29 |
| 47228 | 47511 | 29 |
| 47229 | 47512 | 29 |
| ... | ... | @@ -47450,6 +47733,7 @@ powerpc64le-linux-gnu |
| 47450 | 47733 | 29 |
| 47451 | 47734 | 29 |
| 47452 | 47735 | 29 |
| 47736 | 40 | |
| 47453 | 47737 | 29 |
| 47454 | 47738 | 29 |
| 47455 | 47739 | 29 |
| ... | ... | @@ -47818,6 +48102,7 @@ powerpc64le-linux-gnu |
| 47818 | 48102 | 37 |
| 47819 | 48103 | 37 |
| 47820 | 48104 | 29 |
| 48105 | 40 | |
| 47821 | 48106 | 38 |
| 47822 | 48107 | 38 |
| 47823 | 48108 | 38 |
| ... | ... | @@ -47891,6 +48176,7 @@ powerpc64le-linux-gnu |
| 47891 | 48176 | 29 |
| 47892 | 48177 | 29 |
| 47893 | 48178 | 29 |
| 48179 | 40 | |
| 47894 | 48180 | 29 |
| 47895 | 48181 | 29 |
| 47896 | 48182 | 29 |
| ... | ... | @@ -48666,6 +48952,7 @@ powerpc64-linux-gnu |
| 48666 | 48952 | 12 |
| 48667 | 48953 | 12 |
| 48668 | 48954 | 12 |
| 48955 | ||
| 48669 | 48956 | 27 |
| 48670 | 48957 | |
| 48671 | 48958 | 27 |
| ... | ... | @@ -48778,12 +49065,18 @@ powerpc64-linux-gnu |
| 48778 | 49065 | 16 |
| 48779 | 49066 | 16 |
| 48780 | 49067 | 16 |
| 49068 | 40 | |
| 49069 | 40 | |
| 48781 | 49070 | 16 |
| 48782 | 49071 | 38 |
| 48783 | 49072 | 38 |
| 48784 | 49073 | 38 |
| 48785 | 49074 | 16 |
| 48786 | 49075 | 38 |
| 49076 | 40 | |
| 49077 | 40 | |
| 49078 | 40 | |
| 49079 | 40 | |
| 48787 | 49080 | 16 |
| 48788 | 49081 | 16 |
| 48789 | 49082 | 16 |
| ... | ... | @@ -48804,6 +49097,8 @@ powerpc64-linux-gnu |
| 48804 | 49097 | 16 |
| 48805 | 49098 | 16 |
| 48806 | 49099 | 16 |
| 49100 | 40 | |
| 49101 | 40 | |
| 48807 | 49102 | 16 |
| 48808 | 49103 | 16 |
| 48809 | 49104 | 16 |
| ... | ... | @@ -48816,8 +49111,12 @@ powerpc64-linux-gnu |
| 48816 | 49111 | 16 |
| 48817 | 49112 | 16 |
| 48818 | 49113 | 16 |
| 49114 | 40 | |
| 49115 | 40 | |
| 48819 | 49116 | 16 |
| 48820 | 49117 | 16 |
| 49118 | 40 | |
| 49119 | 40 | |
| 48821 | 49120 | 16 |
| 48822 | 49121 | 16 |
| 48823 | 49122 | 12 |
| ... | ... | @@ -50080,6 +50379,7 @@ powerpc64-linux-gnu |
| 50080 | 50379 | 12 |
| 50081 | 50380 | 12 |
| 50082 | 50381 | 12 |
| 50382 | 40 | |
| 50083 | 50383 | 12 |
| 50084 | 50384 | 12 |
| 50085 | 50385 | 12 |
| ... | ... | @@ -50200,6 +50500,7 @@ powerpc64-linux-gnu |
| 50200 | 50500 | 12 |
| 50201 | 50501 | 12 |
| 50202 | 50502 | 12 |
| 50503 | 40 | |
| 50203 | 50504 | 12 |
| 50204 | 50505 | 12 |
| 50205 | 50506 | 12 |
| ... | ... | @@ -50873,6 +51174,7 @@ powerpc64-linux-gnu |
| 50873 | 51174 | 12 |
| 50874 | 51175 | 12 |
| 50875 | 51176 | 12 13 |
| 51177 | 40 | |
| 50876 | 51178 | 12 13 |
| 50877 | 51179 | 12 13 |
| 50878 | 51180 | 12 13 |
| ... | ... | @@ -50901,6 +51203,7 @@ powerpc64-linux-gnu |
| 50901 | 51203 | 12 |
| 50902 | 51204 | 12 |
| 50903 | 51205 | 12 |
| 51206 | 40 | |
| 50904 | 51207 | 24 |
| 50905 | 51208 | 16 |
| 50906 | 51209 | 12 |
| ... | ... | @@ -50928,6 +51231,8 @@ powerpc64-linux-gnu |
| 50928 | 51231 | 16 |
| 50929 | 51232 | 12 |
| 50930 | 51233 | 12 |
| 51234 | 40 | |
| 51235 | 40 | |
| 50931 | 51236 | 12 |
| 50932 | 51237 | 12 |
| 50933 | 51238 | 12 |
| ... | ... | @@ -51154,6 +51459,7 @@ powerpc64-linux-gnu |
| 51154 | 51459 | 12 |
| 51155 | 51460 | 12 |
| 51156 | 51461 | 12 |
| 51462 | 40 | |
| 51157 | 51463 | 12 |
| 51158 | 51464 | 12 |
| 51159 | 51465 | 12 |
| ... | ... | @@ -51522,6 +51828,7 @@ powerpc64-linux-gnu |
| 51522 | 51828 | 37 |
| 51523 | 51829 | |
| 51524 | 51830 | 12 16 |
| 51831 | 40 | |
| 51525 | 51832 | 38 |
| 51526 | 51833 | 38 |
| 51527 | 51834 | 38 |
| ... | ... | @@ -51595,6 +51902,7 @@ powerpc64-linux-gnu |
| 51595 | 51902 | 12 |
| 51596 | 51903 | 12 |
| 51597 | 51904 | 12 |
| 51905 | 40 | |
| 51598 | 51906 | 12 |
| 51599 | 51907 | 12 |
| 51600 | 51908 | 12 |
| ... | ... | @@ -52370,6 +52678,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 52370 | 52678 | 1 |
| 52371 | 52679 | 0 |
| 52372 | 52680 | 0 |
| 52681 | 3 | |
| 52373 | 52682 | 27 |
| 52374 | 52683 | |
| 52375 | 52684 | 27 |
| ... | ... | @@ -52482,12 +52791,18 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 52482 | 52791 | 16 |
| 52483 | 52792 | 16 |
| 52484 | 52793 | 16 |
| 52794 | 40 | |
| 52795 | 40 | |
| 52485 | 52796 | 16 |
| 52486 | 52797 | 38 |
| 52487 | 52798 | 38 |
| 52488 | 52799 | 38 |
| 52489 | 52800 | 16 |
| 52490 | 52801 | 38 |
| 52802 | 40 | |
| 52803 | 40 | |
| 52804 | 40 | |
| 52805 | 40 | |
| 52491 | 52806 | 16 |
| 52492 | 52807 | 16 |
| 52493 | 52808 | 16 |
| ... | ... | @@ -52508,6 +52823,8 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 52508 | 52823 | 16 |
| 52509 | 52824 | 16 |
| 52510 | 52825 | 16 |
| 52826 | 40 | |
| 52827 | 40 | |
| 52511 | 52828 | 16 |
| 52512 | 52829 | 16 |
| 52513 | 52830 | 16 |
| ... | ... | @@ -52520,8 +52837,12 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 52520 | 52837 | 16 |
| 52521 | 52838 | 16 |
| 52522 | 52839 | 16 |
| 52840 | 40 | |
| 52841 | 40 | |
| 52523 | 52842 | 16 |
| 52524 | 52843 | 16 |
| 52844 | 40 | |
| 52845 | 40 | |
| 52525 | 52846 | 16 |
| 52526 | 52847 | 16 |
| 52527 | 52848 | 0 |
| ... | ... | @@ -53784,6 +54105,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 53784 | 54105 | 1 |
| 53785 | 54106 | 1 |
| 53786 | 54107 | 0 |
| 54108 | 40 | |
| 53787 | 54109 | 0 |
| 53788 | 54110 | 5 |
| 53789 | 54111 | 0 |
| ... | ... | @@ -53904,6 +54226,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 53904 | 54226 | 0 3 |
| 53905 | 54227 | 0 |
| 53906 | 54228 | 0 |
| 54229 | 40 | |
| 53907 | 54230 | 0 |
| 53908 | 54231 | 0 |
| 53909 | 54232 | 0 |
| ... | ... | @@ -54577,6 +54900,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 54577 | 54900 | 5 |
| 54578 | 54901 | 0 |
| 54579 | 54902 | 0 13 |
| 54903 | 40 | |
| 54580 | 54904 | 0 13 |
| 54581 | 54905 | 0 13 |
| 54582 | 54906 | 0 13 |
| ... | ... | @@ -54605,6 +54929,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 54605 | 54929 | 0 |
| 54606 | 54930 | 0 |
| 54607 | 54931 | 0 |
| 54932 | 40 | |
| 54608 | 54933 | 24 |
| 54609 | 54934 | 16 |
| 54610 | 54935 | 0 |
| ... | ... | @@ -54632,6 +54957,8 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 54632 | 54957 | 16 |
| 54633 | 54958 | 1 |
| 54634 | 54959 | 0 |
| 54960 | 40 | |
| 54961 | 40 | |
| 54635 | 54962 | 1 |
| 54636 | 54963 | 1 |
| 54637 | 54964 | 1 |
| ... | ... | @@ -54858,6 +55185,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 54858 | 55185 | 0 |
| 54859 | 55186 | 0 |
| 54860 | 55187 | 0 |
| 55188 | 40 | |
| 54861 | 55189 | 2 |
| 54862 | 55190 | 0 1 |
| 54863 | 55191 | 0 1 |
| ... | ... | @@ -55226,6 +55554,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 55226 | 55554 | 37 |
| 55227 | 55555 | |
| 55228 | 55556 | 1 16 |
| 55557 | 40 | |
| 55229 | 55558 | 38 |
| 55230 | 55559 | 38 |
| 55231 | 55560 | 38 |
| ... | ... | @@ -55299,6 +55628,7 @@ powerpc-linux-gnueabi powerpc-linux-gnueabihf |
| 55299 | 55628 | 0 |
| 55300 | 55629 | 0 |
| 55301 | 55630 | 0 |
| 55631 | 40 | |
| 55302 | 55632 | 0 |
| 55303 | 55633 | 0 |
| 55304 | 55634 | 0 |
lib/libc/glibc/fns.txt+22| ... | ... | @@ -513,6 +513,7 @@ __libc_realloc c |
| 513 | 513 | __libc_sa_len c |
| 514 | 514 | __libc_start_main c |
| 515 | 515 | __libc_valloc c |
| 516 | __libpthread_version_placeholder pthread | |
| 516 | 517 | __log10_finite m |
| 517 | 518 | __log10f128_finite m |
| 518 | 519 | __log10f_finite m |
| ... | ... | @@ -625,12 +626,18 @@ __nldbl___vswprintf_chk c |
| 625 | 626 | __nldbl___vsyslog_chk c |
| 626 | 627 | __nldbl___vwprintf_chk c |
| 627 | 628 | __nldbl___wprintf_chk c |
| 629 | __nldbl_argp_error c | |
| 630 | __nldbl_argp_failure c | |
| 628 | 631 | __nldbl_asprintf c |
| 629 | 632 | __nldbl_daddl m |
| 630 | 633 | __nldbl_ddivl m |
| 631 | 634 | __nldbl_dmull m |
| 632 | 635 | __nldbl_dprintf c |
| 633 | 636 | __nldbl_dsubl m |
| 637 | __nldbl_err c | |
| 638 | __nldbl_error c | |
| 639 | __nldbl_error_at_line c | |
| 640 | __nldbl_errx c | |
| 634 | 641 | __nldbl_fprintf c |
| 635 | 642 | __nldbl_fscanf c |
| 636 | 643 | __nldbl_fwprintf c |
| ... | ... | @@ -651,6 +658,8 @@ __nldbl_swscanf c |
| 651 | 658 | __nldbl_syslog c |
| 652 | 659 | __nldbl_vasprintf c |
| 653 | 660 | __nldbl_vdprintf c |
| 661 | __nldbl_verr c | |
| 662 | __nldbl_verrx c | |
| 654 | 663 | __nldbl_vfprintf c |
| 655 | 664 | __nldbl_vfscanf c |
| 656 | 665 | __nldbl_vfwprintf c |
| ... | ... | @@ -663,8 +672,12 @@ __nldbl_vsscanf c |
| 663 | 672 | __nldbl_vswprintf c |
| 664 | 673 | __nldbl_vswscanf c |
| 665 | 674 | __nldbl_vsyslog c |
| 675 | __nldbl_vwarn c | |
| 676 | __nldbl_vwarnx c | |
| 666 | 677 | __nldbl_vwprintf c |
| 667 | 678 | __nldbl_vwscanf c |
| 679 | __nldbl_warn c | |
| 680 | __nldbl_warnx c | |
| 668 | 681 | __nldbl_wprintf c |
| 669 | 682 | __nldbl_wscanf c |
| 670 | 683 | __nss_configure_lookup c |
| ... | ... | @@ -1927,6 +1940,7 @@ getdate c |
| 1927 | 1940 | getdate_err c |
| 1928 | 1941 | getdate_r c |
| 1929 | 1942 | getdelim c |
| 1943 | getdents64 c | |
| 1930 | 1944 | getdirentries c |
| 1931 | 1945 | getdirentries64 c |
| 1932 | 1946 | getdomainname c |
| ... | ... | @@ -2047,6 +2061,7 @@ getspnam c |
| 2047 | 2061 | getspnam_r c |
| 2048 | 2062 | getsubopt c |
| 2049 | 2063 | gettext c |
| 2064 | gettid c | |
| 2050 | 2065 | gettimeofday c |
| 2051 | 2066 | getttyent c |
| 2052 | 2067 | getttynam c |
| ... | ... | @@ -2720,6 +2735,7 @@ pthread_barrierattr_init pthread |
| 2720 | 2735 | pthread_barrierattr_setpshared pthread |
| 2721 | 2736 | pthread_cancel pthread |
| 2722 | 2737 | pthread_cond_broadcast c |
| 2738 | pthread_cond_clockwait pthread | |
| 2723 | 2739 | pthread_cond_destroy c |
| 2724 | 2740 | pthread_cond_init c |
| 2725 | 2741 | pthread_cond_signal c |
| ... | ... | @@ -2748,6 +2764,7 @@ pthread_key_create pthread |
| 2748 | 2764 | pthread_key_delete pthread |
| 2749 | 2765 | pthread_kill pthread |
| 2750 | 2766 | pthread_kill_other_threads_np pthread |
| 2767 | pthread_mutex_clocklock pthread | |
| 2751 | 2768 | pthread_mutex_consistent pthread |
| 2752 | 2769 | pthread_mutex_consistent_np pthread |
| 2753 | 2770 | pthread_mutex_destroy c |
| ... | ... | @@ -2775,6 +2792,8 @@ pthread_mutexattr_setrobust pthread |
| 2775 | 2792 | pthread_mutexattr_setrobust_np pthread |
| 2776 | 2793 | pthread_mutexattr_settype pthread |
| 2777 | 2794 | pthread_once pthread |
| 2795 | pthread_rwlock_clockrdlock pthread | |
| 2796 | pthread_rwlock_clockwrlock pthread | |
| 2778 | 2797 | pthread_rwlock_destroy pthread |
| 2779 | 2798 | pthread_rwlock_init pthread |
| 2780 | 2799 | pthread_rwlock_rdlock pthread |
| ... | ... | @@ -3001,6 +3020,7 @@ seed48 c |
| 3001 | 3020 | seed48_r c |
| 3002 | 3021 | seekdir c |
| 3003 | 3022 | select c |
| 3023 | sem_clockwait pthread | |
| 3004 | 3024 | sem_close pthread |
| 3005 | 3025 | sem_destroy pthread |
| 3006 | 3026 | sem_getvalue pthread |
| ... | ... | @@ -3369,6 +3389,7 @@ tgammaf32x m |
| 3369 | 3389 | tgammaf64 m |
| 3370 | 3390 | tgammaf64x m |
| 3371 | 3391 | tgammal m |
| 3392 | tgkill c | |
| 3372 | 3393 | thrd_create pthread |
| 3373 | 3394 | thrd_current c |
| 3374 | 3395 | thrd_detach pthread |
| ... | ... | @@ -3442,6 +3463,7 @@ ttyname c |
| 3442 | 3463 | ttyname_r c |
| 3443 | 3464 | ttyslot c |
| 3444 | 3465 | twalk c |
| 3466 | twalk_r c | |
| 3445 | 3467 | tzname c |
| 3446 | 3468 | tzset c |
| 3447 | 3469 | ualarm c |
lib/libc/glibc/vers.txt+1| ... | ... | @@ -38,3 +38,4 @@ GLIBC_2.26 |
| 38 | 38 | GLIBC_2.27 |
| 39 | 39 | GLIBC_2.28 |
| 40 | 40 | GLIBC_2.29 |
| 41 | GLIBC_2.30 |
lib/libc/include/aarch64-linux-gnu/bits/hwcap.h+4-1| ... | ... | @@ -50,4 +50,7 @@ |
| 50 | 50 | #define HWCAP_USCAT		(1 << 25) |
| 51 | 51 | #define HWCAP_ILRCPC		(1 << 26) |
| 52 | 52 | #define HWCAP_FLAGM		(1 << 27) |
| 53 | #define HWCAP_SSBS		(1 << 28) | |
| \ No newline at end of file | ||
| 53 | #define HWCAP_SSBS		(1 << 28) | |
| 54 | #define HWCAP_SB		(1 << 29) | |
| 55 | #define HWCAP_PACA		(1 << 30) | |
| 56 | #define HWCAP_PACG		(1UL << 31) | |
| \ No newline at end of file |
lib/libc/include/aarch64-linux-gnu/gnu/stubs-lp64.h-6| ... | ... | @@ -13,15 +13,9 @@ |
| 13 | 13 | #define __stub___compat_query_module |
| 14 | 14 | #define __stub___compat_uselib |
| 15 | 15 | #define __stub_chflags |
| 16 | #define __stub_fattach | |
| 17 | 16 | #define __stub_fchflags |
| 18 | #define __stub_fdetach | |
| 19 | #define __stub_getmsg | |
| 20 | #define __stub_getpmsg | |
| 21 | 17 | #define __stub_gtty |
| 22 | 18 | #define __stub_lchmod |
| 23 | #define __stub_putmsg | |
| 24 | #define __stub_putpmsg | |
| 25 | 19 | #define __stub_revoke |
| 26 | 20 | #define __stub_setlogin |
| 27 | 21 | #define __stub_sigreturn |
lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h+4-1| ... | ... | @@ -50,4 +50,7 @@ |
| 50 | 50 | #define HWCAP_USCAT		(1 << 25) |
| 51 | 51 | #define HWCAP_ILRCPC		(1 << 26) |
| 52 | 52 | #define HWCAP_FLAGM		(1 << 27) |
| 53 | #define HWCAP_SSBS		(1 << 28) | |
| \ No newline at end of file | ||
| 53 | #define HWCAP_SSBS		(1 << 28) | |
| 54 | #define HWCAP_SB		(1 << 29) | |
| 55 | #define HWCAP_PACA		(1 << 30) | |
| 56 | #define HWCAP_PACG		(1UL << 31) | |
| \ No newline at end of file |
lib/libc/include/aarch64_be-linux-gnu/gnu/stubs-lp64_be.h-6| ... | ... | @@ -13,15 +13,9 @@ |
| 13 | 13 | #define __stub___compat_query_module |
| 14 | 14 | #define __stub___compat_uselib |
| 15 | 15 | #define __stub_chflags |
| 16 | #define __stub_fattach | |
| 17 | 16 | #define __stub_fchflags |
| 18 | #define __stub_fdetach | |
| 19 | #define __stub_getmsg | |
| 20 | #define __stub_getpmsg | |
| 21 | 17 | #define __stub_gtty |
| 22 | 18 | #define __stub_lchmod |
| 23 | #define __stub_putmsg | |
| 24 | #define __stub_putpmsg | |
| 25 | 19 | #define __stub_revoke |
| 26 | 20 | #define __stub_setlogin |
| 27 | 21 | #define __stub_sigreturn |
lib/libc/include/generic-glibc/bits/dirent_ext.h created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | /* System-specific extensions of <dirent.h>. Linux version. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _DIRENT_H | |
| 20 | # error "Never include <bits/dirent_ext.h> directly; use <dirent.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | __BEGIN_DECLS | |
| 24 | ||
| 25 | #ifdef __USE_GNU | |
| 26 | /* Read from the directory descriptor FD into LENGTH bytes at BUFFER. | |
| 27 | Return the number of bytes read on success (0 for end of | |
| 28 | directory), and -1 for failure. */ | |
| 29 | extern __ssize_t getdents64 (int __fd, void *__buffer, size_t __length) | |
| 30 | __THROW __nonnull ((2)); | |
| 31 | #endif | |
| 32 | ||
| 33 | __END_DECLS | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/fcntl-linux.h+2| ... | ... | @@ -284,6 +284,8 @@ struct f_owner_ex |
| 284 | 284 | # define F_SEAL_SHRINK	0x0002	/* Prevent file from shrinking. */ |
| 285 | 285 | # define F_SEAL_GROW	0x0004	/* Prevent file from growing. */ |
| 286 | 286 | # define F_SEAL_WRITE	0x0008	/* Prevent writes. */ |
| 287 | # define F_SEAL_FUTURE_WRITE	0x0010	/* Prevent future writes while | |
| 288 | 					 mapped. */ | |
| 287 | 289 | #endif |
| 288 | 290 | |
| 289 | 291 | #ifdef __USE_GNU |
lib/libc/include/generic-glibc/bits/in.h+1| ... | ... | @@ -192,6 +192,7 @@ struct in_pktinfo |
| 192 | 192 | #define IPV6_JOIN_ANYCAST	27 |
| 193 | 193 | #define IPV6_LEAVE_ANYCAST	28 |
| 194 | 194 | #define IPV6_MULTICAST_ALL	29 |
| 195 | #define IPV6_ROUTER_ALERT_ISOLATE 30 | |
| 195 | 196 | #define IPV6_IPSEC_POLICY	34 |
| 196 | 197 | #define IPV6_XFRM_POLICY	35 |
| 197 | 198 | #define IPV6_HDRINCL		36 |
lib/libc/include/generic-glibc/bits/math-vector-fortran.h deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | ! No SIMD math functions are available for this platform. | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/signal_ext.h created+31| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | /* System-specific extensions of <signal.h>, Linux version. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SIGNAL_H | |
| 20 | # error "Never include <bits/signal_ext.h> directly; use <signal.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifdef __USE_GNU | |
| 24 | ||
| 25 | /* Send SIGNAL to the thread TID in the thread group (process) | |
| 26 | identified by TGID. This function behaves like kill, but also | |
| 27 | fails with ESRCH if the specified TID does not belong to the | |
| 28 | specified thread group. */ | |
| 29 | extern int tgkill (__pid_t __tgid, __pid_t __tid, int __signal); | |
| 30 | ||
| 31 | #endif /* __USE_GNU */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 1 | |
| 24 | #define SO_ACCEPTCONN 30 | |
| 25 | #define SO_BROADCAST 6 | |
| 26 | #define SO_DONTROUTE 5 | |
| 27 | #define SO_ERROR 4 | |
| 28 | #define SO_KEEPALIVE 9 | |
| 29 | #define SO_LINGER 13 | |
| 30 | #define SO_OOBINLINE 10 | |
| 31 | #define SO_RCVBUF 8 | |
| 32 | #define SO_RCVLOWAT 18 | |
| 33 | #define SO_RCVTIMEO 20 | |
| 34 | #define SO_REUSEADDR 2 | |
| 35 | #define SO_SNDBUF 7 | |
| 36 | #define SO_SNDLOWAT 19 | |
| 37 | #define SO_SNDTIMEO 21 | |
| 38 | #define SO_TYPE 3 | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/socket.h+6-92| ... | ... | @@ -349,98 +349,12 @@ struct ucred |
| 349 | 349 | }; |
| 350 | 350 | #endif |
| 351 | 351 | |
| 352 | /* Ugly workaround for unclean kernel headers. */ | |
| 353 | #ifndef __USE_MISC | |
| 354 | # ifndef FIOGETOWN | |
| 355 | # define __SYS_SOCKET_H_undef_FIOGETOWN | |
| 356 | # endif | |
| 357 | # ifndef FIOSETOWN | |
| 358 | # define __SYS_SOCKET_H_undef_FIOSETOWN | |
| 359 | # endif | |
| 360 | # ifndef SIOCATMARK | |
| 361 | # define __SYS_SOCKET_H_undef_SIOCATMARK | |
| 362 | # endif | |
| 363 | # ifndef SIOCGPGRP | |
| 364 | # define __SYS_SOCKET_H_undef_SIOCGPGRP | |
| 365 | # endif | |
| 366 | # ifndef SIOCGSTAMP | |
| 367 | # define __SYS_SOCKET_H_undef_SIOCGSTAMP | |
| 368 | # endif | |
| 369 | # ifndef SIOCGSTAMPNS | |
| 370 | # define __SYS_SOCKET_H_undef_SIOCGSTAMPNS | |
| 371 | # endif | |
| 372 | # ifndef SIOCSPGRP | |
| 373 | # define __SYS_SOCKET_H_undef_SIOCSPGRP | |
| 374 | # endif | |
| 375 | #endif | |
| 376 | #ifndef IOCSIZE_MASK | |
| 377 | # define __SYS_SOCKET_H_undef_IOCSIZE_MASK | |
| 378 | #endif | |
| 379 | #ifndef IOCSIZE_SHIFT | |
| 380 | # define __SYS_SOCKET_H_undef_IOCSIZE_SHIFT | |
| 381 | #endif | |
| 382 | #ifndef IOC_IN | |
| 383 | # define __SYS_SOCKET_H_undef_IOC_IN | |
| 384 | #endif | |
| 385 | #ifndef IOC_INOUT | |
| 386 | # define __SYS_SOCKET_H_undef_IOC_INOUT | |
| 387 | #endif | |
| 388 | #ifndef IOC_OUT | |
| 389 | # define __SYS_SOCKET_H_undef_IOC_OUT | |
| 390 | #endif | |
| 391 | ||
| 392 | /* Get socket manipulation related informations from kernel headers. */ | |
| 393 | #include <asm/socket.h> | |
| 394 | ||
| 395 | #ifndef __USE_MISC | |
| 396 | # ifdef __SYS_SOCKET_H_undef_FIOGETOWN | |
| 397 | # undef __SYS_SOCKET_H_undef_FIOGETOWN | |
| 398 | # undef FIOGETOWN | |
| 399 | # endif | |
| 400 | # ifdef __SYS_SOCKET_H_undef_FIOSETOWN | |
| 401 | # undef __SYS_SOCKET_H_undef_FIOSETOWN | |
| 402 | # undef FIOSETOWN | |
| 403 | # endif | |
| 404 | # ifdef __SYS_SOCKET_H_undef_SIOCATMARK | |
| 405 | # undef __SYS_SOCKET_H_undef_SIOCATMARK | |
| 406 | # undef SIOCATMARK | |
| 407 | # endif | |
| 408 | # ifdef __SYS_SOCKET_H_undef_SIOCGPGRP | |
| 409 | # undef __SYS_SOCKET_H_undef_SIOCGPGRP | |
| 410 | # undef SIOCGPGRP | |
| 411 | # endif | |
| 412 | # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP | |
| 413 | # undef __SYS_SOCKET_H_undef_SIOCGSTAMP | |
| 414 | # undef SIOCGSTAMP | |
| 415 | # endif | |
| 416 | # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS | |
| 417 | # undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS | |
| 418 | # undef SIOCGSTAMPNS | |
| 419 | # endif | |
| 420 | # ifdef __SYS_SOCKET_H_undef_SIOCSPGRP | |
| 421 | # undef __SYS_SOCKET_H_undef_SIOCSPGRP | |
| 422 | # undef SIOCSPGRP | |
| 423 | # endif | |
| 424 | #endif | |
| 425 | #ifdef __SYS_SOCKET_H_undef_IOCSIZE_MASK | |
| 426 | # undef __SYS_SOCKET_H_undef_IOCSIZE_MASK | |
| 427 | # undef IOCSIZE_MASK | |
| 428 | #endif | |
| 429 | #ifdef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT | |
| 430 | # undef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT | |
| 431 | # undef IOCSIZE_SHIFT | |
| 432 | #endif | |
| 433 | #ifdef __SYS_SOCKET_H_undef_IOC_IN | |
| 434 | # undef __SYS_SOCKET_H_undef_IOC_IN | |
| 435 | # undef IOC_IN | |
| 436 | #endif | |
| 437 | #ifdef __SYS_SOCKET_H_undef_IOC_INOUT | |
| 438 | # undef __SYS_SOCKET_H_undef_IOC_INOUT | |
| 439 | # undef IOC_INOUT | |
| 440 | #endif | |
| 441 | #ifdef __SYS_SOCKET_H_undef_IOC_OUT | |
| 442 | # undef __SYS_SOCKET_H_undef_IOC_OUT | |
| 443 | # undef IOC_OUT | |
| 352 | #ifdef __USE_MISC | |
| 353 | # include <bits/types/time_t.h> | |
| 354 | # include <asm/socket.h> | |
| 355 | #else | |
| 356 | # define SO_DEBUG 1 | |
| 357 | # include <bits/socket-constants.h> | |
| 444 | 358 | #endif |
| 445 | 359 | |
| 446 | 360 | /* Structure used to manipulate the SO_LINGER option. */ |
lib/libc/include/generic-glibc/bits/statx-generic.h created+60| ... | ... | @@ -0,0 +1,60 @@ |
| 1 | /* Generic statx-related definitions and declarations. | |
| 2 | Copyright (C) 2018-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | /* This interface is based on <linux/stat.h> in Linux. */ | |
| 20 | ||
| 21 | #ifndef _SYS_STAT_H | |
| 22 | # error Never include <bits/statx-generic.h> directly, include <sys/stat.h> instead. | |
| 23 | #endif | |
| 24 | ||
| 25 | #include <bits/types/struct_statx_timestamp.h> | |
| 26 | #include <bits/types/struct_statx.h> | |
| 27 | ||
| 28 | #ifndef STATX_TYPE | |
| 29 | # define STATX_TYPE 0x0001U | |
| 30 | # define STATX_MODE 0x0002U | |
| 31 | # define STATX_NLINK 0x0004U | |
| 32 | # define STATX_UID 0x0008U | |
| 33 | # define STATX_GID 0x0010U | |
| 34 | # define STATX_ATIME 0x0020U | |
| 35 | # define STATX_MTIME 0x0040U | |
| 36 | # define STATX_CTIME 0x0080U | |
| 37 | # define STATX_INO 0x0100U | |
| 38 | # define STATX_SIZE 0x0200U | |
| 39 | # define STATX_BLOCKS 0x0400U | |
| 40 | # define STATX_BASIC_STATS 0x07ffU | |
| 41 | # define STATX_ALL 0x0fffU | |
| 42 | # define STATX_BTIME 0x0800U | |
| 43 | # define STATX__RESERVED 0x80000000U | |
| 44 | ||
| 45 | # define STATX_ATTR_COMPRESSED 0x0004 | |
| 46 | # define STATX_ATTR_IMMUTABLE 0x0010 | |
| 47 | # define STATX_ATTR_APPEND 0x0020 | |
| 48 | # define STATX_ATTR_NODUMP 0x0040 | |
| 49 | # define STATX_ATTR_ENCRYPTED 0x0800 | |
| 50 | # define STATX_ATTR_AUTOMOUNT 0x1000 | |
| 51 | #endif /* !STATX_TYPE */ | |
| 52 | ||
| 53 | __BEGIN_DECLS | |
| 54 | ||
| 55 | /* Fill *BUF with information about PATH in DIRFD. */ | |
| 56 | int statx (int __dirfd, const char *__restrict __path, int __flags, | |
| 57 | unsigned int __mask, struct statx *__restrict __buf) | |
| 58 | __THROW __nonnull ((2, 5)); | |
| 59 | ||
| 60 | __END_DECLS | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/statx.h+13-67| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | /* statx-related definitions and declarations. | |
| 1 | /* statx-related definitions and declarations. Linux version. | |
| 2 | 2 | Copyright (C) 2018-2019 Free Software Foundation, Inc. |
| 3 | 3 | This file is part of the GNU C Library. |
| 4 | 4 | |
| ... | ... | @@ -19,73 +19,19 @@ |
| 19 | 19 | /* This interface is based on <linux/stat.h> in Linux. */ |
| 20 | 20 | |
| 21 | 21 | #ifndef _SYS_STAT_H |
| 22 | # error Never include <bits/stat.x.h> directly, include <sys/stat.h> instead. | |
| 22 | # error Never include <bits/statx.h> directly, include <sys/stat.h> instead. | |
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | struct statx_timestamp | |
| 26 | { | |
| 27 | __int64_t tv_sec; | |
| 28 | __uint32_t tv_nsec; | |
| 29 | __int32_t __statx_timestamp_pad1[1]; | |
| 30 | }; | |
| 25 | /* Use the Linux kernel header if available. */ | |
| 31 | 26 | |
| 32 | /* Warning: The kernel may add additional fields to this struct in the | |
| 33 | future. Only use this struct for calling the statx function, not | |
| 34 | for storing data. (Expansion will be controlled by the mask | |
| 35 | argument of the statx function.) */ | |
| 36 | struct statx | |
| 37 | { | |
| 38 | __uint32_t stx_mask; | |
| 39 | __uint32_t stx_blksize; | |
| 40 | __uint64_t stx_attributes; | |
| 41 | __uint32_t stx_nlink; | |
| 42 | __uint32_t stx_uid; | |
| 43 | __uint32_t stx_gid; | |
| 44 | __uint16_t stx_mode; | |
| 45 | __uint16_t __statx_pad1[1]; | |
| 46 | __uint64_t stx_ino; | |
| 47 | __uint64_t stx_size; | |
| 48 | __uint64_t stx_blocks; | |
| 49 | __uint64_t stx_attributes_mask; | |
| 50 | struct statx_timestamp stx_atime; | |
| 51 | struct statx_timestamp stx_btime; | |
| 52 | struct statx_timestamp stx_ctime; | |
| 53 | struct statx_timestamp stx_mtime; | |
| 54 | __uint32_t stx_rdev_major; | |
| 55 | __uint32_t stx_rdev_minor; | |
| 56 | __uint32_t stx_dev_major; | |
| 57 | __uint32_t stx_dev_minor; | |
| 58 | __uint64_t __statx_pad2[14]; | |
| 59 | }; | |
| 60 | ||
| 61 | #define STATX_TYPE 0x0001U | |
| 62 | #define STATX_MODE 0x0002U | |
| 63 | #define STATX_NLINK 0x0004U | |
| 64 | #define STATX_UID 0x0008U | |
| 65 | #define STATX_GID 0x0010U | |
| 66 | #define STATX_ATIME 0x0020U | |
| 67 | #define STATX_MTIME 0x0040U | |
| 68 | #define STATX_CTIME 0x0080U | |
| 69 | #define STATX_INO 0x0100U | |
| 70 | #define STATX_SIZE 0x0200U | |
| 71 | #define STATX_BLOCKS 0x0400U | |
| 72 | #define STATX_BASIC_STATS 0x07ffU | |
| 73 | #define STATX_ALL 0x0fffU | |
| 74 | #define STATX_BTIME 0x0800U | |
| 75 | #define STATX__RESERVED 0x80000000U | |
| 76 | ||
| 77 | #define STATX_ATTR_COMPRESSED 0x0004 | |
| 78 | #define STATX_ATTR_IMMUTABLE 0x0010 | |
| 79 | #define STATX_ATTR_APPEND 0x0020 | |
| 80 | #define STATX_ATTR_NODUMP 0x0040 | |
| 81 | #define STATX_ATTR_ENCRYPTED 0x0800 | |
| 82 | #define STATX_ATTR_AUTOMOUNT 0x1000 | |
| 83 | ||
| 84 | __BEGIN_DECLS | |
| 85 | ||
| 86 | /* Fill *BUF with information about PATH in DIRFD. */ | |
| 87 | int statx (int __dirfd, const char *__restrict __path, int __flags, | |
| 88 | unsigned int __mask, struct statx *__restrict __buf) | |
| 89 | __THROW __nonnull ((2, 5)); | |
| 27 | /* Use "" to work around incorrect macro expansion of the | |
| 28 | __has_include argument (GCC PR 80005). */ | |
| 29 | #if __glibc_has_include ("linux/stat.h") | |
| 30 | # include "linux/stat.h" | |
| 31 | # ifdef STATX_TYPE | |
| 32 | # define __statx_timestamp_defined 1 | |
| 33 | # define __statx_defined 1 | |
| 34 | # endif | |
| 35 | #endif | |
| 90 | 36 | |
| 91 | __END_DECLS | |
| \ No newline at end of file | ||
| 37 | #include <bits/statx-generic.h> | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/stropts.h deleted-230| ... | ... | @@ -1,230 +0,0 @@ |
| 1 | /* Copyright (C) 1998-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _STROPTS_H | |
| 19 | # error "Never include <bits/stropts.h> directly; use <stropts.h> instead." | |
| 20 | #endif | |
| 21 | ||
| 22 | #ifndef _BITS_STROPTS_H | |
| 23 | #define _BITS_STROPTS_H	1 | |
| 24 | ||
| 25 | #include <bits/types.h> | |
| 26 | ||
| 27 | /* Macros used as `request' argument to `ioctl'. */ | |
| 28 | #define __SID		('S' << 8) | |
| 29 | ||
| 30 | #define I_NREAD	 (__SID | 1)	/* Counts the number of data bytes in the data | |
| 31 | 				 block in the first message. */ | |
| 32 | #define I_PUSH	 (__SID | 2)	/* Push STREAMS module onto top of the current | |
| 33 | 				 STREAM, just below the STREAM head. */ | |
| 34 | #define I_POP	 (__SID | 3)	/* Remove STREAMS module from just below the | |
| 35 | 				 STREAM head. */ | |
| 36 | #define I_LOOK	 (__SID | 4)	/* Retrieve the name of the module just below | |
| 37 | 				 the STREAM head and place it in a character | |
| 38 | 				 string. */ | |
| 39 | #define I_FLUSH	 (__SID | 5)	/* Flush all input and/or output. */ | |
| 40 | #define I_SRDOPT (__SID | 6)	/* Sets the read mode. */ | |
| 41 | #define I_GRDOPT (__SID | 7)	/* Returns the current read mode setting. */ | |
| 42 | #define I_STR	 (__SID | 8)	/* Construct an internal STREAMS `ioctl' | |
| 43 | 				 message and send that message downstream. */ | |
| 44 | #define I_SETSIG (__SID | 9)	/* Inform the STREAM head that the process | |
| 45 | 				 wants the SIGPOLL signal issued. */ | |
| 46 | #define I_GETSIG (__SID |10) /* Return the events for which the calling | |
| 47 | 				 process is currently registered to be sent | |
| 48 | 				 a SIGPOLL signal. */ | |
| 49 | #define I_FIND	 (__SID |11) /* Compares the names of all modules currently | |
| 50 | 				 present in the STREAM to the name pointed to | |
| 51 | 				 by `arg'. */ | |
| 52 | #define I_LINK	 (__SID |12) /* Connect two STREAMs. */ | |
| 53 | #define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */ | |
| 54 | #define I_PEEK	 (__SID |15) /* Allows a process to retrieve the information | |
| 55 | 				 in the first message on the STREAM head read | |
| 56 | 				 queue without taking the message off the | |
| 57 | 				 queue. */ | |
| 58 | #define I_FDINSERT (__SID |16) /* Create a message from the specified | |
| 59 | 				 buffer(s), adds information about another | |
| 60 | 				 STREAM, and send the message downstream. */ | |
| 61 | #define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes' | |
| 62 | 				 to send a message, containing a file | |
| 63 | 				 pointer, to the STREAM head at the other end | |
| 64 | 				 of a STREAMS pipe. */ | |
| 65 | #define I_RECVFD (__SID |14) /* Non-EFT definition. */ | |
| 66 | #define I_SWROPT (__SID |19) /* Set the write mode. */ | |
| 67 | #define I_GWROPT (__SID |20) /* Return the current write mode setting. */ | |
| 68 | #define I_LIST	 (__SID |21) /* List all the module names on the STREAM, up | |
| 69 | 				 to and including the topmost driver name. */ | |
| 70 | #define I_PLINK	 (__SID |22) /* Connect two STREAMs with a persistent | |
| 71 | 				 link. */ | |
| 72 | #define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were | |
| 73 | 				 connected with a persistent link. */ | |
| 74 | #define I_FLUSHBAND (__SID |28) /* Flush only band specified. */ | |
| 75 | #define I_CKBAND (__SID |29) /* Check if the message of a given priority | |
| 76 | 				 band exists on the STREAM head read | |
| 77 | 				 queue. */ | |
| 78 | #define I_GETBAND (__SID |30) /* Return the priority band of the first | |
| 79 | 				 message on the STREAM head read queue. */ | |
| 80 | #define I_ATMARK (__SID |31) /* See if the current message on the STREAM | |
| 81 | 				 head read queue is "marked" by some module | |
| 82 | 				 downstream. */ | |
| 83 | #define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when | |
| 84 | 				 a STREAM is closing and there is data on | |
| 85 | 				 the write queues. */ | |
| 86 | #define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */ | |
| 87 | #define I_CANPUT (__SID |34) /* Check if a certain band is writable. */ | |
| 88 | ||
| 89 | ||
| 90 | /* Used in `I_LOOK' request. */ | |
| 91 | #define FMNAMESZ	8	/* compatibility w/UnixWare/Solaris. */ | |
| 92 | ||
| 93 | /* Flush options. */ | |
| 94 | #define FLUSHR		0x01	/* Flush read queues. */ | |
| 95 | #define FLUSHW		0x02	/* Flush write queues. */ | |
| 96 | #define FLUSHRW		0x03	/* Flush read and write queues. */ | |
| 97 | #ifdef __USE_GNU | |
| 98 | # define FLUSHBAND	0x04	/* Flush only specified band. */ | |
| 99 | #endif | |
| 100 | ||
| 101 | /* Possible arguments for `I_SETSIG'. */ | |
| 102 | #define S_INPUT		0x0001	/* A message, other than a high-priority | |
| 103 | 				 message, has arrived. */ | |
| 104 | #define S_HIPRI		0x0002	/* A high-priority message is present. */ | |
| 105 | #define S_OUTPUT	0x0004	/* The write queue for normal data is no longer | |
| 106 | 				 full. */ | |
| 107 | #define S_MSG		0x0008	/* A STREAMS signal message that contains the | |
| 108 | 				 SIGPOLL signal reaches the front of the | |
| 109 | 				 STREAM head read queue. */ | |
| 110 | #define S_ERROR		0x0010	/* Notification of an error condition. */ | |
| 111 | #define S_HANGUP	0x0020	/* Notification of a hangup. */ | |
| 112 | #define S_RDNORM	0x0040	/* A normal message has arrived. */ | |
| 113 | #define S_WRNORM	S_OUTPUT | |
| 114 | #define S_RDBAND	0x0080	/* A message with a non-zero priority has | |
| 115 | 				 arrived. */ | |
| 116 | #define S_WRBAND	0x0100	/* The write queue for a non-zero priority | |
| 117 | 				 band is no longer full. */ | |
| 118 | #define S_BANDURG	0x0200	/* When used in conjunction with S_RDBAND, | |
| 119 | 				 SIGURG is generated instead of SIGPOLL when | |
| 120 | 				 a priority message reaches the front of the | |
| 121 | 				 STREAM head read queue. */ | |
| 122 | ||
| 123 | /* Option for `I_PEEK'. */ | |
| 124 | #define RS_HIPRI	0x01	/* Only look for high-priority messages. */ | |
| 125 | ||
| 126 | /* Options for `I_SRDOPT'. */ | |
| 127 | #define RNORM		0x0000	/* Byte-STREAM mode, the default. */ | |
| 128 | #define RMSGD		0x0001	/* Message-discard mode. */ | |
| 129 | #define RMSGN		0x0002	/* Message-nondiscard mode. */ | |
| 130 | #define RPROTDAT	0x0004	/* Deliver the control part of a message as | |
| 131 | 				 data. */ | |
| 132 | #define RPROTDIS	0x0008	/* Discard the control part of a message, | |
| 133 | 				 delivering any data part. */ | |
| 134 | #define RPROTNORM	0x0010	/* Fail `read' with EBADMSG if a message | |
| 135 | 				 containing a control part is at the front | |
| 136 | 				 of the STREAM head read queue. */ | |
| 137 | #ifdef __USE_GNU | |
| 138 | # define RPROTMASK	0x001C	/* The RPROT bits */ | |
| 139 | #endif | |
| 140 | ||
| 141 | /* Possible mode for `I_SWROPT'. */ | |
| 142 | #define SNDZERO		0x001	/* Send a zero-length message downstream when a | |
| 143 | 				 `write' of 0 bytes occurs. */ | |
| 144 | #ifdef __USE_GNU | |
| 145 | # define SNDPIPE	0x002	/* Send SIGPIPE on write and putmsg if | |
| 146 | 				 sd_werror is set. */ | |
| 147 | #endif | |
| 148 | ||
| 149 | /* Arguments for `I_ATMARK'. */ | |
| 150 | #define ANYMARK		0x01	/* Check if the message is marked. */ | |
| 151 | #define LASTMARK	0x02	/* Check if the message is the last one marked | |
| 152 | 				 on the queue. */ | |
| 153 | ||
| 154 | /* Argument for `I_UNLINK'. */ | |
| 155 | #ifdef __USE_GNU | |
| 156 | # define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM | |
| 157 | 				 associated with `fildes'. */ | |
| 158 | #endif | |
| 159 | ||
| 160 | ||
| 161 | /* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */ | |
| 162 | #define MSG_HIPRI	0x01	/* Send/receive high priority message. */ | |
| 163 | #define MSG_ANY		0x02	/* Receive any message. */ | |
| 164 | #define MSG_BAND	0x04	/* Receive message from specified band. */ | |
| 165 | ||
| 166 | /* Values returned by getmsg and getpmsg */ | |
| 167 | #define MORECTL		1	/* More control information is left in | |
| 168 | 				 message. */ | |
| 169 | #define MOREDATA	2	/* More data is left in message. */ | |
| 170 | ||
| 171 | ||
| 172 | /* Structure used for the I_FLUSHBAND ioctl on streams. */ | |
| 173 | struct bandinfo | |
| 174 | { | |
| 175 | unsigned char bi_pri; | |
| 176 | int bi_flag; | |
| 177 | }; | |
| 178 | ||
| 179 | struct strbuf | |
| 180 | { | |
| 181 | int maxlen;		/* Maximum buffer length. */ | |
| 182 | int len;		/* Length of data. */ | |
| 183 | char *buf;		/* Pointer to buffer. */ | |
| 184 | }; | |
| 185 | ||
| 186 | struct strpeek | |
| 187 | { | |
| 188 | struct strbuf ctlbuf; | |
| 189 | struct strbuf databuf; | |
| 190 | t_uscalar_t flags;			/* UnixWare/Solaris compatibility. */ | |
| 191 | }; | |
| 192 | ||
| 193 | struct strfdinsert | |
| 194 | { | |
| 195 | struct strbuf ctlbuf; | |
| 196 | struct strbuf databuf; | |
| 197 | t_uscalar_t flags;			/* UnixWare/Solaris compatibility. */ | |
| 198 | int fildes; | |
| 199 | int offset; | |
| 200 | }; | |
| 201 | ||
| 202 | struct strioctl | |
| 203 | { | |
| 204 | int ic_cmd; | |
| 205 | int ic_timout; | |
| 206 | int ic_len; | |
| 207 | char *ic_dp; | |
| 208 | }; | |
| 209 | ||
| 210 | struct strrecvfd | |
| 211 | { | |
| 212 | int fd; | |
| 213 | uid_t uid; | |
| 214 | gid_t gid; | |
| 215 | char __fill[8];			/* UnixWare/Solaris compatibility */ | |
| 216 | }; | |
| 217 | ||
| 218 | ||
| 219 | struct str_mlist | |
| 220 | { | |
| 221 | char l_name[FMNAMESZ + 1]; | |
| 222 | }; | |
| 223 | ||
| 224 | struct str_list | |
| 225 | { | |
| 226 | int sl_nmods; | |
| 227 | struct str_mlist *sl_modlist; | |
| 228 | }; | |
| 229 | ||
| 230 | #endif /* bits/stropts.h */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/syscall.h+154-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | /* Generated at libc build time from syscall list. */ |
| 2 | /* The system call list corresponds to kernel 4.20. */ | |
| 2 | /* The system call list corresponds to kernel 5.2. */ | |
| 3 | 3 | |
| 4 | 4 | #ifndef _SYSCALL_H |
| 5 | 5 | # error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." |
| 6 | 6 | #endif |
| 7 | 7 | |
| 8 | #define __GLIBC_LINUX_VERSION_CODE 267264 | |
| 8 | #define __GLIBC_LINUX_VERSION_CODE 328192 | |
| 9 | 9 | |
| 10 | 10 | #ifdef __NR_FAST_atomic_update |
| 11 | 11 | # define SYS_FAST_atomic_update __NR_FAST_atomic_update |
| ... | ... | @@ -115,6 +115,10 @@ |
| 115 | 115 | # define SYS_break __NR_break |
| 116 | 116 | #endif |
| 117 | 117 | |
| 118 | #ifdef __NR_breakpoint | |
| 119 | # define SYS_breakpoint __NR_breakpoint | |
| 120 | #endif | |
| 121 | ||
| 118 | 122 | #ifdef __NR_brk |
| 119 | 123 | # define SYS_brk __NR_brk |
| 120 | 124 | #endif |
| ... | ... | @@ -159,22 +163,42 @@ |
| 159 | 163 | # define SYS_clock_adjtime __NR_clock_adjtime |
| 160 | 164 | #endif |
| 161 | 165 | |
| 166 | #ifdef __NR_clock_adjtime64 | |
| 167 | # define SYS_clock_adjtime64 __NR_clock_adjtime64 | |
| 168 | #endif | |
| 169 | ||
| 162 | 170 | #ifdef __NR_clock_getres |
| 163 | 171 | # define SYS_clock_getres __NR_clock_getres |
| 164 | 172 | #endif |
| 165 | 173 | |
| 174 | #ifdef __NR_clock_getres_time64 | |
| 175 | # define SYS_clock_getres_time64 __NR_clock_getres_time64 | |
| 176 | #endif | |
| 177 | ||
| 166 | 178 | #ifdef __NR_clock_gettime |
| 167 | 179 | # define SYS_clock_gettime __NR_clock_gettime |
| 168 | 180 | #endif |
| 169 | 181 | |
| 182 | #ifdef __NR_clock_gettime64 | |
| 183 | # define SYS_clock_gettime64 __NR_clock_gettime64 | |
| 184 | #endif | |
| 185 | ||
| 170 | 186 | #ifdef __NR_clock_nanosleep |
| 171 | 187 | # define SYS_clock_nanosleep __NR_clock_nanosleep |
| 172 | 188 | #endif |
| 173 | 189 | |
| 190 | #ifdef __NR_clock_nanosleep_time64 | |
| 191 | # define SYS_clock_nanosleep_time64 __NR_clock_nanosleep_time64 | |
| 192 | #endif | |
| 193 | ||
| 174 | 194 | #ifdef __NR_clock_settime |
| 175 | 195 | # define SYS_clock_settime __NR_clock_settime |
| 176 | 196 | #endif |
| 177 | 197 | |
| 198 | #ifdef __NR_clock_settime64 | |
| 199 | # define SYS_clock_settime64 __NR_clock_settime64 | |
| 200 | #endif | |
| 201 | ||
| 178 | 202 | #ifdef __NR_clone |
| 179 | 203 | # define SYS_clone __NR_clone |
| 180 | 204 | #endif |
| ... | ... | @@ -367,6 +391,10 @@ |
| 367 | 391 | # define SYS_fork __NR_fork |
| 368 | 392 | #endif |
| 369 | 393 | |
| 394 | #ifdef __NR_fp_udfiex_crtl | |
| 395 | # define SYS_fp_udfiex_crtl __NR_fp_udfiex_crtl | |
| 396 | #endif | |
| 397 | ||
| 370 | 398 | #ifdef __NR_free_hugepages |
| 371 | 399 | # define SYS_free_hugepages __NR_free_hugepages |
| 372 | 400 | #endif |
| ... | ... | @@ -375,10 +403,26 @@ |
| 375 | 403 | # define SYS_fremovexattr __NR_fremovexattr |
| 376 | 404 | #endif |
| 377 | 405 | |
| 406 | #ifdef __NR_fsconfig | |
| 407 | # define SYS_fsconfig __NR_fsconfig | |
| 408 | #endif | |
| 409 | ||
| 378 | 410 | #ifdef __NR_fsetxattr |
| 379 | 411 | # define SYS_fsetxattr __NR_fsetxattr |
| 380 | 412 | #endif |
| 381 | 413 | |
| 414 | #ifdef __NR_fsmount | |
| 415 | # define SYS_fsmount __NR_fsmount | |
| 416 | #endif | |
| 417 | ||
| 418 | #ifdef __NR_fsopen | |
| 419 | # define SYS_fsopen __NR_fsopen | |
| 420 | #endif | |
| 421 | ||
| 422 | #ifdef __NR_fspick | |
| 423 | # define SYS_fspick __NR_fspick | |
| 424 | #endif | |
| 425 | ||
| 382 | 426 | #ifdef __NR_fstat |
| 383 | 427 | # define SYS_fstat __NR_fstat |
| 384 | 428 | #endif |
| ... | ... | @@ -419,6 +463,10 @@ |
| 419 | 463 | # define SYS_futex __NR_futex |
| 420 | 464 | #endif |
| 421 | 465 | |
| 466 | #ifdef __NR_futex_time64 | |
| 467 | # define SYS_futex_time64 __NR_futex_time64 | |
| 468 | #endif | |
| 469 | ||
| 422 | 470 | #ifdef __NR_futimesat |
| 423 | 471 | # define SYS_futimesat __NR_futimesat |
| 424 | 472 | #endif |
| ... | ... | @@ -439,6 +487,10 @@ |
| 439 | 487 | # define SYS_get_thread_area __NR_get_thread_area |
| 440 | 488 | #endif |
| 441 | 489 | |
| 490 | #ifdef __NR_get_tls | |
| 491 | # define SYS_get_tls __NR_get_tls | |
| 492 | #endif | |
| 493 | ||
| 442 | 494 | #ifdef __NR_getcpu |
| 443 | 495 | # define SYS_getcpu __NR_getcpu |
| 444 | 496 | #endif |
| ... | ... | @@ -655,6 +707,10 @@ |
| 655 | 707 | # define SYS_io_pgetevents __NR_io_pgetevents |
| 656 | 708 | #endif |
| 657 | 709 | |
| 710 | #ifdef __NR_io_pgetevents_time64 | |
| 711 | # define SYS_io_pgetevents_time64 __NR_io_pgetevents_time64 | |
| 712 | #endif | |
| 713 | ||
| 658 | 714 | #ifdef __NR_io_setup |
| 659 | 715 | # define SYS_io_setup __NR_io_setup |
| 660 | 716 | #endif |
| ... | ... | @@ -663,6 +719,18 @@ |
| 663 | 719 | # define SYS_io_submit __NR_io_submit |
| 664 | 720 | #endif |
| 665 | 721 | |
| 722 | #ifdef __NR_io_uring_enter | |
| 723 | # define SYS_io_uring_enter __NR_io_uring_enter | |
| 724 | #endif | |
| 725 | ||
| 726 | #ifdef __NR_io_uring_register | |
| 727 | # define SYS_io_uring_register __NR_io_uring_register | |
| 728 | #endif | |
| 729 | ||
| 730 | #ifdef __NR_io_uring_setup | |
| 731 | # define SYS_io_uring_setup __NR_io_uring_setup | |
| 732 | #endif | |
| 733 | ||
| 666 | 734 | #ifdef __NR_ioctl |
| 667 | 735 | # define SYS_ioctl __NR_ioctl |
| 668 | 736 | #endif |
| ... | ... | @@ -847,6 +915,10 @@ |
| 847 | 915 | # define SYS_mount __NR_mount |
| 848 | 916 | #endif |
| 849 | 917 | |
| 918 | #ifdef __NR_move_mount | |
| 919 | # define SYS_move_mount __NR_move_mount | |
| 920 | #endif | |
| 921 | ||
| 850 | 922 | #ifdef __NR_move_pages |
| 851 | 923 | # define SYS_move_pages __NR_move_pages |
| 852 | 924 | #endif |
| ... | ... | @@ -875,10 +947,18 @@ |
| 875 | 947 | # define SYS_mq_timedreceive __NR_mq_timedreceive |
| 876 | 948 | #endif |
| 877 | 949 | |
| 950 | #ifdef __NR_mq_timedreceive_time64 | |
| 951 | # define SYS_mq_timedreceive_time64 __NR_mq_timedreceive_time64 | |
| 952 | #endif | |
| 953 | ||
| 878 | 954 | #ifdef __NR_mq_timedsend |
| 879 | 955 | # define SYS_mq_timedsend __NR_mq_timedsend |
| 880 | 956 | #endif |
| 881 | 957 | |
| 958 | #ifdef __NR_mq_timedsend_time64 | |
| 959 | # define SYS_mq_timedsend_time64 __NR_mq_timedsend_time64 | |
| 960 | #endif | |
| 961 | ||
| 882 | 962 | #ifdef __NR_mq_unlink |
| 883 | 963 | # define SYS_mq_unlink __NR_mq_unlink |
| 884 | 964 | #endif |
| ... | ... | @@ -951,6 +1031,10 @@ |
| 951 | 1031 | # define SYS_old_adjtimex __NR_old_adjtimex |
| 952 | 1032 | #endif |
| 953 | 1033 | |
| 1034 | #ifdef __NR_old_getpagesize | |
| 1035 | # define SYS_old_getpagesize __NR_old_getpagesize | |
| 1036 | #endif | |
| 1037 | ||
| 954 | 1038 | #ifdef __NR_oldfstat |
| 955 | 1039 | # define SYS_oldfstat __NR_oldfstat |
| 956 | 1040 | #endif |
| ... | ... | @@ -983,6 +1067,10 @@ |
| 983 | 1067 | # define SYS_open_by_handle_at __NR_open_by_handle_at |
| 984 | 1068 | #endif |
| 985 | 1069 | |
| 1070 | #ifdef __NR_open_tree | |
| 1071 | # define SYS_open_tree __NR_open_tree | |
| 1072 | #endif | |
| 1073 | ||
| 986 | 1074 | #ifdef __NR_openat |
| 987 | 1075 | # define SYS_openat __NR_openat |
| 988 | 1076 | #endif |
| ... | ... | @@ -1459,6 +1547,10 @@ |
| 1459 | 1547 | # define SYS_personality __NR_personality |
| 1460 | 1548 | #endif |
| 1461 | 1549 | |
| 1550 | #ifdef __NR_pidfd_send_signal | |
| 1551 | # define SYS_pidfd_send_signal __NR_pidfd_send_signal | |
| 1552 | #endif | |
| 1553 | ||
| 1462 | 1554 | #ifdef __NR_pipe |
| 1463 | 1555 | # define SYS_pipe __NR_pipe |
| 1464 | 1556 | #endif |
| ... | ... | @@ -1491,6 +1583,10 @@ |
| 1491 | 1583 | # define SYS_ppoll __NR_ppoll |
| 1492 | 1584 | #endif |
| 1493 | 1585 | |
| 1586 | #ifdef __NR_ppoll_time64 | |
| 1587 | # define SYS_ppoll_time64 __NR_ppoll_time64 | |
| 1588 | #endif | |
| 1589 | ||
| 1494 | 1590 | #ifdef __NR_prctl |
| 1495 | 1591 | # define SYS_prctl __NR_prctl |
| 1496 | 1592 | #endif |
| ... | ... | @@ -1531,6 +1627,10 @@ |
| 1531 | 1627 | # define SYS_pselect6 __NR_pselect6 |
| 1532 | 1628 | #endif |
| 1533 | 1629 | |
| 1630 | #ifdef __NR_pselect6_time64 | |
| 1631 | # define SYS_pselect6_time64 __NR_pselect6_time64 | |
| 1632 | #endif | |
| 1633 | ||
| 1534 | 1634 | #ifdef __NR_ptrace |
| 1535 | 1635 | # define SYS_ptrace __NR_ptrace |
| 1536 | 1636 | #endif |
| ... | ... | @@ -1599,6 +1699,10 @@ |
| 1599 | 1699 | # define SYS_recvmmsg __NR_recvmmsg |
| 1600 | 1700 | #endif |
| 1601 | 1701 | |
| 1702 | #ifdef __NR_recvmmsg_time64 | |
| 1703 | # define SYS_recvmmsg_time64 __NR_recvmmsg_time64 | |
| 1704 | #endif | |
| 1705 | ||
| 1602 | 1706 | #ifdef __NR_recvmsg |
| 1603 | 1707 | # define SYS_recvmsg __NR_recvmsg |
| 1604 | 1708 | #endif |
| ... | ... | @@ -1671,6 +1775,10 @@ |
| 1671 | 1775 | # define SYS_rt_sigtimedwait __NR_rt_sigtimedwait |
| 1672 | 1776 | #endif |
| 1673 | 1777 | |
| 1778 | #ifdef __NR_rt_sigtimedwait_time64 | |
| 1779 | # define SYS_rt_sigtimedwait_time64 __NR_rt_sigtimedwait_time64 | |
| 1780 | #endif | |
| 1781 | ||
| 1674 | 1782 | #ifdef __NR_rt_tgsigqueueinfo |
| 1675 | 1783 | # define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo |
| 1676 | 1784 | #endif |
| ... | ... | @@ -1731,6 +1839,10 @@ |
| 1731 | 1839 | # define SYS_sched_rr_get_interval __NR_sched_rr_get_interval |
| 1732 | 1840 | #endif |
| 1733 | 1841 | |
| 1842 | #ifdef __NR_sched_rr_get_interval_time64 | |
| 1843 | # define SYS_sched_rr_get_interval_time64 __NR_sched_rr_get_interval_time64 | |
| 1844 | #endif | |
| 1845 | ||
| 1734 | 1846 | #ifdef __NR_sched_set_affinity |
| 1735 | 1847 | # define SYS_sched_set_affinity __NR_sched_set_affinity |
| 1736 | 1848 | #endif |
| ... | ... | @@ -1783,6 +1895,10 @@ |
| 1783 | 1895 | # define SYS_semtimedop __NR_semtimedop |
| 1784 | 1896 | #endif |
| 1785 | 1897 | |
| 1898 | #ifdef __NR_semtimedop_time64 | |
| 1899 | # define SYS_semtimedop_time64 __NR_semtimedop_time64 | |
| 1900 | #endif | |
| 1901 | ||
| 1786 | 1902 | #ifdef __NR_send |
| 1787 | 1903 | # define SYS_send __NR_send |
| 1788 | 1904 | #endif |
| ... | ... | @@ -1823,6 +1939,10 @@ |
| 1823 | 1939 | # define SYS_set_tid_address __NR_set_tid_address |
| 1824 | 1940 | #endif |
| 1825 | 1941 | |
| 1942 | #ifdef __NR_set_tls | |
| 1943 | # define SYS_set_tls __NR_set_tls | |
| 1944 | #endif | |
| 1945 | ||
| 1826 | 1946 | #ifdef __NR_setdomainname |
| 1827 | 1947 | # define SYS_setdomainname __NR_setdomainname |
| 1828 | 1948 | #endif |
| ... | ... | @@ -2171,10 +2291,18 @@ |
| 2171 | 2291 | # define SYS_timer_gettime __NR_timer_gettime |
| 2172 | 2292 | #endif |
| 2173 | 2293 | |
| 2294 | #ifdef __NR_timer_gettime64 | |
| 2295 | # define SYS_timer_gettime64 __NR_timer_gettime64 | |
| 2296 | #endif | |
| 2297 | ||
| 2174 | 2298 | #ifdef __NR_timer_settime |
| 2175 | 2299 | # define SYS_timer_settime __NR_timer_settime |
| 2176 | 2300 | #endif |
| 2177 | 2301 | |
| 2302 | #ifdef __NR_timer_settime64 | |
| 2303 | # define SYS_timer_settime64 __NR_timer_settime64 | |
| 2304 | #endif | |
| 2305 | ||
| 2178 | 2306 | #ifdef __NR_timerfd |
| 2179 | 2307 | # define SYS_timerfd __NR_timerfd |
| 2180 | 2308 | #endif |
| ... | ... | @@ -2187,10 +2315,18 @@ |
| 2187 | 2315 | # define SYS_timerfd_gettime __NR_timerfd_gettime |
| 2188 | 2316 | #endif |
| 2189 | 2317 | |
| 2318 | #ifdef __NR_timerfd_gettime64 | |
| 2319 | # define SYS_timerfd_gettime64 __NR_timerfd_gettime64 | |
| 2320 | #endif | |
| 2321 | ||
| 2190 | 2322 | #ifdef __NR_timerfd_settime |
| 2191 | 2323 | # define SYS_timerfd_settime __NR_timerfd_settime |
| 2192 | 2324 | #endif |
| 2193 | 2325 | |
| 2326 | #ifdef __NR_timerfd_settime64 | |
| 2327 | # define SYS_timerfd_settime64 __NR_timerfd_settime64 | |
| 2328 | #endif | |
| 2329 | ||
| 2194 | 2330 | #ifdef __NR_times |
| 2195 | 2331 | # define SYS_times __NR_times |
| 2196 | 2332 | #endif |
| ... | ... | @@ -2211,6 +2347,10 @@ |
| 2211 | 2347 | # define SYS_tuxcall __NR_tuxcall |
| 2212 | 2348 | #endif |
| 2213 | 2349 | |
| 2350 | #ifdef __NR_udftrap | |
| 2351 | # define SYS_udftrap __NR_udftrap | |
| 2352 | #endif | |
| 2353 | ||
| 2214 | 2354 | #ifdef __NR_ugetrlimit |
| 2215 | 2355 | # define SYS_ugetrlimit __NR_ugetrlimit |
| 2216 | 2356 | #endif |
| ... | ... | @@ -2255,6 +2395,14 @@ |
| 2255 | 2395 | # define SYS_userfaultfd __NR_userfaultfd |
| 2256 | 2396 | #endif |
| 2257 | 2397 | |
| 2398 | #ifdef __NR_usr26 | |
| 2399 | # define SYS_usr26 __NR_usr26 | |
| 2400 | #endif | |
| 2401 | ||
| 2402 | #ifdef __NR_usr32 | |
| 2403 | # define SYS_usr32 __NR_usr32 | |
| 2404 | #endif | |
| 2405 | ||
| 2258 | 2406 | #ifdef __NR_ustat |
| 2259 | 2407 | # define SYS_ustat __NR_ustat |
| 2260 | 2408 | #endif |
| ... | ... | @@ -2267,6 +2415,10 @@ |
| 2267 | 2415 | # define SYS_utimensat __NR_utimensat |
| 2268 | 2416 | #endif |
| 2269 | 2417 | |
| 2418 | #ifdef __NR_utimensat_time64 | |
| 2419 | # define SYS_utimensat_time64 __NR_utimensat_time64 | |
| 2420 | #endif | |
| 2421 | ||
| 2270 | 2422 | #ifdef __NR_utimes |
| 2271 | 2423 | # define SYS_utimes __NR_utimes |
| 2272 | 2424 | #endif |
lib/libc/include/generic-glibc/bits/types.h+11-8| ... | ... | @@ -87,7 +87,7 @@ __extension__ typedef unsigned long long int __uintmax_t; |
| 87 | 87 | 	32		-- "natural" 32-bit type (always int) |
| 88 | 88 | 	64		-- "natural" 64-bit type (long or long long) |
| 89 | 89 | 	LONG32		-- 32-bit type, traditionally long |
| 90 | 	QUAD		-- 64-bit type, always long long | |
| 90 | 	QUAD		-- 64-bit type, traditionally long long | |
| 91 | 91 | 	WORD		-- natural type of __WORDSIZE bits (int or long) |
| 92 | 92 | 	LONGWORD	-- type of __WORDSIZE bits, traditionally long |
| 93 | 93 | |
| ... | ... | @@ -113,14 +113,14 @@ __extension__ typedef unsigned long long int __uintmax_t; |
| 113 | 113 | #define __SLONGWORD_TYPE	long int |
| 114 | 114 | #define __ULONGWORD_TYPE	unsigned long int |
| 115 | 115 | #if __WORDSIZE == 32 |
| 116 | # define __SQUAD_TYPE		__quad_t | |
| 117 | # define __UQUAD_TYPE		__u_quad_t | |
| 116 | # define __SQUAD_TYPE		__int64_t | |
| 117 | # define __UQUAD_TYPE		__uint64_t | |
| 118 | 118 | # define __SWORD_TYPE		int |
| 119 | 119 | # define __UWORD_TYPE		unsigned int |
| 120 | 120 | # define __SLONG32_TYPE		long int |
| 121 | 121 | # define __ULONG32_TYPE		unsigned long int |
| 122 | # define __S64_TYPE		__quad_t | |
| 123 | # define __U64_TYPE		__u_quad_t | |
| 122 | # define __S64_TYPE		__int64_t | |
| 123 | # define __U64_TYPE		__uint64_t | |
| 124 | 124 | /* We want __extension__ before typedef's that use nonstandard base types |
| 125 | 125 | such as `long long' in C89 mode. */ |
| 126 | 126 | # define __STD_TYPE		__extension__ typedef |
| ... | ... | @@ -213,10 +213,13 @@ __STD_TYPE __U32_TYPE __socklen_t; |
| 213 | 213 | It is not currently necessary for this to be machine-specific. */ |
| 214 | 214 | typedef int __sig_atomic_t; |
| 215 | 215 | |
| 216 | #if __TIMESIZE == 64 | |
| 216 | /* Seconds since the Epoch, visible to user code when time_t is too | |
| 217 | narrow only for consistency with the old way of widening too-narrow | |
| 218 | types. User code should never use __time64_t. */ | |
| 219 | #if __TIMESIZE == 64 && defined __LIBC | |
| 217 | 220 | # define __time64_t __time_t |
| 218 | #else | |
| 219 | __STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch. */ | |
| 221 | #elif __TIMESIZE != 64 | |
| 222 | __STD_TYPE __TIME64_T_TYPE __time64_t; | |
| 220 | 223 | #endif |
| 221 | 224 | |
| 222 | 225 | #undef __STD_TYPE |
lib/libc/include/generic-glibc/bits/types/struct_statx.h created+55| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | /* Definition of the generic version of struct statx. | |
| 2 | Copyright (C) 2018-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_STAT_H | |
| 20 | # error Never include <bits/types/struct_statx.h> directly, include <sys/stat.h> instead. | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef __statx_defined | |
| 24 | #define __statx_defined 1 | |
| 25 | ||
| 26 | /* Warning: The kernel may add additional fields to this struct in the | |
| 27 | future. Only use this struct for calling the statx function, not | |
| 28 | for storing data. (Expansion will be controlled by the mask | |
| 29 | argument of the statx function.) */ | |
| 30 | struct statx | |
| 31 | { | |
| 32 | __uint32_t stx_mask; | |
| 33 | __uint32_t stx_blksize; | |
| 34 | __uint64_t stx_attributes; | |
| 35 | __uint32_t stx_nlink; | |
| 36 | __uint32_t stx_uid; | |
| 37 | __uint32_t stx_gid; | |
| 38 | __uint16_t stx_mode; | |
| 39 | __uint16_t __statx_pad1[1]; | |
| 40 | __uint64_t stx_ino; | |
| 41 | __uint64_t stx_size; | |
| 42 | __uint64_t stx_blocks; | |
| 43 | __uint64_t stx_attributes_mask; | |
| 44 | struct statx_timestamp stx_atime; | |
| 45 | struct statx_timestamp stx_btime; | |
| 46 | struct statx_timestamp stx_ctime; | |
| 47 | struct statx_timestamp stx_mtime; | |
| 48 | __uint32_t stx_rdev_major; | |
| 49 | __uint32_t stx_rdev_minor; | |
| 50 | __uint32_t stx_dev_major; | |
| 51 | __uint32_t stx_dev_minor; | |
| 52 | __uint64_t __statx_pad2[14]; | |
| 53 | }; | |
| 54 | ||
| 55 | #endif /* __statx_defined */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/types/struct_statx_timestamp.h created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | /* Definition of the generic version of struct statx_timestamp. | |
| 2 | Copyright (C) 2018-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_STAT_H | |
| 20 | # error Never include <bits/types/struct_statx_timestamp.h> directly, include <sys/stat.h> instead. | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef __statx_timestamp_defined | |
| 24 | #define __statx_timestamp_defined 1 | |
| 25 | ||
| 26 | struct statx_timestamp | |
| 27 | { | |
| 28 | __int64_t tv_sec; | |
| 29 | __uint32_t tv_nsec; | |
| 30 | __int32_t __statx_timestamp_pad1[1]; | |
| 31 | }; | |
| 32 | ||
| 33 | #endif /* __statx_timestamp_defined */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/bits/xtitypes.h deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. Generic. | |
| 2 | Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _STROPTS_H | |
| 20 | # error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_XTITYPES_H | |
| 24 | #define _BITS_XTITYPES_H	1 | |
| 25 | ||
| 26 | #include <bits/types.h> | |
| 27 | ||
| 28 | /* This type is used by some structs in <bits/stropts.h>. */ | |
| 29 | typedef __SLONGWORD_TYPE __t_scalar_t; | |
| 30 | typedef __ULONGWORD_TYPE __t_uscalar_t; | |
| 31 | ||
| 32 | ||
| 33 | #endif /* bits/xtitypes.h */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/dirent.h+2| ... | ... | @@ -401,4 +401,6 @@ extern int versionsort64 (const struct dirent64 **__e1, |
| 401 | 401 | |
| 402 | 402 | __END_DECLS |
| 403 | 403 | |
| 404 | #include <bits/dirent_ext.h> | |
| 405 | ||
| 404 | 406 | #endif /* dirent.h */ |
| \ No newline at end of file |
lib/libc/include/generic-glibc/dlfcn.h+12| ... | ... | @@ -180,7 +180,19 @@ typedef struct |
| 180 | 180 | { |
| 181 | 181 | size_t dls_size;		/* Size in bytes of the whole buffer. */ |
| 182 | 182 | unsigned int dls_cnt;		/* Number of elements in `dls_serpath'. */ |
| 183 | # if __GNUC_PREREQ (3, 0) | |
| 184 | /* The zero-length array avoids an unwanted array subscript check by | |
| 185 | the compiler, while the surrounding anonymous union preserves the | |
| 186 | historic size of the type. At the time of writing, GNU C does | |
| 187 | not support structs with flexible array members in unions. */ | |
| 188 | __extension__ union | |
| 189 | { | |
| 190 | Dl_serpath dls_serpath[0]; /* Actually longer, dls_cnt elements. */ | |
| 191 | Dl_serpath __dls_serpath_pad[1]; | |
| 192 | }; | |
| 193 | # else | |
| 183 | 194 | Dl_serpath dls_serpath[1];	/* Actually longer, dls_cnt elements. */ |
| 195 | # endif | |
| 184 | 196 | } Dl_serinfo; |
| 185 | 197 | #endif /* __USE_GNU */ |
| 186 | 198 |
lib/libc/include/generic-glibc/elf.h+30-2| ... | ... | @@ -360,7 +360,7 @@ typedef struct |
| 360 | 360 | #define EM_RISCV	243	/* RISC-V */ |
| 361 | 361 | |
| 362 | 362 | #define EM_BPF		247	/* Linux BPF -- in-kernel virtual machine */ |
| 363 | #define EM_CSKY		252 /* C_SKY */ | |
| 363 | #define EM_CSKY		252 /* C-SKY */ | |
| 364 | 364 | |
| 365 | 365 | #define EM_NUM		253 |
| 366 | 366 | |
| ... | ... | @@ -809,9 +809,16 @@ typedef struct |
| 809 | 809 | #define NT_ARM_SYSTEM_CALL	0x404	/* ARM system call number */ |
| 810 | 810 | #define NT_ARM_SVE	0x405		/* ARM Scalable Vector Extension |
| 811 | 811 | 					 registers */ |
| 812 | #define NT_ARM_PAC_MASK	0x406		/* ARM pointer authentication | |
| 813 | 					 code masks. */ | |
| 814 | #define NT_ARM_PACA_KEYS	0x407	/* ARM pointer authentication | |
| 815 | 					 address keys. */ | |
| 816 | #define NT_ARM_PACG_KEYS	0x408	/* ARM pointer authentication | |
| 817 | 					 generic key. */ | |
| 812 | 818 | #define NT_VMCOREDD	0x700		/* Vmcore Device Dump Note. */ |
| 813 | 819 | #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers. */ |
| 814 | 820 | #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode. */ |
| 821 | #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers. */ | |
| 815 | 822 | |
| 816 | 823 | /* Legal values for the note segment descriptor types for object files. */ |
| 817 | 824 | |
| ... | ... | @@ -987,6 +994,9 @@ typedef struct |
| 987 | 994 | #define	DF_1_SINGLETON	0x02000000	/* Singleton symbols are used. */ |
| 988 | 995 | #define	DF_1_STUB	0x04000000 |
| 989 | 996 | #define	DF_1_PIE	0x08000000 |
| 997 | #define	DF_1_KMOD 0x10000000 | |
| 998 | #define	DF_1_WEAKFILTER 0x20000000 | |
| 999 | #define	DF_1_NOCOMMON 0x40000000 | |
| 990 | 1000 | |
| 991 | 1001 | /* Flags for the feature selection in DT_FEATURE_1. */ |
| 992 | 1002 | #define DTF_1_PARINIT	0x00000001 |
| ... | ... | @@ -2854,6 +2864,13 @@ enum |
| 2854 | 2864 | #define R_AARCH64_TLSDESC 1031	/* TLS Descriptor. */ |
| 2855 | 2865 | #define R_AARCH64_IRELATIVE	1032	/* STT_GNU_IFUNC relocation. */ |
| 2856 | 2866 | |
| 2867 | /* AArch64 specific values for the Dyn d_tag field. */ | |
| 2868 | #define DT_AARCH64_VARIANT_PCS	(DT_LOPROC + 5) | |
| 2869 | #define DT_AARCH64_NUM		6 | |
| 2870 | ||
| 2871 | /* AArch64 specific values for the st_other field. */ | |
| 2872 | #define STO_AARCH64_VARIANT_PCS 0x80 | |
| 2873 | ||
| 2857 | 2874 | /* ARM relocs. */ |
| 2858 | 2875 | |
| 2859 | 2876 | #define R_ARM_NONE		0	/* No reloc */ |
| ... | ... | @@ -3022,7 +3039,7 @@ enum |
| 3022 | 3039 | /* Keep this the last entry. */ |
| 3023 | 3040 | #define R_ARM_NUM		256 |
| 3024 | 3041 | |
| 3025 | /* csky */ | |
| 3042 | /* C-SKY */ | |
| 3026 | 3043 | #define R_CKCORE_NONE 0	/* no reloc */ |
| 3027 | 3044 | #define R_CKCORE_ADDR32 1	/* direct 32 bit (S + A) */ |
| 3028 | 3045 | #define R_CKCORE_PCRELIMM8BY4 2	/* disp ((S + A - P) >> 2) & 0xff */ |
| ... | ... | @@ -3086,6 +3103,17 @@ enum |
| 3086 | 3103 | #define R_CKCORE_TLS_DTPOFF32 57 |
| 3087 | 3104 | #define R_CKCORE_TLS_TPOFF32 58 |
| 3088 | 3105 | |
| 3106 | /* C-SKY elf header definition. */ | |
| 3107 | #define EF_CSKY_ABIMASK		 0XF0000000 | |
| 3108 | #define EF_CSKY_OTHER		 0X0FFF0000 | |
| 3109 | #define EF_CSKY_PROCESSOR	 0X0000FFFF | |
| 3110 | ||
| 3111 | #define EF_CSKY_ABIV1		 0X10000000 | |
| 3112 | #define EF_CSKY_ABIV2		 0X20000000 | |
| 3113 | ||
| 3114 | /* C-SKY attributes section. */ | |
| 3115 | #define SHT_CSKY_ATTRIBUTES	 (SHT_LOPROC + 1) | |
| 3116 | ||
| 3089 | 3117 | /* IA-64 specific declarations. */ |
| 3090 | 3118 | |
| 3091 | 3119 | /* Processor specific flags for the Ehdr e_flags field. */ |
lib/libc/include/generic-glibc/features.h+1-1| ... | ... | @@ -439,7 +439,7 @@ |
| 439 | 439 | /* Major and minor version number of the GNU C library package. Use |
| 440 | 440 | these macros to test for features in specific releases. */ |
| 441 | 441 | #define	__GLIBC__	2 |
| 442 | #define	__GLIBC_MINOR__	29 | |
| 442 | #define	__GLIBC_MINOR__	30 | |
| 443 | 443 | |
| 444 | 444 | #define __GLIBC_PREREQ(maj, min) \ |
| 445 | 445 | 	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) |
lib/libc/include/generic-glibc/finclude/math-vector-fortran.h created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | ! No SIMD math functions are available for this platform. | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/gconv.h+2-9| ... | ... | @@ -86,6 +86,8 @@ struct __gconv_step |
| 86 | 86 | struct __gconv_loaded_object *__shlib_handle; |
| 87 | 87 | const char *__modname; |
| 88 | 88 | |
| 89 | /* For internal use by glibc. (Accesses to this member must occur | |
| 90 | when the internal __gconv_lock mutex is acquired). */ | |
| 89 | 91 | int __counter; |
| 90 | 92 | |
| 91 | 93 | char *__from_name; |
| ... | ... | @@ -142,13 +144,4 @@ typedef struct __gconv_info |
| 142 | 144 | __extension__ struct __gconv_step_data __data[0]; |
| 143 | 145 | } *__gconv_t; |
| 144 | 146 | |
| 145 | /* Transliteration using the locale's data. */ | |
| 146 | extern int __gconv_transliterate (struct __gconv_step *step, | |
| 147 | 				 struct __gconv_step_data *step_data, | |
| 148 | 				 const unsigned char *inbufstart, | |
| 149 | 				 const unsigned char **inbufp, | |
| 150 | 				 const unsigned char *inbufend, | |
| 151 | 				 unsigned char **outbufstart, | |
| 152 | 				 size_t *irreversible); | |
| 153 | ||
| 154 | 147 | #endif /* gconv.h */ |
| \ No newline at end of file |
lib/libc/include/generic-glibc/gnu/stubs-32.h-2| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | 10 | #define __stub_chflags |
| 11 | #define __stub_fattach | |
| 12 | 11 | #define __stub_fchflags |
| 13 | #define __stub_fdetach | |
| 14 | 12 | #define __stub_gtty |
| 15 | 13 | #define __stub_lchmod |
| 16 | 14 | #define __stub_revoke |
lib/libc/include/generic-glibc/gnu/stubs-64.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines a symbol `__stub_FUNCTION' for each function | |
| 3 | in the C library which is a stub, meaning it will fail | |
| 4 | every time called, usually setting errno to ENOSYS. */ | |
| 5 | ||
| 6 | #ifdef _LIBC | |
| 7 | #error Applications may not define the macro _LIBC | |
| 8 | #endif | |
| 9 | ||
| 10 | #define __stub_chflags | |
| 11 | #define __stub_fchflags | |
| 12 | #define __stub_gtty | |
| 13 | #define __stub_lchmod | |
| 14 | #define __stub_revoke | |
| 15 | #define __stub_setlogin | |
| 16 | #define __stub_sigreturn | |
| 17 | #define __stub_sstk | |
| 18 | #define __stub_stty | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/gnu/stubs-hard.h-6| ... | ... | @@ -11,15 +11,9 @@ |
| 11 | 11 | #define __stub___compat_get_kernel_syms |
| 12 | 12 | #define __stub___compat_query_module |
| 13 | 13 | #define __stub_chflags |
| 14 | #define __stub_fattach | |
| 15 | 14 | #define __stub_fchflags |
| 16 | #define __stub_fdetach | |
| 17 | #define __stub_getmsg | |
| 18 | #define __stub_getpmsg | |
| 19 | 15 | #define __stub_gtty |
| 20 | 16 | #define __stub_lchmod |
| 21 | #define __stub_putmsg | |
| 22 | #define __stub_putpmsg | |
| 23 | 17 | #define __stub_revoke |
| 24 | 18 | #define __stub_setlogin |
| 25 | 19 | #define __stub_sigreturn |
lib/libc/include/generic-glibc/gnu/stubs-n32_hard.h-2| ... | ... | @@ -10,9 +10,7 @@ |
| 10 | 10 | #define __stub___compat_bdflush |
| 11 | 11 | #define __stub___compat_uselib |
| 12 | 12 | #define __stub_chflags |
| 13 | #define __stub_fattach | |
| 14 | 13 | #define __stub_fchflags |
| 15 | #define __stub_fdetach | |
| 16 | 14 | #define __stub_gtty |
| 17 | 15 | #define __stub_lchmod |
| 18 | 16 | #define __stub_revoke |
lib/libc/include/generic-glibc/gnu/stubs-n64_hard.h-2| ... | ... | @@ -10,9 +10,7 @@ |
| 10 | 10 | #define __stub___compat_bdflush |
| 11 | 11 | #define __stub___compat_uselib |
| 12 | 12 | #define __stub_chflags |
| 13 | #define __stub_fattach | |
| 14 | 13 | #define __stub_fchflags |
| 15 | #define __stub_fdetach | |
| 16 | 14 | #define __stub_gtty |
| 17 | 15 | #define __stub_lchmod |
| 18 | 16 | #define __stub_revoke |
lib/libc/include/generic-glibc/gnu/stubs-o32_hard.h-2| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | 10 | #define __stub_chflags |
| 11 | #define __stub_fattach | |
| 12 | 11 | #define __stub_fchflags |
| 13 | #define __stub_fdetach | |
| 14 | 12 | #define __stub_gtty |
| 15 | 13 | #define __stub_lchmod |
| 16 | 14 | #define __stub_revoke |
lib/libc/include/generic-glibc/gnu/stubs-soft.h-6| ... | ... | @@ -11,15 +11,9 @@ |
| 11 | 11 | #define __stub___compat_get_kernel_syms |
| 12 | 12 | #define __stub___compat_query_module |
| 13 | 13 | #define __stub_chflags |
| 14 | #define __stub_fattach | |
| 15 | 14 | #define __stub_fchflags |
| 16 | #define __stub_fdetach | |
| 17 | #define __stub_getmsg | |
| 18 | #define __stub_getpmsg | |
| 19 | 15 | #define __stub_gtty |
| 20 | 16 | #define __stub_lchmod |
| 21 | #define __stub_putmsg | |
| 22 | #define __stub_putpmsg | |
| 23 | 17 | #define __stub_revoke |
| 24 | 18 | #define __stub_setlogin |
| 25 | 19 | #define __stub_sigreturn |
lib/libc/include/generic-glibc/malloc.h+10-10| ... | ... | @@ -35,11 +35,12 @@ |
| 35 | 35 | __BEGIN_DECLS |
| 36 | 36 | |
| 37 | 37 | /* Allocate SIZE bytes of memory. */ |
| 38 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; | |
| 38 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ | |
| 39 | __attribute_alloc_size__ ((1)) __wur; | |
| 39 | 40 | |
| 40 | 41 | /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ |
| 41 | 42 | extern void *calloc (size_t __nmemb, size_t __size) |
| 42 | __THROW __attribute_malloc__ __wur; | |
| 43 | __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur; | |
| 43 | 44 | |
| 44 | 45 | /* Re-allocate the previously allocated block in __ptr, making the new |
| 45 | 46 | block SIZE bytes long. */ |
| ... | ... | @@ -47,7 +48,7 @@ __THROW __attribute_malloc__ __wur; |
| 47 | 48 | the same pointer that was passed to it, aliasing needs to be allowed |
| 48 | 49 | between objects pointed by the old and new pointers. */ |
| 49 | 50 | extern void *realloc (void *__ptr, size_t __size) |
| 50 | __THROW __attribute_warn_unused_result__; | |
| 51 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); | |
| 51 | 52 | |
| 52 | 53 | /* Re-allocate the previously allocated block in PTR, making the new |
| 53 | 54 | block large enough for NMEMB elements of SIZE bytes each. */ |
| ... | ... | @@ -55,21 +56,23 @@ __THROW __attribute_warn_unused_result__; |
| 55 | 56 | the same pointer that was passed to it, aliasing needs to be allowed |
| 56 | 57 | between objects pointed by the old and new pointers. */ |
| 57 | 58 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 58 | __THROW __attribute_warn_unused_result__; | |
| 59 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2, 3)); | |
| 59 | 60 | |
| 60 | 61 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ |
| 61 | 62 | extern void free (void *__ptr) __THROW; |
| 62 | 63 | |
| 63 | 64 | /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ |
| 64 | 65 | extern void *memalign (size_t __alignment, size_t __size) |
| 65 | __THROW __attribute_malloc__ __wur; | |
| 66 | __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur; | |
| 66 | 67 | |
| 67 | 68 | /* Allocate SIZE bytes on a page boundary. */ |
| 68 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; | |
| 69 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ | |
| 70 | __attribute_alloc_size__ ((1)) __wur; | |
| 69 | 71 | |
| 70 | 72 | /* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up |
| 71 | 73 | __size to nearest pagesize. */ |
| 72 | extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; | |
| 74 | extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ | |
| 75 | __attribute_alloc_size__ ((1)) __wur; | |
| 73 | 76 | |
| 74 | 77 | /* Underlying allocation function; successive calls should return |
| 75 | 78 | contiguous pieces of memory. */ |
| ... | ... | @@ -156,9 +159,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, |
| 156 | 159 | __MALLOC_DEPRECATED; |
| 157 | 160 | extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); |
| 158 | 161 | |
| 159 | /* Activate a standard set of debugging hooks. */ | |
| 160 | extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED; | |
| 161 | ||
| 162 | 162 | |
| 163 | 163 | __END_DECLS |
| 164 | 164 | #endif /* malloc.h */ |
| \ No newline at end of file |
lib/libc/include/generic-glibc/math.h+11-6| ... | ... | @@ -874,7 +874,8 @@ enum |
| 874 | 874 | the __SUPPORT_SNAN__ check may be skipped for those versions. */ |
| 875 | 875 | |
| 876 | 876 | /* Return number of classification appropriate for X. */ |
| 877 | # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__			 \ | |
| 877 | # if ((__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__)		 \ | |
| 878 | || __glibc_clang_prereq (2,8))					 \ | |
| 878 | 879 | && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus) |
| 879 | 880 | /* The check for __cplusplus allows the use of the builtin, even |
| 880 | 881 | 	when optimization for size is on. This is provided for |
| ... | ... | @@ -889,7 +890,7 @@ enum |
| 889 | 890 | # endif |
| 890 | 891 | |
| 891 | 892 | /* Return nonzero value if sign of X is negative. */ |
| 892 | # if __GNUC_PREREQ (6,0) | |
| 893 | # if __GNUC_PREREQ (6,0) || __glibc_clang_prereq (3,3) | |
| 893 | 894 | # define signbit(x) __builtin_signbit (x) |
| 894 | 895 | # elif defined __cplusplus |
| 895 | 896 | /* In C++ mode, __MATH_TG cannot be used, because it relies on |
| ... | ... | @@ -907,14 +908,16 @@ enum |
| 907 | 908 | # endif |
| 908 | 909 | |
| 909 | 910 | /* Return nonzero value if X is not +-Inf or NaN. */ |
| 910 | # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ | |
| 911 | # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ | |
| 912 | || __glibc_clang_prereq (2,8) | |
| 911 | 913 | # define isfinite(x) __builtin_isfinite (x) |
| 912 | 914 | # else |
| 913 | 915 | # define isfinite(x) __MATH_TG ((x), __finite, (x)) |
| 914 | 916 | # endif |
| 915 | 917 | |
| 916 | 918 | /* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ |
| 917 | # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ | |
| 919 | # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ | |
| 920 | || __glibc_clang_prereq (2,8) | |
| 918 | 921 | # define isnormal(x) __builtin_isnormal (x) |
| 919 | 922 | # else |
| 920 | 923 | # define isnormal(x) (fpclassify (x) == FP_NORMAL) |
| ... | ... | @@ -922,7 +925,8 @@ enum |
| 922 | 925 | |
| 923 | 926 | /* Return nonzero value if X is a NaN. We could use `fpclassify' but |
| 924 | 927 | we already have this functions `__isnan' and it is faster. */ |
| 925 | # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ | |
| 928 | # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ | |
| 929 | || __glibc_clang_prereq (2,8) | |
| 926 | 930 | # define isnan(x) __builtin_isnan (x) |
| 927 | 931 | # else |
| 928 | 932 | # define isnan(x) __MATH_TG ((x), __isnan, (x)) |
| ... | ... | @@ -939,7 +943,8 @@ enum |
| 939 | 943 | # define isinf(x) \ |
| 940 | 944 | (__builtin_types_compatible_p (__typeof (x), _Float128) \ |
| 941 | 945 | ? __isinff128 (x) : __builtin_isinf_sign (x)) |
| 942 | # elif __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ | |
| 946 | # elif (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ | |
| 947 | || __glibc_clang_prereq (3,7) | |
| 943 | 948 | # define isinf(x) __builtin_isinf_sign (x) |
| 944 | 949 | # else |
| 945 | 950 | # define isinf(x) __MATH_TG ((x), __isinf, (x)) |
lib/libc/include/generic-glibc/netinet/igmp.h+1| ... | ... | @@ -86,6 +86,7 @@ struct igmp { |
| 86 | 86 | |
| 87 | 87 | #define IGMP_MTRACE_RESP		0x1e	/* traceroute resp.(to sender)*/ |
| 88 | 88 | #define IGMP_MTRACE			0x1f	/* mcast traceroute messages */ |
| 89 | #define IGMP_MRDISC_ADV			0x30	/* From RFC4286. */ | |
| 89 | 90 | |
| 90 | 91 | #define IGMP_MAX_HOST_REPORT_DELAY	10	/* max delay for response to */ |
| 91 | 92 | 						/* query (in seconds) according */ |
lib/libc/include/generic-glibc/netinet/in.h+1| ... | ... | @@ -204,6 +204,7 @@ enum |
| 204 | 204 | #define INADDR_UNSPEC_GROUP	((in_addr_t) 0xe0000000) /* 224.0.0.0 */ |
| 205 | 205 | #define INADDR_ALLHOSTS_GROUP	((in_addr_t) 0xe0000001) /* 224.0.0.1 */ |
| 206 | 206 | #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ |
| 207 | #define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) /* 224.0.0.106 */ | |
| 207 | 208 | #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ |
| 208 | 209 | |
| 209 | 210 | #if !__USE_KERNEL_IPV6_DEFS |
lib/libc/include/generic-glibc/netinet/udp.h+1| ... | ... | @@ -82,6 +82,7 @@ struct udphdr |
| 82 | 82 | #define UDP_NO_CHECK6_RX 102	/* Disable accepting checksum for UDP |
| 83 | 83 | 				 over IPv6. */ |
| 84 | 84 | #define UDP_SEGMENT	103	/* Set GSO segmentation size. */ |
| 85 | #define UDP_GRO		104	/* This socket can receive UDP GRO packets. */ | |
| 85 | 86 | |
| 86 | 87 | /* UDP encapsulation types */ |
| 87 | 88 | #define UDP_ENCAP_ESPINUDP_NON_IKE 1	/* draft-ietf-ipsec-nat-t-ike-00/01 */ |
lib/libc/include/generic-glibc/pthread.h+36| ... | ... | @@ -770,6 +770,13 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, |
| 770 | 770 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 771 | 771 | #endif |
| 772 | 772 | |
| 773 | #ifdef __USE_GNU | |
| 774 | extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, | |
| 775 | 				 clockid_t __clockid, | |
| 776 | 				 const struct timespec *__restrict | |
| 777 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 778 | #endif | |
| 779 | ||
| 773 | 780 | /* Unlock a mutex. */ |
| 774 | 781 | extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) |
| 775 | 782 | __THROWNL __nonnull ((1)); |
| ... | ... | @@ -909,6 +916,13 @@ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, |
| 909 | 916 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 910 | 917 | # endif |
| 911 | 918 | |
| 919 | # ifdef __USE_GNU | |
| 920 | extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, | |
| 921 | 				 clockid_t __clockid, | |
| 922 | 				 const struct timespec *__restrict | |
| 923 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 924 | # endif | |
| 925 | ||
| 912 | 926 | /* Acquire write lock for RWLOCK. */ |
| 913 | 927 | extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) |
| 914 | 928 | __THROWNL __nonnull ((1)); |
| ... | ... | @@ -924,6 +938,13 @@ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, |
| 924 | 938 | 				 __abstime) __THROWNL __nonnull ((1, 2)); |
| 925 | 939 | # endif |
| 926 | 940 | |
| 941 | # ifdef __USE_GNU | |
| 942 | extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, | |
| 943 | 				 clockid_t __clockid, | |
| 944 | 				 const struct timespec *__restrict | |
| 945 | 				 __abstime) __THROWNL __nonnull ((1, 3)); | |
| 946 | # endif | |
| 947 | ||
| 927 | 948 | /* Unlock RWLOCK. */ |
| 928 | 949 | extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) |
| 929 | 950 | __THROWNL __nonnull ((1)); |
| ... | ... | @@ -1003,6 +1024,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, |
| 1003 | 1024 | 				 const struct timespec *__restrict __abstime) |
| 1004 | 1025 | __nonnull ((1, 2, 3)); |
| 1005 | 1026 | |
| 1027 | # ifdef __USE_GNU | |
| 1028 | /* Wait for condition variable COND to be signaled or broadcast until | |
| 1029 | ABSTIME measured by the specified clock. MUTEX is assumed to be | |
| 1030 | locked before. CLOCK is the clock to use. ABSTIME is an absolute | |
| 1031 | time specification against CLOCK's epoch. | |
| 1032 | ||
| 1033 | This function is a cancellation point and therefore not marked with | |
| 1034 | __THROW. */ | |
| 1035 | extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, | |
| 1036 | 				 pthread_mutex_t *__restrict __mutex, | |
| 1037 | 				 __clockid_t __clock_id, | |
| 1038 | 				 const struct timespec *__restrict __abstime) | |
| 1039 | __nonnull ((1, 2, 4)); | |
| 1040 | # endif | |
| 1041 | ||
| 1006 | 1042 | /* Functions for handling condition variable attributes. */ |
| 1007 | 1043 | |
| 1008 | 1044 | /* Initialize condition variable attribute ATTR. */ |
lib/libc/include/generic-glibc/resolv.h-4| ... | ... | @@ -115,11 +115,7 @@ struct res_sym { |
| 115 | 115 | #define RES_DEFNAMES	0x00000080	/* use default domain name */ |
| 116 | 116 | #define RES_STAYOPEN	0x00000100	/* Keep TCP socket open */ |
| 117 | 117 | #define RES_DNSRCH	0x00000200	/* search up local domain tree */ |
| 118 | #define	RES_INSECURE1	0x00000400	/* type 1 security disabled */ | |
| 119 | #define	RES_INSECURE2	0x00000800	/* type 2 security disabled */ | |
| 120 | 118 | #define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */ |
| 121 | #define	RES_USE_INET6	\ | |
| 122 | __glibc_macro_warning ("RES_USE_INET6 is deprecated") 0x00002000 | |
| 123 | 119 | #define RES_ROTATE	0x00004000	/* rotate ns list after each query */ |
| 124 | 120 | #define	RES_NOCHECKNAME \ |
| 125 | 121 | __glibc_macro_warning ("RES_NOCHECKNAME is deprecated") 0x00008000 |
lib/libc/include/generic-glibc/search.h+7| ... | ... | @@ -150,6 +150,13 @@ typedef void (*__action_fn_t) (const void *__nodep, VISIT __value, |
| 150 | 150 | extern void twalk (const void *__root, __action_fn_t __action); |
| 151 | 151 | |
| 152 | 152 | #ifdef __USE_GNU |
| 153 | /* Like twalk, but pass down a closure parameter instead of the | |
| 154 | level. */ | |
| 155 | extern void twalk_r (const void *__root, | |
| 156 | 		 void (*) (const void *__nodep, VISIT __value, | |
| 157 | 			 void *__closure), | |
| 158 | 		 void *__closure); | |
| 159 | ||
| 153 | 160 | /* Callback type for function to free a tree node. If the keys are atomic |
| 154 | 161 | data this function should do nothing. */ |
| 155 | 162 | typedef void (*__free_fn_t) (void *__nodep); |
lib/libc/include/generic-glibc/semaphore.h+20-10| ... | ... | @@ -33,24 +33,26 @@ __BEGIN_DECLS |
| 33 | 33 | /* Initialize semaphore object SEM to VALUE. If PSHARED then share it |
| 34 | 34 | with other processes. */ |
| 35 | 35 | extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) |
| 36 | __THROW; | |
| 36 | __THROW __nonnull ((1)); | |
| 37 | ||
| 37 | 38 | /* Free resources associated with semaphore object SEM. */ |
| 38 | extern int sem_destroy (sem_t *__sem) __THROW; | |
| 39 | extern int sem_destroy (sem_t *__sem) __THROW __nonnull ((1)); | |
| 39 | 40 | |
| 40 | 41 | /* Open a named semaphore NAME with open flags OFLAG. */ |
| 41 | extern sem_t *sem_open (const char *__name, int __oflag, ...) __THROW; | |
| 42 | extern sem_t *sem_open (const char *__name, int __oflag, ...) | |
| 43 | __THROW __nonnull ((1)); | |
| 42 | 44 | |
| 43 | 45 | /* Close descriptor for named semaphore SEM. */ |
| 44 | extern int sem_close (sem_t *__sem) __THROW; | |
| 46 | extern int sem_close (sem_t *__sem) __THROW __nonnull ((1)); | |
| 45 | 47 | |
| 46 | 48 | /* Remove named semaphore NAME. */ |
| 47 | extern int sem_unlink (const char *__name) __THROW; | |
| 49 | extern int sem_unlink (const char *__name) __THROW __nonnull ((1)); | |
| 48 | 50 | |
| 49 | 51 | /* Wait for SEM being posted. |
| 50 | 52 | |
| 51 | 53 | This function is a cancellation point and therefore not marked with |
| 52 | 54 | __THROW. */ |
| 53 | extern int sem_wait (sem_t *__sem); | |
| 55 | extern int sem_wait (sem_t *__sem) __nonnull ((1)); | |
| 54 | 56 | |
| 55 | 57 | #ifdef __USE_XOPEN2K |
| 56 | 58 | /* Similar to `sem_wait' but wait only until ABSTIME. |
| ... | ... | @@ -58,18 +60,26 @@ extern int sem_wait (sem_t *__sem); |
| 58 | 60 | This function is a cancellation point and therefore not marked with |
| 59 | 61 | __THROW. */ |
| 60 | 62 | extern int sem_timedwait (sem_t *__restrict __sem, |
| 61 | 			 const struct timespec *__restrict __abstime); | |
| 63 | 			 const struct timespec *__restrict __abstime) | |
| 64 | __nonnull ((1, 2)); | |
| 65 | #endif | |
| 66 | ||
| 67 | #ifdef __USE_GNU | |
| 68 | extern int sem_clockwait (sem_t *__restrict __sem, | |
| 69 | 			 clockid_t clock, | |
| 70 | 			 const struct timespec *__restrict __abstime) | |
| 71 | __nonnull ((1, 3)); | |
| 62 | 72 | #endif |
| 63 | 73 | |
| 64 | 74 | /* Test whether SEM is posted. */ |
| 65 | extern int sem_trywait (sem_t *__sem) __THROWNL; | |
| 75 | extern int sem_trywait (sem_t *__sem) __THROWNL __nonnull ((1)); | |
| 66 | 76 | |
| 67 | 77 | /* Post SEM. */ |
| 68 | extern int sem_post (sem_t *__sem) __THROWNL; | |
| 78 | extern int sem_post (sem_t *__sem) __THROWNL __nonnull ((1)); | |
| 69 | 79 | |
| 70 | 80 | /* Get current value of SEM and store it in *SVAL. */ |
| 71 | 81 | extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval) |
| 72 | __THROW; | |
| 82 | __THROW __nonnull ((1, 2)); | |
| 73 | 83 | |
| 74 | 84 | |
| 75 | 85 | __END_DECLS |
lib/libc/include/generic-glibc/signal.h+3| ... | ... | @@ -370,6 +370,9 @@ extern int __libc_current_sigrtmax (void) __THROW; |
| 370 | 370 | #define SIGRTMIN (__libc_current_sigrtmin ()) |
| 371 | 371 | #define SIGRTMAX (__libc_current_sigrtmax ()) |
| 372 | 372 | |
| 373 | /* System-specific extensions. */ | |
| 374 | #include <bits/signal_ext.h> | |
| 375 | ||
| 373 | 376 | __END_DECLS |
| 374 | 377 | |
| 375 | 378 | #endif /* not signal.h */ |
| \ No newline at end of file |
lib/libc/include/generic-glibc/stdlib.h+8-5| ... | ... | @@ -536,10 +536,11 @@ extern int lcong48_r (unsigned short int __param[7], |
| 536 | 536 | #endif	/* Use misc or X/Open. */ |
| 537 | 537 | |
| 538 | 538 | /* Allocate SIZE bytes of memory. */ |
| 539 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; | |
| 539 | extern void *malloc (size_t __size) __THROW __attribute_malloc__ | |
| 540 | __attribute_alloc_size__ ((1)) __wur; | |
| 540 | 541 | /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ |
| 541 | 542 | extern void *calloc (size_t __nmemb, size_t __size) |
| 542 | __THROW __attribute_malloc__ __wur; | |
| 543 | __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur; | |
| 543 | 544 | |
| 544 | 545 | /* Re-allocate the previously allocated block |
| 545 | 546 | in PTR, making the new block SIZE bytes long. */ |
| ... | ... | @@ -547,7 +548,7 @@ extern void *calloc (size_t __nmemb, size_t __size) |
| 547 | 548 | the same pointer that was passed to it, aliasing needs to be allowed |
| 548 | 549 | between objects pointed by the old and new pointers. */ |
| 549 | 550 | extern void *realloc (void *__ptr, size_t __size) |
| 550 | __THROW __attribute_warn_unused_result__; | |
| 551 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); | |
| 551 | 552 | |
| 552 | 553 | #ifdef __USE_MISC |
| 553 | 554 | /* Re-allocate the previously allocated block in PTR, making the new |
| ... | ... | @@ -556,7 +557,8 @@ extern void *realloc (void *__ptr, size_t __size) |
| 556 | 557 | the same pointer that was passed to it, aliasing needs to be allowed |
| 557 | 558 | between objects pointed by the old and new pointers. */ |
| 558 | 559 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 559 | __THROW __attribute_warn_unused_result__; | |
| 560 | __THROW __attribute_warn_unused_result__ | |
| 561 | __attribute_alloc_size__ ((2, 3)); | |
| 560 | 562 | #endif |
| 561 | 563 | |
| 562 | 564 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ |
| ... | ... | @@ -569,7 +571,8 @@ extern void free (void *__ptr) __THROW; |
| 569 | 571 | #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ |
| 570 | 572 | || defined __USE_MISC |
| 571 | 573 | /* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ |
| 572 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; | |
| 574 | extern void *valloc (size_t __size) __THROW __attribute_malloc__ | |
| 575 | __attribute_alloc_size__ ((1)) __wur; | |
| 573 | 576 | #endif |
| 574 | 577 | |
| 575 | 578 | #ifdef __USE_XOPEN2K |
lib/libc/include/generic-glibc/stropts.h deleted-92| ... | ... | @@ -1,92 +0,0 @@ |
| 1 | /* Copyright (C) 1998-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _STROPTS_H | |
| 19 | #define _STROPTS_H	1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | #include <bits/types.h> | |
| 23 | #include <bits/xtitypes.h> | |
| 24 | ||
| 25 | #ifndef __gid_t_defined | |
| 26 | typedef __gid_t gid_t; | |
| 27 | # define __gid_t_defined | |
| 28 | #endif | |
| 29 | ||
| 30 | #ifndef __uid_t_defined | |
| 31 | typedef __uid_t uid_t; | |
| 32 | # define __uid_t_defined | |
| 33 | #endif | |
| 34 | ||
| 35 | typedef __t_scalar_t t_scalar_t; | |
| 36 | typedef __t_uscalar_t t_uscalar_t; | |
| 37 | ||
| 38 | /* Get system specific constants. */ | |
| 39 | #include <bits/stropts.h> | |
| 40 | ||
| 41 | ||
| 42 | __BEGIN_DECLS | |
| 43 | ||
| 44 | /* Test whether FILDES is associated with a STREAM-based file. */ | |
| 45 | extern int isastream (int __fildes) __THROW; | |
| 46 | ||
| 47 | /* Receive next message from a STREAMS file. | |
| 48 | ||
| 49 | This function is a cancellation point and therefore not marked with | |
| 50 | __THROW. */ | |
| 51 | extern int getmsg (int __fildes, struct strbuf *__restrict __ctlptr, | |
| 52 | 		 struct strbuf *__restrict __dataptr, | |
| 53 | 		 int *__restrict __flagsp); | |
| 54 | ||
| 55 | /* Receive next message from a STREAMS file, with *FLAGSP allowing to | |
| 56 | control which message. | |
| 57 | ||
| 58 | This function is a cancellation point and therefore not marked with | |
| 59 | __THROW. */ | |
| 60 | extern int getpmsg (int __fildes, struct strbuf *__restrict __ctlptr, | |
| 61 | 		 struct strbuf *__restrict __dataptr, | |
| 62 | 		 int *__restrict __bandp, int *__restrict __flagsp); | |
| 63 | ||
| 64 | /* Perform the I/O control operation specified by REQUEST on FD. | |
| 65 | One argument may follow; its presence and type depend on REQUEST. | |
| 66 | Return value depends on REQUEST. Usually -1 indicates error. */ | |
| 67 | extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; | |
| 68 | ||
| 69 | /* Send a message on a STREAM. | |
| 70 | ||
| 71 | This function is a cancellation point and therefore not marked with | |
| 72 | __THROW. */ | |
| 73 | extern int putmsg (int __fildes, const struct strbuf *__ctlptr, | |
| 74 | 		 const struct strbuf *__dataptr, int __flags); | |
| 75 | ||
| 76 | /* Send a message on a STREAM to the BAND. | |
| 77 | ||
| 78 | This function is a cancellation point and therefore not marked with | |
| 79 | __THROW. */ | |
| 80 | extern int putpmsg (int __fildes, const struct strbuf *__ctlptr, | |
| 81 | 		 const struct strbuf *__dataptr, int __band, int __flags); | |
| 82 | ||
| 83 | /* Attach a STREAMS-based file descriptor FILDES to a file PATH in the | |
| 84 | file system name space. */ | |
| 85 | extern int fattach (int __fildes, const char *__path) __THROW; | |
| 86 | ||
| 87 | /* Detach a name PATH from a STREAMS-based file descriptor. */ | |
| 88 | extern int fdetach (const char *__path) __THROW; | |
| 89 | ||
| 90 | __END_DECLS | |
| 91 | ||
| 92 | #endif /* stropts.h */ | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/sys/cdefs.h+8| ... | ... | @@ -412,6 +412,14 @@ |
| 412 | 412 | # define __glibc_has_attribute(attr)	0 |
| 413 | 413 | #endif |
| 414 | 414 | |
| 415 | #ifdef __has_include | |
| 416 | /* Do not use a function-like macro, so that __has_include can inhibit | |
| 417 | macro expansion. */ | |
| 418 | # define __glibc_has_include __has_include | |
| 419 | #else | |
| 420 | # define __glibc_has_include(header)	0 | |
| 421 | #endif | |
| 422 | ||
| 415 | 423 | #if (!defined _Noreturn \ |
| 416 | 424 | && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ |
| 417 | 425 | && !__GNUC_PREREQ (4,7)) |
lib/libc/include/generic-glibc/sys/ifunc.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /* Definitions used by AArch64 indirect function resolvers. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_IFUNC_H | |
| 20 | #define _SYS_IFUNC_H | |
| 21 | ||
| 22 | /* A second argument is passed to the ifunc resolver. */ | |
| 23 | #define _IFUNC_ARG_HWCAP	(1ULL << 62) | |
| 24 | ||
| 25 | /* The prototype of a gnu indirect function resolver on AArch64 is | |
| 26 | ||
| 27 | ElfW(Addr) ifunc_resolver (uint64_t, const __ifunc_arg_t *); | |
| 28 | ||
| 29 | the first argument should have the _IFUNC_ARG_HWCAP bit set and | |
| 30 | the remaining bits should match the AT_HWCAP settings. */ | |
| 31 | ||
| 32 | /* Second argument to an ifunc resolver. */ | |
| 33 | struct __ifunc_arg_t | |
| 34 | { | |
| 35 | unsigned long _size; /* Size of the struct, so it can grow. */ | |
| 36 | unsigned long _hwcap; | |
| 37 | unsigned long _hwcap2; | |
| 38 | }; | |
| 39 | ||
| 40 | typedef struct __ifunc_arg_t __ifunc_arg_t; | |
| 41 | ||
| 42 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/sys/io.h+151-15| ... | ... | @@ -12,36 +12,172 @@ |
| 12 | 12 | Lesser General Public License for more details. |
| 13 | 13 | |
| 14 | 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library. If not, see | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | 16 | <http://www.gnu.org/licenses/>. */ |
| 17 | 17 | |
| 18 | 18 | #ifndef	_SYS_IO_H |
| 19 | ||
| 20 | 19 | #define	_SYS_IO_H	1 |
| 20 | ||
| 21 | 21 | #include <features.h> |
| 22 | 22 | |
| 23 | 23 | __BEGIN_DECLS |
| 24 | 24 | |
| 25 | 25 | /* If TURN_ON is TRUE, request for permission to do direct i/o on the |
| 26 | 26 | port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O |
| 27 | permission off for that range. This call requires root privileges. */ | |
| 27 | permission off for that range. This call requires root privileges. | |
| 28 | ||
| 29 | Portability note: not all Linux platforms support this call. Most | |
| 30 | platforms based on the PC I/O architecture probably will, however. | |
| 31 | E.g., Linux/Alpha for Alpha PCs supports this. */ | |
| 28 | 32 | extern int ioperm (unsigned long int __from, unsigned long int __num, |
| 29 | 		 int __turn_on) __THROW; | |
| 33 | int __turn_on) __THROW; | |
| 30 | 34 | |
| 31 | /* Set the I/O privilege level to LEVEL. If LEVEL is nonzero, | |
| 32 | permission to access any I/O port is granted. This call requires | |
| 33 | root privileges. */ | |
| 35 | /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to | |
| 36 | access any I/O port is granted. This call requires root | |
| 37 | privileges. */ | |
| 34 | 38 | extern int iopl (int __level) __THROW; |
| 35 | 39 | |
| 36 | /* The functions that actually perform reads and writes. */ | |
| 37 | extern unsigned char inb (unsigned long int __port) __THROW; | |
| 38 | extern unsigned short int inw (unsigned long int __port) __THROW; | |
| 39 | extern unsigned long int inl (unsigned long int __port) __THROW; | |
| 40 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 40 | 41 | |
| 41 | extern void outb (unsigned char __value, unsigned long int __port) __THROW; | |
| 42 | extern void outw (unsigned short __value, unsigned long int __port) __THROW; | |
| 43 | extern void outl (unsigned long __value, unsigned long int __port) __THROW; | |
| 42 | static __inline unsigned char | |
| 43 | inb (unsigned short int __port) | |
| 44 | { | |
| 45 | unsigned char _v; | |
| 44 | 46 | |
| 45 | __END_DECLS | |
| 47 | __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 48 | return _v; | |
| 49 | } | |
| 50 | ||
| 51 | static __inline unsigned char | |
| 52 | inb_p (unsigned short int __port) | |
| 53 | { | |
| 54 | unsigned char _v; | |
| 55 | ||
| 56 | __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 57 | return _v; | |
| 58 | } | |
| 59 | ||
| 60 | static __inline unsigned short int | |
| 61 | inw (unsigned short int __port) | |
| 62 | { | |
| 63 | unsigned short _v; | |
| 64 | ||
| 65 | __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 66 | return _v; | |
| 67 | } | |
| 68 | ||
| 69 | static __inline unsigned short int | |
| 70 | inw_p (unsigned short int __port) | |
| 71 | { | |
| 72 | unsigned short int _v; | |
| 73 | ||
| 74 | __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 75 | return _v; | |
| 76 | } | |
| 77 | ||
| 78 | static __inline unsigned int | |
| 79 | inl (unsigned short int __port) | |
| 80 | { | |
| 81 | unsigned int _v; | |
| 82 | ||
| 83 | __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 84 | return _v; | |
| 85 | } | |
| 86 | ||
| 87 | static __inline unsigned int | |
| 88 | inl_p (unsigned short int __port) | |
| 89 | { | |
| 90 | unsigned int _v; | |
| 91 | __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 92 | return _v; | |
| 93 | } | |
| 94 | ||
| 95 | static __inline void | |
| 96 | outb (unsigned char __value, unsigned short int __port) | |
| 97 | { | |
| 98 | __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); | |
| 99 | } | |
| 46 | 100 | |
| 101 | static __inline void | |
| 102 | outb_p (unsigned char __value, unsigned short int __port) | |
| 103 | { | |
| 104 | __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 105 | 			"Nd" (__port)); | |
| 106 | } | |
| 107 | ||
| 108 | static __inline void | |
| 109 | outw (unsigned short int __value, unsigned short int __port) | |
| 110 | { | |
| 111 | __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); | |
| 112 | ||
| 113 | } | |
| 114 | ||
| 115 | static __inline void | |
| 116 | outw_p (unsigned short int __value, unsigned short int __port) | |
| 117 | { | |
| 118 | __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 119 | 			"Nd" (__port)); | |
| 120 | } | |
| 121 | ||
| 122 | static __inline void | |
| 123 | outl (unsigned int __value, unsigned short int __port) | |
| 124 | { | |
| 125 | __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); | |
| 126 | } | |
| 127 | ||
| 128 | static __inline void | |
| 129 | outl_p (unsigned int __value, unsigned short int __port) | |
| 130 | { | |
| 131 | __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 132 | 			"Nd" (__port)); | |
| 133 | } | |
| 134 | ||
| 135 | static __inline void | |
| 136 | insb (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 137 | { | |
| 138 | __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) | |
| 139 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 140 | } | |
| 141 | ||
| 142 | static __inline void | |
| 143 | insw (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 144 | { | |
| 145 | __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) | |
| 146 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 147 | } | |
| 148 | ||
| 149 | static __inline void | |
| 150 | insl (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 151 | { | |
| 152 | __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) | |
| 153 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 154 | } | |
| 155 | ||
| 156 | static __inline void | |
| 157 | outsb (unsigned short int __port, const void *__addr, | |
| 158 | unsigned long int __count) | |
| 159 | { | |
| 160 | __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) | |
| 161 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline void | |
| 165 | outsw (unsigned short int __port, const void *__addr, | |
| 166 | unsigned long int __count) | |
| 167 | { | |
| 168 | __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) | |
| 169 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 170 | } | |
| 171 | ||
| 172 | static __inline void | |
| 173 | outsl (unsigned short int __port, const void *__addr, | |
| 174 | unsigned long int __count) | |
| 175 | { | |
| 176 | __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) | |
| 177 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 178 | } | |
| 179 | ||
| 180 | #endif	/* GNU C */ | |
| 181 | ||
| 182 | __END_DECLS | |
| 47 | 183 | #endif /* _SYS_IO_H */ |
| \ No newline at end of file |
lib/libc/include/generic-glibc/sys/stropts.h deleted-1| ... | ... | @@ -1 +0,0 @@ |
| 1 | #include <stropts.h> | |
| \ No newline at end of file |
lib/libc/include/generic-glibc/sys/sysctl.h+4-1| ... | ... | @@ -18,6 +18,8 @@ |
| 18 | 18 | #ifndef	_SYS_SYSCTL_H |
| 19 | 19 | #define	_SYS_SYSCTL_H	1 |
| 20 | 20 | |
| 21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed." | |
| 22 | ||
| 21 | 23 | #include <features.h> |
| 22 | 24 | #define __need_size_t |
| 23 | 25 | #include <stddef.h> |
| ... | ... | @@ -66,7 +68,8 @@ __BEGIN_DECLS |
| 66 | 68 | |
| 67 | 69 | /* Read or write system parameters. */ |
| 68 | 70 | extern int sysctl (int *__name, int __nlen, void *__oldval, |
| 69 | 		 size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; | |
| 71 | 		 size_t *__oldlenp, void *__newval, size_t __newlen) __THROW | |
| 72 | __attribute_deprecated__; | |
| 70 | 73 | |
| 71 | 74 | __END_DECLS |
| 72 | 75 |
lib/libc/include/generic-glibc/sys/types.h+8-25| ... | ... | @@ -154,37 +154,20 @@ typedef unsigned int uint; |
| 154 | 154 | |
| 155 | 155 | #include <bits/stdint-intn.h> |
| 156 | 156 | |
| 157 | #if !__GNUC_PREREQ (2, 7) | |
| 158 | ||
| 159 | 157 | /* These were defined by ISO C without the first `_'. */ |
| 160 | typedef	unsigned char u_int8_t; | |
| 161 | typedef	unsigned short int u_int16_t; | |
| 162 | typedef	unsigned int u_int32_t; | |
| 163 | # if __WORDSIZE == 64 | |
| 164 | typedef unsigned long int u_int64_t; | |
| 165 | # else | |
| 166 | __extension__ typedef unsigned long long int u_int64_t; | |
| 167 | # endif | |
| 168 | ||
| 169 | typedef int register_t; | |
| 170 | ||
| 171 | #else | |
| 172 | ||
| 173 | /* For GCC 2.7 and later, we can use specific type-size attributes. */ | |
| 174 | # define __u_intN_t(N, MODE) \ | |
| 175 | typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) | |
| 176 | ||
| 177 | __u_intN_t (8, __QI__); | |
| 178 | __u_intN_t (16, __HI__); | |
| 179 | __u_intN_t (32, __SI__); | |
| 180 | __u_intN_t (64, __DI__); | |
| 158 | typedef __uint8_t u_int8_t; | |
| 159 | typedef __uint16_t u_int16_t; | |
| 160 | typedef __uint32_t u_int32_t; | |
| 161 | typedef __uint64_t u_int64_t; | |
| 181 | 162 | |
| 163 | #if __GNUC_PREREQ (2, 7) | |
| 182 | 164 | typedef int register_t __attribute__ ((__mode__ (__word__))); |
| 183 | ||
| 165 | #else | |
| 166 | typedef int register_t; | |
| 167 | #endif | |
| 184 | 168 | |
| 185 | 169 | /* Some code from BIND tests this macro to see if the types above are |
| 186 | 170 | defined. */ |
| 187 | #endif | |
| 188 | 171 | #define __BIT_TYPES_DEFINED__	1 |
| 189 | 172 | |
| 190 | 173 |
lib/libc/include/i386-linux-gnu/bits/math-vector-fortran.h deleted-43| ... | ... | @@ -1,43 +0,0 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/i386-linux-gnu/bits/xtitypes.h deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. x86-64. | |
| 2 | Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _STROPTS_H | |
| 20 | # error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_XTITYPES_H | |
| 24 | #define _BITS_XTITYPES_H	1 | |
| 25 | ||
| 26 | #include <bits/types.h> | |
| 27 | ||
| 28 | /* This type is used by some structs in <bits/stropts.h>. */ | |
| 29 | typedef __SLONG32_TYPE __t_scalar_t; | |
| 30 | typedef __ULONG32_TYPE __t_uscalar_t; | |
| 31 | ||
| 32 | ||
| 33 | #endif /* bits/xtitypes.h */ | |
| \ No newline at end of file |
lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/i386-linux-gnu/sys/io.h deleted-183| ... | ... | @@ -1,183 +0,0 @@ |
| 1 | /* Copyright (C) 1996-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef	_SYS_IO_H | |
| 19 | #define	_SYS_IO_H	1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | ||
| 23 | __BEGIN_DECLS | |
| 24 | ||
| 25 | /* If TURN_ON is TRUE, request for permission to do direct i/o on the | |
| 26 | port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O | |
| 27 | permission off for that range. This call requires root privileges. | |
| 28 | ||
| 29 | Portability note: not all Linux platforms support this call. Most | |
| 30 | platforms based on the PC I/O architecture probably will, however. | |
| 31 | E.g., Linux/Alpha for Alpha PCs supports this. */ | |
| 32 | extern int ioperm (unsigned long int __from, unsigned long int __num, | |
| 33 | int __turn_on) __THROW; | |
| 34 | ||
| 35 | /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to | |
| 36 | access any I/O port is granted. This call requires root | |
| 37 | privileges. */ | |
| 38 | extern int iopl (int __level) __THROW; | |
| 39 | ||
| 40 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 41 | ||
| 42 | static __inline unsigned char | |
| 43 | inb (unsigned short int __port) | |
| 44 | { | |
| 45 | unsigned char _v; | |
| 46 | ||
| 47 | __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 48 | return _v; | |
| 49 | } | |
| 50 | ||
| 51 | static __inline unsigned char | |
| 52 | inb_p (unsigned short int __port) | |
| 53 | { | |
| 54 | unsigned char _v; | |
| 55 | ||
| 56 | __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 57 | return _v; | |
| 58 | } | |
| 59 | ||
| 60 | static __inline unsigned short int | |
| 61 | inw (unsigned short int __port) | |
| 62 | { | |
| 63 | unsigned short _v; | |
| 64 | ||
| 65 | __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 66 | return _v; | |
| 67 | } | |
| 68 | ||
| 69 | static __inline unsigned short int | |
| 70 | inw_p (unsigned short int __port) | |
| 71 | { | |
| 72 | unsigned short int _v; | |
| 73 | ||
| 74 | __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 75 | return _v; | |
| 76 | } | |
| 77 | ||
| 78 | static __inline unsigned int | |
| 79 | inl (unsigned short int __port) | |
| 80 | { | |
| 81 | unsigned int _v; | |
| 82 | ||
| 83 | __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 84 | return _v; | |
| 85 | } | |
| 86 | ||
| 87 | static __inline unsigned int | |
| 88 | inl_p (unsigned short int __port) | |
| 89 | { | |
| 90 | unsigned int _v; | |
| 91 | __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 92 | return _v; | |
| 93 | } | |
| 94 | ||
| 95 | static __inline void | |
| 96 | outb (unsigned char __value, unsigned short int __port) | |
| 97 | { | |
| 98 | __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); | |
| 99 | } | |
| 100 | ||
| 101 | static __inline void | |
| 102 | outb_p (unsigned char __value, unsigned short int __port) | |
| 103 | { | |
| 104 | __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 105 | 			"Nd" (__port)); | |
| 106 | } | |
| 107 | ||
| 108 | static __inline void | |
| 109 | outw (unsigned short int __value, unsigned short int __port) | |
| 110 | { | |
| 111 | __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); | |
| 112 | ||
| 113 | } | |
| 114 | ||
| 115 | static __inline void | |
| 116 | outw_p (unsigned short int __value, unsigned short int __port) | |
| 117 | { | |
| 118 | __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 119 | 			"Nd" (__port)); | |
| 120 | } | |
| 121 | ||
| 122 | static __inline void | |
| 123 | outl (unsigned int __value, unsigned short int __port) | |
| 124 | { | |
| 125 | __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); | |
| 126 | } | |
| 127 | ||
| 128 | static __inline void | |
| 129 | outl_p (unsigned int __value, unsigned short int __port) | |
| 130 | { | |
| 131 | __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 132 | 			"Nd" (__port)); | |
| 133 | } | |
| 134 | ||
| 135 | static __inline void | |
| 136 | insb (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 137 | { | |
| 138 | __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) | |
| 139 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 140 | } | |
| 141 | ||
| 142 | static __inline void | |
| 143 | insw (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 144 | { | |
| 145 | __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) | |
| 146 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 147 | } | |
| 148 | ||
| 149 | static __inline void | |
| 150 | insl (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 151 | { | |
| 152 | __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) | |
| 153 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 154 | } | |
| 155 | ||
| 156 | static __inline void | |
| 157 | outsb (unsigned short int __port, const void *__addr, | |
| 158 | unsigned long int __count) | |
| 159 | { | |
| 160 | __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) | |
| 161 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline void | |
| 165 | outsw (unsigned short int __port, const void *__addr, | |
| 166 | unsigned long int __count) | |
| 167 | { | |
| 168 | __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) | |
| 169 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 170 | } | |
| 171 | ||
| 172 | static __inline void | |
| 173 | outsl (unsigned short int __port, const void *__addr, | |
| 174 | unsigned long int __count) | |
| 175 | { | |
| 176 | __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) | |
| 177 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 178 | } | |
| 179 | ||
| 180 | #endif	/* GNU C */ | |
| 181 | ||
| 182 | __END_DECLS | |
| 183 | #endif /* _SYS_IO_H */ | |
| \ No newline at end of file |
lib/libc/include/mips-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for MIPS. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 4105 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 4100 | |
| 33 | #define SO_RCVTIMEO 4102 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4099 | |
| 37 | #define SO_SNDTIMEO 4101 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/powerpc-linux-gnu/bits/fenvinline.h+30-7| ... | ... | @@ -18,13 +18,36 @@ |
| 18 | 18 | |
| 19 | 19 | #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ |
| 20 | 20 | |
| 21 | /* Inline definition for fegetround. */ | |
| 22 | # define __fegetround() \ | |
| 23 | (__extension__ ({ int __fegetround_result;				 \ | |
| 24 | 		 __asm__ __volatile__				 \ | |
| 25 | 		 ("mcrfs 7,7 ; mfcr %0"				 \ | |
| 26 | 			: "=r"(__fegetround_result) : : "cr7");		 \ | |
| 27 | 		 __fegetround_result & 3; })) | |
| 21 | /* Inline definitions for fegetround. */ | |
| 22 | # define __fegetround_ISA300()						\ | |
| 23 | (__extension__ ({							\ | |
| 24 | union { double __d; unsigned long long __ll; } __u;			\ | |
| 25 | __asm__ __volatile__ (						\ | |
| 26 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop"	\ | |
| 27 | : "=f" (__u.__d));						\ | |
| 28 | __u.__ll & 0x0000000000000003LL;					\ | |
| 29 | })) | |
| 30 | ||
| 31 | # define __fegetround_ISA2()						\ | |
| 32 | (__extension__ ({							\ | |
| 33 | int __fegetround_result;						\ | |
| 34 | __asm__ __volatile__ ("mcrfs 7,7 ; mfcr %0"			\ | |
| 35 | 			 : "=r"(__fegetround_result) : : "cr7");	\ | |
| 36 | __fegetround_result & 3;						\ | |
| 37 | })) | |
| 38 | ||
| 39 | # ifdef _ARCH_PWR9 | |
| 40 | # define __fegetround() __fegetround_ISA300() | |
| 41 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 42 | # define __fegetround()						\ | |
| 43 | (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))		\ | |
| 44 | ? __fegetround_ISA300()						\ | |
| 45 | : __fegetround_ISA2()						\ | |
| 46 | ) | |
| 47 | # else | |
| 48 | # define __fegetround() __fegetround_ISA2() | |
| 49 | # endif | |
| 50 | ||
| 28 | 51 | # define fegetround() __fegetround () |
| 29 | 52 | |
| 30 | 53 | # ifndef __NO_MATH_INLINES |
lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for POWER. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 1 | |
| 24 | #define SO_ACCEPTCONN 30 | |
| 25 | #define SO_BROADCAST 6 | |
| 26 | #define SO_DONTROUTE 5 | |
| 27 | #define SO_ERROR 4 | |
| 28 | #define SO_KEEPALIVE 9 | |
| 29 | #define SO_LINGER 13 | |
| 30 | #define SO_OOBINLINE 10 | |
| 31 | #define SO_RCVBUF 8 | |
| 32 | #define SO_RCVLOWAT 16 | |
| 33 | #define SO_RCVTIMEO 18 | |
| 34 | #define SO_REUSEADDR 2 | |
| 35 | #define SO_SNDBUF 7 | |
| 36 | #define SO_SNDLOWAT 17 | |
| 37 | #define SO_SNDTIMEO 19 | |
| 38 | #define SO_TYPE 3 | |
| \ No newline at end of file |
lib/libc/include/powerpc-linux-gnu/fpu_control.h+33-39| ... | ... | @@ -19,6 +19,10 @@ |
| 19 | 19 | #ifndef _FPU_CONTROL_H |
| 20 | 20 | #define _FPU_CONTROL_H |
| 21 | 21 | |
| 22 | #if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT) | |
| 23 | # error "SPE/e500 is no longer supported" | |
| 24 | #endif | |
| 25 | ||
| 22 | 26 | #ifdef _SOFT_FLOAT |
| 23 | 27 | |
| 24 | 28 | # define _FPU_RESERVED 0xffffffff |
| ... | ... | @@ -28,41 +32,6 @@ typedef unsigned int fpu_control_t; |
| 28 | 32 | # define _FPU_SETCW(cw) (void) (cw) |
| 29 | 33 | extern fpu_control_t __fpu_control; |
| 30 | 34 | |
| 31 | #elif defined __NO_FPRS__ /* e500 */ | |
| 32 | ||
| 33 | /* rounding control */ | |
| 34 | # define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ | |
| 35 | # define _FPU_RC_DOWN 0x03 | |
| 36 | # define _FPU_RC_UP 0x02 | |
| 37 | # define _FPU_RC_ZERO 0x01 | |
| 38 | ||
| 39 | /* masking of interrupts */ | |
| 40 | # define _FPU_MASK_ZM 0x10 /* zero divide */ | |
| 41 | # define _FPU_MASK_OM 0x04 /* overflow */ | |
| 42 | # define _FPU_MASK_UM 0x08 /* underflow */ | |
| 43 | # define _FPU_MASK_XM 0x40 /* inexact */ | |
| 44 | # define _FPU_MASK_IM 0x20 /* invalid operation */ | |
| 45 | ||
| 46 | # define _FPU_RESERVED 0x00c10080 /* These bits are reserved and not changed. */ | |
| 47 | ||
| 48 | /* Correct IEEE semantics require traps to be enabled at the hardware | |
| 49 | level; the kernel then does the emulation and determines whether | |
| 50 | generation of signals from those traps was enabled using prctl. */ | |
| 51 | # define _FPU_DEFAULT 0x0000003c /* Default value. */ | |
| 52 | # define _FPU_IEEE _FPU_DEFAULT | |
| 53 | ||
| 54 | /* Type of the control word. */ | |
| 55 | typedef unsigned int fpu_control_t; | |
| 56 | ||
| 57 | /* Macros for accessing the hardware control word. */ | |
| 58 | # define _FPU_GETCW(cw) \ | |
| 59 | __asm__ volatile ("mfspefscr %0" : "=r" (cw)) | |
| 60 | # define _FPU_SETCW(cw) \ | |
| 61 | __asm__ volatile ("mtspefscr %0" : : "r" (cw)) | |
| 62 | ||
| 63 | /* Default control word set at startup. */ | |
| 64 | extern fpu_control_t __fpu_control; | |
| 65 | ||
| 66 | 35 | #else /* PowerPC 6xx floating-point. */ |
| 67 | 36 | |
| 68 | 37 | /* rounding control */ |
| ... | ... | @@ -71,6 +40,8 @@ extern fpu_control_t __fpu_control; |
| 71 | 40 | # define _FPU_RC_UP 0x02 |
| 72 | 41 | # define _FPU_RC_ZERO 0x01 |
| 73 | 42 | |
| 43 | # define _FPU_MASK_RC (_FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO) | |
| 44 | ||
| 74 | 45 | # define _FPU_MASK_NI 0x04 /* non-ieee mode */ |
| 75 | 46 | |
| 76 | 47 | /* masking of interrupts */ |
| ... | ... | @@ -96,20 +67,43 @@ typedef unsigned int fpu_control_t; |
| 96 | 67 | /* Macros for accessing the hardware control word. */ |
| 97 | 68 | # define _FPU_GETCW(cw)						\ |
| 98 | 69 | ({union { double __d; unsigned long long __ll; } __u;		\ |
| 99 | register double __fr;					\ | |
| 100 | __asm__ ("mffs %0" : "=f" (__fr));				\ | |
| 101 | __u.__d = __fr;						\ | |
| 70 | __asm__ __volatile__("mffs %0" : "=f" (__u.__d));		\ | |
| 102 | 71 | (cw) = (fpu_control_t) __u.__ll;				\ |
| 103 | 72 | (fpu_control_t) __u.__ll;					\ |
| 104 | 73 | }) |
| 105 | 74 | |
| 75 | # define _FPU_GET_RC_ISA300()						\ | |
| 76 | ({union { double __d; unsigned long long __ll; } __u;			\ | |
| 77 | __asm__ __volatile__(						\ | |
| 78 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop" 	\ | |
| 79 | : "=f" (__u.__d));						\ | |
| 80 | (fpu_control_t) (__u.__ll & _FPU_MASK_RC);				\ | |
| 81 | }) | |
| 82 | ||
| 83 | # ifdef _ARCH_PWR9 | |
| 84 | # define _FPU_GET_RC() _FPU_GET_RC_ISA300() | |
| 85 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 86 | # define _FPU_GET_RC()							\ | |
| 87 | ({fpu_control_t __rc;							\ | |
| 88 | __rc = __glibc_likely (__builtin_cpu_supports ("arch_3_00"))	\ | |
| 89 | ? _FPU_GET_RC_ISA300 ()						\ | |
| 90 | : _FPU_GETCW (__rc) & _FPU_MASK_RC;				\ | |
| 91 | __rc;								\ | |
| 92 | }) | |
| 93 | # else | |
| 94 | # define _FPU_GET_RC()						\ | |
| 95 | ({fpu_control_t __rc = _FPU_GETCW (__rc) & _FPU_MASK_RC;	\ | |
| 96 | __rc;							\ | |
| 97 | }) | |
| 98 | # endif | |
| 99 | ||
| 106 | 100 | # define _FPU_SETCW(cw)						\ |
| 107 | 101 | { union { double __d; unsigned long long __ll; } __u;		\ |
| 108 | 102 | register double __fr;					\ |
| 109 | 103 | __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */	\ |
| 110 | 104 | __u.__ll |= (cw) & 0xffffffffLL;				\ |
| 111 | 105 | __fr = __u.__d;						\ |
| 112 | __asm__ ("mtfsf 255,%0" : : "f" (__fr));			\ | |
| 106 | __asm__ __volatile__("mtfsf 255,%0" : : "f" (__fr));	\ | |
| 113 | 107 | } |
| 114 | 108 | |
| 115 | 109 | /* Default control word set at startup. */ |
lib/libc/include/powerpc64-linux-gnu/bits/fenvinline.h+30-7| ... | ... | @@ -18,13 +18,36 @@ |
| 18 | 18 | |
| 19 | 19 | #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ |
| 20 | 20 | |
| 21 | /* Inline definition for fegetround. */ | |
| 22 | # define __fegetround() \ | |
| 23 | (__extension__ ({ int __fegetround_result;				 \ | |
| 24 | 		 __asm__ __volatile__				 \ | |
| 25 | 		 ("mcrfs 7,7 ; mfcr %0"				 \ | |
| 26 | 			: "=r"(__fegetround_result) : : "cr7");		 \ | |
| 27 | 		 __fegetround_result & 3; })) | |
| 21 | /* Inline definitions for fegetround. */ | |
| 22 | # define __fegetround_ISA300()						\ | |
| 23 | (__extension__ ({							\ | |
| 24 | union { double __d; unsigned long long __ll; } __u;			\ | |
| 25 | __asm__ __volatile__ (						\ | |
| 26 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop"	\ | |
| 27 | : "=f" (__u.__d));						\ | |
| 28 | __u.__ll & 0x0000000000000003LL;					\ | |
| 29 | })) | |
| 30 | ||
| 31 | # define __fegetround_ISA2()						\ | |
| 32 | (__extension__ ({							\ | |
| 33 | int __fegetround_result;						\ | |
| 34 | __asm__ __volatile__ ("mcrfs 7,7 ; mfcr %0"			\ | |
| 35 | 			 : "=r"(__fegetround_result) : : "cr7");	\ | |
| 36 | __fegetround_result & 3;						\ | |
| 37 | })) | |
| 38 | ||
| 39 | # ifdef _ARCH_PWR9 | |
| 40 | # define __fegetround() __fegetround_ISA300() | |
| 41 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 42 | # define __fegetround()						\ | |
| 43 | (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))		\ | |
| 44 | ? __fegetround_ISA300()						\ | |
| 45 | : __fegetround_ISA2()						\ | |
| 46 | ) | |
| 47 | # else | |
| 48 | # define __fegetround() __fegetround_ISA2() | |
| 49 | # endif | |
| 50 | ||
| 28 | 51 | # define fegetround() __fegetround () |
| 29 | 52 | |
| 30 | 53 | # ifndef __NO_MATH_INLINES |
lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for POWER. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 1 | |
| 24 | #define SO_ACCEPTCONN 30 | |
| 25 | #define SO_BROADCAST 6 | |
| 26 | #define SO_DONTROUTE 5 | |
| 27 | #define SO_ERROR 4 | |
| 28 | #define SO_KEEPALIVE 9 | |
| 29 | #define SO_LINGER 13 | |
| 30 | #define SO_OOBINLINE 10 | |
| 31 | #define SO_RCVBUF 8 | |
| 32 | #define SO_RCVLOWAT 16 | |
| 33 | #define SO_RCVTIMEO 18 | |
| 34 | #define SO_REUSEADDR 2 | |
| 35 | #define SO_SNDBUF 7 | |
| 36 | #define SO_SNDLOWAT 17 | |
| 37 | #define SO_SNDTIMEO 19 | |
| 38 | #define SO_TYPE 3 | |
| \ No newline at end of file |
lib/libc/include/powerpc64-linux-gnu/fpu_control.h+33-39| ... | ... | @@ -19,6 +19,10 @@ |
| 19 | 19 | #ifndef _FPU_CONTROL_H |
| 20 | 20 | #define _FPU_CONTROL_H |
| 21 | 21 | |
| 22 | #if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT) | |
| 23 | # error "SPE/e500 is no longer supported" | |
| 24 | #endif | |
| 25 | ||
| 22 | 26 | #ifdef _SOFT_FLOAT |
| 23 | 27 | |
| 24 | 28 | # define _FPU_RESERVED 0xffffffff |
| ... | ... | @@ -28,41 +32,6 @@ typedef unsigned int fpu_control_t; |
| 28 | 32 | # define _FPU_SETCW(cw) (void) (cw) |
| 29 | 33 | extern fpu_control_t __fpu_control; |
| 30 | 34 | |
| 31 | #elif defined __NO_FPRS__ /* e500 */ | |
| 32 | ||
| 33 | /* rounding control */ | |
| 34 | # define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ | |
| 35 | # define _FPU_RC_DOWN 0x03 | |
| 36 | # define _FPU_RC_UP 0x02 | |
| 37 | # define _FPU_RC_ZERO 0x01 | |
| 38 | ||
| 39 | /* masking of interrupts */ | |
| 40 | # define _FPU_MASK_ZM 0x10 /* zero divide */ | |
| 41 | # define _FPU_MASK_OM 0x04 /* overflow */ | |
| 42 | # define _FPU_MASK_UM 0x08 /* underflow */ | |
| 43 | # define _FPU_MASK_XM 0x40 /* inexact */ | |
| 44 | # define _FPU_MASK_IM 0x20 /* invalid operation */ | |
| 45 | ||
| 46 | # define _FPU_RESERVED 0x00c10080 /* These bits are reserved and not changed. */ | |
| 47 | ||
| 48 | /* Correct IEEE semantics require traps to be enabled at the hardware | |
| 49 | level; the kernel then does the emulation and determines whether | |
| 50 | generation of signals from those traps was enabled using prctl. */ | |
| 51 | # define _FPU_DEFAULT 0x0000003c /* Default value. */ | |
| 52 | # define _FPU_IEEE _FPU_DEFAULT | |
| 53 | ||
| 54 | /* Type of the control word. */ | |
| 55 | typedef unsigned int fpu_control_t; | |
| 56 | ||
| 57 | /* Macros for accessing the hardware control word. */ | |
| 58 | # define _FPU_GETCW(cw) \ | |
| 59 | __asm__ volatile ("mfspefscr %0" : "=r" (cw)) | |
| 60 | # define _FPU_SETCW(cw) \ | |
| 61 | __asm__ volatile ("mtspefscr %0" : : "r" (cw)) | |
| 62 | ||
| 63 | /* Default control word set at startup. */ | |
| 64 | extern fpu_control_t __fpu_control; | |
| 65 | ||
| 66 | 35 | #else /* PowerPC 6xx floating-point. */ |
| 67 | 36 | |
| 68 | 37 | /* rounding control */ |
| ... | ... | @@ -71,6 +40,8 @@ extern fpu_control_t __fpu_control; |
| 71 | 40 | # define _FPU_RC_UP 0x02 |
| 72 | 41 | # define _FPU_RC_ZERO 0x01 |
| 73 | 42 | |
| 43 | # define _FPU_MASK_RC (_FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO) | |
| 44 | ||
| 74 | 45 | # define _FPU_MASK_NI 0x04 /* non-ieee mode */ |
| 75 | 46 | |
| 76 | 47 | /* masking of interrupts */ |
| ... | ... | @@ -96,20 +67,43 @@ typedef unsigned int fpu_control_t; |
| 96 | 67 | /* Macros for accessing the hardware control word. */ |
| 97 | 68 | # define _FPU_GETCW(cw)						\ |
| 98 | 69 | ({union { double __d; unsigned long long __ll; } __u;		\ |
| 99 | register double __fr;					\ | |
| 100 | __asm__ ("mffs %0" : "=f" (__fr));				\ | |
| 101 | __u.__d = __fr;						\ | |
| 70 | __asm__ __volatile__("mffs %0" : "=f" (__u.__d));		\ | |
| 102 | 71 | (cw) = (fpu_control_t) __u.__ll;				\ |
| 103 | 72 | (fpu_control_t) __u.__ll;					\ |
| 104 | 73 | }) |
| 105 | 74 | |
| 75 | # define _FPU_GET_RC_ISA300()						\ | |
| 76 | ({union { double __d; unsigned long long __ll; } __u;			\ | |
| 77 | __asm__ __volatile__(						\ | |
| 78 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop" 	\ | |
| 79 | : "=f" (__u.__d));						\ | |
| 80 | (fpu_control_t) (__u.__ll & _FPU_MASK_RC);				\ | |
| 81 | }) | |
| 82 | ||
| 83 | # ifdef _ARCH_PWR9 | |
| 84 | # define _FPU_GET_RC() _FPU_GET_RC_ISA300() | |
| 85 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 86 | # define _FPU_GET_RC()							\ | |
| 87 | ({fpu_control_t __rc;							\ | |
| 88 | __rc = __glibc_likely (__builtin_cpu_supports ("arch_3_00"))	\ | |
| 89 | ? _FPU_GET_RC_ISA300 ()						\ | |
| 90 | : _FPU_GETCW (__rc) & _FPU_MASK_RC;				\ | |
| 91 | __rc;								\ | |
| 92 | }) | |
| 93 | # else | |
| 94 | # define _FPU_GET_RC()						\ | |
| 95 | ({fpu_control_t __rc = _FPU_GETCW (__rc) & _FPU_MASK_RC;	\ | |
| 96 | __rc;							\ | |
| 97 | }) | |
| 98 | # endif | |
| 99 | ||
| 106 | 100 | # define _FPU_SETCW(cw)						\ |
| 107 | 101 | { union { double __d; unsigned long long __ll; } __u;		\ |
| 108 | 102 | register double __fr;					\ |
| 109 | 103 | __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */	\ |
| 110 | 104 | __u.__ll |= (cw) & 0xffffffffLL;				\ |
| 111 | 105 | __fr = __u.__d;						\ |
| 112 | __asm__ ("mtfsf 255,%0" : : "f" (__fr));			\ | |
| 106 | __asm__ __volatile__("mtfsf 255,%0" : : "f" (__fr));	\ | |
| 113 | 107 | } |
| 114 | 108 | |
| 115 | 109 | /* Default control word set at startup. */ |
lib/libc/include/powerpc64-linux-gnu/gnu/stubs-64-v1.h-2| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | 10 | #define __stub_chflags |
| 11 | #define __stub_fattach | |
| 12 | 11 | #define __stub_fchflags |
| 13 | #define __stub_fdetach | |
| 14 | 12 | #define __stub_gtty |
| 15 | 13 | #define __stub_lchmod |
| 16 | 14 | #define __stub_revoke |
lib/libc/include/powerpc64le-linux-gnu/bits/fenvinline.h+30-7| ... | ... | @@ -18,13 +18,36 @@ |
| 18 | 18 | |
| 19 | 19 | #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ |
| 20 | 20 | |
| 21 | /* Inline definition for fegetround. */ | |
| 22 | # define __fegetround() \ | |
| 23 | (__extension__ ({ int __fegetround_result;				 \ | |
| 24 | 		 __asm__ __volatile__				 \ | |
| 25 | 		 ("mcrfs 7,7 ; mfcr %0"				 \ | |
| 26 | 			: "=r"(__fegetround_result) : : "cr7");		 \ | |
| 27 | 		 __fegetround_result & 3; })) | |
| 21 | /* Inline definitions for fegetround. */ | |
| 22 | # define __fegetround_ISA300()						\ | |
| 23 | (__extension__ ({							\ | |
| 24 | union { double __d; unsigned long long __ll; } __u;			\ | |
| 25 | __asm__ __volatile__ (						\ | |
| 26 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop"	\ | |
| 27 | : "=f" (__u.__d));						\ | |
| 28 | __u.__ll & 0x0000000000000003LL;					\ | |
| 29 | })) | |
| 30 | ||
| 31 | # define __fegetround_ISA2()						\ | |
| 32 | (__extension__ ({							\ | |
| 33 | int __fegetround_result;						\ | |
| 34 | __asm__ __volatile__ ("mcrfs 7,7 ; mfcr %0"			\ | |
| 35 | 			 : "=r"(__fegetround_result) : : "cr7");	\ | |
| 36 | __fegetround_result & 3;						\ | |
| 37 | })) | |
| 38 | ||
| 39 | # ifdef _ARCH_PWR9 | |
| 40 | # define __fegetround() __fegetround_ISA300() | |
| 41 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 42 | # define __fegetround()						\ | |
| 43 | (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))		\ | |
| 44 | ? __fegetround_ISA300()						\ | |
| 45 | : __fegetround_ISA2()						\ | |
| 46 | ) | |
| 47 | # else | |
| 48 | # define __fegetround() __fegetround_ISA2() | |
| 49 | # endif | |
| 50 | ||
| 28 | 51 | # define fegetround() __fegetround () |
| 29 | 52 | |
| 30 | 53 | # ifndef __NO_MATH_INLINES |
lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for POWER. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 1 | |
| 24 | #define SO_ACCEPTCONN 30 | |
| 25 | #define SO_BROADCAST 6 | |
| 26 | #define SO_DONTROUTE 5 | |
| 27 | #define SO_ERROR 4 | |
| 28 | #define SO_KEEPALIVE 9 | |
| 29 | #define SO_LINGER 13 | |
| 30 | #define SO_OOBINLINE 10 | |
| 31 | #define SO_RCVBUF 8 | |
| 32 | #define SO_RCVLOWAT 16 | |
| 33 | #define SO_RCVTIMEO 18 | |
| 34 | #define SO_REUSEADDR 2 | |
| 35 | #define SO_SNDBUF 7 | |
| 36 | #define SO_SNDLOWAT 17 | |
| 37 | #define SO_SNDTIMEO 19 | |
| 38 | #define SO_TYPE 3 | |
| \ No newline at end of file |
lib/libc/include/powerpc64le-linux-gnu/fpu_control.h+33-39| ... | ... | @@ -19,6 +19,10 @@ |
| 19 | 19 | #ifndef _FPU_CONTROL_H |
| 20 | 20 | #define _FPU_CONTROL_H |
| 21 | 21 | |
| 22 | #if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT) | |
| 23 | # error "SPE/e500 is no longer supported" | |
| 24 | #endif | |
| 25 | ||
| 22 | 26 | #ifdef _SOFT_FLOAT |
| 23 | 27 | |
| 24 | 28 | # define _FPU_RESERVED 0xffffffff |
| ... | ... | @@ -28,41 +32,6 @@ typedef unsigned int fpu_control_t; |
| 28 | 32 | # define _FPU_SETCW(cw) (void) (cw) |
| 29 | 33 | extern fpu_control_t __fpu_control; |
| 30 | 34 | |
| 31 | #elif defined __NO_FPRS__ /* e500 */ | |
| 32 | ||
| 33 | /* rounding control */ | |
| 34 | # define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ | |
| 35 | # define _FPU_RC_DOWN 0x03 | |
| 36 | # define _FPU_RC_UP 0x02 | |
| 37 | # define _FPU_RC_ZERO 0x01 | |
| 38 | ||
| 39 | /* masking of interrupts */ | |
| 40 | # define _FPU_MASK_ZM 0x10 /* zero divide */ | |
| 41 | # define _FPU_MASK_OM 0x04 /* overflow */ | |
| 42 | # define _FPU_MASK_UM 0x08 /* underflow */ | |
| 43 | # define _FPU_MASK_XM 0x40 /* inexact */ | |
| 44 | # define _FPU_MASK_IM 0x20 /* invalid operation */ | |
| 45 | ||
| 46 | # define _FPU_RESERVED 0x00c10080 /* These bits are reserved and not changed. */ | |
| 47 | ||
| 48 | /* Correct IEEE semantics require traps to be enabled at the hardware | |
| 49 | level; the kernel then does the emulation and determines whether | |
| 50 | generation of signals from those traps was enabled using prctl. */ | |
| 51 | # define _FPU_DEFAULT 0x0000003c /* Default value. */ | |
| 52 | # define _FPU_IEEE _FPU_DEFAULT | |
| 53 | ||
| 54 | /* Type of the control word. */ | |
| 55 | typedef unsigned int fpu_control_t; | |
| 56 | ||
| 57 | /* Macros for accessing the hardware control word. */ | |
| 58 | # define _FPU_GETCW(cw) \ | |
| 59 | __asm__ volatile ("mfspefscr %0" : "=r" (cw)) | |
| 60 | # define _FPU_SETCW(cw) \ | |
| 61 | __asm__ volatile ("mtspefscr %0" : : "r" (cw)) | |
| 62 | ||
| 63 | /* Default control word set at startup. */ | |
| 64 | extern fpu_control_t __fpu_control; | |
| 65 | ||
| 66 | 35 | #else /* PowerPC 6xx floating-point. */ |
| 67 | 36 | |
| 68 | 37 | /* rounding control */ |
| ... | ... | @@ -71,6 +40,8 @@ extern fpu_control_t __fpu_control; |
| 71 | 40 | # define _FPU_RC_UP 0x02 |
| 72 | 41 | # define _FPU_RC_ZERO 0x01 |
| 73 | 42 | |
| 43 | # define _FPU_MASK_RC (_FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO) | |
| 44 | ||
| 74 | 45 | # define _FPU_MASK_NI 0x04 /* non-ieee mode */ |
| 75 | 46 | |
| 76 | 47 | /* masking of interrupts */ |
| ... | ... | @@ -96,20 +67,43 @@ typedef unsigned int fpu_control_t; |
| 96 | 67 | /* Macros for accessing the hardware control word. */ |
| 97 | 68 | # define _FPU_GETCW(cw)						\ |
| 98 | 69 | ({union { double __d; unsigned long long __ll; } __u;		\ |
| 99 | register double __fr;					\ | |
| 100 | __asm__ ("mffs %0" : "=f" (__fr));				\ | |
| 101 | __u.__d = __fr;						\ | |
| 70 | __asm__ __volatile__("mffs %0" : "=f" (__u.__d));		\ | |
| 102 | 71 | (cw) = (fpu_control_t) __u.__ll;				\ |
| 103 | 72 | (fpu_control_t) __u.__ll;					\ |
| 104 | 73 | }) |
| 105 | 74 | |
| 75 | # define _FPU_GET_RC_ISA300()						\ | |
| 76 | ({union { double __d; unsigned long long __ll; } __u;			\ | |
| 77 | __asm__ __volatile__(						\ | |
| 78 | ".machine push; .machine \"power9\"; mffsl %0; .machine pop" 	\ | |
| 79 | : "=f" (__u.__d));						\ | |
| 80 | (fpu_control_t) (__u.__ll & _FPU_MASK_RC);				\ | |
| 81 | }) | |
| 82 | ||
| 83 | # ifdef _ARCH_PWR9 | |
| 84 | # define _FPU_GET_RC() _FPU_GET_RC_ISA300() | |
| 85 | # elif defined __BUILTIN_CPU_SUPPORTS__ | |
| 86 | # define _FPU_GET_RC()							\ | |
| 87 | ({fpu_control_t __rc;							\ | |
| 88 | __rc = __glibc_likely (__builtin_cpu_supports ("arch_3_00"))	\ | |
| 89 | ? _FPU_GET_RC_ISA300 ()						\ | |
| 90 | : _FPU_GETCW (__rc) & _FPU_MASK_RC;				\ | |
| 91 | __rc;								\ | |
| 92 | }) | |
| 93 | # else | |
| 94 | # define _FPU_GET_RC()						\ | |
| 95 | ({fpu_control_t __rc = _FPU_GETCW (__rc) & _FPU_MASK_RC;	\ | |
| 96 | __rc;							\ | |
| 97 | }) | |
| 98 | # endif | |
| 99 | ||
| 106 | 100 | # define _FPU_SETCW(cw)						\ |
| 107 | 101 | { union { double __d; unsigned long long __ll; } __u;		\ |
| 108 | 102 | register double __fr;					\ |
| 109 | 103 | __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */	\ |
| 110 | 104 | __u.__ll |= (cw) & 0xffffffffLL;				\ |
| 111 | 105 | __fr = __u.__d;						\ |
| 112 | __asm__ ("mtfsf 255,%0" : : "f" (__fr));			\ | |
| 106 | __asm__ __volatile__("mtfsf 255,%0" : : "f" (__fr));	\ | |
| 113 | 107 | } |
| 114 | 108 | |
| 115 | 109 | /* Default control word set at startup. */ |
lib/libc/include/powerpc64le-linux-gnu/gnu/stubs-64-v2.h-2| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | 10 | #define __stub_chflags |
| 11 | #define __stub_fattach | |
| 12 | 11 | #define __stub_fchflags |
| 13 | #define __stub_fdetach | |
| 14 | 12 | #define __stub_gtty |
| 15 | 13 | #define __stub_lchmod |
| 16 | 14 | #define __stub_revoke |
lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64.h-6| ... | ... | @@ -13,9 +13,7 @@ |
| 13 | 13 | #define __stub___compat_query_module |
| 14 | 14 | #define __stub___compat_uselib |
| 15 | 15 | #define __stub_chflags |
| 16 | #define __stub_fattach | |
| 17 | 16 | #define __stub_fchflags |
| 18 | #define __stub_fdetach | |
| 19 | 17 | #define __stub_feclearexcept |
| 20 | 18 | #define __stub_fedisableexcept |
| 21 | 19 | #define __stub_feenableexcept |
| ... | ... | @@ -33,12 +31,8 @@ |
| 33 | 31 | #define __stub_fesetround |
| 34 | 32 | #define __stub_fetestexcept |
| 35 | 33 | #define __stub_feupdateenv |
| 36 | #define __stub_getmsg | |
| 37 | #define __stub_getpmsg | |
| 38 | 34 | #define __stub_gtty |
| 39 | 35 | #define __stub_lchmod |
| 40 | #define __stub_putmsg | |
| 41 | #define __stub_putpmsg | |
| 42 | 36 | #define __stub_revoke |
| 43 | 37 | #define __stub_setlogin |
| 44 | 38 | #define __stub_sigreturn |
lib/libc/include/s390x-linux-gnu/bits/hwcap.h+5-1| ... | ... | @@ -38,4 +38,8 @@ |
| 38 | 38 | #define HWCAP_S390_VX 2048 |
| 39 | 39 | #define HWCAP_S390_VXD 4096 |
| 40 | 40 | #define HWCAP_S390_VXE 8192 |
| 41 | #define HWCAP_S390_GS 16384 | |
| \ No newline at end of file | ||
| 41 | #define HWCAP_S390_GS 16384 | |
| 42 | #define HWCAP_S390_VXRS_EXT2 32768 | |
| 43 | #define HWCAP_S390_VXRS_PDE 65536 | |
| 44 | #define HWCAP_S390_SORT 131072 | |
| 45 | #define HWCAP_S390_DFLT 262144 | |
| \ No newline at end of file |
lib/libc/include/s390x-linux-gnu/bits/xtitypes.h deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. S390/S390x | |
| 2 | Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _STROPTS_H | |
| 20 | # error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_XTITYPES_H | |
| 24 | #define _BITS_XTITYPES_H	1 | |
| 25 | ||
| 26 | #include <bits/types.h> | |
| 27 | ||
| 28 | /* This type is used by some structs in <bits/stropts.h>. */ | |
| 29 | typedef __S32_TYPE __t_scalar_t; | |
| 30 | typedef __U32_TYPE __t_uscalar_t; | |
| 31 | ||
| 32 | ||
| 33 | #endif /* bits/xtitypes.h */ | |
| \ No newline at end of file |
lib/libc/include/s390x-linux-gnu/gnu/stubs-64.h deleted-24| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines a symbol `__stub_FUNCTION' for each function | |
| 3 | in the C library which is a stub, meaning it will fail | |
| 4 | every time called, usually setting errno to ENOSYS. */ | |
| 5 | ||
| 6 | #ifdef _LIBC | |
| 7 | #error Applications may not define the macro _LIBC | |
| 8 | #endif | |
| 9 | ||
| 10 | #define __stub_chflags | |
| 11 | #define __stub_fattach | |
| 12 | #define __stub_fchflags | |
| 13 | #define __stub_fdetach | |
| 14 | #define __stub_getmsg | |
| 15 | #define __stub_gtty | |
| 16 | #define __stub_lchmod | |
| 17 | #define __stub_pkey_alloc | |
| 18 | #define __stub_pkey_free | |
| 19 | #define __stub_putmsg | |
| 20 | #define __stub_revoke | |
| 21 | #define __stub_setlogin | |
| 22 | #define __stub_sigreturn | |
| 23 | #define __stub_sstk | |
| 24 | #define __stub_stty | |
| \ No newline at end of file |
lib/libc/include/sparc-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for SPARC. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 32768 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 2048 | |
| 33 | #define SO_RCVTIMEO 8192 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4096 | |
| 37 | #define SO_SNDTIMEO 16384 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/sparc-linux-gnu/gnu/stubs-64.h deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines a symbol `__stub_FUNCTION' for each function | |
| 3 | in the C library which is a stub, meaning it will fail | |
| 4 | every time called, usually setting errno to ENOSYS. */ | |
| 5 | ||
| 6 | #ifdef _LIBC | |
| 7 | #error Applications may not define the macro _LIBC | |
| 8 | #endif | |
| 9 | ||
| 10 | #define __stub_chflags | |
| 11 | #define __stub_fattach | |
| 12 | #define __stub_fchflags | |
| 13 | #define __stub_fdetach | |
| 14 | #define __stub_getmsg | |
| 15 | #define __stub_getpmsg | |
| 16 | #define __stub_gtty | |
| 17 | #define __stub_lchmod | |
| 18 | #define __stub_pkey_alloc | |
| 19 | #define __stub_pkey_free | |
| 20 | #define __stub_putmsg | |
| 21 | #define __stub_putpmsg | |
| 22 | #define __stub_revoke | |
| 23 | #define __stub_setlogin | |
| 24 | #define __stub_sigreturn | |
| 25 | #define __stub_sstk | |
| 26 | #define __stub_stty | |
| \ No newline at end of file |
lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Socket constants which vary among Linux architectures. Version for SPARC. | |
| 2 | Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _SYS_SOCKET_H | |
| 20 | # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #define SOL_SOCKET 65535 | |
| 24 | #define SO_ACCEPTCONN 32768 | |
| 25 | #define SO_BROADCAST 32 | |
| 26 | #define SO_DONTROUTE 16 | |
| 27 | #define SO_ERROR 4103 | |
| 28 | #define SO_KEEPALIVE 8 | |
| 29 | #define SO_LINGER 128 | |
| 30 | #define SO_OOBINLINE 256 | |
| 31 | #define SO_RCVBUF 4098 | |
| 32 | #define SO_RCVLOWAT 2048 | |
| 33 | #define SO_RCVTIMEO 8192 | |
| 34 | #define SO_REUSEADDR 4 | |
| 35 | #define SO_SNDBUF 4097 | |
| 36 | #define SO_SNDLOWAT 4096 | |
| 37 | #define SO_SNDTIMEO 16384 | |
| 38 | #define SO_TYPE 4104 | |
| \ No newline at end of file |
lib/libc/include/sparcv9-linux-gnu/gnu/stubs-32.h deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines a symbol `__stub_FUNCTION' for each function | |
| 3 | in the C library which is a stub, meaning it will fail | |
| 4 | every time called, usually setting errno to ENOSYS. */ | |
| 5 | ||
| 6 | #ifdef _LIBC | |
| 7 | #error Applications may not define the macro _LIBC | |
| 8 | #endif | |
| 9 | ||
| 10 | #define __stub_chflags | |
| 11 | #define __stub_fattach | |
| 12 | #define __stub_fchflags | |
| 13 | #define __stub_fdetach | |
| 14 | #define __stub_getmsg | |
| 15 | #define __stub_getpmsg | |
| 16 | #define __stub_gtty | |
| 17 | #define __stub_lchmod | |
| 18 | #define __stub_pkey_alloc | |
| 19 | #define __stub_pkey_free | |
| 20 | #define __stub_putmsg | |
| 21 | #define __stub_putpmsg | |
| 22 | #define __stub_revoke | |
| 23 | #define __stub_setlogin | |
| 24 | #define __stub_sigreturn | |
| 25 | #define __stub_sstk | |
| 26 | #define __stub_stty | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnu/bits/math-vector-fortran.h deleted-43| ... | ... | @@ -1,43 +0,0 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnu/bits/xtitypes.h deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. x86-64. | |
| 2 | Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _STROPTS_H | |
| 20 | # error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_XTITYPES_H | |
| 24 | #define _BITS_XTITYPES_H	1 | |
| 25 | ||
| 26 | #include <bits/types.h> | |
| 27 | ||
| 28 | /* This type is used by some structs in <bits/stropts.h>. */ | |
| 29 | typedef __SLONG32_TYPE __t_scalar_t; | |
| 30 | typedef __ULONG32_TYPE __t_uscalar_t; | |
| 31 | ||
| 32 | ||
| 33 | #endif /* bits/xtitypes.h */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnu/finclude/math-vector-fortran.h created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnu/gnu/stubs-64.h-4| ... | ... | @@ -9,13 +9,9 @@ |
| 9 | 9 | |
| 10 | 10 | #define __stub___compat_bdflush |
| 11 | 11 | #define __stub_chflags |
| 12 | #define __stub_fattach | |
| 13 | 12 | #define __stub_fchflags |
| 14 | #define __stub_fdetach | |
| 15 | #define __stub_getmsg | |
| 16 | 13 | #define __stub_gtty |
| 17 | 14 | #define __stub_lchmod |
| 18 | #define __stub_putmsg | |
| 19 | 15 | #define __stub_revoke |
| 20 | 16 | #define __stub_setlogin |
| 21 | 17 | #define __stub_sigreturn |
lib/libc/include/x86_64-linux-gnu/sys/io.h deleted-183| ... | ... | @@ -1,183 +0,0 @@ |
| 1 | /* Copyright (C) 1996-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef	_SYS_IO_H | |
| 19 | #define	_SYS_IO_H	1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | ||
| 23 | __BEGIN_DECLS | |
| 24 | ||
| 25 | /* If TURN_ON is TRUE, request for permission to do direct i/o on the | |
| 26 | port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O | |
| 27 | permission off for that range. This call requires root privileges. | |
| 28 | ||
| 29 | Portability note: not all Linux platforms support this call. Most | |
| 30 | platforms based on the PC I/O architecture probably will, however. | |
| 31 | E.g., Linux/Alpha for Alpha PCs supports this. */ | |
| 32 | extern int ioperm (unsigned long int __from, unsigned long int __num, | |
| 33 | int __turn_on) __THROW; | |
| 34 | ||
| 35 | /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to | |
| 36 | access any I/O port is granted. This call requires root | |
| 37 | privileges. */ | |
| 38 | extern int iopl (int __level) __THROW; | |
| 39 | ||
| 40 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 41 | ||
| 42 | static __inline unsigned char | |
| 43 | inb (unsigned short int __port) | |
| 44 | { | |
| 45 | unsigned char _v; | |
| 46 | ||
| 47 | __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 48 | return _v; | |
| 49 | } | |
| 50 | ||
| 51 | static __inline unsigned char | |
| 52 | inb_p (unsigned short int __port) | |
| 53 | { | |
| 54 | unsigned char _v; | |
| 55 | ||
| 56 | __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 57 | return _v; | |
| 58 | } | |
| 59 | ||
| 60 | static __inline unsigned short int | |
| 61 | inw (unsigned short int __port) | |
| 62 | { | |
| 63 | unsigned short _v; | |
| 64 | ||
| 65 | __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 66 | return _v; | |
| 67 | } | |
| 68 | ||
| 69 | static __inline unsigned short int | |
| 70 | inw_p (unsigned short int __port) | |
| 71 | { | |
| 72 | unsigned short int _v; | |
| 73 | ||
| 74 | __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 75 | return _v; | |
| 76 | } | |
| 77 | ||
| 78 | static __inline unsigned int | |
| 79 | inl (unsigned short int __port) | |
| 80 | { | |
| 81 | unsigned int _v; | |
| 82 | ||
| 83 | __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 84 | return _v; | |
| 85 | } | |
| 86 | ||
| 87 | static __inline unsigned int | |
| 88 | inl_p (unsigned short int __port) | |
| 89 | { | |
| 90 | unsigned int _v; | |
| 91 | __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 92 | return _v; | |
| 93 | } | |
| 94 | ||
| 95 | static __inline void | |
| 96 | outb (unsigned char __value, unsigned short int __port) | |
| 97 | { | |
| 98 | __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); | |
| 99 | } | |
| 100 | ||
| 101 | static __inline void | |
| 102 | outb_p (unsigned char __value, unsigned short int __port) | |
| 103 | { | |
| 104 | __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 105 | 			"Nd" (__port)); | |
| 106 | } | |
| 107 | ||
| 108 | static __inline void | |
| 109 | outw (unsigned short int __value, unsigned short int __port) | |
| 110 | { | |
| 111 | __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); | |
| 112 | ||
| 113 | } | |
| 114 | ||
| 115 | static __inline void | |
| 116 | outw_p (unsigned short int __value, unsigned short int __port) | |
| 117 | { | |
| 118 | __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 119 | 			"Nd" (__port)); | |
| 120 | } | |
| 121 | ||
| 122 | static __inline void | |
| 123 | outl (unsigned int __value, unsigned short int __port) | |
| 124 | { | |
| 125 | __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); | |
| 126 | } | |
| 127 | ||
| 128 | static __inline void | |
| 129 | outl_p (unsigned int __value, unsigned short int __port) | |
| 130 | { | |
| 131 | __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 132 | 			"Nd" (__port)); | |
| 133 | } | |
| 134 | ||
| 135 | static __inline void | |
| 136 | insb (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 137 | { | |
| 138 | __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) | |
| 139 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 140 | } | |
| 141 | ||
| 142 | static __inline void | |
| 143 | insw (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 144 | { | |
| 145 | __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) | |
| 146 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 147 | } | |
| 148 | ||
| 149 | static __inline void | |
| 150 | insl (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 151 | { | |
| 152 | __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) | |
| 153 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 154 | } | |
| 155 | ||
| 156 | static __inline void | |
| 157 | outsb (unsigned short int __port, const void *__addr, | |
| 158 | unsigned long int __count) | |
| 159 | { | |
| 160 | __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) | |
| 161 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline void | |
| 165 | outsw (unsigned short int __port, const void *__addr, | |
| 166 | unsigned long int __count) | |
| 167 | { | |
| 168 | __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) | |
| 169 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 170 | } | |
| 171 | ||
| 172 | static __inline void | |
| 173 | outsl (unsigned short int __port, const void *__addr, | |
| 174 | unsigned long int __count) | |
| 175 | { | |
| 176 | __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) | |
| 177 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 178 | } | |
| 179 | ||
| 180 | #endif	/* GNU C */ | |
| 181 | ||
| 182 | __END_DECLS | |
| 183 | #endif /* _SYS_IO_H */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnux32/bits/math-vector-fortran.h deleted-43| ... | ... | @@ -1,43 +0,0 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnux32/bits/xtitypes.h deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. x86-64. | |
| 2 | Copyright (C) 2002-2019 Free Software Foundation, Inc. | |
| 3 | This file is part of the GNU C Library. | |
| 4 | ||
| 5 | The GNU C Library is free software; you can redistribute it and/or | |
| 6 | modify it under the terms of the GNU Lesser General Public | |
| 7 | License as published by the Free Software Foundation; either | |
| 8 | version 2.1 of the License, or (at your option) any later version. | |
| 9 | ||
| 10 | The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | Lesser General Public License for more details. | |
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public | |
| 16 | License along with the GNU C Library; if not, see | |
| 17 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #ifndef _STROPTS_H | |
| 20 | # error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_XTITYPES_H | |
| 24 | #define _BITS_XTITYPES_H	1 | |
| 25 | ||
| 26 | #include <bits/types.h> | |
| 27 | ||
| 28 | /* This type is used by some structs in <bits/stropts.h>. */ | |
| 29 | typedef __SLONG32_TYPE __t_scalar_t; | |
| 30 | typedef __ULONG32_TYPE __t_uscalar_t; | |
| 31 | ||
| 32 | ||
| 33 | #endif /* bits/xtitypes.h */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnux32/finclude/math-vector-fortran.h created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- | |
| 2 | ! Copyright (C) 2019 Free Software Foundation, Inc. | |
| 3 | ! This file is part of the GNU C Library. | |
| 4 | ! | |
| 5 | ! The GNU C Library is free software; you can redistribute it and/or | |
| 6 | ! modify it under the terms of the GNU Lesser General Public | |
| 7 | ! License as published by the Free Software Foundation; either | |
| 8 | ! version 2.1 of the License, or (at your option) any later version. | |
| 9 | ! | |
| 10 | ! The GNU C Library is distributed in the hope that it will be useful, | |
| 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | ! Lesser General Public License for more details. | |
| 14 | ! | |
| 15 | ! You should have received a copy of the GNU Lesser General Public | |
| 16 | ! License along with the GNU C Library; if not, see | |
| 17 | ! <http://www.gnu.org/licenses/>. | |
| 18 | ||
| 19 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') | |
| 20 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') | |
| 21 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') | |
| 22 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') | |
| 23 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') | |
| 24 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') | |
| 25 | !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') | |
| 26 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') | |
| 27 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') | |
| 28 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') | |
| 29 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') | |
| 30 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') | |
| 31 | ||
| 32 | !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') | |
| 33 | !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') | |
| 34 | !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') | |
| 35 | !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') | |
| 36 | !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') | |
| 37 | !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') | |
| 38 | !GCC$ builtin (log) attributes simd (notinbranch) if('x32') | |
| 39 | !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') | |
| 40 | !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') | |
| 41 | !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') | |
| 42 | !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') | |
| 43 | !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') | |
| \ No newline at end of file |
lib/libc/include/x86_64-linux-gnux32/gnu/stubs-x32.h-4| ... | ... | @@ -14,13 +14,9 @@ |
| 14 | 14 | #define __stub___compat_query_module |
| 15 | 15 | #define __stub___compat_uselib |
| 16 | 16 | #define __stub_chflags |
| 17 | #define __stub_fattach | |
| 18 | 17 | #define __stub_fchflags |
| 19 | #define __stub_fdetach | |
| 20 | #define __stub_getmsg | |
| 21 | 18 | #define __stub_gtty |
| 22 | 19 | #define __stub_lchmod |
| 23 | #define __stub_putmsg | |
| 24 | 20 | #define __stub_revoke |
| 25 | 21 | #define __stub_setlogin |
| 26 | 22 | #define __stub_sigreturn |
lib/libc/include/x86_64-linux-gnux32/sys/io.h deleted-183| ... | ... | @@ -1,183 +0,0 @@ |
| 1 | /* Copyright (C) 1996-2019 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <http://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef	_SYS_IO_H | |
| 19 | #define	_SYS_IO_H	1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | ||
| 23 | __BEGIN_DECLS | |
| 24 | ||
| 25 | /* If TURN_ON is TRUE, request for permission to do direct i/o on the | |
| 26 | port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O | |
| 27 | permission off for that range. This call requires root privileges. | |
| 28 | ||
| 29 | Portability note: not all Linux platforms support this call. Most | |
| 30 | platforms based on the PC I/O architecture probably will, however. | |
| 31 | E.g., Linux/Alpha for Alpha PCs supports this. */ | |
| 32 | extern int ioperm (unsigned long int __from, unsigned long int __num, | |
| 33 | int __turn_on) __THROW; | |
| 34 | ||
| 35 | /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to | |
| 36 | access any I/O port is granted. This call requires root | |
| 37 | privileges. */ | |
| 38 | extern int iopl (int __level) __THROW; | |
| 39 | ||
| 40 | #if defined __GNUC__ && __GNUC__ >= 2 | |
| 41 | ||
| 42 | static __inline unsigned char | |
| 43 | inb (unsigned short int __port) | |
| 44 | { | |
| 45 | unsigned char _v; | |
| 46 | ||
| 47 | __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 48 | return _v; | |
| 49 | } | |
| 50 | ||
| 51 | static __inline unsigned char | |
| 52 | inb_p (unsigned short int __port) | |
| 53 | { | |
| 54 | unsigned char _v; | |
| 55 | ||
| 56 | __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 57 | return _v; | |
| 58 | } | |
| 59 | ||
| 60 | static __inline unsigned short int | |
| 61 | inw (unsigned short int __port) | |
| 62 | { | |
| 63 | unsigned short _v; | |
| 64 | ||
| 65 | __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 66 | return _v; | |
| 67 | } | |
| 68 | ||
| 69 | static __inline unsigned short int | |
| 70 | inw_p (unsigned short int __port) | |
| 71 | { | |
| 72 | unsigned short int _v; | |
| 73 | ||
| 74 | __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 75 | return _v; | |
| 76 | } | |
| 77 | ||
| 78 | static __inline unsigned int | |
| 79 | inl (unsigned short int __port) | |
| 80 | { | |
| 81 | unsigned int _v; | |
| 82 | ||
| 83 | __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); | |
| 84 | return _v; | |
| 85 | } | |
| 86 | ||
| 87 | static __inline unsigned int | |
| 88 | inl_p (unsigned short int __port) | |
| 89 | { | |
| 90 | unsigned int _v; | |
| 91 | __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); | |
| 92 | return _v; | |
| 93 | } | |
| 94 | ||
| 95 | static __inline void | |
| 96 | outb (unsigned char __value, unsigned short int __port) | |
| 97 | { | |
| 98 | __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); | |
| 99 | } | |
| 100 | ||
| 101 | static __inline void | |
| 102 | outb_p (unsigned char __value, unsigned short int __port) | |
| 103 | { | |
| 104 | __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 105 | 			"Nd" (__port)); | |
| 106 | } | |
| 107 | ||
| 108 | static __inline void | |
| 109 | outw (unsigned short int __value, unsigned short int __port) | |
| 110 | { | |
| 111 | __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); | |
| 112 | ||
| 113 | } | |
| 114 | ||
| 115 | static __inline void | |
| 116 | outw_p (unsigned short int __value, unsigned short int __port) | |
| 117 | { | |
| 118 | __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 119 | 			"Nd" (__port)); | |
| 120 | } | |
| 121 | ||
| 122 | static __inline void | |
| 123 | outl (unsigned int __value, unsigned short int __port) | |
| 124 | { | |
| 125 | __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); | |
| 126 | } | |
| 127 | ||
| 128 | static __inline void | |
| 129 | outl_p (unsigned int __value, unsigned short int __port) | |
| 130 | { | |
| 131 | __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), | |
| 132 | 			"Nd" (__port)); | |
| 133 | } | |
| 134 | ||
| 135 | static __inline void | |
| 136 | insb (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 137 | { | |
| 138 | __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) | |
| 139 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 140 | } | |
| 141 | ||
| 142 | static __inline void | |
| 143 | insw (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 144 | { | |
| 145 | __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) | |
| 146 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 147 | } | |
| 148 | ||
| 149 | static __inline void | |
| 150 | insl (unsigned short int __port, void *__addr, unsigned long int __count) | |
| 151 | { | |
| 152 | __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) | |
| 153 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 154 | } | |
| 155 | ||
| 156 | static __inline void | |
| 157 | outsb (unsigned short int __port, const void *__addr, | |
| 158 | unsigned long int __count) | |
| 159 | { | |
| 160 | __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) | |
| 161 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline void | |
| 165 | outsw (unsigned short int __port, const void *__addr, | |
| 166 | unsigned long int __count) | |
| 167 | { | |
| 168 | __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) | |
| 169 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 170 | } | |
| 171 | ||
| 172 | static __inline void | |
| 173 | outsl (unsigned short int __port, const void *__addr, | |
| 174 | unsigned long int __count) | |
| 175 | { | |
| 176 | __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) | |
| 177 | 			:"d" (__port), "0" (__addr), "1" (__count)); | |
| 178 | } | |
| 179 | ||
| 180 | #endif	/* GNU C */ | |
| 181 | ||
| 182 | __END_DECLS | |
| 183 | #endif /* _SYS_IO_H */ | |
| \ No newline at end of file |
src-self-hosted/arg.zig+2-2| ... | ... | @@ -5,7 +5,7 @@ const mem = std.mem; |
| 5 | 5 | |
| 6 | 6 | const Allocator = mem.Allocator; |
| 7 | 7 | const ArrayList = std.ArrayList; |
| 8 | const HashMap = std.HashMap; | |
| 8 | const StringHashMap = std.StringHashMap; | |
| 9 | 9 | |
| 10 | 10 | fn trimStart(slice: []const u8, ch: u8) []const u8 { |
| 11 | 11 | var i: usize = 0; |
| ... | ... | @@ -73,7 +73,7 @@ fn readFlagArguments(allocator: *Allocator, args: []const []const u8, required: |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | const HashMapFlags = HashMap([]const u8, FlagArg, std.hash.Fnv1a_32.hash, mem.eql_slice_u8); | |
| 76 | const HashMapFlags = StringHashMap(FlagArg); | |
| 77 | 77 | |
| 78 | 78 | // A store for querying found flags and positional arguments. |
| 79 | 79 | pub const Args = struct { |
src-self-hosted/compilation.zig+1-1| ... | ... | @@ -249,7 +249,7 @@ pub const Compilation = struct { |
| 249 | 249 | const ArrayTypeTable = std.HashMap(*const Type.Array.Key, *Type.Array, Type.Array.Key.hash, Type.Array.Key.eql); |
| 250 | 250 | const PtrTypeTable = std.HashMap(*const Type.Pointer.Key, *Type.Pointer, Type.Pointer.Key.hash, Type.Pointer.Key.eql); |
| 251 | 251 | const FnTypeTable = std.HashMap(*const Type.Fn.Key, *Type.Fn, Type.Fn.Key.hash, Type.Fn.Key.eql); |
| 252 | const TypeTable = std.HashMap([]const u8, *Type, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 252 | const TypeTable = std.StringHashMap(*Type); | |
| 253 | 253 | |
| 254 | 254 | const CompileErrList = std.ArrayList(*Msg); |
| 255 | 255 |
src-self-hosted/decl.zig+1-1| ... | ... | @@ -20,7 +20,7 @@ pub const Decl = struct { |
| 20 | 20 | // TODO when we destroy the decl, deref the tree scope |
| 21 | 21 | tree_scope: *Scope.AstTree, |
| 22 | 22 | |
| 23 | pub const Table = std.HashMap([]const u8, *Decl, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 23 | pub const Table = std.StringHashMap(*Decl); | |
| 24 | 24 | |
| 25 | 25 | pub fn cast(base: *Decl, comptime T: type) ?*T { |
| 26 | 26 | if (base.id != @field(Id, @typeName(T))) return null; |
src-self-hosted/main.zig+1-1| ... | ... | @@ -541,7 +541,7 @@ const Fmt = struct { |
| 541 | 541 | color: errmsg.Color, |
| 542 | 542 | loop: *event.Loop, |
| 543 | 543 | |
| 544 | const SeenMap = std.HashMap([]const u8, void, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 544 | const SeenMap = std.StringHashMap(void); | |
| 545 | 545 | }; |
| 546 | 546 | |
| 547 | 547 | fn parseLibcPaths(allocator: *Allocator, libc: *LibCInstallation, libc_paths_file: []const u8) void { |
src-self-hosted/package.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ pub const Package = struct { |
| 10 | 10 | /// relative to root_src_dir |
| 11 | 11 | table: Table, |
| 12 | 12 | |
| 13 | pub const Table = std.HashMap([]const u8, *Package, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 13 | pub const Table = std.StringHashMap(*Package); | |
| 14 | 14 | |
| 15 | 15 | /// makes internal copies of root_src_dir and root_src_path |
| 16 | 16 | /// allocator should be an arena allocator because Package never frees anything |
src-self-hosted/stage1.zig+2-2| ... | ... | @@ -343,7 +343,7 @@ const Fmt = struct { |
| 343 | 343 | color: errmsg.Color, |
| 344 | 344 | allocator: *mem.Allocator, |
| 345 | 345 | |
| 346 | const SeenMap = std.HashMap([]const u8, void, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 346 | const SeenMap = std.StringHashMap(void); | |
| 347 | 347 | }; |
| 348 | 348 | |
| 349 | 349 | fn printErrMsgToFile( |
| ... | ... | @@ -376,7 +376,7 @@ fn printErrMsgToFile( |
| 376 | 376 | const text = text_buf.toOwnedSlice(); |
| 377 | 377 | |
| 378 | 378 | const stream = &file.outStream().stream; |
| 379 | try stream.print( "{}:{}:{}: error: {}\n", path, start_loc.line + 1, start_loc.column + 1, text); | |
| 379 | try stream.print("{}:{}:{}: error: {}\n", path, start_loc.line + 1, start_loc.column + 1, text); | |
| 380 | 380 | |
| 381 | 381 | if (!color_on) return; |
| 382 | 382 |
src/all_types.hpp+73-14| ... | ... | @@ -25,6 +25,7 @@ struct ZigFn; |
| 25 | 25 | struct Scope; |
| 26 | 26 | struct ScopeBlock; |
| 27 | 27 | struct ScopeFnDef; |
| 28 | struct ScopeExpr; | |
| 28 | 29 | struct ZigType; |
| 29 | 30 | struct ZigVar; |
| 30 | 31 | struct ErrorTableEntry; |
| ... | ... | @@ -47,6 +48,7 @@ struct ResultLoc; |
| 47 | 48 | struct ResultLocPeer; |
| 48 | 49 | struct ResultLocPeerParent; |
| 49 | 50 | struct ResultLocBitCast; |
| 51 | struct ResultLocReturn; | |
| 50 | 52 | |
| 51 | 53 | enum PtrLen { |
| 52 | 54 | PtrLenUnknown, |
| ... | ... | @@ -54,6 +56,14 @@ enum PtrLen { |
| 54 | 56 | PtrLenC, |
| 55 | 57 | }; |
| 56 | 58 | |
| 59 | // This one corresponds to the builtin.zig enum. | |
| 60 | enum BuiltinPtrSize { | |
| 61 | BuiltinPtrSizeOne, | |
| 62 | BuiltinPtrSizeMany, | |
| 63 | BuiltinPtrSizeSlice, | |
| 64 | BuiltinPtrSizeC, | |
| 65 | }; | |
| 66 | ||
| 57 | 67 | enum UndefAllowed { |
| 58 | 68 | UndefOk, |
| 59 | 69 | UndefBad, |
| ... | ... | @@ -595,6 +605,12 @@ enum CallingConvention { |
| 595 | 605 | CallingConventionAsync, |
| 596 | 606 | }; |
| 597 | 607 | |
| 608 | enum FnInline { | |
| 609 | FnInlineAuto, | |
| 610 | FnInlineAlways, | |
| 611 | FnInlineNever, | |
| 612 | }; | |
| 613 | ||
| 598 | 614 | struct AstNodeFnProto { |
| 599 | 615 | VisibMod visib_mod; |
| 600 | 616 | Buf *name; |
| ... | ... | @@ -604,7 +620,7 @@ struct AstNodeFnProto { |
| 604 | 620 | bool is_var_args; |
| 605 | 621 | bool is_extern; |
| 606 | 622 | bool is_export; |
| 607 | bool is_inline; | |
| 623 | FnInline fn_inline; | |
| 608 | 624 | CallingConvention cc; |
| 609 | 625 | AstNode *fn_def_node; |
| 610 | 626 | // populated if this is an extern declaration |
| ... | ... | @@ -743,11 +759,17 @@ struct AstNodeUnwrapOptional { |
| 743 | 759 | AstNode *expr; |
| 744 | 760 | }; |
| 745 | 761 | |
| 762 | enum CallModifier { | |
| 763 | CallModifierNone, | |
| 764 | CallModifierAsync, | |
| 765 | CallModifierNoAsync, | |
| 766 | CallModifierBuiltin, | |
| 767 | }; | |
| 768 | ||
| 746 | 769 | struct AstNodeFnCallExpr { |
| 747 | 770 | AstNode *fn_ref_expr; |
| 748 | 771 | ZigList<AstNode *> params; |
| 749 | bool is_builtin; | |
| 750 | bool is_async; | |
| 772 | CallModifier modifier; | |
| 751 | 773 | bool seen; // used by @compileLog |
| 752 | 774 | }; |
| 753 | 775 | |
| ... | ... | @@ -1445,12 +1467,6 @@ enum FnAnalState { |
| 1445 | 1467 | FnAnalStateInvalid, |
| 1446 | 1468 | }; |
| 1447 | 1469 | |
| 1448 | enum FnInline { | |
| 1449 | FnInlineAuto, | |
| 1450 | FnInlineAlways, | |
| 1451 | FnInlineNever, | |
| 1452 | }; | |
| 1453 | ||
| 1454 | 1470 | struct GlobalExport { |
| 1455 | 1471 | Buf name; |
| 1456 | 1472 | GlobalLinkageId linkage; |
| ... | ... | @@ -1534,6 +1550,7 @@ enum BuiltinFnId { |
| 1534 | 1550 | BuiltinFnIdMemberName, |
| 1535 | 1551 | BuiltinFnIdField, |
| 1536 | 1552 | BuiltinFnIdTypeInfo, |
| 1553 | BuiltinFnIdType, | |
| 1537 | 1554 | BuiltinFnIdHasField, |
| 1538 | 1555 | BuiltinFnIdTypeof, |
| 1539 | 1556 | BuiltinFnIdAddWithOverflow, |
| ... | ... | @@ -1664,6 +1681,7 @@ enum PanicMsgId { |
| 1664 | 1681 | PanicMsgIdResumedAnAwaitingFn, |
| 1665 | 1682 | PanicMsgIdFrameTooSmall, |
| 1666 | 1683 | PanicMsgIdResumedFnPendingAwait, |
| 1684 | PanicMsgIdBadNoAsyncCall, | |
| 1667 | 1685 | |
| 1668 | 1686 | PanicMsgIdCount, |
| 1669 | 1687 | }; |
| ... | ... | @@ -1954,6 +1972,8 @@ struct CodeGen { |
| 1954 | 1972 | ZigFn *panic_fn; |
| 1955 | 1973 | TldFn *panic_tld_fn; |
| 1956 | 1974 | |
| 1975 | ZigFn *largest_frame_fn; | |
| 1976 | ||
| 1957 | 1977 | WantPIC want_pic; |
| 1958 | 1978 | WantStackCheck want_stack_check; |
| 1959 | 1979 | CacheHash cache_hash; |
| ... | ... | @@ -1986,9 +2006,11 @@ struct CodeGen { |
| 1986 | 2006 | bool generate_error_name_table; |
| 1987 | 2007 | bool enable_cache; // mutually exclusive with output_dir |
| 1988 | 2008 | bool enable_time_report; |
| 2009 | bool enable_stack_report; | |
| 1989 | 2010 | bool system_linker_hack; |
| 1990 | 2011 | bool reported_bad_link_libc_error; |
| 1991 | 2012 | bool is_dynamic; // shared library rather than static library. dynamic musl rather than static musl. |
| 2013 | bool need_frame_size_prefix_data; | |
| 1992 | 2014 | |
| 1993 | 2015 | //////////////////////////// Participates in Input Parameter Cache Hash |
| 1994 | 2016 | /////// Note: there is a separate cache hash for builtin.zig, when adding fields, |
| ... | ... | @@ -2051,7 +2073,7 @@ struct CodeGen { |
| 2051 | 2073 | }; |
| 2052 | 2074 | |
| 2053 | 2075 | struct ZigVar { |
| 2054 | Buf name; | |
| 2076 | const char *name; | |
| 2055 | 2077 | ConstExprValue *const_value; |
| 2056 | 2078 | ZigType *var_type; |
| 2057 | 2079 | LLVMValueRef value_ref; |
| ... | ... | @@ -2066,7 +2088,6 @@ struct ZigVar { |
| 2066 | 2088 | LLVMValueRef param_value_ref; |
| 2067 | 2089 | size_t mem_slot_index; |
| 2068 | 2090 | IrExecutable *owner_exec; |
| 2069 | size_t ref_count; | |
| 2070 | 2091 | |
| 2071 | 2092 | // In an inline loop, multiple variables may be created, |
| 2072 | 2093 | // In this case, a reference to a variable should follow |
| ... | ... | @@ -2076,6 +2097,7 @@ struct ZigVar { |
| 2076 | 2097 | ZigList<GlobalExport> export_list; |
| 2077 | 2098 | |
| 2078 | 2099 | uint32_t align_bytes; |
| 2100 | uint32_t ref_count; | |
| 2079 | 2101 | |
| 2080 | 2102 | bool shadowable; |
| 2081 | 2103 | bool src_is_const; |
| ... | ... | @@ -2106,6 +2128,7 @@ enum ScopeId { |
| 2106 | 2128 | ScopeIdCompTime, |
| 2107 | 2129 | ScopeIdRuntime, |
| 2108 | 2130 | ScopeIdTypeOf, |
| 2131 | ScopeIdExpr, | |
| 2109 | 2132 | }; |
| 2110 | 2133 | |
| 2111 | 2134 | struct Scope { |
| ... | ... | @@ -2211,6 +2234,7 @@ struct ScopeLoop { |
| 2211 | 2234 | ZigList<IrInstruction *> *incoming_values; |
| 2212 | 2235 | ZigList<IrBasicBlock *> *incoming_blocks; |
| 2213 | 2236 | ResultLocPeerParent *peer_parent; |
| 2237 | ScopeExpr *spill_scope; | |
| 2214 | 2238 | }; |
| 2215 | 2239 | |
| 2216 | 2240 | // This scope blocks certain things from working such as comptime continue |
| ... | ... | @@ -2253,6 +2277,24 @@ struct ScopeTypeOf { |
| 2253 | 2277 | Scope base; |
| 2254 | 2278 | }; |
| 2255 | 2279 | |
| 2280 | enum MemoizedBool { | |
| 2281 | MemoizedBoolUnknown, | |
| 2282 | MemoizedBoolFalse, | |
| 2283 | MemoizedBoolTrue, | |
| 2284 | }; | |
| 2285 | ||
| 2286 | // This scope is created for each expression. | |
| 2287 | // It's used to identify when an instruction needs to be spilled, | |
| 2288 | // so that it can be accessed after a suspend point. | |
| 2289 | struct ScopeExpr { | |
| 2290 | Scope base; | |
| 2291 | ||
| 2292 | ScopeExpr **children_ptr; | |
| 2293 | size_t children_len; | |
| 2294 | ||
| 2295 | MemoizedBool need_spill; | |
| 2296 | }; | |
| 2297 | ||
| 2256 | 2298 | // synchronized with code in define_builtin_compile_vars |
| 2257 | 2299 | enum AtomicOrder { |
| 2258 | 2300 | AtomicOrderUnordered, |
| ... | ... | @@ -2435,6 +2477,7 @@ enum IrInstructionId { |
| 2435 | 2477 | IrInstructionIdByteOffsetOf, |
| 2436 | 2478 | IrInstructionIdBitOffsetOf, |
| 2437 | 2479 | IrInstructionIdTypeInfo, |
| 2480 | IrInstructionIdType, | |
| 2438 | 2481 | IrInstructionIdHasField, |
| 2439 | 2482 | IrInstructionIdTypeId, |
| 2440 | 2483 | IrInstructionIdSetEvalBranchQuota, |
| ... | ... | @@ -2491,6 +2534,10 @@ struct IrInstruction { |
| 2491 | 2534 | // with this child field. |
| 2492 | 2535 | IrInstruction *child; |
| 2493 | 2536 | IrBasicBlock *owner_bb; |
| 2537 | // Nearly any instruction can have to be stored as a local variable before suspending | |
| 2538 | // and then loaded after resuming, in case there is an expression with a suspend point | |
| 2539 | // in it, such as: x + await y | |
| 2540 | IrInstruction *spill; | |
| 2494 | 2541 | IrInstructionId id; |
| 2495 | 2542 | // true if this instruction was generated by zig and not from user code |
| 2496 | 2543 | bool is_gen; |
| ... | ... | @@ -2718,8 +2765,10 @@ struct IrInstructionCallSrc { |
| 2718 | 2765 | ResultLoc *result_loc; |
| 2719 | 2766 | |
| 2720 | 2767 | IrInstruction *new_stack; |
| 2768 | ||
| 2721 | 2769 | FnInline fn_inline; |
| 2722 | bool is_async; | |
| 2770 | CallModifier modifier; | |
| 2771 | ||
| 2723 | 2772 | bool is_async_call_builtin; |
| 2724 | 2773 | bool is_comptime; |
| 2725 | 2774 | }; |
| ... | ... | @@ -2733,10 +2782,11 @@ struct IrInstructionCallGen { |
| 2733 | 2782 | IrInstruction **args; |
| 2734 | 2783 | IrInstruction *result_loc; |
| 2735 | 2784 | IrInstruction *frame_result_loc; |
| 2736 | ||
| 2737 | 2785 | IrInstruction *new_stack; |
| 2786 | ||
| 2738 | 2787 | FnInline fn_inline; |
| 2739 | bool is_async; | |
| 2788 | CallModifier modifier; | |
| 2789 | ||
| 2740 | 2790 | bool is_async_call_builtin; |
| 2741 | 2791 | }; |
| 2742 | 2792 | |
| ... | ... | @@ -3471,6 +3521,12 @@ struct IrInstructionTypeInfo { |
| 3471 | 3521 | IrInstruction *type_value; |
| 3472 | 3522 | }; |
| 3473 | 3523 | |
| 3524 | struct IrInstructionType { | |
| 3525 | IrInstruction base; | |
| 3526 | ||
| 3527 | IrInstruction *type_info; | |
| 3528 | }; | |
| 3529 | ||
| 3474 | 3530 | struct IrInstructionHasField { |
| 3475 | 3531 | IrInstruction base; |
| 3476 | 3532 | |
| ... | ... | @@ -3567,6 +3623,7 @@ struct IrInstructionAddImplicitReturnType { |
| 3567 | 3623 | IrInstruction base; |
| 3568 | 3624 | |
| 3569 | 3625 | IrInstruction *value; |
| 3626 | ResultLocReturn *result_loc_ret; | |
| 3570 | 3627 | }; |
| 3571 | 3628 | |
| 3572 | 3629 | // For float ops which take a single argument |
| ... | ... | @@ -3793,6 +3850,8 @@ struct ResultLocVar { |
| 3793 | 3850 | |
| 3794 | 3851 | struct ResultLocReturn { |
| 3795 | 3852 | ResultLoc base; |
| 3853 | ||
| 3854 | bool implicit_return_type_done; | |
| 3796 | 3855 | }; |
| 3797 | 3856 | |
| 3798 | 3857 | struct IrSuspendPosition { |
src/analyze.cpp+337-88| ... | ... | @@ -96,6 +96,30 @@ static ScopeDecls **get_container_scope_ptr(ZigType *type_entry) { |
| 96 | 96 | zig_unreachable(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | static ScopeExpr *find_expr_scope(Scope *scope) { | |
| 100 | for (;;) { | |
| 101 | switch (scope->id) { | |
| 102 | case ScopeIdExpr: | |
| 103 | return reinterpret_cast<ScopeExpr *>(scope); | |
| 104 | case ScopeIdDefer: | |
| 105 | case ScopeIdDeferExpr: | |
| 106 | case ScopeIdDecls: | |
| 107 | case ScopeIdFnDef: | |
| 108 | case ScopeIdCompTime: | |
| 109 | case ScopeIdVarDecl: | |
| 110 | case ScopeIdCImport: | |
| 111 | case ScopeIdSuspend: | |
| 112 | case ScopeIdTypeOf: | |
| 113 | case ScopeIdBlock: | |
| 114 | return nullptr; | |
| 115 | case ScopeIdLoop: | |
| 116 | case ScopeIdRuntime: | |
| 117 | scope = scope->parent; | |
| 118 | continue; | |
| 119 | } | |
| 120 | } | |
| 121 | } | |
| 122 | ||
| 99 | 123 | ScopeDecls *get_container_scope(ZigType *type_entry) { |
| 100 | 124 | return *get_container_scope_ptr(type_entry); |
| 101 | 125 | } |
| ... | ... | @@ -203,6 +227,20 @@ Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent) { |
| 203 | 227 | return &scope->base; |
| 204 | 228 | } |
| 205 | 229 | |
| 230 | ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent) { | |
| 231 | ScopeExpr *scope = allocate<ScopeExpr>(1); | |
| 232 | init_scope(g, &scope->base, ScopeIdExpr, node, parent); | |
| 233 | ScopeExpr *parent_expr = find_expr_scope(parent); | |
| 234 | if (parent_expr != nullptr) { | |
| 235 | size_t new_len = parent_expr->children_len + 1; | |
| 236 | parent_expr->children_ptr = reallocate_nonzero<ScopeExpr *>( | |
| 237 | parent_expr->children_ptr, parent_expr->children_len, new_len); | |
| 238 | parent_expr->children_ptr[parent_expr->children_len] = scope; | |
| 239 | parent_expr->children_len = new_len; | |
| 240 | } | |
| 241 | return scope; | |
| 242 | } | |
| 243 | ||
| 206 | 244 | ZigType *get_scope_import(Scope *scope) { |
| 207 | 245 | while (scope) { |
| 208 | 246 | if (scope->id == ScopeIdDecls) { |
| ... | ... | @@ -1719,6 +1757,32 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc |
| 1719 | 1757 | return g->builtin_types.entry_invalid; |
| 1720 | 1758 | } |
| 1721 | 1759 | |
| 1760 | switch (specified_return_type->id) { | |
| 1761 | case ZigTypeIdInvalid: | |
| 1762 | zig_unreachable(); | |
| 1763 | ||
| 1764 | case ZigTypeIdUndefined: | |
| 1765 | case ZigTypeIdNull: | |
| 1766 | case ZigTypeIdArgTuple: | |
| 1767 | add_node_error(g, fn_proto->return_type, | |
| 1768 | buf_sprintf("return type '%s' not allowed", buf_ptr(&specified_return_type->name))); | |
| 1769 | return g->builtin_types.entry_invalid; | |
| 1770 | ||
| 1771 | case ZigTypeIdOpaque: | |
| 1772 | { | |
| 1773 | ErrorMsg* msg = add_node_error(g, fn_proto->return_type, | |
| 1774 | buf_sprintf("opaque return type '%s' not allowed", buf_ptr(&specified_return_type->name))); | |
| 1775 | Tld *tld = find_decl(g, &fn_entry->fndef_scope->base, &specified_return_type->name); | |
| 1776 | if (tld != nullptr) { | |
| 1777 | add_error_note(g, msg, tld->source_node, buf_sprintf("declared here")); | |
| 1778 | } | |
| 1779 | return g->builtin_types.entry_invalid; | |
| 1780 | } | |
| 1781 | ||
| 1782 | default: | |
| 1783 | break; | |
| 1784 | } | |
| 1785 | ||
| 1722 | 1786 | if (fn_proto->auto_err_set) { |
| 1723 | 1787 | ZigType *inferred_err_set_type = get_auto_err_set_type(g, fn_entry); |
| 1724 | 1788 | if ((err = type_resolve(g, specified_return_type, ResolveStatusSizeKnown))) |
| ... | ... | @@ -1744,15 +1808,11 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc |
| 1744 | 1808 | |
| 1745 | 1809 | switch (fn_type_id.return_type->id) { |
| 1746 | 1810 | case ZigTypeIdInvalid: |
| 1747 | zig_unreachable(); | |
| 1748 | ||
| 1749 | 1811 | case ZigTypeIdUndefined: |
| 1750 | 1812 | case ZigTypeIdNull: |
| 1751 | 1813 | case ZigTypeIdArgTuple: |
| 1752 | 1814 | case ZigTypeIdOpaque: |
| 1753 | add_node_error(g, fn_proto->return_type, | |
| 1754 | buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name))); | |
| 1755 | return g->builtin_types.entry_invalid; | |
| 1815 | zig_unreachable(); | |
| 1756 | 1816 | |
| 1757 | 1817 | case ZigTypeIdComptimeFloat: |
| 1758 | 1818 | case ZigTypeIdComptimeInt: |
| ... | ... | @@ -2043,34 +2103,30 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) { |
| 2043 | 2103 | |
| 2044 | 2104 | |
| 2045 | 2105 | // Resolve types for fields |
| 2046 | if (!packed) { | |
| 2047 | for (size_t i = 0; i < field_count; i += 1) { | |
| 2048 | TypeStructField *field = &struct_type->data.structure.fields[i]; | |
| 2049 | ZigType *field_type = resolve_struct_field_type(g, field); | |
| 2050 | if (field_type == nullptr) { | |
| 2051 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2052 | return err; | |
| 2053 | } | |
| 2054 | ||
| 2055 | if ((err = type_resolve(g, field_type, ResolveStatusSizeKnown))) { | |
| 2056 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2057 | return err; | |
| 2058 | } | |
| 2106 | for (size_t i = 0; i < field_count; i += 1) { | |
| 2107 | TypeStructField *field = &struct_type->data.structure.fields[i]; | |
| 2108 | ZigType *field_type = resolve_struct_field_type(g, field); | |
| 2109 | if (field_type == nullptr) { | |
| 2110 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2111 | return err; | |
| 2112 | } | |
| 2059 | 2113 | |
| 2060 | if (struct_type->data.structure.layout == ContainerLayoutExtern && | |
| 2061 | !type_allowed_in_extern(g, field_type)) | |
| 2062 | { | |
| 2063 | add_node_error(g, field->decl_node, | |
| 2064 | buf_sprintf("extern structs cannot contain fields of type '%s'", | |
| 2065 | buf_ptr(&field_type->name))); | |
| 2066 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2067 | return ErrorSemanticAnalyzeFail; | |
| 2068 | } | |
| 2114 | if ((err = type_resolve(g, field_type, ResolveStatusSizeKnown))) { | |
| 2115 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2116 | return err; | |
| 2117 | } | |
| 2069 | 2118 | |
| 2119 | if (struct_type->data.structure.layout == ContainerLayoutExtern && | |
| 2120 | !type_allowed_in_extern(g, field_type)) | |
| 2121 | { | |
| 2122 | add_node_error(g, field->decl_node, | |
| 2123 | buf_sprintf("extern structs cannot contain fields of type '%s'", | |
| 2124 | buf_ptr(&field_type->name))); | |
| 2125 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; | |
| 2126 | return ErrorSemanticAnalyzeFail; | |
| 2070 | 2127 | } |
| 2071 | 2128 | } |
| 2072 | 2129 | |
| 2073 | ||
| 2074 | 2130 | return ErrorNone; |
| 2075 | 2131 | } |
| 2076 | 2132 | |
| ... | ... | @@ -2671,6 +2727,10 @@ static Error resolve_struct_alignment(CodeGen *g, ZigType *struct_type) { |
| 2671 | 2727 | } |
| 2672 | 2728 | } |
| 2673 | 2729 | |
| 2730 | if (!type_has_bits(struct_type)) { | |
| 2731 | assert(struct_type->abi_align == 0); | |
| 2732 | } | |
| 2733 | ||
| 2674 | 2734 | struct_type->data.structure.resolve_loop_flag_other = false; |
| 2675 | 2735 | |
| 2676 | 2736 | if (struct_type->data.structure.resolve_status == ResolveStatusInvalid) { |
| ... | ... | @@ -3062,8 +3122,7 @@ ZigFn *create_fn(CodeGen *g, AstNode *proto_node) { |
| 3062 | 3122 | assert(proto_node->type == NodeTypeFnProto); |
| 3063 | 3123 | AstNodeFnProto *fn_proto = &proto_node->data.fn_proto; |
| 3064 | 3124 | |
| 3065 | FnInline inline_value = fn_proto->is_inline ? FnInlineAlways : FnInlineAuto; | |
| 3066 | ZigFn *fn_entry = create_fn_raw(g, inline_value); | |
| 3125 | ZigFn *fn_entry = create_fn_raw(g, fn_proto->fn_inline); | |
| 3067 | 3126 | |
| 3068 | 3127 | fn_entry->proto_node = proto_node; |
| 3069 | 3128 | fn_entry->body_node = (proto_node->data.fn_proto.fn_def_node == nullptr) ? nullptr : |
| ... | ... | @@ -3111,26 +3170,26 @@ ZigType *get_test_fn_type(CodeGen *g) { |
| 3111 | 3170 | return g->test_fn_type; |
| 3112 | 3171 | } |
| 3113 | 3172 | |
| 3114 | void add_var_export(CodeGen *g, ZigVar *var, Buf *symbol_name, GlobalLinkageId linkage) { | |
| 3173 | void add_var_export(CodeGen *g, ZigVar *var, const char *symbol_name, GlobalLinkageId linkage) { | |
| 3115 | 3174 | GlobalExport *global_export = var->export_list.add_one(); |
| 3116 | 3175 | memset(global_export, 0, sizeof(GlobalExport)); |
| 3117 | buf_init_from_buf(&global_export->name, symbol_name); | |
| 3176 | buf_init_from_str(&global_export->name, symbol_name); | |
| 3118 | 3177 | global_export->linkage = linkage; |
| 3119 | 3178 | } |
| 3120 | 3179 | |
| 3121 | void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, Buf *symbol_name, GlobalLinkageId linkage, bool ccc) { | |
| 3180 | void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, const char *symbol_name, GlobalLinkageId linkage, bool ccc) { | |
| 3122 | 3181 | if (ccc) { |
| 3123 | if (buf_eql_str(symbol_name, "main") && g->libc_link_lib != nullptr) { | |
| 3182 | if (strcmp(symbol_name, "main") == 0 && g->libc_link_lib != nullptr) { | |
| 3124 | 3183 | g->have_c_main = true; |
| 3125 | } else if (buf_eql_str(symbol_name, "WinMain") && | |
| 3184 | } else if (strcmp(symbol_name, "WinMain") == 0 && | |
| 3126 | 3185 | g->zig_target->os == OsWindows) |
| 3127 | 3186 | { |
| 3128 | 3187 | g->have_winmain = true; |
| 3129 | } else if (buf_eql_str(symbol_name, "WinMainCRTStartup") && | |
| 3188 | } else if (strcmp(symbol_name, "WinMainCRTStartup") == 0 && | |
| 3130 | 3189 | g->zig_target->os == OsWindows) |
| 3131 | 3190 | { |
| 3132 | 3191 | g->have_winmain_crt_startup = true; |
| 3133 | } else if (buf_eql_str(symbol_name, "DllMainCRTStartup") && | |
| 3192 | } else if (strcmp(symbol_name, "DllMainCRTStartup") == 0 && | |
| 3134 | 3193 | g->zig_target->os == OsWindows) |
| 3135 | 3194 | { |
| 3136 | 3195 | g->have_dllmain_crt_startup = true; |
| ... | ... | @@ -3139,7 +3198,7 @@ void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, Buf *symbol_name, GlobalLi |
| 3139 | 3198 | |
| 3140 | 3199 | GlobalExport *fn_export = fn_table_entry->export_list.add_one(); |
| 3141 | 3200 | memset(fn_export, 0, sizeof(GlobalExport)); |
| 3142 | buf_init_from_buf(&fn_export->name, symbol_name); | |
| 3201 | buf_init_from_str(&fn_export->name, symbol_name); | |
| 3143 | 3202 | fn_export->linkage = linkage; |
| 3144 | 3203 | } |
| 3145 | 3204 | |
| ... | ... | @@ -3163,7 +3222,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { |
| 3163 | 3222 | |
| 3164 | 3223 | if (fn_proto->is_export) { |
| 3165 | 3224 | bool ccc = (fn_proto->cc == CallingConventionUnspecified || fn_proto->cc == CallingConventionC); |
| 3166 | add_fn_export(g, fn_table_entry, &fn_table_entry->symbol_name, GlobalLinkageIdStrong, ccc); | |
| 3225 | add_fn_export(g, fn_table_entry, buf_ptr(&fn_table_entry->symbol_name), GlobalLinkageIdStrong, ccc); | |
| 3167 | 3226 | } |
| 3168 | 3227 | |
| 3169 | 3228 | if (!is_extern) { |
| ... | ... | @@ -3522,7 +3581,7 @@ ZigVar *add_variable(CodeGen *g, AstNode *source_node, Scope *parent_scope, Buf |
| 3522 | 3581 | variable_entry->src_arg_index = SIZE_MAX; |
| 3523 | 3582 | |
| 3524 | 3583 | assert(name); |
| 3525 | buf_init_from_buf(&variable_entry->name, name); | |
| 3584 | variable_entry->name = strdup(buf_ptr(name)); | |
| 3526 | 3585 | |
| 3527 | 3586 | if ((err = type_resolve(g, var_type, ResolveStatusAlignmentKnown))) { |
| 3528 | 3587 | variable_entry->var_type = g->builtin_types.entry_invalid; |
| ... | ... | @@ -3670,7 +3729,7 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var, bool allow_lazy) { |
| 3670 | 3729 | } |
| 3671 | 3730 | |
| 3672 | 3731 | if (is_export) { |
| 3673 | add_var_export(g, tld_var->var, &tld_var->var->name, GlobalLinkageIdStrong); | |
| 3732 | add_var_export(g, tld_var->var, tld_var->var->name, GlobalLinkageIdStrong); | |
| 3674 | 3733 | } |
| 3675 | 3734 | |
| 3676 | 3735 | g->global_vars.append(tld_var); |
| ... | ... | @@ -3879,7 +3938,7 @@ ZigVar *find_variable(CodeGen *g, Scope *scope, Buf *name, ScopeFnDef **crossed_ |
| 3879 | 3938 | while (scope) { |
| 3880 | 3939 | if (scope->id == ScopeIdVarDecl) { |
| 3881 | 3940 | ScopeVarDecl *var_scope = (ScopeVarDecl *)scope; |
| 3882 | if (buf_eql_buf(name, &var_scope->var->name)) { | |
| 3941 | if (buf_eql_str(name, var_scope->var->name)) { | |
| 3883 | 3942 | if (crossed_fndef_scope != nullptr) |
| 3884 | 3943 | *crossed_fndef_scope = my_crossed_fndef_scope; |
| 3885 | 3944 | return var_scope->var; |
| ... | ... | @@ -4191,7 +4250,7 @@ bool fn_is_async(ZigFn *fn) { |
| 4191 | 4250 | return fn->inferred_async_node != inferred_async_none; |
| 4192 | 4251 | } |
| 4193 | 4252 | |
| 4194 | static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { | |
| 4253 | void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { | |
| 4195 | 4254 | assert(fn->inferred_async_node != nullptr); |
| 4196 | 4255 | assert(fn->inferred_async_node != inferred_async_checking); |
| 4197 | 4256 | assert(fn->inferred_async_node != inferred_async_none); |
| ... | ... | @@ -4215,7 +4274,7 @@ static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { |
| 4215 | 4274 | add_error_note(g, msg, fn->inferred_async_node, |
| 4216 | 4275 | buf_sprintf("await here is a suspend point")); |
| 4217 | 4276 | } else if (fn->inferred_async_node->type == NodeTypeFnCallExpr && |
| 4218 | fn->inferred_async_node->data.fn_call_expr.is_builtin) | |
| 4277 | fn->inferred_async_node->data.fn_call_expr.modifier == CallModifierBuiltin) | |
| 4219 | 4278 | { |
| 4220 | 4279 | add_error_note(g, msg, fn->inferred_async_node, |
| 4221 | 4280 | buf_sprintf("@frame() causes function to be async")); |
| ... | ... | @@ -4229,33 +4288,44 @@ static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { |
| 4229 | 4288 | // ErrorIsAsync - yes async |
| 4230 | 4289 | // ErrorSemanticAnalyzeFail - compile error emitted result is invalid |
| 4231 | 4290 | static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode *call_node, |
| 4232 | bool must_not_be_async) | |
| 4291 | bool must_not_be_async, CallModifier modifier) | |
| 4233 | 4292 | { |
| 4234 | if (callee->type_entry->data.fn.fn_type_id.cc != CallingConventionUnspecified) | |
| 4293 | if (modifier == CallModifierNoAsync) | |
| 4235 | 4294 | return ErrorNone; |
| 4236 | if (callee->anal_state == FnAnalStateReady) { | |
| 4237 | analyze_fn_body(g, callee); | |
| 4238 | if (callee->anal_state == FnAnalStateInvalid) { | |
| 4239 | return ErrorSemanticAnalyzeFail; | |
| 4240 | } | |
| 4295 | bool callee_is_async = false; | |
| 4296 | switch (callee->type_entry->data.fn.fn_type_id.cc) { | |
| 4297 | case CallingConventionUnspecified: | |
| 4298 | break; | |
| 4299 | case CallingConventionAsync: | |
| 4300 | callee_is_async = true; | |
| 4301 | break; | |
| 4302 | default: | |
| 4303 | return ErrorNone; | |
| 4241 | 4304 | } |
| 4242 | bool callee_is_async; | |
| 4243 | if (callee->anal_state == FnAnalStateComplete) { | |
| 4244 | analyze_fn_async(g, callee, true); | |
| 4245 | if (callee->anal_state == FnAnalStateInvalid) { | |
| 4246 | return ErrorSemanticAnalyzeFail; | |
| 4305 | if (!callee_is_async) { | |
| 4306 | if (callee->anal_state == FnAnalStateReady) { | |
| 4307 | analyze_fn_body(g, callee); | |
| 4308 | if (callee->anal_state == FnAnalStateInvalid) { | |
| 4309 | return ErrorSemanticAnalyzeFail; | |
| 4310 | } | |
| 4247 | 4311 | } |
| 4248 | callee_is_async = fn_is_async(callee); | |
| 4249 | } else { | |
| 4250 | // If it's already been determined, use that value. Otherwise | |
| 4251 | // assume non-async, emit an error later if it turned out to be async. | |
| 4252 | if (callee->inferred_async_node == nullptr || | |
| 4253 | callee->inferred_async_node == inferred_async_checking) | |
| 4254 | { | |
| 4255 | callee->assumed_non_async = call_node; | |
| 4256 | callee_is_async = false; | |
| 4312 | if (callee->anal_state == FnAnalStateComplete) { | |
| 4313 | analyze_fn_async(g, callee, true); | |
| 4314 | if (callee->anal_state == FnAnalStateInvalid) { | |
| 4315 | return ErrorSemanticAnalyzeFail; | |
| 4316 | } | |
| 4317 | callee_is_async = fn_is_async(callee); | |
| 4257 | 4318 | } else { |
| 4258 | callee_is_async = callee->inferred_async_node != inferred_async_none; | |
| 4319 | // If it's already been determined, use that value. Otherwise | |
| 4320 | // assume non-async, emit an error later if it turned out to be async. | |
| 4321 | if (callee->inferred_async_node == nullptr || | |
| 4322 | callee->inferred_async_node == inferred_async_checking) | |
| 4323 | { | |
| 4324 | callee->assumed_non_async = call_node; | |
| 4325 | callee_is_async = false; | |
| 4326 | } else { | |
| 4327 | callee_is_async = callee->inferred_async_node != inferred_async_none; | |
| 4328 | } | |
| 4259 | 4329 | } |
| 4260 | 4330 | } |
| 4261 | 4331 | if (callee_is_async) { |
| ... | ... | @@ -4313,7 +4383,9 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) { |
| 4313 | 4383 | // TODO function pointer call here, could be anything |
| 4314 | 4384 | continue; |
| 4315 | 4385 | } |
| 4316 | switch (analyze_callee_async(g, fn, call->fn_entry, call->base.source_node, must_not_be_async)) { | |
| 4386 | switch (analyze_callee_async(g, fn, call->fn_entry, call->base.source_node, must_not_be_async, | |
| 4387 | call->modifier)) | |
| 4388 | { | |
| 4317 | 4389 | case ErrorSemanticAnalyzeFail: |
| 4318 | 4390 | fn->anal_state = FnAnalStateInvalid; |
| 4319 | 4391 | return; |
| ... | ... | @@ -4330,7 +4402,11 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) { |
| 4330 | 4402 | } |
| 4331 | 4403 | for (size_t i = 0; i < fn->await_list.length; i += 1) { |
| 4332 | 4404 | IrInstructionAwaitGen *await = fn->await_list.at(i); |
| 4333 | switch (analyze_callee_async(g, fn, await->target_fn, await->base.source_node, must_not_be_async)) { | |
| 4405 | // TODO If this is a noasync await, it doesn't count | |
| 4406 | // https://github.com/ziglang/zig/issues/3157 | |
| 4407 | switch (analyze_callee_async(g, fn, await->target_fn, await->base.source_node, must_not_be_async, | |
| 4408 | CallModifierNone)) | |
| 4409 | { | |
| 4334 | 4410 | case ErrorSemanticAnalyzeFail: |
| 4335 | 4411 | fn->anal_state = FnAnalStateInvalid; |
| 4336 | 4412 | return; |
| ... | ... | @@ -4415,7 +4491,7 @@ static void analyze_fn_ir(CodeGen *g, ZigFn *fn, AstNode *return_type_node) { |
| 4415 | 4491 | |
| 4416 | 4492 | if (g->verbose_ir) { |
| 4417 | 4493 | fprintf(stderr, "fn %s() { // (analyzed)\n", buf_ptr(&fn->symbol_name)); |
| 4418 | ir_print(g, stderr, &fn->analyzed_executable, 4, 2); | |
| 4494 | ir_print(g, stderr, &fn->analyzed_executable, 4, IrPassGen); | |
| 4419 | 4495 | fprintf(stderr, "}\n"); |
| 4420 | 4496 | } |
| 4421 | 4497 | fn->anal_state = FnAnalStateComplete; |
| ... | ... | @@ -4448,8 +4524,8 @@ static void analyze_fn_body(CodeGen *g, ZigFn *fn_table_entry) { |
| 4448 | 4524 | if (g->verbose_ir) { |
| 4449 | 4525 | fprintf(stderr, "\n"); |
| 4450 | 4526 | ast_render(stderr, fn_table_entry->body_node, 4); |
| 4451 | fprintf(stderr, "\n{ // (IR)\n"); | |
| 4452 | ir_print(g, stderr, &fn_table_entry->ir_executable, 4, 1); | |
| 4527 | fprintf(stderr, "\nfn %s() { // (IR)\n", buf_ptr(&fn_table_entry->symbol_name)); | |
| 4528 | ir_print(g, stderr, &fn_table_entry->ir_executable, 4, IrPassSrc); | |
| 4453 | 4529 | fprintf(stderr, "}\n"); |
| 4454 | 4530 | } |
| 4455 | 4531 | |
| ... | ... | @@ -5638,6 +5714,83 @@ static ZigType *get_async_fn_type(CodeGen *g, ZigType *orig_fn_type) { |
| 5638 | 5714 | return fn_type; |
| 5639 | 5715 | } |
| 5640 | 5716 | |
| 5717 | // Traverse up to the very top ExprScope, which has children. | |
| 5718 | // We have just arrived at the top from a child. That child, | |
| 5719 | // and its next siblings, do not need to be marked. But the previous | |
| 5720 | // siblings do. | |
| 5721 | // x + (await y) | |
| 5722 | // vs | |
| 5723 | // (await y) + x | |
| 5724 | static void mark_suspension_point(Scope *scope) { | |
| 5725 | ScopeExpr *child_expr_scope = (scope->id == ScopeIdExpr) ? reinterpret_cast<ScopeExpr *>(scope) : nullptr; | |
| 5726 | bool looking_for_exprs = true; | |
| 5727 | for (;;) { | |
| 5728 | scope = scope->parent; | |
| 5729 | switch (scope->id) { | |
| 5730 | case ScopeIdDeferExpr: | |
| 5731 | case ScopeIdDecls: | |
| 5732 | case ScopeIdFnDef: | |
| 5733 | case ScopeIdCompTime: | |
| 5734 | case ScopeIdCImport: | |
| 5735 | case ScopeIdSuspend: | |
| 5736 | case ScopeIdTypeOf: | |
| 5737 | return; | |
| 5738 | case ScopeIdVarDecl: | |
| 5739 | case ScopeIdDefer: | |
| 5740 | case ScopeIdBlock: | |
| 5741 | looking_for_exprs = false; | |
| 5742 | continue; | |
| 5743 | case ScopeIdRuntime: | |
| 5744 | continue; | |
| 5745 | case ScopeIdLoop: { | |
| 5746 | ScopeLoop *loop_scope = reinterpret_cast<ScopeLoop *>(scope); | |
| 5747 | if (loop_scope->spill_scope != nullptr) { | |
| 5748 | loop_scope->spill_scope->need_spill = MemoizedBoolTrue; | |
| 5749 | } | |
| 5750 | looking_for_exprs = false; | |
| 5751 | continue; | |
| 5752 | } | |
| 5753 | case ScopeIdExpr: { | |
| 5754 | if (!looking_for_exprs) { | |
| 5755 | // Now we're only looking for a block, to see if it's in a loop (see the case ScopeIdBlock) | |
| 5756 | continue; | |
| 5757 | } | |
| 5758 | ScopeExpr *parent_expr_scope = reinterpret_cast<ScopeExpr *>(scope); | |
| 5759 | if (child_expr_scope != nullptr) { | |
| 5760 | for (size_t i = 0; parent_expr_scope->children_ptr[i] != child_expr_scope; i += 1) { | |
| 5761 | assert(i < parent_expr_scope->children_len); | |
| 5762 | parent_expr_scope->children_ptr[i]->need_spill = MemoizedBoolTrue; | |
| 5763 | } | |
| 5764 | } | |
| 5765 | parent_expr_scope->need_spill = MemoizedBoolTrue; | |
| 5766 | child_expr_scope = parent_expr_scope; | |
| 5767 | continue; | |
| 5768 | } | |
| 5769 | } | |
| 5770 | } | |
| 5771 | } | |
| 5772 | ||
| 5773 | static bool scope_needs_spill(Scope *scope) { | |
| 5774 | ScopeExpr *scope_expr = find_expr_scope(scope); | |
| 5775 | if (scope_expr == nullptr) return false; | |
| 5776 | ||
| 5777 | switch (scope_expr->need_spill) { | |
| 5778 | case MemoizedBoolUnknown: | |
| 5779 | if (scope_needs_spill(scope_expr->base.parent)) { | |
| 5780 | scope_expr->need_spill = MemoizedBoolTrue; | |
| 5781 | return true; | |
| 5782 | } else { | |
| 5783 | scope_expr->need_spill = MemoizedBoolFalse; | |
| 5784 | return false; | |
| 5785 | } | |
| 5786 | case MemoizedBoolFalse: | |
| 5787 | return false; | |
| 5788 | case MemoizedBoolTrue: | |
| 5789 | return true; | |
| 5790 | } | |
| 5791 | zig_unreachable(); | |
| 5792 | } | |
| 5793 | ||
| 5641 | 5794 | static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 5642 | 5795 | Error err; |
| 5643 | 5796 | |
| ... | ... | @@ -5766,16 +5919,87 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 5766 | 5919 | if (!fn_is_async(callee)) |
| 5767 | 5920 | continue; |
| 5768 | 5921 | |
| 5769 | IrInstructionAllocaGen *alloca_gen = allocate<IrInstructionAllocaGen>(1); | |
| 5770 | alloca_gen->base.id = IrInstructionIdAllocaGen; | |
| 5771 | alloca_gen->base.source_node = call->base.source_node; | |
| 5772 | alloca_gen->base.scope = call->base.scope; | |
| 5773 | alloca_gen->base.value.type = get_pointer_to_type(g, callee_frame_type, false); | |
| 5774 | alloca_gen->base.ref_count = 1; | |
| 5775 | alloca_gen->name_hint = ""; | |
| 5776 | fn->alloca_gen_list.append(alloca_gen); | |
| 5777 | call->frame_result_loc = &alloca_gen->base; | |
| 5922 | mark_suspension_point(call->base.scope); | |
| 5923 | ||
| 5924 | call->frame_result_loc = ir_create_alloca(g, call->base.scope, call->base.source_node, fn, | |
| 5925 | callee_frame_type, ""); | |
| 5926 | } | |
| 5927 | // Since this frame is async, an await might represent a suspend point, and | |
| 5928 | // therefore need to spill. It also needs to mark expr scopes as having to spill. | |
| 5929 | // For example: foo() + await z | |
| 5930 | // The funtion call result of foo() must be spilled. | |
| 5931 | for (size_t i = 0; i < fn->await_list.length; i += 1) { | |
| 5932 | IrInstructionAwaitGen *await = fn->await_list.at(i); | |
| 5933 | // TODO If this is a noasync await, it doesn't suspend | |
| 5934 | // https://github.com/ziglang/zig/issues/3157 | |
| 5935 | if (await->base.value.special != ConstValSpecialRuntime) { | |
| 5936 | // Known at comptime. No spill, no suspend. | |
| 5937 | continue; | |
| 5938 | } | |
| 5939 | if (await->target_fn != nullptr) { | |
| 5940 | // we might not need to suspend | |
| 5941 | analyze_fn_async(g, await->target_fn, false); | |
| 5942 | if (await->target_fn->anal_state == FnAnalStateInvalid) { | |
| 5943 | frame_type->data.frame.locals_struct = g->builtin_types.entry_invalid; | |
| 5944 | return ErrorSemanticAnalyzeFail; | |
| 5945 | } | |
| 5946 | if (!fn_is_async(await->target_fn)) { | |
| 5947 | // This await does not represent a suspend point. No spill needed, | |
| 5948 | // and no need to mark ExprScope. | |
| 5949 | continue; | |
| 5950 | } | |
| 5951 | } | |
| 5952 | // This await is a suspend point, but it might not need a spill. | |
| 5953 | // We do need to mark the ExprScope as having a suspend point in it. | |
| 5954 | mark_suspension_point(await->base.scope); | |
| 5955 | ||
| 5956 | if (await->result_loc != nullptr) { | |
| 5957 | // If there's a result location, that is the spill | |
| 5958 | continue; | |
| 5959 | } | |
| 5960 | if (await->base.ref_count == 0) | |
| 5961 | continue; | |
| 5962 | if (!type_has_bits(await->base.value.type)) | |
| 5963 | continue; | |
| 5964 | await->result_loc = ir_create_alloca(g, await->base.scope, await->base.source_node, fn, | |
| 5965 | await->base.value.type, ""); | |
| 5966 | } | |
| 5967 | for (size_t block_i = 0; block_i < fn->analyzed_executable.basic_block_list.length; block_i += 1) { | |
| 5968 | IrBasicBlock *block = fn->analyzed_executable.basic_block_list.at(block_i); | |
| 5969 | for (size_t instr_i = 0; instr_i < block->instruction_list.length; instr_i += 1) { | |
| 5970 | IrInstruction *instruction = block->instruction_list.at(instr_i); | |
| 5971 | if (instruction->id == IrInstructionIdSuspendFinish) { | |
| 5972 | mark_suspension_point(instruction->scope); | |
| 5973 | } | |
| 5974 | } | |
| 5975 | } | |
| 5976 | // Now that we've marked all the expr scopes that have to spill, we go over the instructions | |
| 5977 | // and spill the relevant ones. | |
| 5978 | for (size_t block_i = 0; block_i < fn->analyzed_executable.basic_block_list.length; block_i += 1) { | |
| 5979 | IrBasicBlock *block = fn->analyzed_executable.basic_block_list.at(block_i); | |
| 5980 | for (size_t instr_i = 0; instr_i < block->instruction_list.length; instr_i += 1) { | |
| 5981 | IrInstruction *instruction = block->instruction_list.at(instr_i); | |
| 5982 | if (instruction->id == IrInstructionIdAwaitGen || | |
| 5983 | instruction->id == IrInstructionIdVarPtr || | |
| 5984 | instruction->id == IrInstructionIdDeclRef || | |
| 5985 | instruction->id == IrInstructionIdAllocaGen) | |
| 5986 | { | |
| 5987 | // This instruction does its own spilling specially, or otherwise doesn't need it. | |
| 5988 | continue; | |
| 5989 | } | |
| 5990 | if (instruction->value.special != ConstValSpecialRuntime) | |
| 5991 | continue; | |
| 5992 | if (instruction->ref_count == 0) | |
| 5993 | continue; | |
| 5994 | if (!type_has_bits(instruction->value.type)) | |
| 5995 | continue; | |
| 5996 | if (scope_needs_spill(instruction->scope)) { | |
| 5997 | instruction->spill = ir_create_alloca(g, instruction->scope, instruction->source_node, | |
| 5998 | fn, instruction->value.type, ""); | |
| 5999 | } | |
| 6000 | } | |
| 5778 | 6001 | } |
| 6002 | ||
| 5779 | 6003 | FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id; |
| 5780 | 6004 | ZigType *ptr_return_type = get_pointer_to_type(g, fn_type_id->return_type, false); |
| 5781 | 6005 | |
| ... | ... | @@ -5858,6 +6082,11 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 5858 | 6082 | frame_type->abi_size = frame_type->data.frame.locals_struct->abi_size; |
| 5859 | 6083 | frame_type->abi_align = frame_type->data.frame.locals_struct->abi_align; |
| 5860 | 6084 | frame_type->size_in_bits = frame_type->data.frame.locals_struct->size_in_bits; |
| 6085 | ||
| 6086 | if (g->largest_frame_fn == nullptr || frame_type->abi_size > g->largest_frame_fn->frame_type->abi_size) { | |
| 6087 | g->largest_frame_fn = fn; | |
| 6088 | } | |
| 6089 | ||
| 5861 | 6090 | return ErrorNone; |
| 5862 | 6091 | } |
| 5863 | 6092 | |
| ... | ... | @@ -6216,9 +6445,7 @@ void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_v |
| 6216 | 6445 | } |
| 6217 | 6446 | |
| 6218 | 6447 | static void render_const_val_ptr(CodeGen *g, Buf *buf, ConstExprValue *const_val, ZigType *type_entry) { |
| 6219 | assert(type_entry->id == ZigTypeIdPointer); | |
| 6220 | ||
| 6221 | if (type_entry->data.pointer.child_type->id == ZigTypeIdOpaque) { | |
| 6448 | if (type_entry->id == ZigTypeIdPointer && type_entry->data.pointer.child_type->id == ZigTypeIdOpaque) { | |
| 6222 | 6449 | buf_append_buf(buf, &type_entry->name); |
| 6223 | 6450 | return; |
| 6224 | 6451 | } |
| ... | ... | @@ -7683,12 +7910,19 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatu |
| 7683 | 7910 | static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveStatus wanted_resolve_status) { |
| 7684 | 7911 | if (union_type->data.unionation.resolve_status >= wanted_resolve_status) return; |
| 7685 | 7912 | |
| 7913 | bool packed = (union_type->data.unionation.layout == ContainerLayoutPacked); | |
| 7914 | ||
| 7686 | 7915 | TypeUnionField *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 7687 | 7916 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 7688 | 7917 | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; |
| 7689 | 7918 | if (gen_field_count == 0) { |
| 7690 | union_type->llvm_type = get_llvm_type(g, tag_type); | |
| 7691 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); | |
| 7919 | if (tag_type == nullptr) { | |
| 7920 | union_type->llvm_type = g->builtin_types.entry_void->llvm_type; | |
| 7921 | union_type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type; | |
| 7922 | } else { | |
| 7923 | union_type->llvm_type = get_llvm_type(g, tag_type); | |
| 7924 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); | |
| 7925 | } | |
| 7692 | 7926 | union_type->data.unionation.resolve_status = ResolveStatusLLVMFull; |
| 7693 | 7927 | return; |
| 7694 | 7928 | } |
| ... | ... | @@ -7744,9 +7978,9 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7744 | 7978 | most_aligned_union_member->type_entry->llvm_type, |
| 7745 | 7979 | get_llvm_type(g, padding_array), |
| 7746 | 7980 | }; |
| 7747 | LLVMStructSetBody(union_type->llvm_type, union_element_types, 2, false); | |
| 7981 | LLVMStructSetBody(union_type->llvm_type, union_element_types, 2, packed); | |
| 7748 | 7982 | } else { |
| 7749 | LLVMStructSetBody(union_type->llvm_type, &most_aligned_union_member->type_entry->llvm_type, 1, false); | |
| 7983 | LLVMStructSetBody(union_type->llvm_type, &most_aligned_union_member->type_entry->llvm_type, 1, packed); | |
| 7750 | 7984 | } |
| 7751 | 7985 | union_type->data.unionation.union_llvm_type = union_type->llvm_type; |
| 7752 | 7986 | union_type->data.unionation.gen_tag_index = SIZE_MAX; |
| ... | ... | @@ -7785,7 +8019,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7785 | 8019 | LLVMTypeRef root_struct_element_types[2]; |
| 7786 | 8020 | root_struct_element_types[union_type->data.unionation.gen_tag_index] = get_llvm_type(g, tag_type); |
| 7787 | 8021 | root_struct_element_types[union_type->data.unionation.gen_union_index] = union_type_ref; |
| 7788 | LLVMStructSetBody(union_type->llvm_type, root_struct_element_types, 2, false); | |
| 8022 | LLVMStructSetBody(union_type->llvm_type, root_struct_element_types, 2, packed); | |
| 7789 | 8023 | |
| 7790 | 8024 | // create debug type for union |
| 7791 | 8025 | ZigLLVMDIType *union_di_type = ZigLLVMCreateDebugUnionType(g->dbuilder, |
| ... | ... | @@ -8495,3 +8729,18 @@ void src_assert(bool ok, AstNode *source_node) { |
| 8495 | 8729 | const char *msg = "assertion failed. This is a bug in the Zig compiler."; |
| 8496 | 8730 | stage2_panic(msg, strlen(msg)); |
| 8497 | 8731 | } |
| 8732 | ||
| 8733 | IrInstruction *ir_create_alloca(CodeGen *g, Scope *scope, AstNode *source_node, ZigFn *fn, | |
| 8734 | ZigType *var_type, const char *name_hint) | |
| 8735 | { | |
| 8736 | IrInstructionAllocaGen *alloca_gen = allocate<IrInstructionAllocaGen>(1); | |
| 8737 | alloca_gen->base.id = IrInstructionIdAllocaGen; | |
| 8738 | alloca_gen->base.source_node = source_node; | |
| 8739 | alloca_gen->base.scope = scope; | |
| 8740 | alloca_gen->base.value.type = get_pointer_to_type(g, var_type, false); | |
| 8741 | alloca_gen->base.ref_count = 1; | |
| 8742 | alloca_gen->name_hint = name_hint; | |
| 8743 | fn->alloca_gen_list.append(alloca_gen); | |
| 8744 | return &alloca_gen->base; | |
| 8745 | } | |
| 8746 |
src/analyze.hpp+8-2| ... | ... | @@ -114,6 +114,7 @@ ScopeFnDef *create_fndef_scope(CodeGen *g, AstNode *node, Scope *parent, ZigFn * |
| 114 | 114 | Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 115 | 115 | Scope *create_runtime_scope(CodeGen *g, AstNode *node, Scope *parent, IrInstruction *is_comptime); |
| 116 | 116 | Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 117 | ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent); | |
| 117 | 118 | |
| 118 | 119 | void init_const_str_lit(CodeGen *g, ConstExprValue *const_val, Buf *str); |
| 119 | 120 | ConstExprValue *create_const_str_lit(CodeGen *g, Buf *str); |
| ... | ... | @@ -188,8 +189,8 @@ ZigType *get_align_amt_type(CodeGen *g); |
| 188 | 189 | ZigPackage *new_anonymous_package(void); |
| 189 | 190 | |
| 190 | 191 | Buf *const_value_to_buffer(ConstExprValue *const_val); |
| 191 | void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, Buf *symbol_name, GlobalLinkageId linkage, bool ccc); | |
| 192 | void add_var_export(CodeGen *g, ZigVar *fn_table_entry, Buf *symbol_name, GlobalLinkageId linkage); | |
| 192 | void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, const char *symbol_name, GlobalLinkageId linkage, bool ccc); | |
| 193 | void add_var_export(CodeGen *g, ZigVar *fn_table_entry, const char *symbol_name, GlobalLinkageId linkage); | |
| 193 | 194 | |
| 194 | 195 | |
| 195 | 196 | ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name); |
| ... | ... | @@ -256,4 +257,9 @@ Error type_val_resolve_zero_bits(CodeGen *g, ConstExprValue *type_val, ZigType * |
| 256 | 257 | ZigType *resolve_union_field_type(CodeGen *g, TypeUnionField *union_field); |
| 257 | 258 | ZigType *resolve_struct_field_type(CodeGen *g, TypeStructField *struct_field); |
| 258 | 259 | |
| 260 | void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn); | |
| 261 | ||
| 262 | IrInstruction *ir_create_alloca(CodeGen *g, Scope *scope, AstNode *source_node, ZigFn *fn, | |
| 263 | ZigType *var_type, const char *name_hint); | |
| 264 | ||
| 259 | 265 | #endif |
src/ast_render.cpp+20-8| ... | ... | @@ -124,8 +124,13 @@ static const char *export_string(bool is_export) { |
| 124 | 124 | // zig_unreachable(); |
| 125 | 125 | //} |
| 126 | 126 | |
| 127 | static const char *inline_string(bool is_inline) { | |
| 128 | return is_inline ? "inline " : ""; | |
| 127 | static const char *inline_string(FnInline fn_inline) { | |
| 128 | switch (fn_inline) { | |
| 129 | case FnInlineAlways: return "inline "; | |
| 130 | case FnInlineNever: return "noinline "; | |
| 131 | case FnInlineAuto: return ""; | |
| 132 | } | |
| 133 | zig_unreachable(); | |
| 129 | 134 | } |
| 130 | 135 | |
| 131 | 136 | static const char *const_or_var_string(bool is_const) { |
| ... | ... | @@ -436,7 +441,7 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { |
| 436 | 441 | const char *pub_str = visib_mod_string(node->data.fn_proto.visib_mod); |
| 437 | 442 | const char *extern_str = extern_string(node->data.fn_proto.is_extern); |
| 438 | 443 | const char *export_str = export_string(node->data.fn_proto.is_export); |
| 439 | const char *inline_str = inline_string(node->data.fn_proto.is_inline); | |
| 444 | const char *inline_str = inline_string(node->data.fn_proto.fn_inline); | |
| 440 | 445 | fprintf(ar->f, "%s%s%s%sfn ", pub_str, inline_str, export_str, extern_str); |
| 441 | 446 | if (node->data.fn_proto.name != nullptr) { |
| 442 | 447 | print_symbol(ar, node->data.fn_proto.name); |
| ... | ... | @@ -693,11 +698,18 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { |
| 693 | 698 | } |
| 694 | 699 | case NodeTypeFnCallExpr: |
| 695 | 700 | { |
| 696 | if (node->data.fn_call_expr.is_builtin) { | |
| 697 | fprintf(ar->f, "@"); | |
| 698 | } | |
| 699 | if (node->data.fn_call_expr.is_async) { | |
| 700 | fprintf(ar->f, "async "); | |
| 701 | switch (node->data.fn_call_expr.modifier) { | |
| 702 | case CallModifierNone: | |
| 703 | break; | |
| 704 | case CallModifierBuiltin: | |
| 705 | fprintf(ar->f, "@"); | |
| 706 | break; | |
| 707 | case CallModifierAsync: | |
| 708 | fprintf(ar->f, "async "); | |
| 709 | break; | |
| 710 | case CallModifierNoAsync: | |
| 711 | fprintf(ar->f, "noasync "); | |
| 712 | break; | |
| 701 | 713 | } |
| 702 | 714 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; |
| 703 | 715 | bool grouped = (fn_ref_node->type != NodeTypePrefixOpExpr && fn_ref_node->type != NodeTypePointerType); |
src/buffer.hpp+5| ... | ... | @@ -57,6 +57,11 @@ static inline void buf_deinit(Buf *buf) { |
| 57 | 57 | buf->list.deinit(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | static inline void buf_destroy(Buf *buf) { | |
| 61 | buf_deinit(buf); | |
| 62 | free(buf); | |
| 63 | } | |
| 64 | ||
| 60 | 65 | static inline void buf_init_from_mem(Buf *buf, const char *ptr, size_t len) { |
| 61 | 66 | assert(len != SIZE_MAX); |
| 62 | 67 | buf->list.resize(len + 1); |
src/codegen.cpp+216-85| ... | ... | @@ -183,9 +183,12 @@ static void render_const_val(CodeGen *g, ConstExprValue *const_val, const char * |
| 183 | 183 | static void render_const_val_global(CodeGen *g, ConstExprValue *const_val, const char *name); |
| 184 | 184 | static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const char *name); |
| 185 | 185 | static void generate_error_name_table(CodeGen *g); |
| 186 | static bool value_is_all_undef(ConstExprValue *const_val); | |
| 186 | static bool value_is_all_undef(CodeGen *g, ConstExprValue *const_val); | |
| 187 | 187 | static void gen_undef_init(CodeGen *g, uint32_t ptr_align_bytes, ZigType *value_type, LLVMValueRef ptr); |
| 188 | 188 | static LLVMValueRef build_alloca(CodeGen *g, ZigType *type_entry, const char *name, uint32_t alignment); |
| 189 | static LLVMValueRef gen_await_early_return(CodeGen *g, IrInstruction *source_instr, | |
| 190 | LLVMValueRef target_frame_ptr, ZigType *result_type, ZigType *ptr_result_type, | |
| 191 | LLVMValueRef result_loc, bool non_async); | |
| 189 | 192 | |
| 190 | 193 | static void addLLVMAttr(LLVMValueRef val, LLVMAttributeIndex attr_index, const char *attr_name) { |
| 191 | 194 | unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name, strlen(attr_name)); |
| ... | ... | @@ -231,18 +234,23 @@ static void addLLVMArgAttrInt(LLVMValueRef fn_val, unsigned param_index, const c |
| 231 | 234 | return addLLVMAttrInt(fn_val, param_index + 1, attr_name, attr_val); |
| 232 | 235 | } |
| 233 | 236 | |
| 234 | static bool is_symbol_available(CodeGen *g, Buf *name) { | |
| 235 | return g->exported_symbol_names.maybe_get(name) == nullptr && g->external_prototypes.maybe_get(name) == nullptr; | |
| 237 | static bool is_symbol_available(CodeGen *g, const char *name) { | |
| 238 | Buf *buf_name = buf_create_from_str(name); | |
| 239 | bool result = | |
| 240 | g->exported_symbol_names.maybe_get(buf_name) == nullptr && | |
| 241 | g->external_prototypes.maybe_get(buf_name) == nullptr; | |
| 242 | buf_destroy(buf_name); | |
| 243 | return result; | |
| 236 | 244 | } |
| 237 | 245 | |
| 238 | static Buf *get_mangled_name(CodeGen *g, Buf *original_name, bool external_linkage) { | |
| 246 | static const char *get_mangled_name(CodeGen *g, const char *original_name, bool external_linkage) { | |
| 239 | 247 | if (external_linkage || is_symbol_available(g, original_name)) { |
| 240 | 248 | return original_name; |
| 241 | 249 | } |
| 242 | 250 | |
| 243 | 251 | int n = 0; |
| 244 | 252 | for (;; n += 1) { |
| 245 | Buf *new_name = buf_sprintf("%s.%d", buf_ptr(original_name), n); | |
| 253 | const char *new_name = buf_ptr(buf_sprintf("%s.%d", original_name, n)); | |
| 246 | 254 | if (is_symbol_available(g, new_name)) { |
| 247 | 255 | return new_name; |
| 248 | 256 | } |
| ... | ... | @@ -384,8 +392,8 @@ static bool codegen_have_frame_pointer(CodeGen *g) { |
| 384 | 392 | } |
| 385 | 393 | |
| 386 | 394 | static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 387 | Buf *unmangled_name = &fn->symbol_name; | |
| 388 | Buf *symbol_name; | |
| 395 | const char *unmangled_name = buf_ptr(&fn->symbol_name); | |
| 396 | const char *symbol_name; | |
| 389 | 397 | GlobalLinkageId linkage; |
| 390 | 398 | if (fn->body_node == nullptr) { |
| 391 | 399 | symbol_name = unmangled_name; |
| ... | ... | @@ -395,7 +403,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 395 | 403 | linkage = GlobalLinkageIdInternal; |
| 396 | 404 | } else { |
| 397 | 405 | GlobalExport *fn_export = &fn->export_list.items[0]; |
| 398 | symbol_name = &fn_export->name; | |
| 406 | symbol_name = buf_ptr(&fn_export->name); | |
| 399 | 407 | linkage = fn_export->linkage; |
| 400 | 408 | } |
| 401 | 409 | |
| ... | ... | @@ -405,7 +413,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 405 | 413 | g->zig_target->arch == ZigLLVM_x86) |
| 406 | 414 | { |
| 407 | 415 | // prevent llvm name mangling |
| 408 | symbol_name = buf_sprintf("\x01_%s", buf_ptr(symbol_name)); | |
| 416 | symbol_name = buf_ptr(buf_sprintf("\x01_%s", symbol_name)); | |
| 409 | 417 | } |
| 410 | 418 | |
| 411 | 419 | bool is_async = fn_is_async(fn); |
| ... | ... | @@ -417,13 +425,16 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 417 | 425 | LLVMTypeRef fn_llvm_type = fn->raw_type_ref; |
| 418 | 426 | LLVMValueRef llvm_fn = nullptr; |
| 419 | 427 | if (fn->body_node == nullptr) { |
| 420 | LLVMValueRef existing_llvm_fn = LLVMGetNamedFunction(g->module, buf_ptr(symbol_name)); | |
| 428 | LLVMValueRef existing_llvm_fn = LLVMGetNamedFunction(g->module, symbol_name); | |
| 421 | 429 | if (existing_llvm_fn) { |
| 422 | 430 | return LLVMConstBitCast(existing_llvm_fn, LLVMPointerType(fn_llvm_type, 0)); |
| 423 | 431 | } else { |
| 424 | auto entry = g->exported_symbol_names.maybe_get(symbol_name); | |
| 432 | Buf *buf_symbol_name = buf_create_from_str(symbol_name); | |
| 433 | auto entry = g->exported_symbol_names.maybe_get(buf_symbol_name); | |
| 434 | buf_destroy(buf_symbol_name); | |
| 435 | ||
| 425 | 436 | if (entry == nullptr) { |
| 426 | llvm_fn = LLVMAddFunction(g->module, buf_ptr(symbol_name), fn_llvm_type); | |
| 437 | llvm_fn = LLVMAddFunction(g->module, symbol_name, fn_llvm_type); | |
| 427 | 438 | |
| 428 | 439 | if (target_is_wasm(g->zig_target)) { |
| 429 | 440 | assert(fn->proto_node->type == NodeTypeFnProto); |
| ... | ... | @@ -437,7 +448,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 437 | 448 | TldFn *tld_fn = reinterpret_cast<TldFn *>(entry->value); |
| 438 | 449 | // Make the raw_type_ref populated |
| 439 | 450 | resolve_llvm_types_fn(g, tld_fn->fn_entry); |
| 440 | tld_fn->fn_entry->llvm_value = LLVMAddFunction(g->module, buf_ptr(symbol_name), | |
| 451 | tld_fn->fn_entry->llvm_value = LLVMAddFunction(g->module, symbol_name, | |
| 441 | 452 | tld_fn->fn_entry->raw_type_ref); |
| 442 | 453 | llvm_fn = LLVMConstBitCast(tld_fn->fn_entry->llvm_value, LLVMPointerType(fn_llvm_type, 0)); |
| 443 | 454 | return llvm_fn; |
| ... | ... | @@ -445,7 +456,7 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) { |
| 445 | 456 | } |
| 446 | 457 | } else { |
| 447 | 458 | if (llvm_fn == nullptr) { |
| 448 | llvm_fn = LLVMAddFunction(g->module, buf_ptr(symbol_name), fn_llvm_type); | |
| 459 | llvm_fn = LLVMAddFunction(g->module, symbol_name, fn_llvm_type); | |
| 449 | 460 | } |
| 450 | 461 | |
| 451 | 462 | for (size_t i = 1; i < fn->export_list.length; i += 1) { |
| ... | ... | @@ -646,6 +657,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { |
| 646 | 657 | case ScopeIdCompTime: |
| 647 | 658 | case ScopeIdRuntime: |
| 648 | 659 | case ScopeIdTypeOf: |
| 660 | case ScopeIdExpr: | |
| 649 | 661 | return get_di_scope(g, scope->parent); |
| 650 | 662 | } |
| 651 | 663 | zig_unreachable(); |
| ... | ... | @@ -920,6 +932,8 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) { |
| 920 | 932 | return buf_create_from_str("frame too small"); |
| 921 | 933 | case PanicMsgIdResumedFnPendingAwait: |
| 922 | 934 | return buf_create_from_str("resumed an async function which can only be awaited"); |
| 935 | case PanicMsgIdBadNoAsyncCall: | |
| 936 | return buf_create_from_str("async function called with noasync suspended"); | |
| 923 | 937 | } |
| 924 | 938 | zig_unreachable(); |
| 925 | 939 | } |
| ... | ... | @@ -1052,8 +1066,8 @@ static LLVMValueRef get_add_error_return_trace_addr_fn(CodeGen *g) { |
| 1052 | 1066 | }; |
| 1053 | 1067 | LLVMTypeRef fn_type_ref = LLVMFunctionType(LLVMVoidType(), arg_types, 2, false); |
| 1054 | 1068 | |
| 1055 | Buf *fn_name = get_mangled_name(g, buf_create_from_str("__zig_add_err_ret_trace_addr"), false); | |
| 1056 | LLVMValueRef fn_val = LLVMAddFunction(g->module, buf_ptr(fn_name), fn_type_ref); | |
| 1069 | const char *fn_name = get_mangled_name(g, "__zig_add_err_ret_trace_addr", false); | |
| 1070 | LLVMValueRef fn_val = LLVMAddFunction(g->module, fn_name, fn_type_ref); | |
| 1057 | 1071 | addLLVMFnAttr(fn_val, "alwaysinline"); |
| 1058 | 1072 | LLVMSetLinkage(fn_val, LLVMInternalLinkage); |
| 1059 | 1073 | LLVMSetFunctionCallConv(fn_val, get_llvm_cc(g, CallingConventionUnspecified)); |
| ... | ... | @@ -1132,8 +1146,8 @@ static LLVMValueRef get_return_err_fn(CodeGen *g) { |
| 1132 | 1146 | }; |
| 1133 | 1147 | LLVMTypeRef fn_type_ref = LLVMFunctionType(LLVMVoidType(), arg_types, 1, false); |
| 1134 | 1148 | |
| 1135 | Buf *fn_name = get_mangled_name(g, buf_create_from_str("__zig_return_error"), false); | |
| 1136 | LLVMValueRef fn_val = LLVMAddFunction(g->module, buf_ptr(fn_name), fn_type_ref); | |
| 1149 | const char *fn_name = get_mangled_name(g, "__zig_return_error", false); | |
| 1150 | LLVMValueRef fn_val = LLVMAddFunction(g->module, fn_name, fn_type_ref); | |
| 1137 | 1151 | addLLVMFnAttr(fn_val, "noinline"); // so that we can look at return address |
| 1138 | 1152 | addLLVMFnAttr(fn_val, "cold"); |
| 1139 | 1153 | LLVMSetLinkage(fn_val, LLVMInternalLinkage); |
| ... | ... | @@ -1202,7 +1216,7 @@ static LLVMValueRef get_safety_crash_err_fn(CodeGen *g) { |
| 1202 | 1216 | LLVMSetLinkage(msg_prefix, LLVMInternalLinkage); |
| 1203 | 1217 | LLVMSetGlobalConstant(msg_prefix, true); |
| 1204 | 1218 | |
| 1205 | Buf *fn_name = get_mangled_name(g, buf_create_from_str("__zig_fail_unwrap"), false); | |
| 1219 | const char *fn_name = get_mangled_name(g, "__zig_fail_unwrap", false); | |
| 1206 | 1220 | LLVMTypeRef fn_type_ref; |
| 1207 | 1221 | if (g->have_err_ret_tracing) { |
| 1208 | 1222 | LLVMTypeRef arg_types[] = { |
| ... | ... | @@ -1216,7 +1230,7 @@ static LLVMValueRef get_safety_crash_err_fn(CodeGen *g) { |
| 1216 | 1230 | }; |
| 1217 | 1231 | fn_type_ref = LLVMFunctionType(LLVMVoidType(), arg_types, 1, false); |
| 1218 | 1232 | } |
| 1219 | LLVMValueRef fn_val = LLVMAddFunction(g->module, buf_ptr(fn_name), fn_type_ref); | |
| 1233 | LLVMValueRef fn_val = LLVMAddFunction(g->module, fn_name, fn_type_ref); | |
| 1220 | 1234 | addLLVMFnAttr(fn_val, "noreturn"); |
| 1221 | 1235 | addLLVMFnAttr(fn_val, "cold"); |
| 1222 | 1236 | LLVMSetLinkage(fn_val, LLVMInternalLinkage); |
| ... | ... | @@ -1639,7 +1653,6 @@ static void gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, |
| 1639 | 1653 | LLVMValueRef ored_value = LLVMBuildOr(g->builder, shifted_value, anded_containing_int, ""); |
| 1640 | 1654 | |
| 1641 | 1655 | gen_store(g, ored_value, ptr, ptr_type); |
| 1642 | return; | |
| 1643 | 1656 | } |
| 1644 | 1657 | |
| 1645 | 1658 | static void gen_var_debug_decl(CodeGen *g, ZigVar *var) { |
| ... | ... | @@ -1656,6 +1669,19 @@ static LLVMValueRef ir_llvm_value(CodeGen *g, IrInstruction *instruction) { |
| 1656 | 1669 | if (!type_has_bits(instruction->value.type)) |
| 1657 | 1670 | return nullptr; |
| 1658 | 1671 | if (!instruction->llvm_value) { |
| 1672 | if (instruction->id == IrInstructionIdAwaitGen) { | |
| 1673 | IrInstructionAwaitGen *await = reinterpret_cast<IrInstructionAwaitGen*>(instruction); | |
| 1674 | if (await->result_loc != nullptr) { | |
| 1675 | return get_handle_value(g, ir_llvm_value(g, await->result_loc), | |
| 1676 | await->result_loc->value.type->data.pointer.child_type, await->result_loc->value.type); | |
| 1677 | } | |
| 1678 | } | |
| 1679 | if (instruction->spill != nullptr) { | |
| 1680 | ZigType *ptr_type = instruction->spill->value.type; | |
| 1681 | src_assert(ptr_type->id == ZigTypeIdPointer, instruction->source_node); | |
| 1682 | return get_handle_value(g, ir_llvm_value(g, instruction->spill), | |
| 1683 | ptr_type->data.pointer.child_type, instruction->spill->value.type); | |
| 1684 | } | |
| 1659 | 1685 | src_assert(instruction->value.special != ConstValSpecialRuntime, instruction->source_node); |
| 1660 | 1686 | assert(instruction->value.type); |
| 1661 | 1687 | render_const_val(g, &instruction->value, ""); |
| ... | ... | @@ -1787,7 +1813,7 @@ static bool iter_function_params_c_abi(CodeGen *g, ZigType *fn_type, FnWalk *fn_ |
| 1787 | 1813 | fn_walk->data.types.param_di_types->append(get_llvm_di_type(g, ty)); |
| 1788 | 1814 | break; |
| 1789 | 1815 | case FnWalkIdVars: { |
| 1790 | var->value_ref = build_alloca(g, ty, buf_ptr(&var->name), var->align_bytes); | |
| 1816 | var->value_ref = build_alloca(g, ty, var->name, var->align_bytes); | |
| 1791 | 1817 | di_arg_index = fn_walk->data.vars.gen_i; |
| 1792 | 1818 | fn_walk->data.vars.gen_i += 1; |
| 1793 | 1819 | dest_ty = ty; |
| ... | ... | @@ -1898,7 +1924,7 @@ static bool iter_function_params_c_abi(CodeGen *g, ZigType *fn_type, FnWalk *fn_ |
| 1898 | 1924 | } |
| 1899 | 1925 | case FnWalkIdVars: { |
| 1900 | 1926 | di_arg_index = fn_walk->data.vars.gen_i; |
| 1901 | var->value_ref = build_alloca(g, ty, buf_ptr(&var->name), var->align_bytes); | |
| 1927 | var->value_ref = build_alloca(g, ty, var->name, var->align_bytes); | |
| 1902 | 1928 | fn_walk->data.vars.gen_i += 1; |
| 1903 | 1929 | dest_ty = ty; |
| 1904 | 1930 | goto var_ok; |
| ... | ... | @@ -1931,7 +1957,7 @@ var_ok: |
| 1931 | 1957 | if (dest_ty != nullptr && var->decl_node) { |
| 1932 | 1958 | // arg index + 1 because the 0 index is return value |
| 1933 | 1959 | var->di_loc_var = ZigLLVMCreateParameterVariable(g->dbuilder, get_di_scope(g, var->parent_scope), |
| 1934 | buf_ptr(&var->name), fn_walk->data.vars.import->data.structure.root_struct->di_file, | |
| 1960 | var->name, fn_walk->data.vars.import->data.structure.root_struct->di_file, | |
| 1935 | 1961 | (unsigned)(var->decl_node->line + 1), |
| 1936 | 1962 | get_llvm_di_type(g, dest_ty), !g->strip_debug_symbols, 0, di_arg_index + 1); |
| 1937 | 1963 | } |
| ... | ... | @@ -2042,8 +2068,8 @@ static LLVMValueRef get_merge_err_ret_traces_fn_val(CodeGen *g) { |
| 2042 | 2068 | }; |
| 2043 | 2069 | LLVMTypeRef fn_type_ref = LLVMFunctionType(LLVMVoidType(), param_types, 2, false); |
| 2044 | 2070 | |
| 2045 | Buf *fn_name = get_mangled_name(g, buf_create_from_str("__zig_merge_error_return_traces"), false); | |
| 2046 | LLVMValueRef fn_val = LLVMAddFunction(g->module, buf_ptr(fn_name), fn_type_ref); | |
| 2071 | const char *fn_name = get_mangled_name(g, "__zig_merge_error_return_traces", false); | |
| 2072 | LLVMValueRef fn_val = LLVMAddFunction(g->module, fn_name, fn_type_ref); | |
| 2047 | 2073 | LLVMSetLinkage(fn_val, LLVMInternalLinkage); |
| 2048 | 2074 | LLVMSetFunctionCallConv(fn_val, get_llvm_cc(g, CallingConventionUnspecified)); |
| 2049 | 2075 | addLLVMFnAttr(fn_val, "nounwind"); |
| ... | ... | @@ -3377,7 +3403,7 @@ static LLVMValueRef ir_render_load_ptr(CodeGen *g, IrExecutable *executable, IrI |
| 3377 | 3403 | return LLVMBuildTrunc(g->builder, shifted_value, get_llvm_type(g, child_type), ""); |
| 3378 | 3404 | } |
| 3379 | 3405 | |
| 3380 | static bool value_is_all_undef_array(ConstExprValue *const_val, size_t len) { | |
| 3406 | static bool value_is_all_undef_array(CodeGen *g, ConstExprValue *const_val, size_t len) { | |
| 3381 | 3407 | switch (const_val->data.x_array.special) { |
| 3382 | 3408 | case ConstArraySpecialUndef: |
| 3383 | 3409 | return true; |
| ... | ... | @@ -3385,7 +3411,7 @@ static bool value_is_all_undef_array(ConstExprValue *const_val, size_t len) { |
| 3385 | 3411 | return false; |
| 3386 | 3412 | case ConstArraySpecialNone: |
| 3387 | 3413 | for (size_t i = 0; i < len; i += 1) { |
| 3388 | if (!value_is_all_undef(&const_val->data.x_array.data.s_none.elements[i])) | |
| 3414 | if (!value_is_all_undef(g, &const_val->data.x_array.data.s_none.elements[i])) | |
| 3389 | 3415 | return false; |
| 3390 | 3416 | } |
| 3391 | 3417 | return true; |
| ... | ... | @@ -3393,7 +3419,12 @@ static bool value_is_all_undef_array(ConstExprValue *const_val, size_t len) { |
| 3393 | 3419 | zig_unreachable(); |
| 3394 | 3420 | } |
| 3395 | 3421 | |
| 3396 | static bool value_is_all_undef(ConstExprValue *const_val) { | |
| 3422 | static bool value_is_all_undef(CodeGen *g, ConstExprValue *const_val) { | |
| 3423 | Error err; | |
| 3424 | if (const_val->special == ConstValSpecialLazy && | |
| 3425 | (err = ir_resolve_lazy(g, nullptr, const_val))) | |
| 3426 | report_errors_and_exit(g); | |
| 3427 | ||
| 3397 | 3428 | switch (const_val->special) { |
| 3398 | 3429 | case ConstValSpecialLazy: |
| 3399 | 3430 | zig_unreachable(); |
| ... | ... | @@ -3404,14 +3435,14 @@ static bool value_is_all_undef(ConstExprValue *const_val) { |
| 3404 | 3435 | case ConstValSpecialStatic: |
| 3405 | 3436 | if (const_val->type->id == ZigTypeIdStruct) { |
| 3406 | 3437 | for (size_t i = 0; i < const_val->type->data.structure.src_field_count; i += 1) { |
| 3407 | if (!value_is_all_undef(&const_val->data.x_struct.fields[i])) | |
| 3438 | if (!value_is_all_undef(g, &const_val->data.x_struct.fields[i])) | |
| 3408 | 3439 | return false; |
| 3409 | 3440 | } |
| 3410 | 3441 | return true; |
| 3411 | 3442 | } else if (const_val->type->id == ZigTypeIdArray) { |
| 3412 | return value_is_all_undef_array(const_val, const_val->type->data.array.len); | |
| 3443 | return value_is_all_undef_array(g, const_val, const_val->type->data.array.len); | |
| 3413 | 3444 | } else if (const_val->type->id == ZigTypeIdVector) { |
| 3414 | return value_is_all_undef_array(const_val, const_val->type->data.vector.len); | |
| 3445 | return value_is_all_undef_array(g, const_val, const_val->type->data.vector.len); | |
| 3415 | 3446 | } else { |
| 3416 | 3447 | return false; |
| 3417 | 3448 | } |
| ... | ... | @@ -3532,7 +3563,7 @@ static LLVMValueRef ir_render_store_ptr(CodeGen *g, IrExecutable *executable, Ir |
| 3532 | 3563 | return nullptr; |
| 3533 | 3564 | } |
| 3534 | 3565 | |
| 3535 | bool have_init_expr = !value_is_all_undef(&instruction->value->value); | |
| 3566 | bool have_init_expr = !value_is_all_undef(g, &instruction->value->value); | |
| 3536 | 3567 | if (have_init_expr) { |
| 3537 | 3568 | LLVMValueRef ptr = ir_llvm_value(g, instruction->ptr); |
| 3538 | 3569 | LLVMValueRef value = ir_llvm_value(g, instruction->value); |
| ... | ... | @@ -3720,12 +3751,11 @@ static void render_async_spills(CodeGen *g) { |
| 3720 | 3751 | continue; |
| 3721 | 3752 | } |
| 3722 | 3753 | |
| 3723 | var->value_ref = LLVMBuildStructGEP(g->builder, g->cur_frame_ptr, async_var_index, | |
| 3724 | buf_ptr(&var->name)); | |
| 3754 | var->value_ref = LLVMBuildStructGEP(g->builder, g->cur_frame_ptr, async_var_index, var->name); | |
| 3725 | 3755 | async_var_index += 1; |
| 3726 | 3756 | if (var->decl_node) { |
| 3727 | 3757 | var->di_loc_var = ZigLLVMCreateAutoVariable(g->dbuilder, get_di_scope(g, var->parent_scope), |
| 3728 | buf_ptr(&var->name), import->data.structure.root_struct->di_file, | |
| 3758 | var->name, import->data.structure.root_struct->di_file, | |
| 3729 | 3759 | (unsigned)(var->decl_node->line + 1), |
| 3730 | 3760 | get_llvm_di_type(g, var->var_type), !g->strip_debug_symbols, 0); |
| 3731 | 3761 | gen_var_debug_decl(g, var); |
| ... | ... | @@ -3768,6 +3798,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) { |
| 3768 | 3798 | case ScopeIdCompTime: |
| 3769 | 3799 | case ScopeIdRuntime: |
| 3770 | 3800 | case ScopeIdTypeOf: |
| 3801 | case ScopeIdExpr: | |
| 3771 | 3802 | scope = scope->parent; |
| 3772 | 3803 | continue; |
| 3773 | 3804 | } |
| ... | ... | @@ -3775,6 +3806,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) { |
| 3775 | 3806 | } |
| 3776 | 3807 | |
| 3777 | 3808 | static LLVMValueRef gen_frame_size(CodeGen *g, LLVMValueRef fn_val) { |
| 3809 | assert(g->need_frame_size_prefix_data); | |
| 3778 | 3810 | LLVMTypeRef usize_llvm_type = g->builtin_types.entry_usize->llvm_type; |
| 3779 | 3811 | LLVMTypeRef ptr_usize_llvm_type = LLVMPointerType(usize_llvm_type, 0); |
| 3780 | 3812 | LLVMValueRef casted_fn_val = LLVMBuildBitCast(g->builder, fn_val, ptr_usize_llvm_type, ""); |
| ... | ... | @@ -3836,7 +3868,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3836 | 3868 | LLVMValueRef ret_ptr; |
| 3837 | 3869 | if (callee_is_async) { |
| 3838 | 3870 | if (instruction->new_stack == nullptr) { |
| 3839 | if (instruction->is_async) { | |
| 3871 | if (instruction->modifier == CallModifierAsync) { | |
| 3840 | 3872 | frame_result_loc = result_loc; |
| 3841 | 3873 | } else { |
| 3842 | 3874 | frame_result_loc = ir_llvm_value(g, instruction->frame_result_loc); |
| ... | ... | @@ -3877,7 +3909,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3877 | 3909 | } |
| 3878 | 3910 | } |
| 3879 | 3911 | } |
| 3880 | if (instruction->is_async) { | |
| 3912 | if (instruction->modifier == CallModifierAsync) { | |
| 3881 | 3913 | if (instruction->new_stack == nullptr) { |
| 3882 | 3914 | awaiter_init_val = zero; |
| 3883 | 3915 | |
| ... | ... | @@ -3902,9 +3934,15 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3902 | 3934 | // even if prefix_arg_err_ret_stack is true, let the async function do its own |
| 3903 | 3935 | // initialization. |
| 3904 | 3936 | } else { |
| 3905 | // async function called as a normal function | |
| 3906 | ||
| 3907 | awaiter_init_val = LLVMBuildPtrToInt(g->builder, g->cur_frame_ptr, usize_type_ref, ""); // caller's own frame pointer | |
| 3937 | if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) { | |
| 3938 | // Async function called as a normal function, and calling function is not async. | |
| 3939 | // This is allowed because it was called with `noasync` which asserts that it will | |
| 3940 | // never suspend. | |
| 3941 | awaiter_init_val = zero; | |
| 3942 | } else { | |
| 3943 | // async function called as a normal function | |
| 3944 | awaiter_init_val = LLVMBuildPtrToInt(g->builder, g->cur_frame_ptr, usize_type_ref, ""); // caller's own frame pointer | |
| 3945 | } | |
| 3908 | 3946 | if (ret_has_bits) { |
| 3909 | 3947 | if (result_loc == nullptr) { |
| 3910 | 3948 | // return type is a scalar, but we still need a pointer to it. Use the async fn frame. |
| ... | ... | @@ -3945,7 +3983,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 3945 | 3983 | LLVMValueRef ret_ptr_ptr = LLVMBuildStructGEP(g->builder, frame_result_loc, frame_ret_start, ""); |
| 3946 | 3984 | LLVMBuildStore(g->builder, ret_ptr, ret_ptr_ptr); |
| 3947 | 3985 | } |
| 3948 | } else if (instruction->is_async) { | |
| 3986 | } else if (instruction->modifier == CallModifierAsync) { | |
| 3949 | 3987 | // Async call of blocking function |
| 3950 | 3988 | if (instruction->new_stack != nullptr) { |
| 3951 | 3989 | zig_panic("TODO @asyncCall of non-async function"); |
| ... | ... | @@ -4042,13 +4080,39 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4042 | 4080 | gen_param_values.at(arg_i)); |
| 4043 | 4081 | } |
| 4044 | 4082 | |
| 4045 | if (instruction->is_async) { | |
| 4083 | if (instruction->modifier == CallModifierAsync) { | |
| 4046 | 4084 | gen_resume(g, fn_val, frame_result_loc, ResumeIdCall); |
| 4047 | 4085 | if (instruction->new_stack != nullptr) { |
| 4048 | 4086 | return LLVMBuildBitCast(g->builder, frame_result_loc, |
| 4049 | 4087 | get_llvm_type(g, instruction->base.value.type), ""); |
| 4050 | 4088 | } |
| 4051 | 4089 | return nullptr; |
| 4090 | } else if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) { | |
| 4091 | gen_resume(g, fn_val, frame_result_loc, ResumeIdCall); | |
| 4092 | ||
| 4093 | if (ir_want_runtime_safety(g, &instruction->base)) { | |
| 4094 | LLVMValueRef awaiter_ptr = LLVMBuildStructGEP(g->builder, frame_result_loc, | |
| 4095 | frame_awaiter_index, ""); | |
| 4096 | LLVMValueRef all_ones = LLVMConstAllOnes(usize_type_ref); | |
| 4097 | LLVMValueRef prev_val = gen_maybe_atomic_op(g, LLVMAtomicRMWBinOpXchg, awaiter_ptr, | |
| 4098 | all_ones, LLVMAtomicOrderingRelease); | |
| 4099 | LLVMValueRef ok_val = LLVMBuildICmp(g->builder, LLVMIntEQ, prev_val, all_ones, ""); | |
| 4100 | ||
| 4101 | LLVMBasicBlockRef bad_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncPanic"); | |
| 4102 | LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncOk"); | |
| 4103 | LLVMBuildCondBr(g->builder, ok_val, ok_block, bad_block); | |
| 4104 | ||
| 4105 | // The async function suspended, but this noasync call asserted it wouldn't. | |
| 4106 | LLVMPositionBuilderAtEnd(g->builder, bad_block); | |
| 4107 | gen_safety_crash(g, PanicMsgIdBadNoAsyncCall); | |
| 4108 | ||
| 4109 | LLVMPositionBuilderAtEnd(g->builder, ok_block); | |
| 4110 | } | |
| 4111 | ||
| 4112 | ZigType *result_type = instruction->base.value.type; | |
| 4113 | ZigType *ptr_result_type = get_pointer_to_type(g, result_type, true); | |
| 4114 | return gen_await_early_return(g, &instruction->base, frame_result_loc, | |
| 4115 | result_type, ptr_result_type, result_loc, true); | |
| 4052 | 4116 | } else { |
| 4053 | 4117 | ZigType *ptr_result_type = get_pointer_to_type(g, src_return_type, true); |
| 4054 | 4118 | |
| ... | ... | @@ -4065,8 +4129,14 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4065 | 4129 | if (!type_has_bits(src_return_type)) |
| 4066 | 4130 | return nullptr; |
| 4067 | 4131 | |
| 4068 | if (result_loc != nullptr) | |
| 4069 | return get_handle_value(g, result_loc, src_return_type, ptr_result_type); | |
| 4132 | if (result_loc != nullptr) { | |
| 4133 | if (instruction->result_loc->id == IrInstructionIdReturnPtr) { | |
| 4134 | instruction->base.spill = nullptr; | |
| 4135 | return g->cur_ret_ptr; | |
| 4136 | } else { | |
| 4137 | return get_handle_value(g, result_loc, src_return_type, ptr_result_type); | |
| 4138 | } | |
| 4139 | } | |
| 4070 | 4140 | |
| 4071 | 4141 | LLVMValueRef result_ptr = LLVMBuildStructGEP(g->builder, frame_result_loc, frame_ret_start + 2, ""); |
| 4072 | 4142 | return LLVMBuildLoad(g->builder, result_ptr, ""); |
| ... | ... | @@ -4076,7 +4146,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4076 | 4146 | if (instruction->new_stack == nullptr || instruction->is_async_call_builtin) { |
| 4077 | 4147 | result = ZigLLVMBuildCall(g->builder, fn_val, |
| 4078 | 4148 | gen_param_values.items, (unsigned)gen_param_values.length, llvm_cc, fn_inline, ""); |
| 4079 | } else if (instruction->is_async) { | |
| 4149 | } else if (instruction->modifier == CallModifierAsync) { | |
| 4080 | 4150 | zig_panic("TODO @asyncCall of non-async function"); |
| 4081 | 4151 | } else { |
| 4082 | 4152 | LLVMValueRef stacksave_fn_val = get_stacksave_fn_val(g); |
| ... | ... | @@ -4101,7 +4171,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4101 | 4171 | LLVMValueRef store_instr = LLVMBuildStore(g->builder, result, result_loc); |
| 4102 | 4172 | LLVMSetAlignment(store_instr, get_ptr_align(g, instruction->result_loc->value.type)); |
| 4103 | 4173 | return result_loc; |
| 4104 | } else if (!callee_is_async && instruction->is_async) { | |
| 4174 | } else if (!callee_is_async && instruction->modifier == CallModifierAsync) { | |
| 4105 | 4175 | LLVMBuildStore(g->builder, result, ret_ptr); |
| 4106 | 4176 | return result_loc; |
| 4107 | 4177 | } else { |
| ... | ... | @@ -4112,6 +4182,8 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr |
| 4112 | 4182 | static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executable, |
| 4113 | 4183 | IrInstructionStructFieldPtr *instruction) |
| 4114 | 4184 | { |
| 4185 | Error err; | |
| 4186 | ||
| 4115 | 4187 | if (instruction->base.value.special != ConstValSpecialRuntime) |
| 4116 | 4188 | return nullptr; |
| 4117 | 4189 | |
| ... | ... | @@ -4129,6 +4201,11 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa |
| 4129 | 4201 | return struct_ptr; |
| 4130 | 4202 | } |
| 4131 | 4203 | |
| 4204 | ZigType *struct_type = (struct_ptr_type->id == ZigTypeIdPointer) ? | |
| 4205 | struct_ptr_type->data.pointer.child_type : struct_ptr_type; | |
| 4206 | if ((err = type_resolve(g, struct_type, ResolveStatusLLVMFull))) | |
| 4207 | report_errors_and_exit(g); | |
| 4208 | ||
| 4132 | 4209 | assert(field->gen_index != SIZE_MAX); |
| 4133 | 4210 | return LLVMBuildStructGEP(g->builder, struct_ptr, (unsigned)field->gen_index, ""); |
| 4134 | 4211 | } |
| ... | ... | @@ -4583,8 +4660,9 @@ static LLVMValueRef get_enum_tag_name_function(CodeGen *g, ZigType *enum_type) { |
| 4583 | 4660 | LLVMTypeRef fn_type_ref = LLVMFunctionType(LLVMPointerType(get_llvm_type(g, u8_slice_type), 0), |
| 4584 | 4661 | &tag_int_llvm_type, 1, false); |
| 4585 | 4662 | |
| 4586 | Buf *fn_name = get_mangled_name(g, buf_sprintf("__zig_tag_name_%s", buf_ptr(&enum_type->name)), false); | |
| 4587 | LLVMValueRef fn_val = LLVMAddFunction(g->module, buf_ptr(fn_name), fn_type_ref); | |
| 4663 | const char *fn_name = get_mangled_name(g, | |
| 4664 | buf_ptr(buf_sprintf("__zig_tag_name_%s", buf_ptr(&enum_type->name))), false); | |
| 4665 | LLVMValueRef fn_val = LLVMAddFunction(g->module, fn_name, fn_type_ref); | |
| 4588 | 4666 | LLVMSetLinkage(fn_val, LLVMInternalLinkage); |
| 4589 | 4667 | LLVMSetFunctionCallConv(fn_val, get_llvm_cc(g, CallingConventionUnspecified)); |
| 4590 | 4668 | addLLVMFnAttr(fn_val, "nounwind"); |
| ... | ... | @@ -4879,7 +4957,7 @@ static LLVMValueRef ir_render_memset(CodeGen *g, IrExecutable *executable, IrIns |
| 4879 | 4957 | ZigType *ptr_type = instruction->dest_ptr->value.type; |
| 4880 | 4958 | assert(ptr_type->id == ZigTypeIdPointer); |
| 4881 | 4959 | |
| 4882 | bool val_is_undef = value_is_all_undef(&instruction->byte->value); | |
| 4960 | bool val_is_undef = value_is_all_undef(g, &instruction->byte->value); | |
| 4883 | 4961 | LLVMValueRef fill_char; |
| 4884 | 4962 | if (val_is_undef) { |
| 4885 | 4963 | fill_char = LLVMConstInt(LLVMInt8Type(), 0xaa, false); |
| ... | ... | @@ -5595,7 +5673,6 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutable *executable, IrInst |
| 5595 | 5673 | // At this point resuming the function will continue from resume_bb. |
| 5596 | 5674 | // This code is as if it is running inside the suspend block. |
| 5597 | 5675 | |
| 5598 | ||
| 5599 | 5676 | // supply the awaiter return pointer |
| 5600 | 5677 | if (type_has_bits(result_type)) { |
| 5601 | 5678 | LLVMValueRef awaiter_ret_ptr_ptr = LLVMBuildStructGEP(g->builder, target_frame_ptr, frame_ret_start + 1, ""); |
| ... | ... | @@ -5653,9 +5730,8 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutable *executable, IrInst |
| 5653 | 5730 | LLVMBuildBr(g->builder, end_bb); |
| 5654 | 5731 | |
| 5655 | 5732 | LLVMPositionBuilderAtEnd(g->builder, end_bb); |
| 5656 | if (type_has_bits(result_type) && result_loc != nullptr) { | |
| 5657 | return get_handle_value(g, result_loc, result_type, ptr_result_type); | |
| 5658 | } | |
| 5733 | // Rely on the spill for the llvm_value to be populated. | |
| 5734 | // See the implementation of ir_llvm_value. | |
| 5659 | 5735 | return nullptr; |
| 5660 | 5736 | } |
| 5661 | 5737 | |
| ... | ... | @@ -5762,6 +5838,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, |
| 5762 | 5838 | case IrInstructionIdByteOffsetOf: |
| 5763 | 5839 | case IrInstructionIdBitOffsetOf: |
| 5764 | 5840 | case IrInstructionIdTypeInfo: |
| 5841 | case IrInstructionIdType: | |
| 5765 | 5842 | case IrInstructionIdHasField: |
| 5766 | 5843 | case IrInstructionIdTypeId: |
| 5767 | 5844 | case IrInstructionIdSetEvalBranchQuota: |
| ... | ... | @@ -5992,6 +6069,11 @@ static void ir_render(CodeGen *g, ZigFn *fn_entry) { |
| 5992 | 6069 | set_debug_location(g, instruction); |
| 5993 | 6070 | } |
| 5994 | 6071 | instruction->llvm_value = ir_render_instruction(g, executable, instruction); |
| 6072 | if (instruction->spill != nullptr) { | |
| 6073 | LLVMValueRef spill_ptr = ir_llvm_value(g, instruction->spill); | |
| 6074 | gen_assign_raw(g, spill_ptr, instruction->spill->value.type, instruction->llvm_value); | |
| 6075 | instruction->llvm_value = nullptr; | |
| 6076 | } | |
| 5995 | 6077 | } |
| 5996 | 6078 | current_block->llvm_exit_block = LLVMGetInsertBlock(g->builder); |
| 5997 | 6079 | } |
| ... | ... | @@ -6845,7 +6927,7 @@ static void generate_error_name_table(CodeGen *g) { |
| 6845 | 6927 | LLVMValueRef err_name_table_init = LLVMConstArray(get_llvm_type(g, str_type), values, (unsigned)g->errors_by_index.length); |
| 6846 | 6928 | |
| 6847 | 6929 | g->err_name_table = LLVMAddGlobal(g->module, LLVMTypeOf(err_name_table_init), |
| 6848 | buf_ptr(get_mangled_name(g, buf_create_from_str("__zig_err_name_table"), false))); | |
| 6930 | get_mangled_name(g, buf_ptr(buf_create_from_str("__zig_err_name_table")), false)); | |
| 6849 | 6931 | LLVMSetInitializer(g->err_name_table, err_name_table_init); |
| 6850 | 6932 | LLVMSetLinkage(g->err_name_table, LLVMPrivateLinkage); |
| 6851 | 6933 | LLVMSetGlobalConstant(g->err_name_table, true); |
| ... | ... | @@ -6886,8 +6968,8 @@ static void gen_global_var(CodeGen *g, ZigVar *var, LLVMValueRef init_val, |
| 6886 | 6968 | assert(import); |
| 6887 | 6969 | |
| 6888 | 6970 | bool is_local_to_unit = true; |
| 6889 | ZigLLVMCreateGlobalVariable(g->dbuilder, get_di_scope(g, var->parent_scope), buf_ptr(&var->name), | |
| 6890 | buf_ptr(&var->name), import->data.structure.root_struct->di_file, | |
| 6971 | ZigLLVMCreateGlobalVariable(g->dbuilder, get_di_scope(g, var->parent_scope), var->name, | |
| 6972 | var->name, import->data.structure.root_struct->di_file, | |
| 6891 | 6973 | (unsigned)(var->decl_node->line + 1), |
| 6892 | 6974 | get_llvm_di_type(g, type_entry), is_local_to_unit); |
| 6893 | 6975 | |
| ... | ... | @@ -6969,8 +7051,8 @@ static void do_code_gen(CodeGen *g) { |
| 6969 | 7051 | assert(var->decl_node); |
| 6970 | 7052 | |
| 6971 | 7053 | GlobalLinkageId linkage; |
| 6972 | Buf *unmangled_name = &var->name; | |
| 6973 | Buf *symbol_name; | |
| 7054 | const char *unmangled_name = var->name; | |
| 7055 | const char *symbol_name; | |
| 6974 | 7056 | if (var->export_list.length == 0) { |
| 6975 | 7057 | if (var->decl_node->data.variable_declaration.is_extern) { |
| 6976 | 7058 | symbol_name = unmangled_name; |
| ... | ... | @@ -6981,19 +7063,19 @@ static void do_code_gen(CodeGen *g) { |
| 6981 | 7063 | } |
| 6982 | 7064 | } else { |
| 6983 | 7065 | GlobalExport *global_export = &var->export_list.items[0]; |
| 6984 | symbol_name = &global_export->name; | |
| 7066 | symbol_name = buf_ptr(&global_export->name); | |
| 6985 | 7067 | linkage = global_export->linkage; |
| 6986 | 7068 | } |
| 6987 | 7069 | |
| 6988 | 7070 | LLVMValueRef global_value; |
| 6989 | 7071 | bool externally_initialized = var->decl_node->data.variable_declaration.expr == nullptr; |
| 6990 | 7072 | if (externally_initialized) { |
| 6991 | LLVMValueRef existing_llvm_var = LLVMGetNamedGlobal(g->module, buf_ptr(symbol_name)); | |
| 7073 | LLVMValueRef existing_llvm_var = LLVMGetNamedGlobal(g->module, symbol_name); | |
| 6992 | 7074 | if (existing_llvm_var) { |
| 6993 | 7075 | global_value = LLVMConstBitCast(existing_llvm_var, |
| 6994 | 7076 | LLVMPointerType(get_llvm_type(g, var->var_type), 0)); |
| 6995 | 7077 | } else { |
| 6996 | global_value = LLVMAddGlobal(g->module, get_llvm_type(g, var->var_type), buf_ptr(symbol_name)); | |
| 7078 | global_value = LLVMAddGlobal(g->module, get_llvm_type(g, var->var_type), symbol_name); | |
| 6997 | 7079 | // TODO debug info for the extern variable |
| 6998 | 7080 | |
| 6999 | 7081 | LLVMSetLinkage(global_value, to_llvm_linkage(linkage)); |
| ... | ... | @@ -7004,8 +7086,8 @@ static void do_code_gen(CodeGen *g) { |
| 7004 | 7086 | } |
| 7005 | 7087 | } else { |
| 7006 | 7088 | bool exported = (linkage != GlobalLinkageIdInternal); |
| 7007 | render_const_val(g, var->const_value, buf_ptr(symbol_name)); | |
| 7008 | render_const_val_global(g, var->const_value, buf_ptr(symbol_name)); | |
| 7089 | render_const_val(g, var->const_value, symbol_name); | |
| 7090 | render_const_val_global(g, var->const_value, symbol_name); | |
| 7009 | 7091 | global_value = var->const_value->global_refs->llvm_global; |
| 7010 | 7092 | |
| 7011 | 7093 | if (exported) { |
| ... | ... | @@ -7090,6 +7172,21 @@ static void do_code_gen(CodeGen *g) { |
| 7090 | 7172 | } |
| 7091 | 7173 | |
| 7092 | 7174 | if (!is_async) { |
| 7175 | // allocate async frames for noasync calls & awaits to async functions | |
| 7176 | for (size_t i = 0; i < fn_table_entry->call_list.length; i += 1) { | |
| 7177 | IrInstructionCallGen *call = fn_table_entry->call_list.at(i); | |
| 7178 | if (call->fn_entry == nullptr) | |
| 7179 | continue; | |
| 7180 | if (!fn_is_async(call->fn_entry)) | |
| 7181 | continue; | |
| 7182 | if (call->modifier != CallModifierNoAsync) | |
| 7183 | continue; | |
| 7184 | if (call->frame_result_loc != nullptr) | |
| 7185 | continue; | |
| 7186 | ZigType *callee_frame_type = get_fn_frame_type(g, call->fn_entry); | |
| 7187 | call->frame_result_loc = ir_create_alloca(g, call->base.scope, call->base.source_node, | |
| 7188 | fn_table_entry, callee_frame_type, ""); | |
| 7189 | } | |
| 7093 | 7190 | // allocate temporary stack data |
| 7094 | 7191 | for (size_t alloca_i = 0; alloca_i < fn_table_entry->alloca_gen_list.length; alloca_i += 1) { |
| 7095 | 7192 | IrInstructionAllocaGen *instruction = fn_table_entry->alloca_gen_list.at(alloca_i); |
| ... | ... | @@ -7145,7 +7242,7 @@ static void do_code_gen(CodeGen *g) { |
| 7145 | 7242 | |
| 7146 | 7243 | if (var->src_arg_index == SIZE_MAX) { |
| 7147 | 7244 | var->di_loc_var = ZigLLVMCreateAutoVariable(g->dbuilder, get_di_scope(g, var->parent_scope), |
| 7148 | buf_ptr(&var->name), import->data.structure.root_struct->di_file, (unsigned)(var->decl_node->line + 1), | |
| 7245 | var->name, import->data.structure.root_struct->di_file, (unsigned)(var->decl_node->line + 1), | |
| 7149 | 7246 | get_llvm_di_type(g, var->var_type), !g->strip_debug_symbols, 0); |
| 7150 | 7247 | |
| 7151 | 7248 | } else if (is_c_abi) { |
| ... | ... | @@ -7165,11 +7262,11 @@ static void do_code_gen(CodeGen *g) { |
| 7165 | 7262 | var->value_ref = LLVMGetParam(fn, gen_info->gen_index); |
| 7166 | 7263 | } else { |
| 7167 | 7264 | gen_type = var->var_type; |
| 7168 | var->value_ref = build_alloca(g, var->var_type, buf_ptr(&var->name), var->align_bytes); | |
| 7265 | var->value_ref = build_alloca(g, var->var_type, var->name, var->align_bytes); | |
| 7169 | 7266 | } |
| 7170 | 7267 | if (var->decl_node) { |
| 7171 | 7268 | var->di_loc_var = ZigLLVMCreateParameterVariable(g->dbuilder, get_di_scope(g, var->parent_scope), |
| 7172 | buf_ptr(&var->name), import->data.structure.root_struct->di_file, | |
| 7269 | var->name, import->data.structure.root_struct->di_file, | |
| 7173 | 7270 | (unsigned)(var->decl_node->line + 1), |
| 7174 | 7271 | get_llvm_di_type(g, gen_type), !g->strip_debug_symbols, 0, (unsigned)(gen_info->gen_index+1)); |
| 7175 | 7272 | } |
| ... | ... | @@ -7208,7 +7305,9 @@ static void do_code_gen(CodeGen *g) { |
| 7208 | 7305 | |
| 7209 | 7306 | LLVMTypeRef usize_type_ref = g->builtin_types.entry_usize->llvm_type; |
| 7210 | 7307 | LLVMValueRef size_val = LLVMConstInt(usize_type_ref, fn_table_entry->frame_type->abi_size, false); |
| 7211 | ZigLLVMFunctionSetPrefixData(fn_table_entry->llvm_value, size_val); | |
| 7308 | if (g->need_frame_size_prefix_data) { | |
| 7309 | ZigLLVMFunctionSetPrefixData(fn_table_entry->llvm_value, size_val); | |
| 7310 | } | |
| 7212 | 7311 | |
| 7213 | 7312 | if (!g->strip_debug_symbols) { |
| 7214 | 7313 | AstNode *source_node = fn_table_entry->proto_node; |
| ... | ... | @@ -7296,10 +7395,8 @@ static void do_code_gen(CodeGen *g) { |
| 7296 | 7395 | LLVMDumpModule(g->module); |
| 7297 | 7396 | } |
| 7298 | 7397 | |
| 7299 | #ifndef NDEBUG | |
| 7300 | 7398 | char *error = nullptr; |
| 7301 | 7399 | LLVMVerifyModule(g->module, LLVMAbortProcessAction, &error); |
| 7302 | #endif | |
| 7303 | 7400 | } |
| 7304 | 7401 | |
| 7305 | 7402 | static void zig_llvm_emit_output(CodeGen *g) { |
| ... | ... | @@ -7587,6 +7684,7 @@ static void define_builtin_fns(CodeGen *g) { |
| 7587 | 7684 | create_builtin_fn(g, BuiltinFnIdMemberName, "memberName", 2); |
| 7588 | 7685 | create_builtin_fn(g, BuiltinFnIdField, "field", 2); |
| 7589 | 7686 | create_builtin_fn(g, BuiltinFnIdTypeInfo, "typeInfo", 1); |
| 7687 | create_builtin_fn(g, BuiltinFnIdType, "Type", 1); | |
| 7590 | 7688 | create_builtin_fn(g, BuiltinFnIdHasField, "hasField", 2); |
| 7591 | 7689 | create_builtin_fn(g, BuiltinFnIdTypeof, "typeOf", 1); // TODO rename to TypeOf |
| 7592 | 7690 | create_builtin_fn(g, BuiltinFnIdAddWithOverflow, "addWithOverflow", 4); |
| ... | ... | @@ -8149,20 +8247,25 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 8149 | 8247 | " };\n" |
| 8150 | 8248 | " };\n" |
| 8151 | 8249 | "};\n\n"); |
| 8152 | assert(ContainerLayoutAuto == 0); | |
| 8153 | assert(ContainerLayoutExtern == 1); | |
| 8154 | assert(ContainerLayoutPacked == 2); | |
| 8155 | ||
| 8156 | assert(CallingConventionUnspecified == 0); | |
| 8157 | assert(CallingConventionC == 1); | |
| 8158 | assert(CallingConventionCold == 2); | |
| 8159 | assert(CallingConventionNaked == 3); | |
| 8160 | assert(CallingConventionStdcall == 4); | |
| 8161 | assert(CallingConventionAsync == 5); | |
| 8162 | ||
| 8163 | assert(FnInlineAuto == 0); | |
| 8164 | assert(FnInlineAlways == 1); | |
| 8165 | assert(FnInlineNever == 2); | |
| 8250 | static_assert(ContainerLayoutAuto == 0, ""); | |
| 8251 | static_assert(ContainerLayoutExtern == 1, ""); | |
| 8252 | static_assert(ContainerLayoutPacked == 2, ""); | |
| 8253 | ||
| 8254 | static_assert(CallingConventionUnspecified == 0, ""); | |
| 8255 | static_assert(CallingConventionC == 1, ""); | |
| 8256 | static_assert(CallingConventionCold == 2, ""); | |
| 8257 | static_assert(CallingConventionNaked == 3, ""); | |
| 8258 | static_assert(CallingConventionStdcall == 4, ""); | |
| 8259 | static_assert(CallingConventionAsync == 5, ""); | |
| 8260 | ||
| 8261 | static_assert(FnInlineAuto == 0, ""); | |
| 8262 | static_assert(FnInlineAlways == 1, ""); | |
| 8263 | static_assert(FnInlineNever == 2, ""); | |
| 8264 | ||
| 8265 | static_assert(BuiltinPtrSizeOne == 0, ""); | |
| 8266 | static_assert(BuiltinPtrSizeMany == 1, ""); | |
| 8267 | static_assert(BuiltinPtrSizeSlice == 2, ""); | |
| 8268 | static_assert(BuiltinPtrSizeC == 3, ""); | |
| 8166 | 8269 | } |
| 8167 | 8270 | { |
| 8168 | 8271 | buf_appendf(contents, |
| ... | ... | @@ -8458,8 +8561,21 @@ static void init(CodeGen *g) { |
| 8458 | 8561 | Buf *producer = buf_sprintf("zig %d.%d.%d", ZIG_VERSION_MAJOR, ZIG_VERSION_MINOR, ZIG_VERSION_PATCH); |
| 8459 | 8562 | const char *flags = ""; |
| 8460 | 8563 | unsigned runtime_version = 0; |
| 8564 | ||
| 8565 | // For macOS stack traces, we want to avoid having to parse the compilation unit debug | |
| 8566 | // info. As long as each debug info file has a path independent of the compilation unit | |
| 8567 | // directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug | |
| 8568 | // info. If we provide an absolute path to LLVM here for the compilation unit debug info, | |
| 8569 | // LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "." | |
| 8570 | // for the compilation unit directory. This forces each debug file to have a directory | |
| 8571 | // rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will | |
| 8572 | // no longer reference DW_AT_comp_dir, for the purpose of being able to support the | |
| 8573 | // common practice of stripping all but the line number sections from an executable. | |
| 8574 | const char *compile_unit_dir = target_os_is_darwin(g->zig_target->os) ? "." : | |
| 8575 | buf_ptr(&g->root_package->root_src_dir); | |
| 8576 | ||
| 8461 | 8577 | ZigLLVMDIFile *compile_unit_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(g->root_out_name), |
| 8462 | buf_ptr(&g->root_package->root_src_dir)); | |
| 8578 | compile_unit_dir); | |
| 8463 | 8579 | g->compile_unit = ZigLLVMCreateCompileUnit(g->dbuilder, ZigLLVMLang_DW_LANG_C99(), |
| 8464 | 8580 | compile_unit_file, buf_ptr(producer), is_optimized, flags, runtime_version, |
| 8465 | 8581 | "", 0, !g->strip_debug_symbols); |
| ... | ... | @@ -8674,6 +8790,11 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa |
| 8674 | 8790 | } |
| 8675 | 8791 | } |
| 8676 | 8792 | |
| 8793 | for (size_t i = 0; i < g->framework_dirs.length; i += 1) { | |
| 8794 | args.append("-iframework"); | |
| 8795 | args.append(g->framework_dirs.at(i)); | |
| 8796 | } | |
| 8797 | ||
| 8677 | 8798 | // According to Rich Felker libc headers are supposed to go before C language headers. |
| 8678 | 8799 | // However as noted by @dimenus, appending libc headers before c_headers breaks intrinsics |
| 8679 | 8800 | // and other compiler specific items. |
| ... | ... | @@ -8896,6 +9017,15 @@ static void create_test_compile_var_and_add_test_runner(CodeGen *g) { |
| 8896 | 9017 | for (size_t i = 0; i < g->test_fns.length; i += 1) { |
| 8897 | 9018 | ZigFn *test_fn_entry = g->test_fns.at(i); |
| 8898 | 9019 | |
| 9020 | if (fn_is_async(test_fn_entry)) { | |
| 9021 | ErrorMsg *msg = add_node_error(g, test_fn_entry->proto_node, | |
| 9022 | buf_create_from_str("test functions cannot be async")); | |
| 9023 | add_error_note(g, msg, test_fn_entry->proto_node, | |
| 9024 | buf_sprintf("this restriction may be lifted in the future. See https://github.com/ziglang/zig/issues/3117 for more details")); | |
| 9025 | add_async_error_notes(g, msg, test_fn_entry); | |
| 9026 | continue; | |
| 9027 | } | |
| 9028 | ||
| 8899 | 9029 | ConstExprValue *this_val = &test_fn_array->data.x_array.data.s_none.elements[i]; |
| 8900 | 9030 | this_val->special = ConstValSpecialStatic; |
| 8901 | 9031 | this_val->type = struct_type; |
| ... | ... | @@ -8915,6 +9045,7 @@ static void create_test_compile_var_and_add_test_runner(CodeGen *g) { |
| 8915 | 9045 | fn_field->data.x_ptr.mut = ConstPtrMutComptimeConst; |
| 8916 | 9046 | fn_field->data.x_ptr.data.fn.fn_entry = test_fn_entry; |
| 8917 | 9047 | } |
| 9048 | report_errors_and_maybe_exit(g); | |
| 8918 | 9049 | |
| 8919 | 9050 | ConstExprValue *test_fn_slice = create_const_slice(g, test_fn_array, 0, g->test_fns.length, true); |
| 8920 | 9051 |
src/ir.cpp+445-81| ... | ... | @@ -197,6 +197,7 @@ static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source |
| 197 | 197 | static IrInstruction *ir_gen_union_init_expr(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 198 | 198 | IrInstruction *union_type, IrInstruction *field_name, AstNode *expr_node, |
| 199 | 199 | LVal lval, ResultLoc *parent_result_loc); |
| 200 | static void ir_reset_result(ResultLoc *result_loc); | |
| 200 | 201 | |
| 201 | 202 | static ConstExprValue *const_ptr_pointee_unchecked(CodeGen *g, ConstExprValue *const_val) { |
| 202 | 203 | assert(get_src_ptr_type(const_val->type) != nullptr); |
| ... | ... | @@ -912,6 +913,10 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionTypeInfo *) { |
| 912 | 913 | return IrInstructionIdTypeInfo; |
| 913 | 914 | } |
| 914 | 915 | |
| 916 | static constexpr IrInstructionId ir_instruction_id(IrInstructionType *) { | |
| 917 | return IrInstructionIdType; | |
| 918 | } | |
| 919 | ||
| 915 | 920 | static constexpr IrInstructionId ir_instruction_id(IrInstructionHasField *) { |
| 916 | 921 | return IrInstructionIdHasField; |
| 917 | 922 | } |
| ... | ... | @@ -1384,7 +1389,7 @@ static IrInstruction *ir_build_union_field_ptr(IrBuilder *irb, Scope *scope, Ast |
| 1384 | 1389 | |
| 1385 | 1390 | static IrInstruction *ir_build_call_src(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1386 | 1391 | ZigFn *fn_entry, IrInstruction *fn_ref, size_t arg_count, IrInstruction **args, |
| 1387 | bool is_comptime, FnInline fn_inline, bool is_async, bool is_async_call_builtin, | |
| 1392 | bool is_comptime, FnInline fn_inline, CallModifier modifier, bool is_async_call_builtin, | |
| 1388 | 1393 | IrInstruction *new_stack, ResultLoc *result_loc) |
| 1389 | 1394 | { |
| 1390 | 1395 | IrInstructionCallSrc *call_instruction = ir_build_instruction<IrInstructionCallSrc>(irb, scope, source_node); |
| ... | ... | @@ -1394,7 +1399,7 @@ static IrInstruction *ir_build_call_src(IrBuilder *irb, Scope *scope, AstNode *s |
| 1394 | 1399 | call_instruction->fn_inline = fn_inline; |
| 1395 | 1400 | call_instruction->args = args; |
| 1396 | 1401 | call_instruction->arg_count = arg_count; |
| 1397 | call_instruction->is_async = is_async; | |
| 1402 | call_instruction->modifier = modifier; | |
| 1398 | 1403 | call_instruction->is_async_call_builtin = is_async_call_builtin; |
| 1399 | 1404 | call_instruction->new_stack = new_stack; |
| 1400 | 1405 | call_instruction->result_loc = result_loc; |
| ... | ... | @@ -1402,7 +1407,7 @@ static IrInstruction *ir_build_call_src(IrBuilder *irb, Scope *scope, AstNode *s |
| 1402 | 1407 | if (fn_ref != nullptr) ir_ref_instruction(fn_ref, irb->current_basic_block); |
| 1403 | 1408 | for (size_t i = 0; i < arg_count; i += 1) |
| 1404 | 1409 | ir_ref_instruction(args[i], irb->current_basic_block); |
| 1405 | if (is_async && new_stack != nullptr) { | |
| 1410 | if (modifier == CallModifierAsync && new_stack != nullptr) { | |
| 1406 | 1411 | // in this case the arg at the end is the return pointer |
| 1407 | 1412 | ir_ref_instruction(args[arg_count], irb->current_basic_block); |
| 1408 | 1413 | } |
| ... | ... | @@ -1413,7 +1418,7 @@ static IrInstruction *ir_build_call_src(IrBuilder *irb, Scope *scope, AstNode *s |
| 1413 | 1418 | |
| 1414 | 1419 | static IrInstructionCallGen *ir_build_call_gen(IrAnalyze *ira, IrInstruction *source_instruction, |
| 1415 | 1420 | ZigFn *fn_entry, IrInstruction *fn_ref, size_t arg_count, IrInstruction **args, |
| 1416 | FnInline fn_inline, bool is_async, IrInstruction *new_stack, bool is_async_call_builtin, | |
| 1421 | FnInline fn_inline, CallModifier modifier, IrInstruction *new_stack, bool is_async_call_builtin, | |
| 1417 | 1422 | IrInstruction *result_loc, ZigType *return_type) |
| 1418 | 1423 | { |
| 1419 | 1424 | IrInstructionCallGen *call_instruction = ir_build_instruction<IrInstructionCallGen>(&ira->new_irb, |
| ... | ... | @@ -1424,7 +1429,7 @@ static IrInstructionCallGen *ir_build_call_gen(IrAnalyze *ira, IrInstruction *so |
| 1424 | 1429 | call_instruction->fn_inline = fn_inline; |
| 1425 | 1430 | call_instruction->args = args; |
| 1426 | 1431 | call_instruction->arg_count = arg_count; |
| 1427 | call_instruction->is_async = is_async; | |
| 1432 | call_instruction->modifier = modifier; | |
| 1428 | 1433 | call_instruction->is_async_call_builtin = is_async_call_builtin; |
| 1429 | 1434 | call_instruction->new_stack = new_stack; |
| 1430 | 1435 | call_instruction->result_loc = result_loc; |
| ... | ... | @@ -2907,6 +2912,15 @@ static IrInstruction *ir_build_type_info(IrBuilder *irb, Scope *scope, AstNode * |
| 2907 | 2912 | return &instruction->base; |
| 2908 | 2913 | } |
| 2909 | 2914 | |
| 2915 | static IrInstruction *ir_build_type(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *type_info) { | |
| 2916 | IrInstructionType *instruction = ir_build_instruction<IrInstructionType>(irb, scope, source_node); | |
| 2917 | instruction->type_info = type_info; | |
| 2918 | ||
| 2919 | ir_ref_instruction(type_info, irb->current_basic_block); | |
| 2920 | ||
| 2921 | return &instruction->base; | |
| 2922 | } | |
| 2923 | ||
| 2910 | 2924 | static IrInstruction *ir_build_type_id(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2911 | 2925 | IrInstruction *type_value) |
| 2912 | 2926 | { |
| ... | ... | @@ -3072,10 +3086,11 @@ static IrInstruction *ir_build_save_err_ret_addr(IrBuilder *irb, Scope *scope, A |
| 3072 | 3086 | } |
| 3073 | 3087 | |
| 3074 | 3088 | static IrInstruction *ir_build_add_implicit_return_type(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 3075 | IrInstruction *value) | |
| 3089 | IrInstruction *value, ResultLocReturn *result_loc_ret) | |
| 3076 | 3090 | { |
| 3077 | 3091 | IrInstructionAddImplicitReturnType *instruction = ir_build_instruction<IrInstructionAddImplicitReturnType>(irb, scope, source_node); |
| 3078 | 3092 | instruction->value = value; |
| 3093 | instruction->result_loc_ret = result_loc_ret; | |
| 3079 | 3094 | |
| 3080 | 3095 | ir_ref_instruction(value, irb->current_basic_block); |
| 3081 | 3096 | |
| ... | ... | @@ -3349,6 +3364,7 @@ static void ir_count_defers(IrBuilder *irb, Scope *inner_scope, Scope *outer_sco |
| 3349 | 3364 | case ScopeIdCompTime: |
| 3350 | 3365 | case ScopeIdRuntime: |
| 3351 | 3366 | case ScopeIdTypeOf: |
| 3367 | case ScopeIdExpr: | |
| 3352 | 3368 | scope = scope->parent; |
| 3353 | 3369 | continue; |
| 3354 | 3370 | case ScopeIdDeferExpr: |
| ... | ... | @@ -3405,6 +3421,7 @@ static bool ir_gen_defers_for_block(IrBuilder *irb, Scope *inner_scope, Scope *o |
| 3405 | 3421 | case ScopeIdCompTime: |
| 3406 | 3422 | case ScopeIdRuntime: |
| 3407 | 3423 | case ScopeIdTypeOf: |
| 3424 | case ScopeIdExpr: | |
| 3408 | 3425 | scope = scope->parent; |
| 3409 | 3426 | continue; |
| 3410 | 3427 | case ScopeIdDeferExpr: |
| ... | ... | @@ -3492,7 +3509,7 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node, |
| 3492 | 3509 | return_value = ir_build_const_void(irb, scope, node); |
| 3493 | 3510 | } |
| 3494 | 3511 | |
| 3495 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, return_value)); | |
| 3512 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, return_value, result_loc_ret)); | |
| 3496 | 3513 | |
| 3497 | 3514 | size_t defer_counts[2]; |
| 3498 | 3515 | ir_count_defers(irb, scope, outer_scope, defer_counts); |
| ... | ... | @@ -3567,7 +3584,7 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node, |
| 3567 | 3584 | ir_set_cursor_at_end_and_append_block(irb, return_block); |
| 3568 | 3585 | IrInstruction *err_val_ptr = ir_build_unwrap_err_code(irb, scope, node, err_union_ptr); |
| 3569 | 3586 | IrInstruction *err_val = ir_build_load_ptr(irb, scope, node, err_val_ptr); |
| 3570 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, err_val)); | |
| 3587 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, err_val, nullptr)); | |
| 3571 | 3588 | IrInstructionSpillBegin *spill_begin = ir_build_spill_begin(irb, scope, node, err_val, |
| 3572 | 3589 | SpillIdRetErrCode); |
| 3573 | 3590 | ResultLocReturn *result_loc_ret = allocate<ResultLocReturn>(1); |
| ... | ... | @@ -3611,7 +3628,7 @@ static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_s |
| 3611 | 3628 | } |
| 3612 | 3629 | |
| 3613 | 3630 | if (name) { |
| 3614 | buf_init_from_buf(&variable_entry->name, name); | |
| 3631 | variable_entry->name = strdup(buf_ptr(name)); | |
| 3615 | 3632 | |
| 3616 | 3633 | if (!skip_name_check) { |
| 3617 | 3634 | ZigVar *existing_var = find_variable(codegen, parent_scope, name, nullptr); |
| ... | ... | @@ -3644,7 +3661,7 @@ static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_s |
| 3644 | 3661 | // TODO make this name not actually be in scope. user should be able to make a variable called "_anon" |
| 3645 | 3662 | // might already be solved, let's just make sure it has test coverage |
| 3646 | 3663 | // maybe we put a prefix on this so the debug info doesn't clobber user debug info for same named variables |
| 3647 | buf_init_from_str(&variable_entry->name, "_anon"); | |
| 3664 | variable_entry->name = "_anon"; | |
| 3648 | 3665 | } |
| 3649 | 3666 | |
| 3650 | 3667 | variable_entry->src_is_const = src_is_const; |
| ... | ... | @@ -3677,6 +3694,7 @@ static ResultLocPeer *create_peer_result(ResultLocPeerParent *peer_parent) { |
| 3677 | 3694 | result->base.id = ResultLocIdPeer; |
| 3678 | 3695 | result->base.source_instruction = peer_parent->base.source_instruction; |
| 3679 | 3696 | result->parent = peer_parent; |
| 3697 | result->base.allow_write_through_const = peer_parent->parent->allow_write_through_const; | |
| 3680 | 3698 | return result; |
| 3681 | 3699 | } |
| 3682 | 3700 | |
| ... | ... | @@ -3799,7 +3817,7 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode |
| 3799 | 3817 | // no need for save_err_ret_addr because this cannot return error |
| 3800 | 3818 | // only generate unconditional defers |
| 3801 | 3819 | |
| 3802 | ir_mark_gen(ir_build_add_implicit_return_type(irb, child_scope, block_node, result)); | |
| 3820 | ir_mark_gen(ir_build_add_implicit_return_type(irb, child_scope, block_node, result, nullptr)); | |
| 3803 | 3821 | ir_gen_defers_for_block(irb, child_scope, outer_block_scope, false); |
| 3804 | 3822 | return ir_mark_gen(ir_build_return(irb, child_scope, result->source_node, result)); |
| 3805 | 3823 | } |
| ... | ... | @@ -4396,10 +4414,10 @@ static IrInstruction *ir_gen_async_call(IrBuilder *irb, Scope *scope, AstNode *a |
| 4396 | 4414 | |
| 4397 | 4415 | args[arg_count] = ret_ptr; |
| 4398 | 4416 | |
| 4399 | bool is_async = await_node == nullptr; | |
| 4417 | CallModifier modifier = (await_node == nullptr) ? CallModifierAsync : CallModifierNone; | |
| 4400 | 4418 | bool is_async_call_builtin = true; |
| 4401 | 4419 | IrInstruction *call = ir_build_call_src(irb, scope, call_node, nullptr, fn_ref, arg_count, args, false, |
| 4402 | FnInlineAuto, is_async, is_async_call_builtin, bytes, result_loc); | |
| 4420 | FnInlineAuto, modifier, is_async_call_builtin, bytes, result_loc); | |
| 4403 | 4421 | return ir_lval_wrap(irb, scope, call, lval, result_loc); |
| 4404 | 4422 | } |
| 4405 | 4423 | |
| ... | ... | @@ -5046,6 +5064,16 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 5046 | 5064 | IrInstruction *type_info = ir_build_type_info(irb, scope, node, arg0_value); |
| 5047 | 5065 | return ir_lval_wrap(irb, scope, type_info, lval, result_loc); |
| 5048 | 5066 | } |
| 5067 | case BuiltinFnIdType: | |
| 5068 | { | |
| 5069 | AstNode *arg_node = node->data.fn_call_expr.params.at(0); | |
| 5070 | IrInstruction *arg = ir_gen_node(irb, arg_node, scope); | |
| 5071 | if (arg == irb->codegen->invalid_instruction) | |
| 5072 | return arg; | |
| 5073 | ||
| 5074 | IrInstruction *type = ir_build_type(irb, scope, node, arg); | |
| 5075 | return ir_lval_wrap(irb, scope, type, lval, result_loc); | |
| 5076 | } | |
| 5049 | 5077 | case BuiltinFnIdBreakpoint: |
| 5050 | 5078 | return ir_lval_wrap(irb, scope, ir_build_breakpoint(irb, scope, node), lval, result_loc); |
| 5051 | 5079 | case BuiltinFnIdReturnAddress: |
| ... | ... | @@ -5276,7 +5304,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 5276 | 5304 | FnInline fn_inline = (builtin_fn->id == BuiltinFnIdInlineCall) ? FnInlineAlways : FnInlineNever; |
| 5277 | 5305 | |
| 5278 | 5306 | IrInstruction *call = ir_build_call_src(irb, scope, node, nullptr, fn_ref, arg_count, args, false, |
| 5279 | fn_inline, false, false, nullptr, result_loc); | |
| 5307 | fn_inline, CallModifierNone, false, nullptr, result_loc); | |
| 5280 | 5308 | return ir_lval_wrap(irb, scope, call, lval, result_loc); |
| 5281 | 5309 | } |
| 5282 | 5310 | case BuiltinFnIdNewStackCall: |
| ... | ... | @@ -5309,7 +5337,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 5309 | 5337 | } |
| 5310 | 5338 | |
| 5311 | 5339 | IrInstruction *call = ir_build_call_src(irb, scope, node, nullptr, fn_ref, arg_count, args, false, |
| 5312 | FnInlineAuto, false, false, new_stack, result_loc); | |
| 5340 | FnInlineAuto, CallModifierNone, false, new_stack, result_loc); | |
| 5313 | 5341 | return ir_lval_wrap(irb, scope, call, lval, result_loc); |
| 5314 | 5342 | } |
| 5315 | 5343 | case BuiltinFnIdAsyncCall: |
| ... | ... | @@ -5598,7 +5626,7 @@ static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node |
| 5598 | 5626 | { |
| 5599 | 5627 | assert(node->type == NodeTypeFnCallExpr); |
| 5600 | 5628 | |
| 5601 | if (node->data.fn_call_expr.is_builtin) | |
| 5629 | if (node->data.fn_call_expr.modifier == CallModifierBuiltin) | |
| 5602 | 5630 | return ir_gen_builtin_fn_call(irb, scope, node, lval, result_loc); |
| 5603 | 5631 | |
| 5604 | 5632 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; |
| ... | ... | @@ -5615,9 +5643,8 @@ static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node |
| 5615 | 5643 | return args[i]; |
| 5616 | 5644 | } |
| 5617 | 5645 | |
| 5618 | bool is_async = node->data.fn_call_expr.is_async; | |
| 5619 | 5646 | IrInstruction *fn_call = ir_build_call_src(irb, scope, node, nullptr, fn_ref, arg_count, args, false, |
| 5620 | FnInlineAuto, is_async, false, nullptr, result_loc); | |
| 5647 | FnInlineAuto, node->data.fn_call_expr.modifier, false, nullptr, result_loc); | |
| 5621 | 5648 | return ir_lval_wrap(irb, scope, fn_call, lval, result_loc); |
| 5622 | 5649 | } |
| 5623 | 5650 | |
| ... | ... | @@ -6440,7 +6467,9 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo |
| 6440 | 6467 | } |
| 6441 | 6468 | assert(elem_node->type == NodeTypeSymbol); |
| 6442 | 6469 | |
| 6443 | IrInstruction *array_val_ptr = ir_gen_node_extra(irb, array_node, parent_scope, LValPtr, nullptr); | |
| 6470 | ScopeExpr *spill_scope = create_expr_scope(irb->codegen, node, parent_scope); | |
| 6471 | ||
| 6472 | IrInstruction *array_val_ptr = ir_gen_node_extra(irb, array_node, &spill_scope->base, LValPtr, nullptr); | |
| 6444 | 6473 | if (array_val_ptr == irb->codegen->invalid_instruction) |
| 6445 | 6474 | return array_val_ptr; |
| 6446 | 6475 | |
| ... | ... | @@ -6477,11 +6506,11 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo |
| 6477 | 6506 | |
| 6478 | 6507 | Buf *len_field_name = buf_create_from_str("len"); |
| 6479 | 6508 | IrInstruction *len_ref = ir_build_field_ptr(irb, parent_scope, node, array_val_ptr, len_field_name, false); |
| 6480 | IrInstruction *len_val = ir_build_load_ptr(irb, parent_scope, node, len_ref); | |
| 6509 | IrInstruction *len_val = ir_build_load_ptr(irb, &spill_scope->base, node, len_ref); | |
| 6481 | 6510 | ir_build_br(irb, parent_scope, node, cond_block, is_comptime); |
| 6482 | 6511 | |
| 6483 | 6512 | ir_set_cursor_at_end_and_append_block(irb, cond_block); |
| 6484 | IrInstruction *index_val = ir_build_load_ptr(irb, parent_scope, node, index_ptr); | |
| 6513 | IrInstruction *index_val = ir_build_load_ptr(irb, &spill_scope->base, node, index_ptr); | |
| 6485 | 6514 | IrInstruction *cond = ir_build_bin_op(irb, parent_scope, node, IrBinOpCmpLessThan, index_val, len_val, false); |
| 6486 | 6515 | IrBasicBlock *after_cond_block = irb->current_basic_block; |
| 6487 | 6516 | IrInstruction *void_else_value = else_node ? nullptr : ir_mark_gen(ir_build_const_void(irb, parent_scope, node)); |
| ... | ... | @@ -6491,7 +6520,8 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo |
| 6491 | 6520 | ResultLocPeerParent *peer_parent = ir_build_result_peers(irb, cond_br_inst, end_block, result_loc, is_comptime); |
| 6492 | 6521 | |
| 6493 | 6522 | ir_set_cursor_at_end_and_append_block(irb, body_block); |
| 6494 | IrInstruction *elem_ptr = ir_build_elem_ptr(irb, parent_scope, node, array_val_ptr, index_val, false, | |
| 6523 | Scope *elem_ptr_scope = node->data.for_expr.elem_is_ptr ? parent_scope : &spill_scope->base; | |
| 6524 | IrInstruction *elem_ptr = ir_build_elem_ptr(irb, elem_ptr_scope, node, array_val_ptr, index_val, false, | |
| 6495 | 6525 | PtrLenSingle, nullptr); |
| 6496 | 6526 | // TODO make it an error to write to element variable or i variable. |
| 6497 | 6527 | Buf *elem_var_name = elem_node->data.symbol_expr.symbol; |
| ... | ... | @@ -6499,7 +6529,7 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo |
| 6499 | 6529 | Scope *child_scope = elem_var->child_scope; |
| 6500 | 6530 | |
| 6501 | 6531 | IrInstruction *var_ptr = node->data.for_expr.elem_is_ptr ? |
| 6502 | ir_build_ref(irb, parent_scope, elem_node, elem_ptr, true, false) : elem_ptr; | |
| 6532 | ir_build_ref(irb, &spill_scope->base, elem_node, elem_ptr, true, false) : elem_ptr; | |
| 6503 | 6533 | ir_build_var_decl_src(irb, parent_scope, elem_node, elem_var, nullptr, var_ptr); |
| 6504 | 6534 | |
| 6505 | 6535 | ZigList<IrInstruction *> incoming_values = {0}; |
| ... | ... | @@ -6512,6 +6542,7 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo |
| 6512 | 6542 | loop_scope->incoming_values = &incoming_values; |
| 6513 | 6543 | loop_scope->lval = LValNone; |
| 6514 | 6544 | loop_scope->peer_parent = peer_parent; |
| 6545 | loop_scope->spill_scope = spill_scope; | |
| 6515 | 6546 | |
| 6516 | 6547 | // Note the body block of the loop is not the place that lval and result_loc are used - |
| 6517 | 6548 | // it's actually in break statements, handled similarly to return statements. |
| ... | ... | @@ -7911,7 +7942,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n |
| 7911 | 7942 | assert(node->type == NodeTypeAwaitExpr); |
| 7912 | 7943 | |
| 7913 | 7944 | AstNode *expr_node = node->data.await_expr.expr; |
| 7914 | if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.is_builtin) { | |
| 7945 | if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.modifier == CallModifierBuiltin) { | |
| 7915 | 7946 | AstNode *fn_ref_expr = expr_node->data.fn_call_expr.fn_ref_expr; |
| 7916 | 7947 | Buf *name = fn_ref_expr->data.symbol_expr.symbol; |
| 7917 | 7948 | auto entry = irb->codegen->builtin_fn_table.maybe_get(name); |
| ... | ... | @@ -8133,7 +8164,15 @@ static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *sc |
| 8133 | 8164 | result_loc = no_result_loc(); |
| 8134 | 8165 | ir_build_reset_result(irb, scope, node, result_loc); |
| 8135 | 8166 | } |
| 8136 | IrInstruction *result = ir_gen_node_raw(irb, node, scope, lval, result_loc); | |
| 8167 | Scope *child_scope; | |
| 8168 | if (irb->exec->is_inline || | |
| 8169 | (irb->exec->fn_entry != nullptr && irb->exec->fn_entry->child_scope == scope)) | |
| 8170 | { | |
| 8171 | child_scope = scope; | |
| 8172 | } else { | |
| 8173 | child_scope = &create_expr_scope(irb->codegen, node, scope)->base; | |
| 8174 | } | |
| 8175 | IrInstruction *result = ir_gen_node_raw(irb, node, child_scope, lval, result_loc); | |
| 8137 | 8176 | if (result == irb->codegen->invalid_instruction) { |
| 8138 | 8177 | if (irb->exec->first_err_trace_msg == nullptr) { |
| 8139 | 8178 | irb->exec->first_err_trace_msg = irb->codegen->trace_err; |
| ... | ... | @@ -8184,7 +8223,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 8184 | 8223 | } |
| 8185 | 8224 | |
| 8186 | 8225 | if (!instr_is_unreachable(result)) { |
| 8187 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, result->source_node, result)); | |
| 8226 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, result->source_node, result, nullptr)); | |
| 8188 | 8227 | // no need for save_err_ret_addr because this cannot return error |
| 8189 | 8228 | ir_mark_gen(ir_build_return(irb, scope, result->source_node, result)); |
| 8190 | 8229 | } |
| ... | ... | @@ -10869,7 +10908,7 @@ ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *nod |
| 10869 | 10908 | fprintf(stderr, "\nSource: "); |
| 10870 | 10909 | ast_render(stderr, node, 4); |
| 10871 | 10910 | fprintf(stderr, "\n{ // (IR)\n"); |
| 10872 | ir_print(codegen, stderr, ir_executable, 2, 1); | |
| 10911 | ir_print(codegen, stderr, ir_executable, 2, IrPassSrc); | |
| 10873 | 10912 | fprintf(stderr, "}\n"); |
| 10874 | 10913 | } |
| 10875 | 10914 | IrExecutable *analyzed_executable = allocate<IrExecutable>(1); |
| ... | ... | @@ -10890,7 +10929,7 @@ ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *nod |
| 10890 | 10929 | |
| 10891 | 10930 | if (codegen->verbose_ir) { |
| 10892 | 10931 | fprintf(stderr, "{ // (analyzed)\n"); |
| 10893 | ir_print(codegen, stderr, analyzed_executable, 2, 2); | |
| 10932 | ir_print(codegen, stderr, analyzed_executable, 2, IrPassGen); | |
| 10894 | 10933 | fprintf(stderr, "}\n"); |
| 10895 | 10934 | } |
| 10896 | 10935 | |
| ... | ... | @@ -12058,6 +12097,29 @@ static bool is_pointery_and_elem_is_not_pointery(ZigType *ty) { |
| 12058 | 12097 | return false; |
| 12059 | 12098 | } |
| 12060 | 12099 | |
| 12100 | static IrInstruction *ir_analyze_enum_literal(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, | |
| 12101 | ZigType *enum_type) | |
| 12102 | { | |
| 12103 | assert(enum_type->id == ZigTypeIdEnum); | |
| 12104 | ||
| 12105 | Error err; | |
| 12106 | if ((err = type_resolve(ira->codegen, enum_type, ResolveStatusZeroBitsKnown))) | |
| 12107 | return ira->codegen->invalid_instruction; | |
| 12108 | ||
| 12109 | TypeEnumField *field = find_enum_type_field(enum_type, value->value.data.x_enum_literal); | |
| 12110 | if (field == nullptr) { | |
| 12111 | ErrorMsg *msg = ir_add_error(ira, source_instr, buf_sprintf("enum '%s' has no field named '%s'", | |
| 12112 | buf_ptr(&enum_type->name), buf_ptr(value->value.data.x_enum_literal))); | |
| 12113 | add_error_note(ira->codegen, msg, enum_type->data.enumeration.decl_node, | |
| 12114 | buf_sprintf("'%s' declared here", buf_ptr(&enum_type->name))); | |
| 12115 | return ira->codegen->invalid_instruction; | |
| 12116 | } | |
| 12117 | IrInstruction *result = ir_const(ira, source_instr, enum_type); | |
| 12118 | bigint_init_bigint(&result->value.data.x_enum_tag, &field->value); | |
| 12119 | ||
| 12120 | return result; | |
| 12121 | } | |
| 12122 | ||
| 12061 | 12123 | static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 12062 | 12124 | ZigType *wanted_type, IrInstruction *value, ResultLoc *result_loc) |
| 12063 | 12125 | { |
| ... | ... | @@ -12416,21 +12478,31 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12416 | 12478 | } |
| 12417 | 12479 | |
| 12418 | 12480 | // cast from enum literal to enum with matching field name |
| 12419 | if (actual_type->id == ZigTypeIdEnumLiteral && wanted_type->id == ZigTypeIdEnum) { | |
| 12420 | if ((err = type_resolve(ira->codegen, wanted_type, ResolveStatusZeroBitsKnown))) | |
| 12421 | return ira->codegen->invalid_instruction; | |
| 12481 | if (actual_type->id == ZigTypeIdEnumLiteral && wanted_type->id == ZigTypeIdEnum) | |
| 12482 | { | |
| 12483 | return ir_analyze_enum_literal(ira, source_instr, value, wanted_type); | |
| 12484 | } | |
| 12422 | 12485 | |
| 12423 | TypeEnumField *field = find_enum_type_field(wanted_type, value->value.data.x_enum_literal); | |
| 12424 | if (field == nullptr) { | |
| 12425 | ErrorMsg *msg = ir_add_error(ira, source_instr, buf_sprintf("enum '%s' has no field named '%s'", | |
| 12426 | buf_ptr(&wanted_type->name), buf_ptr(value->value.data.x_enum_literal))); | |
| 12427 | add_error_note(ira->codegen, msg, wanted_type->data.enumeration.decl_node, | |
| 12428 | buf_sprintf("'%s' declared here", buf_ptr(&wanted_type->name))); | |
| 12429 | return ira->codegen->invalid_instruction; | |
| 12430 | } | |
| 12431 | IrInstruction *result = ir_const(ira, source_instr, wanted_type); | |
| 12432 | bigint_init_bigint(&result->value.data.x_enum_tag, &field->value); | |
| 12433 | return result; | |
| 12486 | // cast from enum literal to optional enum | |
| 12487 | if (actual_type->id == ZigTypeIdEnumLiteral && | |
| 12488 | (wanted_type->id == ZigTypeIdOptional && wanted_type->data.maybe.child_type->id == ZigTypeIdEnum)) | |
| 12489 | { | |
| 12490 | IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.maybe.child_type); | |
| 12491 | if (result == ira->codegen->invalid_instruction) | |
| 12492 | return result; | |
| 12493 | ||
| 12494 | return ir_analyze_optional_wrap(ira, result, value, wanted_type, result_loc); | |
| 12495 | } | |
| 12496 | ||
| 12497 | // cast from enum literal to error union when payload is an enum | |
| 12498 | if (actual_type->id == ZigTypeIdEnumLiteral && | |
| 12499 | (wanted_type->id == ZigTypeIdErrorUnion && wanted_type->data.error_union.payload_type->id == ZigTypeIdEnum)) | |
| 12500 | { | |
| 12501 | IrInstruction *result = ir_analyze_enum_literal(ira, source_instr, value, wanted_type->data.error_union.payload_type); | |
| 12502 | if (result == ira->codegen->invalid_instruction) | |
| 12503 | return result; | |
| 12504 | ||
| 12505 | return ir_analyze_err_wrap_payload(ira, result, value, wanted_type, result_loc); | |
| 12434 | 12506 | } |
| 12435 | 12507 | |
| 12436 | 12508 | // cast from union to the enum type of the union |
| ... | ... | @@ -12883,7 +12955,9 @@ static IrInstruction *ir_analyze_instruction_add_implicit_return_type(IrAnalyze |
| 12883 | 12955 | if (type_is_invalid(value->value.type)) |
| 12884 | 12956 | return ir_unreach_error(ira); |
| 12885 | 12957 | |
| 12886 | ira->src_implicit_return_type_list.append(value); | |
| 12958 | if (instruction->result_loc_ret == nullptr || !instruction->result_loc_ret->implicit_return_type_done) { | |
| 12959 | ira->src_implicit_return_type_list.append(value); | |
| 12960 | } | |
| 12887 | 12961 | |
| 12888 | 12962 | return ir_const_void(ira, &instruction->base); |
| 12889 | 12963 | } |
| ... | ... | @@ -13154,6 +13228,46 @@ static IrInstruction *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp * |
| 13154 | 13228 | ir_add_error_node(ira, source_node, buf_sprintf("comparison of '%s' with null", |
| 13155 | 13229 | buf_ptr(&non_null_type->name))); |
| 13156 | 13230 | return ira->codegen->invalid_instruction; |
| 13231 | } else if (is_equality_cmp && ( | |
| 13232 | (op1->value.type->id == ZigTypeIdEnumLiteral && op2->value.type->id == ZigTypeIdUnion) || | |
| 13233 | (op2->value.type->id == ZigTypeIdEnumLiteral && op1->value.type->id == ZigTypeIdUnion))) | |
| 13234 | { | |
| 13235 | // Support equality comparison between a union's tag value and a enum literal | |
| 13236 | IrInstruction *union_val = op1->value.type->id == ZigTypeIdUnion ? op1 : op2; | |
| 13237 | IrInstruction *enum_val = op1->value.type->id == ZigTypeIdUnion ? op2 : op1; | |
| 13238 | ||
| 13239 | ZigType *tag_type = union_val->value.type->data.unionation.tag_type; | |
| 13240 | assert(tag_type != nullptr); | |
| 13241 | ||
| 13242 | IrInstruction *casted_union = ir_implicit_cast(ira, union_val, tag_type); | |
| 13243 | if (type_is_invalid(casted_union->value.type)) | |
| 13244 | return ira->codegen->invalid_instruction; | |
| 13245 | ||
| 13246 | IrInstruction *casted_val = ir_implicit_cast(ira, enum_val, tag_type); | |
| 13247 | if (type_is_invalid(casted_val->value.type)) | |
| 13248 | return ira->codegen->invalid_instruction; | |
| 13249 | ||
| 13250 | if (instr_is_comptime(casted_union)) { | |
| 13251 | ConstExprValue *const_union_val = ir_resolve_const(ira, casted_union, UndefBad); | |
| 13252 | if (!const_union_val) | |
| 13253 | return ira->codegen->invalid_instruction; | |
| 13254 | ||
| 13255 | ConstExprValue *const_enum_val = ir_resolve_const(ira, casted_val, UndefBad); | |
| 13256 | if (!const_enum_val) | |
| 13257 | return ira->codegen->invalid_instruction; | |
| 13258 | ||
| 13259 | Cmp cmp_result = bigint_cmp(&const_union_val->data.x_union.tag, &const_enum_val->data.x_enum_tag); | |
| 13260 | bool bool_result = (op_id == IrBinOpCmpEq) ? cmp_result == CmpEQ : cmp_result != CmpEQ; | |
| 13261 | ||
| 13262 | return ir_const_bool(ira, &bin_op_instruction->base, bool_result); | |
| 13263 | } | |
| 13264 | ||
| 13265 | IrInstruction *result = ir_build_bin_op(&ira->new_irb, | |
| 13266 | bin_op_instruction->base.scope, bin_op_instruction->base.source_node, | |
| 13267 | op_id, casted_union, casted_val, bin_op_instruction->safety_check_on); | |
| 13268 | result->value.type = ira->codegen->builtin_types.entry_bool; | |
| 13269 | ||
| 13270 | return result; | |
| 13157 | 13271 | } |
| 13158 | 13272 | |
| 13159 | 13273 | if (op1->value.type->id == ZigTypeIdErrorSet && op2->value.type->id == ZigTypeIdErrorSet) { |
| ... | ... | @@ -13678,7 +13792,7 @@ static IrInstruction *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *b |
| 13678 | 13792 | return ira->codegen->invalid_instruction; |
| 13679 | 13793 | |
| 13680 | 13794 | if (op1->value.type->id != ZigTypeIdInt && op1->value.type->id != ZigTypeIdComptimeInt) { |
| 13681 | ir_add_error(ira, &bin_op_instruction->base, | |
| 13795 | ir_add_error(ira, bin_op_instruction->op1, | |
| 13682 | 13796 | buf_sprintf("bit shifting operation expected integer type, found '%s'", |
| 13683 | 13797 | buf_ptr(&op1->value.type->name))); |
| 13684 | 13798 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -13688,6 +13802,13 @@ static IrInstruction *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *b |
| 13688 | 13802 | if (type_is_invalid(op2->value.type)) |
| 13689 | 13803 | return ira->codegen->invalid_instruction; |
| 13690 | 13804 | |
| 13805 | if (op2->value.type->id != ZigTypeIdInt && op2->value.type->id != ZigTypeIdComptimeInt) { | |
| 13806 | ir_add_error(ira, bin_op_instruction->op2, | |
| 13807 | buf_sprintf("shift amount has to be an integer type, but found '%s'", | |
| 13808 | buf_ptr(&op2->value.type->name))); | |
| 13809 | return ira->codegen->invalid_instruction; | |
| 13810 | } | |
| 13811 | ||
| 13691 | 13812 | IrInstruction *casted_op2; |
| 13692 | 13813 | IrBinOp op_id = bin_op_instruction->op_id; |
| 13693 | 13814 | if (op1->value.type->id == ZigTypeIdComptimeInt) { |
| ... | ... | @@ -14478,7 +14599,8 @@ static IrInstruction *ir_analyze_instruction_decl_var(IrAnalyze *ira, |
| 14478 | 14599 | // We make a new variable so that it can hold a different type, and so the debug info can |
| 14479 | 14600 | // be distinct. |
| 14480 | 14601 | ZigVar *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope, |
| 14481 | &var->name, var->src_is_const, var->gen_is_const, var->shadowable, var->is_comptime, true); | |
| 14602 | buf_create_from_str(var->name), var->src_is_const, var->gen_is_const, | |
| 14603 | var->shadowable, var->is_comptime, true); | |
| 14482 | 14604 | new_var->owner_exec = var->owner_exec; |
| 14483 | 14605 | new_var->align_bytes = var->align_bytes; |
| 14484 | 14606 | if (var->mem_slot_index != SIZE_MAX) { |
| ... | ... | @@ -14621,7 +14743,8 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio |
| 14621 | 14743 | case CallingConventionNaked: |
| 14622 | 14744 | case CallingConventionCold: |
| 14623 | 14745 | case CallingConventionStdcall: |
| 14624 | add_fn_export(ira->codegen, fn_entry, symbol_name, global_linkage_id, cc == CallingConventionC); | |
| 14746 | add_fn_export(ira->codegen, fn_entry, buf_ptr(symbol_name), global_linkage_id, | |
| 14747 | cc == CallingConventionC); | |
| 14625 | 14748 | break; |
| 14626 | 14749 | } |
| 14627 | 14750 | } break; |
| ... | ... | @@ -14759,7 +14882,7 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio |
| 14759 | 14882 | if (load_ptr->ptr->id == IrInstructionIdVarPtr) { |
| 14760 | 14883 | IrInstructionVarPtr *var_ptr = reinterpret_cast<IrInstructionVarPtr *>(load_ptr->ptr); |
| 14761 | 14884 | ZigVar *var = var_ptr->var; |
| 14762 | add_var_export(ira->codegen, var, symbol_name, global_linkage_id); | |
| 14885 | add_var_export(ira->codegen, var, buf_ptr(symbol_name), global_linkage_id); | |
| 14763 | 14886 | } |
| 14764 | 14887 | } |
| 14765 | 14888 | |
| ... | ... | @@ -14839,6 +14962,12 @@ static IrInstruction *ir_analyze_alloca(IrAnalyze *ira, IrInstruction *source_in |
| 14839 | 14962 | if (align != 0) { |
| 14840 | 14963 | if ((err = type_resolve(ira->codegen, var_type, ResolveStatusAlignmentKnown))) |
| 14841 | 14964 | return ira->codegen->invalid_instruction; |
| 14965 | if (!type_has_bits(var_type)) { | |
| 14966 | ir_add_error(ira, source_inst, | |
| 14967 | buf_sprintf("variable '%s' of zero-bit type '%s' has no in-memory representation, it cannot be aligned", | |
| 14968 | name_hint, buf_ptr(&var_type->name))); | |
| 14969 | return ira->codegen->invalid_instruction; | |
| 14970 | } | |
| 14842 | 14971 | } |
| 14843 | 14972 | assert(result->base.value.data.x_ptr.special != ConstPtrSpecialInvalid); |
| 14844 | 14973 | |
| ... | ... | @@ -14907,6 +15036,24 @@ static void set_up_result_loc_for_inferred_comptime(IrInstruction *ptr) { |
| 14907 | 15036 | ptr->value.data.x_ptr.data.ref.pointee = undef_child; |
| 14908 | 15037 | } |
| 14909 | 15038 | |
| 15039 | static bool ir_result_has_type(ResultLoc *result_loc) { | |
| 15040 | switch (result_loc->id) { | |
| 15041 | case ResultLocIdInvalid: | |
| 15042 | case ResultLocIdPeerParent: | |
| 15043 | zig_unreachable(); | |
| 15044 | case ResultLocIdNone: | |
| 15045 | case ResultLocIdPeer: | |
| 15046 | return false; | |
| 15047 | case ResultLocIdReturn: | |
| 15048 | case ResultLocIdInstruction: | |
| 15049 | case ResultLocIdBitCast: | |
| 15050 | return true; | |
| 15051 | case ResultLocIdVar: | |
| 15052 | return reinterpret_cast<ResultLocVar *>(result_loc)->var->decl_node->data.variable_declaration.type != nullptr; | |
| 15053 | } | |
| 15054 | zig_unreachable(); | |
| 15055 | } | |
| 15056 | ||
| 14910 | 15057 | // when calling this function, at the callsite must check for result type noreturn and propagate it up |
| 14911 | 15058 | static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspend_source_instr, |
| 14912 | 15059 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value, bool force_runtime, bool non_null_comptime) |
| ... | ... | @@ -15036,14 +15183,23 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15036 | 15183 | bool is_comptime; |
| 15037 | 15184 | if (!ir_resolve_comptime(ira, peer_parent->is_comptime->child, &is_comptime)) |
| 15038 | 15185 | return ira->codegen->invalid_instruction; |
| 15039 | peer_parent->skipped = is_comptime; | |
| 15040 | if (peer_parent->skipped) { | |
| 15186 | if (is_comptime) { | |
| 15187 | peer_parent->skipped = true; | |
| 15041 | 15188 | if (non_null_comptime) { |
| 15042 | 15189 | return ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, |
| 15043 | 15190 | value_type, value, force_runtime, non_null_comptime, true); |
| 15044 | 15191 | } |
| 15045 | 15192 | return nullptr; |
| 15046 | 15193 | } |
| 15194 | if (ir_result_has_type(peer_parent->parent)) { | |
| 15195 | if (peer_parent->parent->id == ResultLocIdReturn && value != nullptr) { | |
| 15196 | reinterpret_cast<ResultLocReturn *>(peer_parent->parent)->implicit_return_type_done = true; | |
| 15197 | ira->src_implicit_return_type_list.append(value); | |
| 15198 | } | |
| 15199 | peer_parent->skipped = true; | |
| 15200 | return ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, | |
| 15201 | value_type, value, force_runtime, true, true); | |
| 15202 | } | |
| 15047 | 15203 | |
| 15048 | 15204 | if (peer_parent->resolved_type == nullptr) { |
| 15049 | 15205 | if (peer_parent->end_bb->suspend_instruction_ref == nullptr) { |
| ... | ... | @@ -15253,9 +15409,11 @@ static void ir_reset_result(ResultLoc *result_loc) { |
| 15253 | 15409 | alloca_src->base.child = nullptr; |
| 15254 | 15410 | break; |
| 15255 | 15411 | } |
| 15412 | case ResultLocIdReturn: | |
| 15413 | reinterpret_cast<ResultLocReturn *>(result_loc)->implicit_return_type_done = false; | |
| 15414 | break; | |
| 15256 | 15415 | case ResultLocIdPeer: |
| 15257 | 15416 | case ResultLocIdNone: |
| 15258 | case ResultLocIdReturn: | |
| 15259 | 15417 | case ResultLocIdInstruction: |
| 15260 | 15418 | case ResultLocIdBitCast: |
| 15261 | 15419 | break; |
| ... | ... | @@ -15305,7 +15463,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc |
| 15305 | 15463 | ZigType *anyframe_type = get_any_frame_type(ira->codegen, fn_ret_type); |
| 15306 | 15464 | |
| 15307 | 15465 | IrInstructionCallGen *call_gen = ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, |
| 15308 | arg_count, casted_args, FnInlineAuto, true, casted_new_stack, | |
| 15466 | arg_count, casted_args, FnInlineAuto, CallModifierAsync, casted_new_stack, | |
| 15309 | 15467 | call_instruction->is_async_call_builtin, ret_ptr, anyframe_type); |
| 15310 | 15468 | return &call_gen->base; |
| 15311 | 15469 | } else { |
| ... | ... | @@ -15319,8 +15477,8 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc |
| 15319 | 15477 | if (type_is_invalid(result_loc->value.type)) |
| 15320 | 15478 | return ira->codegen->invalid_instruction; |
| 15321 | 15479 | return &ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, arg_count, |
| 15322 | casted_args, FnInlineAuto, true, casted_new_stack, call_instruction->is_async_call_builtin, | |
| 15323 | result_loc, frame_type)->base; | |
| 15480 | casted_args, FnInlineAuto, CallModifierAsync, casted_new_stack, | |
| 15481 | call_instruction->is_async_call_builtin, result_loc, frame_type)->base; | |
| 15324 | 15482 | } |
| 15325 | 15483 | } |
| 15326 | 15484 | static bool ir_analyze_fn_call_inline_arg(IrAnalyze *ira, AstNode *fn_proto_node, |
| ... | ... | @@ -15671,6 +15829,7 @@ static IrInstruction *analyze_casted_new_stack(IrAnalyze *ira, IrInstructionCall |
| 15671 | 15829 | ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, |
| 15672 | 15830 | false, false, PtrLenUnknown, target_fn_align(ira->codegen->zig_target), 0, 0, false); |
| 15673 | 15831 | ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); |
| 15832 | ira->codegen->need_frame_size_prefix_data = true; | |
| 15674 | 15833 | return ir_implicit_cast(ira, new_stack, u8_slice); |
| 15675 | 15834 | } |
| 15676 | 15835 | } |
| ... | ... | @@ -16070,7 +16229,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16070 | 16229 | return ira->codegen->invalid_instruction; |
| 16071 | 16230 | |
| 16072 | 16231 | size_t impl_param_count = impl_fn_type_id->param_count; |
| 16073 | if (call_instruction->is_async) { | |
| 16232 | if (call_instruction->modifier == CallModifierAsync) { | |
| 16074 | 16233 | IrInstruction *result = ir_analyze_async_call(ira, call_instruction, impl_fn, impl_fn->type_entry, |
| 16075 | 16234 | nullptr, casted_args, impl_param_count, casted_new_stack); |
| 16076 | 16235 | return ir_finish_anal(ira, result); |
| ... | ... | @@ -16097,14 +16256,17 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16097 | 16256 | result_loc = nullptr; |
| 16098 | 16257 | } |
| 16099 | 16258 | |
| 16100 | if (impl_fn_type_id->cc == CallingConventionAsync && parent_fn_entry->inferred_async_node == nullptr) { | |
| 16259 | if (impl_fn_type_id->cc == CallingConventionAsync && | |
| 16260 | parent_fn_entry->inferred_async_node == nullptr && | |
| 16261 | call_instruction->modifier != CallModifierNoAsync) | |
| 16262 | { | |
| 16101 | 16263 | parent_fn_entry->inferred_async_node = fn_ref->source_node; |
| 16102 | 16264 | parent_fn_entry->inferred_async_fn = impl_fn; |
| 16103 | 16265 | } |
| 16104 | 16266 | |
| 16105 | 16267 | IrInstructionCallGen *new_call_instruction = ir_build_call_gen(ira, &call_instruction->base, |
| 16106 | 16268 | impl_fn, nullptr, impl_param_count, casted_args, fn_inline, |
| 16107 | false, casted_new_stack, call_instruction->is_async_call_builtin, result_loc, | |
| 16269 | call_instruction->modifier, casted_new_stack, call_instruction->is_async_call_builtin, result_loc, | |
| 16108 | 16270 | impl_fn_type_id->return_type); |
| 16109 | 16271 | |
| 16110 | 16272 | if (get_scope_typeof(call_instruction->base.scope) == nullptr) { |
| ... | ... | @@ -16221,13 +16383,16 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16221 | 16383 | if (casted_new_stack != nullptr && type_is_invalid(casted_new_stack->value.type)) |
| 16222 | 16384 | return ira->codegen->invalid_instruction; |
| 16223 | 16385 | |
| 16224 | if (call_instruction->is_async) { | |
| 16386 | if (call_instruction->modifier == CallModifierAsync) { | |
| 16225 | 16387 | IrInstruction *result = ir_analyze_async_call(ira, call_instruction, fn_entry, fn_type, fn_ref, |
| 16226 | 16388 | casted_args, call_param_count, casted_new_stack); |
| 16227 | 16389 | return ir_finish_anal(ira, result); |
| 16228 | 16390 | } |
| 16229 | 16391 | |
| 16230 | if (fn_type_id->cc == CallingConventionAsync && parent_fn_entry->inferred_async_node == nullptr) { | |
| 16392 | if (fn_type_id->cc == CallingConventionAsync && | |
| 16393 | parent_fn_entry->inferred_async_node == nullptr && | |
| 16394 | call_instruction->modifier != CallModifierNoAsync) | |
| 16395 | { | |
| 16231 | 16396 | parent_fn_entry->inferred_async_node = fn_ref->source_node; |
| 16232 | 16397 | parent_fn_entry->inferred_async_fn = fn_entry; |
| 16233 | 16398 | } |
| ... | ... | @@ -16254,7 +16419,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16254 | 16419 | } |
| 16255 | 16420 | |
| 16256 | 16421 | IrInstructionCallGen *new_call_instruction = ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, |
| 16257 | call_param_count, casted_args, fn_inline, false, casted_new_stack, | |
| 16422 | call_param_count, casted_args, fn_inline, call_instruction->modifier, casted_new_stack, | |
| 16258 | 16423 | call_instruction->is_async_call_builtin, result_loc, return_type); |
| 16259 | 16424 | if (get_scope_typeof(call_instruction->base.scope) == nullptr) { |
| 16260 | 16425 | parent_fn_entry->call_list.append(new_call_instruction); |
| ... | ... | @@ -16461,6 +16626,15 @@ static IrInstruction *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *ins |
| 16461 | 16626 | if (type_is_invalid(expr_type)) |
| 16462 | 16627 | return ira->codegen->invalid_instruction; |
| 16463 | 16628 | |
| 16629 | if (!(expr_type->id == ZigTypeIdInt || expr_type->id == ZigTypeIdComptimeInt || | |
| 16630 | expr_type->id == ZigTypeIdFloat || expr_type->id == ZigTypeIdComptimeFloat || | |
| 16631 | expr_type->id == ZigTypeIdVector)) | |
| 16632 | { | |
| 16633 | ir_add_error(ira, &instruction->base, | |
| 16634 | buf_sprintf("negation of type '%s'", buf_ptr(&expr_type->name))); | |
| 16635 | return ira->codegen->invalid_instruction; | |
| 16636 | } | |
| 16637 | ||
| 16464 | 16638 | bool is_wrap_op = (instruction->op_id == IrUnOpNegationWrap); |
| 16465 | 16639 | |
| 16466 | 16640 | ZigType *scalar_type = (expr_type->id == ZigTypeIdVector) ? expr_type->data.vector.elem_type : expr_type; |
| ... | ... | @@ -16810,10 +16984,21 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 16810 | 16984 | return new_incoming_values.at(0); |
| 16811 | 16985 | } |
| 16812 | 16986 | |
| 16813 | ZigType *resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, nullptr, | |
| 16814 | new_incoming_values.items, new_incoming_values.length); | |
| 16815 | if (type_is_invalid(resolved_type)) | |
| 16816 | return ira->codegen->invalid_instruction; | |
| 16987 | ZigType *resolved_type; | |
| 16988 | if (peer_parent != nullptr && ir_result_has_type(peer_parent->parent)) { | |
| 16989 | if (peer_parent->parent->id == ResultLocIdReturn) { | |
| 16990 | resolved_type = ira->explicit_return_type; | |
| 16991 | } else { | |
| 16992 | ZigType *resolved_loc_ptr_type = peer_parent->parent->resolved_loc->value.type; | |
| 16993 | ir_assert(resolved_loc_ptr_type->id == ZigTypeIdPointer, &phi_instruction->base); | |
| 16994 | resolved_type = resolved_loc_ptr_type->data.pointer.child_type; | |
| 16995 | } | |
| 16996 | } else { | |
| 16997 | resolved_type = ir_resolve_peer_types(ira, phi_instruction->base.source_node, nullptr, | |
| 16998 | new_incoming_values.items, new_incoming_values.length); | |
| 16999 | if (type_is_invalid(resolved_type)) | |
| 17000 | return ira->codegen->invalid_instruction; | |
| 17001 | } | |
| 16817 | 17002 | |
| 16818 | 17003 | switch (type_has_one_possible_value(ira->codegen, resolved_type)) { |
| 16819 | 17004 | case OnePossibleValueInvalid: |
| ... | ... | @@ -16880,7 +17065,7 @@ static IrInstruction *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructi |
| 16880 | 17065 | IrInstruction *result = ir_get_var_ptr(ira, &instruction->base, var); |
| 16881 | 17066 | if (instruction->crossed_fndef_scope != nullptr && !instr_is_comptime(result)) { |
| 16882 | 17067 | ErrorMsg *msg = ir_add_error(ira, &instruction->base, |
| 16883 | buf_sprintf("'%s' not accessible from inner function", buf_ptr(&var->name))); | |
| 17068 | buf_sprintf("'%s' not accessible from inner function", var->name)); | |
| 16884 | 17069 | add_error_note(ira->codegen, msg, instruction->crossed_fndef_scope->base.source_node, |
| 16885 | 17070 | buf_sprintf("crossed function definition here")); |
| 16886 | 17071 | add_error_note(ira->codegen, msg, var->decl_node, |
| ... | ... | @@ -17463,7 +17648,12 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 17463 | 17648 | return ir_analyze_container_member_access_inner(ira, bare_type, field_name, |
| 17464 | 17649 | source_instr, container_ptr, container_type); |
| 17465 | 17650 | } |
| 17466 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field->type_entry, | |
| 17651 | ||
| 17652 | ZigType *field_type = resolve_union_field_type(ira->codegen, field); | |
| 17653 | if (field_type == nullptr) | |
| 17654 | return ira->codegen->invalid_instruction; | |
| 17655 | ||
| 17656 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field_type, | |
| 17467 | 17657 | is_const, is_volatile, PtrLenSingle, 0, 0, 0, false); |
| 17468 | 17658 | if (instr_is_comptime(container_ptr)) { |
| 17469 | 17659 | ConstExprValue *ptr_val = ir_resolve_const(ira, container_ptr, UndefBad); |
| ... | ... | @@ -17480,7 +17670,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 17480 | 17670 | if (initializing) { |
| 17481 | 17671 | ConstExprValue *payload_val = create_const_vals(1); |
| 17482 | 17672 | payload_val->special = ConstValSpecialUndef; |
| 17483 | payload_val->type = field->type_entry; | |
| 17673 | payload_val->type = field_type; | |
| 17484 | 17674 | payload_val->parent.id = ConstParentIdUnion; |
| 17485 | 17675 | payload_val->parent.data.p_union.union_val = union_val; |
| 17486 | 17676 | |
| ... | ... | @@ -17587,7 +17777,8 @@ static IrInstruction *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_ |
| 17587 | 17777 | return ir_error_dependency_loop(ira, source_instruction); |
| 17588 | 17778 | } |
| 17589 | 17779 | if (tld_var->extern_lib_name != nullptr) { |
| 17590 | add_link_lib_symbol(ira, tld_var->extern_lib_name, &var->name, source_instruction->source_node); | |
| 17780 | add_link_lib_symbol(ira, tld_var->extern_lib_name, buf_create_from_str(var->name), | |
| 17781 | source_instruction->source_node); | |
| 17591 | 17782 | } |
| 17592 | 17783 | |
| 17593 | 17784 | return ir_get_var_ptr(ira, source_instruction, var); |
| ... | ... | @@ -19544,6 +19735,11 @@ static IrInstruction *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstr |
| 19544 | 19735 | if (type_is_invalid(msg->value.type)) |
| 19545 | 19736 | return ira->codegen->invalid_instruction; |
| 19546 | 19737 | buf_resize(&buf, 0); |
| 19738 | if (msg->value.special == ConstValSpecialLazy) { | |
| 19739 | // Resolve any lazy value that's passed, we need its value | |
| 19740 | if (ir_resolve_lazy(ira->codegen, msg->source_node, &msg->value)) | |
| 19741 | return ira->codegen->invalid_instruction; | |
| 19742 | } | |
| 19547 | 19743 | render_const_value(ira->codegen, &buf, &msg->value); |
| 19548 | 19744 | const char *comma_str = (i != 0) ? ", " : ""; |
| 19549 | 19745 | fprintf(stderr, "%s%s", comma_str, buf_ptr(&buf)); |
| ... | ... | @@ -20041,8 +20237,9 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInstruction *source_instr |
| 20041 | 20237 | for (size_t fn_arg_index = 0; fn_arg_index < fn_arg_count; fn_arg_index++) { |
| 20042 | 20238 | ZigVar *arg_var = fn_entry->variable_list.at(fn_arg_index); |
| 20043 | 20239 | ConstExprValue *fn_arg_name_val = &fn_arg_name_array->data.x_array.data.s_none.elements[fn_arg_index]; |
| 20044 | ConstExprValue *arg_name = create_const_str_lit(ira->codegen, &arg_var->name); | |
| 20045 | init_const_slice(ira->codegen, fn_arg_name_val, arg_name, 0, buf_len(&arg_var->name), true); | |
| 20240 | ConstExprValue *arg_name = create_const_str_lit(ira->codegen, | |
| 20241 | buf_create_from_str(arg_var->name)); | |
| 20242 | init_const_slice(ira->codegen, fn_arg_name_val, arg_name, 0, strlen(arg_var->name), true); | |
| 20046 | 20243 | fn_arg_name_val->parent.id = ConstParentIdArray; |
| 20047 | 20244 | fn_arg_name_val->parent.data.p_array.array_val = fn_arg_name_array; |
| 20048 | 20245 | fn_arg_name_val->parent.data.p_array.elem_index = fn_arg_index; |
| ... | ... | @@ -20080,14 +20277,27 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInstruction *source_instr |
| 20080 | 20277 | return ErrorNone; |
| 20081 | 20278 | } |
| 20082 | 20279 | |
| 20083 | static uint32_t ptr_len_to_size_enum_index(PtrLen ptr_len) { | |
| 20280 | static BuiltinPtrSize ptr_len_to_size_enum_index(PtrLen ptr_len) { | |
| 20084 | 20281 | switch (ptr_len) { |
| 20085 | 20282 | case PtrLenSingle: |
| 20086 | return 0; | |
| 20283 | return BuiltinPtrSizeOne; | |
| 20087 | 20284 | case PtrLenUnknown: |
| 20088 | return 1; | |
| 20285 | return BuiltinPtrSizeMany; | |
| 20089 | 20286 | case PtrLenC: |
| 20090 | return 3; | |
| 20287 | return BuiltinPtrSizeC; | |
| 20288 | } | |
| 20289 | zig_unreachable(); | |
| 20290 | } | |
| 20291 | ||
| 20292 | static PtrLen size_enum_index_to_ptr_len(BuiltinPtrSize size_enum_index) { | |
| 20293 | switch (size_enum_index) { | |
| 20294 | case BuiltinPtrSizeOne: | |
| 20295 | return PtrLenSingle; | |
| 20296 | case BuiltinPtrSizeMany: | |
| 20297 | case BuiltinPtrSizeSlice: | |
| 20298 | return PtrLenUnknown; | |
| 20299 | case BuiltinPtrSizeC: | |
| 20300 | return PtrLenC; | |
| 20091 | 20301 | } |
| 20092 | 20302 | zig_unreachable(); |
| 20093 | 20303 | } |
| ... | ... | @@ -20095,10 +20305,10 @@ static uint32_t ptr_len_to_size_enum_index(PtrLen ptr_len) { |
| 20095 | 20305 | static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_type_entry) { |
| 20096 | 20306 | Error err; |
| 20097 | 20307 | ZigType *attrs_type; |
| 20098 | uint32_t size_enum_index; | |
| 20308 | BuiltinPtrSize size_enum_index; | |
| 20099 | 20309 | if (is_slice(ptr_type_entry)) { |
| 20100 | 20310 | attrs_type = ptr_type_entry->data.structure.fields[slice_ptr_index].type_entry; |
| 20101 | size_enum_index = 2; | |
| 20311 | size_enum_index = BuiltinPtrSizeSlice; | |
| 20102 | 20312 | } else if (ptr_type_entry->id == ZigTypeIdPointer) { |
| 20103 | 20313 | attrs_type = ptr_type_entry; |
| 20104 | 20314 | size_enum_index = ptr_len_to_size_enum_index(ptr_type_entry->data.pointer.ptr_len); |
| ... | ... | @@ -20777,6 +20987,148 @@ static IrInstruction *ir_analyze_instruction_type_info(IrAnalyze *ira, |
| 20777 | 20987 | return result; |
| 20778 | 20988 | } |
| 20779 | 20989 | |
| 20990 | static ConstExprValue *get_const_field(IrAnalyze *ira, ConstExprValue *struct_value, const char *name, size_t field_index) | |
| 20991 | { | |
| 20992 | ensure_field_index(struct_value->type, name, field_index); | |
| 20993 | assert(struct_value->data.x_struct.fields[field_index].special == ConstValSpecialStatic); | |
| 20994 | return &struct_value->data.x_struct.fields[field_index]; | |
| 20995 | } | |
| 20996 | ||
| 20997 | static bool get_const_field_bool(IrAnalyze *ira, ConstExprValue *struct_value, const char *name, size_t field_index) | |
| 20998 | { | |
| 20999 | ConstExprValue *value = get_const_field(ira, struct_value, name, field_index); | |
| 21000 | assert(value->type == ira->codegen->builtin_types.entry_bool); | |
| 21001 | return value->data.x_bool; | |
| 21002 | } | |
| 21003 | ||
| 21004 | static BigInt *get_const_field_lit_int(IrAnalyze *ira, ConstExprValue *struct_value, const char *name, size_t field_index) | |
| 21005 | { | |
| 21006 | ConstExprValue *value = get_const_field(ira, struct_value, name, field_index); | |
| 21007 | assert(value->type == ira->codegen->builtin_types.entry_num_lit_int); | |
| 21008 | return &value->data.x_bigint; | |
| 21009 | } | |
| 21010 | ||
| 21011 | static ZigType *get_const_field_meta_type(IrAnalyze *ira, ConstExprValue *struct_value, const char *name, size_t field_index) | |
| 21012 | { | |
| 21013 | ConstExprValue *value = get_const_field(ira, struct_value, name, field_index); | |
| 21014 | assert(value->type == ira->codegen->builtin_types.entry_type); | |
| 21015 | return value->data.x_type; | |
| 21016 | } | |
| 21017 | ||
| 21018 | static ZigType *type_info_to_type(IrAnalyze *ira, IrInstruction *instruction, ZigTypeId tagTypeId, ConstExprValue *payload) { | |
| 21019 | switch (tagTypeId) { | |
| 21020 | case ZigTypeIdInvalid: | |
| 21021 | zig_unreachable(); | |
| 21022 | case ZigTypeIdMetaType: | |
| 21023 | return ira->codegen->builtin_types.entry_type; | |
| 21024 | case ZigTypeIdVoid: | |
| 21025 | return ira->codegen->builtin_types.entry_void; | |
| 21026 | case ZigTypeIdBool: | |
| 21027 | return ira->codegen->builtin_types.entry_bool; | |
| 21028 | case ZigTypeIdUnreachable: | |
| 21029 | return ira->codegen->builtin_types.entry_unreachable; | |
| 21030 | case ZigTypeIdInt: | |
| 21031 | assert(payload->special == ConstValSpecialStatic); | |
| 21032 | assert(payload->type == ir_type_info_get_type(ira, "Int", nullptr)); | |
| 21033 | return get_int_type(ira->codegen, | |
| 21034 | get_const_field_bool(ira, payload, "is_signed", 0), | |
| 21035 | bigint_as_u32(get_const_field_lit_int(ira, payload, "bits", 1))); | |
| 21036 | case ZigTypeIdFloat: | |
| 21037 | { | |
| 21038 | assert(payload->special == ConstValSpecialStatic); | |
| 21039 | assert(payload->type == ir_type_info_get_type(ira, "Float", nullptr)); | |
| 21040 | uint32_t bits = bigint_as_u32(get_const_field_lit_int(ira, payload, "bits", 0)); | |
| 21041 | switch (bits) { | |
| 21042 | case 16: return ira->codegen->builtin_types.entry_f16; | |
| 21043 | case 32: return ira->codegen->builtin_types.entry_f32; | |
| 21044 | case 64: return ira->codegen->builtin_types.entry_f64; | |
| 21045 | case 128: return ira->codegen->builtin_types.entry_f128; | |
| 21046 | } | |
| 21047 | ir_add_error(ira, instruction, | |
| 21048 | buf_sprintf("%d-bit float unsupported", bits)); | |
| 21049 | return nullptr; | |
| 21050 | } | |
| 21051 | case ZigTypeIdPointer: | |
| 21052 | { | |
| 21053 | ZigType *type_info_pointer_type = ir_type_info_get_type(ira, "Pointer", nullptr); | |
| 21054 | assert(payload->special == ConstValSpecialStatic); | |
| 21055 | assert(payload->type == type_info_pointer_type); | |
| 21056 | ConstExprValue *size_value = get_const_field(ira, payload, "size", 0); | |
| 21057 | assert(size_value->type == ir_type_info_get_type(ira, "Size", type_info_pointer_type)); | |
| 21058 | BuiltinPtrSize size_enum_index = (BuiltinPtrSize)bigint_as_u32(&size_value->data.x_enum_tag); | |
| 21059 | PtrLen ptr_len = size_enum_index_to_ptr_len(size_enum_index); | |
| 21060 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, | |
| 21061 | get_const_field_meta_type(ira, payload, "child", 4), | |
| 21062 | get_const_field_bool(ira, payload, "is_const", 1), | |
| 21063 | get_const_field_bool(ira, payload, "is_volatile", 2), | |
| 21064 | ptr_len, | |
| 21065 | bigint_as_u32(get_const_field_lit_int(ira, payload, "alignment", 3)), | |
| 21066 | 0, // bit_offset_in_host | |
| 21067 | 0, // host_int_bytes | |
| 21068 | get_const_field_bool(ira, payload, "is_allowzero", 5) | |
| 21069 | ); | |
| 21070 | if (size_enum_index != 2) | |
| 21071 | return ptr_type; | |
| 21072 | return get_slice_type(ira->codegen, ptr_type); | |
| 21073 | } | |
| 21074 | case ZigTypeIdArray: | |
| 21075 | assert(payload->special == ConstValSpecialStatic); | |
| 21076 | assert(payload->type == ir_type_info_get_type(ira, "Array", nullptr)); | |
| 21077 | return get_array_type(ira->codegen, | |
| 21078 | get_const_field_meta_type(ira, payload, "child", 1), | |
| 21079 | bigint_as_u64(get_const_field_lit_int(ira, payload, "len", 0)) | |
| 21080 | ); | |
| 21081 | case ZigTypeIdComptimeFloat: | |
| 21082 | return ira->codegen->builtin_types.entry_num_lit_float; | |
| 21083 | case ZigTypeIdComptimeInt: | |
| 21084 | return ira->codegen->builtin_types.entry_num_lit_int; | |
| 21085 | case ZigTypeIdUndefined: | |
| 21086 | return ira->codegen->builtin_types.entry_undef; | |
| 21087 | case ZigTypeIdNull: | |
| 21088 | return ira->codegen->builtin_types.entry_null; | |
| 21089 | case ZigTypeIdOptional: | |
| 21090 | case ZigTypeIdErrorUnion: | |
| 21091 | case ZigTypeIdErrorSet: | |
| 21092 | case ZigTypeIdEnum: | |
| 21093 | case ZigTypeIdOpaque: | |
| 21094 | case ZigTypeIdFnFrame: | |
| 21095 | case ZigTypeIdAnyFrame: | |
| 21096 | case ZigTypeIdVector: | |
| 21097 | case ZigTypeIdEnumLiteral: | |
| 21098 | ir_add_error(ira, instruction, buf_sprintf( | |
| 21099 | "TODO implement @Type for 'TypeInfo.%s': see https://github.com/ziglang/zig/issues/2907", type_id_name(tagTypeId))); | |
| 21100 | return nullptr; | |
| 21101 | case ZigTypeIdUnion: | |
| 21102 | case ZigTypeIdFn: | |
| 21103 | case ZigTypeIdBoundFn: | |
| 21104 | case ZigTypeIdArgTuple: | |
| 21105 | case ZigTypeIdStruct: | |
| 21106 | ir_add_error(ira, instruction, buf_sprintf( | |
| 21107 | "@Type not availble for 'TypeInfo.%s'", type_id_name(tagTypeId))); | |
| 21108 | return nullptr; | |
| 21109 | } | |
| 21110 | zig_unreachable(); | |
| 21111 | } | |
| 21112 | ||
| 21113 | static IrInstruction *ir_analyze_instruction_type(IrAnalyze *ira, IrInstructionType *instruction) { | |
| 21114 | IrInstruction *type_info_ir = instruction->type_info->child; | |
| 21115 | if (type_is_invalid(type_info_ir->value.type)) | |
| 21116 | return ira->codegen->invalid_instruction; | |
| 21117 | ||
| 21118 | IrInstruction *casted_ir = ir_implicit_cast(ira, type_info_ir, ir_type_info_get_type(ira, nullptr, nullptr)); | |
| 21119 | if (type_is_invalid(casted_ir->value.type)) | |
| 21120 | return ira->codegen->invalid_instruction; | |
| 21121 | ||
| 21122 | ConstExprValue *type_info_value = ir_resolve_const(ira, casted_ir, UndefBad); | |
| 21123 | if (!type_info_value) | |
| 21124 | return ira->codegen->invalid_instruction; | |
| 21125 | ZigTypeId typeId = type_id_at_index(bigint_as_usize(&type_info_value->data.x_union.tag)); | |
| 21126 | ZigType *type = type_info_to_type(ira, type_info_ir, typeId, type_info_value->data.x_union.payload); | |
| 21127 | if (!type) | |
| 21128 | return ira->codegen->invalid_instruction; | |
| 21129 | return ir_const_type(ira, &instruction->base, type); | |
| 21130 | } | |
| 21131 | ||
| 20780 | 21132 | static IrInstruction *ir_analyze_instruction_type_id(IrAnalyze *ira, |
| 20781 | 21133 | IrInstructionTypeId *instruction) |
| 20782 | 21134 | { |
| ... | ... | @@ -21036,15 +21388,20 @@ static IrInstruction *ir_analyze_instruction_c_define(IrAnalyze *ira, IrInstruct |
| 21036 | 21388 | if (type_is_invalid(value->value.type)) |
| 21037 | 21389 | return ira->codegen->invalid_instruction; |
| 21038 | 21390 | |
| 21039 | Buf *define_value = ir_resolve_str(ira, value); | |
| 21040 | if (!define_value) | |
| 21041 | return ira->codegen->invalid_instruction; | |
| 21391 | Buf *define_value = nullptr; | |
| 21392 | // The second parameter is either a string or void (equivalent to "") | |
| 21393 | if (value->value.type->id != ZigTypeIdVoid) { | |
| 21394 | define_value = ir_resolve_str(ira, value); | |
| 21395 | if (!define_value) | |
| 21396 | return ira->codegen->invalid_instruction; | |
| 21397 | } | |
| 21042 | 21398 | |
| 21043 | 21399 | Buf *c_import_buf = exec_c_import_buf(ira->new_irb.exec); |
| 21044 | 21400 | // We check for this error in pass1 |
| 21045 | 21401 | assert(c_import_buf); |
| 21046 | 21402 | |
| 21047 | buf_appendf(c_import_buf, "#define %s %s\n", buf_ptr(define_name), buf_ptr(define_value)); | |
| 21403 | buf_appendf(c_import_buf, "#define %s %s\n", buf_ptr(define_name), | |
| 21404 | define_value ? buf_ptr(define_value) : ""); | |
| 21048 | 21405 | |
| 21049 | 21406 | return ir_const_void(ira, &instruction->base); |
| 21050 | 21407 | } |
| ... | ... | @@ -22533,6 +22890,8 @@ static IrInstruction *ir_analyze_instruction_frame_size(IrAnalyze *ira, IrInstru |
| 22533 | 22890 | return ira->codegen->invalid_instruction; |
| 22534 | 22891 | } |
| 22535 | 22892 | |
| 22893 | ira->codegen->need_frame_size_prefix_data = true; | |
| 22894 | ||
| 22536 | 22895 | IrInstruction *result = ir_build_frame_size_gen(&ira->new_irb, instruction->base.scope, |
| 22537 | 22896 | instruction->base.source_node, fn); |
| 22538 | 22897 | result->value.type = ira->codegen->builtin_types.entry_usize; |
| ... | ... | @@ -24823,7 +25182,7 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct |
| 24823 | 25182 | if (result_loc->value.type->id == ZigTypeIdUnreachable) |
| 24824 | 25183 | return result_loc; |
| 24825 | 25184 | |
| 24826 | if (!was_written) { | |
| 25185 | if (!was_written || instruction->result_loc->id == ResultLocIdPeer) { | |
| 24827 | 25186 | IrInstruction *store_ptr = ir_analyze_store_ptr(ira, &instruction->base, result_loc, value, |
| 24828 | 25187 | instruction->result_loc->allow_write_through_const); |
| 24829 | 25188 | if (type_is_invalid(store_ptr->value.type)) { |
| ... | ... | @@ -24831,7 +25190,9 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct |
| 24831 | 25190 | } |
| 24832 | 25191 | } |
| 24833 | 25192 | |
| 24834 | if (result_loc->value.data.x_ptr.mut == ConstPtrMutInfer) { | |
| 25193 | if (result_loc->value.data.x_ptr.mut == ConstPtrMutInfer && | |
| 25194 | instruction->result_loc->id != ResultLocIdPeer) | |
| 25195 | { | |
| 24835 | 25196 | if (instr_is_comptime(value)) { |
| 24836 | 25197 | result_loc->value.data.x_ptr.mut = ConstPtrMutComptimeConst; |
| 24837 | 25198 | } else { |
| ... | ... | @@ -25281,6 +25642,8 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction |
| 25281 | 25642 | return ir_analyze_instruction_bit_offset_of(ira, (IrInstructionBitOffsetOf *)instruction); |
| 25282 | 25643 | case IrInstructionIdTypeInfo: |
| 25283 | 25644 | return ir_analyze_instruction_type_info(ira, (IrInstructionTypeInfo *) instruction); |
| 25645 | case IrInstructionIdType: | |
| 25646 | return ir_analyze_instruction_type(ira, (IrInstructionType *)instruction); | |
| 25284 | 25647 | case IrInstructionIdHasField: |
| 25285 | 25648 | return ir_analyze_instruction_has_field(ira, (IrInstructionHasField *) instruction); |
| 25286 | 25649 | case IrInstructionIdTypeId: |
| ... | ... | @@ -25584,6 +25947,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 25584 | 25947 | case IrInstructionIdByteOffsetOf: |
| 25585 | 25948 | case IrInstructionIdBitOffsetOf: |
| 25586 | 25949 | case IrInstructionIdTypeInfo: |
| 25950 | case IrInstructionIdType: | |
| 25587 | 25951 | case IrInstructionIdHasField: |
| 25588 | 25952 | case IrInstructionIdTypeId: |
| 25589 | 25953 | case IrInstructionIdAlignCast: |
src/ir.hpp+5| ... | ... | @@ -10,6 +10,11 @@ |
| 10 | 10 | |
| 11 | 11 | #include "all_types.hpp" |
| 12 | 12 | |
| 13 | enum IrPass { | |
| 14 | IrPassSrc, | |
| 15 | IrPassGen, | |
| 16 | }; | |
| 17 | ||
| 13 | 18 | bool ir_gen(CodeGen *g, AstNode *node, Scope *scope, IrExecutable *ir_executable); |
| 14 | 19 | bool ir_gen_fn(CodeGen *g, ZigFn *fn_entry); |
| 15 | 20 |
src/ir_print.cpp+43-14| ... | ... | @@ -22,7 +22,7 @@ using InstructionSet = HashMap<IrInstruction*, uint8_t, hash_instruction_ptr, in |
| 22 | 22 | using InstructionList = ZigList<IrInstruction*>; |
| 23 | 23 | |
| 24 | 24 | struct IrPrint { |
| 25 | size_t pass_num; | |
| 25 | IrPass pass; | |
| 26 | 26 | CodeGen *codegen; |
| 27 | 27 | FILE *f; |
| 28 | 28 | int indent; |
| ... | ... | @@ -280,6 +280,8 @@ static const char* ir_instruction_type_str(IrInstruction* instruction) { |
| 280 | 280 | return "BitOffsetOf"; |
| 281 | 281 | case IrInstructionIdTypeInfo: |
| 282 | 282 | return "TypeInfo"; |
| 283 | case IrInstructionIdType: | |
| 284 | return "Type"; | |
| 283 | 285 | case IrInstructionIdHasField: |
| 284 | 286 | return "HasField"; |
| 285 | 287 | case IrInstructionIdTypeId: |
| ... | ... | @@ -389,7 +391,7 @@ static void ir_print_const_value(IrPrint *irp, ConstExprValue *const_val) { |
| 389 | 391 | |
| 390 | 392 | static void ir_print_var_instruction(IrPrint *irp, IrInstruction *instruction) { |
| 391 | 393 | fprintf(irp->f, "#%" ZIG_PRI_usize "", instruction->debug_id); |
| 392 | if (irp->pass_num == 2 && irp->printed.maybe_get(instruction) == nullptr) { | |
| 394 | if (irp->pass != IrPassSrc && irp->printed.maybe_get(instruction) == nullptr) { | |
| 393 | 395 | irp->printed.put(instruction, 0); |
| 394 | 396 | irp->pending.append(instruction); |
| 395 | 397 | } |
| ... | ... | @@ -529,7 +531,7 @@ static void ir_print_bin_op(IrPrint *irp, IrInstructionBinOp *bin_op_instruction |
| 529 | 531 | |
| 530 | 532 | static void ir_print_decl_var_src(IrPrint *irp, IrInstructionDeclVarSrc *decl_var_instruction) { |
| 531 | 533 | const char *var_or_const = decl_var_instruction->var->gen_is_const ? "const" : "var"; |
| 532 | const char *name = buf_ptr(&decl_var_instruction->var->name); | |
| 534 | const char *name = decl_var_instruction->var->name; | |
| 533 | 535 | if (decl_var_instruction->var_type) { |
| 534 | 536 | fprintf(irp->f, "%s %s: ", var_or_const, name); |
| 535 | 537 | ir_print_other_instruction(irp, decl_var_instruction->var_type); |
| ... | ... | @@ -606,8 +608,17 @@ static void ir_print_result_loc(IrPrint *irp, ResultLoc *result_loc) { |
| 606 | 608 | } |
| 607 | 609 | |
| 608 | 610 | static void ir_print_call_src(IrPrint *irp, IrInstructionCallSrc *call_instruction) { |
| 609 | if (call_instruction->is_async) { | |
| 610 | fprintf(irp->f, "async "); | |
| 611 | switch (call_instruction->modifier) { | |
| 612 | case CallModifierNone: | |
| 613 | break; | |
| 614 | case CallModifierAsync: | |
| 615 | fprintf(irp->f, "async "); | |
| 616 | break; | |
| 617 | case CallModifierNoAsync: | |
| 618 | fprintf(irp->f, "noasync "); | |
| 619 | break; | |
| 620 | case CallModifierBuiltin: | |
| 621 | zig_unreachable(); | |
| 611 | 622 | } |
| 612 | 623 | if (call_instruction->fn_entry) { |
| 613 | 624 | fprintf(irp->f, "%s", buf_ptr(&call_instruction->fn_entry->symbol_name)); |
| ... | ... | @@ -627,8 +638,17 @@ static void ir_print_call_src(IrPrint *irp, IrInstructionCallSrc *call_instructi |
| 627 | 638 | } |
| 628 | 639 | |
| 629 | 640 | static void ir_print_call_gen(IrPrint *irp, IrInstructionCallGen *call_instruction) { |
| 630 | if (call_instruction->is_async) { | |
| 631 | fprintf(irp->f, "async "); | |
| 641 | switch (call_instruction->modifier) { | |
| 642 | case CallModifierNone: | |
| 643 | break; | |
| 644 | case CallModifierAsync: | |
| 645 | fprintf(irp->f, "async "); | |
| 646 | break; | |
| 647 | case CallModifierNoAsync: | |
| 648 | fprintf(irp->f, "noasync "); | |
| 649 | break; | |
| 650 | case CallModifierBuiltin: | |
| 651 | zig_unreachable(); | |
| 632 | 652 | } |
| 633 | 653 | if (call_instruction->fn_entry) { |
| 634 | 654 | fprintf(irp->f, "%s", buf_ptr(&call_instruction->fn_entry->symbol_name)); |
| ... | ... | @@ -727,7 +747,7 @@ static void ir_print_elem_ptr(IrPrint *irp, IrInstructionElemPtr *instruction) { |
| 727 | 747 | } |
| 728 | 748 | |
| 729 | 749 | static void ir_print_var_ptr(IrPrint *irp, IrInstructionVarPtr *instruction) { |
| 730 | fprintf(irp->f, "&%s", buf_ptr(&instruction->var->name)); | |
| 750 | fprintf(irp->f, "&%s", instruction->var->name); | |
| 731 | 751 | } |
| 732 | 752 | |
| 733 | 753 | static void ir_print_return_ptr(IrPrint *irp, IrInstructionReturnPtr *instruction) { |
| ... | ... | @@ -1627,6 +1647,12 @@ static void ir_print_type_info(IrPrint *irp, IrInstructionTypeInfo *instruction) |
| 1627 | 1647 | fprintf(irp->f, ")"); |
| 1628 | 1648 | } |
| 1629 | 1649 | |
| 1650 | static void ir_print_type(IrPrint *irp, IrInstructionType *instruction) { | |
| 1651 | fprintf(irp->f, "@Type("); | |
| 1652 | ir_print_other_instruction(irp, instruction->type_info); | |
| 1653 | fprintf(irp->f, ")"); | |
| 1654 | } | |
| 1655 | ||
| 1630 | 1656 | static void ir_print_has_field(IrPrint *irp, IrInstructionHasField *instruction) { |
| 1631 | 1657 | fprintf(irp->f, "@hasField("); |
| 1632 | 1658 | ir_print_other_instruction(irp, instruction->container_type); |
| ... | ... | @@ -1826,7 +1852,7 @@ static void ir_print_mul_add(IrPrint *irp, IrInstructionMulAdd *instruction) { |
| 1826 | 1852 | static void ir_print_decl_var_gen(IrPrint *irp, IrInstructionDeclVarGen *decl_var_instruction) { |
| 1827 | 1853 | ZigVar *var = decl_var_instruction->var; |
| 1828 | 1854 | const char *var_or_const = decl_var_instruction->var->gen_is_const ? "const" : "var"; |
| 1829 | const char *name = buf_ptr(&decl_var_instruction->var->name); | |
| 1855 | const char *name = decl_var_instruction->var->name; | |
| 1830 | 1856 | fprintf(irp->f, "%s %s: %s align(%u) = ", var_or_const, name, buf_ptr(&var->var_type->name), |
| 1831 | 1857 | var->align_bytes); |
| 1832 | 1858 | |
| ... | ... | @@ -2258,6 +2284,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction, bool |
| 2258 | 2284 | case IrInstructionIdTypeInfo: |
| 2259 | 2285 | ir_print_type_info(irp, (IrInstructionTypeInfo *)instruction); |
| 2260 | 2286 | break; |
| 2287 | case IrInstructionIdType: | |
| 2288 | ir_print_type(irp, (IrInstructionType *)instruction); | |
| 2289 | break; | |
| 2261 | 2290 | case IrInstructionIdHasField: |
| 2262 | 2291 | ir_print_has_field(irp, (IrInstructionHasField *)instruction); |
| 2263 | 2292 | break; |
| ... | ... | @@ -2388,10 +2417,10 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction, bool |
| 2388 | 2417 | fprintf(irp->f, "\n"); |
| 2389 | 2418 | } |
| 2390 | 2419 | |
| 2391 | void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_size, size_t pass_num) { | |
| 2420 | void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_size, IrPass pass) { | |
| 2392 | 2421 | IrPrint ir_print = {}; |
| 2393 | 2422 | IrPrint *irp = &ir_print; |
| 2394 | irp->pass_num = pass_num; | |
| 2423 | irp->pass = pass; | |
| 2395 | 2424 | irp->codegen = codegen; |
| 2396 | 2425 | irp->f = f; |
| 2397 | 2426 | irp->indent = indent_size; |
| ... | ... | @@ -2405,7 +2434,7 @@ void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_si |
| 2405 | 2434 | fprintf(irp->f, "%s_%" ZIG_PRI_usize ":\n", current_block->name_hint, current_block->debug_id); |
| 2406 | 2435 | for (size_t instr_i = 0; instr_i < current_block->instruction_list.length; instr_i += 1) { |
| 2407 | 2436 | IrInstruction *instruction = current_block->instruction_list.at(instr_i); |
| 2408 | if (irp->pass_num == 2) { | |
| 2437 | if (irp->pass != IrPassSrc) { | |
| 2409 | 2438 | irp->printed.put(instruction, 0); |
| 2410 | 2439 | irp->pending.clear(); |
| 2411 | 2440 | } |
| ... | ... | @@ -2419,10 +2448,10 @@ void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_si |
| 2419 | 2448 | irp->printed.deinit(); |
| 2420 | 2449 | } |
| 2421 | 2450 | |
| 2422 | void ir_print_instruction(CodeGen *codegen, FILE *f, IrInstruction *instruction, int indent_size, size_t pass_num) { | |
| 2451 | void ir_print_instruction(CodeGen *codegen, FILE *f, IrInstruction *instruction, int indent_size, IrPass pass) { | |
| 2423 | 2452 | IrPrint ir_print = {}; |
| 2424 | 2453 | IrPrint *irp = &ir_print; |
| 2425 | irp->pass_num = pass_num; | |
| 2454 | irp->pass = pass; | |
| 2426 | 2455 | irp->codegen = codegen; |
| 2427 | 2456 | irp->f = f; |
| 2428 | 2457 | irp->indent = indent_size; |
src/ir_print.hpp+2-2| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | |
| 13 | 13 | #include <stdio.h> |
| 14 | 14 | |
| 15 | void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_size, size_t pass_num); | |
| 16 | void ir_print_instruction(CodeGen *codegen, FILE *f, IrInstruction *instruction, int indent_size, size_t pass_num); | |
| 15 | void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_size, IrPass pass); | |
| 16 | void ir_print_instruction(CodeGen *codegen, FILE *f, IrInstruction *instruction, int indent_size, IrPass pass); | |
| 17 | 17 | |
| 18 | 18 | #endif |
src/main.cpp+20-1| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #include "libc_installation.hpp" |
| 17 | 17 | #include "userland.h" |
| 18 | 18 | #include "glibc.hpp" |
| 19 | #include "stack_report.hpp" | |
| 19 | 20 | |
| 20 | 21 | #include <stdio.h> |
| 21 | 22 | |
| ... | ... | @@ -62,6 +63,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 62 | 63 | " -fPIC enable Position Independent Code\n" |
| 63 | 64 | " -fno-PIC disable Position Independent Code\n" |
| 64 | 65 | " -ftime-report print timing diagnostics\n" |
| 66 | " -fstack-report print stack size diagnostics\n" | |
| 65 | 67 | " --libc [file] Provide a file which specifies libc paths\n" |
| 66 | 68 | " --name [name] override output name\n" |
| 67 | 69 | " --output-dir [dir] override output directory (defaults to cwd)\n" |
| ... | ... | @@ -101,6 +103,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 101 | 103 | " --version-script [path] provide a version .map file\n" |
| 102 | 104 | " --object [obj] add object file to build\n" |
| 103 | 105 | " -L[dir] alias for --library-path\n" |
| 106 | " -l[lib] alias for --library\n" | |
| 104 | 107 | " -rdynamic add all symbols to the dynamic symbol table\n" |
| 105 | 108 | " -rpath [path] add directory to the runtime library search path\n" |
| 106 | 109 | " --subsystem [subsystem] (windows) /SUBSYSTEM:<subsystem> to the linker\n" |
| ... | ... | @@ -475,6 +478,7 @@ int main(int argc, char **argv) { |
| 475 | 478 | size_t ver_minor = 0; |
| 476 | 479 | size_t ver_patch = 0; |
| 477 | 480 | bool timing_info = false; |
| 481 | bool stack_report = false; | |
| 478 | 482 | const char *cache_dir = nullptr; |
| 479 | 483 | CliPkg *cur_pkg = allocate<CliPkg>(1); |
| 480 | 484 | BuildMode build_mode = BuildModeDebug; |
| ... | ... | @@ -663,6 +667,8 @@ int main(int argc, char **argv) { |
| 663 | 667 | each_lib_rpath = true; |
| 664 | 668 | } else if (strcmp(arg, "-ftime-report") == 0) { |
| 665 | 669 | timing_info = true; |
| 670 | } else if (strcmp(arg, "-fstack-report") == 0) { | |
| 671 | stack_report = true; | |
| 666 | 672 | } else if (strcmp(arg, "--enable-valgrind") == 0) { |
| 667 | 673 | valgrind_support = ValgrindSupportEnabled; |
| 668 | 674 | } else if (strcmp(arg, "--disable-valgrind") == 0) { |
| ... | ... | @@ -688,6 +694,12 @@ int main(int argc, char **argv) { |
| 688 | 694 | } else if (arg[1] == 'L' && arg[2] != 0) { |
| 689 | 695 | // alias for --library-path |
| 690 | 696 | lib_dirs.append(&arg[2]); |
| 697 | } else if (arg[1] == 'l' && arg[2] != 0) { | |
| 698 | // alias for --library | |
| 699 | const char *l = &arg[2]; | |
| 700 | if (strcmp(l, "c") == 0) | |
| 701 | have_libc = true; | |
| 702 | link_libs.append(l); | |
| 691 | 703 | } else if (arg[1] == 'F' && arg[2] != 0) { |
| 692 | 704 | framework_dirs.append(&arg[2]); |
| 693 | 705 | } else if (strcmp(arg, "--pkg-begin") == 0) { |
| ... | ... | @@ -778,7 +790,7 @@ int main(int argc, char **argv) { |
| 778 | 790 | lib_dirs.append(argv[i]); |
| 779 | 791 | } else if (strcmp(arg, "-F") == 0) { |
| 780 | 792 | framework_dirs.append(argv[i]); |
| 781 | } else if (strcmp(arg, "--library") == 0) { | |
| 793 | } else if (strcmp(arg, "--library") == 0 || strcmp(arg, "-l") == 0) { | |
| 782 | 794 | if (strcmp(argv[i], "c") == 0) |
| 783 | 795 | have_libc = true; |
| 784 | 796 | link_libs.append(argv[i]); |
| ... | ... | @@ -1129,6 +1141,7 @@ int main(int argc, char **argv) { |
| 1129 | 1141 | g->subsystem = subsystem; |
| 1130 | 1142 | |
| 1131 | 1143 | g->enable_time_report = timing_info; |
| 1144 | g->enable_stack_report = stack_report; | |
| 1132 | 1145 | codegen_set_out_name(g, buf_out_name); |
| 1133 | 1146 | codegen_set_lib_version(g, ver_major, ver_minor, ver_patch); |
| 1134 | 1147 | g->want_single_threaded = want_single_threaded; |
| ... | ... | @@ -1216,6 +1229,8 @@ int main(int argc, char **argv) { |
| 1216 | 1229 | codegen_build_and_link(g); |
| 1217 | 1230 | if (timing_info) |
| 1218 | 1231 | codegen_print_timing_report(g, stdout); |
| 1232 | if (stack_report) | |
| 1233 | zig_print_stack_report(g, stdout); | |
| 1219 | 1234 | |
| 1220 | 1235 | if (cmd == CmdRun) { |
| 1221 | 1236 | const char *exec_path = buf_ptr(&g->output_file_path); |
| ... | ... | @@ -1265,6 +1280,10 @@ int main(int argc, char **argv) { |
| 1265 | 1280 | codegen_print_timing_report(g, stdout); |
| 1266 | 1281 | } |
| 1267 | 1282 | |
| 1283 | if (stack_report) { | |
| 1284 | zig_print_stack_report(g, stdout); | |
| 1285 | } | |
| 1286 | ||
| 1268 | 1287 | Buf *test_exe_path_unresolved = &g->output_file_path; |
| 1269 | 1288 | Buf *test_exe_path = buf_alloc(); |
| 1270 | 1289 | *test_exe_path = os_path_resolve(&test_exe_path_unresolved, 1); |
src/os.cpp+24| ... | ... | @@ -45,6 +45,7 @@ typedef SSIZE_T ssize_t; |
| 45 | 45 | #include <sys/types.h> |
| 46 | 46 | #include <sys/stat.h> |
| 47 | 47 | #include <sys/wait.h> |
| 48 | #include <sys/resource.h> | |
| 48 | 49 | #include <fcntl.h> |
| 49 | 50 | #include <limits.h> |
| 50 | 51 | #include <spawn.h> |
| ... | ... | @@ -1374,6 +1375,29 @@ int os_init(void) { |
| 1374 | 1375 | #elif defined(__MACH__) |
| 1375 | 1376 | host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &macos_monotonic_clock); |
| 1376 | 1377 | host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &macos_calendar_clock); |
| 1378 | #endif | |
| 1379 | #if defined(ZIG_OS_POSIX) | |
| 1380 | // Raise the open file descriptor limit. | |
| 1381 | // Code lifted from node.js | |
| 1382 | struct rlimit lim; | |
| 1383 | if (getrlimit(RLIMIT_NOFILE, &lim) == 0 && lim.rlim_cur != lim.rlim_max) { | |
| 1384 | // Do a binary search for the limit. | |
| 1385 | rlim_t min = lim.rlim_cur; | |
| 1386 | rlim_t max = 1 << 20; | |
| 1387 | // But if there's a defined upper bound, don't search, just set it. | |
| 1388 | if (lim.rlim_max != RLIM_INFINITY) { | |
| 1389 | min = lim.rlim_max; | |
| 1390 | max = lim.rlim_max; | |
| 1391 | } | |
| 1392 | do { | |
| 1393 | lim.rlim_cur = min + (max - min) / 2; | |
| 1394 | if (setrlimit(RLIMIT_NOFILE, &lim)) { | |
| 1395 | max = lim.rlim_cur; | |
| 1396 | } else { | |
| 1397 | min = lim.rlim_cur; | |
| 1398 | } | |
| 1399 | } while (min + 1 < max); | |
| 1400 | } | |
| 1377 | 1401 | #endif |
| 1378 | 1402 | return 0; |
| 1379 | 1403 | } |
src/parser.cpp+31-16| ... | ... | @@ -113,7 +113,7 @@ static AstNode *ast_parse_multiply_op(ParseContext *pc); |
| 113 | 113 | static AstNode *ast_parse_prefix_op(ParseContext *pc); |
| 114 | 114 | static AstNode *ast_parse_prefix_type_op(ParseContext *pc); |
| 115 | 115 | static AstNode *ast_parse_suffix_op(ParseContext *pc); |
| 116 | static AstNode *ast_parse_fn_call_argumnets(ParseContext *pc); | |
| 116 | static AstNode *ast_parse_fn_call_arguments(ParseContext *pc); | |
| 117 | 117 | static AstNode *ast_parse_array_type_start(ParseContext *pc); |
| 118 | 118 | static AstNode *ast_parse_ptr_type_start(ParseContext *pc); |
| 119 | 119 | static AstNode *ast_parse_container_decl_auto(ParseContext *pc); |
| ... | ... | @@ -578,7 +578,7 @@ static AstNode *ast_parse_top_level_comptime(ParseContext *pc) { |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | // TopLevelDecl |
| 581 | // <- (KEYWORD_export / KEYWORD_extern STRINGLITERAL? / KEYWORD_inline)? FnProto (SEMICOLON / Block) | |
| 581 | // <- (KEYWORD_export / KEYWORD_extern STRINGLITERAL? / (KEYWORD_inline / KEYWORD_noinline))? FnProto (SEMICOLON / Block) | |
| 582 | 582 | // / (KEYWORD_export / KEYWORD_extern STRINGLITERAL?)? KEYWORD_threadlocal? VarDecl |
| 583 | 583 | // / KEYWORD_use Expr SEMICOLON |
| 584 | 584 | static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod) { |
| ... | ... | @@ -587,12 +587,14 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod) { |
| 587 | 587 | first = eat_token_if(pc, TokenIdKeywordExtern); |
| 588 | 588 | if (first == nullptr) |
| 589 | 589 | first = eat_token_if(pc, TokenIdKeywordInline); |
| 590 | if (first == nullptr) | |
| 591 | first = eat_token_if(pc, TokenIdKeywordNoInline); | |
| 590 | 592 | if (first != nullptr) { |
| 591 | 593 | Token *lib_name = nullptr; |
| 592 | 594 | if (first->id == TokenIdKeywordExtern) |
| 593 | 595 | lib_name = eat_token_if(pc, TokenIdStringLiteral); |
| 594 | 596 | |
| 595 | if (first->id != TokenIdKeywordInline) { | |
| 597 | if (first->id != TokenIdKeywordInline && first->id != TokenIdKeywordNoInline) { | |
| 596 | 598 | Token *thread_local_kw = eat_token_if(pc, TokenIdKeywordThreadLocal); |
| 597 | 599 | AstNode *var_decl = ast_parse_var_decl(pc); |
| 598 | 600 | if (var_decl != nullptr) { |
| ... | ... | @@ -623,8 +625,19 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod) { |
| 623 | 625 | fn_proto->data.fn_proto.visib_mod = visib_mod; |
| 624 | 626 | fn_proto->data.fn_proto.is_extern = first->id == TokenIdKeywordExtern; |
| 625 | 627 | fn_proto->data.fn_proto.is_export = first->id == TokenIdKeywordExport; |
| 626 | fn_proto->data.fn_proto.is_inline = first->id == TokenIdKeywordInline; | |
| 628 | switch (first->id) { | |
| 629 | case TokenIdKeywordInline: | |
| 630 | fn_proto->data.fn_proto.fn_inline = FnInlineAlways; | |
| 631 | break; | |
| 632 | case TokenIdKeywordNoInline: | |
| 633 | fn_proto->data.fn_proto.fn_inline = FnInlineNever; | |
| 634 | break; | |
| 635 | default: | |
| 636 | fn_proto->data.fn_proto.fn_inline = FnInlineAuto; | |
| 637 | break; | |
| 638 | } | |
| 627 | 639 | fn_proto->data.fn_proto.lib_name = token_buf(lib_name); |
| 640 | ||
| 628 | 641 | AstNode *res = fn_proto; |
| 629 | 642 | if (body != nullptr) { |
| 630 | 643 | res = ast_create_node_copy_line_info(pc, NodeTypeFnDef, fn_proto); |
| ... | ... | @@ -1390,12 +1403,14 @@ static AstNode *ast_parse_error_union_expr(ParseContext *pc) { |
| 1390 | 1403 | } |
| 1391 | 1404 | |
| 1392 | 1405 | // SuffixExpr |
| 1393 | // <- KEYWORD_async PrimaryTypeExpr SuffixOp* FnCallArguments | |
| 1406 | // <- KEYWORD_async PrimaryTypeExpr SuffixOp* FnCallArguments | |
| 1407 | // / KEYWORD_noasync PrimaryTypeExpr SuffixOp* FnCallArguments | |
| 1394 | 1408 | // / PrimaryTypeExpr (SuffixOp / FnCallArguments)* |
| 1395 | 1409 | static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1396 | Token *async_token = eat_token_if(pc, TokenIdKeywordAsync); | |
| 1397 | if (async_token != nullptr) { | |
| 1398 | if (eat_token_if(pc, TokenIdKeywordFn) != nullptr) { | |
| 1410 | Token *async_token = eat_token(pc); | |
| 1411 | bool is_async = async_token->id == TokenIdKeywordAsync; | |
| 1412 | if (is_async || async_token->id == TokenIdKeywordNoAsync) { | |
| 1413 | if (is_async && eat_token_if(pc, TokenIdKeywordFn) != nullptr) { | |
| 1399 | 1414 | // HACK: If we see the keyword `fn`, then we assume that |
| 1400 | 1415 | // we are parsing an async fn proto, and not a call. |
| 1401 | 1416 | // We therefore put back all tokens consumed by the async |
| ... | ... | @@ -1434,24 +1449,24 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1434 | 1449 | child = suffix; |
| 1435 | 1450 | } |
| 1436 | 1451 | |
| 1437 | // TODO: Both *_async_prefix and *_fn_call_argumnets returns an | |
| 1452 | // TODO: Both *_async_prefix and *_fn_call_arguments returns an | |
| 1438 | 1453 | // AstNode *. All we really want here is the arguments of |
| 1439 | 1454 | // the call we parse. We therefor "leak" the node for now. |
| 1440 | 1455 | // Wait till we get async rework to fix this. |
| 1441 | AstNode *args = ast_parse_fn_call_argumnets(pc); | |
| 1456 | AstNode *args = ast_parse_fn_call_arguments(pc); | |
| 1442 | 1457 | if (args == nullptr) |
| 1443 | 1458 | ast_invalid_token_error(pc, peek_token(pc)); |
| 1444 | 1459 | |
| 1445 | 1460 | assert(args->type == NodeTypeFnCallExpr); |
| 1446 | 1461 | |
| 1447 | 1462 | AstNode *res = ast_create_node(pc, NodeTypeFnCallExpr, async_token); |
| 1448 | res->data.fn_call_expr.is_async = true; | |
| 1463 | res->data.fn_call_expr.modifier = is_async ? CallModifierAsync : CallModifierNoAsync; | |
| 1449 | 1464 | res->data.fn_call_expr.seen = false; |
| 1450 | 1465 | res->data.fn_call_expr.fn_ref_expr = child; |
| 1451 | 1466 | res->data.fn_call_expr.params = args->data.fn_call_expr.params; |
| 1452 | res->data.fn_call_expr.is_builtin = false; | |
| 1453 | 1467 | return res; |
| 1454 | 1468 | } |
| 1469 | put_back_token(pc); | |
| 1455 | 1470 | |
| 1456 | 1471 | AstNode *res = ast_parse_primary_type_expr(pc); |
| 1457 | 1472 | if (res == nullptr) |
| ... | ... | @@ -1483,7 +1498,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1483 | 1498 | continue; |
| 1484 | 1499 | } |
| 1485 | 1500 | |
| 1486 | AstNode * call = ast_parse_fn_call_argumnets(pc); | |
| 1501 | AstNode * call = ast_parse_fn_call_arguments(pc); | |
| 1487 | 1502 | if (call != nullptr) { |
| 1488 | 1503 | assert(call->type == NodeTypeFnCallExpr); |
| 1489 | 1504 | call->data.fn_call_expr.fn_ref_expr = res; |
| ... | ... | @@ -1539,7 +1554,7 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1539 | 1554 | name = buf_create_from_str("export"); |
| 1540 | 1555 | } |
| 1541 | 1556 | |
| 1542 | AstNode *res = ast_expect(pc, ast_parse_fn_call_argumnets); | |
| 1557 | AstNode *res = ast_expect(pc, ast_parse_fn_call_arguments); | |
| 1543 | 1558 | AstNode *name_sym = ast_create_node(pc, NodeTypeSymbol, token); |
| 1544 | 1559 | name_sym->data.symbol_expr.symbol = name; |
| 1545 | 1560 | |
| ... | ... | @@ -1547,7 +1562,7 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1547 | 1562 | res->line = at_sign->start_line; |
| 1548 | 1563 | res->column = at_sign->start_column; |
| 1549 | 1564 | res->data.fn_call_expr.fn_ref_expr = name_sym; |
| 1550 | res->data.fn_call_expr.is_builtin = true; | |
| 1565 | res->data.fn_call_expr.modifier = CallModifierBuiltin; | |
| 1551 | 1566 | return res; |
| 1552 | 1567 | } |
| 1553 | 1568 | |
| ... | ... | @@ -2659,7 +2674,7 @@ static AstNode *ast_parse_suffix_op(ParseContext *pc) { |
| 2659 | 2674 | } |
| 2660 | 2675 | |
| 2661 | 2676 | // FnCallArguments <- LPAREN ExprList RPAREN |
| 2662 | static AstNode *ast_parse_fn_call_argumnets(ParseContext *pc) { | |
| 2677 | static AstNode *ast_parse_fn_call_arguments(ParseContext *pc) { | |
| 2663 | 2678 | Token *paren = eat_token_if(pc, TokenIdLParen); |
| 2664 | 2679 | if (paren == nullptr) |
| 2665 | 2680 | return nullptr; |
src/stack_report.cpp created+121| ... | ... | @@ -0,0 +1,121 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2019 Andrew Kelley | |
| 3 | * | |
| 4 | * This file is part of zig, which is MIT licensed. | |
| 5 | * See http://opensource.org/licenses/MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #include "stack_report.hpp" | |
| 9 | ||
| 10 | static void tree_print(FILE *f, ZigType *ty, size_t indent); | |
| 11 | ||
| 12 | static void pretty_print_bytes(FILE *f, double n) { | |
| 13 | if (n > 1024.0 * 1024.0 * 1024.0) { | |
| 14 | fprintf(f, "%.02f GiB", n / 1024.0 / 1024.0 / 1024.0); | |
| 15 | return; | |
| 16 | } | |
| 17 | if (n > 1024.0 * 1024.0) { | |
| 18 | fprintf(f, "%.02f MiB", n / 1024.0 / 1024.0); | |
| 19 | return; | |
| 20 | } | |
| 21 | if (n > 1024.0) { | |
| 22 | fprintf(f, "%.02f KiB", n / 1024.0); | |
| 23 | return; | |
| 24 | } | |
| 25 | fprintf(f, "%.02f bytes", n ); | |
| 26 | return; | |
| 27 | } | |
| 28 | ||
| 29 | static int compare_type_abi_sizes_desc(const void *a, const void *b) { | |
| 30 | uint64_t size_a = (*(ZigType * const*)(a))->abi_size; | |
| 31 | uint64_t size_b = (*(ZigType * const*)(b))->abi_size; | |
| 32 | if (size_a > size_b) | |
| 33 | return -1; | |
| 34 | if (size_a < size_b) | |
| 35 | return 1; | |
| 36 | return 0; | |
| 37 | } | |
| 38 | ||
| 39 | static void start_child(FILE *f, size_t indent) { | |
| 40 | fprintf(f, "\n"); | |
| 41 | for (size_t i = 0; i < indent; i += 1) { | |
| 42 | fprintf(f, " "); | |
| 43 | } | |
| 44 | } | |
| 45 | ||
| 46 | static void start_peer(FILE *f, size_t indent) { | |
| 47 | fprintf(f, ",\n"); | |
| 48 | for (size_t i = 0; i < indent; i += 1) { | |
| 49 | fprintf(f, " "); | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | static void tree_print_struct(FILE *f, ZigType *struct_type, size_t indent) { | |
| 54 | ZigList<ZigType *> children = {}; | |
| 55 | uint64_t sum_from_fields = 0; | |
| 56 | for (size_t i = 0; i < struct_type->data.structure.src_field_count; i += 1) { | |
| 57 | TypeStructField *field = &struct_type->data.structure.fields[i]; | |
| 58 | children.append(field->type_entry); | |
| 59 | sum_from_fields += field->type_entry->abi_size; | |
| 60 | } | |
| 61 | qsort(children.items, children.length, sizeof(ZigType *), compare_type_abi_sizes_desc); | |
| 62 | ||
| 63 | start_peer(f, indent); | |
| 64 | fprintf(f, "\"padding\": \"%" ZIG_PRI_u64 "\"", struct_type->abi_size - sum_from_fields); | |
| 65 | ||
| 66 | start_peer(f, indent); | |
| 67 | fprintf(f, "\"fields\": ["); | |
| 68 | ||
| 69 | for (size_t i = 0; i < children.length; i += 1) { | |
| 70 | if (i == 0) { | |
| 71 | start_child(f, indent + 1); | |
| 72 | } else { | |
| 73 | start_peer(f, indent + 1); | |
| 74 | } | |
| 75 | fprintf(f, "{"); | |
| 76 | ||
| 77 | ZigType *child_type = children.at(i); | |
| 78 | tree_print(f, child_type, indent + 2); | |
| 79 | ||
| 80 | start_child(f, indent + 1); | |
| 81 | fprintf(f, "}"); | |
| 82 | } | |
| 83 | ||
| 84 | start_child(f, indent); | |
| 85 | fprintf(f, "]"); | |
| 86 | } | |
| 87 | ||
| 88 | static void tree_print(FILE *f, ZigType *ty, size_t indent) { | |
| 89 | start_child(f, indent); | |
| 90 | fprintf(f, "\"type\": \"%s\"", buf_ptr(&ty->name)); | |
| 91 | ||
| 92 | start_peer(f, indent); | |
| 93 | fprintf(f, "\"sizef\": \""); | |
| 94 | pretty_print_bytes(f, ty->abi_size); | |
| 95 | fprintf(f, "\""); | |
| 96 | ||
| 97 | start_peer(f, indent); | |
| 98 | fprintf(f, "\"size\": \"%" ZIG_PRI_u64 "\"", ty->abi_size); | |
| 99 | ||
| 100 | switch (ty->id) { | |
| 101 | case ZigTypeIdFnFrame: | |
| 102 | return tree_print_struct(f, ty->data.frame.locals_struct, indent); | |
| 103 | case ZigTypeIdStruct: | |
| 104 | return tree_print_struct(f, ty, indent); | |
| 105 | default: | |
| 106 | start_child(f, indent); | |
| 107 | return; | |
| 108 | } | |
| 109 | } | |
| 110 | ||
| 111 | void zig_print_stack_report(CodeGen *g, FILE *f) { | |
| 112 | if (g->largest_frame_fn == nullptr) { | |
| 113 | fprintf(f, "{\"error\": \"No async function frames in entire compilation.\"}\n"); | |
| 114 | return; | |
| 115 | } | |
| 116 | fprintf(f, "{"); | |
| 117 | tree_print(f, g->largest_frame_fn->frame_type, 1); | |
| 118 | ||
| 119 | start_child(f, 0); | |
| 120 | fprintf(f, "}\n"); | |
| 121 | } |
src/stack_report.hpp created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2019 Andrew Kelley | |
| 3 | * | |
| 4 | * This file is part of zig, which is MIT licensed. | |
| 5 | * See http://opensource.org/licenses/MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #ifndef ZIG_STACK_REPORT_HPP | |
| 9 | #define ZIG_STACK_REPORT_HPP | |
| 10 | ||
| 11 | #include "all_types.hpp" | |
| 12 | #include <stdio.h> | |
| 13 | ||
| 14 | void zig_print_stack_report(CodeGen *g, FILE *f); | |
| 15 | ||
| 16 | #endif |
src/target.cpp+4-4| ... | ... | @@ -1441,6 +1441,10 @@ const char *arch_stack_pointer_register_name(ZigLLVM_ArchType arch) { |
| 1441 | 1441 | return "esp"; |
| 1442 | 1442 | case ZigLLVM_x86_64: |
| 1443 | 1443 | return "rsp"; |
| 1444 | case ZigLLVM_arm: | |
| 1445 | case ZigLLVM_armeb: | |
| 1446 | case ZigLLVM_thumb: | |
| 1447 | case ZigLLVM_thumbeb: | |
| 1444 | 1448 | case ZigLLVM_aarch64: |
| 1445 | 1449 | case ZigLLVM_aarch64_be: |
| 1446 | 1450 | case ZigLLVM_aarch64_32: |
| ... | ... | @@ -1448,12 +1452,9 @@ const char *arch_stack_pointer_register_name(ZigLLVM_ArchType arch) { |
| 1448 | 1452 | case ZigLLVM_riscv64: |
| 1449 | 1453 | return "sp"; |
| 1450 | 1454 | |
| 1451 | case ZigLLVM_arm: | |
| 1452 | case ZigLLVM_thumb: | |
| 1453 | 1455 | case ZigLLVM_amdgcn: |
| 1454 | 1456 | case ZigLLVM_amdil: |
| 1455 | 1457 | case ZigLLVM_amdil64: |
| 1456 | case ZigLLVM_armeb: | |
| 1457 | 1458 | case ZigLLVM_arc: |
| 1458 | 1459 | case ZigLLVM_avr: |
| 1459 | 1460 | case ZigLLVM_bpfeb: |
| ... | ... | @@ -1485,7 +1486,6 @@ const char *arch_stack_pointer_register_name(ZigLLVM_ArchType arch) { |
| 1485 | 1486 | case ZigLLVM_systemz: |
| 1486 | 1487 | case ZigLLVM_tce: |
| 1487 | 1488 | case ZigLLVM_tcele: |
| 1488 | case ZigLLVM_thumbeb: | |
| 1489 | 1489 | case ZigLLVM_wasm32: |
| 1490 | 1490 | case ZigLLVM_wasm64: |
| 1491 | 1491 | case ZigLLVM_xcore: |
src/tokenizer.cpp+4| ... | ... | @@ -132,6 +132,8 @@ static const struct ZigKeyword zig_keywords[] = { |
| 132 | 132 | {"inline", TokenIdKeywordInline}, |
| 133 | 133 | {"nakedcc", TokenIdKeywordNakedCC}, |
| 134 | 134 | {"noalias", TokenIdKeywordNoAlias}, |
| 135 | {"noasync", TokenIdKeywordNoAsync}, | |
| 136 | {"noinline", TokenIdKeywordNoInline}, | |
| 135 | 137 | {"null", TokenIdKeywordNull}, |
| 136 | 138 | {"or", TokenIdKeywordOr}, |
| 137 | 139 | {"orelse", TokenIdKeywordOrElse}, |
| ... | ... | @@ -1553,6 +1555,8 @@ const char * token_name(TokenId id) { |
| 1553 | 1555 | case TokenIdKeywordInline: return "inline"; |
| 1554 | 1556 | case TokenIdKeywordNakedCC: return "nakedcc"; |
| 1555 | 1557 | case TokenIdKeywordNoAlias: return "noalias"; |
| 1558 | case TokenIdKeywordNoAsync: return "noasync"; | |
| 1559 | case TokenIdKeywordNoInline: return "noinline"; | |
| 1556 | 1560 | case TokenIdKeywordNull: return "null"; |
| 1557 | 1561 | case TokenIdKeywordOr: return "or"; |
| 1558 | 1562 | case TokenIdKeywordOrElse: return "orelse"; |
src/tokenizer.hpp+2| ... | ... | @@ -74,9 +74,11 @@ enum TokenId { |
| 74 | 74 | TokenIdKeywordFor, |
| 75 | 75 | TokenIdKeywordIf, |
| 76 | 76 | TokenIdKeywordInline, |
| 77 | TokenIdKeywordNoInline, | |
| 77 | 78 | TokenIdKeywordLinkSection, |
| 78 | 79 | TokenIdKeywordNakedCC, |
| 79 | 80 | TokenIdKeywordNoAlias, |
| 81 | TokenIdKeywordNoAsync, | |
| 80 | 82 | TokenIdKeywordNull, |
| 81 | 83 | TokenIdKeywordOr, |
| 82 | 84 | TokenIdKeywordOrElse, |
src/translate_c.cpp+2-2| ... | ... | @@ -253,7 +253,7 @@ static AstNode *trans_create_node_symbol_str(Context *c, const char *name) { |
| 253 | 253 | static AstNode *trans_create_node_builtin_fn_call(Context *c, Buf *name) { |
| 254 | 254 | AstNode *node = trans_create_node(c, NodeTypeFnCallExpr); |
| 255 | 255 | node->data.fn_call_expr.fn_ref_expr = trans_create_node_symbol(c, name); |
| 256 | node->data.fn_call_expr.is_builtin = true; | |
| 256 | node->data.fn_call_expr.modifier = CallModifierBuiltin; | |
| 257 | 257 | return node; |
| 258 | 258 | } |
| 259 | 259 | |
| ... | ... | @@ -432,7 +432,7 @@ static AstNode *trans_create_node_inline_fn(Context *c, Buf *fn_name, AstNode *r |
| 432 | 432 | AstNode *fn_proto = trans_create_node(c, NodeTypeFnProto); |
| 433 | 433 | fn_proto->data.fn_proto.visib_mod = c->visib_mod; |
| 434 | 434 | fn_proto->data.fn_proto.name = fn_name; |
| 435 | fn_proto->data.fn_proto.is_inline = true; | |
| 435 | fn_proto->data.fn_proto.fn_inline = FnInlineAlways; | |
| 436 | 436 | fn_proto->data.fn_proto.return_type = src_proto_node->data.fn_proto.return_type; // TODO ok for these to alias? |
| 437 | 437 | |
| 438 | 438 | fn_def->data.fn_def.fn_proto = fn_proto; |
src/zig_llvm.cpp+1| ... | ... | @@ -853,6 +853,7 @@ const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch) { |
| 853 | 853 | |
| 854 | 854 | void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module) { |
| 855 | 855 | unwrap(module)->addModuleFlag(Module::Warning, "Debug Info Version", DEBUG_METADATA_VERSION); |
| 856 | unwrap(module)->addModuleFlag(Module::Warning, "Dwarf Version", 4); | |
| 856 | 857 | } |
| 857 | 858 | |
| 858 | 859 | void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module) { |
std/bloom_filter.zig created+253| ... | ... | @@ -0,0 +1,253 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const std = @import("std.zig"); | |
| 3 | const math = std.math; | |
| 4 | const debug = std.debug; | |
| 5 | const assert = std.debug.assert; | |
| 6 | const testing = std.testing; | |
| 7 | ||
| 8 | /// There is a trade off of how quickly to fill a bloom filter; | |
| 9 | /// the number of items is: | |
| 10 | /// n_items / K * ln(2) | |
| 11 | /// the rate of false positives is: | |
| 12 | /// (1-e^(-K*N/n_items))^K | |
| 13 | /// where N is the number of items | |
| 14 | pub fn BloomFilter( | |
| 15 | /// Size of bloom filter in cells, must be a power of two. | |
| 16 | comptime n_items: usize, | |
| 17 | /// Number of cells to set per item | |
| 18 | comptime K: usize, | |
| 19 | /// Cell type, should be: | |
| 20 | /// - `bool` for a standard bloom filter | |
| 21 | /// - an unsigned integer type for a counting bloom filter | |
| 22 | comptime Cell: type, | |
| 23 | /// endianess of the Cell | |
| 24 | comptime endian: builtin.Endian, | |
| 25 | /// Hash function to use | |
| 26 | comptime hash: fn (out: []u8, Ki: usize, in: []const u8) void, | |
| 27 | ) type { | |
| 28 | assert(n_items > 0); | |
| 29 | assert(math.isPowerOfTwo(n_items)); | |
| 30 | assert(K > 0); | |
| 31 | const cellEmpty = if (Cell == bool) false else Cell(0); | |
| 32 | const cellMax = if (Cell == bool) true else math.maxInt(Cell); | |
| 33 | const n_bytes = (n_items * comptime std.meta.bitCount(Cell)) / 8; | |
| 34 | assert(n_bytes > 0); | |
| 35 | const Io = std.packed_int_array.PackedIntIo(Cell, endian); | |
| 36 | ||
| 37 | return struct { | |
| 38 | const Self = @This(); | |
| 39 | pub const items = n_items; | |
| 40 | pub const Index = math.IntFittingRange(0, n_items - 1); | |
| 41 | ||
| 42 | data: [n_bytes]u8 = [_]u8{0} ** n_bytes, | |
| 43 | ||
| 44 | pub fn reset(self: *Self) void { | |
| 45 | std.mem.set(u8, self.data[0..], 0); | |
| 46 | } | |
| 47 | ||
| 48 | pub fn @"union"(x: Self, y: Self) Self { | |
| 49 | var r = Self{ .data = undefined }; | |
| 50 | inline for (x.data) |v, i| { | |
| 51 | r.data[i] = v | y.data[i]; | |
| 52 | } | |
| 53 | return r; | |
| 54 | } | |
| 55 | ||
| 56 | pub fn intersection(x: Self, y: Self) Self { | |
| 57 | var r = Self{ .data = undefined }; | |
| 58 | inline for (x.data) |v, i| { | |
| 59 | r.data[i] = v & y.data[i]; | |
| 60 | } | |
| 61 | return r; | |
| 62 | } | |
| 63 | ||
| 64 | pub fn getCell(self: Self, cell: Index) Cell { | |
| 65 | return Io.get(self.data, cell, 0); | |
| 66 | } | |
| 67 | ||
| 68 | pub fn incrementCell(self: *Self, cell: Index) void { | |
| 69 | if (Cell == bool or Cell == u1) { | |
| 70 | // skip the 'get' operation | |
| 71 | Io.set(&self.data, cell, 0, cellMax); | |
| 72 | } else { | |
| 73 | const old = Io.get(self.data, cell, 0); | |
| 74 | if (old != cellMax) { | |
| 75 | Io.set(&self.data, cell, 0, old + 1); | |
| 76 | } | |
| 77 | } | |
| 78 | } | |
| 79 | ||
| 80 | pub fn clearCell(self: *Self, cell: Index) void { | |
| 81 | Io.set(&self.data, cell, 0, cellEmpty); | |
| 82 | } | |
| 83 | ||
| 84 | pub fn add(self: *Self, item: []const u8) void { | |
| 85 | comptime var i = 0; | |
| 86 | inline while (i < K) : (i += 1) { | |
| 87 | var K_th_bit: packed struct { x: Index } = undefined; | |
| 88 | hash(std.mem.asBytes(&K_th_bit), i, item); | |
| 89 | incrementCell(self, K_th_bit.x); | |
| 90 | } | |
| 91 | } | |
| 92 | ||
| 93 | pub fn contains(self: Self, item: []const u8) bool { | |
| 94 | comptime var i = 0; | |
| 95 | inline while (i < K) : (i += 1) { | |
| 96 | var K_th_bit: packed struct { x: Index } = undefined; | |
| 97 | hash(std.mem.asBytes(&K_th_bit), i, item); | |
| 98 | if (getCell(self, K_th_bit.x) == cellEmpty) | |
| 99 | return false; | |
| 100 | } | |
| 101 | return true; | |
| 102 | } | |
| 103 | ||
| 104 | pub fn resize(self: Self, comptime newsize: usize) BloomFilter(newsize, K, Cell, endian, hash) { | |
| 105 | var r: BloomFilter(newsize, K, Cell, endian, hash) = undefined; | |
| 106 | if (newsize < n_items) { | |
| 107 | std.mem.copy(u8, r.data[0..], self.data[0..r.data.len]); | |
| 108 | var copied: usize = r.data.len; | |
| 109 | while (copied < self.data.len) : (copied += r.data.len) { | |
| 110 | for (self.data[copied .. copied + r.data.len]) |s, i| { | |
| 111 | r.data[i] |= s; | |
| 112 | } | |
| 113 | } | |
| 114 | } else if (newsize == n_items) { | |
| 115 | r = self; | |
| 116 | } else if (newsize > n_items) { | |
| 117 | var copied: usize = 0; | |
| 118 | while (copied < r.data.len) : (copied += self.data.len) { | |
| 119 | std.mem.copy(u8, r.data[copied .. copied + self.data.len], self.data); | |
| 120 | } | |
| 121 | } | |
| 122 | return r; | |
| 123 | } | |
| 124 | ||
| 125 | /// Returns number of non-zero cells | |
| 126 | pub fn popCount(self: Self) Index { | |
| 127 | var n: Index = 0; | |
| 128 | if (Cell == bool or Cell == u1) { | |
| 129 | for (self.data) |b, i| { | |
| 130 | n += @popCount(u8, b); | |
| 131 | } | |
| 132 | } else { | |
| 133 | var i: usize = 0; | |
| 134 | while (i < n_items) : (i += 1) { | |
| 135 | const cell = self.getCell(@intCast(Index, i)); | |
| 136 | n += if (if (Cell == bool) cell else cell > 0) Index(1) else Index(0); | |
| 137 | } | |
| 138 | } | |
| 139 | return n; | |
| 140 | } | |
| 141 | ||
| 142 | pub fn estimateItems(self: Self) f64 { | |
| 143 | const m = comptime @intToFloat(f64, n_items); | |
| 144 | const k = comptime @intToFloat(f64, K); | |
| 145 | const X = @intToFloat(f64, self.popCount()); | |
| 146 | return (comptime (-m / k)) * math.log1p(X * comptime (-1 / m)); | |
| 147 | } | |
| 148 | }; | |
| 149 | } | |
| 150 | ||
| 151 | fn hashFunc(out: []u8, Ki: usize, in: []const u8) void { | |
| 152 | var st = std.crypto.gimli.Hash.init(); | |
| 153 | st.update(std.mem.asBytes(&Ki)); | |
| 154 | st.update(in); | |
| 155 | st.final(out); | |
| 156 | } | |
| 157 | ||
| 158 | test "std.BloomFilter" { | |
| 159 | inline for ([_]type{ bool, u1, u2, u3, u4 }) |Cell| { | |
| 160 | const emptyCell = if (Cell == bool) false else Cell(0); | |
| 161 | const BF = BloomFilter(128 * 8, 8, Cell, builtin.endian, hashFunc); | |
| 162 | var bf = BF{}; | |
| 163 | var i: usize = undefined; | |
| 164 | // confirm that it is initialised to the empty filter | |
| 165 | i = 0; | |
| 166 | while (i < BF.items) : (i += 1) { | |
| 167 | testing.expectEqual(emptyCell, bf.getCell(@intCast(BF.Index, i))); | |
| 168 | } | |
| 169 | testing.expectEqual(BF.Index(0), bf.popCount()); | |
| 170 | testing.expectEqual(f64(0), bf.estimateItems()); | |
| 171 | // fill in a few items | |
| 172 | bf.incrementCell(42); | |
| 173 | bf.incrementCell(255); | |
| 174 | bf.incrementCell(256); | |
| 175 | bf.incrementCell(257); | |
| 176 | // check that they were set | |
| 177 | testing.expectEqual(true, bf.getCell(42) != emptyCell); | |
| 178 | testing.expectEqual(true, bf.getCell(255) != emptyCell); | |
| 179 | testing.expectEqual(true, bf.getCell(256) != emptyCell); | |
| 180 | testing.expectEqual(true, bf.getCell(257) != emptyCell); | |
| 181 | // clear just one of them; make sure the rest are still set | |
| 182 | bf.clearCell(256); | |
| 183 | testing.expectEqual(true, bf.getCell(42) != emptyCell); | |
| 184 | testing.expectEqual(true, bf.getCell(255) != emptyCell); | |
| 185 | testing.expectEqual(false, bf.getCell(256) != emptyCell); | |
| 186 | testing.expectEqual(true, bf.getCell(257) != emptyCell); | |
| 187 | // reset any of the ones we've set and confirm we're back to the empty filter | |
| 188 | bf.clearCell(42); | |
| 189 | bf.clearCell(255); | |
| 190 | bf.clearCell(257); | |
| 191 | i = 0; | |
| 192 | while (i < BF.items) : (i += 1) { | |
| 193 | testing.expectEqual(emptyCell, bf.getCell(@intCast(BF.Index, i))); | |
| 194 | } | |
| 195 | testing.expectEqual(BF.Index(0), bf.popCount()); | |
| 196 | testing.expectEqual(f64(0), bf.estimateItems()); | |
| 197 | ||
| 198 | // Lets add a string | |
| 199 | bf.add("foo"); | |
| 200 | testing.expectEqual(true, bf.contains("foo")); | |
| 201 | { | |
| 202 | // try adding same string again. make sure popcount is the same | |
| 203 | const old_popcount = bf.popCount(); | |
| 204 | testing.expect(old_popcount > 0); | |
| 205 | bf.add("foo"); | |
| 206 | testing.expectEqual(true, bf.contains("foo")); | |
| 207 | testing.expectEqual(old_popcount, bf.popCount()); | |
| 208 | } | |
| 209 | ||
| 210 | // Get back to empty filter via .reset | |
| 211 | bf.reset(); | |
| 212 | // Double check that .reset worked | |
| 213 | i = 0; | |
| 214 | while (i < BF.items) : (i += 1) { | |
| 215 | testing.expectEqual(emptyCell, bf.getCell(@intCast(BF.Index, i))); | |
| 216 | } | |
| 217 | testing.expectEqual(BF.Index(0), bf.popCount()); | |
| 218 | testing.expectEqual(f64(0), bf.estimateItems()); | |
| 219 | ||
| 220 | comptime var teststrings = [_][]const u8{ | |
| 221 | "foo", | |
| 222 | "bar", | |
| 223 | "a longer string", | |
| 224 | "some more", | |
| 225 | "the quick brown fox", | |
| 226 | "unique string", | |
| 227 | }; | |
| 228 | inline for (teststrings) |str| { | |
| 229 | bf.add(str); | |
| 230 | } | |
| 231 | inline for (teststrings) |str| { | |
| 232 | testing.expectEqual(true, bf.contains(str)); | |
| 233 | } | |
| 234 | ||
| 235 | { // estimate should be close for low packing | |
| 236 | const est = bf.estimateItems(); | |
| 237 | testing.expect(est > @intToFloat(f64, teststrings.len) - 1); | |
| 238 | testing.expect(est < @intToFloat(f64, teststrings.len) + 1); | |
| 239 | } | |
| 240 | ||
| 241 | const larger_bf = bf.resize(4096); | |
| 242 | inline for (teststrings) |str| { | |
| 243 | testing.expectEqual(true, larger_bf.contains(str)); | |
| 244 | } | |
| 245 | testing.expectEqual(u12(bf.popCount()) * (4096 / 1024), larger_bf.popCount()); | |
| 246 | ||
| 247 | const smaller_bf = bf.resize(64); | |
| 248 | inline for (teststrings) |str| { | |
| 249 | testing.expectEqual(true, smaller_bf.contains(str)); | |
| 250 | } | |
| 251 | testing.expect(bf.popCount() <= u10(smaller_bf.popCount()) * (1024 / 64)); | |
| 252 | } | |
| 253 | } |
std/buf_map.zig+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const HashMap = std.HashMap; | |
| 2 | const StringHashMap = std.StringHashMap; | |
| 3 | 3 | const mem = std.mem; |
| 4 | 4 | const Allocator = mem.Allocator; |
| 5 | 5 | const testing = std.testing; |
| ... | ... | @@ -9,7 +9,7 @@ const testing = std.testing; |
| 9 | 9 | pub const BufMap = struct { |
| 10 | 10 | hash_map: BufMapHashMap, |
| 11 | 11 | |
| 12 | const BufMapHashMap = HashMap([]const u8, []const u8, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 12 | const BufMapHashMap = StringHashMap([]const u8); | |
| 13 | 13 | |
| 14 | 14 | pub fn init(allocator: *Allocator) BufMap { |
| 15 | 15 | var self = BufMap{ .hash_map = BufMapHashMap.init(allocator) }; |
std/buf_set.zig+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | const HashMap = @import("hash_map.zig").HashMap; | |
| 2 | const StringHashMap = std.StringHashMap; | |
| 3 | 3 | const mem = @import("mem.zig"); |
| 4 | 4 | const Allocator = mem.Allocator; |
| 5 | 5 | const testing = std.testing; |
| ... | ... | @@ -7,7 +7,7 @@ const testing = std.testing; |
| 7 | 7 | pub const BufSet = struct { |
| 8 | 8 | hash_map: BufSetHashMap, |
| 9 | 9 | |
| 10 | const BufSetHashMap = HashMap([]const u8, void, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 10 | const BufSetHashMap = StringHashMap(void); | |
| 11 | 11 | |
| 12 | 12 | pub fn init(a: *Allocator) BufSet { |
| 13 | 13 | var self = BufSet{ .hash_map = BufSetHashMap.init(a) }; |
std/build.zig+21-17| ... | ... | @@ -4,10 +4,11 @@ const io = std.io; |
| 4 | 4 | const fs = std.fs; |
| 5 | 5 | const mem = std.mem; |
| 6 | 6 | const debug = std.debug; |
| 7 | const panic = std.debug.panic; | |
| 7 | 8 | const assert = debug.assert; |
| 8 | 9 | const warn = std.debug.warn; |
| 9 | 10 | const ArrayList = std.ArrayList; |
| 10 | const HashMap = std.HashMap; | |
| 11 | const StringHashMap = std.StringHashMap; | |
| 11 | 12 | const Allocator = mem.Allocator; |
| 12 | 13 | const process = std.process; |
| 13 | 14 | const BufSet = std.BufSet; |
| ... | ... | @@ -42,8 +43,8 @@ pub const Builder = struct { |
| 42 | 43 | top_level_steps: ArrayList(*TopLevelStep), |
| 43 | 44 | install_prefix: ?[]const u8, |
| 44 | 45 | dest_dir: ?[]const u8, |
| 45 | lib_dir: ?[]const u8, | |
| 46 | exe_dir: ?[]const u8, | |
| 46 | lib_dir: []const u8, | |
| 47 | exe_dir: []const u8, | |
| 47 | 48 | install_path: []const u8, |
| 48 | 49 | search_prefixes: ArrayList([]const u8), |
| 49 | 50 | installed_files: ArrayList(InstalledFile), |
| ... | ... | @@ -60,8 +61,8 @@ pub const Builder = struct { |
| 60 | 61 | C11, |
| 61 | 62 | }; |
| 62 | 63 | |
| 63 | const UserInputOptionsMap = HashMap([]const u8, UserInputOption, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 64 | const AvailableOptionsMap = HashMap([]const u8, AvailableOption, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 64 | const UserInputOptionsMap = StringHashMap(UserInputOption); | |
| 65 | const AvailableOptionsMap = StringHashMap(AvailableOption); | |
| 65 | 66 | |
| 66 | 67 | const AvailableOption = struct { |
| 67 | 68 | name: []const u8, |
| ... | ... | @@ -129,8 +130,8 @@ pub const Builder = struct { |
| 129 | 130 | .env_map = env_map, |
| 130 | 131 | .search_prefixes = ArrayList([]const u8).init(allocator), |
| 131 | 132 | .install_prefix = null, |
| 132 | .lib_dir = null, | |
| 133 | .exe_dir = null, | |
| 133 | .lib_dir = undefined, | |
| 134 | .exe_dir = undefined, | |
| 134 | 135 | .dest_dir = env_map.get("DESTDIR"), |
| 135 | 136 | .installed_files = ArrayList(InstalledFile).init(allocator), |
| 136 | 137 | .install_tls = TopLevelStep{ |
| ... | ... | @@ -163,11 +164,13 @@ pub const Builder = struct { |
| 163 | 164 | self.allocator.destroy(self); |
| 164 | 165 | } |
| 165 | 166 | |
| 167 | /// This function is intended to be called by std/special/build_runner.zig, not a build.zig file. | |
| 166 | 168 | pub fn setInstallPrefix(self: *Builder, optional_prefix: ?[]const u8) void { |
| 167 | 169 | self.install_prefix = optional_prefix; |
| 168 | 170 | } |
| 169 | 171 | |
| 170 | fn resolveInstallPrefix(self: *Builder) void { | |
| 172 | /// This function is intended to be called by std/special/build_runner.zig, not a build.zig file. | |
| 173 | pub fn resolveInstallPrefix(self: *Builder) void { | |
| 171 | 174 | if (self.dest_dir) |dest_dir| { |
| 172 | 175 | const install_prefix = self.install_prefix orelse "/usr"; |
| 173 | 176 | self.install_path = fs.path.join(self.allocator, [_][]const u8{ dest_dir, install_prefix }) catch unreachable; |
| ... | ... | @@ -437,7 +440,7 @@ pub const Builder = struct { |
| 437 | 440 | .description = description, |
| 438 | 441 | }; |
| 439 | 442 | if ((self.available_options_map.put(name, available_option) catch unreachable) != null) { |
| 440 | debug.panic("Option '{}' declared twice", name); | |
| 443 | panic("Option '{}' declared twice", name); | |
| 441 | 444 | } |
| 442 | 445 | self.available_options_list.append(available_option) catch unreachable; |
| 443 | 446 | |
| ... | ... | @@ -463,8 +466,8 @@ pub const Builder = struct { |
| 463 | 466 | return null; |
| 464 | 467 | }, |
| 465 | 468 | }, |
| 466 | TypeId.Int => debug.panic("TODO integer options to build script"), | |
| 467 | TypeId.Float => debug.panic("TODO float options to build script"), | |
| 469 | TypeId.Int => panic("TODO integer options to build script"), | |
| 470 | TypeId.Float => panic("TODO float options to build script"), | |
| 468 | 471 | TypeId.String => switch (entry.value.value) { |
| 469 | 472 | UserValue.Flag => { |
| 470 | 473 | warn("Expected -D{} to be a string, but received a boolean.\n", name); |
| ... | ... | @@ -478,7 +481,7 @@ pub const Builder = struct { |
| 478 | 481 | }, |
| 479 | 482 | UserValue.Scalar => |s| return s, |
| 480 | 483 | }, |
| 481 | TypeId.List => debug.panic("TODO list options to build script"), | |
| 484 | TypeId.List => panic("TODO list options to build script"), | |
| 482 | 485 | } |
| 483 | 486 | } |
| 484 | 487 | |
| ... | ... | @@ -644,8 +647,6 @@ pub const Builder = struct { |
| 644 | 647 | } |
| 645 | 648 | |
| 646 | 649 | pub fn validateUserInputDidItFail(self: *Builder) bool { |
| 647 | self.resolveInstallPrefix(); | |
| 648 | ||
| 649 | 650 | // make sure all args are used |
| 650 | 651 | var it = self.user_input_options.iterator(); |
| 651 | 652 | while (true) { |
| ... | ... | @@ -855,7 +856,7 @@ pub const Builder = struct { |
| 855 | 856 | var stdout_file_in_stream = child.stdout.?.inStream(); |
| 856 | 857 | try stdout_file_in_stream.stream.readAllBuffer(&stdout, max_output_size); |
| 857 | 858 | |
| 858 | const term = child.wait() catch |err| std.debug.panic("unable to spawn {}: {}", argv[0], err); | |
| 859 | const term = child.wait() catch |err| panic("unable to spawn {}: {}", argv[0], err); | |
| 859 | 860 | switch (term) { |
| 860 | 861 | .Exited => |code| { |
| 861 | 862 | if (code != 0) { |
| ... | ... | @@ -882,8 +883,8 @@ pub const Builder = struct { |
| 882 | 883 | fn getInstallPath(self: *Builder, dir: InstallDir, dest_rel_path: []const u8) []const u8 { |
| 883 | 884 | const base_dir = switch (dir) { |
| 884 | 885 | .Prefix => self.install_path, |
| 885 | .Bin => self.exe_dir.?, | |
| 886 | .Lib => self.lib_dir.?, | |
| 886 | .Bin => self.exe_dir, | |
| 887 | .Lib => self.lib_dir, | |
| 887 | 888 | }; |
| 888 | 889 | return fs.path.resolve( |
| 889 | 890 | self.allocator, |
| ... | ... | @@ -1318,6 +1319,9 @@ pub const LibExeObjStep = struct { |
| 1318 | 1319 | } |
| 1319 | 1320 | |
| 1320 | 1321 | fn initExtraArgs(builder: *Builder, name: []const u8, root_src: ?[]const u8, kind: Kind, is_dynamic: bool, ver: Version) LibExeObjStep { |
| 1322 | if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) { | |
| 1323 | panic("invalid name: '{}'. It looks like a file path, but it is supposed to be the library or application name.", name); | |
| 1324 | } | |
| 1321 | 1325 | var self = LibExeObjStep{ |
| 1322 | 1326 | .strip = false, |
| 1323 | 1327 | .builder = builder, |
std/c.zig+1| ... | ... | @@ -68,6 +68,7 @@ pub extern "c" fn open(path: [*]const u8, oflag: c_uint, ...) c_int; |
| 68 | 68 | pub extern "c" fn openat(fd: c_int, path: [*]const u8, oflag: c_uint, ...) c_int; |
| 69 | 69 | pub extern "c" fn raise(sig: c_int) c_int; |
| 70 | 70 | pub extern "c" fn read(fd: fd_t, buf: [*]u8, nbyte: usize) isize; |
| 71 | pub extern "c" fn readv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint) isize; | |
| 71 | 72 | pub extern "c" fn pread(fd: fd_t, buf: [*]u8, nbyte: usize, offset: u64) isize; |
| 72 | 73 | pub extern "c" fn preadv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: usize) isize; |
| 73 | 74 | pub extern "c" fn writev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint) isize; |
std/debug.zig+32-14| ... | ... | @@ -330,14 +330,16 @@ pub fn writeCurrentStackTraceWindows( |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | /// TODO once https://github.com/ziglang/zig/issues/3157 is fully implemented, | |
| 334 | /// make this `noasync fn` and remove the individual noasync calls. | |
| 333 | 335 | pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void { |
| 334 | 336 | if (windows.is_the_target) { |
| 335 | return printSourceAtAddressWindows(debug_info, out_stream, address, tty_color); | |
| 337 | return noasync printSourceAtAddressWindows(debug_info, out_stream, address, tty_color); | |
| 336 | 338 | } |
| 337 | 339 | if (os.darwin.is_the_target) { |
| 338 | return printSourceAtAddressMacOs(debug_info, out_stream, address, tty_color); | |
| 340 | return noasync printSourceAtAddressMacOs(debug_info, out_stream, address, tty_color); | |
| 339 | 341 | } |
| 340 | return printSourceAtAddressPosix(debug_info, out_stream, address, tty_color); | |
| 342 | return noasync printSourceAtAddressPosix(debug_info, out_stream, address, tty_color); | |
| 341 | 343 | } |
| 342 | 344 | |
| 343 | 345 | fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_address: usize, tty_color: bool) !void { |
| ... | ... | @@ -793,7 +795,7 @@ fn printLineInfo( |
| 793 | 795 | try out_stream.write(GREEN ++ "^" ++ RESET ++ "\n"); |
| 794 | 796 | } |
| 795 | 797 | } else |err| switch (err) { |
| 796 | error.EndOfFile => {}, | |
| 798 | error.EndOfFile, error.FileNotFound => {}, | |
| 797 | 799 | else => return err, |
| 798 | 800 | } |
| 799 | 801 | } else { |
| ... | ... | @@ -816,16 +818,18 @@ pub const OpenSelfDebugInfoError = error{ |
| 816 | 818 | UnsupportedOperatingSystem, |
| 817 | 819 | }; |
| 818 | 820 | |
| 821 | /// TODO once https://github.com/ziglang/zig/issues/3157 is fully implemented, | |
| 822 | /// make this `noasync fn` and remove the individual noasync calls. | |
| 819 | 823 | pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo { |
| 820 | 824 | if (builtin.strip_debug_info) |
| 821 | 825 | return error.MissingDebugInfo; |
| 822 | 826 | if (windows.is_the_target) { |
| 823 | return openSelfDebugInfoWindows(allocator); | |
| 827 | return noasync openSelfDebugInfoWindows(allocator); | |
| 824 | 828 | } |
| 825 | 829 | if (os.darwin.is_the_target) { |
| 826 | return openSelfDebugInfoMacOs(allocator); | |
| 830 | return noasync openSelfDebugInfoMacOs(allocator); | |
| 827 | 831 | } |
| 828 | return openSelfDebugInfoPosix(allocator); | |
| 832 | return noasync openSelfDebugInfoPosix(allocator); | |
| 829 | 833 | } |
| 830 | 834 | |
| 831 | 835 | fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| ... | ... | @@ -1053,7 +1057,8 @@ fn openSelfDebugInfoPosix(allocator: *mem.Allocator) !DwarfInfo { |
| 1053 | 1057 | S.self_exe_file = try fs.openSelfExe(); |
| 1054 | 1058 | errdefer S.self_exe_file.close(); |
| 1055 | 1059 | |
| 1056 | const self_exe_mmap_len = mem.alignForward(try S.self_exe_file.getEndPos(), mem.page_size); | |
| 1060 | const self_exe_len = math.cast(usize, try S.self_exe_file.getEndPos()) catch return error.DebugInfoTooLarge; | |
| 1061 | const self_exe_mmap_len = mem.alignForward(self_exe_len, mem.page_size); | |
| 1057 | 1062 | const self_exe_mmap = try os.mmap( |
| 1058 | 1063 | null, |
| 1059 | 1064 | self_exe_mmap_len, |
| ... | ... | @@ -1507,15 +1512,25 @@ fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, size: usize) ! |
| 1507 | 1512 | } |
| 1508 | 1513 | |
| 1509 | 1514 | fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: bool, comptime size: i32) !FormValue { |
| 1515 | // TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here. | |
| 1516 | // `noasync` should be removed from all the function calls once it is fixed. | |
| 1510 | 1517 | return FormValue{ |
| 1511 | 1518 | .Const = Constant{ |
| 1512 | 1519 | .signed = signed, |
| 1513 | 1520 | .payload = switch (size) { |
| 1514 | 1 => try in_stream.readIntLittle(u8), | |
| 1515 | 2 => try in_stream.readIntLittle(u16), | |
| 1516 | 4 => try in_stream.readIntLittle(u32), | |
| 1517 | 8 => try in_stream.readIntLittle(u64), | |
| 1518 | -1 => if (signed) @bitCast(u64, try leb.readILEB128(i64, in_stream)) else try leb.readULEB128(u64, in_stream), | |
| 1521 | 1 => try noasync in_stream.readIntLittle(u8), | |
| 1522 | 2 => try noasync in_stream.readIntLittle(u16), | |
| 1523 | 4 => try noasync in_stream.readIntLittle(u32), | |
| 1524 | 8 => try noasync in_stream.readIntLittle(u64), | |
| 1525 | -1 => blk: { | |
| 1526 | if (signed) { | |
| 1527 | const x = try noasync leb.readILEB128(i64, in_stream); | |
| 1528 | break :blk @bitCast(u64, x); | |
| 1529 | } else { | |
| 1530 | const x = try noasync leb.readULEB128(u64, in_stream); | |
| 1531 | break :blk x; | |
| 1532 | } | |
| 1533 | }, | |
| 1519 | 1534 | else => @compileError("Invalid size"), |
| 1520 | 1535 | }, |
| 1521 | 1536 | }, |
| ... | ... | @@ -1583,7 +1598,10 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, is_64 |
| 1583 | 1598 | DW.FORM_strp => FormValue{ .StrPtr = try parseFormValueDwarfOffsetSize(in_stream, is_64) }, |
| 1584 | 1599 | DW.FORM_indirect => { |
| 1585 | 1600 | const child_form_id = try leb.readULEB128(u64, in_stream); |
| 1586 | return parseFormValue(allocator, in_stream, child_form_id, is_64); | |
| 1601 | const F = @typeOf(async parseFormValue(allocator, in_stream, child_form_id, is_64)); | |
| 1602 | var frame = try allocator.create(F); | |
| 1603 | defer allocator.destroy(frame); | |
| 1604 | return await @asyncCall(frame, {}, parseFormValue, allocator, in_stream, child_form_id, is_64); | |
| 1587 | 1605 | }, |
| 1588 | 1606 | else => error.InvalidDebugInfo, |
| 1589 | 1607 | }; |
std/event.zig-2| ... | ... | @@ -6,7 +6,6 @@ pub const Locked = @import("event/locked.zig").Locked; |
| 6 | 6 | pub const RwLock = @import("event/rwlock.zig").RwLock; |
| 7 | 7 | pub const RwLocked = @import("event/rwlocked.zig").RwLocked; |
| 8 | 8 | pub const Loop = @import("event/loop.zig").Loop; |
| 9 | pub const io = @import("event/io.zig"); | |
| 10 | 9 | pub const fs = @import("event/fs.zig"); |
| 11 | 10 | pub const net = @import("event/net.zig"); |
| 12 | 11 | |
| ... | ... | @@ -15,7 +14,6 @@ test "import event tests" { |
| 15 | 14 | _ = @import("event/fs.zig"); |
| 16 | 15 | _ = @import("event/future.zig"); |
| 17 | 16 | _ = @import("event/group.zig"); |
| 18 | _ = @import("event/io.zig"); | |
| 19 | 17 | _ = @import("event/lock.zig"); |
| 20 | 18 | _ = @import("event/locked.zig"); |
| 21 | 19 | _ = @import("event/rwlock.zig"); |
std/event/future.zig+1-5| ... | ... | @@ -104,11 +104,7 @@ fn testFuture(loop: *Loop) void { |
| 104 | 104 | var b = async waitOnFuture(&future); |
| 105 | 105 | resolveFuture(&future); |
| 106 | 106 | |
| 107 | // TODO https://github.com/ziglang/zig/issues/3077 | |
| 108 | //const result = (await a) + (await b); | |
| 109 | const a_result = await a; | |
| 110 | const b_result = await b; | |
| 111 | const result = a_result + b_result; | |
| 107 | const result = (await a) + (await b); | |
| 112 | 108 | |
| 113 | 109 | testing.expect(result == 12); |
| 114 | 110 | } |
std/event/io.zig deleted-76| ... | ... | @@ -1,76 +0,0 @@ |
| 1 | const std = @import("../std.zig"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const assert = std.debug.assert; | |
| 4 | const mem = std.mem; | |
| 5 | ||
| 6 | pub fn InStream(comptime ReadError: type) type { | |
| 7 | return struct { | |
| 8 | const Self = @This(); | |
| 9 | pub const Error = ReadError; | |
| 10 | ||
| 11 | /// Return the number of bytes read. It may be less than buffer.len. | |
| 12 | /// If the number of bytes read is 0, it means end of stream. | |
| 13 | /// End of stream is not an error condition. | |
| 14 | readFn: async fn (self: *Self, buffer: []u8) Error!usize, | |
| 15 | ||
| 16 | /// Return the number of bytes read. It may be less than buffer.len. | |
| 17 | /// If the number of bytes read is 0, it means end of stream. | |
| 18 | /// End of stream is not an error condition. | |
| 19 | pub async fn read(self: *Self, buffer: []u8) !usize { | |
| 20 | return self.readFn(self, buffer); | |
| 21 | } | |
| 22 | ||
| 23 | /// Return the number of bytes read. If it is less than buffer.len | |
| 24 | /// it means end of stream. | |
| 25 | pub async fn readFull(self: *Self, buffer: []u8) !usize { | |
| 26 | var index: usize = 0; | |
| 27 | while (index != buf.len) { | |
| 28 | const amt_read = try self.read(buf[index..]); | |
| 29 | if (amt_read == 0) return index; | |
| 30 | index += amt_read; | |
| 31 | } | |
| 32 | return index; | |
| 33 | } | |
| 34 | ||
| 35 | /// Same as `readFull` but end of stream returns `error.EndOfStream`. | |
| 36 | pub async fn readNoEof(self: *Self, buf: []u8) !void { | |
| 37 | const amt_read = try self.readFull(buf[index..]); | |
| 38 | if (amt_read < buf.len) return error.EndOfStream; | |
| 39 | } | |
| 40 | ||
| 41 | pub async fn readIntLittle(self: *Self, comptime T: type) !T { | |
| 42 | var bytes: [@sizeOf(T)]u8 = undefined; | |
| 43 | try self.readNoEof(bytes[0..]); | |
| 44 | return mem.readIntLittle(T, &bytes); | |
| 45 | } | |
| 46 | ||
| 47 | pub async fn readIntBe(self: *Self, comptime T: type) !T { | |
| 48 | var bytes: [@sizeOf(T)]u8 = undefined; | |
| 49 | try self.readNoEof(bytes[0..]); | |
| 50 | return mem.readIntBig(T, &bytes); | |
| 51 | } | |
| 52 | ||
| 53 | pub async fn readInt(self: *Self, comptime T: type, endian: builtin.Endian) !T { | |
| 54 | var bytes: [@sizeOf(T)]u8 = undefined; | |
| 55 | try self.readNoEof(bytes[0..]); | |
| 56 | return mem.readInt(T, &bytes, endian); | |
| 57 | } | |
| 58 | ||
| 59 | pub async fn readStruct(self: *Self, comptime T: type) !T { | |
| 60 | // Only extern and packed structs have defined in-memory layout. | |
| 61 | comptime assert(@typeInfo(T).Struct.layout != builtin.TypeInfo.ContainerLayout.Auto); | |
| 62 | var res: [1]T = undefined; | |
| 63 | try self.readNoEof(@sliceToBytes(res[0..])); | |
| 64 | return res[0]; | |
| 65 | } | |
| 66 | }; | |
| 67 | } | |
| 68 | ||
| 69 | pub fn OutStream(comptime WriteError: type) type { | |
| 70 | return struct { | |
| 71 | const Self = @This(); | |
| 72 | pub const Error = WriteError; | |
| 73 | ||
| 74 | writeFn: async fn (self: *Self, buffer: []u8) Error!void, | |
| 75 | }; | |
| 76 | } |
std/event/loop.zig+5-9| ... | ... | @@ -86,18 +86,10 @@ pub const Loop = struct { |
| 86 | 86 | }; |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | pub const IoMode = enum { | |
| 90 | blocking, | |
| 91 | evented, | |
| 92 | mixed, | |
| 93 | }; | |
| 94 | pub const io_mode: IoMode = if (@hasDecl(root, "io_mode")) root.io_mode else IoMode.blocking; | |
| 95 | 89 | var global_instance_state: Loop = undefined; |
| 96 | threadlocal var per_thread_instance: ?*Loop = null; | |
| 97 | const default_instance: ?*Loop = switch (io_mode) { | |
| 90 | const default_instance: ?*Loop = switch (std.io.mode) { | |
| 98 | 91 | .blocking => null, |
| 99 | 92 | .evented => &global_instance_state, |
| 100 | .mixed => per_thread_instance, | |
| 101 | 93 | }; |
| 102 | 94 | pub const instance: ?*Loop = if (@hasDecl(root, "event_loop")) root.event_loop else default_instance; |
| 103 | 95 | |
| ... | ... | @@ -470,6 +462,10 @@ pub const Loop = struct { |
| 470 | 462 | } |
| 471 | 463 | } |
| 472 | 464 | |
| 465 | pub fn waitUntilFdReadable(self: *Loop, fd: os.fd_t) !void { | |
| 466 | return self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLIN); | |
| 467 | } | |
| 468 | ||
| 473 | 469 | pub async fn bsdWaitKev(self: *Loop, ident: usize, filter: i16, fflags: u32) !os.Kevent { |
| 474 | 470 | var resume_node = ResumeNode.Basic{ |
| 475 | 471 | .base = ResumeNode{ |
std/fmt/parse_float.zig+11-3| ... | ... | @@ -110,9 +110,7 @@ fn convertRepr(comptime T: type, n: FloatRepr) T { |
| 110 | 110 | q.shiftLeft1(s); // q = p << 1 |
| 111 | 111 | r.shiftLeft1(q); // r = p << 2 |
| 112 | 112 | s.shiftLeft1(r); // p = p << 3 |
| 113 | q.add(s); // p = (p << 3) + (p << 1) | |
| 114 | ||
| 115 | exp -= 1; | |
| 113 | s.add(q); // p = (p << 3) + (p << 1) | |
| 116 | 114 | |
| 117 | 115 | while (s.d2 & mask28 != 0) { |
| 118 | 116 | q.shiftRight1(s); |
| ... | ... | @@ -402,6 +400,13 @@ test "fmt.parseFloat" { |
| 402 | 400 | expectEqual((try parseFloat(T, "+0")), 0.0); |
| 403 | 401 | expectEqual((try parseFloat(T, "-0")), 0.0); |
| 404 | 402 | |
| 403 | expectEqual((try parseFloat(T, "0e0")), 0); | |
| 404 | expectEqual((try parseFloat(T, "2e3")), 2000.0); | |
| 405 | expectEqual((try parseFloat(T, "1e0")), 1.0); | |
| 406 | expectEqual((try parseFloat(T, "-2e3")), -2000.0); | |
| 407 | expectEqual((try parseFloat(T, "-1e0")), -1.0); | |
| 408 | expectEqual((try parseFloat(T, "1.234e3")), 1234); | |
| 409 | ||
| 405 | 410 | expect(approxEq(T, try parseFloat(T, "3.141"), 3.141, epsilon)); |
| 406 | 411 | expect(approxEq(T, try parseFloat(T, "-3.141"), -3.141, epsilon)); |
| 407 | 412 | |
| ... | ... | @@ -413,6 +418,9 @@ test "fmt.parseFloat" { |
| 413 | 418 | expectEqual((try parseFloat(T, "-INF")), -std.math.inf(T)); |
| 414 | 419 | |
| 415 | 420 | if (T != f16) { |
| 421 | expect(approxEq(T, try parseFloat(T, "1e-2"), 0.01, epsilon)); | |
| 422 | expect(approxEq(T, try parseFloat(T, "1234e-2"), 12.34, epsilon)); | |
| 423 | ||
| 416 | 424 | expect(approxEq(T, try parseFloat(T, "123142.1"), 123142.1, epsilon)); |
| 417 | 425 | expect(approxEq(T, try parseFloat(T, "-123142.1124"), T(-123142.1124), epsilon)); |
| 418 | 426 | expect(approxEq(T, try parseFloat(T, "0.7062146892655368"), T(0.7062146892655368), epsilon)); |
std/fs/file.zig+3-3| ... | ... | @@ -261,9 +261,9 @@ pub const File = struct { |
| 261 | 261 | return Stat{ |
| 262 | 262 | .size = @bitCast(u64, st.size), |
| 263 | 263 | .mode = st.mode, |
| 264 | .atime = atime.tv_sec * std.time.ns_per_s + atime.tv_nsec, | |
| 265 | .mtime = mtime.tv_sec * std.time.ns_per_s + mtime.tv_nsec, | |
| 266 | .ctime = ctime.tv_sec * std.time.ns_per_s + ctime.tv_nsec, | |
| 264 | .atime = i64(atime.tv_sec) * std.time.ns_per_s + atime.tv_nsec, | |
| 265 | .mtime = i64(mtime.tv_sec) * std.time.ns_per_s + mtime.tv_nsec, | |
| 266 | .ctime = i64(ctime.tv_sec) * std.time.ns_per_s + ctime.tv_nsec, | |
| 267 | 267 | }; |
| 268 | 268 | } |
| 269 | 269 |
std/hash/cityhash.zig+4-4| ... | ... | @@ -214,7 +214,7 @@ pub const CityHash64 = struct { |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | fn hashLen0To16(str: []const u8) u64 { |
| 217 | const len: u64 = @truncate(u64, str.len); | |
| 217 | const len: u64 = u64(str.len); | |
| 218 | 218 | if (len >= 8) { |
| 219 | 219 | const mul: u64 = k2 +% len *% 2; |
| 220 | 220 | const a: u64 = fetch64(str.ptr) +% k2; |
| ... | ... | @@ -240,7 +240,7 @@ pub const CityHash64 = struct { |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | fn hashLen17To32(str: []const u8) u64 { |
| 243 | const len: u64 = @truncate(u64, str.len); | |
| 243 | const len: u64 = u64(str.len); | |
| 244 | 244 | const mul: u64 = k2 +% len *% 2; |
| 245 | 245 | const a: u64 = fetch64(str.ptr) *% k1; |
| 246 | 246 | const b: u64 = fetch64(str.ptr + 8); |
| ... | ... | @@ -251,7 +251,7 @@ pub const CityHash64 = struct { |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | fn hashLen33To64(str: []const u8) u64 { |
| 254 | const len: u64 = @truncate(u64, str.len); | |
| 254 | const len: u64 = u64(str.len); | |
| 255 | 255 | const mul: u64 = k2 +% len *% 2; |
| 256 | 256 | const a: u64 = fetch64(str.ptr) *% k2; |
| 257 | 257 | const b: u64 = fetch64(str.ptr + 8); |
| ... | ... | @@ -305,7 +305,7 @@ pub const CityHash64 = struct { |
| 305 | 305 | return hashLen33To64(str); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | var len: u64 = @truncate(u64, str.len); | |
| 308 | var len: u64 = u64(str.len); | |
| 309 | 309 | |
| 310 | 310 | var x: u64 = fetch64(str.ptr + str.len - 40); |
| 311 | 311 | var y: u64 = fetch64(str.ptr + str.len - 16) +% fetch64(str.ptr + str.len - 56); |
std/hash/murmur.zig+3-3| ... | ... | @@ -98,9 +98,9 @@ pub const Murmur2_64 = struct { |
| 98 | 98 | |
| 99 | 99 | pub fn hashWithSeed(str: []const u8, seed: u64) u64 { |
| 100 | 100 | const m: u64 = 0xc6a4a7935bd1e995; |
| 101 | const len = @truncate(u64, str.len); | |
| 101 | const len = u64(str.len); | |
| 102 | 102 | var h1: u64 = seed ^ (len *% m); |
| 103 | for (@ptrCast([*]allowzero align(1) const u64, str.ptr)[0..(len >> 3)]) |v| { | |
| 103 | for (@ptrCast([*]allowzero align(1) const u64, str.ptr)[0..@intCast(usize, len >> 3)]) |v| { | |
| 104 | 104 | var k1: u64 = v; |
| 105 | 105 | if (builtin.endian == builtin.Endian.Big) |
| 106 | 106 | k1 = @byteSwap(u64, k1); |
| ... | ... | @@ -114,7 +114,7 @@ pub const Murmur2_64 = struct { |
| 114 | 114 | const offset = len - rest; |
| 115 | 115 | if (rest > 0) { |
| 116 | 116 | var k1: u64 = 0; |
| 117 | @memcpy(@ptrCast([*]u8, &k1), @ptrCast([*]const u8, &str[offset]), rest); | |
| 117 | @memcpy(@ptrCast([*]u8, &k1), @ptrCast([*]const u8, &str[@intCast(usize, offset)]), @intCast(usize, rest)); | |
| 118 | 118 | if (builtin.endian == builtin.Endian.Big) |
| 119 | 119 | k1 = @byteSwap(u64, k1); |
| 120 | 120 | h1 ^= k1; |
std/hash_map.zig+1-3| ... | ... | @@ -23,9 +23,7 @@ pub fn StringHashMap(comptime V: type) type { |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub fn eqlString(a: []const u8, b: []const u8) bool { |
| 26 | if (a.len != b.len) return false; | |
| 27 | if (a.ptr == b.ptr) return true; | |
| 28 | return mem.compare(u8, a, b) == .Equal; | |
| 26 | return mem.eql(u8, a, b); | |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | 29 | pub fn hashString(s: []const u8) u32 { |
std/io.zig+14-174| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const root = @import("root"); | |
| 3 | 4 | const c = std.c; |
| 4 | 5 | |
| 5 | 6 | const math = std.math; |
| ... | ... | @@ -15,6 +16,18 @@ const fmt = std.fmt; |
| 15 | 16 | const File = std.fs.File; |
| 16 | 17 | const testing = std.testing; |
| 17 | 18 | |
| 19 | pub const Mode = enum { | |
| 20 | blocking, | |
| 21 | evented, | |
| 22 | }; | |
| 23 | pub const mode: Mode = if (@hasDecl(root, "io_mode")) | |
| 24 | root.io_mode | |
| 25 | else if (@hasDecl(root, "event_loop")) | |
| 26 | Mode.evented | |
| 27 | else | |
| 28 | Mode.blocking; | |
| 29 | pub const is_async = mode != .blocking; | |
| 30 | ||
| 18 | 31 | pub const GetStdIoError = os.windows.GetStdHandleError; |
| 19 | 32 | |
| 20 | 33 | pub fn getStdOut() GetStdIoError!File { |
| ... | ... | @@ -44,180 +57,7 @@ pub fn getStdIn() GetStdIoError!File { |
| 44 | 57 | pub const SeekableStream = @import("io/seekable_stream.zig").SeekableStream; |
| 45 | 58 | pub const SliceSeekableInStream = @import("io/seekable_stream.zig").SliceSeekableInStream; |
| 46 | 59 | pub const COutStream = @import("io/c_out_stream.zig").COutStream; |
| 47 | ||
| 48 | pub fn InStream(comptime ReadError: type) type { | |
| 49 | return struct { | |
| 50 | const Self = @This(); | |
| 51 | pub const Error = ReadError; | |
| 52 | ||
| 53 | /// Return the number of bytes read. If the number read is smaller than buf.len, it | |
| 54 | /// means the stream reached the end. Reaching the end of a stream is not an error | |
| 55 | /// condition. | |
| 56 | readFn: fn (self: *Self, buffer: []u8) Error!usize, | |
| 57 | ||
| 58 | /// Replaces `buffer` contents by reading from the stream until it is finished. | |
| 59 | /// If `buffer.len()` would exceed `max_size`, `error.StreamTooLong` is returned and | |
| 60 | /// the contents read from the stream are lost. | |
| 61 | pub fn readAllBuffer(self: *Self, buffer: *Buffer, max_size: usize) !void { | |
| 62 | try buffer.resize(0); | |
| 63 | ||
| 64 | var actual_buf_len: usize = 0; | |
| 65 | while (true) { | |
| 66 | const dest_slice = buffer.toSlice()[actual_buf_len..]; | |
| 67 | const bytes_read = try self.readFull(dest_slice); | |
| 68 | actual_buf_len += bytes_read; | |
| 69 | ||
| 70 | if (bytes_read != dest_slice.len) { | |
| 71 | buffer.shrink(actual_buf_len); | |
| 72 | return; | |
| 73 | } | |
| 74 | ||
| 75 | const new_buf_size = math.min(max_size, actual_buf_len + mem.page_size); | |
| 76 | if (new_buf_size == actual_buf_len) return error.StreamTooLong; | |
| 77 | try buffer.resize(new_buf_size); | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | /// Allocates enough memory to hold all the contents of the stream. If the allocated | |
| 82 | /// memory would be greater than `max_size`, returns `error.StreamTooLong`. | |
| 83 | /// Caller owns returned memory. | |
| 84 | /// If this function returns an error, the contents from the stream read so far are lost. | |
| 85 | pub fn readAllAlloc(self: *Self, allocator: *mem.Allocator, max_size: usize) ![]u8 { | |
| 86 | var buf = Buffer.initNull(allocator); | |
| 87 | defer buf.deinit(); | |
| 88 | ||
| 89 | try self.readAllBuffer(&buf, max_size); | |
| 90 | return buf.toOwnedSlice(); | |
| 91 | } | |
| 92 | ||
| 93 | /// Replaces `buffer` contents by reading from the stream until `delimiter` is found. | |
| 94 | /// Does not include the delimiter in the result. | |
| 95 | /// If `buffer.len()` would exceed `max_size`, `error.StreamTooLong` is returned and the contents | |
| 96 | /// read from the stream so far are lost. | |
| 97 | pub fn readUntilDelimiterBuffer(self: *Self, buffer: *Buffer, delimiter: u8, max_size: usize) !void { | |
| 98 | try buffer.resize(0); | |
| 99 | ||
| 100 | while (true) { | |
| 101 | var byte: u8 = try self.readByte(); | |
| 102 | ||
| 103 | if (byte == delimiter) { | |
| 104 | return; | |
| 105 | } | |
| 106 | ||
| 107 | if (buffer.len() == max_size) { | |
| 108 | return error.StreamTooLong; | |
| 109 | } | |
| 110 | ||
| 111 | try buffer.appendByte(byte); | |
| 112 | } | |
| 113 | } | |
| 114 | ||
| 115 | /// Allocates enough memory to read until `delimiter`. If the allocated | |
| 116 | /// memory would be greater than `max_size`, returns `error.StreamTooLong`. | |
| 117 | /// Caller owns returned memory. | |
| 118 | /// If this function returns an error, the contents from the stream read so far are lost. | |
| 119 | pub fn readUntilDelimiterAlloc(self: *Self, allocator: *mem.Allocator, delimiter: u8, max_size: usize) ![]u8 { | |
| 120 | var buf = Buffer.initNull(allocator); | |
| 121 | defer buf.deinit(); | |
| 122 | ||
| 123 | try self.readUntilDelimiterBuffer(&buf, delimiter, max_size); | |
| 124 | return buf.toOwnedSlice(); | |
| 125 | } | |
| 126 | ||
| 127 | /// Returns the number of bytes read. It may be less than buffer.len. | |
| 128 | /// If the number of bytes read is 0, it means end of stream. | |
| 129 | /// End of stream is not an error condition. | |
| 130 | pub fn read(self: *Self, buffer: []u8) Error!usize { | |
| 131 | return self.readFn(self, buffer); | |
| 132 | } | |
| 133 | ||
| 134 | /// Returns the number of bytes read. If the number read is smaller than buf.len, it | |
| 135 | /// means the stream reached the end. Reaching the end of a stream is not an error | |
| 136 | /// condition. | |
| 137 | pub fn readFull(self: *Self, buffer: []u8) Error!usize { | |
| 138 | var index: usize = 0; | |
| 139 | while (index != buffer.len) { | |
| 140 | const amt = try self.read(buffer[index..]); | |
| 141 | if (amt == 0) return index; | |
| 142 | index += amt; | |
| 143 | } | |
| 144 | return index; | |
| 145 | } | |
| 146 | ||
| 147 | /// Same as `readFull` but end of stream returns `error.EndOfStream`. | |
| 148 | pub fn readNoEof(self: *Self, buf: []u8) !void { | |
| 149 | const amt_read = try self.readFull(buf); | |
| 150 | if (amt_read < buf.len) return error.EndOfStream; | |
| 151 | } | |
| 152 | ||
| 153 | /// Reads 1 byte from the stream or returns `error.EndOfStream`. | |
| 154 | pub fn readByte(self: *Self) !u8 { | |
| 155 | var result: [1]u8 = undefined; | |
| 156 | try self.readNoEof(result[0..]); | |
| 157 | return result[0]; | |
| 158 | } | |
| 159 | ||
| 160 | /// Same as `readByte` except the returned byte is signed. | |
| 161 | pub fn readByteSigned(self: *Self) !i8 { | |
| 162 | return @bitCast(i8, try self.readByte()); | |
| 163 | } | |
| 164 | ||
| 165 | /// Reads a native-endian integer | |
| 166 | pub fn readIntNative(self: *Self, comptime T: type) !T { | |
| 167 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 168 | try self.readNoEof(bytes[0..]); | |
| 169 | return mem.readIntNative(T, &bytes); | |
| 170 | } | |
| 171 | ||
| 172 | /// Reads a foreign-endian integer | |
| 173 | pub fn readIntForeign(self: *Self, comptime T: type) !T { | |
| 174 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 175 | try self.readNoEof(bytes[0..]); | |
| 176 | return mem.readIntForeign(T, &bytes); | |
| 177 | } | |
| 178 | ||
| 179 | pub fn readIntLittle(self: *Self, comptime T: type) !T { | |
| 180 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 181 | try self.readNoEof(bytes[0..]); | |
| 182 | return mem.readIntLittle(T, &bytes); | |
| 183 | } | |
| 184 | ||
| 185 | pub fn readIntBig(self: *Self, comptime T: type) !T { | |
| 186 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 187 | try self.readNoEof(bytes[0..]); | |
| 188 | return mem.readIntBig(T, &bytes); | |
| 189 | } | |
| 190 | ||
| 191 | pub fn readInt(self: *Self, comptime T: type, endian: builtin.Endian) !T { | |
| 192 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 193 | try self.readNoEof(bytes[0..]); | |
| 194 | return mem.readInt(T, &bytes, endian); | |
| 195 | } | |
| 196 | ||
| 197 | pub fn readVarInt(self: *Self, comptime ReturnType: type, endian: builtin.Endian, size: usize) !ReturnType { | |
| 198 | assert(size <= @sizeOf(ReturnType)); | |
| 199 | var bytes_buf: [@sizeOf(ReturnType)]u8 = undefined; | |
| 200 | const bytes = bytes_buf[0..size]; | |
| 201 | try self.readNoEof(bytes); | |
| 202 | return mem.readVarInt(ReturnType, bytes, endian); | |
| 203 | } | |
| 204 | ||
| 205 | pub fn skipBytes(self: *Self, num_bytes: u64) !void { | |
| 206 | var i: u64 = 0; | |
| 207 | while (i < num_bytes) : (i += 1) { | |
| 208 | _ = try self.readByte(); | |
| 209 | } | |
| 210 | } | |
| 211 | ||
| 212 | pub fn readStruct(self: *Self, comptime T: type) !T { | |
| 213 | // Only extern and packed structs have defined in-memory layout. | |
| 214 | comptime assert(@typeInfo(T).Struct.layout != builtin.TypeInfo.ContainerLayout.Auto); | |
| 215 | var res: [1]T = undefined; | |
| 216 | try self.readNoEof(@sliceToBytes(res[0..])); | |
| 217 | return res[0]; | |
| 218 | } | |
| 219 | }; | |
| 220 | } | |
| 60 | pub const InStream = @import("io/in_stream.zig").InStream; | |
| 221 | 61 | |
| 222 | 62 | pub fn OutStream(comptime WriteError: type) type { |
| 223 | 63 | return struct { |
std/io/in_stream.zig created+200| ... | ... | @@ -0,0 +1,200 @@ |
| 1 | const std = @import("../std.zig"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const root = @import("root"); | |
| 4 | const math = std.math; | |
| 5 | const assert = std.debug.assert; | |
| 6 | const mem = std.mem; | |
| 7 | const Buffer = std.Buffer; | |
| 8 | ||
| 9 | pub const default_stack_size = 4 * 1024 * 1024; | |
| 10 | pub const stack_size: usize = if (@hasDecl(root, "stack_size_std_io_InStream")) | |
| 11 | root.stack_size_std_io_InStream | |
| 12 | else | |
| 13 | default_stack_size; | |
| 14 | pub const stack_align = 16; | |
| 15 | ||
| 16 | pub fn InStream(comptime ReadError: type) type { | |
| 17 | return struct { | |
| 18 | const Self = @This(); | |
| 19 | pub const Error = ReadError; | |
| 20 | pub const ReadFn = if (std.io.is_async) | |
| 21 | async fn (self: *Self, buffer: []u8) Error!usize | |
| 22 | else | |
| 23 | fn (self: *Self, buffer: []u8) Error!usize; | |
| 24 | ||
| 25 | /// Returns the number of bytes read. It may be less than buffer.len. | |
| 26 | /// If the number of bytes read is 0, it means end of stream. | |
| 27 | /// End of stream is not an error condition. | |
| 28 | readFn: ReadFn, | |
| 29 | ||
| 30 | /// Returns the number of bytes read. It may be less than buffer.len. | |
| 31 | /// If the number of bytes read is 0, it means end of stream. | |
| 32 | /// End of stream is not an error condition. | |
| 33 | pub fn read(self: *Self, buffer: []u8) Error!usize { | |
| 34 | if (std.io.is_async) { | |
| 35 | var stack_frame: [stack_size]u8 align(stack_align) = undefined; | |
| 36 | // TODO https://github.com/ziglang/zig/issues/3068 | |
| 37 | var result: Error!usize = undefined; | |
| 38 | return await @asyncCall(&stack_frame, &result, self.readFn, self, buffer); | |
| 39 | } else { | |
| 40 | return self.readFn(self, buffer); | |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | /// Returns the number of bytes read. If the number read is smaller than buf.len, it | |
| 45 | /// means the stream reached the end. Reaching the end of a stream is not an error | |
| 46 | /// condition. | |
| 47 | pub fn readFull(self: *Self, buffer: []u8) Error!usize { | |
| 48 | var index: usize = 0; | |
| 49 | while (index != buffer.len) { | |
| 50 | const amt = try self.read(buffer[index..]); | |
| 51 | if (amt == 0) return index; | |
| 52 | index += amt; | |
| 53 | } | |
| 54 | return index; | |
| 55 | } | |
| 56 | ||
| 57 | /// Returns the number of bytes read. If the number read would be smaller than buf.len, | |
| 58 | /// error.EndOfStream is returned instead. | |
| 59 | pub fn readNoEof(self: *Self, buf: []u8) !void { | |
| 60 | const amt_read = try self.readFull(buf); | |
| 61 | if (amt_read < buf.len) return error.EndOfStream; | |
| 62 | } | |
| 63 | ||
| 64 | /// Replaces `buffer` contents by reading from the stream until it is finished. | |
| 65 | /// If `buffer.len()` would exceed `max_size`, `error.StreamTooLong` is returned and | |
| 66 | /// the contents read from the stream are lost. | |
| 67 | pub fn readAllBuffer(self: *Self, buffer: *Buffer, max_size: usize) !void { | |
| 68 | try buffer.resize(0); | |
| 69 | ||
| 70 | var actual_buf_len: usize = 0; | |
| 71 | while (true) { | |
| 72 | const dest_slice = buffer.toSlice()[actual_buf_len..]; | |
| 73 | const bytes_read = try self.readFull(dest_slice); | |
| 74 | actual_buf_len += bytes_read; | |
| 75 | ||
| 76 | if (bytes_read != dest_slice.len) { | |
| 77 | buffer.shrink(actual_buf_len); | |
| 78 | return; | |
| 79 | } | |
| 80 | ||
| 81 | const new_buf_size = math.min(max_size, actual_buf_len + mem.page_size); | |
| 82 | if (new_buf_size == actual_buf_len) return error.StreamTooLong; | |
| 83 | try buffer.resize(new_buf_size); | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| 87 | /// Allocates enough memory to hold all the contents of the stream. If the allocated | |
| 88 | /// memory would be greater than `max_size`, returns `error.StreamTooLong`. | |
| 89 | /// Caller owns returned memory. | |
| 90 | /// If this function returns an error, the contents from the stream read so far are lost. | |
| 91 | pub fn readAllAlloc(self: *Self, allocator: *mem.Allocator, max_size: usize) ![]u8 { | |
| 92 | var buf = Buffer.initNull(allocator); | |
| 93 | defer buf.deinit(); | |
| 94 | ||
| 95 | try self.readAllBuffer(&buf, max_size); | |
| 96 | return buf.toOwnedSlice(); | |
| 97 | } | |
| 98 | ||
| 99 | /// Replaces `buffer` contents by reading from the stream until `delimiter` is found. | |
| 100 | /// Does not include the delimiter in the result. | |
| 101 | /// If `buffer.len()` would exceed `max_size`, `error.StreamTooLong` is returned and the contents | |
| 102 | /// read from the stream so far are lost. | |
| 103 | pub fn readUntilDelimiterBuffer(self: *Self, buffer: *Buffer, delimiter: u8, max_size: usize) !void { | |
| 104 | try buffer.resize(0); | |
| 105 | ||
| 106 | while (true) { | |
| 107 | var byte: u8 = try self.readByte(); | |
| 108 | ||
| 109 | if (byte == delimiter) { | |
| 110 | return; | |
| 111 | } | |
| 112 | ||
| 113 | if (buffer.len() == max_size) { | |
| 114 | return error.StreamTooLong; | |
| 115 | } | |
| 116 | ||
| 117 | try buffer.appendByte(byte); | |
| 118 | } | |
| 119 | } | |
| 120 | ||
| 121 | /// Allocates enough memory to read until `delimiter`. If the allocated | |
| 122 | /// memory would be greater than `max_size`, returns `error.StreamTooLong`. | |
| 123 | /// Caller owns returned memory. | |
| 124 | /// If this function returns an error, the contents from the stream read so far are lost. | |
| 125 | pub fn readUntilDelimiterAlloc(self: *Self, allocator: *mem.Allocator, delimiter: u8, max_size: usize) ![]u8 { | |
| 126 | var buf = Buffer.initNull(allocator); | |
| 127 | defer buf.deinit(); | |
| 128 | ||
| 129 | try self.readUntilDelimiterBuffer(&buf, delimiter, max_size); | |
| 130 | return buf.toOwnedSlice(); | |
| 131 | } | |
| 132 | ||
| 133 | /// Reads 1 byte from the stream or returns `error.EndOfStream`. | |
| 134 | pub fn readByte(self: *Self) !u8 { | |
| 135 | var result: [1]u8 = undefined; | |
| 136 | try self.readNoEof(result[0..]); | |
| 137 | return result[0]; | |
| 138 | } | |
| 139 | ||
| 140 | /// Same as `readByte` except the returned byte is signed. | |
| 141 | pub fn readByteSigned(self: *Self) !i8 { | |
| 142 | return @bitCast(i8, try self.readByte()); | |
| 143 | } | |
| 144 | ||
| 145 | /// Reads a native-endian integer | |
| 146 | pub fn readIntNative(self: *Self, comptime T: type) !T { | |
| 147 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 148 | try self.readNoEof(bytes[0..]); | |
| 149 | return mem.readIntNative(T, &bytes); | |
| 150 | } | |
| 151 | ||
| 152 | /// Reads a foreign-endian integer | |
| 153 | pub fn readIntForeign(self: *Self, comptime T: type) !T { | |
| 154 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 155 | try self.readNoEof(bytes[0..]); | |
| 156 | return mem.readIntForeign(T, &bytes); | |
| 157 | } | |
| 158 | ||
| 159 | pub fn readIntLittle(self: *Self, comptime T: type) !T { | |
| 160 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 161 | try self.readNoEof(bytes[0..]); | |
| 162 | return mem.readIntLittle(T, &bytes); | |
| 163 | } | |
| 164 | ||
| 165 | pub fn readIntBig(self: *Self, comptime T: type) !T { | |
| 166 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 167 | try self.readNoEof(bytes[0..]); | |
| 168 | return mem.readIntBig(T, &bytes); | |
| 169 | } | |
| 170 | ||
| 171 | pub fn readInt(self: *Self, comptime T: type, endian: builtin.Endian) !T { | |
| 172 | var bytes: [(T.bit_count + 7) / 8]u8 = undefined; | |
| 173 | try self.readNoEof(bytes[0..]); | |
| 174 | return mem.readInt(T, &bytes, endian); | |
| 175 | } | |
| 176 | ||
| 177 | pub fn readVarInt(self: *Self, comptime ReturnType: type, endian: builtin.Endian, size: usize) !ReturnType { | |
| 178 | assert(size <= @sizeOf(ReturnType)); | |
| 179 | var bytes_buf: [@sizeOf(ReturnType)]u8 = undefined; | |
| 180 | const bytes = bytes_buf[0..size]; | |
| 181 | try self.readNoEof(bytes); | |
| 182 | return mem.readVarInt(ReturnType, bytes, endian); | |
| 183 | } | |
| 184 | ||
| 185 | pub fn skipBytes(self: *Self, num_bytes: u64) !void { | |
| 186 | var i: u64 = 0; | |
| 187 | while (i < num_bytes) : (i += 1) { | |
| 188 | _ = try self.readByte(); | |
| 189 | } | |
| 190 | } | |
| 191 | ||
| 192 | pub fn readStruct(self: *Self, comptime T: type) !T { | |
| 193 | // Only extern and packed structs have defined in-memory layout. | |
| 194 | comptime assert(@typeInfo(T).Struct.layout != builtin.TypeInfo.ContainerLayout.Auto); | |
| 195 | var res: [1]T = undefined; | |
| 196 | try self.readNoEof(@sliceToBytes(res[0..])); | |
| 197 | return res[0]; | |
| 198 | } | |
| 199 | }; | |
| 200 | } |
std/json.zig+2-2| ... | ... | @@ -989,7 +989,7 @@ test "json.validate" { |
| 989 | 989 | const Allocator = std.mem.Allocator; |
| 990 | 990 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 991 | 991 | const ArrayList = std.ArrayList; |
| 992 | const HashMap = std.HashMap; | |
| 992 | const StringHashMap = std.StringHashMap; | |
| 993 | 993 | |
| 994 | 994 | pub const ValueTree = struct { |
| 995 | 995 | arena: ArenaAllocator, |
| ... | ... | @@ -1000,7 +1000,7 @@ pub const ValueTree = struct { |
| 1000 | 1000 | } |
| 1001 | 1001 | }; |
| 1002 | 1002 | |
| 1003 | pub const ObjectMap = HashMap([]const u8, Value, mem.hash_slice_u8, mem.eql_slice_u8); | |
| 1003 | pub const ObjectMap = StringHashMap(Value); | |
| 1004 | 1004 | |
| 1005 | 1005 | pub const Value = union(enum) { |
| 1006 | 1006 | Null, |
std/mem.zig+13-25| ... | ... | @@ -339,6 +339,7 @@ test "mem.lessThan" { |
| 339 | 339 | /// Compares two slices and returns whether they are equal. |
| 340 | 340 | pub fn eql(comptime T: type, a: []const T, b: []const T) bool { |
| 341 | 341 | if (a.len != b.len) return false; |
| 342 | if (a.ptr == b.ptr) return true; | |
| 342 | 343 | for (a) |item, index| { |
| 343 | 344 | if (b[index] != item) return false; |
| 344 | 345 | } |
| ... | ... | @@ -738,47 +739,34 @@ test "writeIntBig and writeIntLittle" { |
| 738 | 739 | var buf9: [9]u8 = undefined; |
| 739 | 740 | |
| 740 | 741 | writeIntBig(u0, &buf0, 0x0); |
| 741 | testing.expect(eql_slice_u8(buf0[0..], [_]u8{})); | |
| 742 | testing.expect(eql(u8, buf0[0..], [_]u8{})); | |
| 742 | 743 | writeIntLittle(u0, &buf0, 0x0); |
| 743 | testing.expect(eql_slice_u8(buf0[0..], [_]u8{})); | |
| 744 | testing.expect(eql(u8, buf0[0..], [_]u8{})); | |
| 744 | 745 | |
| 745 | 746 | writeIntBig(u8, &buf1, 0x12); |
| 746 | testing.expect(eql_slice_u8(buf1[0..], [_]u8{0x12})); | |
| 747 | testing.expect(eql(u8, buf1[0..], [_]u8{0x12})); | |
| 747 | 748 | writeIntLittle(u8, &buf1, 0x34); |
| 748 | testing.expect(eql_slice_u8(buf1[0..], [_]u8{0x34})); | |
| 749 | testing.expect(eql(u8, buf1[0..], [_]u8{0x34})); | |
| 749 | 750 | |
| 750 | 751 | writeIntBig(u16, &buf2, 0x1234); |
| 751 | testing.expect(eql_slice_u8(buf2[0..], [_]u8{ 0x12, 0x34 })); | |
| 752 | testing.expect(eql(u8, buf2[0..], [_]u8{ 0x12, 0x34 })); | |
| 752 | 753 | writeIntLittle(u16, &buf2, 0x5678); |
| 753 | testing.expect(eql_slice_u8(buf2[0..], [_]u8{ 0x78, 0x56 })); | |
| 754 | testing.expect(eql(u8, buf2[0..], [_]u8{ 0x78, 0x56 })); | |
| 754 | 755 | |
| 755 | 756 | writeIntBig(u72, &buf9, 0x123456789abcdef024); |
| 756 | testing.expect(eql_slice_u8(buf9[0..], [_]u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 })); | |
| 757 | testing.expect(eql(u8, buf9[0..], [_]u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 })); | |
| 757 | 758 | writeIntLittle(u72, &buf9, 0xfedcba9876543210ec); |
| 758 | testing.expect(eql_slice_u8(buf9[0..], [_]u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe })); | |
| 759 | testing.expect(eql(u8, buf9[0..], [_]u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe })); | |
| 759 | 760 | |
| 760 | 761 | writeIntBig(i8, &buf1, -1); |
| 761 | testing.expect(eql_slice_u8(buf1[0..], [_]u8{0xff})); | |
| 762 | testing.expect(eql(u8, buf1[0..], [_]u8{0xff})); | |
| 762 | 763 | writeIntLittle(i8, &buf1, -2); |
| 763 | testing.expect(eql_slice_u8(buf1[0..], [_]u8{0xfe})); | |
| 764 | testing.expect(eql(u8, buf1[0..], [_]u8{0xfe})); | |
| 764 | 765 | |
| 765 | 766 | writeIntBig(i16, &buf2, -3); |
| 766 | testing.expect(eql_slice_u8(buf2[0..], [_]u8{ 0xff, 0xfd })); | |
| 767 | testing.expect(eql(u8, buf2[0..], [_]u8{ 0xff, 0xfd })); | |
| 767 | 768 | writeIntLittle(i16, &buf2, -4); |
| 768 | testing.expect(eql_slice_u8(buf2[0..], [_]u8{ 0xfc, 0xff })); | |
| 769 | } | |
| 770 | ||
| 771 | pub fn hash_slice_u8(k: []const u8) u32 { | |
| 772 | // FNV 32-bit hash | |
| 773 | var h: u32 = 2166136261; | |
| 774 | for (k) |b| { | |
| 775 | h = (h ^ b) *% 16777619; | |
| 776 | } | |
| 777 | return h; | |
| 778 | } | |
| 779 | ||
| 780 | pub fn eql_slice_u8(a: []const u8, b: []const u8) bool { | |
| 781 | return eql(u8, a, b); | |
| 769 | testing.expect(eql(u8, buf2[0..], [_]u8{ 0xfc, 0xff })); | |
| 782 | 770 | } |
| 783 | 771 | |
| 784 | 772 | /// Returns an iterator that iterates over the slices of `buffer` that are not |
std/meta.zig+2-1| ... | ... | @@ -74,9 +74,10 @@ test "std.meta.stringToEnum" { |
| 74 | 74 | |
| 75 | 75 | pub fn bitCount(comptime T: type) comptime_int { |
| 76 | 76 | return switch (@typeInfo(T)) { |
| 77 | TypeId.Bool => 1, | |
| 77 | 78 | TypeId.Int => |info| info.bits, |
| 78 | 79 | TypeId.Float => |info| info.bits, |
| 79 | else => @compileError("Expected int or float type, found '" ++ @typeName(T) ++ "'"), | |
| 80 | else => @compileError("Expected bool, int or float type, found '" ++ @typeName(T) ++ "'"), | |
| 80 | 81 | }; |
| 81 | 82 | } |
| 82 | 83 |
std/os.zig+18-24| ... | ... | @@ -254,13 +254,18 @@ pub const ReadError = error{ |
| 254 | 254 | IsDir, |
| 255 | 255 | OperationAborted, |
| 256 | 256 | BrokenPipe, |
| 257 | ||
| 258 | /// This error occurs when no global event loop is configured, | |
| 259 | /// and reading from the file descriptor would block. | |
| 260 | WouldBlock, | |
| 261 | ||
| 257 | 262 | Unexpected, |
| 258 | 263 | }; |
| 259 | 264 | |
| 260 | 265 | /// Returns the number of bytes that were read, which can be less than |
| 261 | 266 | /// buf.len. If 0 bytes were read, that means EOF. |
| 262 | /// This function is for blocking file descriptors only. For non-blocking, see | |
| 263 | /// `readAsync`. | |
| 267 | /// If the application has a global event loop enabled, EAGAIN is handled | |
| 268 | /// via the event loop. Otherwise EAGAIN results in error.WouldBlock. | |
| 264 | 269 | pub fn read(fd: fd_t, buf: []u8) ReadError!usize { |
| 265 | 270 | if (windows.is_the_target) { |
| 266 | 271 | return windows.ReadFile(fd, buf); |
| ... | ... | @@ -279,28 +284,19 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { |
| 279 | 284 | } |
| 280 | 285 | } |
| 281 | 286 | |
| 282 | // Linux can return EINVAL when read amount is > 0x7ffff000 | |
| 283 | // See https://github.com/ziglang/zig/pull/743#issuecomment-363158274 | |
| 284 | // TODO audit this. Shawn Landden says that this is not actually true. | |
| 285 | // if this logic should stay, move it to std.os.linux | |
| 286 | const max_buf_len = 0x7ffff000; | |
| 287 | ||
| 288 | var index: usize = 0; | |
| 289 | while (index < buf.len) { | |
| 290 | const want_to_read = math.min(buf.len - index, usize(max_buf_len)); | |
| 291 | const rc = system.read(fd, buf.ptr + index, want_to_read); | |
| 287 | while (true) { | |
| 288 | const rc = system.read(fd, buf.ptr, buf.len); | |
| 292 | 289 | switch (errno(rc)) { |
| 293 | 0 => { | |
| 294 | const amt_read = @intCast(usize, rc); | |
| 295 | index += amt_read; | |
| 296 | if (amt_read == want_to_read) continue; | |
| 297 | // Read returned less than buf.len. | |
| 298 | return index; | |
| 299 | }, | |
| 290 | 0 => return @intCast(usize, rc), | |
| 300 | 291 | EINTR => continue, |
| 301 | 292 | EINVAL => unreachable, |
| 302 | 293 | EFAULT => unreachable, |
| 303 | EAGAIN => unreachable, // This function is for blocking reads. | |
| 294 | EAGAIN => if (std.event.Loop.instance) |loop| { | |
| 295 | loop.waitUntilFdReadable(fd) catch return error.WouldBlock; | |
| 296 | continue; | |
| 297 | } else { | |
| 298 | return error.WouldBlock; | |
| 299 | }, | |
| 304 | 300 | EBADF => unreachable, // Always a race condition. |
| 305 | 301 | EIO => return error.InputOutput, |
| 306 | 302 | EISDIR => return error.IsDir, |
| ... | ... | @@ -313,8 +309,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { |
| 313 | 309 | } |
| 314 | 310 | |
| 315 | 311 | /// Number of bytes read is returned. Upon reading end-of-file, zero is returned. |
| 316 | /// This function is for blocking file descriptors only. For non-blocking, see | |
| 317 | /// `preadvAsync`. | |
| 312 | /// This function is for blocking file descriptors only. | |
| 318 | 313 | pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) ReadError!usize { |
| 319 | 314 | if (darwin.is_the_target) { |
| 320 | 315 | // Darwin does not have preadv but it does have pread. |
| ... | ... | @@ -386,8 +381,7 @@ pub const WriteError = error{ |
| 386 | 381 | }; |
| 387 | 382 | |
| 388 | 383 | /// Write to a file descriptor. Keeps trying if it gets interrupted. |
| 389 | /// This function is for blocking file descriptors only. For non-blocking, see | |
| 390 | /// `writeAsync`. | |
| 384 | /// This function is for blocking file descriptors only. | |
| 391 | 385 | pub fn write(fd: fd_t, bytes: []const u8) WriteError!void { |
| 392 | 386 | if (windows.is_the_target) { |
| 393 | 387 | return windows.WriteFile(fd, bytes); |
std/os/bits/linux.zig+1| ... | ... | @@ -7,6 +7,7 @@ pub usingnamespace @import("linux/errno.zig"); |
| 7 | 7 | pub usingnamespace switch (builtin.arch) { |
| 8 | 8 | .x86_64 => @import("linux/x86_64.zig"), |
| 9 | 9 | .aarch64 => @import("linux/arm64.zig"), |
| 10 | .arm => @import("linux/arm-eabi.zig"), | |
| 10 | 11 | .riscv64 => @import("linux/riscv64.zig"), |
| 11 | 12 | else => struct {}, |
| 12 | 13 | }; |
std/os/bits/linux/arm-eabi.zig created+573| ... | ... | @@ -0,0 +1,573 @@ |
| 1 | // arm-eabi-specific declarations that are intended to be imported into the POSIX namespace. | |
| 2 | ||
| 3 | const std = @import("../../std.zig"); | |
| 4 | const linux = std.os.linux; | |
| 5 | const socklen_t = linux.socklen_t; | |
| 6 | const iovec = linux.iovec; | |
| 7 | const iovec_const = linux.iovec_const; | |
| 8 | ||
| 9 | pub const SYS_restart_syscall = 0; | |
| 10 | pub const SYS_exit = 1; | |
| 11 | pub const SYS_fork = 2; | |
| 12 | pub const SYS_read = 3; | |
| 13 | pub const SYS_write = 4; | |
| 14 | pub const SYS_open = 5; | |
| 15 | pub const SYS_close = 6; | |
| 16 | pub const SYS_creat = 8; | |
| 17 | pub const SYS_link = 9; | |
| 18 | pub const SYS_unlink = 10; | |
| 19 | pub const SYS_execve = 11; | |
| 20 | pub const SYS_chdir = 12; | |
| 21 | pub const SYS_mknod = 14; | |
| 22 | pub const SYS_chmod = 15; | |
| 23 | pub const SYS_lchown = 16; | |
| 24 | pub const SYS_lseek = 19; | |
| 25 | pub const SYS_getpid = 20; | |
| 26 | pub const SYS_mount = 21; | |
| 27 | pub const SYS_setuid = 23; | |
| 28 | pub const SYS_getuid = 24; | |
| 29 | pub const SYS_ptrace = 26; | |
| 30 | pub const SYS_pause = 29; | |
| 31 | pub const SYS_access = 33; | |
| 32 | pub const SYS_nice = 34; | |
| 33 | pub const SYS_sync = 36; | |
| 34 | pub const SYS_kill = 37; | |
| 35 | pub const SYS_rename = 38; | |
| 36 | pub const SYS_mkdir = 39; | |
| 37 | pub const SYS_rmdir = 40; | |
| 38 | pub const SYS_dup = 41; | |
| 39 | pub const SYS_pipe = 42; | |
| 40 | pub const SYS_times = 43; | |
| 41 | pub const SYS_brk = 45; | |
| 42 | pub const SYS_setgid = 46; | |
| 43 | pub const SYS_getgid = 47; | |
| 44 | pub const SYS_geteuid = 49; | |
| 45 | pub const SYS_getegid = 50; | |
| 46 | pub const SYS_acct = 51; | |
| 47 | pub const SYS_umount2 = 52; | |
| 48 | pub const SYS_ioctl = 54; | |
| 49 | pub const SYS_fcntl = 55; | |
| 50 | pub const SYS_setpgid = 57; | |
| 51 | pub const SYS_umask = 60; | |
| 52 | pub const SYS_chroot = 61; | |
| 53 | pub const SYS_ustat = 62; | |
| 54 | pub const SYS_dup2 = 63; | |
| 55 | pub const SYS_getppid = 64; | |
| 56 | pub const SYS_getpgrp = 65; | |
| 57 | pub const SYS_setsid = 66; | |
| 58 | pub const SYS_sigaction = 67; | |
| 59 | pub const SYS_setreuid = 70; | |
| 60 | pub const SYS_setregid = 71; | |
| 61 | pub const SYS_sigsuspend = 72; | |
| 62 | pub const SYS_sigpending = 73; | |
| 63 | pub const SYS_sethostname = 74; | |
| 64 | pub const SYS_setrlimit = 75; | |
| 65 | pub const SYS_getrusage = 77; | |
| 66 | pub const SYS_gettimeofday = 78; | |
| 67 | pub const SYS_settimeofday = 79; | |
| 68 | pub const SYS_getgroups = 80; | |
| 69 | pub const SYS_setgroups = 81; | |
| 70 | pub const SYS_symlink = 83; | |
| 71 | pub const SYS_readlink = 85; | |
| 72 | pub const SYS_uselib = 86; | |
| 73 | pub const SYS_swapon = 87; | |
| 74 | pub const SYS_reboot = 88; | |
| 75 | pub const SYS_munmap = 91; | |
| 76 | pub const SYS_truncate = 92; | |
| 77 | pub const SYS_ftruncate = 93; | |
| 78 | pub const SYS_fchmod = 94; | |
| 79 | pub const SYS_fchown = 95; | |
| 80 | pub const SYS_getpriority = 96; | |
| 81 | pub const SYS_setpriority = 97; | |
| 82 | pub const SYS_statfs = 99; | |
| 83 | pub const SYS_fstatfs = 100; | |
| 84 | pub const SYS_syslog = 103; | |
| 85 | pub const SYS_setitimer = 104; | |
| 86 | pub const SYS_getitimer = 105; | |
| 87 | pub const SYS_stat = 106; | |
| 88 | pub const SYS_lstat = 107; | |
| 89 | pub const SYS_fstat = 108; | |
| 90 | pub const SYS_vhangup = 111; | |
| 91 | pub const SYS_wait4 = 114; | |
| 92 | pub const SYS_swapoff = 115; | |
| 93 | pub const SYS_sysinfo = 116; | |
| 94 | pub const SYS_fsync = 118; | |
| 95 | pub const SYS_sigreturn = 119; | |
| 96 | pub const SYS_clone = 120; | |
| 97 | pub const SYS_setdomainname = 121; | |
| 98 | pub const SYS_uname = 122; | |
| 99 | pub const SYS_adjtimex = 124; | |
| 100 | pub const SYS_mprotect = 125; | |
| 101 | pub const SYS_sigprocmask = 126; | |
| 102 | pub const SYS_init_module = 128; | |
| 103 | pub const SYS_delete_module = 129; | |
| 104 | pub const SYS_quotactl = 131; | |
| 105 | pub const SYS_getpgid = 132; | |
| 106 | pub const SYS_fchdir = 133; | |
| 107 | pub const SYS_bdflush = 134; | |
| 108 | pub const SYS_sysfs = 135; | |
| 109 | pub const SYS_personality = 136; | |
| 110 | pub const SYS_setfsuid = 138; | |
| 111 | pub const SYS_setfsgid = 139; | |
| 112 | pub const SYS__llseek = 140; | |
| 113 | pub const SYS_getdents = 141; | |
| 114 | pub const SYS__newselect = 142; | |
| 115 | pub const SYS_flock = 143; | |
| 116 | pub const SYS_msync = 144; | |
| 117 | pub const SYS_readv = 145; | |
| 118 | pub const SYS_writev = 146; | |
| 119 | pub const SYS_getsid = 147; | |
| 120 | pub const SYS_fdatasync = 148; | |
| 121 | pub const SYS__sysctl = 149; | |
| 122 | pub const SYS_mlock = 150; | |
| 123 | pub const SYS_munlock = 151; | |
| 124 | pub const SYS_mlockall = 152; | |
| 125 | pub const SYS_munlockall = 153; | |
| 126 | pub const SYS_sched_setparam = 154; | |
| 127 | pub const SYS_sched_getparam = 155; | |
| 128 | pub const SYS_sched_setscheduler = 156; | |
| 129 | pub const SYS_sched_getscheduler = 157; | |
| 130 | pub const SYS_sched_yield = 158; | |
| 131 | pub const SYS_sched_get_priority_max = 159; | |
| 132 | pub const SYS_sched_get_priority_min = 160; | |
| 133 | pub const SYS_sched_rr_get_interval = 161; | |
| 134 | pub const SYS_nanosleep = 162; | |
| 135 | pub const SYS_mremap = 163; | |
| 136 | pub const SYS_setresuid = 164; | |
| 137 | pub const SYS_getresuid = 165; | |
| 138 | pub const SYS_poll = 168; | |
| 139 | pub const SYS_nfsservctl = 169; | |
| 140 | pub const SYS_setresgid = 170; | |
| 141 | pub const SYS_getresgid = 171; | |
| 142 | pub const SYS_prctl = 172; | |
| 143 | pub const SYS_rt_sigreturn = 173; | |
| 144 | pub const SYS_rt_sigaction = 174; | |
| 145 | pub const SYS_rt_sigprocmask = 175; | |
| 146 | pub const SYS_rt_sigpending = 176; | |
| 147 | pub const SYS_rt_sigtimedwait = 177; | |
| 148 | pub const SYS_rt_sigqueueinfo = 178; | |
| 149 | pub const SYS_rt_sigsuspend = 179; | |
| 150 | pub const SYS_pread64 = 180; | |
| 151 | pub const SYS_pwrite64 = 181; | |
| 152 | pub const SYS_chown = 182; | |
| 153 | pub const SYS_getcwd = 183; | |
| 154 | pub const SYS_capget = 184; | |
| 155 | pub const SYS_capset = 185; | |
| 156 | pub const SYS_sigaltstack = 186; | |
| 157 | pub const SYS_sendfile = 187; | |
| 158 | pub const SYS_vfork = 190; | |
| 159 | pub const SYS_ugetrlimit = 191; | |
| 160 | pub const SYS_mmap2 = 192; | |
| 161 | pub const SYS_truncate64 = 193; | |
| 162 | pub const SYS_ftruncate64 = 194; | |
| 163 | pub const SYS_stat64 = 195; | |
| 164 | pub const SYS_lstat64 = 196; | |
| 165 | pub const SYS_fstat64 = 197; | |
| 166 | pub const SYS_lchown32 = 198; | |
| 167 | pub const SYS_getuid32 = 199; | |
| 168 | pub const SYS_getgid32 = 200; | |
| 169 | pub const SYS_geteuid32 = 201; | |
| 170 | pub const SYS_getegid32 = 202; | |
| 171 | pub const SYS_setreuid32 = 203; | |
| 172 | pub const SYS_setregid32 = 204; | |
| 173 | pub const SYS_getgroups32 = 205; | |
| 174 | pub const SYS_setgroups32 = 206; | |
| 175 | pub const SYS_fchown32 = 207; | |
| 176 | pub const SYS_setresuid32 = 208; | |
| 177 | pub const SYS_getresuid32 = 209; | |
| 178 | pub const SYS_setresgid32 = 210; | |
| 179 | pub const SYS_getresgid32 = 211; | |
| 180 | pub const SYS_chown32 = 212; | |
| 181 | pub const SYS_setuid32 = 213; | |
| 182 | pub const SYS_setgid32 = 214; | |
| 183 | pub const SYS_setfsuid32 = 215; | |
| 184 | pub const SYS_setfsgid32 = 216; | |
| 185 | pub const SYS_getdents64 = 217; | |
| 186 | pub const SYS_pivot_root = 218; | |
| 187 | pub const SYS_mincore = 219; | |
| 188 | pub const SYS_madvise = 220; | |
| 189 | pub const SYS_fcntl64 = 221; | |
| 190 | pub const SYS_gettid = 224; | |
| 191 | pub const SYS_readahead = 225; | |
| 192 | pub const SYS_setxattr = 226; | |
| 193 | pub const SYS_lsetxattr = 227; | |
| 194 | pub const SYS_fsetxattr = 228; | |
| 195 | pub const SYS_getxattr = 229; | |
| 196 | pub const SYS_lgetxattr = 230; | |
| 197 | pub const SYS_fgetxattr = 231; | |
| 198 | pub const SYS_listxattr = 232; | |
| 199 | pub const SYS_llistxattr = 233; | |
| 200 | pub const SYS_flistxattr = 234; | |
| 201 | pub const SYS_removexattr = 235; | |
| 202 | pub const SYS_lremovexattr = 236; | |
| 203 | pub const SYS_fremovexattr = 237; | |
| 204 | pub const SYS_tkill = 238; | |
| 205 | pub const SYS_sendfile64 = 239; | |
| 206 | pub const SYS_futex = 240; | |
| 207 | pub const SYS_sched_setaffinity = 241; | |
| 208 | pub const SYS_sched_getaffinity = 242; | |
| 209 | pub const SYS_io_setup = 243; | |
| 210 | pub const SYS_io_destroy = 244; | |
| 211 | pub const SYS_io_getevents = 245; | |
| 212 | pub const SYS_io_submit = 246; | |
| 213 | pub const SYS_io_cancel = 247; | |
| 214 | pub const SYS_exit_group = 248; | |
| 215 | pub const SYS_lookup_dcookie = 249; | |
| 216 | pub const SYS_epoll_create = 250; | |
| 217 | pub const SYS_epoll_ctl = 251; | |
| 218 | pub const SYS_epoll_wait = 252; | |
| 219 | pub const SYS_remap_file_pages = 253; | |
| 220 | pub const SYS_set_tid_address = 256; | |
| 221 | pub const SYS_timer_create = 257; | |
| 222 | pub const SYS_timer_settime = 258; | |
| 223 | pub const SYS_timer_gettime = 259; | |
| 224 | pub const SYS_timer_getoverrun = 260; | |
| 225 | pub const SYS_timer_delete = 261; | |
| 226 | pub const SYS_clock_settime = 262; | |
| 227 | pub const SYS_clock_gettime = 263; | |
| 228 | pub const SYS_clock_getres = 264; | |
| 229 | pub const SYS_clock_nanosleep = 265; | |
| 230 | pub const SYS_statfs64 = 266; | |
| 231 | pub const SYS_fstatfs64 = 267; | |
| 232 | pub const SYS_tgkill = 268; | |
| 233 | pub const SYS_utimes = 269; | |
| 234 | pub const SYS_fadvise64_64 = 270; | |
| 235 | pub const SYS_arm_fadvise64_64 = 270; | |
| 236 | pub const SYS_pciconfig_iobase = 271; | |
| 237 | pub const SYS_pciconfig_read = 272; | |
| 238 | pub const SYS_pciconfig_write = 273; | |
| 239 | pub const SYS_mq_open = 274; | |
| 240 | pub const SYS_mq_unlink = 275; | |
| 241 | pub const SYS_mq_timedsend = 276; | |
| 242 | pub const SYS_mq_timedreceive = 277; | |
| 243 | pub const SYS_mq_notify = 278; | |
| 244 | pub const SYS_mq_getsetattr = 279; | |
| 245 | pub const SYS_waitid = 280; | |
| 246 | pub const SYS_socket = 281; | |
| 247 | pub const SYS_bind = 282; | |
| 248 | pub const SYS_connect = 283; | |
| 249 | pub const SYS_listen = 284; | |
| 250 | pub const SYS_accept = 285; | |
| 251 | pub const SYS_getsockname = 286; | |
| 252 | pub const SYS_getpeername = 287; | |
| 253 | pub const SYS_socketpair = 288; | |
| 254 | pub const SYS_send = 289; | |
| 255 | pub const SYS_sendto = 290; | |
| 256 | pub const SYS_recv = 291; | |
| 257 | pub const SYS_recvfrom = 292; | |
| 258 | pub const SYS_shutdown = 293; | |
| 259 | pub const SYS_setsockopt = 294; | |
| 260 | pub const SYS_getsockopt = 295; | |
| 261 | pub const SYS_sendmsg = 296; | |
| 262 | pub const SYS_recvmsg = 297; | |
| 263 | pub const SYS_semop = 298; | |
| 264 | pub const SYS_semget = 299; | |
| 265 | pub const SYS_semctl = 300; | |
| 266 | pub const SYS_msgsnd = 301; | |
| 267 | pub const SYS_msgrcv = 302; | |
| 268 | pub const SYS_msgget = 303; | |
| 269 | pub const SYS_msgctl = 304; | |
| 270 | pub const SYS_shmat = 305; | |
| 271 | pub const SYS_shmdt = 306; | |
| 272 | pub const SYS_shmget = 307; | |
| 273 | pub const SYS_shmctl = 308; | |
| 274 | pub const SYS_add_key = 309; | |
| 275 | pub const SYS_request_key = 310; | |
| 276 | pub const SYS_keyctl = 311; | |
| 277 | pub const SYS_semtimedop = 312; | |
| 278 | pub const SYS_vserver = 313; | |
| 279 | pub const SYS_ioprio_set = 314; | |
| 280 | pub const SYS_ioprio_get = 315; | |
| 281 | pub const SYS_inotify_init = 316; | |
| 282 | pub const SYS_inotify_add_watch = 317; | |
| 283 | pub const SYS_inotify_rm_watch = 318; | |
| 284 | pub const SYS_mbind = 319; | |
| 285 | pub const SYS_get_mempolicy = 320; | |
| 286 | pub const SYS_set_mempolicy = 321; | |
| 287 | pub const SYS_openat = 322; | |
| 288 | pub const SYS_mkdirat = 323; | |
| 289 | pub const SYS_mknodat = 324; | |
| 290 | pub const SYS_fchownat = 325; | |
| 291 | pub const SYS_futimesat = 326; | |
| 292 | pub const SYS_fstatat64 = 327; | |
| 293 | pub const SYS_unlinkat = 328; | |
| 294 | pub const SYS_renameat = 329; | |
| 295 | pub const SYS_linkat = 330; | |
| 296 | pub const SYS_symlinkat = 331; | |
| 297 | pub const SYS_readlinkat = 332; | |
| 298 | pub const SYS_fchmodat = 333; | |
| 299 | pub const SYS_faccessat = 334; | |
| 300 | pub const SYS_pselect6 = 335; | |
| 301 | pub const SYS_ppoll = 336; | |
| 302 | pub const SYS_unshare = 337; | |
| 303 | pub const SYS_set_robust_list = 338; | |
| 304 | pub const SYS_get_robust_list = 339; | |
| 305 | pub const SYS_splice = 340; | |
| 306 | pub const SYS_sync_file_range2 = 341; | |
| 307 | pub const SYS_arm_sync_file_range = 341; | |
| 308 | pub const SYS_tee = 342; | |
| 309 | pub const SYS_vmsplice = 343; | |
| 310 | pub const SYS_move_pages = 344; | |
| 311 | pub const SYS_getcpu = 345; | |
| 312 | pub const SYS_epoll_pwait = 346; | |
| 313 | pub const SYS_kexec_load = 347; | |
| 314 | pub const SYS_utimensat = 348; | |
| 315 | pub const SYS_signalfd = 349; | |
| 316 | pub const SYS_timerfd_create = 350; | |
| 317 | pub const SYS_eventfd = 351; | |
| 318 | pub const SYS_fallocate = 352; | |
| 319 | pub const SYS_timerfd_settime = 353; | |
| 320 | pub const SYS_timerfd_gettime = 354; | |
| 321 | pub const SYS_signalfd4 = 355; | |
| 322 | pub const SYS_eventfd2 = 356; | |
| 323 | pub const SYS_epoll_create1 = 357; | |
| 324 | pub const SYS_dup3 = 358; | |
| 325 | pub const SYS_pipe2 = 359; | |
| 326 | pub const SYS_inotify_init1 = 360; | |
| 327 | pub const SYS_preadv = 361; | |
| 328 | pub const SYS_pwritev = 362; | |
| 329 | pub const SYS_rt_tgsigqueueinfo = 363; | |
| 330 | pub const SYS_perf_event_open = 364; | |
| 331 | pub const SYS_recvmmsg = 365; | |
| 332 | pub const SYS_accept4 = 366; | |
| 333 | pub const SYS_fanotify_init = 367; | |
| 334 | pub const SYS_fanotify_mark = 368; | |
| 335 | pub const SYS_prlimit64 = 369; | |
| 336 | pub const SYS_name_to_handle_at = 370; | |
| 337 | pub const SYS_open_by_handle_at = 371; | |
| 338 | pub const SYS_clock_adjtime = 372; | |
| 339 | pub const SYS_syncfs = 373; | |
| 340 | pub const SYS_sendmmsg = 374; | |
| 341 | pub const SYS_setns = 375; | |
| 342 | pub const SYS_process_vm_readv = 376; | |
| 343 | pub const SYS_process_vm_writev = 377; | |
| 344 | pub const SYS_kcmp = 378; | |
| 345 | pub const SYS_finit_module = 379; | |
| 346 | pub const SYS_sched_setattr = 380; | |
| 347 | pub const SYS_sched_getattr = 381; | |
| 348 | pub const SYS_renameat2 = 382; | |
| 349 | pub const SYS_seccomp = 383; | |
| 350 | pub const SYS_getrandom = 384; | |
| 351 | pub const SYS_memfd_create = 385; | |
| 352 | pub const SYS_bpf = 386; | |
| 353 | pub const SYS_execveat = 387; | |
| 354 | pub const SYS_userfaultfd = 388; | |
| 355 | pub const SYS_membarrier = 389; | |
| 356 | pub const SYS_mlock2 = 390; | |
| 357 | pub const SYS_copy_file_range = 391; | |
| 358 | pub const SYS_preadv2 = 392; | |
| 359 | pub const SYS_pwritev2 = 393; | |
| 360 | pub const SYS_pkey_mprotect = 394; | |
| 361 | pub const SYS_pkey_alloc = 395; | |
| 362 | pub const SYS_pkey_free = 396; | |
| 363 | pub const SYS_statx = 397; | |
| 364 | pub const SYS_rseq = 398; | |
| 365 | pub const SYS_io_pgetevents = 399; | |
| 366 | pub const SYS_migrate_pages = 400; | |
| 367 | pub const SYS_kexec_file_load = 401; | |
| 368 | pub const SYS_clock_gettime64 = 403; | |
| 369 | pub const SYS_clock_settime64 = 404; | |
| 370 | pub const SYS_clock_adjtime64 = 405; | |
| 371 | pub const SYS_clock_getres_time64 = 406; | |
| 372 | pub const SYS_clock_nanosleep_time64 = 407; | |
| 373 | pub const SYS_timer_gettime64 = 408; | |
| 374 | pub const SYS_timer_settime64 = 409; | |
| 375 | pub const SYS_timerfd_gettime64 = 410; | |
| 376 | pub const SYS_timerfd_settime64 = 411; | |
| 377 | pub const SYS_utimensat_time64 = 412; | |
| 378 | pub const SYS_pselect6_time64 = 413; | |
| 379 | pub const SYS_ppoll_time64 = 414; | |
| 380 | pub const SYS_io_pgetevents_time64 = 416; | |
| 381 | pub const SYS_recvmmsg_time64 = 417; | |
| 382 | pub const SYS_mq_timedsend_time64 = 418; | |
| 383 | pub const SYS_mq_timedreceive_time64 = 419; | |
| 384 | pub const SYS_semtimedop_time64 = 420; | |
| 385 | pub const SYS_rt_sigtimedwait_time64 = 421; | |
| 386 | pub const SYS_futex_time64 = 422; | |
| 387 | pub const SYS_sched_rr_get_interval_time64 = 423; | |
| 388 | pub const SYS_pidfd_send_signal = 424; | |
| 389 | pub const SYS_io_uring_setup = 425; | |
| 390 | pub const SYS_io_uring_enter = 426; | |
| 391 | pub const SYS_io_uring_register = 427; | |
| 392 | ||
| 393 | pub const SYS_breakpoint = 0x0f0001; | |
| 394 | pub const SYS_cacheflush = 0x0f0002; | |
| 395 | pub const SYS_usr26 = 0x0f0003; | |
| 396 | pub const SYS_usr32 = 0x0f0004; | |
| 397 | pub const SYS_set_tls = 0x0f0005; | |
| 398 | pub const SYS_get_tls = 0x0f0006; | |
| 399 | ||
| 400 | pub const MMAP2_UNIT = 4096; | |
| 401 | ||
| 402 | pub const O_CREAT = 0o100; | |
| 403 | pub const O_EXCL = 0o200; | |
| 404 | pub const O_NOCTTY = 0o400; | |
| 405 | pub const O_TRUNC = 0o1000; | |
| 406 | pub const O_APPEND = 0o2000; | |
| 407 | pub const O_NONBLOCK = 0o4000; | |
| 408 | pub const O_DSYNC = 0o10000; | |
| 409 | pub const O_SYNC = 0o4010000; | |
| 410 | pub const O_RSYNC = 0o4010000; | |
| 411 | pub const O_DIRECTORY = 0o40000; | |
| 412 | pub const O_NOFOLLOW = 0o100000; | |
| 413 | pub const O_CLOEXEC = 0o2000000; | |
| 414 | ||
| 415 | pub const O_ASYNC = 0o20000; | |
| 416 | pub const O_DIRECT = 0o200000; | |
| 417 | pub const O_LARGEFILE = 0o400000; | |
| 418 | pub const O_NOATIME = 0o1000000; | |
| 419 | pub const O_PATH = 0o10000000; | |
| 420 | pub const O_TMPFILE = 0o20040000; | |
| 421 | pub const O_NDELAY = O_NONBLOCK; | |
| 422 | ||
| 423 | pub const F_DUPFD = 0; | |
| 424 | pub const F_GETFD = 1; | |
| 425 | pub const F_SETFD = 2; | |
| 426 | pub const F_GETFL = 3; | |
| 427 | pub const F_SETFL = 4; | |
| 428 | ||
| 429 | pub const F_SETOWN = 8; | |
| 430 | pub const F_GETOWN = 9; | |
| 431 | pub const F_SETSIG = 10; | |
| 432 | pub const F_GETSIG = 11; | |
| 433 | ||
| 434 | pub const F_GETLK = 12; | |
| 435 | pub const F_SETLK = 13; | |
| 436 | pub const F_SETLKW = 14; | |
| 437 | ||
| 438 | pub const F_SETOWN_EX = 15; | |
| 439 | pub const F_GETOWN_EX = 16; | |
| 440 | ||
| 441 | pub const F_GETOWNER_UIDS = 17; | |
| 442 | ||
| 443 | /// stack-like segment | |
| 444 | pub const MAP_GROWSDOWN = 0x0100; | |
| 445 | ||
| 446 | /// ETXTBSY | |
| 447 | pub const MAP_DENYWRITE = 0x0800; | |
| 448 | ||
| 449 | /// mark it as an executable | |
| 450 | pub const MAP_EXECUTABLE = 0x1000; | |
| 451 | ||
| 452 | /// pages are locked | |
| 453 | pub const MAP_LOCKED = 0x2000; | |
| 454 | ||
| 455 | /// don't check for reservations | |
| 456 | pub const MAP_NORESERVE = 0x4000; | |
| 457 | ||
| 458 | /// populate (prefault) pagetables | |
| 459 | pub const MAP_POPULATE = 0x8000; | |
| 460 | ||
| 461 | /// do not block on IO | |
| 462 | pub const MAP_NONBLOCK = 0x10000; | |
| 463 | ||
| 464 | /// give out an address that is best suited for process/thread stacks | |
| 465 | pub const MAP_STACK = 0x20000; | |
| 466 | ||
| 467 | /// create a huge page mapping | |
| 468 | pub const MAP_HUGETLB = 0x40000; | |
| 469 | ||
| 470 | /// perform synchronous page faults for the mapping | |
| 471 | pub const MAP_SYNC = 0x80000; | |
| 472 | ||
| 473 | pub const VDSO_USEFUL = true; | |
| 474 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; | |
| 475 | pub const VDSO_CGT_VER = "LINUX_2.6"; | |
| 476 | ||
| 477 | pub const HWCAP_SWP = 1 << 0; | |
| 478 | pub const HWCAP_HALF = 1 << 1; | |
| 479 | pub const HWCAP_THUMB = 1 << 2; | |
| 480 | pub const HWCAP_26BIT = 1 << 3; | |
| 481 | pub const HWCAP_FAST_MULT = 1 << 4; | |
| 482 | pub const HWCAP_FPA = 1 << 5; | |
| 483 | pub const HWCAP_VFP = 1 << 6; | |
| 484 | pub const HWCAP_EDSP = 1 << 7; | |
| 485 | pub const HWCAP_JAVA = 1 << 8; | |
| 486 | pub const HWCAP_IWMMXT = 1 << 9; | |
| 487 | pub const HWCAP_CRUNCH = 1 << 10; | |
| 488 | pub const HWCAP_THUMBEE = 1 << 11; | |
| 489 | pub const HWCAP_NEON = 1 << 12; | |
| 490 | pub const HWCAP_VFPv3 = 1 << 13; | |
| 491 | pub const HWCAP_VFPv3D16 = 1 << 14; | |
| 492 | pub const HWCAP_TLS = 1 << 15; | |
| 493 | pub const HWCAP_VFPv4 = 1 << 16; | |
| 494 | pub const HWCAP_IDIVA = 1 << 17; | |
| 495 | pub const HWCAP_IDIVT = 1 << 18; | |
| 496 | pub const HWCAP_VFPD32 = 1 << 19; | |
| 497 | pub const HWCAP_IDIV = HWCAP_IDIVA | HWCAP_IDIVT; | |
| 498 | pub const HWCAP_LPAE = 1 << 20; | |
| 499 | pub const HWCAP_EVTSTRM = 1 << 21; | |
| 500 | ||
| 501 | pub const msghdr = extern struct { | |
| 502 | msg_name: ?*sockaddr, | |
| 503 | msg_namelen: socklen_t, | |
| 504 | msg_iov: [*]iovec, | |
| 505 | msg_iovlen: i32, | |
| 506 | msg_control: ?*c_void, | |
| 507 | msg_controllen: socklen_t, | |
| 508 | msg_flags: i32, | |
| 509 | }; | |
| 510 | ||
| 511 | pub const msghdr_const = extern struct { | |
| 512 | msg_name: ?*const sockaddr, | |
| 513 | msg_namelen: socklen_t, | |
| 514 | msg_iov: [*]iovec_const, | |
| 515 | msg_iovlen: i32, | |
| 516 | msg_control: ?*c_void, | |
| 517 | msg_controllen: socklen_t, | |
| 518 | msg_flags: i32, | |
| 519 | }; | |
| 520 | ||
| 521 | /// Renamed to Stat to not conflict with the stat function. | |
| 522 | /// atime, mtime, and ctime have functions to return `timespec`, | |
| 523 | /// because although this is a POSIX API, the layout and names of | |
| 524 | /// the structs are inconsistent across operating systems, and | |
| 525 | /// in C, macros are used to hide the differences. Here we use | |
| 526 | /// methods to accomplish this. | |
| 527 | pub const Stat = extern struct { | |
| 528 | dev: u64, | |
| 529 | __dev_padding: u32, | |
| 530 | __ino_truncated: u32, | |
| 531 | mode: u32, | |
| 532 | nlink: u32, | |
| 533 | uid: u32, | |
| 534 | gid: u32, | |
| 535 | rdev: u64, | |
| 536 | __rdev_padding: u32, | |
| 537 | size: i64, | |
| 538 | blksize: i32, | |
| 539 | blocks: u64, | |
| 540 | atim: timespec, | |
| 541 | mtim: timespec, | |
| 542 | ctim: timespec, | |
| 543 | ino: u64, | |
| 544 | ||
| 545 | pub fn atime(self: Stat) timespec { | |
| 546 | return self.atim; | |
| 547 | } | |
| 548 | ||
| 549 | pub fn mtime(self: Stat) timespec { | |
| 550 | return self.mtim; | |
| 551 | } | |
| 552 | ||
| 553 | pub fn ctime(self: Stat) timespec { | |
| 554 | return self.ctim; | |
| 555 | } | |
| 556 | }; | |
| 557 | ||
| 558 | pub const timespec = extern struct { | |
| 559 | tv_sec: i32, | |
| 560 | tv_nsec: i32, | |
| 561 | }; | |
| 562 | ||
| 563 | pub const timeval = extern struct { | |
| 564 | tv_sec: i32, | |
| 565 | tv_usec: i32, | |
| 566 | }; | |
| 567 | ||
| 568 | pub const timezone = extern struct { | |
| 569 | tz_minuteswest: i32, | |
| 570 | tz_dsttime: i32, | |
| 571 | }; | |
| 572 | ||
| 573 | pub const Elf_Symndx = u32; |
std/os/linux.zig+132-25| ... | ... | @@ -17,6 +17,7 @@ pub const is_the_target = builtin.os == .linux; |
| 17 | 17 | pub usingnamespace switch (builtin.arch) { |
| 18 | 18 | .x86_64 => @import("linux/x86_64.zig"), |
| 19 | 19 | .aarch64 => @import("linux/arm64.zig"), |
| 20 | .arm => @import("linux/arm-eabi.zig"), | |
| 20 | 21 | .riscv64 => @import("linux/riscv64.zig"), |
| 21 | 22 | else => struct {}, |
| 22 | 23 | }; |
| ... | ... | @@ -190,7 +191,11 @@ pub fn umount2(special: [*]const u8, flags: u32) usize { |
| 190 | 191 | } |
| 191 | 192 | |
| 192 | 193 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: isize) usize { |
| 193 | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, offset)); | |
| 194 | if (@hasDecl(@This(), "SYS_mmap2")) { | |
| 195 | return syscall6(SYS_mmap2, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, @divTrunc(offset, MMAP2_UNIT))); | |
| 196 | } else { | |
| 197 | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, offset)); | |
| 198 | } | |
| 194 | 199 | } |
| 195 | 200 | |
| 196 | 201 | pub fn mprotect(address: [*]const u8, length: usize, protection: usize) usize { |
| ... | ... | @@ -206,11 +211,26 @@ pub fn read(fd: i32, buf: [*]u8, count: usize) usize { |
| 206 | 211 | } |
| 207 | 212 | |
| 208 | 213 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: u64) usize { |
| 209 | return syscall4(SYS_preadv, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); | |
| 214 | return syscall5( | |
| 215 | SYS_preadv, | |
| 216 | @bitCast(usize, isize(fd)), | |
| 217 | @ptrToInt(iov), | |
| 218 | count, | |
| 219 | @truncate(usize, offset), | |
| 220 | @truncate(usize, offset >> 32), | |
| 221 | ); | |
| 210 | 222 | } |
| 211 | 223 | |
| 212 | 224 | pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: u64, flags: kernel_rwf) usize { |
| 213 | return syscall5(SYS_preadv2, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset, flags); | |
| 225 | return syscall6( | |
| 226 | SYS_preadv2, | |
| 227 | @bitCast(usize, isize(fd)), | |
| 228 | @ptrToInt(iov), | |
| 229 | count, | |
| 230 | @truncate(usize, offset), | |
| 231 | @truncate(usize, offset >> 32), | |
| 232 | flags, | |
| 233 | ); | |
| 214 | 234 | } |
| 215 | 235 | |
| 216 | 236 | pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize { |
| ... | ... | @@ -222,11 +242,26 @@ pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { |
| 222 | 242 | } |
| 223 | 243 | |
| 224 | 244 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64) usize { |
| 225 | return syscall4(SYS_pwritev, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); | |
| 245 | return syscall5( | |
| 246 | SYS_pwritev, | |
| 247 | @bitCast(usize, isize(fd)), | |
| 248 | @ptrToInt(iov), | |
| 249 | count, | |
| 250 | @truncate(usize, offset), | |
| 251 | @truncate(usize, offset >> 32), | |
| 252 | ); | |
| 226 | 253 | } |
| 227 | 254 | |
| 228 | 255 | pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64, flags: kernel_rwf) usize { |
| 229 | return syscall5(SYS_pwritev2, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset, flags); | |
| 256 | return syscall6( | |
| 257 | SYS_pwritev2, | |
| 258 | @bitCast(usize, isize(fd)), | |
| 259 | @ptrToInt(iov), | |
| 260 | count, | |
| 261 | @truncate(usize, offset), | |
| 262 | @truncate(usize, offset >> 32), | |
| 263 | flags, | |
| 264 | ); | |
| 230 | 265 | } |
| 231 | 266 | |
| 232 | 267 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | ... | @@ -482,67 +517,123 @@ pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize { |
| 482 | 517 | } |
| 483 | 518 | |
| 484 | 519 | pub fn setuid(uid: u32) usize { |
| 485 | return syscall1(SYS_setuid, uid); | |
| 520 | if (@hasDecl(@This(), "SYS_setuid32")) { | |
| 521 | return syscall1(SYS_setuid32, uid); | |
| 522 | } else { | |
| 523 | return syscall1(SYS_setuid, uid); | |
| 524 | } | |
| 486 | 525 | } |
| 487 | 526 | |
| 488 | 527 | pub fn setgid(gid: u32) usize { |
| 489 | return syscall1(SYS_setgid, gid); | |
| 528 | if (@hasDecl(@This(), "SYS_setgid32")) { | |
| 529 | return syscall1(SYS_setgid32, gid); | |
| 530 | } else { | |
| 531 | return syscall1(SYS_setgid, gid); | |
| 532 | } | |
| 490 | 533 | } |
| 491 | 534 | |
| 492 | 535 | pub fn setreuid(ruid: u32, euid: u32) usize { |
| 493 | return syscall2(SYS_setreuid, ruid, euid); | |
| 536 | if (@hasDecl(@This(), "SYS_setreuid32")) { | |
| 537 | return syscall2(SYS_setreuid32, ruid, euid); | |
| 538 | } else { | |
| 539 | return syscall2(SYS_setreuid, ruid, euid); | |
| 540 | } | |
| 494 | 541 | } |
| 495 | 542 | |
| 496 | 543 | pub fn setregid(rgid: u32, egid: u32) usize { |
| 497 | return syscall2(SYS_setregid, rgid, egid); | |
| 544 | if (@hasDecl(@This(), "SYS_setregid32")) { | |
| 545 | return syscall2(SYS_setregid32, rgid, egid); | |
| 546 | } else { | |
| 547 | return syscall2(SYS_setregid, rgid, egid); | |
| 548 | } | |
| 498 | 549 | } |
| 499 | 550 | |
| 500 | 551 | pub fn getuid() u32 { |
| 501 | return u32(syscall0(SYS_getuid)); | |
| 552 | if (@hasDecl(@This(), "SYS_getuid32")) { | |
| 553 | return u32(syscall0(SYS_getuid32)); | |
| 554 | } else { | |
| 555 | return u32(syscall0(SYS_getuid)); | |
| 556 | } | |
| 502 | 557 | } |
| 503 | 558 | |
| 504 | 559 | pub fn getgid() u32 { |
| 505 | return u32(syscall0(SYS_getgid)); | |
| 560 | if (@hasDecl(@This(), "SYS_getgid32")) { | |
| 561 | return u32(syscall0(SYS_getgid32)); | |
| 562 | } else { | |
| 563 | return u32(syscall0(SYS_getgid)); | |
| 564 | } | |
| 506 | 565 | } |
| 507 | 566 | |
| 508 | 567 | pub fn geteuid() u32 { |
| 509 | return u32(syscall0(SYS_geteuid)); | |
| 568 | if (@hasDecl(@This(), "SYS_geteuid32")) { | |
| 569 | return u32(syscall0(SYS_geteuid32)); | |
| 570 | } else { | |
| 571 | return u32(syscall0(SYS_geteuid)); | |
| 572 | } | |
| 510 | 573 | } |
| 511 | 574 | |
| 512 | 575 | pub fn getegid() u32 { |
| 513 | return u32(syscall0(SYS_getegid)); | |
| 576 | if (@hasDecl(@This(), "SYS_getegid32")) { | |
| 577 | return u32(syscall0(SYS_getegid32)); | |
| 578 | } else { | |
| 579 | return u32(syscall0(SYS_getegid)); | |
| 580 | } | |
| 514 | 581 | } |
| 515 | 582 | |
| 516 | 583 | pub fn seteuid(euid: u32) usize { |
| 517 | return syscall1(SYS_seteuid, euid); | |
| 584 | return setreuid(std.math.maxInt(u32), euid); | |
| 518 | 585 | } |
| 519 | 586 | |
| 520 | 587 | pub fn setegid(egid: u32) usize { |
| 521 | return syscall1(SYS_setegid, egid); | |
| 588 | return setregid(std.math.maxInt(u32), egid); | |
| 522 | 589 | } |
| 523 | 590 | |
| 524 | 591 | pub fn getresuid(ruid: *u32, euid: *u32, suid: *u32) usize { |
| 525 | return syscall3(SYS_getresuid, @ptrToInt(ruid), @ptrToInt(euid), @ptrToInt(suid)); | |
| 592 | if (@hasDecl(@This(), "SYS_getresuid32")) { | |
| 593 | return syscall3(SYS_getresuid32, @ptrToInt(ruid), @ptrToInt(euid), @ptrToInt(suid)); | |
| 594 | } else { | |
| 595 | return syscall3(SYS_getresuid, @ptrToInt(ruid), @ptrToInt(euid), @ptrToInt(suid)); | |
| 596 | } | |
| 526 | 597 | } |
| 527 | 598 | |
| 528 | 599 | pub fn getresgid(rgid: *u32, egid: *u32, sgid: *u32) usize { |
| 529 | return syscall3(SYS_getresgid, @ptrToInt(rgid), @ptrToInt(egid), @ptrToInt(sgid)); | |
| 600 | if (@hasDecl(@This(), "SYS_getresgid32")) { | |
| 601 | return syscall3(SYS_getresgid32, @ptrToInt(rgid), @ptrToInt(egid), @ptrToInt(sgid)); | |
| 602 | } else { | |
| 603 | return syscall3(SYS_getresgid, @ptrToInt(rgid), @ptrToInt(egid), @ptrToInt(sgid)); | |
| 604 | } | |
| 530 | 605 | } |
| 531 | 606 | |
| 532 | 607 | pub fn setresuid(ruid: u32, euid: u32, suid: u32) usize { |
| 533 | return syscall3(SYS_setresuid, ruid, euid, suid); | |
| 608 | if (@hasDecl(@This(), "SYS_setresuid32")) { | |
| 609 | return syscall3(SYS_setresuid32, ruid, euid, suid); | |
| 610 | } else { | |
| 611 | return syscall3(SYS_setresuid, ruid, euid, suid); | |
| 612 | } | |
| 534 | 613 | } |
| 535 | 614 | |
| 536 | 615 | pub fn setresgid(rgid: u32, egid: u32, sgid: u32) usize { |
| 537 | return syscall3(SYS_setresgid, rgid, egid, sgid); | |
| 616 | if (@hasDecl(@This(), "SYS_setresgid32")) { | |
| 617 | return syscall3(SYS_setresgid32, rgid, egid, sgid); | |
| 618 | } else { | |
| 619 | return syscall3(SYS_setresgid, rgid, egid, sgid); | |
| 620 | } | |
| 538 | 621 | } |
| 539 | 622 | |
| 540 | 623 | pub fn getgroups(size: usize, list: *u32) usize { |
| 541 | return syscall2(SYS_getgroups, size, @ptrToInt(list)); | |
| 624 | if (@hasDecl(@This(), "SYS_getgroups32")) { | |
| 625 | return syscall2(SYS_getgroups32, size, @ptrToInt(list)); | |
| 626 | } else { | |
| 627 | return syscall2(SYS_getgroups, size, @ptrToInt(list)); | |
| 628 | } | |
| 542 | 629 | } |
| 543 | 630 | |
| 544 | 631 | pub fn setgroups(size: usize, list: *const u32) usize { |
| 545 | return syscall2(SYS_setgroups, size, @ptrToInt(list)); | |
| 632 | if (@hasDecl(@This(), "SYS_setgroups32")) { | |
| 633 | return syscall2(SYS_setgroups32, size, @ptrToInt(list)); | |
| 634 | } else { | |
| 635 | return syscall2(SYS_setgroups, size, @ptrToInt(list)); | |
| 636 | } | |
| 546 | 637 | } |
| 547 | 638 | |
| 548 | 639 | pub fn getpid() i32 { |
| ... | ... | @@ -709,22 +800,38 @@ pub fn accept4(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t, flags: |
| 709 | 800 | } |
| 710 | 801 | |
| 711 | 802 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { |
| 712 | return syscall2(SYS_fstat, @bitCast(usize, isize(fd)), @ptrToInt(stat_buf)); | |
| 803 | if (@hasDecl(@This(), "SYS_fstat64")) { | |
| 804 | return syscall2(SYS_fstat64, @bitCast(usize, isize(fd)), @ptrToInt(stat_buf)); | |
| 805 | } else { | |
| 806 | return syscall2(SYS_fstat, @bitCast(usize, isize(fd)), @ptrToInt(stat_buf)); | |
| 807 | } | |
| 713 | 808 | } |
| 714 | 809 | |
| 715 | 810 | // TODO https://github.com/ziglang/zig/issues/265 |
| 716 | 811 | pub fn stat(pathname: [*]const u8, statbuf: *Stat) usize { |
| 717 | return syscall2(SYS_stat, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 812 | if (@hasDecl(@This(), "SYS_stat64")) { | |
| 813 | return syscall2(SYS_stat64, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 814 | } else { | |
| 815 | return syscall2(SYS_stat, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 816 | } | |
| 718 | 817 | } |
| 719 | 818 | |
| 720 | 819 | // TODO https://github.com/ziglang/zig/issues/265 |
| 721 | 820 | pub fn lstat(pathname: [*]const u8, statbuf: *Stat) usize { |
| 722 | return syscall2(SYS_lstat, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 821 | if (@hasDecl(@This(), "SYS_lstat64")) { | |
| 822 | return syscall2(SYS_lstat64, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 823 | } else { | |
| 824 | return syscall2(SYS_lstat, @ptrToInt(pathname), @ptrToInt(statbuf)); | |
| 825 | } | |
| 723 | 826 | } |
| 724 | 827 | |
| 725 | 828 | // TODO https://github.com/ziglang/zig/issues/265 |
| 726 | 829 | pub fn fstatat(dirfd: i32, path: [*]const u8, stat_buf: *Stat, flags: u32) usize { |
| 727 | return syscall4(SYS_fstatat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); | |
| 830 | if (@hasDecl(@This(), "SYS_fstatat64")) { | |
| 831 | return syscall4(SYS_fstatat64, @bitCast(usize, isize(dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); | |
| 832 | } else { | |
| 833 | return syscall4(SYS_fstatat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); | |
| 834 | } | |
| 728 | 835 | } |
| 729 | 836 | |
| 730 | 837 | // TODO https://github.com/ziglang/zig/issues/265 |
std/os/linux/arm-eabi.zig created+96| ... | ... | @@ -0,0 +1,96 @@ |
| 1 | pub fn syscall0(number: usize) usize { | |
| 2 | return asm volatile ("svc #0" | |
| 3 | : [ret] "={r0}" (-> usize) | |
| 4 | : [number] "{r7}" (number) | |
| 5 | : "memory" | |
| 6 | ); | |
| 7 | } | |
| 8 | ||
| 9 | pub fn syscall1(number: usize, arg1: usize) usize { | |
| 10 | return asm volatile ("svc #0" | |
| 11 | : [ret] "={r0}" (-> usize) | |
| 12 | : [number] "{r7}" (number), | |
| 13 | [arg1] "{r0}" (arg1) | |
| 14 | : "memory" | |
| 15 | ); | |
| 16 | } | |
| 17 | ||
| 18 | pub fn syscall2(number: usize, arg1: usize, arg2: usize) usize { | |
| 19 | return asm volatile ("svc #0" | |
| 20 | : [ret] "={r0}" (-> usize) | |
| 21 | : [number] "{r7}" (number), | |
| 22 | [arg1] "{r0}" (arg1), | |
| 23 | [arg2] "{r1}" (arg2) | |
| 24 | : "memory" | |
| 25 | ); | |
| 26 | } | |
| 27 | ||
| 28 | pub fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) usize { | |
| 29 | return asm volatile ("svc #0" | |
| 30 | : [ret] "={r0}" (-> usize) | |
| 31 | : [number] "{r7}" (number), | |
| 32 | [arg1] "{r0}" (arg1), | |
| 33 | [arg2] "{r1}" (arg2), | |
| 34 | [arg3] "{r2}" (arg3) | |
| 35 | : "memory" | |
| 36 | ); | |
| 37 | } | |
| 38 | ||
| 39 | pub fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | |
| 40 | return asm volatile ("svc #0" | |
| 41 | : [ret] "={r0}" (-> usize) | |
| 42 | : [number] "{r7}" (number), | |
| 43 | [arg1] "{r0}" (arg1), | |
| 44 | [arg2] "{r1}" (arg2), | |
| 45 | [arg3] "{r2}" (arg3), | |
| 46 | [arg4] "{r3}" (arg4) | |
| 47 | : "memory" | |
| 48 | ); | |
| 49 | } | |
| 50 | ||
| 51 | pub fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | |
| 52 | return asm volatile ("svc #0" | |
| 53 | : [ret] "={r0}" (-> usize) | |
| 54 | : [number] "{r7}" (number), | |
| 55 | [arg1] "{r0}" (arg1), | |
| 56 | [arg2] "{r1}" (arg2), | |
| 57 | [arg3] "{r2}" (arg3), | |
| 58 | [arg4] "{r3}" (arg4), | |
| 59 | [arg5] "{r4}" (arg5) | |
| 60 | : "memory" | |
| 61 | ); | |
| 62 | } | |
| 63 | ||
| 64 | pub fn syscall6( | |
| 65 | number: usize, | |
| 66 | arg1: usize, | |
| 67 | arg2: usize, | |
| 68 | arg3: usize, | |
| 69 | arg4: usize, | |
| 70 | arg5: usize, | |
| 71 | arg6: usize, | |
| 72 | ) usize { | |
| 73 | return asm volatile ("svc #0" | |
| 74 | : [ret] "={r0}" (-> usize) | |
| 75 | : [number] "{r7}" (number), | |
| 76 | [arg1] "{r0}" (arg1), | |
| 77 | [arg2] "{r1}" (arg2), | |
| 78 | [arg3] "{r2}" (arg3), | |
| 79 | [arg4] "{r3}" (arg4), | |
| 80 | [arg5] "{r4}" (arg5), | |
| 81 | [arg6] "{r5}" (arg6) | |
| 82 | : "memory" | |
| 83 | ); | |
| 84 | } | |
| 85 | ||
| 86 | /// This matches the libc clone function. | |
| 87 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | |
| 88 | ||
| 89 | // LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass | |
| 90 | // that to llvm via zig, see https://github.com/ziglang/zig/issues/2883. | |
| 91 | // LLVM expects libc to provide this function as __aeabi_read_tp, so it is exported if needed from special/c.zig. | |
| 92 | pub extern fn getThreadPointer() usize { | |
| 93 | return asm volatile("mrc p15, 0, %[ret], c13, c0, 3" | |
| 94 | : [ret] "=r" (-> usize) | |
| 95 | ); | |
| 96 | } | |
| \ No newline at end of file |
std/os/linux/arm64.zig+7-7| ... | ... | @@ -2,7 +2,7 @@ pub fn syscall0(number: usize) usize { |
| 2 | 2 | return asm volatile ("svc #0" |
| 3 | 3 | : [ret] "={x0}" (-> usize) |
| 4 | 4 | : [number] "{x8}" (number) |
| 5 | : "memory" | |
| 5 | : "memory", "cc" | |
| 6 | 6 | ); |
| 7 | 7 | } |
| 8 | 8 | |
| ... | ... | @@ -11,7 +11,7 @@ pub fn syscall1(number: usize, arg1: usize) usize { |
| 11 | 11 | : [ret] "={x0}" (-> usize) |
| 12 | 12 | : [number] "{x8}" (number), |
| 13 | 13 | [arg1] "{x0}" (arg1) |
| 14 | : "memory" | |
| 14 | : "memory", "cc" | |
| 15 | 15 | ); |
| 16 | 16 | } |
| 17 | 17 | |
| ... | ... | @@ -21,7 +21,7 @@ pub fn syscall2(number: usize, arg1: usize, arg2: usize) usize { |
| 21 | 21 | : [number] "{x8}" (number), |
| 22 | 22 | [arg1] "{x0}" (arg1), |
| 23 | 23 | [arg2] "{x1}" (arg2) |
| 24 | : "memory" | |
| 24 | : "memory", "cc" | |
| 25 | 25 | ); |
| 26 | 26 | } |
| 27 | 27 | |
| ... | ... | @@ -32,7 +32,7 @@ pub fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) usize { |
| 32 | 32 | [arg1] "{x0}" (arg1), |
| 33 | 33 | [arg2] "{x1}" (arg2), |
| 34 | 34 | [arg3] "{x2}" (arg3) |
| 35 | : "memory" | |
| 35 | : "memory", "cc" | |
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
| ... | ... | @@ -44,7 +44,7 @@ pub fn syscall4(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usiz |
| 44 | 44 | [arg2] "{x1}" (arg2), |
| 45 | 45 | [arg3] "{x2}" (arg3), |
| 46 | 46 | [arg4] "{x3}" (arg4) |
| 47 | : "memory" | |
| 47 | : "memory", "cc" | |
| 48 | 48 | ); |
| 49 | 49 | } |
| 50 | 50 | |
| ... | ... | @@ -57,7 +57,7 @@ pub fn syscall5(number: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usiz |
| 57 | 57 | [arg3] "{x2}" (arg3), |
| 58 | 58 | [arg4] "{x3}" (arg4), |
| 59 | 59 | [arg5] "{x4}" (arg5) |
| 60 | : "memory" | |
| 60 | : "memory", "cc" | |
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall6( |
| 79 | 79 | [arg4] "{x3}" (arg4), |
| 80 | 80 | [arg5] "{x4}" (arg5), |
| 81 | 81 | [arg6] "{x5}" (arg6) |
| 82 | : "memory" | |
| 82 | : "memory", "cc" | |
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 |
std/os/linux/tls.zig+13| ... | ... | @@ -118,6 +118,9 @@ pub fn setThreadPointer(addr: usize) void { |
| 118 | 118 | : [addr] "r" (addr) |
| 119 | 119 | ); |
| 120 | 120 | }, |
| 121 | .arm => |arm| { | |
| 122 | _ = std.os.linux.syscall1(std.os.linux.SYS_set_tls, addr); | |
| 123 | }, | |
| 121 | 124 | .riscv64 => { |
| 122 | 125 | asm volatile ( |
| 123 | 126 | \\ mv tp, %[addr] |
| ... | ... | @@ -137,6 +140,7 @@ pub fn initTLS() void { |
| 137 | 140 | var at_phent: usize = undefined; |
| 138 | 141 | var at_phnum: usize = undefined; |
| 139 | 142 | var at_phdr: usize = undefined; |
| 143 | var at_hwcap: usize = undefined; | |
| 140 | 144 | |
| 141 | 145 | var i: usize = 0; |
| 142 | 146 | while (auxv[i].a_type != std.elf.AT_NULL) : (i += 1) { |
| ... | ... | @@ -144,6 +148,7 @@ pub fn initTLS() void { |
| 144 | 148 | elf.AT_PHENT => at_phent = auxv[i].a_un.a_val, |
| 145 | 149 | elf.AT_PHNUM => at_phnum = auxv[i].a_un.a_val, |
| 146 | 150 | elf.AT_PHDR => at_phdr = auxv[i].a_un.a_val, |
| 151 | elf.AT_HWCAP => at_hwcap = auxv[i].a_un.a_val, | |
| 147 | 152 | else => continue, |
| 148 | 153 | } |
| 149 | 154 | } |
| ... | ... | @@ -163,6 +168,14 @@ pub fn initTLS() void { |
| 163 | 168 | } |
| 164 | 169 | |
| 165 | 170 | if (tls_phdr) |phdr| { |
| 171 | // If the cpu is arm-based, check if it supports the TLS register | |
| 172 | if (builtin.arch == builtin.Arch.arm and at_hwcap & std.os.linux.HWCAP_TLS == 0) { | |
| 173 | // If the CPU does not support TLS via a coprocessor register, | |
| 174 | // a kernel helper function can be used instead on certain linux kernels. | |
| 175 | // See linux/arch/arm/include/asm/tls.h and musl/src/thread/arm/__set_thread_area.c. | |
| 176 | @panic("TODO: Implement ARM fallback TLS functionality"); | |
| 177 | } | |
| 178 | ||
| 166 | 179 | // Offsets into the allocated TLS area |
| 167 | 180 | var tcb_offset: usize = undefined; |
| 168 | 181 | var dtv_offset: usize = undefined; |
std/special/build_runner.zig+2| ... | ... | @@ -123,6 +123,7 @@ pub fn main() !void { |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | builder.resolveInstallPrefix(); | |
| 126 | 127 | try runBuild(builder); |
| 127 | 128 | |
| 128 | 129 | if (builder.validateUserInputDidItFail()) |
| ... | ... | @@ -151,6 +152,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void { |
| 151 | 152 | // run the build script to collect the options |
| 152 | 153 | if (!already_ran_build) { |
| 153 | 154 | builder.setInstallPrefix(null); |
| 155 | builder.resolveInstallPrefix(); | |
| 154 | 156 | try runBuild(builder); |
| 155 | 157 | } |
| 156 | 158 |
std/special/c.zig+31| ... | ... | @@ -31,6 +31,8 @@ comptime { |
| 31 | 31 | @export("strlen", strlen, .Strong); |
| 32 | 32 | } else if (is_msvc) { |
| 33 | 33 | @export("_fltused", _fltused, .Strong); |
| 34 | } else if (builtin.arch == builtin.Arch.arm and builtin.os == .linux) { | |
| 35 | @export("__aeabi_read_tp", std.os.linux.getThreadPointer, .Strong); | |
| 34 | 36 | } |
| 35 | 37 | } |
| 36 | 38 | |
| ... | ... | @@ -249,6 +251,35 @@ nakedcc fn clone() void { |
| 249 | 251 | \\ mov x8,#93 // SYS_exit |
| 250 | 252 | \\ svc #0 |
| 251 | 253 | ); |
| 254 | } else if (builtin.arch == builtin.Arch.arm) { | |
| 255 | asm volatile ( | |
| 256 | \\ stmfd sp!,{r4,r5,r6,r7} | |
| 257 | \\ mov r7,#120 | |
| 258 | \\ mov r6,r3 | |
| 259 | \\ mov r5,r0 | |
| 260 | \\ mov r0,r2 | |
| 261 | \\ and r1,r1,#-16 | |
| 262 | \\ ldr r2,[sp,#16] | |
| 263 | \\ ldr r3,[sp,#20] | |
| 264 | \\ ldr r4,[sp,#24] | |
| 265 | \\ svc 0 | |
| 266 | \\ tst r0,r0 | |
| 267 | \\ beq 1f | |
| 268 | \\ ldmfd sp!,{r4,r5,r6,r7} | |
| 269 | \\ bx lr | |
| 270 | \\ | |
| 271 | \\1: mov r0,r6 | |
| 272 | \\ tst r5,#1 | |
| 273 | \\ bne 1f | |
| 274 | \\ mov lr,pc | |
| 275 | \\ mov pc,r5 | |
| 276 | \\2: mov r7,#1 | |
| 277 | \\ svc 0 | |
| 278 | \\ | |
| 279 | \\1: mov lr,pc | |
| 280 | \\ bx r5 | |
| 281 | \\ b 2b | |
| 282 | ); | |
| 252 | 283 | } else { |
| 253 | 284 | @compileError("Implement clone() for this arch."); |
| 254 | 285 | } |
std/special/start.zig+1-1| ... | ... | @@ -44,7 +44,7 @@ nakedcc fn _start() noreturn { |
| 44 | 44 | : [argc] "={esp}" (-> [*]usize) |
| 45 | 45 | ); |
| 46 | 46 | }, |
| 47 | .aarch64, .aarch64_be => { | |
| 47 | .aarch64, .aarch64_be, .arm => { | |
| 48 | 48 | argc_ptr = asm ("mov %[argc], sp" |
| 49 | 49 | : [argc] "=r" (-> [*]usize) |
| 50 | 50 | ); |
std/std.zig+3| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | pub const AlignedArrayList = @import("array_list.zig").AlignedArrayList; |
| 2 | 2 | pub const ArrayList = @import("array_list.zig").ArrayList; |
| 3 | 3 | pub const AutoHashMap = @import("hash_map.zig").AutoHashMap; |
| 4 | pub const BloomFilter = @import("bloom_filter.zig").BloomFilter; | |
| 4 | 5 | pub const BufMap = @import("buf_map.zig").BufMap; |
| 5 | 6 | pub const BufSet = @import("buf_set.zig").BufSet; |
| 6 | 7 | pub const Buffer = @import("buffer.zig").Buffer; |
| ... | ... | @@ -48,6 +49,7 @@ pub const mem = @import("mem.zig"); |
| 48 | 49 | pub const meta = @import("meta.zig"); |
| 49 | 50 | pub const net = @import("net.zig"); |
| 50 | 51 | pub const os = @import("os.zig"); |
| 52 | pub const packed_int_array = @import("packed_int_array.zig"); | |
| 51 | 53 | pub const pdb = @import("pdb.zig"); |
| 52 | 54 | pub const process = @import("process.zig"); |
| 53 | 55 | pub const rand = @import("rand.zig"); |
| ... | ... | @@ -64,6 +66,7 @@ test "std" { |
| 64 | 66 | // run tests from these |
| 65 | 67 | _ = @import("array_list.zig"); |
| 66 | 68 | _ = @import("atomic.zig"); |
| 69 | _ = @import("bloom_filter.zig"); | |
| 67 | 70 | _ = @import("buf_map.zig"); |
| 68 | 71 | _ = @import("buf_set.zig"); |
| 69 | 72 | _ = @import("buffer.zig"); |
std/zig/parse.zig+4-2| ... | ... | @@ -201,7 +201,7 @@ fn parseTopLevelComptime(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?* |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /// TopLevelDecl |
| 204 | /// <- (KEYWORD_export / KEYWORD_extern STRINGLITERAL? / KEYWORD_inline)? FnProto (SEMICOLON / Block) | |
| 204 | /// <- (KEYWORD_export / KEYWORD_extern STRINGLITERAL? / (KEYWORD_inline / KEYWORD_noinline))? FnProto (SEMICOLON / Block) | |
| 205 | 205 | /// / (KEYWORD_export / KEYWORD_extern STRINGLITERAL?)? KEYWORD_threadlocal? VarDecl |
| 206 | 206 | /// / KEYWORD_usingnamespace Expr SEMICOLON |
| 207 | 207 | fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| ... | ... | @@ -213,6 +213,7 @@ fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 213 | 213 | break :blk token; |
| 214 | 214 | } |
| 215 | 215 | if (eatToken(it, .Keyword_inline)) |token| break :blk token; |
| 216 | if (eatToken(it, .Keyword_noinline)) |token| break :blk token; | |
| 216 | 217 | break :blk null; |
| 217 | 218 | }; |
| 218 | 219 | |
| ... | ... | @@ -232,7 +233,8 @@ fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 232 | 233 | } |
| 233 | 234 | |
| 234 | 235 | if (extern_export_inline_token) |token| { |
| 235 | if (tree.tokens.at(token).id == .Keyword_inline) { | |
| 236 | if (tree.tokens.at(token).id == .Keyword_inline or | |
| 237 | tree.tokens.at(token).id == .Keyword_noinline) { | |
| 236 | 238 | putBackToken(it, token); |
| 237 | 239 | return null; |
| 238 | 240 | } |
std/zig/parser_test.zig+91| ... | ... | @@ -1677,14 +1677,17 @@ test "zig fmt: functions" { |
| 1677 | 1677 | \\extern "c" fn puts(s: *const u8) c_int; |
| 1678 | 1678 | \\export fn puts(s: *const u8) c_int; |
| 1679 | 1679 | \\inline fn puts(s: *const u8) c_int; |
| 1680 | \\noinline fn puts(s: *const u8) c_int; | |
| 1680 | 1681 | \\pub extern fn puts(s: *const u8) c_int; |
| 1681 | 1682 | \\pub extern "c" fn puts(s: *const u8) c_int; |
| 1682 | 1683 | \\pub export fn puts(s: *const u8) c_int; |
| 1683 | 1684 | \\pub inline fn puts(s: *const u8) c_int; |
| 1685 | \\pub noinline fn puts(s: *const u8) c_int; | |
| 1684 | 1686 | \\pub extern fn puts(s: *const u8) align(2 + 2) c_int; |
| 1685 | 1687 | \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int; |
| 1686 | 1688 | \\pub export fn puts(s: *const u8) align(2 + 2) c_int; |
| 1687 | 1689 | \\pub inline fn puts(s: *const u8) align(2 + 2) c_int; |
| 1690 | \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int; | |
| 1688 | 1691 | \\ |
| 1689 | 1692 | ); |
| 1690 | 1693 | } |
| ... | ... | @@ -2419,6 +2422,94 @@ test "zig fmt: comment after empty comment" { |
| 2419 | 2422 | ); |
| 2420 | 2423 | } |
| 2421 | 2424 | |
| 2425 | test "zig fmt: line comment in array" { | |
| 2426 | try testTransform( | |
| 2427 | \\test "a" { | |
| 2428 | \\ var arr = [_]u32{ | |
| 2429 | \\ 0 | |
| 2430 | \\ // 1, | |
| 2431 | \\ // 2, | |
| 2432 | \\ }; | |
| 2433 | \\} | |
| 2434 | \\ | |
| 2435 | , | |
| 2436 | \\test "a" { | |
| 2437 | \\ var arr = [_]u32{ | |
| 2438 | \\ 0, // 1, | |
| 2439 | \\ // 2, | |
| 2440 | \\ }; | |
| 2441 | \\} | |
| 2442 | \\ | |
| 2443 | ); | |
| 2444 | try testCanonical( | |
| 2445 | \\test "a" { | |
| 2446 | \\ var arr = [_]u32{ | |
| 2447 | \\ 0, | |
| 2448 | \\ // 1, | |
| 2449 | \\ // 2, | |
| 2450 | \\ }; | |
| 2451 | \\} | |
| 2452 | \\ | |
| 2453 | ); | |
| 2454 | } | |
| 2455 | ||
| 2456 | test "zig fmt: comment after params" { | |
| 2457 | try testTransform( | |
| 2458 | \\fn a( | |
| 2459 | \\ b: u32 | |
| 2460 | \\ // c: u32, | |
| 2461 | \\ // d: u32, | |
| 2462 | \\) void {} | |
| 2463 | \\ | |
| 2464 | , | |
| 2465 | \\fn a( | |
| 2466 | \\ b: u32, // c: u32, | |
| 2467 | \\ // d: u32, | |
| 2468 | \\) void {} | |
| 2469 | \\ | |
| 2470 | ); | |
| 2471 | try testCanonical( | |
| 2472 | \\fn a( | |
| 2473 | \\ b: u32, | |
| 2474 | \\ // c: u32, | |
| 2475 | \\ // d: u32, | |
| 2476 | \\) void {} | |
| 2477 | \\ | |
| 2478 | ); | |
| 2479 | } | |
| 2480 | ||
| 2481 | test "zig fmt: comment in array initializer/access" { | |
| 2482 | try testCanonical( | |
| 2483 | \\test "a" { | |
| 2484 | \\ var a = x{ //aa | |
| 2485 | \\ //bb | |
| 2486 | \\ }; | |
| 2487 | \\ var a = []x{ //aa | |
| 2488 | \\ //bb | |
| 2489 | \\ }; | |
| 2490 | \\ var b = [ //aa | |
| 2491 | \\ _ | |
| 2492 | \\ ]x{ //aa | |
| 2493 | \\ //bb | |
| 2494 | \\ 9, | |
| 2495 | \\ }; | |
| 2496 | \\ var c = b[ //aa | |
| 2497 | \\ 0 | |
| 2498 | \\ ]; | |
| 2499 | \\ var d = [_ | |
| 2500 | \\ //aa | |
| 2501 | \\ ]x{ //aa | |
| 2502 | \\ //bb | |
| 2503 | \\ 9, | |
| 2504 | \\ }; | |
| 2505 | \\ var e = d[0 | |
| 2506 | \\ //aa | |
| 2507 | \\ ]; | |
| 2508 | \\} | |
| 2509 | \\ | |
| 2510 | ); | |
| 2511 | } | |
| 2512 | ||
| 2422 | 2513 | test "zig fmt: comments at several places in struct init" { |
| 2423 | 2514 | try testTransform( |
| 2424 | 2515 | \\var bar = Bar{ |
std/zig/render.zig+34-9| ... | ... | @@ -483,9 +483,23 @@ fn renderExpression( |
| 483 | 483 | }, |
| 484 | 484 | |
| 485 | 485 | ast.Node.PrefixOp.Op.ArrayType => |array_index| { |
| 486 | try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.None); // [ | |
| 487 | try renderExpression(allocator, stream, tree, indent, start_col, array_index, Space.None); | |
| 488 | try renderToken(tree, stream, tree.nextToken(array_index.lastToken()), indent, start_col, Space.None); // ] | |
| 486 | const lbracket = prefix_op_node.op_token; | |
| 487 | const rbracket = tree.nextToken(array_index.lastToken()); | |
| 488 | ||
| 489 | try renderToken(tree, stream, lbracket, indent, start_col, Space.None); // [ | |
| 490 | ||
| 491 | const starts_with_comment = tree.tokens.at(lbracket + 1).id == .LineComment; | |
| 492 | const ends_with_comment = tree.tokens.at(rbracket - 1).id == .LineComment; | |
| 493 | const new_indent = if (ends_with_comment) indent + indent_delta else indent; | |
| 494 | const new_space = if (ends_with_comment) Space.Newline else Space.None; | |
| 495 | try renderExpression(allocator, stream, tree, new_indent, start_col, array_index, new_space); | |
| 496 | if (starts_with_comment) { | |
| 497 | try stream.writeByte('\n'); | |
| 498 | } | |
| 499 | if (ends_with_comment or starts_with_comment) { | |
| 500 | try stream.writeByteNTimes(' ', indent); | |
| 501 | } | |
| 502 | try renderToken(tree, stream, rbracket, indent, start_col, Space.None); // ] | |
| 489 | 503 | }, |
| 490 | 504 | ast.Node.PrefixOp.Op.BitNot, |
| 491 | 505 | ast.Node.PrefixOp.Op.BoolNot, |
| ... | ... | @@ -580,7 +594,18 @@ fn renderExpression( |
| 580 | 594 | |
| 581 | 595 | try renderExpression(allocator, stream, tree, indent, start_col, suffix_op.lhs, Space.None); |
| 582 | 596 | try renderToken(tree, stream, lbracket, indent, start_col, Space.None); // [ |
| 583 | try renderExpression(allocator, stream, tree, indent, start_col, index_expr, Space.None); | |
| 597 | ||
| 598 | const starts_with_comment = tree.tokens.at(lbracket + 1).id == .LineComment; | |
| 599 | const ends_with_comment = tree.tokens.at(rbracket - 1).id == .LineComment; | |
| 600 | const new_indent = if (ends_with_comment) indent + indent_delta else indent; | |
| 601 | const new_space = if (ends_with_comment) Space.Newline else Space.None; | |
| 602 | try renderExpression(allocator, stream, tree, new_indent, start_col, index_expr, new_space); | |
| 603 | if (starts_with_comment) { | |
| 604 | try stream.writeByte('\n'); | |
| 605 | } | |
| 606 | if (ends_with_comment or starts_with_comment) { | |
| 607 | try stream.writeByteNTimes(' ', indent); | |
| 608 | } | |
| 584 | 609 | return renderToken(tree, stream, rbracket, indent, start_col, space); // ] |
| 585 | 610 | }, |
| 586 | 611 | |
| ... | ... | @@ -615,7 +640,7 @@ fn renderExpression( |
| 615 | 640 | |
| 616 | 641 | if (field_inits.len == 0) { |
| 617 | 642 | try renderExpression(allocator, stream, tree, indent, start_col, suffix_op.lhs, Space.None); |
| 618 | try renderToken(tree, stream, lbrace, indent, start_col, Space.None); | |
| 643 | try renderToken(tree, stream, lbrace, indent + indent_delta, start_col, Space.None); | |
| 619 | 644 | return renderToken(tree, stream, suffix_op.rtoken, indent, start_col, space); |
| 620 | 645 | } |
| 621 | 646 | |
| ... | ... | @@ -714,7 +739,7 @@ fn renderExpression( |
| 714 | 739 | try renderToken(tree, stream, lbrace, indent, start_col, Space.None); |
| 715 | 740 | return renderToken(tree, stream, suffix_op.rtoken, indent, start_col, space); |
| 716 | 741 | } |
| 717 | if (exprs.len == 1) { | |
| 742 | if (exprs.len == 1 and tree.tokens.at(exprs.at(0).*.lastToken() + 1).id == .RBrace) { | |
| 718 | 743 | const expr = exprs.at(0).*; |
| 719 | 744 | |
| 720 | 745 | try renderExpression(allocator, stream, tree, indent, start_col, suffix_op.lhs, Space.None); |
| ... | ... | @@ -775,7 +800,7 @@ fn renderExpression( |
| 775 | 800 | while (it.next()) |expr| : (i += 1) { |
| 776 | 801 | counting_stream.bytes_written = 0; |
| 777 | 802 | var dummy_col: usize = 0; |
| 778 | try renderExpression(allocator, &counting_stream.stream, tree, 0, &dummy_col, expr.*, Space.None); | |
| 803 | try renderExpression(allocator, &counting_stream.stream, tree, indent, &dummy_col, expr.*, Space.None); | |
| 779 | 804 | const width = @intCast(usize, counting_stream.bytes_written); |
| 780 | 805 | const col = i % row_size; |
| 781 | 806 | column_widths[col] = std.math.max(column_widths[col], width); |
| ... | ... | @@ -1191,8 +1216,8 @@ fn renderExpression( |
| 1191 | 1216 | }); |
| 1192 | 1217 | |
| 1193 | 1218 | const src_params_trailing_comma = blk: { |
| 1194 | const maybe_comma = tree.prevToken(rparen); | |
| 1195 | break :blk tree.tokens.at(maybe_comma).id == Token.Id.Comma; | |
| 1219 | const maybe_comma = tree.tokens.at(rparen - 1).id; | |
| 1220 | break :blk maybe_comma == .Comma or maybe_comma == .LineComment; | |
| 1196 | 1221 | }; |
| 1197 | 1222 | |
| 1198 | 1223 | if (!src_params_trailing_comma) { |
std/zig/tokenizer.zig+4| ... | ... | @@ -38,6 +38,8 @@ pub const Token = struct { |
| 38 | 38 | Keyword{ .bytes = "inline", .id = Id.Keyword_inline }, |
| 39 | 39 | Keyword{ .bytes = "nakedcc", .id = Id.Keyword_nakedcc }, |
| 40 | 40 | Keyword{ .bytes = "noalias", .id = Id.Keyword_noalias }, |
| 41 | Keyword{ .bytes = "noasync", .id = Id.Keyword_noasync }, | |
| 42 | Keyword{ .bytes = "noinline", .id = Id.Keyword_noinline }, | |
| 41 | 43 | Keyword{ .bytes = "null", .id = Id.Keyword_null }, |
| 42 | 44 | Keyword{ .bytes = "or", .id = Id.Keyword_or }, |
| 43 | 45 | Keyword{ .bytes = "orelse", .id = Id.Keyword_orelse }, |
| ... | ... | @@ -168,6 +170,8 @@ pub const Token = struct { |
| 168 | 170 | Keyword_inline, |
| 169 | 171 | Keyword_nakedcc, |
| 170 | 172 | Keyword_noalias, |
| 173 | Keyword_noasync, | |
| 174 | Keyword_noinline, | |
| 171 | 175 | Keyword_null, |
| 172 | 176 | Keyword_or, |
| 173 | 177 | Keyword_orelse, |
test/compile_errors.zig+105| ... | ... | @@ -2,6 +2,71 @@ const tests = @import("tests.zig"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | |
| 4 | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 5 | cases.add( | |
| 6 | "attempt to negate a non-integer, non-float or non-vector type", | |
| 7 | \\fn foo() anyerror!u32 { | |
| 8 | \\ return 1; | |
| 9 | \\} | |
| 10 | \\ | |
| 11 | \\export fn entry() void { | |
| 12 | \\ const x = -foo(); | |
| 13 | \\} | |
| 14 | , | |
| 15 | "tmp.zig:6:15: error: negation of type 'anyerror!u32'", | |
| 16 | ); | |
| 17 | ||
| 18 | cases.add( | |
| 19 | "attempt to create 17 bit float type", | |
| 20 | \\const builtin = @import("builtin"); | |
| 21 | \\comptime { | |
| 22 | \\ _ = @Type(builtin.TypeInfo { .Float = builtin.TypeInfo.Float { .bits = 17 } }); | |
| 23 | \\} | |
| 24 | , | |
| 25 | "tmp.zig:3:32: error: 17-bit float unsupported", | |
| 26 | ); | |
| 27 | ||
| 28 | cases.add( | |
| 29 | "wrong type for @Type", | |
| 30 | \\export fn entry() void { | |
| 31 | \\ _ = @Type(0); | |
| 32 | \\} | |
| 33 | , | |
| 34 | "tmp.zig:2:15: error: expected type 'builtin.TypeInfo', found 'comptime_int'", | |
| 35 | ); | |
| 36 | ||
| 37 | cases.add( | |
| 38 | "@Type with non-constant expression", | |
| 39 | \\const builtin = @import("builtin"); | |
| 40 | \\var globalTypeInfo : builtin.TypeInfo = undefined; | |
| 41 | \\export fn entry() void { | |
| 42 | \\ _ = @Type(globalTypeInfo); | |
| 43 | \\} | |
| 44 | , | |
| 45 | "tmp.zig:4:15: error: unable to evaluate constant expression", | |
| 46 | ); | |
| 47 | ||
| 48 | cases.add( | |
| 49 | "@Type with TypeInfo.Int", | |
| 50 | \\const builtin = @import("builtin"); | |
| 51 | \\export fn entry() void { | |
| 52 | \\ _ = @Type(builtin.TypeInfo.Int { | |
| 53 | \\ .is_signed = true, | |
| 54 | \\ .bits = 8, | |
| 55 | \\ }); | |
| 56 | \\} | |
| 57 | , | |
| 58 | "tmp.zig:3:36: error: expected type 'builtin.TypeInfo', found 'builtin.Int'", | |
| 59 | ); | |
| 60 | ||
| 61 | cases.add( | |
| 62 | "Struct unavailable for @Type", | |
| 63 | \\export fn entry() void { | |
| 64 | \\ _ = @Type(@typeInfo(struct { })); | |
| 65 | \\} | |
| 66 | , | |
| 67 | "tmp.zig:2:15: error: @Type not availble for 'TypeInfo.Struct'", | |
| 68 | ); | |
| 69 | ||
| 5 | 70 | cases.add( |
| 6 | 71 | "wrong type for result ptr to @asyncCall", |
| 7 | 72 | \\export fn entry() void { |
| ... | ... | @@ -18,6 +83,26 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 18 | 83 | "tmp.zig:6:37: error: expected type '*i32', found 'bool'", |
| 19 | 84 | ); |
| 20 | 85 | |
| 86 | cases.add( | |
| 87 | "shift amount has to be an integer type", | |
| 88 | \\export fn entry() void { | |
| 89 | \\ const x = 1 << &u8(10); | |
| 90 | \\} | |
| 91 | , | |
| 92 | "tmp.zig:2:23: error: shift amount has to be an integer type, but found '*u8'", | |
| 93 | "tmp.zig:2:17: note: referenced here", | |
| 94 | ); | |
| 95 | ||
| 96 | cases.add( | |
| 97 | "bit shifting only works on integer types", | |
| 98 | \\export fn entry() void { | |
| 99 | \\ const x = &u8(1) << 10; | |
| 100 | \\} | |
| 101 | , | |
| 102 | "tmp.zig:2:18: error: bit shifting operation expected integer type, found '*u8'", | |
| 103 | "tmp.zig:2:22: note: referenced here", | |
| 104 | ); | |
| 105 | ||
| 21 | 106 | cases.add( |
| 22 | 107 | "struct depends on itself via optional field", |
| 23 | 108 | \\const LhsExpr = struct { |
| ... | ... | @@ -6462,4 +6547,24 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 6462 | 6547 | "tmp.zig:5:30: error: expression value is ignored", |
| 6463 | 6548 | "tmp.zig:9:30: error: expression value is ignored", |
| 6464 | 6549 | ); |
| 6550 | ||
| 6551 | cases.add( | |
| 6552 | "aligned variable of zero-bit type", | |
| 6553 | \\export fn f() void { | |
| 6554 | \\ var s: struct {} align(4) = undefined; | |
| 6555 | \\} | |
| 6556 | , | |
| 6557 | "tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned", | |
| 6558 | ); | |
| 6559 | ||
| 6560 | cases.add( | |
| 6561 | "function returning opaque type", | |
| 6562 | \\const FooType = @OpaqueType(); | |
| 6563 | \\export fn bar() !FooType { | |
| 6564 | \\ return error.InvalidValue; | |
| 6565 | \\} | |
| 6566 | , | |
| 6567 | "tmp.zig:2:18: error: opaque return type 'FooType' not allowed", | |
| 6568 | "tmp.zig:1:1: note: declared here", | |
| 6569 | ); | |
| 6465 | 6570 | } |
test/runtime_safety.zig+15| ... | ... | @@ -1,6 +1,21 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 4 | cases.addRuntimeSafety("noasync function call, callee suspends", | |
| 5 | \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { | |
| 6 | \\ @import("std").os.exit(126); | |
| 7 | \\} | |
| 8 | \\pub fn main() void { | |
| 9 | \\ _ = noasync add(101, 100); | |
| 10 | \\} | |
| 11 | \\fn add(a: i32, b: i32) i32 { | |
| 12 | \\ if (a > 100) { | |
| 13 | \\ suspend; | |
| 14 | \\ } | |
| 15 | \\ return a + b; | |
| 16 | \\} | |
| 17 | ); | |
| 18 | ||
| 4 | 19 | cases.addRuntimeSafety("awaiting twice", |
| 5 | 20 | \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { |
| 6 | 21 | \\ @import("std").os.exit(126); |
test/stack_traces.zig created+355| ... | ... | @@ -0,0 +1,355 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const std = @import("std"); | |
| 3 | const os = std.os; | |
| 4 | const tests = @import("tests.zig"); | |
| 5 | ||
| 6 | pub fn addCases(cases: *tests.StackTracesContext) void { | |
| 7 | const source_return = | |
| 8 | \\const std = @import("std"); | |
| 9 | \\ | |
| 10 | \\pub fn main() !void { | |
| 11 | \\ return error.TheSkyIsFalling; | |
| 12 | \\} | |
| 13 | ; | |
| 14 | const source_try_return = | |
| 15 | \\const std = @import("std"); | |
| 16 | \\ | |
| 17 | \\fn foo() !void { | |
| 18 | \\ return error.TheSkyIsFalling; | |
| 19 | \\} | |
| 20 | \\ | |
| 21 | \\pub fn main() !void { | |
| 22 | \\ try foo(); | |
| 23 | \\} | |
| 24 | ; | |
| 25 | const source_try_try_return_return = | |
| 26 | \\const std = @import("std"); | |
| 27 | \\ | |
| 28 | \\fn foo() !void { | |
| 29 | \\ try bar(); | |
| 30 | \\} | |
| 31 | \\ | |
| 32 | \\fn bar() !void { | |
| 33 | \\ return make_error(); | |
| 34 | \\} | |
| 35 | \\ | |
| 36 | \\fn make_error() !void { | |
| 37 | \\ return error.TheSkyIsFalling; | |
| 38 | \\} | |
| 39 | \\ | |
| 40 | \\pub fn main() !void { | |
| 41 | \\ try foo(); | |
| 42 | \\} | |
| 43 | ; | |
| 44 | // zig fmt: off | |
| 45 | switch (builtin.os) { | |
| 46 | .freebsd => { | |
| 47 | cases.addCase( | |
| 48 | "return", | |
| 49 | source_return, | |
| 50 | [_][]const u8{ | |
| 51 | // debug | |
| 52 | \\error: TheSkyIsFalling | |
| 53 | \\source.zig:4:5: [address] in main (test) | |
| 54 | \\ | |
| 55 | , | |
| 56 | // release-safe | |
| 57 | \\error: TheSkyIsFalling | |
| 58 | \\source.zig:4:5: [address] in std.special.main (test) | |
| 59 | \\ | |
| 60 | , | |
| 61 | // release-fast | |
| 62 | \\error: TheSkyIsFalling | |
| 63 | \\ | |
| 64 | , | |
| 65 | // release-small | |
| 66 | \\error: TheSkyIsFalling | |
| 67 | \\ | |
| 68 | }, | |
| 69 | ); | |
| 70 | cases.addCase( | |
| 71 | "try return", | |
| 72 | source_try_return, | |
| 73 | [_][]const u8{ | |
| 74 | // debug | |
| 75 | \\error: TheSkyIsFalling | |
| 76 | \\source.zig:4:5: [address] in foo (test) | |
| 77 | \\source.zig:8:5: [address] in main (test) | |
| 78 | \\ | |
| 79 | , | |
| 80 | // release-safe | |
| 81 | \\error: TheSkyIsFalling | |
| 82 | \\source.zig:4:5: [address] in std.special.main (test) | |
| 83 | \\source.zig:8:5: [address] in std.special.main (test) | |
| 84 | \\ | |
| 85 | , | |
| 86 | // release-fast | |
| 87 | \\error: TheSkyIsFalling | |
| 88 | \\ | |
| 89 | , | |
| 90 | // release-small | |
| 91 | \\error: TheSkyIsFalling | |
| 92 | \\ | |
| 93 | }, | |
| 94 | ); | |
| 95 | cases.addCase( | |
| 96 | "try try return return", | |
| 97 | source_try_try_return_return, | |
| 98 | [_][]const u8{ | |
| 99 | // debug | |
| 100 | \\error: TheSkyIsFalling | |
| 101 | \\source.zig:12:5: [address] in make_error (test) | |
| 102 | \\source.zig:8:5: [address] in bar (test) | |
| 103 | \\source.zig:4:5: [address] in foo (test) | |
| 104 | \\source.zig:16:5: [address] in main (test) | |
| 105 | \\ | |
| 106 | , | |
| 107 | // release-safe | |
| 108 | \\error: TheSkyIsFalling | |
| 109 | \\source.zig:12:5: [address] in std.special.main (test) | |
| 110 | \\source.zig:8:5: [address] in std.special.main (test) | |
| 111 | \\source.zig:4:5: [address] in std.special.main (test) | |
| 112 | \\source.zig:16:5: [address] in std.special.main (test) | |
| 113 | \\ | |
| 114 | , | |
| 115 | // release-fast | |
| 116 | \\error: TheSkyIsFalling | |
| 117 | \\ | |
| 118 | , | |
| 119 | // release-small | |
| 120 | \\error: TheSkyIsFalling | |
| 121 | \\ | |
| 122 | }, | |
| 123 | ); | |
| 124 | }, | |
| 125 | .linux => { | |
| 126 | cases.addCase( | |
| 127 | "return", | |
| 128 | source_return, | |
| 129 | [_][]const u8{ | |
| 130 | // debug | |
| 131 | \\error: TheSkyIsFalling | |
| 132 | \\source.zig:4:5: [address] in main (test) | |
| 133 | \\ | |
| 134 | , | |
| 135 | // release-safe | |
| 136 | \\error: TheSkyIsFalling | |
| 137 | \\source.zig:4:5: [address] in std.special.posixCallMainAndExit (test) | |
| 138 | \\ | |
| 139 | , | |
| 140 | // release-fast | |
| 141 | \\error: TheSkyIsFalling | |
| 142 | \\ | |
| 143 | , | |
| 144 | // release-small | |
| 145 | \\error: TheSkyIsFalling | |
| 146 | \\ | |
| 147 | }, | |
| 148 | ); | |
| 149 | cases.addCase( | |
| 150 | "try return", | |
| 151 | source_try_return, | |
| 152 | [_][]const u8{ | |
| 153 | // debug | |
| 154 | \\error: TheSkyIsFalling | |
| 155 | \\source.zig:4:5: [address] in foo (test) | |
| 156 | \\source.zig:8:5: [address] in main (test) | |
| 157 | \\ | |
| 158 | , | |
| 159 | // release-safe | |
| 160 | \\error: TheSkyIsFalling | |
| 161 | \\source.zig:4:5: [address] in std.special.posixCallMainAndExit (test) | |
| 162 | \\source.zig:8:5: [address] in std.special.posixCallMainAndExit (test) | |
| 163 | \\ | |
| 164 | , | |
| 165 | // release-fast | |
| 166 | \\error: TheSkyIsFalling | |
| 167 | \\ | |
| 168 | , | |
| 169 | // release-small | |
| 170 | \\error: TheSkyIsFalling | |
| 171 | \\ | |
| 172 | }, | |
| 173 | ); | |
| 174 | cases.addCase( | |
| 175 | "try try return return", | |
| 176 | source_try_try_return_return, | |
| 177 | [_][]const u8{ | |
| 178 | // debug | |
| 179 | \\error: TheSkyIsFalling | |
| 180 | \\source.zig:12:5: [address] in make_error (test) | |
| 181 | \\source.zig:8:5: [address] in bar (test) | |
| 182 | \\source.zig:4:5: [address] in foo (test) | |
| 183 | \\source.zig:16:5: [address] in main (test) | |
| 184 | \\ | |
| 185 | , | |
| 186 | // release-safe | |
| 187 | \\error: TheSkyIsFalling | |
| 188 | \\source.zig:12:5: [address] in std.special.posixCallMainAndExit (test) | |
| 189 | \\source.zig:8:5: [address] in std.special.posixCallMainAndExit (test) | |
| 190 | \\source.zig:4:5: [address] in std.special.posixCallMainAndExit (test) | |
| 191 | \\source.zig:16:5: [address] in std.special.posixCallMainAndExit (test) | |
| 192 | \\ | |
| 193 | , | |
| 194 | // release-fast | |
| 195 | \\error: TheSkyIsFalling | |
| 196 | \\ | |
| 197 | , | |
| 198 | // release-small | |
| 199 | \\error: TheSkyIsFalling | |
| 200 | \\ | |
| 201 | }, | |
| 202 | ); | |
| 203 | }, | |
| 204 | .macosx => { | |
| 205 | cases.addCase( | |
| 206 | "return", | |
| 207 | source_return, | |
| 208 | [_][]const u8{ | |
| 209 | // debug | |
| 210 | \\error: TheSkyIsFalling | |
| 211 | \\source.zig:4:5: [address] in _main.0 (test.o) | |
| 212 | \\ | |
| 213 | , | |
| 214 | // release-safe | |
| 215 | \\error: TheSkyIsFalling | |
| 216 | \\source.zig:4:5: [address] in _main (test.o) | |
| 217 | \\ | |
| 218 | , | |
| 219 | // release-fast | |
| 220 | \\error: TheSkyIsFalling | |
| 221 | \\ | |
| 222 | , | |
| 223 | // release-small | |
| 224 | \\error: TheSkyIsFalling | |
| 225 | \\ | |
| 226 | }, | |
| 227 | ); | |
| 228 | cases.addCase( | |
| 229 | "try return", | |
| 230 | source_try_return, | |
| 231 | [_][]const u8{ | |
| 232 | // debug | |
| 233 | \\error: TheSkyIsFalling | |
| 234 | \\source.zig:4:5: [address] in _foo (test.o) | |
| 235 | \\source.zig:8:5: [address] in _main.0 (test.o) | |
| 236 | \\ | |
| 237 | , | |
| 238 | // release-safe | |
| 239 | \\error: TheSkyIsFalling | |
| 240 | \\source.zig:4:5: [address] in _main (test.o) | |
| 241 | \\source.zig:8:5: [address] in _main (test.o) | |
| 242 | \\ | |
| 243 | , | |
| 244 | // release-fast | |
| 245 | \\error: TheSkyIsFalling | |
| 246 | \\ | |
| 247 | , | |
| 248 | // release-small | |
| 249 | \\error: TheSkyIsFalling | |
| 250 | \\ | |
| 251 | }, | |
| 252 | ); | |
| 253 | cases.addCase( | |
| 254 | "try try return return", | |
| 255 | source_try_try_return_return, | |
| 256 | [_][]const u8{ | |
| 257 | // debug | |
| 258 | \\error: TheSkyIsFalling | |
| 259 | \\source.zig:12:5: [address] in _make_error (test.o) | |
| 260 | \\source.zig:8:5: [address] in _bar (test.o) | |
| 261 | \\source.zig:4:5: [address] in _foo (test.o) | |
| 262 | \\source.zig:16:5: [address] in _main.0 (test.o) | |
| 263 | \\ | |
| 264 | , | |
| 265 | // release-safe | |
| 266 | \\error: TheSkyIsFalling | |
| 267 | \\source.zig:12:5: [address] in _main (test.o) | |
| 268 | \\source.zig:8:5: [address] in _main (test.o) | |
| 269 | \\source.zig:4:5: [address] in _main (test.o) | |
| 270 | \\source.zig:16:5: [address] in _main (test.o) | |
| 271 | \\ | |
| 272 | , | |
| 273 | // release-fast | |
| 274 | \\error: TheSkyIsFalling | |
| 275 | \\ | |
| 276 | , | |
| 277 | // release-small | |
| 278 | \\error: TheSkyIsFalling | |
| 279 | \\ | |
| 280 | }, | |
| 281 | ); | |
| 282 | }, | |
| 283 | .windows => { | |
| 284 | cases.addCase( | |
| 285 | "return", | |
| 286 | source_return, | |
| 287 | [_][]const u8{ | |
| 288 | // debug | |
| 289 | \\error: TheSkyIsFalling | |
| 290 | \\source.zig:4:5: [address] in main (test.obj) | |
| 291 | \\ | |
| 292 | , | |
| 293 | // release-safe | |
| 294 | // --disabled-- results in segmenetation fault | |
| 295 | "", | |
| 296 | // release-fast | |
| 297 | \\error: TheSkyIsFalling | |
| 298 | \\ | |
| 299 | , | |
| 300 | // release-small | |
| 301 | \\error: TheSkyIsFalling | |
| 302 | \\ | |
| 303 | }, | |
| 304 | ); | |
| 305 | cases.addCase( | |
| 306 | "try return", | |
| 307 | source_try_return, | |
| 308 | [_][]const u8{ | |
| 309 | // debug | |
| 310 | \\error: TheSkyIsFalling | |
| 311 | \\source.zig:4:5: [address] in foo (test.obj) | |
| 312 | \\source.zig:8:5: [address] in main (test.obj) | |
| 313 | \\ | |
| 314 | , | |
| 315 | // release-safe | |
| 316 | // --disabled-- results in segmenetation fault | |
| 317 | "", | |
| 318 | // release-fast | |
| 319 | \\error: TheSkyIsFalling | |
| 320 | \\ | |
| 321 | , | |
| 322 | // release-small | |
| 323 | \\error: TheSkyIsFalling | |
| 324 | \\ | |
| 325 | }, | |
| 326 | ); | |
| 327 | cases.addCase( | |
| 328 | "try try return return", | |
| 329 | source_try_try_return_return, | |
| 330 | [_][]const u8{ | |
| 331 | // debug | |
| 332 | \\error: TheSkyIsFalling | |
| 333 | \\source.zig:12:5: [address] in make_error (test.obj) | |
| 334 | \\source.zig:8:5: [address] in bar (test.obj) | |
| 335 | \\source.zig:4:5: [address] in foo (test.obj) | |
| 336 | \\source.zig:16:5: [address] in main (test.obj) | |
| 337 | \\ | |
| 338 | , | |
| 339 | // release-safe | |
| 340 | // --disabled-- results in segmenetation fault | |
| 341 | "", | |
| 342 | // release-fast | |
| 343 | \\error: TheSkyIsFalling | |
| 344 | \\ | |
| 345 | , | |
| 346 | // release-small | |
| 347 | \\error: TheSkyIsFalling | |
| 348 | \\ | |
| 349 | }, | |
| 350 | ); | |
| 351 | }, | |
| 352 | else => {}, | |
| 353 | } | |
| 354 | // zig fmt: off | |
| 355 | } |
test/stage1/behavior.zig+1| ... | ... | @@ -93,6 +93,7 @@ comptime { |
| 93 | 93 | _ = @import("behavior/this.zig"); |
| 94 | 94 | _ = @import("behavior/truncate.zig"); |
| 95 | 95 | _ = @import("behavior/try.zig"); |
| 96 | _ = @import("behavior/type.zig"); | |
| 96 | 97 | _ = @import("behavior/type_info.zig"); |
| 97 | 98 | _ = @import("behavior/typename.zig"); |
| 98 | 99 | _ = @import("behavior/undefined.zig"); |
test/stage1/behavior/async_fn.zig+184-8| ... | ... | @@ -921,12 +921,10 @@ fn recursiveAsyncFunctionTest(comptime suspending_implementation: bool) type { |
| 921 | 921 | var sum: u32 = 0; |
| 922 | 922 | |
| 923 | 923 | f1_awaited = true; |
| 924 | const result_f1 = await f1; // TODO https://github.com/ziglang/zig/issues/3077 | |
| 925 | sum += try result_f1; | |
| 924 | sum += try await f1; | |
| 926 | 925 | |
| 927 | 926 | f2_awaited = true; |
| 928 | const result_f2 = await f2; // TODO https://github.com/ziglang/zig/issues/3077 | |
| 929 | sum += try result_f2; | |
| 927 | sum += try await f2; | |
| 930 | 928 | |
| 931 | 929 | return sum; |
| 932 | 930 | } |
| ... | ... | @@ -943,8 +941,7 @@ fn recursiveAsyncFunctionTest(comptime suspending_implementation: bool) type { |
| 943 | 941 | |
| 944 | 942 | fn amain(result: *u32) void { |
| 945 | 943 | var x = async fib(std.heap.direct_allocator, 10); |
| 946 | const res = await x; // TODO https://github.com/ziglang/zig/issues/3077 | |
| 947 | result.* = res catch unreachable; | |
| 944 | result.* = (await x) catch unreachable; | |
| 948 | 945 | } |
| 949 | 946 | }; |
| 950 | 947 | } |
| ... | ... | @@ -1002,8 +999,7 @@ test "@asyncCall using the result location inside the frame" { |
| 1002 | 999 | return 1234; |
| 1003 | 1000 | } |
| 1004 | 1001 | fn getAnswer(f: anyframe->i32, out: *i32) void { |
| 1005 | var res = await f; // TODO https://github.com/ziglang/zig/issues/3077 | |
| 1006 | out.* = res; | |
| 1002 | out.* = await f; | |
| 1007 | 1003 | } |
| 1008 | 1004 | }; |
| 1009 | 1005 | var data: i32 = 1; |
| ... | ... | @@ -1092,3 +1088,183 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1092 | 1088 | expect(res.y == 2); |
| 1093 | 1089 | expect(res.z == 3); |
| 1094 | 1090 | } |
| 1091 | ||
| 1092 | test "noasync function call" { | |
| 1093 | const S = struct { | |
| 1094 | fn doTheTest() void { | |
| 1095 | const result = noasync add(50, 100); | |
| 1096 | expect(result == 150); | |
| 1097 | } | |
| 1098 | fn add(a: i32, b: i32) i32 { | |
| 1099 | if (a > 100) { | |
| 1100 | suspend; | |
| 1101 | } | |
| 1102 | return a + b; | |
| 1103 | } | |
| 1104 | }; | |
| 1105 | S.doTheTest(); | |
| 1106 | } | |
| 1107 | ||
| 1108 | test "await used in expression and awaiting fn with no suspend but async calling convention" { | |
| 1109 | const S = struct { | |
| 1110 | fn atest() void { | |
| 1111 | var f1 = async add(1, 2); | |
| 1112 | var f2 = async add(3, 4); | |
| 1113 | ||
| 1114 | const sum = (await f1) + (await f2); | |
| 1115 | expect(sum == 10); | |
| 1116 | } | |
| 1117 | async fn add(a: i32, b: i32) i32 { | |
| 1118 | return a + b; | |
| 1119 | } | |
| 1120 | }; | |
| 1121 | _ = async S.atest(); | |
| 1122 | } | |
| 1123 | ||
| 1124 | test "await used in expression after a fn call" { | |
| 1125 | const S = struct { | |
| 1126 | fn atest() void { | |
| 1127 | var f1 = async add(3, 4); | |
| 1128 | var sum: i32 = 0; | |
| 1129 | sum = foo() + await f1; | |
| 1130 | expect(sum == 8); | |
| 1131 | } | |
| 1132 | async fn add(a: i32, b: i32) i32 { | |
| 1133 | return a + b; | |
| 1134 | } | |
| 1135 | fn foo() i32 { return 1; } | |
| 1136 | }; | |
| 1137 | _ = async S.atest(); | |
| 1138 | } | |
| 1139 | ||
| 1140 | test "async fn call used in expression after a fn call" { | |
| 1141 | const S = struct { | |
| 1142 | fn atest() void { | |
| 1143 | var sum: i32 = 0; | |
| 1144 | sum = foo() + add(3, 4); | |
| 1145 | expect(sum == 8); | |
| 1146 | } | |
| 1147 | async fn add(a: i32, b: i32) i32 { | |
| 1148 | return a + b; | |
| 1149 | } | |
| 1150 | fn foo() i32 { return 1; } | |
| 1151 | }; | |
| 1152 | _ = async S.atest(); | |
| 1153 | } | |
| 1154 | ||
| 1155 | test "suspend in for loop" { | |
| 1156 | const S = struct { | |
| 1157 | var global_frame: ?anyframe = null; | |
| 1158 | ||
| 1159 | fn doTheTest() void { | |
| 1160 | _ = async atest(); | |
| 1161 | while (global_frame) |f| resume f; | |
| 1162 | } | |
| 1163 | ||
| 1164 | fn atest() void { | |
| 1165 | expect(func([_]u8{ 1, 2, 3 }) == 6); | |
| 1166 | } | |
| 1167 | fn func(stuff: []const u8) u32 { | |
| 1168 | global_frame = @frame(); | |
| 1169 | var sum: u32 = 0; | |
| 1170 | for (stuff) |x| { | |
| 1171 | suspend; | |
| 1172 | sum += x; | |
| 1173 | } | |
| 1174 | global_frame = null; | |
| 1175 | return sum; | |
| 1176 | } | |
| 1177 | }; | |
| 1178 | S.doTheTest(); | |
| 1179 | } | |
| 1180 | ||
| 1181 | test "correctly spill when returning the error union result of another async fn" { | |
| 1182 | const S = struct { | |
| 1183 | var global_frame: anyframe = undefined; | |
| 1184 | ||
| 1185 | fn doTheTest() void { | |
| 1186 | expect((atest() catch unreachable) == 1234); | |
| 1187 | } | |
| 1188 | ||
| 1189 | fn atest() !i32 { | |
| 1190 | return fallible1(); | |
| 1191 | } | |
| 1192 | ||
| 1193 | fn fallible1() anyerror!i32 { | |
| 1194 | suspend { | |
| 1195 | global_frame = @frame(); | |
| 1196 | } | |
| 1197 | return 1234; | |
| 1198 | } | |
| 1199 | }; | |
| 1200 | _ = async S.doTheTest(); | |
| 1201 | resume S.global_frame; | |
| 1202 | } | |
| 1203 | ||
| 1204 | ||
| 1205 | test "spill target expr in a for loop" { | |
| 1206 | const S = struct { | |
| 1207 | var global_frame: anyframe = undefined; | |
| 1208 | ||
| 1209 | fn doTheTest() void { | |
| 1210 | var foo = Foo{ | |
| 1211 | .slice = [_]i32{1, 2}, | |
| 1212 | }; | |
| 1213 | expect(atest(&foo) == 3); | |
| 1214 | } | |
| 1215 | ||
| 1216 | const Foo = struct { | |
| 1217 | slice: []i32, | |
| 1218 | }; | |
| 1219 | ||
| 1220 | fn atest(foo: *Foo) i32 { | |
| 1221 | var sum: i32 = 0; | |
| 1222 | for (foo.slice) |x| { | |
| 1223 | suspend { | |
| 1224 | global_frame = @frame(); | |
| 1225 | } | |
| 1226 | sum += x; | |
| 1227 | } | |
| 1228 | return sum; | |
| 1229 | } | |
| 1230 | }; | |
| 1231 | _ = async S.doTheTest(); | |
| 1232 | resume S.global_frame; | |
| 1233 | resume S.global_frame; | |
| 1234 | } | |
| 1235 | ||
| 1236 | test "spill target expr in a for loop, with a var decl in the loop body" { | |
| 1237 | const S = struct { | |
| 1238 | var global_frame: anyframe = undefined; | |
| 1239 | ||
| 1240 | fn doTheTest() void { | |
| 1241 | var foo = Foo{ | |
| 1242 | .slice = [_]i32{1, 2}, | |
| 1243 | }; | |
| 1244 | expect(atest(&foo) == 3); | |
| 1245 | } | |
| 1246 | ||
| 1247 | const Foo = struct { | |
| 1248 | slice: []i32, | |
| 1249 | }; | |
| 1250 | ||
| 1251 | fn atest(foo: *Foo) i32 { | |
| 1252 | var sum: i32 = 0; | |
| 1253 | for (foo.slice) |x| { | |
| 1254 | // Previously this var decl would prevent spills. This test makes sure | |
| 1255 | // the for loop spills still happen even though there is a VarDecl in scope | |
| 1256 | // before the suspend. | |
| 1257 | var anything = true; | |
| 1258 | _ = anything; | |
| 1259 | suspend { | |
| 1260 | global_frame = @frame(); | |
| 1261 | } | |
| 1262 | sum += x; | |
| 1263 | } | |
| 1264 | return sum; | |
| 1265 | } | |
| 1266 | }; | |
| 1267 | _ = async S.doTheTest(); | |
| 1268 | resume S.global_frame; | |
| 1269 | resume S.global_frame; | |
| 1270 | } |
test/stage1/behavior/enum.zig+14| ... | ... | @@ -993,3 +993,17 @@ test "enum with one member and custom tag type" { |
| 993 | 993 | }; |
| 994 | 994 | expect(@enumToInt(E2.One) == 2); |
| 995 | 995 | } |
| 996 | ||
| 997 | test "enum literal casting to optional" { | |
| 998 | var bar: ?Bar = undefined; | |
| 999 | bar = .B; | |
| 1000 | ||
| 1001 | expect(bar.? == Bar.B); | |
| 1002 | } | |
| 1003 | ||
| 1004 | test "enum literal casting to error union with payload enum" { | |
| 1005 | var bar: error{B}!Bar = undefined; | |
| 1006 | bar = .B; // should never cast to the error set | |
| 1007 | ||
| 1008 | expect((try bar) == Bar.B); | |
| 1009 | } |
test/stage1/behavior/if.zig+12| ... | ... | @@ -74,3 +74,15 @@ test "const result loc, runtime if cond, else unreachable" { |
| 74 | 74 | const x = if (t) Num.Two else unreachable; |
| 75 | 75 | if (x != .Two) @compileError("bad"); |
| 76 | 76 | } |
| 77 | ||
| 78 | test "if prongs cast to expected type instead of peer type resolution" { | |
| 79 | const S = struct { | |
| 80 | fn doTheTest(f: bool) void { | |
| 81 | var x: i32 = 0; | |
| 82 | x = if (f) 1 else 2; | |
| 83 | expect(x == 2); | |
| 84 | } | |
| 85 | }; | |
| 86 | S.doTheTest(false); | |
| 87 | comptime S.doTheTest(false); | |
| 88 | } |
test/stage1/behavior/sizeof_and_typeof.zig+9| ... | ... | @@ -115,3 +115,12 @@ test "branching logic inside @typeOf" { |
| 115 | 115 | comptime expect(T == i32); |
| 116 | 116 | expect(S.data == 0); |
| 117 | 117 | } |
| 118 | ||
| 119 | fn fn1(alpha: bool) void { | |
| 120 | const n: usize = 7; | |
| 121 | const v = if (alpha) n else @sizeOf(usize); | |
| 122 | } | |
| 123 | ||
| 124 | test "lazy @sizeOf result is checked for definedness" { | |
| 125 | const f = fn1; | |
| 126 | } |
test/stage1/behavior/struct.zig+59| ... | ... | @@ -599,3 +599,62 @@ test "extern fn returns struct by value" { |
| 599 | 599 | S.entry(); |
| 600 | 600 | comptime S.entry(); |
| 601 | 601 | } |
| 602 | ||
| 603 | test "for loop over pointers to struct, getting field from struct pointer" { | |
| 604 | const S = struct { | |
| 605 | const Foo = struct { | |
| 606 | name: []const u8, | |
| 607 | }; | |
| 608 | ||
| 609 | var ok = true; | |
| 610 | ||
| 611 | fn eql(a: []const u8) bool { | |
| 612 | return true; | |
| 613 | } | |
| 614 | ||
| 615 | const ArrayList = struct { | |
| 616 | fn toSlice(self: *ArrayList) []*Foo { | |
| 617 | return ([*]*Foo)(undefined)[0..0]; | |
| 618 | } | |
| 619 | }; | |
| 620 | ||
| 621 | fn doTheTest() void { | |
| 622 | var objects: ArrayList = undefined; | |
| 623 | ||
| 624 | for (objects.toSlice()) |obj| { | |
| 625 | if (eql(obj.name)) { | |
| 626 | ok = false; | |
| 627 | } | |
| 628 | } | |
| 629 | ||
| 630 | expect(ok); | |
| 631 | } | |
| 632 | }; | |
| 633 | S.doTheTest(); | |
| 634 | } | |
| 635 | ||
| 636 | test "zero-bit field in packed struct" { | |
| 637 | const S = packed struct { | |
| 638 | x: u10, | |
| 639 | y: void, | |
| 640 | }; | |
| 641 | var x: S = undefined; | |
| 642 | } | |
| 643 | ||
| 644 | test "struct field init with catch" { | |
| 645 | const S = struct { | |
| 646 | fn doTheTest() void { | |
| 647 | var x: anyerror!isize = 1; | |
| 648 | var req = Foo{ | |
| 649 | .field = x catch undefined, | |
| 650 | }; | |
| 651 | expect(req.field == 1); | |
| 652 | } | |
| 653 | ||
| 654 | pub const Foo = extern struct { | |
| 655 | field: isize, | |
| 656 | }; | |
| 657 | }; | |
| 658 | S.doTheTest(); | |
| 659 | comptime S.doTheTest(); | |
| 660 | } |
test/stage1/behavior/type.zig created+113| ... | ... | @@ -0,0 +1,113 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const TypeInfo = builtin.TypeInfo; | |
| 3 | ||
| 4 | const std = @import("std"); | |
| 5 | const testing = std.testing; | |
| 6 | ||
| 7 | fn testTypes(comptime types: []const type) void { | |
| 8 | inline for (types) |testType| { | |
| 9 | testing.expect(testType == @Type(@typeInfo(testType))); | |
| 10 | } | |
| 11 | } | |
| 12 | ||
| 13 | test "Type.MetaType" { | |
| 14 | testing.expect(type == @Type(TypeInfo { .Type = undefined })); | |
| 15 | testTypes([_]type {type}); | |
| 16 | } | |
| 17 | ||
| 18 | test "Type.Void" { | |
| 19 | testing.expect(void == @Type(TypeInfo { .Void = undefined })); | |
| 20 | testTypes([_]type {void}); | |
| 21 | } | |
| 22 | ||
| 23 | test "Type.Bool" { | |
| 24 | testing.expect(bool == @Type(TypeInfo { .Bool = undefined })); | |
| 25 | testTypes([_]type {bool}); | |
| 26 | } | |
| 27 | ||
| 28 | test "Type.NoReturn" { | |
| 29 | testing.expect(noreturn == @Type(TypeInfo { .NoReturn = undefined })); | |
| 30 | testTypes([_]type {noreturn}); | |
| 31 | } | |
| 32 | ||
| 33 | test "Type.Int" { | |
| 34 | testing.expect(u1 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = false, .bits = 1 } })); | |
| 35 | testing.expect(i1 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = true, .bits = 1 } })); | |
| 36 | testing.expect(u8 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = false, .bits = 8 } })); | |
| 37 | testing.expect(i8 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = true, .bits = 8 } })); | |
| 38 | testing.expect(u64 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = false, .bits = 64 } })); | |
| 39 | testing.expect(i64 == @Type(TypeInfo { .Int = TypeInfo.Int { .is_signed = true, .bits = 64 } })); | |
| 40 | testTypes([_]type {u8,u32,i64}); | |
| 41 | } | |
| 42 | ||
| 43 | test "Type.Float" { | |
| 44 | testing.expect(f16 == @Type(TypeInfo { .Float = TypeInfo.Float { .bits = 16 } })); | |
| 45 | testing.expect(f32 == @Type(TypeInfo { .Float = TypeInfo.Float { .bits = 32 } })); | |
| 46 | testing.expect(f64 == @Type(TypeInfo { .Float = TypeInfo.Float { .bits = 64 } })); | |
| 47 | testing.expect(f128 == @Type(TypeInfo { .Float = TypeInfo.Float { .bits = 128 } })); | |
| 48 | testTypes([_]type {f16, f32, f64, f128}); | |
| 49 | } | |
| 50 | ||
| 51 | test "Type.Pointer" { | |
| 52 | testTypes([_]type { | |
| 53 | // One Value Pointer Types | |
| 54 | *u8, *const u8, | |
| 55 | *volatile u8, *const volatile u8, | |
| 56 | *align(4) u8, *const align(4) u8, | |
| 57 | *volatile align(4) u8, *const volatile align(4) u8, | |
| 58 | *align(8) u8, *const align(8) u8, | |
| 59 | *volatile align(8) u8, *const volatile align(8) u8, | |
| 60 | *allowzero u8, *const allowzero u8, | |
| 61 | *volatile allowzero u8, *const volatile allowzero u8, | |
| 62 | *align(4) allowzero u8, *const align(4) allowzero u8, | |
| 63 | *volatile align(4) allowzero u8, *const volatile align(4) allowzero u8, | |
| 64 | // Many Values Pointer Types | |
| 65 | [*]u8, [*]const u8, | |
| 66 | [*]volatile u8, [*]const volatile u8, | |
| 67 | [*]align(4) u8, [*]const align(4) u8, | |
| 68 | [*]volatile align(4) u8, [*]const volatile align(4) u8, | |
| 69 | [*]align(8) u8, [*]const align(8) u8, | |
| 70 | [*]volatile align(8) u8, [*]const volatile align(8) u8, | |
| 71 | [*]allowzero u8, [*]const allowzero u8, | |
| 72 | [*]volatile allowzero u8, [*]const volatile allowzero u8, | |
| 73 | [*]align(4) allowzero u8, [*]const align(4) allowzero u8, | |
| 74 | [*]volatile align(4) allowzero u8, [*]const volatile align(4) allowzero u8, | |
| 75 | // Slice Types | |
| 76 | []u8, []const u8, | |
| 77 | []volatile u8, []const volatile u8, | |
| 78 | []align(4) u8, []const align(4) u8, | |
| 79 | []volatile align(4) u8, []const volatile align(4) u8, | |
| 80 | []align(8) u8, []const align(8) u8, | |
| 81 | []volatile align(8) u8, []const volatile align(8) u8, | |
| 82 | []allowzero u8, []const allowzero u8, | |
| 83 | []volatile allowzero u8, []const volatile allowzero u8, | |
| 84 | []align(4) allowzero u8, []const align(4) allowzero u8, | |
| 85 | []volatile align(4) allowzero u8, []const volatile align(4) allowzero u8, | |
| 86 | // C Pointer Types | |
| 87 | [*c]u8, [*c]const u8, | |
| 88 | [*c]volatile u8, [*c]const volatile u8, | |
| 89 | [*c]align(4) u8, [*c]const align(4) u8, | |
| 90 | [*c]volatile align(4) u8, [*c]const volatile align(4) u8, | |
| 91 | [*c]align(8) u8, [*c]const align(8) u8, | |
| 92 | [*c]volatile align(8) u8, [*c]const volatile align(8) u8, | |
| 93 | }); | |
| 94 | } | |
| 95 | ||
| 96 | test "Type.Array" { | |
| 97 | testing.expect([123]u8 == @Type(TypeInfo { .Array = TypeInfo.Array { .len = 123, .child = u8 } })); | |
| 98 | testing.expect([2]u32 == @Type(TypeInfo { .Array = TypeInfo.Array { .len = 2, .child = u32 } })); | |
| 99 | testTypes([_]type {[1]u8, [30]usize, [7]bool}); | |
| 100 | } | |
| 101 | ||
| 102 | test "Type.ComptimeFloat" { | |
| 103 | testTypes([_]type {comptime_float}); | |
| 104 | } | |
| 105 | test "Type.ComptimeInt" { | |
| 106 | testTypes([_]type {comptime_int}); | |
| 107 | } | |
| 108 | test "Type.Undefined" { | |
| 109 | testTypes([_]type {@typeOf(undefined)}); | |
| 110 | } | |
| 111 | test "Type.Null" { | |
| 112 | testTypes([_]type {@typeOf(null)}); | |
| 113 | } |
test/stage1/behavior/union.zig+37| ... | ... | @@ -457,3 +457,40 @@ test "@unionInit can modify a pointer value" { |
| 457 | 457 | value_ptr.* = @unionInit(UnionInitEnum, "Byte", 2); |
| 458 | 458 | expect(value.Byte == 2); |
| 459 | 459 | } |
| 460 | ||
| 461 | test "union no tag with struct member" { | |
| 462 | const Struct = struct {}; | |
| 463 | const Union = union { | |
| 464 | s: Struct, | |
| 465 | pub fn foo(self: *@This()) void {} | |
| 466 | }; | |
| 467 | var u = Union{ .s = Struct{} }; | |
| 468 | u.foo(); | |
| 469 | } | |
| 470 | ||
| 471 | fn testComparison() void { | |
| 472 | var x = Payload{.A = 42}; | |
| 473 | expect(x == .A); | |
| 474 | expect(x != .B); | |
| 475 | expect(x != .C); | |
| 476 | expect((x == .B) == false); | |
| 477 | expect((x == .C) == false); | |
| 478 | expect((x != .A) == false); | |
| 479 | } | |
| 480 | ||
| 481 | test "comparison between union and enum literal" { | |
| 482 | testComparison(); | |
| 483 | comptime testComparison(); | |
| 484 | } | |
| 485 | ||
| 486 | test "packed union generates correctly aligned LLVM type" { | |
| 487 | const U = packed union { | |
| 488 | f1: fn () void, | |
| 489 | f2: u32, | |
| 490 | }; | |
| 491 | var foo = [_]U{ | |
| 492 | U{ .f1 = doTest }, | |
| 493 | U{ .f2 = 0 }, | |
| 494 | }; | |
| 495 | foo[0].f1(); | |
| 496 | } |
test/tests.zig+222-2| ... | ... | @@ -16,13 +16,14 @@ const LibExeObjStep = build.LibExeObjStep; |
| 16 | 16 | |
| 17 | 17 | const compare_output = @import("compare_output.zig"); |
| 18 | 18 | const standalone = @import("standalone.zig"); |
| 19 | const stack_traces = @import("stack_traces.zig"); | |
| 19 | 20 | const compile_errors = @import("compile_errors.zig"); |
| 20 | 21 | const assemble_and_link = @import("assemble_and_link.zig"); |
| 21 | 22 | const runtime_safety = @import("runtime_safety.zig"); |
| 22 | 23 | const translate_c = @import("translate_c.zig"); |
| 23 | 24 | const gen_h = @import("gen_h.zig"); |
| 24 | 25 | |
| 25 | const test_targets = [_]CrossTarget{ | |
| 26 | const cross_targets = [_]CrossTarget{ | |
| 26 | 27 | CrossTarget{ |
| 27 | 28 | .os = .linux, |
| 28 | 29 | .arch = .x86_64, |
| ... | ... | @@ -57,6 +58,21 @@ pub fn addCompareOutputTests(b: *build.Builder, test_filter: ?[]const u8, modes: |
| 57 | 58 | return cases.step; |
| 58 | 59 | } |
| 59 | 60 | |
| 61 | pub fn addStackTraceTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step { | |
| 62 | const cases = b.allocator.create(StackTracesContext) catch unreachable; | |
| 63 | cases.* = StackTracesContext{ | |
| 64 | .b = b, | |
| 65 | .step = b.step("test-stack-traces", "Run the stack trace tests"), | |
| 66 | .test_index = 0, | |
| 67 | .test_filter = test_filter, | |
| 68 | .modes = modes, | |
| 69 | }; | |
| 70 | ||
| 71 | stack_traces.addCases(cases); | |
| 72 | ||
| 73 | return cases.step; | |
| 74 | } | |
| 75 | ||
| 60 | 76 | pub fn addRuntimeSafetyTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step { |
| 61 | 77 | const cases = b.allocator.create(CompareOutputContext) catch unreachable; |
| 62 | 78 | cases.* = CompareOutputContext{ |
| ... | ... | @@ -170,7 +186,17 @@ pub fn addPkgTests( |
| 170 | 186 | skip_non_native: bool, |
| 171 | 187 | ) *build.Step { |
| 172 | 188 | const step = b.step(b.fmt("test-{}", name), desc); |
| 173 | for (test_targets) |test_target| { | |
| 189 | ||
| 190 | var targets = std.ArrayList(*const CrossTarget).init(b.allocator); | |
| 191 | defer targets.deinit(); | |
| 192 | const host = CrossTarget{ .os = builtin.os, .arch = builtin.arch, .abi = builtin.abi }; | |
| 193 | targets.append(&host) catch unreachable; | |
| 194 | for (cross_targets) |*t| { | |
| 195 | if (t.os == builtin.os and t.arch == builtin.arch and t.abi == builtin.abi) continue; | |
| 196 | targets.append(t) catch unreachable; | |
| 197 | } | |
| 198 | ||
| 199 | for (targets.toSliceConst()) |test_target| { | |
| 174 | 200 | const is_native = (test_target.os == builtin.os and test_target.arch == builtin.arch); |
| 175 | 201 | if (skip_non_native and !is_native) |
| 176 | 202 | continue; |
| ... | ... | @@ -549,6 +575,200 @@ pub const CompareOutputContext = struct { |
| 549 | 575 | } |
| 550 | 576 | }; |
| 551 | 577 | |
| 578 | pub const StackTracesContext = struct { | |
| 579 | b: *build.Builder, | |
| 580 | step: *build.Step, | |
| 581 | test_index: usize, | |
| 582 | test_filter: ?[]const u8, | |
| 583 | modes: []const Mode, | |
| 584 | ||
| 585 | const Expect = [@typeInfo(Mode).Enum.fields.len][]const u8; | |
| 586 | ||
| 587 | pub fn addCase( | |
| 588 | self: *StackTracesContext, | |
| 589 | name: []const u8, | |
| 590 | source: []const u8, | |
| 591 | expect: Expect, | |
| 592 | ) void { | |
| 593 | const b = self.b; | |
| 594 | ||
| 595 | const source_pathname = fs.path.join( | |
| 596 | b.allocator, | |
| 597 | [_][]const u8{ b.cache_root, "source.zig" }, | |
| 598 | ) catch unreachable; | |
| 599 | ||
| 600 | for (self.modes) |mode| { | |
| 601 | const expect_for_mode = expect[@enumToInt(mode)]; | |
| 602 | if (expect_for_mode.len == 0) continue; | |
| 603 | ||
| 604 | const annotated_case_name = fmt.allocPrint(self.b.allocator, "{} {} ({})", "stack-trace", name, @tagName(mode)) catch unreachable; | |
| 605 | if (self.test_filter) |filter| { | |
| 606 | if (mem.indexOf(u8, annotated_case_name, filter) == null) continue; | |
| 607 | } | |
| 608 | ||
| 609 | const exe = b.addExecutable("test", source_pathname); | |
| 610 | exe.setBuildMode(mode); | |
| 611 | ||
| 612 | const write_source = b.addWriteFile(source_pathname, source); | |
| 613 | exe.step.dependOn(&write_source.step); | |
| 614 | ||
| 615 | const run_and_compare = RunAndCompareStep.create( | |
| 616 | self, | |
| 617 | exe, | |
| 618 | annotated_case_name, | |
| 619 | mode, | |
| 620 | expect_for_mode, | |
| 621 | ); | |
| 622 | ||
| 623 | self.step.dependOn(&run_and_compare.step); | |
| 624 | } | |
| 625 | } | |
| 626 | ||
| 627 | const RunAndCompareStep = struct { | |
| 628 | step: build.Step, | |
| 629 | context: *StackTracesContext, | |
| 630 | exe: *LibExeObjStep, | |
| 631 | name: []const u8, | |
| 632 | mode: Mode, | |
| 633 | expect_output: []const u8, | |
| 634 | test_index: usize, | |
| 635 | ||
| 636 | pub fn create( | |
| 637 | context: *StackTracesContext, | |
| 638 | exe: *LibExeObjStep, | |
| 639 | name: []const u8, | |
| 640 | mode: Mode, | |
| 641 | expect_output: []const u8, | |
| 642 | ) *RunAndCompareStep { | |
| 643 | const allocator = context.b.allocator; | |
| 644 | const ptr = allocator.create(RunAndCompareStep) catch unreachable; | |
| 645 | ptr.* = RunAndCompareStep{ | |
| 646 | .step = build.Step.init("StackTraceCompareOutputStep", allocator, make), | |
| 647 | .context = context, | |
| 648 | .exe = exe, | |
| 649 | .name = name, | |
| 650 | .mode = mode, | |
| 651 | .expect_output = expect_output, | |
| 652 | .test_index = context.test_index, | |
| 653 | }; | |
| 654 | ptr.step.dependOn(&exe.step); | |
| 655 | context.test_index += 1; | |
| 656 | return ptr; | |
| 657 | } | |
| 658 | ||
| 659 | fn make(step: *build.Step) !void { | |
| 660 | const self = @fieldParentPtr(RunAndCompareStep, "step", step); | |
| 661 | const b = self.context.b; | |
| 662 | ||
| 663 | const full_exe_path = self.exe.getOutputPath(); | |
| 664 | var args = ArrayList([]const u8).init(b.allocator); | |
| 665 | defer args.deinit(); | |
| 666 | args.append(full_exe_path) catch unreachable; | |
| 667 | ||
| 668 | warn("Test {}/{} {}...", self.test_index + 1, self.context.test_index, self.name); | |
| 669 | ||
| 670 | const child = std.ChildProcess.init(args.toSliceConst(), b.allocator) catch unreachable; | |
| 671 | defer child.deinit(); | |
| 672 | ||
| 673 | child.stdin_behavior = .Ignore; | |
| 674 | child.stdout_behavior = .Pipe; | |
| 675 | child.stderr_behavior = .Pipe; | |
| 676 | child.env_map = b.env_map; | |
| 677 | ||
| 678 | child.spawn() catch |err| debug.panic("Unable to spawn {}: {}\n", full_exe_path, @errorName(err)); | |
| 679 | ||
| 680 | var stdout = Buffer.initNull(b.allocator); | |
| 681 | var stderr = Buffer.initNull(b.allocator); | |
| 682 | ||
| 683 | var stdout_file_in_stream = child.stdout.?.inStream(); | |
| 684 | var stderr_file_in_stream = child.stderr.?.inStream(); | |
| 685 | ||
| 686 | stdout_file_in_stream.stream.readAllBuffer(&stdout, max_stdout_size) catch unreachable; | |
| 687 | stderr_file_in_stream.stream.readAllBuffer(&stderr, max_stdout_size) catch unreachable; | |
| 688 | ||
| 689 | const term = child.wait() catch |err| { | |
| 690 | debug.panic("Unable to spawn {}: {}\n", full_exe_path, @errorName(err)); | |
| 691 | }; | |
| 692 | ||
| 693 | switch (term) { | |
| 694 | .Exited => |code| { | |
| 695 | const expect_code: u32 = 1; | |
| 696 | if (code != expect_code) { | |
| 697 | warn("Process {} exited with error code {} but expected code {}\n", full_exe_path, code, expect_code); | |
| 698 | printInvocation(args.toSliceConst()); | |
| 699 | return error.TestFailed; | |
| 700 | } | |
| 701 | }, | |
| 702 | .Signal => |signum| { | |
| 703 | warn("Process {} terminated on signal {}\n", full_exe_path, signum); | |
| 704 | printInvocation(args.toSliceConst()); | |
| 705 | return error.TestFailed; | |
| 706 | }, | |
| 707 | .Stopped => |signum| { | |
| 708 | warn("Process {} stopped on signal {}\n", full_exe_path, signum); | |
| 709 | printInvocation(args.toSliceConst()); | |
| 710 | return error.TestFailed; | |
| 711 | }, | |
| 712 | .Unknown => |code| { | |
| 713 | warn("Process {} terminated unexpectedly with error code {}\n", full_exe_path, code); | |
| 714 | printInvocation(args.toSliceConst()); | |
| 715 | return error.TestFailed; | |
| 716 | }, | |
| 717 | } | |
| 718 | ||
| 719 | // process result | |
| 720 | // - keep only basename of source file path | |
| 721 | // - replace address with symbolic string | |
| 722 | // - skip empty lines | |
| 723 | const got: []const u8 = got_result: { | |
| 724 | var buf = try Buffer.initSize(b.allocator, 0); | |
| 725 | defer buf.deinit(); | |
| 726 | var bytes = stderr.toSliceConst(); | |
| 727 | if (bytes.len != 0 and bytes[bytes.len - 1] == '\n') bytes = bytes[0 .. bytes.len - 1]; | |
| 728 | var it = mem.separate(bytes, "\n"); | |
| 729 | process_lines: while (it.next()) |line| { | |
| 730 | if (line.len == 0) continue; | |
| 731 | const delims = [_][]const u8{ ":", ":", ":", " in " }; | |
| 732 | var marks = [_]usize{0} ** 4; | |
| 733 | // offset search past `[drive]:` on windows | |
| 734 | var pos: usize = if (builtin.os == .windows) 2 else 0; | |
| 735 | for (delims) |delim, i| { | |
| 736 | marks[i] = mem.indexOfPos(u8, line, pos, delim) orelse { | |
| 737 | try buf.append(line); | |
| 738 | try buf.append("\n"); | |
| 739 | continue :process_lines; | |
| 740 | }; | |
| 741 | pos = marks[i] + delim.len; | |
| 742 | } | |
| 743 | pos = mem.lastIndexOfScalar(u8, line[0..marks[0]], fs.path.sep) orelse { | |
| 744 | try buf.append(line); | |
| 745 | try buf.append("\n"); | |
| 746 | continue :process_lines; | |
| 747 | }; | |
| 748 | try buf.append(line[pos + 1 .. marks[2] + delims[2].len]); | |
| 749 | try buf.append(" [address]"); | |
| 750 | try buf.append(line[marks[3]..]); | |
| 751 | try buf.append("\n"); | |
| 752 | } | |
| 753 | break :got_result buf.toOwnedSlice(); | |
| 754 | }; | |
| 755 | ||
| 756 | if (!mem.eql(u8, self.expect_output, got)) { | |
| 757 | warn( | |
| 758 | \\ | |
| 759 | \\========= Expected this output: ========= | |
| 760 | \\{} | |
| 761 | \\================================================ | |
| 762 | \\{} | |
| 763 | \\ | |
| 764 | , self.expect_output, got); | |
| 765 | return error.TestFailed; | |
| 766 | } | |
| 767 | warn("OK\n"); | |
| 768 | } | |
| 769 | }; | |
| 770 | }; | |
| 771 | ||
| 552 | 772 | pub const CompileErrorContext = struct { |
| 553 | 773 | b: *build.Builder, |
| 554 | 774 | step: *build.Step, |
tools/process_headers.zig+70-326| ... | ... | @@ -20,6 +20,7 @@ const assert = std.debug.assert; |
| 20 | 20 | const LibCTarget = struct { |
| 21 | 21 | name: []const u8, |
| 22 | 22 | arch: MultiArch, |
| 23 | abi: MultiAbi, | |
| 23 | 24 | }; |
| 24 | 25 | |
| 25 | 26 | const MultiArch = union(enum) { |
| ... | ... | @@ -39,396 +40,129 @@ const MultiArch = union(enum) { |
| 39 | 40 | } |
| 40 | 41 | }; |
| 41 | 42 | |
| 43 | const MultiAbi = union(enum) { | |
| 44 | musl, | |
| 45 | specific: Abi, | |
| 46 | ||
| 47 | fn eql(a: MultiAbi, b: MultiAbi) bool { | |
| 48 | if (@enumToInt(a) != @enumToInt(b)) | |
| 49 | return false; | |
| 50 | if (@TagType(MultiAbi)(a) != .specific) | |
| 51 | return true; | |
| 52 | return a.specific == b.specific; | |
| 53 | } | |
| 54 | }; | |
| 55 | ||
| 42 | 56 | const glibc_targets = [_]LibCTarget{ |
| 43 | 57 | LibCTarget{ |
| 44 | 58 | .name = "aarch64_be-linux-gnu", |
| 45 | .zig_arch = Arch.aarch64_be, | |
| 46 | .zig_abi = Abi.gnu, | |
| 59 | .arch = MultiArch {.specific = Arch.aarch64_be}, | |
| 60 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 47 | 61 | }, |
| 48 | 62 | LibCTarget{ |
| 49 | 63 | .name = "aarch64-linux-gnu", |
| 50 | .zig_arch = Arch.aarch64, | |
| 51 | .zig_abi = Abi.gnu, | |
| 52 | }, | |
| 53 | LibCTarget{ | |
| 54 | .name = "aarch64-linux-gnu-disable-multi-arch", | |
| 55 | .zig_arch = Arch.aarch64, | |
| 56 | .zig_abi = null, | |
| 57 | }, | |
| 58 | LibCTarget{ | |
| 59 | .name = "alpha-linux-gnu", | |
| 60 | .zig_arch = null, | |
| 61 | .zig_abi = Abi.gnu, | |
| 64 | .arch = MultiArch {.specific = Arch.aarch64}, | |
| 65 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 62 | 66 | }, |
| 63 | 67 | LibCTarget{ |
| 64 | 68 | .name = "armeb-linux-gnueabi", |
| 65 | .zig_arch = Arch.armeb, | |
| 66 | .zig_abi = Abi.gnueabi, | |
| 67 | }, | |
| 68 | LibCTarget{ | |
| 69 | .name = "armeb-linux-gnueabi-be8", | |
| 70 | .zig_arch = Arch.armeb, | |
| 71 | .zig_abi = null, | |
| 69 | .arch = MultiArch {.specific = Arch.armeb}, | |
| 70 | .abi = MultiAbi {.specific = Abi.gnueabi}, | |
| 72 | 71 | }, |
| 73 | 72 | LibCTarget{ |
| 74 | 73 | .name = "armeb-linux-gnueabihf", |
| 75 | .zig_arch = Arch.armeb, | |
| 76 | .zig_abi = Abi.gnueabihf, | |
| 77 | }, | |
| 78 | LibCTarget{ | |
| 79 | .name = "armeb-linux-gnueabihf-be8", | |
| 80 | .zig_arch = Arch.armeb, | |
| 81 | .zig_abi = null, | |
| 74 | .arch = MultiArch {.specific = Arch.armeb}, | |
| 75 | .abi = MultiAbi {.specific = Abi.gnueabihf}, | |
| 82 | 76 | }, |
| 83 | 77 | LibCTarget{ |
| 84 | 78 | .name = "arm-linux-gnueabi", |
| 85 | .zig_arch = Arch.arm, | |
| 86 | .zig_abi = Abi.gnueabi, | |
| 79 | .arch = MultiArch {.specific = Arch.arm}, | |
| 80 | .abi = MultiAbi {.specific = Abi.gnueabi}, | |
| 87 | 81 | }, |
| 88 | 82 | LibCTarget{ |
| 89 | 83 | .name = "arm-linux-gnueabihf", |
| 90 | .zig_arch = Arch.arm, | |
| 91 | .zig_abi = Abi.gnueabihf, | |
| 92 | }, | |
| 93 | LibCTarget{ | |
| 94 | .name = "arm-linux-gnueabihf-v7a", | |
| 95 | .zig_arch = Arch.arm, | |
| 96 | .zig_abi = null, | |
| 97 | }, | |
| 98 | LibCTarget{ | |
| 99 | .name = "arm-linux-gnueabihf-v7a-disable-multi-arch", | |
| 100 | .zig_arch = null, | |
| 101 | .zig_abi = null, | |
| 102 | }, | |
| 103 | LibCTarget{ | |
| 104 | .name = "hppa-linux-gnu", | |
| 105 | .zig_arch = null, | |
| 106 | .zig_abi = Abi.gnu, | |
| 107 | }, | |
| 108 | LibCTarget{ | |
| 109 | .name = "i486-linux-gnu", | |
| 110 | .zig_arch = null, | |
| 111 | .zig_abi = Abi.gnu, | |
| 112 | }, | |
| 113 | LibCTarget{ | |
| 114 | .name = "i586-linux-gnu", | |
| 115 | .zig_arch = null, | |
| 116 | .zig_abi = Abi.gnu, | |
| 117 | }, | |
| 118 | LibCTarget{ | |
| 119 | .name = "i686-gnu", | |
| 120 | .zig_arch = Arch.i386, | |
| 121 | .zig_abi = Abi.gnu, | |
| 84 | .arch = MultiArch {.specific = Arch.arm}, | |
| 85 | .abi = MultiAbi {.specific = Abi.gnueabihf}, | |
| 122 | 86 | }, |
| 123 | 87 | LibCTarget{ |
| 124 | 88 | .name = "i686-linux-gnu", |
| 125 | .zig_arch = Arch.i386, | |
| 126 | .zig_abi = Abi.gnu, | |
| 127 | }, | |
| 128 | LibCTarget{ | |
| 129 | .name = "i686-linux-gnu-disable-multi-arch", | |
| 130 | .zig_arch = null, | |
| 131 | .zig_abi = null, | |
| 132 | }, | |
| 133 | LibCTarget{ | |
| 134 | .name = "i686-linux-gnu-enable-obsolete", | |
| 135 | .zig_arch = Arch.i386, | |
| 136 | .zig_abi = null, | |
| 137 | }, | |
| 138 | LibCTarget{ | |
| 139 | .name = "i686-linux-gnu-static-pie", | |
| 140 | .zig_arch = Arch.i386, | |
| 141 | .zig_abi = null, | |
| 142 | }, | |
| 143 | LibCTarget{ | |
| 144 | .name = "ia64-linux-gnu", | |
| 145 | .zig_arch = null, | |
| 146 | .zig_abi = null, | |
| 147 | }, | |
| 148 | LibCTarget{ | |
| 149 | .name = "m68k-linux-gnu", | |
| 150 | .zig_arch = null, | |
| 151 | .zig_abi = null, | |
| 152 | }, | |
| 153 | LibCTarget{ | |
| 154 | .name = "m68k-linux-gnu-coldfire", | |
| 155 | .zig_arch = null, | |
| 156 | .zig_abi = null, | |
| 157 | }, | |
| 158 | LibCTarget{ | |
| 159 | .name = "m68k-linux-gnu-coldfire-soft", | |
| 160 | .zig_arch = null, | |
| 161 | .zig_abi = null, | |
| 162 | }, | |
| 163 | LibCTarget{ | |
| 164 | .name = "microblazeel-linux-gnu", | |
| 165 | .zig_arch = null, | |
| 166 | .zig_abi = null, | |
| 167 | }, | |
| 168 | LibCTarget{ | |
| 169 | .name = "microblaze-linux-gnu", | |
| 170 | .zig_arch = null, | |
| 171 | .zig_abi = null, | |
| 89 | .arch = MultiArch {.specific = Arch.i386}, | |
| 90 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 172 | 91 | }, |
| 173 | 92 | LibCTarget{ |
| 174 | 93 | .name = "mips64el-linux-gnu-n32", |
| 175 | .zig_arch = Arch.mips64el, | |
| 176 | .zig_abi = Abi.gnuabin32, | |
| 177 | }, | |
| 178 | LibCTarget{ | |
| 179 | .name = "mips64el-linux-gnu-n32-nan2008", | |
| 180 | .zig_arch = Arch.mips64el, | |
| 181 | .zig_abi = null, | |
| 182 | }, | |
| 183 | LibCTarget{ | |
| 184 | .name = "mips64el-linux-gnu-n32-nan2008-soft", | |
| 185 | .zig_arch = Arch.mips64el, | |
| 186 | .zig_abi = null, | |
| 187 | }, | |
| 188 | LibCTarget{ | |
| 189 | .name = "mips64el-linux-gnu-n32-soft", | |
| 190 | .zig_arch = Arch.mips64el, | |
| 191 | .zig_abi = null, | |
| 94 | .arch = MultiArch {.specific = Arch.mips64el}, | |
| 95 | .abi = MultiAbi {.specific = Abi.gnuabin32}, | |
| 192 | 96 | }, |
| 193 | 97 | LibCTarget{ |
| 194 | 98 | .name = "mips64el-linux-gnu-n64", |
| 195 | .zig_arch = Arch.mips64el, | |
| 196 | .zig_abi = Abi.gnuabi64, | |
| 197 | }, | |
| 198 | LibCTarget{ | |
| 199 | .name = "mips64el-linux-gnu-n64-nan2008", | |
| 200 | .zig_arch = Arch.mips64el, | |
| 201 | .zig_abi = null, | |
| 202 | }, | |
| 203 | LibCTarget{ | |
| 204 | .name = "mips64el-linux-gnu-n64-nan2008-soft", | |
| 205 | .zig_arch = Arch.mips64el, | |
| 206 | .zig_abi = null, | |
| 207 | }, | |
| 208 | LibCTarget{ | |
| 209 | .name = "mips64el-linux-gnu-n64-soft", | |
| 210 | .zig_arch = Arch.mips64el, | |
| 211 | .zig_abi = null, | |
| 99 | .arch = MultiArch {.specific = Arch.mips64el}, | |
| 100 | .abi = MultiAbi {.specific = Abi.gnuabi64}, | |
| 212 | 101 | }, |
| 213 | 102 | LibCTarget{ |
| 214 | 103 | .name = "mips64-linux-gnu-n32", |
| 215 | .zig_arch = Arch.mips64, | |
| 216 | .zig_abi = Abi.gnuabin32, | |
| 217 | }, | |
| 218 | LibCTarget{ | |
| 219 | .name = "mips64-linux-gnu-n32-nan2008", | |
| 220 | .zig_arch = Arch.mips64, | |
| 221 | .zig_abi = null, | |
| 222 | }, | |
| 223 | LibCTarget{ | |
| 224 | .name = "mips64-linux-gnu-n32-nan2008-soft", | |
| 225 | .zig_arch = Arch.mips64, | |
| 226 | .zig_abi = null, | |
| 227 | }, | |
| 228 | LibCTarget{ | |
| 229 | .name = "mips64-linux-gnu-n32-soft", | |
| 230 | .zig_arch = Arch.mips64, | |
| 231 | .zig_abi = null, | |
| 104 | .arch = MultiArch {.specific = Arch.mips64}, | |
| 105 | .abi = MultiAbi {.specific = Abi.gnuabin32}, | |
| 232 | 106 | }, |
| 233 | 107 | LibCTarget{ |
| 234 | 108 | .name = "mips64-linux-gnu-n64", |
| 235 | .zig_arch = Arch.mips64, | |
| 236 | .zig_abi = Abi.gnuabi64, | |
| 237 | }, | |
| 238 | LibCTarget{ | |
| 239 | .name = "mips64-linux-gnu-n64-nan2008", | |
| 240 | .zig_arch = Arch.mips64, | |
| 241 | .zig_abi = null, | |
| 242 | }, | |
| 243 | LibCTarget{ | |
| 244 | .name = "mips64-linux-gnu-n64-nan2008-soft", | |
| 245 | .zig_arch = Arch.mips64, | |
| 246 | .zig_abi = null, | |
| 247 | }, | |
| 248 | LibCTarget{ | |
| 249 | .name = "mips64-linux-gnu-n64-soft", | |
| 250 | .zig_arch = Arch.mips64, | |
| 251 | .zig_abi = null, | |
| 109 | .arch = MultiArch {.specific = Arch.mips64}, | |
| 110 | .abi = MultiAbi {.specific = Abi.gnuabi64}, | |
| 252 | 111 | }, |
| 253 | 112 | LibCTarget{ |
| 254 | 113 | .name = "mipsel-linux-gnu", |
| 255 | .zig_arch = Arch.mipsel, | |
| 256 | .zig_abi = Abi.gnu, | |
| 257 | }, | |
| 258 | LibCTarget{ | |
| 259 | .name = "mipsel-linux-gnu-nan2008", | |
| 260 | .zig_arch = Arch.mipsel, | |
| 261 | .zig_abi = null, | |
| 262 | }, | |
| 263 | LibCTarget{ | |
| 264 | .name = "mipsel-linux-gnu-nan2008-soft", | |
| 265 | .zig_arch = Arch.mipsel, | |
| 266 | .zig_abi = null, | |
| 267 | }, | |
| 268 | LibCTarget{ | |
| 269 | .name = "mipsel-linux-gnu-soft", | |
| 270 | .zig_arch = Arch.mipsel, | |
| 271 | .zig_abi = null, | |
| 114 | .arch = MultiArch {.specific = Arch.mipsel}, | |
| 115 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 272 | 116 | }, |
| 273 | 117 | LibCTarget{ |
| 274 | 118 | .name = "mips-linux-gnu", |
| 275 | .zig_arch = Arch.mips, | |
| 276 | .zig_abi = Abi.gnu, | |
| 277 | }, | |
| 278 | LibCTarget{ | |
| 279 | .name = "mips-linux-gnu-nan2008", | |
| 280 | .zig_arch = Arch.mips, | |
| 281 | .zig_abi = null, | |
| 282 | }, | |
| 283 | LibCTarget{ | |
| 284 | .name = "mips-linux-gnu-nan2008-soft", | |
| 285 | .zig_arch = Arch.mips, | |
| 286 | .zig_abi = null, | |
| 287 | }, | |
| 288 | LibCTarget{ | |
| 289 | .name = "mips-linux-gnu-soft", | |
| 290 | .zig_arch = Arch.mips, | |
| 291 | .zig_abi = null, | |
| 119 | .arch = MultiArch {.specific = Arch.mips}, | |
| 120 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 292 | 121 | }, |
| 293 | 122 | LibCTarget{ |
| 294 | 123 | .name = "powerpc64le-linux-gnu", |
| 295 | .zig_arch = Arch.powerpc64le, | |
| 296 | .zig_abi = Abi.gnu, | |
| 124 | .arch = MultiArch {.specific = Arch.powerpc64le}, | |
| 125 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 297 | 126 | }, |
| 298 | 127 | LibCTarget{ |
| 299 | 128 | .name = "powerpc64-linux-gnu", |
| 300 | .zig_arch = Arch.powerpc64, | |
| 301 | .zig_abi = Abi.gnu, | |
| 129 | .arch = MultiArch {.specific = Arch.powerpc64}, | |
| 130 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 302 | 131 | }, |
| 303 | 132 | LibCTarget{ |
| 304 | 133 | .name = "powerpc-linux-gnu", |
| 305 | .zig_arch = Arch.powerpc, | |
| 306 | .zig_abi = Abi.gnu, | |
| 307 | }, | |
| 308 | LibCTarget{ | |
| 309 | .name = "powerpc-linux-gnu-power4", | |
| 310 | .zig_arch = Arch.powerpc, | |
| 311 | .zig_abi = null, | |
| 312 | }, | |
| 313 | LibCTarget{ | |
| 314 | .name = "powerpc-linux-gnu-soft", | |
| 315 | .zig_arch = Arch.powerpc, | |
| 316 | .zig_abi = null, | |
| 317 | }, | |
| 318 | LibCTarget{ | |
| 319 | .name = "powerpc-linux-gnuspe", | |
| 320 | .zig_arch = Arch.powerpc, | |
| 321 | .zig_abi = null, | |
| 322 | }, | |
| 323 | LibCTarget{ | |
| 324 | .name = "powerpc-linux-gnuspe-e500v1", | |
| 325 | .zig_arch = Arch.powerpc, | |
| 326 | .zig_abi = null, | |
| 134 | .arch = MultiArch {.specific = Arch.powerpc}, | |
| 135 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 327 | 136 | }, |
| 328 | 137 | LibCTarget{ |
| 329 | 138 | .name = "riscv64-linux-gnu-rv64imac-lp64", |
| 330 | .zig_arch = Arch.riscv64, | |
| 331 | .zig_abi = Abi.gnu, | |
| 332 | }, | |
| 333 | LibCTarget{ | |
| 334 | .name = "riscv64-linux-gnu-rv64imafdc-lp64", | |
| 335 | .zig_arch = Arch.riscv64, | |
| 336 | .zig_abi = null, | |
| 337 | }, | |
| 338 | LibCTarget{ | |
| 339 | .name = "riscv64-linux-gnu-rv64imafdc-lp64d", | |
| 340 | .zig_arch = Arch.riscv64, | |
| 341 | .zig_abi = null, | |
| 342 | }, | |
| 343 | LibCTarget{ | |
| 344 | .name = "s390-linux-gnu", | |
| 345 | .zig_arch = null, | |
| 346 | .zig_abi = Abi.gnu, | |
| 139 | .arch = MultiArch {.specific = Arch.riscv64}, | |
| 140 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 347 | 141 | }, |
| 348 | 142 | LibCTarget{ |
| 349 | 143 | .name = "s390x-linux-gnu", |
| 350 | .zig_arch = Arch.s390x, | |
| 351 | .zig_abi = Abi.gnu, | |
| 352 | }, | |
| 353 | LibCTarget{ | |
| 354 | .name = "sh3eb-linux-gnu", | |
| 355 | .zig_arch = null, | |
| 356 | .zig_abi = Abi.gnu, | |
| 357 | }, | |
| 358 | LibCTarget{ | |
| 359 | .name = "sh3-linux-gnu", | |
| 360 | .zig_arch = null, | |
| 361 | .zig_abi = Abi.gnu, | |
| 362 | }, | |
| 363 | LibCTarget{ | |
| 364 | .name = "sh4eb-linux-gnu", | |
| 365 | .zig_arch = null, | |
| 366 | .zig_abi = Abi.gnu, | |
| 367 | }, | |
| 368 | LibCTarget{ | |
| 369 | .name = "sh4eb-linux-gnu-soft", | |
| 370 | .zig_arch = null, | |
| 371 | .zig_abi = null, | |
| 372 | }, | |
| 373 | LibCTarget{ | |
| 374 | .name = "sh4-linux-gnu", | |
| 375 | .zig_arch = null, | |
| 376 | .zig_abi = Abi.gnu, | |
| 377 | }, | |
| 378 | LibCTarget{ | |
| 379 | .name = "sh4-linux-gnu-soft", | |
| 380 | .zig_arch = null, | |
| 381 | .zig_abi = null, | |
| 144 | .arch = MultiArch {.specific = Arch.s390x}, | |
| 145 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 382 | 146 | }, |
| 383 | 147 | LibCTarget{ |
| 384 | 148 | .name = "sparc64-linux-gnu", |
| 385 | .zig_arch = Arch.sparc, | |
| 386 | .zig_abi = Abi.gnu, | |
| 387 | }, | |
| 388 | LibCTarget{ | |
| 389 | .name = "sparc64-linux-gnu-disable-multi-arch", | |
| 390 | .zig_arch = Arch.sparc, | |
| 391 | .zig_abi = null, | |
| 149 | .arch = MultiArch {.specific = Arch.sparc}, | |
| 150 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 392 | 151 | }, |
| 393 | 152 | LibCTarget{ |
| 394 | 153 | .name = "sparcv9-linux-gnu", |
| 395 | .zig_arch = Arch.sparcv9, | |
| 396 | .zig_abi = Abi.gnu, | |
| 397 | }, | |
| 398 | LibCTarget{ | |
| 399 | .name = "sparcv9-linux-gnu-disable-multi-arch", | |
| 400 | .zig_arch = Arch.sparcv9, | |
| 401 | .zig_abi = null, | |
| 154 | .arch = MultiArch {.specific = Arch.sparcv9}, | |
| 155 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 402 | 156 | }, |
| 403 | 157 | LibCTarget{ |
| 404 | 158 | .name = "x86_64-linux-gnu", |
| 405 | .zig_arch = Arch.x86_64, | |
| 406 | .zig_abi = Abi.gnu, | |
| 407 | }, | |
| 408 | LibCTarget{ | |
| 409 | .name = "x86_64-linux-gnu-disable-multi-arch", | |
| 410 | .zig_arch = Arch.x86_64, | |
| 411 | .zig_abi = null, | |
| 412 | }, | |
| 413 | LibCTarget{ | |
| 414 | .name = "x86_64-linux-gnu-enable-obsolete", | |
| 415 | .zig_arch = Arch.x86_64, | |
| 416 | .zig_abi = null, | |
| 417 | }, | |
| 418 | LibCTarget{ | |
| 419 | .name = "x86_64-linux-gnu-static-pie", | |
| 420 | .zig_arch = Arch.x86_64, | |
| 421 | .zig_abi = null, | |
| 159 | .arch = MultiArch {.specific = Arch.x86_64}, | |
| 160 | .abi = MultiAbi {.specific = Abi.gnu}, | |
| 422 | 161 | }, |
| 423 | 162 | LibCTarget{ |
| 424 | 163 | .name = "x86_64-linux-gnu-x32", |
| 425 | .zig_arch = Arch.x86_64, | |
| 426 | .zig_abi = Abi.gnux32, | |
| 427 | }, | |
| 428 | LibCTarget{ | |
| 429 | .name = "x86_64-linux-gnu-x32-static-pie", | |
| 430 | .zig_arch = Arch.x86_64, | |
| 431 | .zig_abi = null, | |
| 164 | .arch = MultiArch {.specific = Arch.x86_64}, | |
| 165 | .abi = MultiAbi {.specific = Abi.gnux32}, | |
| 432 | 166 | }, |
| 433 | 167 | }; |
| 434 | 168 | |
| ... | ... | @@ -436,42 +170,52 @@ const musl_targets = [_]LibCTarget{ |
| 436 | 170 | LibCTarget{ |
| 437 | 171 | .name = "aarch64", |
| 438 | 172 | .arch = MultiArch.aarch64, |
| 173 | .abi = MultiAbi.musl, | |
| 439 | 174 | }, |
| 440 | 175 | LibCTarget{ |
| 441 | 176 | .name = "arm", |
| 442 | 177 | .arch = MultiArch.arm, |
| 178 | .abi = MultiAbi.musl, | |
| 443 | 179 | }, |
| 444 | 180 | LibCTarget{ |
| 445 | 181 | .name = "i386", |
| 446 | 182 | .arch = MultiArch{ .specific = .i386 }, |
| 183 | .abi = MultiAbi.musl, | |
| 447 | 184 | }, |
| 448 | 185 | LibCTarget{ |
| 449 | 186 | .name = "mips", |
| 450 | 187 | .arch = MultiArch.mips, |
| 188 | .abi = MultiAbi.musl, | |
| 451 | 189 | }, |
| 452 | 190 | LibCTarget{ |
| 453 | 191 | .name = "mips64", |
| 454 | 192 | .arch = MultiArch.mips64, |
| 193 | .abi = MultiAbi.musl, | |
| 455 | 194 | }, |
| 456 | 195 | LibCTarget{ |
| 457 | 196 | .name = "powerpc", |
| 458 | 197 | .arch = MultiArch{ .specific = .powerpc }, |
| 198 | .abi = MultiAbi.musl, | |
| 459 | 199 | }, |
| 460 | 200 | LibCTarget{ |
| 461 | 201 | .name = "powerpc64", |
| 462 | 202 | .arch = MultiArch.powerpc64, |
| 203 | .abi = MultiAbi.musl, | |
| 463 | 204 | }, |
| 464 | 205 | LibCTarget{ |
| 465 | 206 | .name = "riscv64", |
| 466 | 207 | .arch = MultiArch{ .specific = .riscv64 }, |
| 208 | .abi = MultiAbi.musl, | |
| 467 | 209 | }, |
| 468 | 210 | LibCTarget{ |
| 469 | 211 | .name = "s390x", |
| 470 | 212 | .arch = MultiArch{ .specific = .s390x }, |
| 213 | .abi = MultiAbi.musl, | |
| 471 | 214 | }, |
| 472 | 215 | LibCTarget{ |
| 473 | 216 | .name = "x86_64", |
| 474 | 217 | .arch = MultiArch{ .specific = .x86_64 }, |
| 218 | .abi = MultiAbi.musl, | |
| 475 | 219 | }, |
| 476 | 220 | }; |
| 477 | 221 | |
| ... | ... | @@ -562,7 +306,7 @@ pub fn main() !void { |
| 562 | 306 | var libc_targets: []const LibCTarget = undefined; |
| 563 | 307 | switch (vendor) { |
| 564 | 308 | .musl => libc_targets = musl_targets, |
| 565 | .glibc => @panic("TODO this regressed"), // glibc_targets, | |
| 309 | .glibc => libc_targets = glibc_targets, | |
| 566 | 310 | } |
| 567 | 311 | |
| 568 | 312 | var path_table = PathTable.init(allocator); |
| ... | ... | @@ -577,7 +321,7 @@ pub fn main() !void { |
| 577 | 321 | .arch = libc_target.arch, |
| 578 | 322 | .abi = switch (vendor) { |
| 579 | 323 | .musl => .musl, |
| 580 | else => @panic("TODO this regressed"), | |
| 324 | .glibc => libc_target.abi.specific, | |
| 581 | 325 | }, |
| 582 | 326 | .os = .linux, |
| 583 | 327 | }; |
tools/update_glibc.zig+1-1| ... | ... | @@ -135,7 +135,7 @@ pub fn main() !void { |
| 135 | 135 | const allocator = &arena.allocator; |
| 136 | 136 | const args = try std.process.argsAlloc(allocator); |
| 137 | 137 | const in_glibc_dir = args[1]; // path to the unzipped tarball of glibc, e.g. ~/downloads/glibc-2.25 |
| 138 | const zig_src_dir = args[2]; // path to the source checkout of zig | |
| 138 | const zig_src_dir = args[2]; // path to the source checkout of zig, lib dir, e.g. ~/zig-src/lib | |
| 139 | 139 | |
| 140 | 140 | const prefix = try fs.path.join(allocator, [_][]const u8{ in_glibc_dir, "sysdeps", "unix", "sysv", "linux" }); |
| 141 | 141 | const glibc_out_dir = try fs.path.join(allocator, [_][]const u8{ zig_src_dir, "libc", "glibc" }); |