mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	LoongArch: Enable initial Rust support
Enable initial Rust support for LoongArch. Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: WANG Rui <wangrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
		
							parent
							
								
									f58b0abae8
								
							
						
					
					
						commit
						90868ff9ca
					
				
					 4 changed files with 18 additions and 6 deletions
				
			
		| 
						 | 
					@ -12,10 +12,11 @@ which uses ``libclang``.
 | 
				
			||||||
Below is a general summary of architectures that currently work. Level of
 | 
					Below is a general summary of architectures that currently work. Level of
 | 
				
			||||||
support corresponds to ``S`` values in the ``MAINTAINERS`` file.
 | 
					support corresponds to ``S`` values in the ``MAINTAINERS`` file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
============  ================  ==============================================
 | 
					=============  ================  ==============================================
 | 
				
			||||||
Architecture  Level of support  Constraints
 | 
					Architecture   Level of support  Constraints
 | 
				
			||||||
============  ================  ==============================================
 | 
					=============  ================  ==============================================
 | 
				
			||||||
``um``        Maintained        ``x86_64`` only.
 | 
					``loongarch``  Maintained        -
 | 
				
			||||||
``x86``       Maintained        ``x86_64`` only.
 | 
					``um``         Maintained        ``x86_64`` only.
 | 
				
			||||||
============  ================  ==============================================
 | 
					``x86``        Maintained        ``x86_64`` only.
 | 
				
			||||||
 | 
					=============  ================  ==============================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -140,6 +140,7 @@ config LOONGARCH
 | 
				
			||||||
	select HAVE_REGS_AND_STACK_ACCESS_API
 | 
						select HAVE_REGS_AND_STACK_ACCESS_API
 | 
				
			||||||
	select HAVE_RETHOOK
 | 
						select HAVE_RETHOOK
 | 
				
			||||||
	select HAVE_RSEQ
 | 
						select HAVE_RSEQ
 | 
				
			||||||
 | 
						select HAVE_RUST
 | 
				
			||||||
	select HAVE_SAMPLE_FTRACE_DIRECT
 | 
						select HAVE_SAMPLE_FTRACE_DIRECT
 | 
				
			||||||
	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
 | 
						select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
 | 
				
			||||||
	select HAVE_SETUP_PER_CPU_AREA if NUMA
 | 
						select HAVE_SETUP_PER_CPU_AREA if NUMA
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,8 +81,11 @@ KBUILD_AFLAGS_MODULE		+= -Wa,-mla-global-with-abs
 | 
				
			||||||
KBUILD_CFLAGS_MODULE		+= -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs
 | 
					KBUILD_CFLAGS_MODULE		+= -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					KBUILD_RUSTFLAGS_MODULE		+= -Crelocation-model=pic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(CONFIG_RELOCATABLE),y)
 | 
					ifeq ($(CONFIG_RELOCATABLE),y)
 | 
				
			||||||
KBUILD_CFLAGS_KERNEL		+= -fPIE
 | 
					KBUILD_CFLAGS_KERNEL		+= -fPIE
 | 
				
			||||||
 | 
					KBUILD_RUSTFLAGS_KERNEL		+= -Crelocation-model=pie
 | 
				
			||||||
LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
 | 
					LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -161,6 +161,13 @@ fn main() {
 | 
				
			||||||
        ts.push("features", features);
 | 
					        ts.push("features", features);
 | 
				
			||||||
        ts.push("llvm-target", "x86_64-linux-gnu");
 | 
					        ts.push("llvm-target", "x86_64-linux-gnu");
 | 
				
			||||||
        ts.push("target-pointer-width", "64");
 | 
					        ts.push("target-pointer-width", "64");
 | 
				
			||||||
 | 
					    } else if cfg.has("LOONGARCH") {
 | 
				
			||||||
 | 
					        ts.push("arch", "loongarch64");
 | 
				
			||||||
 | 
					        ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
 | 
				
			||||||
 | 
					        ts.push("features", "-f,-d");
 | 
				
			||||||
 | 
					        ts.push("llvm-target", "loongarch64-linux-gnusf");
 | 
				
			||||||
 | 
					        ts.push("llvm-abiname", "lp64s");
 | 
				
			||||||
 | 
					        ts.push("target-pointer-width", "64");
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        panic!("Unsupported architecture");
 | 
					        panic!("Unsupported architecture");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue