300 Commits

Author SHA1 Message Date
Jakub Konka
20980b33e3 elf: test entry point 2023-10-16 19:33:05 +02:00
Jakub Konka
9861a9ea75 elf: test various copyrel edge cases 2023-10-16 19:33:05 +02:00
Jakub Konka
b6006df565 elf: refactor canonical PLT test 2023-10-16 19:33:05 +02:00
Jakub Konka
c940735c4d elf: port more linker tests 2023-10-16 19:33:05 +02:00
Jakub Konka
149dd82d54 elf: add --as-needed test 2023-10-16 19:33:05 +02:00
Jakub Konka
7ff9461b88 elf: test large alignment of funcs in exe 2023-10-16 19:33:05 +02:00
Jakub Konka
11bdfe1179 elf: test large alignment of funcs in DSO 2023-10-16 19:33:04 +02:00
Jakub Konka
031e12b963 elf: override default dynamic linker path with system\`s dl when appropriate 2023-10-16 19:33:04 +02:00
Jakub Konka
62c6c4a46d elf: more DSO tests 2023-10-16 19:33:04 +02:00
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
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
Andrew Kelley
5722261e64
Merge pull request #17465
Compilation: default to self-hosted backends when not using libllvm
2023-10-11 00:53:07 -07:00
Krzysztof Wolicki
7abf9b3a83
Step.Compile: add options struct for addCSourceFiles (#17420)
Closes #17410
2023-10-10 14:29:26 -04:00
Jakub Konka
33ef01d16b macho: test for presence of _abc as export in 16308 test 2023-10-10 11:17:29 -07:00
Jakub Konka
89c2151a97 elf: move logic for extracing atom's code into input files 2023-09-28 18:35:26 +02:00
Jakub Konka
91f2e66bf9 elf: test TLS in static programs 2023-09-28 15:13:35 +02:00
Jakub Konka
7617486f1d elf: skip running exe on foreign hosts 2023-09-26 21:07:47 +02:00
Jakub Konka
b01b972999 elf: test linking against empty C object 2023-09-26 21:07:47 +02:00
Jakub Konka
5e617e4b0c elf: put libc on the linker line if requested 2023-09-26 21:07:47 +02:00
Jakub Konka
8abfb3559a elf: test statically linking libc 2023-09-26 21:07:47 +02:00
Jakub Konka
aac04b4a5a elf: port some of zld's test harness 2023-09-26 21:07:47 +02:00
Jakub Konka
3b2b9fcbc5 darwin: move inference of SDK version into the linker
`std.zig.system.darwin.getSdk` now pulls only the SDK path
so we execute a child process only once and not twice as it was
until now since we parse the SDK version directly from the pulled path.
This is actually how `ld64` does it too.
2023-08-29 06:43:41 +02:00
Jakub Konka
573bb77ab6 macho: add smoke test for re-exports in static libs 2023-08-16 12:19:34 +02:00
Andrew Kelley
e582a3642b std.zig.system.darwin: fix redundant names 2023-08-03 09:52:15 -07:00
Andrew Kelley
aef8bcf776 std.Build.Step.Compile: fine-grained system lib search control
For each library you can specify the preferred mode and search strategy.

The old way of setting global state is eliminated.
2023-08-03 09:52:15 -07:00
Jakub Konka
16f09127b5 link-test: add matching test case for unwind info when MH_SUBSECTIONS_VIA_SYMBOLS is not set 2023-08-02 22:12:26 +02:00
Andrew Kelley
38840e2e58 build system: follow-up enhancements regarding LazyPath
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685
* move overrideZigLibDir and setMainPkgPath to options fields set once
  and then never mutated.
* avoid introducing Build/util.zig
* use doc comments for deprecation notices so that they show up in
  generated documentation.
* introduce InstallArtifact.Options, accept it as a parameter to
  addInstallArtifact, and move override_dest_dir into it. Instead of
  configuring the installation via Compile step, configure the
  installation via the InstallArtifact step. In retrospect this is
  obvious.
* remove calls to pushInstalledFile in InstallArtifact. See #14943
* rewrite InstallArtifact to not incorrectly observe whether a Compile
  step has any generated outputs. InstallArtifact is meant to trigger
  output generation.
* fix child process evaluation code handling of `-fno-emit-bin`.
* don't store out_h_filename, out_ll_filename, etc., pointlessly. these
  are all just simple extensions appended to the root name.
* make emit_directory optional. It's possible to have nothing outputted,
  for example, if you're just type-checking.
* avoid passing -femit-foo/-fno-emit-foo when it is the default
* rename ConfigHeader.getTemplate to getOutput
* deprecate addOptionArtifact
* update the random number seed of Options step caching.
* avoid using `inline for` pointlessly
* avoid using `override_Dest_dir` pointlessly
* avoid emitting an executable pointlessly in test cases

Removes forceBuild and forceEmit. Let's consider these additions separately.
Nearly all of the usage sites were suspicious.
2023-07-30 11:19:32 -07:00
Felix "xq" Queißner
ae11fba44a Rebase + two fixes. 2023-07-30 11:18:50 -07:00
Felix "xq" Queißner
35d0a49db9 Introduces Compile.forceBuild() and Compile.forceEmit(…) 2023-07-30 11:18:50 -07:00
Felix (xq) Queißner
5c01818410 Introduces Compile.getEmittedX() functions, drops Compile.emit_X. Resolves #14971 2023-07-30 11:18:50 -07:00
Felix (xq) Queißner
ce95a3b153 Build.zig rename orgy (aka: #16353). Renames FileSource to LazyPath and removes functions that take literal paths instead of LazyPath. 2023-07-30 11:18:50 -07:00
Jakub Konka
f821543e4b
Merge pull request #16553 from ziglang/issue-11896
macho: fix parsing of TBDv3 dylib stubs
2023-07-26 18:22:59 +02:00
Jakub Konka
960e5c329a link-test: expect exit code of 0 for TBDv3 test 2023-07-26 14:11:49 +02:00
Jakub Konka
780f0b872a link-test: add test case for MachO bug 16308 2023-07-26 13:38:24 +02:00
Jakub Konka
4ab595239f link-test: adjust TBDv3 test to handle x86_64-macos also 2023-07-26 11:22:43 +02:00
Jakub Konka
5131d074d8 link-test: add test for TBDv3 updated parsing logic 2023-07-26 08:10:53 +02:00
Jakub Konka
e8b613783f check-object: remove wildcard matchers as they are too clunky
Instead, we now have a looser helper called `checkContains(...)`
that will match on any occurrence similarly to `std.mem.indexOf()`.

While at it, I have cleaned up other combinators to make the entire
API more consistent, and so:
* `checkStart(phrase)` is now `checkStart()` followed by
`checkExact(phrase)`
* `checkNext(phrase)` if matching exactly is now `checkExact(phrase)`
* `checkNext(phrase)` if matching loosely is now `checkContains(phrase)`
* `checkNext(phrase)` if matching exactly with var extractors is now
`checkExtract(phrase)`

Finally, `ElfDumper` is now dumping contents of `.symtab` and `.dynsym`
symbol tables. I have also removed dumping of symtabs as optional - they
are now always dumped which cleaned up the implementation even more.
2023-07-20 20:01:06 +02:00
Luuk de Gram
142dbc7b82
wasm-linker: create TLS Wasm globals correctly
Previously, they were only created when we had any TLS segment.
This meant that while the symbol existed, the global itself wouldn't.
The result of this was a crash during symbol names writing as it
would attempt to write the symbol name of a global that didn't exist.
Now we always create them, and instead update its `init` value during
`setupMemory`.

In the future, the entire symbol (and global) will be removed by
the garbage collector.
2023-07-19 17:22:46 +02:00
Luuk de Gram
1a3304ed23
test/link: add shared-memory test for WebAssembly 2023-07-19 17:22:46 +02:00
kcbanner
3ec337484b linker tests: add missing dependOn calls for CheckObject steps 2023-07-13 22:26:19 +02:00
Xavier Bouchoux
8142bc20ea test: linking static libraries built from intermediary object files 2023-07-11 11:46:59 +02:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Jakub Konka
7b5bd3a93f
Merge pull request #16097 from ziglang/macho-faster-uuid
macho: parallelize UUID hash calculation at the expense of full compatibility with ld64
2023-06-21 00:03:52 +02:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00