19921 Commits

Author SHA1 Message Date
Andrew Kelley
aa4544963c
Merge pull request #12629 from motiejus/libresolv-abilists
glibc/abilists: add libresolv stubs
2022-08-25 23:33:59 -04:00
Andrew Kelley
d2ad8afff4 LLVM: fix missing alignment on wrapping instructions
Previously, when lowering AIR instructions `wrap_errunion_payload`,
`wrap_errunion_err`, and `wrap_optional`, the LLVM backend would create
an alloca instruction to store the result, but did not set the alignment
on it. This caused UB which went undetected for a long time until we
started enabling the stack protector.

Closes #12594
Unblocks #12508
Inspires #12634

Tests passed locally:
 * test-behavior
 * test-cases
2022-08-25 16:15:48 -07:00
Andrew Kelley
9d231c4991 CI: drone: reduce duration of the bottleneck
Empirically, the ReleaseSmall std lib tsets take about 55 minutes on the
CI, and is the bottleneck causing timeouts. So this commit disables full
coverage in favor of running a smaller set of ReleaseSmall std lib tests.
2022-08-25 15:23:01 -07:00
Jakub Konka
d5233ee85c add ability to pass force undefined symbols to the linker
This commit enables `-u <symbol>` for ELF and `-include:<symbol>` for
COFF linkers for use internally. This means we do not expose these
flags to the users just yet, however, we make use of them internally
whenever required. One such use case is forcing inclusion of
`_tls_index` when linking for Windows with mingw and LTO and dead
code stripping enabled. This ensures we add `_tls_index` to the symbol
resolver as an undefined symbol and force the linker to include an atom
that provides it marking it a dead-code-stripping root - meaning it will
not be garbage collected by the linker no matter what.
2022-08-25 16:23:01 -04:00
Jakub Konka
ba346ecfe9 run_translated_c: disable failing test on Windows
ziglang/zig#12630
2022-08-25 17:01:49 +02:00
Motiejus Jakštys
29e90efbb1 src/glibc: remove redundant Arch
abilists now use Zig's arch, no need for a separate one.
2022-08-25 16:46:32 +03:00
Motiejus Jakštys
ea785f70ef glibc/abilists: add libresolv stubs
Generated with https://github.com/ziglang/glibc-abi-tool/pull/2

Fixes #12628
2022-08-25 16:36:10 +03:00
Veikka Tuominen
4405188cf7 Sema: ignore comptime params in partial func type check
This fixes a bug exposed by cd1833044ab7505bc101c85f59889bd3ea3fac80
where a function type would be converted to generic_poison even after
being instantiated due to containing comptime only types.

This could also be fixed by just checking `is_generic_instantiation`
but this way also provides better type names.

Closes #12625
2022-08-25 16:29:23 +03:00
Andrew Kelley
3a7ea0b65e fix order of CLI args passed to clang
Commit eb3f7d2f37cab1d3df7c4493b8239e802b83e521 changed the order of CLI
args passed to clang, making object-specific "extra flags" passed first.
However, these are supposed to be able to override other flags, and this
behavior is exploited by workarounds in mingw.zig to disable LTO.

This commit rectifies the situation by moving extra flags back to being
passed after the call to addCCArgs().
2022-08-25 03:10:41 -07:00
Andrew Kelley
7453f56e67 stage2: explicitly tagged enums no longer have one possible value
Previously, Zig had inconsistent semantics for an enum like this:

`enum(u8){zero = 0}`

Although in theory this can only hold one possible value, the tag
`zero`, Zig no longer will treat the type this way. It will do loads and
stores, as if the type has runtime bits.

Closes #12619

Tests passed locally:
 * test-behavior
 * test-cases
2022-08-24 22:20:31 -07:00
Andrew Kelley
af19909b9c stage2: fix generic function cleanup
When removing generic function instantiations from monomorphed_funcs, we
need to first make sure the function is generic, otherwise the hash map
tries to access the `hash` field of the function which is undefined.

closes #12614
2022-08-24 16:47:58 -07:00
Andrew Kelley
f4980a4800 CI: windows: update tarball
needed because of some changes to std.dwarf
2022-08-24 16:18:42 -07:00
Andrew Kelley
a9af472728 Compilation: move comptime condition first
Avoids compile error on Windows due to not having execv capabilities.

Fixup for eb3f7d2f37cab1d3df7c4493b8239e802b83e521.

See #6768
2022-08-24 15:19:31 -07:00
Jonas Gollenz
07afd5bdba docs: remove confusion about align[For|Back]ward 2022-08-24 17:18:29 -04:00
max
d8e22fcb20 fix coff.zig with const qualifier convert problem 2022-08-24 22:49:47 +02:00
Sébastien Marie
397099b7ee pthread_key_create: make it build with stage2 2022-08-24 16:35:01 -04:00
Loris Cro
eb3f7d2f37 compilation: avoid pointless caching
When the entire purpose of this compilation is to perform a single zig
cc operation we could "tail call" clang by doing an execve, and any use
of the caching system would actually be problematic since the user is
presumably doing their own caching by using dep file flags.

Fixes #12317
2022-08-24 16:33:01 -04:00
Andrew Kelley
7a881435ed
Merge pull request #12623 from Vexu/stage2-fixes
Stage2 fixes
2022-08-24 15:59:46 -04:00
Andrew Kelley
2a96209c40
Merge pull request #12574 from Vexu/remove-bit-op-type-param
stage2+stage1: remove type parameter from bit builtins
2022-08-24 15:57:44 -04:00
Andrew Kelley
80b8294bcc test-stack-traces: restore test coverage
reverts 1ce71c86bff351a4ade4321e188a13c9d3cff8b4
2022-08-24 12:57:31 -07:00
Andrew Kelley
40c9b13608 CI: x86_64-linux: update tarball
I thought this would be needed for dwarf 4 but I think it's not actually
needed. Anyway the tarball is fresher, might as well use it.
2022-08-24 12:57:31 -07:00
Felix "xq" Queißner
b466f8c817 Enables std.build.TranslateCStep to use stage1/stage2 selectively. Unbreaks projects using stage1 and manual TranslateC 2022-08-24 15:41:27 -04:00
Veikka Tuominen
69a3c4e279 Sema: correctly reset inst_map for analyzeInlineCallArg
Closes #12622
2022-08-24 21:31:02 +03:00
Veikka Tuominen
f49dff64c6 Sema: check one possible value earlier in zirValidateArrayInit
Closes #12566
2022-08-24 21:31:02 +03:00
Veikka Tuominen
1d0b729f28 Sema: fix crash on slice of non-array type
Closes #12621
2022-08-24 21:31:02 +03:00
Veikka Tuominen
cd1833044a Sema: do not construct nested partial function types
Closes #12616
2022-08-24 21:31:02 +03:00
Will Hawkins
5fd5950c92 Doc: Add hyphenation for top-level doc 2022-08-24 20:00:46 +03:00
Veikka Tuominen
d515d37934 AstGen: make root decls relative to beginning of file
Closes #12610
2022-08-24 15:26:49 +03:00
Veikka Tuominen
38215ccc3e stage2: handle int_u64 in elemValueAdvanced
Closes #12599
2022-08-24 15:04:31 +03:00
Felix "xq" Queißner
5696cc8ab6 Adds std.meta.FnPtr for easier stage1/stage2 compatibility 2022-08-24 03:13:44 -04:00
Andrew Kelley
5db80a051f Revert "std.os: add INVALID_SOCKET (#12081)"
This reverts commit 0f01e812ff054ea83661272bf0a96af228f2ffe3.

This does not belong in `std.posix`, and it is already provided at
`std.os.windows.ws2_32.INVALID_SOCKET`.

See related issue #5019.
2022-08-23 21:30:23 -07:00
Andrew Kelley
a31b449b55 make LLVM and Clang emit DWARF 4 instead of 5
This reverts 6d679eb2bcbe76e389c02e0bb4d4c4feb2847783 and additionally
changes the command line parameters passed to Clang to match.

Clang 14 defaults to DWARFv5 which is an interesting choice. v5 has been
out for 5 years and yet Valgrind does not support it, and apparently
neither does either GDB or LLD, I haven't determined which, but I wasn't
able to use GDB to debug my LLVM-emitted dwarf 5 zig code that was linked
with LLD.

A couple years ago when I was working on the self-hosted ELF linker, I
emitted DWARFv5 but then downgraded to v4 when I realized that third
party tools were stuck in the past. Years later, they still are.

Hopefully, Clang 14's bold move will inspire third party tools to get
their shit together, however, in the meantime, everything's broken, so
we're passing `-gdwarf-4` to clang and instructing LLVM to emit DWARFv4.

Note that Zig's std.debug code *does* support DWARFv5 already as of a
previous commit that I made today.
2022-08-23 21:24:03 -07:00
Andrew Kelley
60722261fa std.debug: DWARFv5 fixes
handle str_offsets_base and addr_base correctly.
handle data16
fix compilation on 32-bit hosts
remove stray debug print statement

closes #12120
2022-08-23 21:11:02 -07:00
yyny
0f01e812ff
std.os: add INVALID_SOCKET (#12081)
This constant returns an invalid `socket_t` that can be used as a sentinel
value.
2022-08-23 19:44:42 -05:00
Jakub Konka
d852894dcf skip failing compiler-rt divxf3 tests on Windows 2022-08-23 22:59:11 +02:00
Jakub Konka
abfe21a4fe skip failing f80 behavior tests on Windows 2022-08-23 22:43:19 +02:00
Jakub Konka
f907f74282 coff: fix compile errors in std.debug 2022-08-23 22:01:05 +02:00
Jakub Konka
cf9f6fd7f0 macho: fix compile errors in std.debug 2022-08-23 22:01:05 +02:00
Loris Cro
c8d04fea15
Merge pull request #12598 from ziglang/autodoc-anonstruct-wip
Autodoc: anon_init_struct support
2022-08-23 18:50:36 +02:00
Loris Cro
b32e5a14ce autodoc: handle self-referential call+field_type instructions 2022-08-23 18:45:22 +02:00
Loris Cro
0482e8ba9d autodoc: initial support for struct_init_anon 2022-08-23 18:37:29 +02:00
Loris Cro
583175dc1d ci: upload rendered source listings in stdlib docs 2022-08-23 15:59:35 +02:00
Loris Cro
102a6e9e9c
Merge pull request #12481 from alichraghi/patch-1
docs: add padding between functions list
2022-08-23 15:48:35 +02:00
Loris Cro
13e502b89b
Merge pull request #12502 from squeek502/autodoc-fields-light-mode
autodoc: Fix border color around field docs in light mode
2022-08-23 15:48:01 +02:00
Loris Cro
d635dcacbf
Merge pull request #12542 from der-teufel-programming/compileError-input
autodoc: show compileErrors correctly
2022-08-23 15:46:26 +02:00
Loris Cro
8c27e7ed91
Merge pull request #12583 from der-teufel-programming/autodoc-error-set
autodoc: error sets now display all their members
2022-08-23 15:44:13 +02:00
Andrew Kelley
1ce71c86bf std.debug: implement support for DWARFv5 2022-08-23 00:28:45 -07:00
Jakub Konka
c84e5ee878 coff: improve default COFF/PE object parser
We now do not allocate memory for headers and other metadata unless
requested by the caller. Instead, we read-in the entire contents
of the image into memory and operate on pointers and casts wherever
possible. I have a left a TODO to hook up Windows' memory-mapped API
here in-place of standard `readToEndAlloc` which should be more memory
proof on memory constrained hosts.

This commit also supplements our `std.coff` with a lot missing basic
extern structs required to make our COFF linker.
2022-08-23 08:55:04 +02:00
Der Teufel
970268d1f5 autodoc: error sets now display all their members 2022-08-23 08:35:13 +02:00
Andrew Kelley
9043e665a5 add behavior test for copying array of vectors
closes #12026
2022-08-22 18:37:42 -07:00