cg_llvm: Reuse LLVM-C Comdat support
Migrate `llvm::set_comdat` and `llvm::SetUniqueComdat` to LLVM-C FFI. Note, now we can call `llvm::set_comdat` only when the target actually supports adding comdat. As this has no convenient LLVM-C API, we implement this as `TargetOptions::supports_comdat`. Co-authored-by: Stuart Cook <Zalathar@users.noreply.github.com>
This commit is contained in:
@@ -2514,6 +2514,13 @@ fn add_link_args(link_args: &mut LinkArgs, flavor: LinkerFlavor, args: &[&'stati
|
||||
add_link_args_iter(link_args, flavor, args.iter().copied().map(Cow::Borrowed))
|
||||
}
|
||||
|
||||
impl TargetOptions {
|
||||
pub fn supports_comdat(&self) -> bool {
|
||||
// XCOFF and MachO don't support COMDAT.
|
||||
!self.is_like_aix && !self.is_like_osx
|
||||
}
|
||||
}
|
||||
|
||||
impl TargetOptions {
|
||||
fn link_args(flavor: LinkerFlavor, args: &[&'static str]) -> LinkArgs {
|
||||
let mut link_args = LinkArgs::new();
|
||||
|
||||
Reference in New Issue
Block a user