File tree Expand file tree Collapse file tree 6 files changed +27
-7
lines changed
Expand file tree Collapse file tree 6 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ Architecture Level of support Constraints
1818``arm `` Maintained ARMv7 Little Endian only.
1919``arm64 `` Maintained Little Endian only.
2020``loongarch `` Maintained \-
21+ ``powerpc `` Maintained 32-bit Big Endian only.
2122``riscv `` Maintained ``riscv64 `` and LLVM/Clang only.
2223``um `` Maintained \-
2324``x86 `` Maintained ``x86_64 `` only.
Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ config PPC
283283 select HAVE_REGS_AND_STACK_ACCESS_API
284284 select HAVE_RELIABLE_STACKTRACE
285285 select HAVE_RSEQ
286+ select HAVE_RUST if PPC32
286287 select HAVE_SAMPLE_FTRACE_DIRECT if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
287288 select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
288289 select HAVE_SETUP_PER_CPU_AREA if PPC64
Original file line number Diff line number Diff line change 6161KBUILD_LDFLAGS_MODULE += $(objtree ) /arch/powerpc/lib/crtsavres.o
6262endif
6363
64+ KBUILD_RUSTFLAGS += --target=powerpc-unknown-linux-gnu
65+
6466ifdef CONFIG_CPU_LITTLE_ENDIAN
6567KBUILD_CPPFLAGS += -mlittle-endian
6668KBUILD_LDFLAGS += -EL
Original file line number Diff line number Diff line change 1515#define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG)
1616#define JUMP_LABEL_NOP_SIZE 4
1717
18+ /* This macro is also expanded on the Rust side. */
19+ #define ARCH_STATIC_BRANCH_ASM (key , label ) \
20+ "1:\n\t" \
21+ "nop # arch_static_branch\n\t" \
22+ ".pushsection __jump_table, \"aw\"\n\t" \
23+ ".long 1b - ., " label " - .\n\t" \
24+ JUMP_ENTRY_TYPE key " - .\n\t" \
25+ ".popsection \n\t"
26+
1827static __always_inline bool arch_static_branch (struct static_key * key , bool branch )
1928{
20- asm goto("1:\n\t"
21- "nop # arch_static_branch\n\t"
22- ".pushsection __jump_table, \"aw\"\n\t"
23- ".long 1b - ., %l[l_yes] - .\n\t"
24- JUMP_ENTRY_TYPE "%c0 - .\n\t"
25- ".popsection \n\t"
29+ asm goto(ARCH_STATIC_BRANCH_ASM ("%c0" , "%l[l_yes]" )
2630 : : "i" (& ((char * )key )[branch ]) : : l_yes );
2731
2832 return false;
Original file line number Diff line number Diff line change @@ -383,13 +383,15 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
383383 -fno-inline-functions-called-once -fsanitize=bounds-strict \
384384 -fstrict-flex-arrays=% -fmin-function-alignment=% \
385385 -fzero-init-padding-bits=% -mno-fdpic \
386- --param=% --param asan-% -fno-isolate-erroneous-paths-dereference
386+ --param=% --param asan-% -fno-isolate-erroneous-paths-dereference \
387+ -ffixed-r2 -mmultiple -mno-readonly-in-sdata
387388
388389# Derived from `scripts/Makefile.clang`.
389390BINDGEN_TARGET_x86 := x86_64-linux-gnu
390391BINDGEN_TARGET_arm64 := aarch64-linux-gnu
391392BINDGEN_TARGET_arm := arm-linux-gnueabi
392393BINDGEN_TARGET_loongarch := loongarch64-linux-gnusf
394+ BINDGEN_TARGET_powerpc := powerpc-linux-gnu
393395BINDGEN_TARGET_um := $(BINDGEN_TARGET_$(SUBARCH ) )
394396BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH ) )
395397
Original file line number Diff line number Diff line change @@ -188,6 +188,16 @@ fn main() {
188188 panic ! ( "arm uses the builtin rustc target" ) ;
189189 } else if cfg. has ( "ARM64" ) {
190190 panic ! ( "arm64 uses the builtin rustc aarch64-unknown-none target" ) ;
191+ } else if cfg. has ( "PPC32" ) {
192+ ts. push ( "arch" , "powerpc" ) ;
193+ ts. push ( "data-layout" , "E-m:e-p:32:32-Fn32-i64:64-n32" ) ;
194+ ts. push ( "features" , "+soft-float" ) ;
195+ ts. push ( "llvm-target" , "powerpc-unknown-eabi" ) ;
196+ if cfg. rustc_version_atleast ( 1 , 91 , 0 ) {
197+ ts. push ( "target-pointer-width" , 32 ) ;
198+ } else {
199+ ts. push ( "target-pointer-width" , "32" ) ;
200+ }
191201 } else if cfg. has ( "RISCV" ) {
192202 if cfg. has ( "64BIT" ) {
193203 panic ! ( "64-bit RISC-V uses the builtin rustc riscv64-unknown-none-elf target" ) ;
You can’t perform that action at this time.
0 commit comments