Commit Graph

368 Commits

Author SHA1 Message Date
Jakub Konka bf285c7e40 test/link/macho: test for correct handling of large __bss sections 2024-01-24 12:34:39 +01:00
Jakub Konka faa1849f81 test/link/macho: test for correct handling of __mh_execute_header symbol 2024-01-24 12:34:39 +01:00
Jakub Konka 49c11e0c34 test/link/macho: upgrade and migrate needed_library test 2024-01-24 12:34:39 +01:00
Jakub Konka d93a0763d4 test/link/link: pass build options to elf and macho tests 2024-01-24 12:34:39 +01:00
Jakub Konka 041f7d69f0 test/link/macho: test segment boundary symbols 2024-01-24 12:34:39 +01:00
Jakub Konka ffd7f7f642 test/link/macho: fix naming in entry-in-dylib test 2024-01-24 12:34:39 +01:00
Jakub Konka 6cdcf61a5c test/link/macho: upgrade and migrate dead_strip test 2024-01-24 12:34:39 +01:00
Jakub Konka aa50bca151 test/link/elf: make invalid input file test less janky 2024-01-24 12:34:39 +01:00
Jakub Konka 56303d770e macho: fix invalid generation of FDE records 2024-01-24 12:34:39 +01:00
Jakub Konka 11524e4d0c test/link/macho: migrate entry_in_dylib test to new test format 2024-01-24 12:34:39 +01:00
Jakub Konka ee68f35bfe macho: fix section boundary symbols test 2024-01-24 12:34:39 +01:00
Jakub Konka b1ffc2b8b3 test/link/elf: patch up relocatable test 2024-01-15 00:18:50 +01:00
Jakub Konka d7c2324cdb test/link/elf: trigger build system bug testing relocatable mode 2024-01-14 20:51:03 +01:00
Carl Åstholm 3cd646869b Add tests for --undefined-version 2024-01-09 17:26:10 +01:00
Pat Tullmann cbaaf6477f test glibc_runtime_check: add strlcpy() check
The strlcpy symbol was added in v2.38, so this is a handy symbol for
creating binaries that won't run on relatively modern systems (e.g., mine,
that has glibc 2.36 installed).
2024-01-04 17:12:07 -07:00
Pat Tullmann 42d7b69d81 test/link/glibc_compat: test various older glibc versions
Compile, link and run a test case against various glibc versions.
Exercise symbols that have been probelmatic in the past.
2024-01-04 17:12:07 -07:00
Andrew Kelley 027e7c1c49 test.link.glibc_compat: fix invalid build system API usage 2024-01-01 19:49:08 -07:00
Andrew Kelley b92e30ff0b std.Build.ResolvedTarget: rename target field to result
This change is seemingly insignificant but I actually agonized over this
for three days. Some other things I considered:

* (status quo in master branch) make Compile step creation functions
  accept a Target.Query and delete the ResolvedTarget struct.
  - downside: redundantly resolve target queries many times
* same as before but additionally add a hash map to cache target query
  resolutions.
  - downside: now there is a hash map that doesn't actually need to
    exist, just to make the API more ergonomic.
* add is_native_os and is_native_abi fields to std.Target and use it
  directly as the result of resolving a target query.
  - downside: they really don't belong there. They would be available
    as comptime booleans via `@import("builtin")` but they should not
    be exposed that way.

With this change the downsides are:
* the option name of addExecutable and friends is `target` instead of
  `resolved_target` matching the type name.
  - upside: this does not break compatibility with existing build
    scripts
* you likely end up seeing `target.result.cpu.arch` rather than
  `target.cpu.arch`.
  - upside: this is an improvement over `target.target.cpu.arch` which
    it was before this commit.
  - downside: `b.host.target` is now `b.host.result`.
2024-01-01 17:51:18 -07:00
Andrew Kelley 3179f58c41 rename std.zig.CrossTarget to std.Target.Query 2024-01-01 17:51:18 -07:00
Andrew Kelley 04480f72d8 fix linker test regressions
Caused by problems with transitive dependencies
2024-01-01 17:51:18 -07:00
Andrew Kelley 142471fcc4 zig build system: change target, compilation, and module APIs
Introduce the concept of "target query" and "resolved target". A target
query is what the user specifies, with some things left to default. A
resolved target has the default things discovered and populated.
In the future, std.zig.CrossTarget will be rename to std.Target.Query.
Introduces `std.Build.resolveTargetQuery` to get from one to the other.

The concept of `main_mod_path` is gone, no longer supported. You have to
put the root source file at the module root now.

* remove deprecated API
* update build.zig for the breaking API changes in this branch
* move std.Build.Step.Compile.BuildId to std.zig.BuildId
* add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions,
  std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and
  std.Build.TestOptions.
* remove `std.Build.constructCMacro`. There is no use for this API.
* deprecate `std.Build.Step.Compile.defineCMacro`. Instead,
  `std.Build.Module.addCMacro` is provided.
  - remove `std.Build.Step.Compile.defineCMacroRaw`.
* deprecate `std.Build.Step.Compile.linkFrameworkNeeded`
  - use `std.Build.Module.linkFramework`
* deprecate `std.Build.Step.Compile.linkFrameworkWeak`
  - use `std.Build.Module.linkFramework`
* move more logic into `std.Build.Module`
* allow `target` and `optimize` to be `null` when creating a Module.
  Along with other fields, those unspecified options will be inherited
  from parent `Module` when inserted into an import table.
* the `target` field of `addExecutable` is now required. pass `b.host`
  to get the host target.
2024-01-01 17:51:18 -07:00
Jakub Konka f26459e594 lib/std/Build/CheckObject: update all tests to new API 2023-12-13 12:06:25 +01:00
Jakub Konka eb70c8801e lib/std/Build/CheckObject: dump Mach-O symbol attributes 2023-12-09 09:38:23 +01:00
Jakub Konka d05db52616 elf: copy out committed ZigObject to a buffer when creating static lib 2023-12-05 17:29:26 +01:00
Jakub Konka ee1630beea elf: exit early with an error when parsing or init failed 2023-12-05 16:31:47 +01:00
Jakub Konka 297c39ff56 test/link/elf: adjust tests for new errors 2023-12-05 14:40:13 +01:00
Luuk de Gram 4115f70cd3 test/link: update wasm linker tests
Disable garbage-collection for certain tests to ensure the tested
sections are being emitted.
2023-11-28 18:32:31 +01:00
mlugg d82d327de2 test: update remaining code to fix 'var is never mutated' errors 2023-11-19 09:57:04 +00:00
Jakub Konka 85c0485fd9 elf: test -r mode does not create unneeded .eh_frame section 2023-11-16 10:54:39 +01:00
Jakub Konka f6bf3353b1 elf: test -r mode with archive on the linker line 2023-11-16 10:51:21 +01:00
Jakub Konka 17177727c0 test/link: refactor common bits between ELF and MachO tests 2023-11-10 13:50:33 +01:00
Jakub Konka 7566a8fbd8 test/link: spawn ELF and MachO tests from the same root test/link/link.zig 2023-11-10 13:44:43 +01:00
Jakub Konka 73fd4ed54b test/link/elf: make .eh_frame relocatable test also verify COMDATs we emit 2023-11-09 23:22:47 +01:00
Jakub Konka 50f48022f0 test/link/elf: fix .eh_frame test 2023-11-09 14:51:00 +01:00
Jakub Konka f607126614 test/link/elf: verify we can output a valid relocatable with .eh_frame section 2023-11-09 11:49:04 +01:00
Jakub Konka 9bcb432a0e elf: test emitting relocatable 2023-11-08 18:41:09 +01:00
Jakub Konka bf0387b6bb Merge pull request #17873 from ziglang/elf-archive
elf: implement archiving input object files
2023-11-07 03:22:14 +01:00
Jakub Konka 261db02018 CheckObject: support parsing and dumping archive symtab for ELF 2023-11-06 21:18:26 +01:00
Jakub Konka 6490e2ed82 test/link/elf: improve test linking with static lib 2023-11-06 14:47:01 +01:00
Andrew Kelley 702b809ea3 Merge pull request #17815 from Luukdegram/wasm-no-entry
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given
2023-11-05 18:44:12 -05:00
Jakub Konka 205f8214d8 test/link/elf: enable our ELF archiver 2023-11-05 13:42:26 +01:00
Jakub Konka ee66137269 elf: add link smoke tests covering emitting obj and static lib 2023-11-04 09:13:34 +01:00
Jakub Konka b8c8565e93 elf: implement --gc-sections for non-LLVM Zig source 2023-11-04 09:08:27 +01:00
Luuk de Gram c893f83715 cli: consolidate entry point flags 2023-11-03 12:48:53 +01:00
Luuk de Gram 938f9dea37 update linker tests
This updates all linker tests to include `no_entry` as well as changes
all tests to executable so they do not need to be updated later when
the in-house WebAssembly linker supports dynamic libraries.
2023-11-03 12:48:53 +01:00
Jakub Konka bc081901dc Step.Compile: differentiate between fuzzy and exact matches for compile errors 2023-10-25 11:40:16 +02:00
Jakub Konka 55c7a6d99d elf: test unknown file type error 2023-10-24 23:11:50 +02:00
Jakub Konka bc9ab3a613 elf: test mismatched cpu architecture error 2023-10-24 22:48:55 +02:00
Jakub Konka c9c210a4e7 elf: test path errors in ld script parsing 2023-10-24 22:31:25 +02:00
Jakub Konka 403e539669 elf: test unresolved symbol reference error 2023-10-24 22:08:36 +02:00