- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Add aarch64_be-unknown-linux-musl target #144551
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            40 changes: 40 additions & 0 deletions
          
          40 
        
  compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| use rustc_abi::Endian; | ||
| 
     | 
||
| use crate::spec::{ | ||
| FramePointer, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base, | ||
| }; | ||
| 
     | 
||
| pub(crate) fn target() -> Target { | ||
| let mut base = base::linux_musl::opts(); | ||
| base.max_atomic_width = Some(128); | ||
| base.supports_xray = true; | ||
| base.features = "+v8a,+outline-atomics".into(); | ||
| base.stack_probes = StackProbeType::Inline; | ||
| base.supported_sanitizers = SanitizerSet::ADDRESS | ||
| | SanitizerSet::CFI | ||
| | SanitizerSet::LEAK | ||
| | SanitizerSet::MEMORY | ||
| | SanitizerSet::THREAD; | ||
| 
     | 
||
| Target { | ||
| llvm_target: "aarch64_be-unknown-linux-musl".into(), | ||
| metadata: TargetMetadata { | ||
| description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: Some(true), | ||
| }, | ||
| pointer_width: 64, | ||
| data_layout: "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(), | ||
| arch: "aarch64".into(), | ||
| options: TargetOptions { | ||
| // the AAPCS64 expects use of non-leaf frame pointers per | ||
| // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer | ||
| // and we tend to encounter interesting bugs in AArch64 unwinding code if we do not | ||
| frame_pointer: FramePointer::NonLeaf, | ||
| mcount: "\u{1}_mcount".into(), | ||
| endian: Endian::Big, | ||
| ..base | ||
| }, | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            49 changes: 49 additions & 0 deletions
          
          49 
        
  src/doc/rustc/src/platform-support/aarch64_be-unknown-linux-musl.md
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # aarch64_be-unknown-linux-musl | ||
| 
     | 
||
| **Tier: 3** | ||
| 
     | 
||
| ARM64 Linux (big-endian) with musl-libc. | ||
| 
     | 
||
| ## Target maintainers | ||
| 
     | 
||
| [@neuschaefer](https://github.com/neuschaefer) | ||
| [@Gelbpunkt](https://github.com/Gelbpunkt) | ||
| 
     | 
||
| ## Requirements | ||
| 
     | 
||
| The target requires a `aarch64_be-*-linux-musl` toolchain, which likely has to | ||
| be built from source because this is a rare combination. [Buildroot] provides | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed that musl.cc/musl-cross-make includes an aarch64_be toolchain, which necessitates some rephrasing in this paragraph.  | 
||
| a way of doing so: | ||
| 
     | 
||
| - select _Target options_ → _Target Architecture_ → _AArch64 (big endian)_ | ||
| - select _Toolchain_ → _C library_ → _musl_ | ||
| - select _Toolchain_ → _Enable C++ support_ | ||
| 
     | 
||
| Host tools are supported. | ||
| 
     | 
||
| [Buildroot]: https://buildroot.org/ | ||
| 
     | 
||
| 
     | 
||
| ## Building the target | ||
| 
     | 
||
| The target can be enabled in bootstrap.toml: | ||
| 
     | 
||
| ```toml | ||
| [build] | ||
| target = ["aarch64_be-unknown-linux-musl"] | ||
| 
     | 
||
| [target.aarch64_be-unknown-linux-musl] | ||
| cc = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-cc" | ||
| cxx = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-c++" | ||
| linker = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-cc" | ||
| ar = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-ar" | ||
| ranlib = "/path/to/buildroot/host/bin/aarch64_be-buildroot-linux-musl-ranlib" | ||
| musl-root = "/path/to/buildroot/staging" | ||
| runner = "qemu-aarch64_be -L /path/to/buildroot/target" | ||
| crt-static = "/path/to/buildroot/target" | ||
| ``` | ||
| 
     | 
||
| 
     | 
||
| ## Testing | ||
| 
     | 
||
| Binaries can be run under `qemu-aarch64_be` or under a big-endian Linux kernel. | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.