Commit Graph

32 Commits

Author SHA1 Message Date
Jakub Konka
2cb6db2219 link-tests: add macho strict validation test
Support more operators when running simple arithmetic tests, and
allow for int literals in the program spec.
2022-12-23 14:02:52 +01:00
Jakub Konka
9ad24a4aee macho: add uuid link test 2022-12-16 18:31:48 +01:00
kcbanner
ea84eda904 'fmt' 2022-11-26 17:16:56 -05:00
kcbanner
57bc61ab26 test-link: add -Denable-symlinks-windows to opt-in to using symlinks
Adds a way for standalone tests to declare they need symlinks, and these
tests won't be run on windows unless -Denable-symlinks-windows is set
2022-11-26 14:26:26 -05:00
Jakub Konka
72769f6cec link-tests: add test case for parsing weak imports 2022-11-06 15:21:28 +01:00
Jakub Konka
5ef33e7c7e
Merge pull request #13459 from ziglang/issue-13457
macho: do not zero-out file if there are no nonzerofill sects
2022-11-06 08:39:13 +01:00
Jakub Konka
aaaa7df152 macho: add linker test case for issue 13457 2022-11-06 00:10:12 +01:00
Luuk de Gram
ef0df24626
test/link: add linker test to verify mangling
This adds a simple linker test to ensure the built library contains
an import entry for each extern function call that was mangled.
2022-11-01 15:43:34 +01:00
Luuk de Gram
2f41109cc4
test/link: add Wasm linker tests for features
Adds a test for inferring features based on a different object file.
Also provides a test case where cpu features are explicitly set on
a library where the end result will output said target features.
2022-10-25 20:48:08 +02:00
jacobly0
bd0dd225e8
Sema: implement linksection on functions
* Sema: implement linksection on functions

 * Implement function linksection in Sema.
 * Don't clobber function linksection/align/addrspace in Sema.
 * Fix copy-paste typo in tests.
 * Add a bunch of missing test_step.dependOn.
 * Fix checkInSymtab match.

Closes #12546
2022-10-18 14:02:10 +03:00
Luuk de Gram
fda75f53fa
test/link: Add linker test for producers section
This also turns off non-debug modes for the bss linker tests for
Wasm. This is done as it's not required to guarantee to zero out
the bss section for non-debug modes.
2022-10-08 09:43:40 +02:00
Jakub Konka
2c3d87b168 macho: test empty translation units 2022-09-17 18:43:24 +02:00
Jakub Konka
0ae2ea671b wasm: temporarily save curr file pointer before pwriting on Win
This is a temporary workaround to an unclear platform-dependence
behavior we have in libstd for `std.fs.File` abstraction. See
https://github.com/ziglang/zig/issues/12783 for more information.
2022-09-08 14:29:54 +02:00
Luuk de Gram
8627858bbc
test/link: add test for extern resolution
Adds a linker tests to verify extern/undefined symbols
representing non-functions are being resolved correctly.
2022-08-30 18:32:08 +02:00
Luuk de Gram
7fe2a3d104
test/link: add wasm linker-test for archives
Adds a test case that will pull-in compiler-rt symbols,
and therefore link with the compiler-rt archive file.
2022-08-20 15:46:39 +02:00
Jakub Konka
9b595dd55f link-test: refactor and reorg
Move common tests by target file format (Wasm, MachO) into helper
functions in `link.zig`, and sort alphabetically within for easier
tracking versus file organization on disk.
2022-08-17 23:13:49 +02:00
Jakub Konka
d84282174c link-test: move tls test to macho/tls
This test was always really testing correct behavior of our in-house
MachO linker to begin with.
2022-08-17 09:00:26 +02:00
Andrew Kelley
486626beb7 disable failing link tests on windows
See tracking issue #12421
2022-08-11 17:53:15 -07:00
Luuk de Gram
34b786fb0f
enable link-test on linux CI 2022-07-23 10:08:51 +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
Luuk de Gram
8033767082
wasm-linker: Implement linker tests (#12006)
* test/link: initial wasm support

This adds basic parsing and dumping of wasm section so they
can be tested using the new linker-test infrastructure.

* test/link: all wasm sections parsing and dumping

We now parse and dump all sections for the wasm binary format.
Currently, this only dumps the name of a custom section.
Later this should also dump symbol table, name, linking metadata and relocations.
All of those live within the custom sections.

* Add wasm linker test

This also fixes a parser mistake in reading the flags.

* test/link: implement linker tests wasm & fixes

Adds several test cases to test the wasm self-hosted linker.
This also introduces fixes that were caught during the implementation
of those tests.

* test-runner: obey omit_stage2 for standalone

When a standalone test requires stage2, but stage2 is omit
from the compiler, such test case will not be included as part
of the test suite that is being ran. This is to support CI's
where we omit stage2 to lower the memory usage.
2022-07-12 14:36:33 +02:00
Jakub Konka
075f5bc5ff link-tests: test -weak-lx and -weak_framework x 2022-06-28 09:22:04 +02:00
Jakub Konka
0dd28920da macho: implement and handle -needed-* and -needed_* family of flags
MachO linker now handles `-needed-l<name>`, `-needed_library=<name>`
and `-needed_framework=<name>`. While on macOS `-l` is equivalent
to `-needed-l`, and `-framework` to `-needed_framework`, it can be
used to the same effect as on Linux if combined with `-dead_strip_dylibs`.

This commit also adds handling for `-needed_library` which is macOS
specific flag only (in addition to `-needed-l`).

Finally, in order to leverage new linker testing harness, this commit
added ability to specify lowering to those flags via `build.zig`:
`linkSystemLibraryNeeded` (and related), and `linkFrameworkNeeded`.
2022-06-27 19:53:38 +02:00
Jakub Konka
efc5c97bff macho: implement -dead_strip_dylibs linker flag 2022-06-27 19:53:38 +02:00
Jakub Konka
589bf67635 macho: implement -headerpad_max_install_names 2022-06-25 18:04:40 +02:00
Jakub Konka
8f00bc9d23 link-tests: put macho search strategy tests into one test case 2022-06-25 10:57:56 +02:00
Jakub Konka
24821dd17f link-tests: test -search_paths_first and -search_dylibs_first macho flags 2022-06-24 22:07:51 +02:00
Jakub Konka
23a63f4ce4 link-tests: rename CheckMachOStep to CheckObjectStep and accept obj format 2022-06-22 10:27:51 +02:00
Jakub Konka
3bb4d65b2f link-tests: move macho tests to subfolder
Handle `-e` option in MachO linker allowing the user to set a custom
entrypoint address.
2022-06-21 23:01:09 +02:00
Jakub Konka
2d09540a63 link-tests: test pagezero_size option for macho 2022-06-20 18:25:20 +02:00
Jakub Konka
6e56a8df20 link-tests: CheckFileStep to do grep test on the binary 2022-06-20 17:59:17 +02:00
Jakub Konka
38edef35bf test: introduce link(er) tests - builds on standalone tests 2022-06-20 17:59:17 +02:00