Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PowerPC/PowerPC64 on FreeBSD #57112

Closed
lenoil98 opened this issue Dec 25, 2018 · 6 comments
Closed

Support for PowerPC/PowerPC64 on FreeBSD #57112

lenoil98 opened this issue Dec 25, 2018 · 6 comments
Labels
O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lenoil98
Copy link
Contributor

Since there's native support in rust for PowerPC on Linux and NetBSD. Would it be difficult to add support for PowerPC/PowerPC64 on FreeBSD?

@glaubitz
Copy link
Contributor

Yes, it should be fairly easy to add FreeBSD support for ppc, ppc64 and sparc64 unless there are any peculiarities in the FreeBSD ABI that I'm unaware of. I can have a go at this.

@lenoil98
Copy link
Contributor Author

Great! I will help where I can.

@nagisa nagisa added O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 26, 2018
@lenoil98
Copy link
Contributor Author

lenoil98 commented Dec 28, 2018

I've created spec files for FreeBSD.

// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use spec::{LinkerFlavor, Target, TargetResult};

pub fn target() -> TargetResult {
    let mut base = super::freebsd_base::opts();
    base.cpu = "ppc64".to_string();
    base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
    base.max_atomic_width = Some(64);

    Ok(Target {
        llvm_target: "powerpc64-unknown-freebsd".to_string(),
        target_endian: "big".to_string(),
        target_pointer_width: "64".to_string(),
        target_c_int_width: "32".to_string(),
        data_layout: "E-m:e-i64:64-n32:64".to_string(),
        arch: "powerpc64".to_string(),
        target_os: "freebsd".to_string(),
        target_env: "".to_string(),
        target_vendor: "unknown".to_string(),
        linker_flavor: LinkerFlavor::Gcc,
        options: base,
    })
}

// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use spec::{LinkerFlavor, Target, TargetResult};

pub fn target() -> TargetResult {
    let mut base = super::freebsd_base::opts();
    base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
    base.max_atomic_width = Some(32);

    Ok(Target {
        llvm_target: "powerpc-unknown-freebsd".to_string(),
        target_endian: "big".to_string(),
        target_pointer_width: "32".to_string(),
        target_c_int_width: "32".to_string(),
        data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
        arch: "powerpc".to_string(),
        target_os: "freebsd".to_string(),
        target_env: String::new(),
        target_vendor: "unknown".to_string(),
        linker_flavor: LinkerFlavor::Gcc,
        options: base,
    })
}

@glaubitz
Copy link
Contributor

@lenoil98 Has this target been added now?

@goosnarrggh
Copy link

goosnarrggh commented Jan 4, 2021

I see that ppc64 support was added, and it is actually available now for ppc64 ELFv1 ABI (FreeBSD 12.x), and both ppc64 and ppc64le ELFv2 ABI (soon-to-be-released FreeBSD 13).

How far has anyone made it with bringing up support for 32-bit ppc, on either FreeBSD 12.x (with gcc 4.2 in the base system, and thus probably relying on a newer gcc/llvm compiled from source code via the ports), or else FreeBSD 13 (with llvm in the base system)?

If someone (perhaps me) were to volunteer to continue working on such a project, what next steps would be required?

(Edit: The compromises that are required to maintain a FreeBSD 12.x system with up-to-date packages are beginning to take a hit as the only viable path forward at the moment is to avoid any packages which have a rust library anywhere in their chain of dependencies. I am increasingly thinking that the better path forward would be to bite the bullet and actually finish a 32-bit ppc rustc bootstrap. I see that 32-bit ppc is already supported as a Tier 2 architecture for a couple different flavours of Linux, so that gives me some hope that it might be possible for FreeBSD too.)

@barracuda156
Copy link

@goosnarrggh Have you gotten anywhere with Rust for ppc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants