Jakub Konka
61b4119a7d
macho: link atom starting section by orig section id
...
In x86_64 relocs, it can so happen that the compiler
refers to the same atom by both the actual assigned symbol
and the start of the section. In this case, we need to
link the two together so add an alias.
2022-07-22 16:58:20 +02:00
Jakub Konka
35a5a4a0e4
macho: fix marking sections for pruning in GC
2022-07-22 16:58:20 +02:00
Jakub Konka
d80fcc8a0b
macho: rework symbol handling for incremental stage2 builds
2022-07-22 16:58:20 +02:00
Jakub Konka
eeb6d8f045
macho: fix compilation issues on 32bit hosts
2022-07-22 16:58:20 +02:00
Jakub Konka
9eb7e5182b
macho: rework symbol handling to match zld/ELF
...
Now, each object file will store a mutable table of symbols that it
defines. Upon symbol resolution between object files, the symbol
will be updated with a globally allocated section ordinal and address
in virtual memory. If the object defines a globally available symbol,
its location only (comprising of the symbol index and object index)
will be stored in the globals map for easy access when relocating, etc.
This approach cleans up the symbol management significantly, and matches
the status quo used in zld/ELF.
Additionally, this makes scoping symbol stabs easier too as they are
now naturally contained within each object file.
2022-07-22 16:58:20 +02:00
Jakub Konka
843701d0fe
macho: remove unused fields from Atom
2022-07-22 16:58:20 +02:00
Jakub Konka
03feea0fb2
macho: split section into subsections if requested and/or possible
2022-07-22 16:58:20 +02:00
Jakub Konka
d042b88c11
macho: put parsing into an atom into a helper
2022-07-22 16:58:20 +02:00
Jakub Konka
b81c48d985
macho: read the entire file contents into memory at once
2022-07-22 16:58:20 +02:00
Jakub Konka
7ec9a4f382
cli: support --gc-sections and --no-gc-sections for Zig sources
2022-07-22 16:58:20 +02:00
Jakub Konka
44ee42c6bc
cli: parse -dead_strip MachO linker flag
2022-07-22 16:58:20 +02:00
Veikka Tuominen
c619371ec1
Sema: fix loading and storing of optional pointers represented as pointers
2022-07-22 17:03:42 +03:00
Veikka Tuominen
393d59bb72
Sema: allow C pointers in fieldCallBind
2022-07-22 17:03:42 +03:00
Veikka Tuominen
8a488fcdb8
Sema: validate empty array init
2022-07-22 17:03:42 +03:00
Veikka Tuominen
47de73980e
Sema: use resolveMaybeUndefValIntable
in zirIntToPtr
2022-07-22 17:03:42 +03:00
Veikka Tuominen
8e75ba653b
Merge pull request #12117 from Vexu/stage2-compile-errors
...
Stage2: explain why value must be comptime known
2022-07-22 13:07:32 +03:00
Andrew Kelley
5cd1ccf4b9
CI: stage3 coverage for test-translate-c
2022-07-21 22:52:08 -07:00
Andrew Kelley
046a4d084b
update test-translate-c cases to stage2
2022-07-21 22:51:17 -07:00
Andrew Kelley
3114978389
update standalone test cases for stage2
2022-07-21 22:51:17 -07:00
Andrew Kelley
46a06074eb
tests: remove superfluous newlines from logs
2022-07-21 22:51:17 -07:00
Andrew Kelley
f550c29c4e
LLVM: fix lowering of structs with underaligned fields
...
When lowering a struct type to an LLVM struct type, keep track of
whether there are any underaligned fields. If so, then make it a packed
llvm struct. This works because we already insert manual padding bytes
regardless.
We could unconditionally use an LLVM packed struct; the reason we bother
checking for underaligned fields is that it is a conservative choice, in
case LLVM handles packed structs less optimally. A future improvement
could simplify this code by unconditionally using packed LLVM structs
and then make sure measure perf is unaffected.
closes #12190
2022-07-21 22:51:17 -07:00
Andrew Kelley
b749487f48
add new compile error note to old test case
2022-07-21 22:05:46 -07:00
Andrew Kelley
25f3be32db
Sema: fix fn pointer align disagrees with fn align error
...
Check the specified function alignment rather than the effective
function alignment.
2022-07-21 15:19:56 -07:00
Andrew Kelley
fc6e111b76
Sema: improve compile error for bad function alignment
...
* Integrate more declaratively with src/target.zig
* Only trigger the check when a function body is found, do not trigger
for function types.
2022-07-21 13:55:29 -07:00
Andrew Kelley
b946934576
build.zig: 32 MiB stack size
...
This gives more headroom for comptime recursion, especially for debug
builds of Zig.
2022-07-21 12:23:33 -07:00
Andrew Kelley
644baa0f5b
constrain target/backend of new test cases
...
avoids testing stuff that doesn't work yet.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
794beafb9c
Sema: validate extern struct field types earlier
...
`validateExternType` does not require the type to be resolved so we can
check it earlier. Only doing it in `resolveTypeFully` lead to worse or
missing compile errors.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
821e4063f9
Sema: better source location for function call args
2022-07-21 12:21:30 -07:00
Veikka Tuominen
79ef0cdf30
Sema: better function parameter source location
2022-07-21 12:21:30 -07:00
Veikka Tuominen
83b2d2cd3e
Sema: better source location for incompatible capture group
2022-07-21 12:21:30 -07:00
Veikka Tuominen
9fb8d21a01
AstGen: add error for fields in opaque types
2022-07-21 12:21:30 -07:00
Veikka Tuominen
1705a21f80
Sema: more union and enum tag type validation
2022-07-21 12:21:30 -07:00
Veikka Tuominen
8feb398760
Sema: validate function parameter types and return type
2022-07-21 12:21:30 -07:00
Veikka Tuominen
d851b24180
Sema: validate function pointer alignment
2022-07-21 12:21:30 -07:00
Veikka Tuominen
76e7959a90
Sema: explain why comptime is needed
2022-07-21 12:21:30 -07:00
Veikka Tuominen
195c3cd89f
fix errors in tests not tested locally or on CI
2022-07-21 12:21:30 -07:00
Veikka Tuominen
d729173204
stage2: better pointer source location
2022-07-21 12:21:30 -07:00
Veikka Tuominen
29815fe9de
Sema: disallow 'align' on functions on wasm
2022-07-21 12:21:30 -07:00
Veikka Tuominen
62120e3d0e
Sema: fix non-exhaustive union switch checks
2022-07-21 12:21:30 -07:00
zc
460211431f
complete the drone pipeline runner type and platform os
2022-07-21 11:17:35 -07:00
Yujiri
b8bf5de75a
Fix #9184 : fmtIntSizeDec/fmtIntSizeBin support FormatOptions
2022-07-21 18:41:21 +03:00
Loris Cro
92966088c2
autodoc: cleanup file-related operations
2022-07-21 16:31:45 +02:00
Loris Cro
d74a49456d
autodoc: use already open handles to output docs artifacts
2022-07-21 14:17:25 +02:00
Andrew Kelley
e054877466
CI: stage3 covers test-universal-libc and builds stage1
2022-07-20 23:28:30 -07:00
Andrew Kelley
ca3adb83b7
Merge pull request #12111 from ziglang/ci-stage3
...
CI: increase stage3 test coverage
2022-07-20 17:07:19 -07:00
Andrew Kelley
5b7e332b28
disable new behavior test in stage1
...
I regressed this in 379beceffd1b0a0b0d8f3163dc02eba1e53ffa39; sorry
about that.
2022-07-20 16:17:33 -07:00
Motiejus Jakštys
fd9b55a640
build.zig: teach --compress-debug-sections
...
Now that #11863 is landed, let's expose it to the zig programs that
build stuff via `build.zig`. "Benchmarks" with [turbonss](https://git.sr.ht/~motiejus/turbonss ):
Built with:
$ zig build -Dtarget=x86_64-linux-gnu.2.19 -Dcpu=x86_64_v3 -Drelease-small=true
*Debug, uncompressed*
174K turbonss-analyze
161K turbonss-getent
1.2M turbonss-unix2db
448K libnss_turbo.so.2.0.0
*Debug, compressed*
78K turbonss-analyze
86K turbonss-getent
572K turbonss-unix2db
190K libnss_turbo.so.2.0.0
*Stripped, for completeness*
17K turbonss-analyze
20K turbonss-getent
197K turbonss-unix2db
26K libnss_turbo.so.2.0.0
2022-07-20 18:26:17 -04:00
Andrew Kelley
c1f3aca602
Merge pull request #12177 from Vexu/packed-ptr
...
stage2 llvm: fix handling of pointer fields in packed structs
2022-07-20 18:22:25 -04:00
Andrew Kelley
379beceffd
improve test case from previous commit
...
Now it checks that the code is correctly compiled rather than only checking
that it does not crash the compiler.
2022-07-20 15:21:24 -07:00
Andrew Kelley
21064d9144
disable std lib test failing with self-hosted ReleaseSafe
...
I opened a corresponding issue #12178 which has the 0.10.0 milestone, so
this must be fixed before we release.
2022-07-20 12:50:58 -07:00