Jacob G-W
2d2a6ed1a4
stage2: implement @setRuntimeSafety
2021-06-25 08:57:03 +03:00
Jacob G-W
4adcd560ce
langref: make @setRuntimeSafety more correct
2021-06-25 08:57:03 +03:00
Jakub Konka
350ead9cb2
Merge pull request #9229 from ziglang/zld-objc-frameworks
...
zig ld: link Obj-C, link frameworks, improve linker's implementation
2021-06-25 07:51:21 +02:00
Jakub Konka
ddd2cd7330
zld: fix Dylib.Id parsing logic for string values
2021-06-24 23:34:31 +02:00
Jakub Konka
264f5f4544
Apply AST fixes
2021-06-24 23:08:24 +02:00
Jakub Konka
8fc5b5a087
zld: put DICE and CodeSig load commands last
...
after `LC_LOAD_DYLIB` commands to match ld64 and make the binaries
compatible with Apple tools.
2021-06-24 22:40:19 +02:00
Jakub Konka
ad0be78577
zld: parse dylib's id from tbd
2021-06-24 22:19:44 +02:00
Jakub Konka
5e0e7b2cb4
zld: exclude libs part of the umbrella
...
when parsing the umbrella lib
2021-06-24 20:27:23 +02:00
Jakub Konka
8669e3d46b
zld: when parsing dylibs, allow multiple return values
2021-06-24 18:57:21 +02:00
Jakub Konka
5ac5cd9de7
zld: naively parse all dylib deps in stubs
2021-06-24 18:57:11 +02:00
Jakub Konka
3cb6b6bd90
zld: merge Stub with Dylib struct
...
After giving it more thought, it doesn't make sense to separate
the two structurally. Instead, there should be two constructors
for a Dylib struct: one from binary file, and the other from a stub
file. This cleans up a lot of code and opens the way for recursive
parsing of re-exports from a dylib which are a hard requirement for
native feel when linking frameworks.
2021-06-24 18:57:04 +02:00
Jakub Konka
3f57468c8b
Classify .m as ObjC, compile using clang and link with zld
2021-06-24 18:56:56 +02:00
Jakub Konka
52a9d3f037
zld: clean up memory management and refactor
2021-06-24 18:56:48 +02:00
Jakub Konka
1ff3ebffa3
zld: handle dynamic binding of proxies for objc correctly
2021-06-24 18:56:41 +02:00
Jakub Konka
0736365fa4
zld: fix finding pointers for rebasing
2021-06-24 18:56:33 +02:00
Jakub Konka
d1fcb99848
zld+macho: populate segname from SegmentCommand when adding section
2021-06-24 18:56:17 +02:00
Jakub Konka
a480ae6e37
zld: handle objc-specific sections
2021-06-24 18:56:09 +02:00
Jakub Konka
5f9b4cba6d
zld: clean up logic for matching and mapping sections
2021-06-24 18:55:43 +02:00
Jakub Konka
852e1ed23c
zld+stage2: refactor creating segments and sections
...
Move the logic into default-init structs part of constructors in
`SegmentCommand` struct in `commands.zig` module.
2021-06-24 18:53:42 +02:00
Jakub Konka
72f2f68938
zld: parse framework dirs and names
2021-06-24 18:53:28 +02:00
Jakub Konka
8216ce6789
Merge pull request #9171 from ziglang/zld-tapi
...
zld: add TAPI parser for linkers, ship libSystem.B.tbd with Zig, and parse tbd stubs on macOS
2021-06-24 18:41:33 +02:00
Jakub Konka
cea8a2f500
tapi: apply ast fixes
2021-06-24 15:01:14 +02:00
Jakub Konka
b55a3cefa4
zld: extract path to libc in the linker proper
2021-06-24 14:45:45 +02:00
Jakub Konka
bc78b02c04
zld: introduce Stub.zig which represents parsed stub file
...
Instead of trying to fit a stub file into the frame of a Dylib struct,
I think it makes more sense to keep them as separate entities with
possibly shared interface (which would be added in the future).
This cleaned up a lot of logic in Dylib as well as Stub. Also, while
here I've made creating actual *Symbols lazy in the sense Dylib and
Stub only store hash maps of symbol names that they expose but we
defer create and referencing given dylib/stub until link time when
a symbol is actually referenced. This should reduce memory usage
and speed things up a bit.
2021-06-24 14:45:45 +02:00
Jakub Konka
09b46198ff
zld: move logic unpacking path to libc stub to Compilation
2021-06-24 14:45:45 +02:00
Jakub Konka
a600d41880
zld: apply AST fixes
2021-06-24 14:45:45 +02:00
Jakub Konka
4854c96bc5
zld: create a synthetic ___dso_handle symbol self-referenced
2021-06-24 14:45:45 +02:00
Jakub Konka
96a0479db2
zld: parse lib stubs as tbds on the linker line
2021-06-24 14:45:45 +02:00
Jakub Konka
089577a71d
zld: parse libSystem tbd stub when linking
2021-06-24 14:45:45 +02:00
Jakub Konka
fbdc515418
link: add basic TAPI parser for linkers
...
Parser uses kubkon/zig-yaml gitrev c3eae1e40a02aedd44ad1171e5c8b259896cbda0
2021-06-24 14:45:45 +02:00
Andrew Kelley
31c49ad64d
Merge pull request #9191 from ziglang/stage1-astcheck
...
run AstGen even when using the stage1 backend
2021-06-23 18:09:19 -04:00
Evan Haas
29314b64bd
translate-c: ensure scoped (non-public) enum constants are used
2021-06-23 14:51:19 -04:00
Andrew Kelley
3259532080
langref: fix unused vars
2021-06-23 11:32:28 -07:00
Evan Haas
de9306096e
translate-c: remove explicit comptime from shuffle mask expression
2021-06-23 11:01:46 -07:00
Evan Haas
8a5fb4c248
translate-c: Ensure all local variables and function params are used
2021-06-23 10:47:47 -07:00
Andrew Kelley
2beb21c4e4
stage2: fix crash when using stage1 backend
...
Calling processOutdatedAndDeletedDecls() should not happen when using
the stage1 backend. Problem solved with checking a simple flag.
2021-06-23 10:44:46 -07:00
Jacob G-W
960932a4bf
astgen: error on struct field with no type
2021-06-23 10:44:46 -07:00
Andrew Kelley
84fe5d4681
fix unused variable errors in runtime safety test cases
2021-06-23 10:44:46 -07:00
Andrew Kelley
3a4a710894
update godbolt test case for unused parameter
2021-06-23 10:44:46 -07:00
Andrew Kelley
189fc964f7
fix unused parameters in compare_output test cases
2021-06-23 10:44:46 -07:00
Andrew Kelley
af40e3f54c
stage2: glue code to AstGen root source file when using stage1
...
Normally we rely on importing std to in turn import the root
in the start code, but when using the stage1 won't happen,
so in order to run AstGen on the root we put it into the
import_table here.
2021-06-23 10:44:46 -07:00
Andrew Kelley
150515f44d
stage2: slightly improve error reporting for missing imports
...
There is now a distinction between `@import` with a .zig extension and
without. Without a .zig extension it assumes it is a package name, and
returns error.PackageNotFound if not mapped into the package table.
2021-06-23 10:44:46 -07:00
Andrew Kelley
6fb45807ab
progress bar: call it "AST Lowering" instead of "AstGen"
2021-06-23 10:44:46 -07:00
Andrew Kelley
c3f637a54c
cmake: debug builds of zig enable logging by default
...
when logging is enabled, the --debug-log flag is available.
2021-06-23 10:44:46 -07:00
Andrew Kelley
96ebf9396f
ci: no need for --ast-check
...
since zig will now run AstGen even when using the stage1 backend.
2021-06-23 10:44:46 -07:00
Andrew Kelley
cf65ab8601
run AstGen even when using the stage1 backend
...
This change reduces the amount of divergence in the compiler's main
pipeline logic enough to run AstGen for all files in the compilation,
regardless of whether the stage1 or stage2 backend is being used.
Practically, this means that all Zig code is subject to new compile
errors, such as unused local variables.
Additionally:
* remove leftover unsound asserts from recent hash map changes
* fix sub-Compilation errors not indenting correctly
2021-06-23 10:44:46 -07:00
Andrew Kelley
fc185a6f71
stage1: @shuffle type and mask params in comptime scope
2021-06-23 09:52:09 -07:00
Jonathan Marler
0134cb0214
nice error for unsupported async sockets on Windows
2021-06-23 12:54:20 +03:00
Veikka Tuominen
29945fb8b3
fix typos in langref.html
...
I thought I built the docs locally but apparently not.
2021-06-23 09:20:39 +03:00
Roman Frołow
ce3679aa45
Docs clarification: local static variable ( #8381 )
2021-06-23 08:45:36 +03:00