Use error-on-mismatch policy for PAuth module flags.

This agrees with Clang, and avoids an error when using LTO with mixed
C/Rust. LLVM considers different behaviour flags to be a mismatch,
even when the flag value itself is the same.

This also makes the flag setting explicit for all uses of
LLVMRustAddModuleFlag.
This commit is contained in:
Jacob Bramley 2022-01-19 14:51:59 +00:00
parent 7bc7be860f
commit e02e9582d2
4 changed files with 73 additions and 13 deletions

View file

@ -722,9 +722,12 @@ extern "C" bool LLVMRustIsRustLLVM() {
#endif
}
extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *Name,
uint32_t Value) {
unwrap(M)->addModuleFlag(Module::Warning, Name, Value);
extern "C" void LLVMRustAddModuleFlag(
LLVMModuleRef M,
Module::ModFlagBehavior MergeBehavior,
const char *Name,
uint32_t Value) {
unwrap(M)->addModuleFlag(MergeBehavior, Name, Value);
}
extern "C" LLVMValueRef LLVMRustMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD) {