26386 Commits

Author SHA1 Message Date
Jakub Konka
e53fa93170 elf: test basic DSO generation and linking 2023-10-16 19:33:04 +02:00
Jakub Konka
ac03a35e82 elf: test common symbols in archives 2023-10-16 19:33:04 +02:00
Jakub Konka
cf2c8c0789 elf: test common symbols handling 2023-10-16 19:33:04 +02:00
Jakub Konka
def7190e84 elf: hook up common symbols handler 2023-10-16 19:33:04 +02:00
Jakub Konka
f4c1b1d9ad elf: implement --verbose-link, and other fixes 2023-10-16 19:33:04 +02:00
Jakub Konka
4af5caa81f elf: add missing generators for special dynamic sections 2023-10-16 19:33:04 +02:00
Jakub Konka
5fa90afb64 elf: fix synthetic section handling and actually parse DSOs 2023-10-16 19:33:04 +02:00
Jakub Konka
d1446565a1 elf: re-enable dynamic linking codepaths 2023-10-16 19:33:04 +02:00
Jakub Konka
04a8f217c6 elf: fix COMDAT deduping logic 2023-10-16 19:33:04 +02:00
Jakub Konka
9a80ac0429 elf: add garbage collection of sections 2023-10-16 19:33:04 +02:00
Jakub Konka
2ee221328f elf: test garbage collection of sections 2023-10-16 19:33:04 +02:00
Jakub Konka
f1b9c365f2 elf: add incomplete handling of build-obj -fllvm -fno-lld 2023-10-16 19:33:04 +02:00
Jakub Konka
976d4f51cc elf: add hello-world c++ link test 2023-10-16 19:33:04 +02:00
Jakub Konka
621ddc003a elf: temporarily disable non-llvm linker tests 2023-10-16 19:33:04 +02:00
Jakub Konka
727d9431c8 elf: link hello-world in c++ 2023-10-16 19:33:04 +02:00
Jakub Konka
d6cec5a586 elf: add more prepwork for linking c++ objects 2023-10-16 19:33:04 +02:00
Jakub Konka
66f34b15e8 elf: add symbols to .got section directly 2023-10-16 19:33:04 +02:00
Jakub Konka
2c2bc66ce1 elf: handle .eh_frame and non-alloc sections 2023-10-16 19:33:04 +02:00
Jakub Konka
9ccd94d560 elf: refactor object.shdrContents to never error out 2023-10-16 19:33:04 +02:00
Jakub Konka
53340544c6 elf: get hello-world with LLVM in Zig working 2023-10-16 19:33:04 +02:00
Jakub Konka
1b70ad622b elf: port zld's allocation mechanism 2023-10-16 19:33:04 +02:00
Jakub Konka
860beda55f elf: remove dirty from synthetic .got section 2023-10-16 19:33:04 +02:00
Jakub Konka
6faed6269f elf: update section sizes accumulated from objects 2023-10-16 19:33:04 +02:00
Jakub Konka
14cff77d87 elf: create atom lists indexed by section index 2023-10-16 19:33:04 +02:00
Jakub Konka
540ef3e010 elf: sort sections by their rank to combine them by segment flags
Currently this ignores ZigModule, however, I believe we can make it
so that this is done excluding sections/segments emitted by ZigModule
and everything should work out just fine.
2023-10-16 19:33:04 +02:00
Jakub Konka
679accd887 elf: initialize output sections from input objects in a separate step 2023-10-16 19:33:04 +02:00
Jakub Konka
509da2316c elf: run populateMissingMetadata only if ZigModule exists 2023-10-16 19:33:04 +02:00
Jakub Konka
f0f19e18c7 elf: write shdr_table in flush 2023-10-16 19:33:04 +02:00
Jakub Konka
87602092fa elf: write .got in bulk after scanning objects 2023-10-16 19:33:04 +02:00
Jakub Konka
d565f8bef2 elf: check for null atom in ZigModule 2023-10-16 19:33:04 +02:00
Jakub Konka
75f4420c2d elf: increase Atom.Index resolution to u32 2023-10-16 19:33:04 +02:00
Jakub Konka
605e3eb08c elf: clean up generating GOT symbol names 2023-10-16 19:33:03 +02:00
Jakub Konka
43406c0696 elf: update .strtab with GOT symbols 2023-10-16 19:33:03 +02:00
Jakub Konka
d06aa21e48 elf: for now always update .shstrtab and .strtab sections 2023-10-16 19:33:03 +02:00
Jakub Konka
ff1423c4ce elf: reuse addSection in alloc functions 2023-10-16 19:33:03 +02:00
Jakub Konka
c8c50a058e elf: do not prealloc space for .symtab 2023-10-16 19:33:03 +02:00
Jakub Konka
52f8a1a24c elf: move initializing string buffers out of populateMissingMetadata 2023-10-16 19:33:03 +02:00
joadnacer
7b9165b375 std.mem: Improve writeIntSlice performance 2023-10-16 08:49:05 -04:00
Veikka Tuominen
14efbf5ed1 Sema: fix missing check for tuple default initializers
Closes #17525
2023-10-16 14:00:18 +03:00
Veikka Tuominen
78855bd218 make distinct error limit configurable
Closes #786
2023-10-16 04:08:45 -04:00
Jacob Young
fbd90e487b Build: fix some issues with ConfigHeader step
* include path was using bad default for dependency lazy paths
 * unhashed config options caused changes to not trigger a rebuild
2023-10-16 03:50:47 -04:00
Andrew Kelley
ca690ffa22
Merge pull request #17448 from squeek502/win32-manifest
Add preliminary support for Windows `.manifest` files
2023-10-15 19:47:27 -07:00
Bogdan Romanyuk
ebde525cce
Sema: fix @extern error on function pointer 2023-10-16 01:30:39 +00:00
Robin Voetter
fd6b3db342
Merge pull request #17293 from Snektron/spirv-aaaa
spirv: more instructions
2023-10-16 02:04:09 +02:00
Ryan Liptak
b51147889f Add warning if .xml file is used, since it's likely intended to be a Windows manifest file
Example:

> zig build-exe test.zig test.xml
warning: embedded manifest files must have the extension '.manifest'
error: unrecognized file extension of parameter 'test.xml'
2023-10-15 13:33:16 -07:00
Ryan Liptak
5f15acc463 Add preliminary support for Windows .manifest files
An embedded manifest file is really just XML data embedded as a RT_MANIFEST resource (ID = 24). Typically, the Windows-only 'Manifest Tool' (`mt.exe`) is used to embed manifest files, and `mt.exe` also seems to perform some transformation of the manifest data before embedding, but in testing it doesn't seem like the transformations are necessary to get the intended result.

So, to handle embedding manifest files, Zig now takes the following approach:

- Generate a .rc file with the contents `1 24 "path-to-manifest.manifest"`
- Compile that generated .rc file into a .res file
- Link the .res file into the final binary

This effectively achieves the same thing as `mt.exe` minus the validation/transformations of the XML data that it performs.

How this is used:

On the command line:
```
zig build-exe main.zig main.manifest
```
(on the command line, specifying a .manifest file when the target object format is not COFF is an error)

or in build.zig:

```
const exe = b.addExecutable(.{
    .name = "manifest-test",
    .root_source_file = .{ .path = "main.zig" },
    .target = target,
    .optimize = optimize,
    .win32_manifest = .{ .path = "main.manifest" },
});
```
(in build.zig, the manifest file is ignored if the target object format is not COFF)

Note: Currently, only one manifest file can be specified per compilation. This is because the ID of the manifest resource is currently always 1. Specifying multiple manifests could be supported if a way for the user to specify an ID for each manifest is added (manifest IDs must be a u16).

Closes #17406

options
2023-10-15 13:33:16 -07:00
Johan Jansson
a1e0b9979a std.heap.ArenaAllocator: fix doc comment typo
Fixes #17537
2023-10-15 21:20:48 +03:00
Robin Voetter
8c153221b9
wasm: disable division test
Seems that bit integers are not properly supported
2023-10-15 20:08:19 +02:00
Robin Voetter
faad97edff
spirv: update failing / passing tests
Some tests are now failing due to debug info changes, some tests
now pass due to improved compiler functionality.
2023-10-15 20:08:18 +02:00
Robin Voetter
0552e504d0
spirv: work around OpSource parsing issue in llvm-spirv
The Khronos SPIRV-LLVM translator does not parse OpSource correctly. This
was causing tests to fail and other mysterious issues.

These are resolved by only generating a single OpSource instruction for now,
which does not have the source file locations also.

See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188
2023-10-15 17:07:39 +02:00