Add -Zvirtual-function-elimination flag
Adds the virtual-function-elimination unstable compiler flag and a check that this flag is only used in combination with -Clto. LLVM can only apply this optimization with fat LTO.
This commit is contained in:
@@ -1431,14 +1431,14 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
|
||||
);
|
||||
}
|
||||
|
||||
// LLVM CFI requires LTO.
|
||||
if sess.is_sanitizer_cfi_enabled() {
|
||||
if sess.opts.cg.lto == config::LtoCli::Unspecified
|
||||
|| sess.opts.cg.lto == config::LtoCli::No
|
||||
|| sess.opts.cg.lto == config::LtoCli::Thin
|
||||
{
|
||||
// LLVM CFI and VFE both require LTO.
|
||||
if sess.lto() != config::Lto::Fat {
|
||||
if sess.is_sanitizer_cfi_enabled() {
|
||||
sess.err("`-Zsanitizer=cfi` requires `-Clto`");
|
||||
}
|
||||
if sess.opts.debugging_opts.virtual_function_elimination {
|
||||
sess.err("`-Zvirtual-function-elimination` requires `-Clto`");
|
||||
}
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.stack_protector != StackProtector::None {
|
||||
|
||||
Reference in New Issue
Block a user