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
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
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
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
Andrew Kelley
1ec50613bf
CI: increase stage3 test coverage
...
* Use a debug build of stage3 instead of a debug build of stage2 for
our self-hosted compiler test coverage.
* Move coverage from stage1 to stage3 for:
- building self-hosted without LLVM
- building self-hosted for 32-bit arm
- test-compiler-rt
- test-behavior
- test-std
- test-compare-output
- test-asm-link
- test-fmt
2022-07-20 12:27:03 -07:00
Veikka Tuominen
d41dd499a9
stage2 llvm: fix handling of pointer fields in packed structs
2022-07-20 17:07:12 +03:00
Cody Tapscott
de62bd0647
macho: Pass sections by pointer when slicing names
...
We were accidentally returning a pointer to stack memory, because these
arguments were passed by value. It's just an accident that stage 1 was
passing these by reference, so things were alright until stage 3.
2022-07-20 03:45:29 -04:00
Andrew Kelley
0efc6a35be
Sema: fix enum value without tag name used as switch item
...
Previously stage2 would report a false positive compile error saying there
was no tag for this value.
2022-07-19 18:39:48 -07:00
Andrew Kelley
1d5f865cfa
Sema: fix runtime instructions omitted
...
in the presence of comptime control flow.
fixes #12171
2022-07-19 17:45:38 -07:00
Andrew Kelley
046df9b7d0
Merge pull request #12131 from hnakamur/fix_big_int_Managed_mul_sqr_capacity_too_large
...
Fix std.math.big.int.Managed capacity after mul and sqr
2022-07-19 18:54:30 -04:00
Andrew Kelley
6fab6c3e46
Merge pull request #12164 from ziglang/llvm-opt-byref
...
LLVM: lower optional types as byref=true
2022-07-19 14:50:03 -04:00
Andrew Kelley
fe8c3ffeb1
LLVM: change commentary on isByRef
...
This branch originally started out as a potential workaround to
address #11450 . It did not solve that problem, however, it did end
up fixing #11498 !
2022-07-19 11:31:37 -07:00
Andrew Kelley
74fb65fb42
LLVM: lower all error unions as byref=true
...
Same reasoning as previous commit.
2022-07-19 11:26:19 -07:00
Andrew Kelley
bab570a225
LLVM: lower all structs as byref=true
...
Same reasoning as previous commit.
2022-07-19 11:26:18 -07:00
Andrew Kelley
65bc4d915d
LLVM: lower optional types as byref=true
...
This is a possible workaround for
https://github.com/llvm/llvm-project/issues/56585
On my computer it makes stage3-release go from false positive
compilation errors on the behavior tests to "segmentation fault".
Is this forwards progress or backwards progress? I have no idea.
See #11450
2022-07-19 11:22:48 -07:00
LeRoyce Pearson
c26d9f6287
Read dynstr starting at rpath offset
...
Since we know the offset, we may as well read starting there. Still expects
rpath to fit in 4096 bytes; that might be worth fixing in the future.
Fixes issue #12112
2022-07-19 14:01:35 -04:00
Cody Tapscott
b93a38860d
stage2: Change optional non-null field to i8
...
This is a workaround for https://github.com/llvm/llvm-project/issues/56585
which causes writes to i1 in memory to be optimized to an incorrect value.
Unfortunately, this does not save users from running into this bug with u1
in their own types.
However, this does seem to be enough to get the behavior tests working.
This resolves #11450 on my machine.
2022-07-19 13:33:41 -04:00