Commit Graph

19445 Commits

Author SHA1 Message Date
Veikka Tuominen
ff7ec4efb5 Sema: bad union field access safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
55fe34100f Sema: exact division safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
76d099950a Sema: cast negative to unsigned safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
0782586b15 Sema: divide by zero safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
9f10dfcb54 Sema: implement shr_exact runtime safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
4d20d6874c move passing safety tests to stage2 2022-07-23 15:40:11 +03:00
Veikka Tuominen
72c60acd5d Revert "std.mem.Allocator: add alignedCreate"
This reverts commit 5647a73fea.
2022-07-23 15:30:12 +03:00
viri
b728e6aa00 stage1: don't lowercaseify lib names 2022-07-23 15:04:02 +03:00
Yujiri
6b9f609bd0 Fix #6944: referencing type info alignment causes error in unrelated function 2022-07-23 14:26:52 +03:00
devins2518
5647a73fea
std.mem.Allocator: add alignedCreate 2022-07-23 14:22:35 +03:00
InKryption
9555b84ab4 langref: clarify permitted @bitCast usage.
The current phrasing is vague; it is unclear whether it is demonstrating an example of the type of permitted behavior, from which the rule set must be extrapolated, or it is stating that this restriction only applies to the relationship between integers and bare structs.
2022-07-23 14:20:29 +03:00
Allan Regush
9734e643fb
docs: Pointer Arithmetic 2022-07-23 13:57:40 +03:00
Veikka Touminen
819c868bbf std.net.getAddressList: fix segfault on bad hostname
Fixes #12065
2022-07-23 13:54:24 +03:00
ominitay
889efddd1a std.json: Fix parsing of large numbers
Numbers greater than about 2^53 are encoded as strings in JSON.
std.json.parseInternal previously errored out in this condition.
2022-07-23 13:52:16 +03:00
Jakub Konka
a8bfddfaea
Merge pull request #12140 from ziglang/macho-gc-sections
macho: add support for `-dead_strip` (GC sections) and simplify symbol resolution
2022-07-23 00:01:09 -07:00
Andrew Kelley
a035d75a17 Autodoc: update to new ZIR
Fixes a merge conflict with 8e75ba653b
which removed ptr_type_simple and added overflow_arithmetic_ptr.
2022-07-22 21:24:19 -07:00
Andrew Kelley
7502e490cb
Merge pull request #12173 from ziglang/autodocs-rebased
New Autodocs!
2022-07-22 20:56:59 -07:00
Andrew Kelley
f591936480
Merge pull request #12198 from Vexu/stage2
Sema: fix loading and storing of optional pointers represented as pointers
2022-07-22 20:47:40 -07:00
Jakub Konka
cf6cfc830d macho: fix use-after-move in placeDecl
Previously, we would get a pointer to a slot in the symbol table,
apply changes to the symbol, and return the pointer. This however
didn't take into account that the symbol table may be moved in memory
in-between the modification and return from the function (`fn placeDecl`).
Prior to my rewrite, this was not possible within the body of the said
function. However, my rewrite revamped how we allocate GOT atoms and
their matching symtab indexes, which now may cause a move in memory
of the container.
2022-07-23 00:13:34 +02:00
Jakub Konka
eb1b2f5c58 macos: add /usr/local/* paths conditional on macOS major version
`/usr/local/include`, `/usr/local/lib` and `/Library/Frameworks`
have been deprecated since approximately macOS 11, and so to avoid
redundant and misinformed warning messages generated by the linker,
add those dirs only when natively targeting macOS 10.x.x or below.
2022-07-22 14:11:23 -07:00
Jakub Konka
600348283f macho: include __StaticInit input sections as GC roots 2022-07-22 21:19:33 +02:00
Andrew Kelley
5dd59a5423
Merge pull request #12191 from ziglang/underaligned-fields
LLVM: fix lowering of structs with underaligned fields
2022-07-22 11:58:50 -07:00
Veikka Tuominen
423a19fa60 Sema: add error for dereferencing invalid payload ptr at comptime 2022-07-22 21:10:50 +03:00
Veikka Tuominen
03b1fbe50d stage2: fix airIsErr when is_ptr == true 2022-07-22 21:07:55 +03:00
Veikka Tuominen
1f748fe426 Sema: fix mutation of optional ptr represented as regular ptr 2022-07-22 19:50:11 +03:00
VÖRÖSKŐI András
d925d19cfc PriorityQueue: use compareFn in update()
update() calls mem.indexOfScalar() which uses `==` for comparing items,
which fails when the operator is not supported.
As PirorityQueue needs a comparing function anyway we can use `.eq` results
to identify matching objects.

closes #9918
2022-07-22 19:25:38 +03:00
Dan Ellis Echavarria
d1d892c83c SIMD size suggestions: suggestions code now compiles, added more
architectures
The idea behind this is using the register capabilities in safe amounts,
 there is still some consideration to be done.
+ Fixed compile error using std.Target.<arch>.featureSetHas
+ X86 MMX and "3DNOW" 64 bits register usage considered for vector size
+ Added ARM Neon recommened usage of 128 bits (The size of the register)
+ Added AARCH64 Neon and SVE for 128 bits. SVE could use in theory up to
  2048 bits, but found only evidence of functional 512 bits on a super
       computer, decided on using 128 bits as a safety
+ Added Altivec recommendation of using the 128 bits long register
+ Using MIPS msa 2x64bits capabilities, usage of 64 bits registers for MDMX
  systems, need testing on how using bigger values affect performance
+ Using V extension on RISC-V, which is extendable via instructions, decided on 128 bits
  as a value to not use all registers
+ in SPARC the 64 bits registers are used, a max of 32 registers
  are to be used for configurable simd instructions, decided on using
the size of the register, need testing on performance hit on using a
bigger sized register vector size
2022-07-22 18:58:43 +03:00
Jakub Konka
f8458a549b macho: dead_strip defaults: off for debug, on for release 2022-07-22 16:58:21 +02:00
Jakub Konka
0901e4805c macho: fix zig cc and c++ using stage2 llvm 2022-07-22 16:58:21 +02:00
Jakub Konka
ca74656685 macho: move GC code into dead_strip.zig module
Implement marking live atoms that reference other live atoms if
required by the compiler (via section attribute).
2022-07-22 16:58:21 +02:00
Jakub Konka
7345976261 macho: sort subsection symbols by seniority 2022-07-22 16:58:21 +02:00
Jakub Konka
39df241df4 macho: do not GC local symbols unless reference dead symbols
If a local references another local, we keep it. If it doesn't
reference anything, we keep it. Otherwise, we dead strip it.
2022-07-22 16:58:21 +02:00
Jakub Konka
a089a6dc4f macho: parse data-in-code when writing LINKEDIT segment 2022-07-22 16:58:21 +02:00
Jakub Konka
2c184f9a5f link-tests: add checkNotPresent and add -dead_strip smoke test
`checkNotPresent` is the inverse of `checkNext` - if the phrase is
found in the output, then it fails the test.
2022-07-22 16:58:21 +02:00
Jakub Konka
2dfc78dc03 macho: limit export info to entrypoint and mh symbol when executable 2022-07-22 16:58:21 +02:00
Jakub Konka
0f1b5d45bc macho: mark __mh_execute_header as ref'd dynamically 2022-07-22 16:58:21 +02:00
Jakub Konka
0da8ba816a macho: do not store stabs; generate on-the-fly instead 2022-07-22 16:58:21 +02:00
Jakub Konka
41b91442f4 macho: improve logs for dyld info 2022-07-22 16:58:21 +02:00
Jakub Konka
4658d857de macho: fix caching linker line in incremental setting 2022-07-22 16:58:20 +02:00
Jakub Konka
b380ed6a72 macho: deallocate globals keys 2022-07-22 16:58:20 +02:00
Jakub Konka
817939d20a macho: don't store GC roots globally
Instead, if dead-strip was requested, create a temp container and
pass it around.
2022-07-22 16:58:20 +02:00
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