ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
32.09k stars 2.34k forks source link

Allow Embedding LLVM Bitcode #11204

Open insraq opened 2 years ago

insraq commented 2 years ago

When building a static library for iOS, -fembed-bitcode flag needs to be passed to clang to embed the generated bitcode in the .a file. Most projects nowadays have bitcode enabled. I could not find a way to enable that flag in Zig build system - it seems that this is not supported. Passing -fembed-bitcode explicitly in addCSourceFile will cause clang to complain about -mno-red-zone, see https://reviews.llvm.org/D61627

insraq commented 2 years ago

Here's the error message when passing -fembed-bitcode explicitly in C flags

error(compilation): clang failed with stderr: zig: error: -mred-zone is not supported with -fembed-bitcode