Skip to content

Commit

Permalink
Allowlist more clang flags in bindgen (#2902)
Browse files Browse the repository at this point in the history
Especially `--target` is very usable for cross-compilation use cases.
  • Loading branch information
hlopko authored Oct 1, 2024
1 parent 144d34f commit 966678b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bindgen/private/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,21 @@ def _rust_bindgen_impl(ctx):
# Ideally we could depend on a more specific toolchain, requesting one which is specifically clang via some constraint.
# Unfortunately, we can't currently rely on this, so instead we filter only to flags we know clang supports.
# We can add extra flags here as needed.
flags_known_to_clang = ("-I", "-iquote", "-isystem", "--sysroot", "--gcc-toolchain")
flags_known_to_clang = (
"-I",
"-iquote",
"-isystem",
"--sysroot",
"--gcc-toolchain",
"--target",
"-W",
"--system-header-prefix",
"--no-system-header-prefix",
"-Xclang",
"-D",
"-no-canonical-prefixes",
"-nostd",
)
open_arg = False
for arg in compile_flags:
if open_arg:
Expand Down

0 comments on commit 966678b

Please sign in to comment.