diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-07-22 16:37:38 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-22 19:51:32 -0700 |
| commit | 7c25390c957273ff43927608a45e257c4ed73549 (patch) | |
| tree | 411809c36b20d2575816bcf726330413c3624398 /src/codegen | |
| parent | a5fb28070f37c2cad92ac8805bcc704e872fc538 (diff) | |
| download | zig-7c25390c957273ff43927608a45e257c4ed73549.tar.gz zig-7c25390c957273ff43927608a45e257c4ed73549.zip | |
support -fcompiler-rt in conjunction with build-obj
When using `build-exe` or `build-lib -dynamic`, `-fcompiler-rt` means building
compiler-rt into a static library and then linking it into the executable.
When using `build-lib`, `-fcompiler-rt` means building compiler-rt into an
object file and then adding it into the static archive.
Before this commit, when using `build-obj`, zig would build compiler-rt
into an object file, and then on ELF, use `lld -r` to merge it into the
main object file. Other linker backends of LLD do not support `-r` to
merge objects, so this failed with error messages for those targets.
Now, `-fcompiler-rt` when used with `build-obj` acts as if the user puts
`_ = @import("compiler_rt");` inside their root source file. The symbols
of compiler-rt go into the same compilation unit as the root source file.
This is hooked up for stage1 only for now. Once stage2 is capable of
building compiler-rt, it should be hooked up there as well.
Diffstat (limited to 'src/codegen')
0 files changed, 0 insertions, 0 deletions
