use crate::spec::{Cc, Lld, LinkerFlavor, Os, RelroLevel, TargetOptions, cvs};

pub(crate) fn opts() -> TargetOptions {
    let add_linker_paths =
        &[
            // For the benefit of powerpc, when libatomic-links is installed,
            "-Wl,-R/usr/pkg/lib/libatomic",
            "-Wl,-L/usr/pkg/lib/libatomic",
        ];
    let pre_link_args = TargetOptions::link_args(
        LinkerFlavor::Gnu(Cc::Yes, Lld::No),
        add_linker_paths
    );
    TargetOptions {
        os: Os::NetBsd,
        dynamic_linking: true,
        families: cvs!["unix"],
        no_default_libraries: false,
        has_rpath: true,
        pre_link_args,
        position_independent_executables: true,
        relro_level: RelroLevel::Full,
        has_thread_local: true,
        use_ctors_section: true,
        default_dwarf_version: 2,
        ..Default::default()
    }
}
