Skip to content

Support for PowerPC/PowerPC64 on FreeBSD #57112

Closed

Description

@lenoil98

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?

Activity

  1. glaubitz commented on Dec 25, 2018

    @glaubitz
    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.

  2. lenoil98 commented on Dec 25, 2018

    @lenoil98
    ContributorAuthor

    Great! I will help where I can.

  3. added
    O-PowerPCTarget: PowerPC processors
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Dec 26, 2018
  4. lenoil98 commented on Dec 28, 2018

    @lenoil98
    ContributorAuthor

    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,
        })
    }
    
  5. glaubitz commented on Jan 11, 2019

    @glaubitz
    Contributor

    @lenoil98 Has this target been added now?

  6. goosnarrggh commented on Jan 4, 2021

    @goosnarrggh

    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.)

  7. barracuda156 commented on May 16, 2024

    @barracuda156

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-PowerPCTarget: PowerPC processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions