- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Add built in PSP target #72062
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
                    Add built in PSP target #72062
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            7 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      b6e4581
              
                Add mipsel-sony-psp target
              
              
                overdrivenpotato 20a6691
              
                Update stdarch
              
              
                overdrivenpotato 8961b08
              
                Formatting
              
              
                overdrivenpotato 7e62240
              
                Add lld_link_script to TargetOptions
              
              
                overdrivenpotato 7b649c7
              
                Renamed lld_link_script to link_script and support all GNU-like linkers
              
              
                overdrivenpotato 7444494
              
                Run rustfmt
              
              
                overdrivenpotato 425723f
              
                Rewrite link script from scratch
              
              
                overdrivenpotato 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
    
  
  
    
              
  
    
      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,43 @@ | ||
| use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; | ||
| use crate::spec::{Target, TargetOptions, TargetResult}; | ||
|  | ||
| // The PSP has custom linker requirements. | ||
| const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); | ||
|  | ||
| pub fn target() -> TargetResult { | ||
| let mut pre_link_args = LinkArgs::new(); | ||
| pre_link_args.insert( | ||
| LinkerFlavor::Lld(LldFlavor::Ld), | ||
| vec!["--eh-frame-hdr".to_string(), "--emit-relocs".to_string()], | ||
| ); | ||
|  | ||
| Ok(Target { | ||
| llvm_target: "mipsel-sony-psp".to_string(), | ||
| target_endian: "little".to_string(), | ||
| target_pointer_width: "32".to_string(), | ||
| target_c_int_width: "32".to_string(), | ||
| data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), | ||
| arch: "mips".to_string(), | ||
| target_os: "psp".to_string(), | ||
| target_env: "".to_string(), | ||
| target_vendor: "sony".to_string(), | ||
| linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), | ||
|  | ||
| options: TargetOptions { | ||
| cpu: "mips2".to_string(), | ||
| executables: true, | ||
| linker: Some("rust-lld".to_owned()), | ||
| linker_is_gnu: true, | ||
| relocation_model: RelocModel::Static, | ||
|  | ||
| // PSP FPU only supports single precision floats. | ||
| features: "+single-float".to_string(), | ||
|  | ||
| // PSP does not support trap-on-condition instructions. | ||
| llvm_args: vec!["-mno-check-zero-division".to_string()], | ||
| pre_link_args, | ||
| link_script: Some(LINKER_SCRIPT.to_string()), | ||
| ..Default::default() | ||
| }, | ||
| }) | ||
| } | 
  
    
      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,34 @@ | ||
| ENTRY(module_start) | ||
| SECTIONS | ||
| { | ||
| /* PRX format requires text to begin at 0 */ | ||
| .text 0 : { *(.text .text.*) } | ||
|  | ||
| /* Sort stubs for convenient ordering */ | ||
| .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } | ||
|  | ||
| /* Keep these sections around, even though they may appear unused to the linker */ | ||
| .lib.ent.top : { KEEP(*(.lib.ent.top)) } | ||
| .lib.ent : { KEEP(*(.lib.ent)) } | ||
| .lib.ent.btm : { KEEP(*(.lib.ent.btm)) } | ||
| .lib.stub.top : { KEEP(*(.lib.stub.top)) } | ||
| .lib.stub : { KEEP(*(.lib.stub)) } | ||
| .lib.stub.btm : { KEEP(*(.lib.stub.btm)) } | ||
| .eh_frame_hdr : { KEEP(*(.eh_frame_hdr)) } | ||
|  | ||
| /* Add symbols for LLVM's libunwind */ | ||
| __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; | ||
| __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; | ||
| .eh_frame : | ||
| { | ||
| __eh_frame_start = .; | ||
| KEEP(*(.eh_frame)) | ||
| __eh_frame_end = .; | ||
| } | ||
|  | ||
| /* These are explicitly listed to avoid being merged into .rodata */ | ||
| .rodata.sceResident : { *(.rodata.sceResident) } | ||
| .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } | ||
| /* Sort NIDs for convenient ordering */ | ||
| .rodata.sceNid : { *(.rodata.sceNid) *(SORT(.rodata.sceNid.*)) } | ||
| } | 
  
    
      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
    
  
  
    
              
  
  Submodule stdarch
    updated
      
        3 files
      
      
          
    | +1 −1 | ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh | |
| +4 −0 | crates/core_arch/src/mips/mod.rs | |
| +9 −3 | crates/core_arch/src/x86/cpuid.rs | 
  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.