0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/src/link.cpp

2956 lines
111 KiB

2019-03-04 22:15:53 -05:00
2019-07-07 17:06:09 -04:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-07-09 23:34:16 -04:00
2019-07-09 23:34:16 -04:00
2019-03-06 13:22:36 -05:00
2019-03-07 12:16:10 -05:00
2019-03-06 13:22:36 -05:00
2019-03-06 13:22:36 -05:00
2019-03-06 13:22:36 -05:00
2019-03-06 13:22:36 -05:00
2019-03-06 13:22:36 -05:00
2019-03-07 12:16:10 -05:00
2019-03-06 13:22:36 -05:00
2019-03-06 13:22:36 -05:00
2019-07-16 19:54:14 -04:00
2019-07-16 19:54:14 -04:00
2019-07-16 19:54:14 -04:00
2019-07-16 19:54:14 -04:00
2019-07-16 19:54:14 -04:00
2019-07-16 19:54:14 -04:00
2019-07-09 23:34:16 -04:00
2019-07-09 23:34:16 -04:00
2019-07-09 23:34:16 -04:00
2019-07-10 20:20:53 -04:00
2019-07-09 23:34:16 -04:00
2019-03-04 22:15:53 -05:00
2019-03-06 13:22:36 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-06 13:22:36 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-06 13:22:36 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-05 13:26:43 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2019-03-04 22:15:53 -05:00
2020-04-01 11:56:39 -04:00
2019-03-04 22:15:53 -05:00
2019-06-28 00:58:35 +02:00
2019-06-28 00:58:35 +02:00
2017-08-15 07:16:22 -04:00
2017-08-15 07:16:22 -04:00
2017-08-15 07:16:22 -04:00
2017-03-13 11:54:56 -04:00
2019-07-07 17:06:09 -04:00
2019-07-07 17:06:09 -04:00
2017-03-13 11:54:56 -04:00
improvements targeted at improving async functions * Reuse bytes of async function frames when non-async functions make `noasync` calls. This prevents explosive stack growth. * Zig now passes a stack size argument to the linker when linking ELF binaries. Linux ignores this value, but it is available as a program header called GNU_STACK. I prototyped some code that memory maps extra space to the stack using this program header, but there was still a problem when accessing stack memory very far down. Stack probing is needed or not working or something. I also prototyped using `@newStackCall` to call main and that does work around the issue but it also brings its own issues. That code is commented out for now in std/special/start.zig. I'm on a plane with no Internet, but I plan to consult with the musl community for advice when I get a chance. * Added `noasync` to a bunch of function calls in std.debug. It's very messy but it's a workaround that makes stack traces functional with evented I/O enabled. Eventually these will be cleaned up as the root bugs are found and fixed. Programs built in blocking mode are unaffected. * Lowered the default stack size of std.io.InStream (for the async version) to 1 MiB instead of 4. Until we figure out how to get choosing a stack size working (see 2nd bullet point above), 4 MiB tends to cause segfaults due to stack size running out, or usage of stack memory too far apart, or something like that. * Default thread stack size is bumped from 8 MiB to 16 to match the size we give for the main thread. It's planned to eventually remove this hard coded value and have Zig able to determine this value during semantic analysis, with call graph analysis and function pointer annotations and extern function annotations.
2019-09-11 20:22:49 -04:00
improvements targeted at improving async functions * Reuse bytes of async function frames when non-async functions make `noasync` calls. This prevents explosive stack growth. * Zig now passes a stack size argument to the linker when linking ELF binaries. Linux ignores this value, but it is available as a program header called GNU_STACK. I prototyped some code that memory maps extra space to the stack using this program header, but there was still a problem when accessing stack memory very far down. Stack probing is needed or not working or something. I also prototyped using `@newStackCall` to call main and that does work around the issue but it also brings its own issues. That code is commented out for now in std/special/start.zig. I'm on a plane with no Internet, but I plan to consult with the musl community for advice when I get a chance. * Added `noasync` to a bunch of function calls in std.debug. It's very messy but it's a workaround that makes stack traces functional with evented I/O enabled. Eventually these will be cleaned up as the root bugs are found and fixed. Programs built in blocking mode are unaffected. * Lowered the default stack size of std.io.InStream (for the async version) to 1 MiB instead of 4. Until we figure out how to get choosing a stack size working (see 2nd bullet point above), 4 MiB tends to cause segfaults due to stack size running out, or usage of stack memory too far apart, or something like that. * Default thread stack size is bumped from 8 MiB to 16 to match the size we give for the main thread. It's planned to eventually remove this hard coded value and have Zig able to determine this value during semantic analysis, with call graph analysis and function pointer annotations and extern function annotations.
2019-09-11 20:22:49 -04:00
2017-02-03 12:34:20 -05:00
2020-04-02 17:29:22 -04:00
2019-03-04 22:15:53 -05:00
2020-01-03 21:28:58 -08:00
2019-12-24 14:26:09 -08:00
2020-04-02 17:29:22 -04:00
2019-03-07 13:04:10 -05:00
2019-09-28 13:21:29 -04:00
2019-09-27 16:51:42 -04:00
2019-09-27 16:51:42 -04:00
2019-09-28 13:21:29 -04:00
2019-09-27 16:51:42 -04:00
2019-09-28 13:21:29 -04:00
2019-09-27 16:51:42 -04:00
2019-07-18 11:45:37 -04:00
2019-07-18 11:45:37 -04:00
2017-03-13 11:54:56 -04:00
2017-03-13 11:54:56 -04:00
2019-03-04 22:15:53 -05:00
2019-03-07 13:04:10 -05:00
2019-07-07 17:06:09 -04:00
2019-03-05 18:17:22 -05:00
2016-02-13 23:03:16 -07:00
2020-03-08 13:52:51 +01:00
2019-07-07 17:06:09 -04:00
2019-03-04 22:15:53 -05:00
2019-09-28 13:21:29 -04:00
2019-09-28 13:21:29 -04:00
2019-09-28 13:21:29 -04:00
2020-04-02 17:29:22 -04:00
2019-07-09 23:34:16 -04:00
2019-04-10 17:14:44 -05:00
2019-04-10 17:14:44 -05:00
2019-04-10 17:14:44 -05:00
2020-01-23 17:28:13 -05:00
2020-01-23 17:28:13 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2017-10-01 21:05:08 -04:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2019-04-20 00:12:33 -05:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2019-07-09 23:34:16 -04:00
2019-03-29 20:37:15 -05:00
2019-07-10 19:40:46 -04:00
2019-03-29 20:37:15 -05:00
2019-07-10 19:40:46 -04:00
2019-04-20 00:12:33 -05:00
2019-03-29 20:37:15 -05:00
2019-03-29 19:25:47 -05:00
2017-10-16 01:14:28 -04:00
2019-03-29 20:37:15 -05:00
2019-03-29 19:25:47 -05:00
2017-10-16 01:14:28 -04:00
2019-03-29 19:25:47 -05:00
2017-10-16 01:14:28 -04:00
2017-09-24 03:54:59 -04:00
2018-12-26 15:25:54 -05:00
2018-12-26 15:25:54 -05:00
breaking changes to zig build API and improved caching * in Zig build scripts, getOutputPath() is no longer a valid function to call, unless setOutputDir() was used, or within a custom make() function. Instead there is more convenient API to use which takes advantage of the caching system. Search this commit diff for `exe.run()` for an example. * Zig build by default enables caching. All build artifacts will go into zig-cache. If you want to access build artifacts in a convenient location, it is recommended to add an `install` step. Otherwise you can use the `run()` API mentioned above to execute programs directly from their location in the cache. Closes #330. `addSystemCommand` is available for programs not built with Zig build. * Please note that Zig does no cache evicting yet. You may have to manually delete zig-cache directories periodically to keep disk usage down. It's planned for this to be a simple Least Recently Used eviction system eventually. * `--output`, `--output-lib`, and `--output-h` are removed. Instead, use `--output-dir` which defaults to the current working directory. Or take advantage of `--cache on`, which will print the main output path to stdout, and the other artifacts will be in the same directory with predictable file names. `--disable-gen-h` is available when one wants to prevent .h file generation. * `@cImport` is always independently cached now. Closes #2015. It always writes the generated Zig code to disk which makes debug info and compile errors better. No more "TODO: remember C source location to display here" * Fix .d file parsing. (Fixes the MacOS CI failure) * Zig no longer creates "temporary files" other than inside a zig-cache directory. This breaks the CLI API that Godbolt uses. The suggested new invocation can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 22:53:35 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 20:37:15 -05:00
2018-12-26 15:25:54 -05:00
2019-07-09 23:34:16 -04:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2019-03-29 20:37:15 -05:00
2017-10-16 01:14:28 -04:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-03-29 19:25:47 -05:00
2019-07-10 19:40:46 -04:00
2018-12-26 15:25:54 -05:00
2019-07-10 19:40:46 -04:00
2019-03-29 20:37:15 -05:00
2019-07-10 15:37:25 -05:00
2019-07-10 15:37:25 -05:00
2016-02-13 23:03:16 -07:00
2019-07-10 15:37:25 -05:00
2019-07-10 15:37:25 -05:00
2019-07-10 15:37:25 -05:00
2017-03-13 11:54:56 -04:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2020-04-02 17:29:22 -04:00
2016-02-15 20:56:52 -07:00
2020-04-02 17:29:22 -04:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2016-02-15 20:56:52 -07:00
2019-03-07 13:04:10 -05:00
2016-02-15 20:56:52 -07:00
2019-03-07 13:04:10 -05:00
2019-03-07 13:04:10 -05:00
2020-04-02 17:29:22 -04:00
2016-02-15 20:56:52 -07:00
2017-03-13 11:54:56 -04:00
2019-07-17 17:45:24 -04:00
2017-03-13 11:54:56 -04:00
2017-03-13 11:54:56 -04:00
2017-06-19 21:36:54 -04:00
2019-03-04 22:15:53 -05:00
2017-03-13 11:54:56 -04:00
2017-03-13 11:54:56 -04:00