-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding values to the `!llvm.module.flags` metadata for a generated module. The syntax is `-Z llvm_module_flag=<name>:<type>:<value>:<behavior>` Currently only u32 values are supported but the type is required to be specified for forward compatibility. The `behavior` element must match one of the named LLVM metadata behaviors.viors. This flag is expected to be perma-unstable.
- Loading branch information
1 parent
b66fe58
commit 10ed802
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/doc/unstable-book/src/compiler-flags/llvm-module-flag.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# `llvm-module-flag` | ||
|
||
--------------------- | ||
|
||
This flag allows adding a key/value to the `!llvm.module.flags` metadata in the | ||
LLVM-IR for a compiled Rust module. The syntax is | ||
|
||
`-Z llvm_module_flag=<name>:<type>:<value>:<behavior>` | ||
|
||
Currently only u32 values are supported but the type is required to be specified | ||
for forward compatibility. The `behavior` element must match one of the named | ||
LLVM [metadata behaviors](https://llvm.org/docs/LangRef.html#module-flags-metadata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Test for -Z llvm_module_flags | ||
// compile-flags: -Z llvm_module_flag=foo:u32:123:error -Z llvm_module_flag=bar:u32:42:max | ||
|
||
fn main() {} | ||
|
||
// CHECK: !{i32 1, !"foo", i32 123} | ||
// CHECK: !{i32 7, !"bar", i32 42} |