Skip to content

Commit 8682d8b

Browse files
author
Fox Snowpatch
committed
1 parent a2f7734 commit 8682d8b

4 files changed

Lines changed: 33 additions & 12 deletions

File tree

arch/powerpc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ config PPC
284284
select HAVE_REGS_AND_STACK_ACCESS_API
285285
select HAVE_RELIABLE_STACKTRACE
286286
select HAVE_RSEQ
287+
select HAVE_RUST if PPC32
288+
select HAVE_RUST if PPC64 && CPU_LITTLE_ENDIAN
287289
select HAVE_SAMPLE_FTRACE_DIRECT if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
288290
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
289291
select HAVE_SETUP_PER_CPU_AREA if PPC64

arch/powerpc/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ else
6161
KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
6262
endif
6363

64+
ifdef CONFIG_PPC64
65+
KBUILD_RUSTFLAGS += --target=powerpc64le-unknown-linux-gnu
66+
KBUILD_RUSTFLAGS += -Ctarget-feature=-mma,-vsx,-hard-float,-altivec
67+
else
68+
KBUILD_RUSTFLAGS += --target=powerpc-unknown-linux-gnu
69+
endif
70+
6471
ifdef CONFIG_CPU_LITTLE_ENDIAN
6572
KBUILD_CPPFLAGS += -mlittle-endian
6673
KBUILD_LDFLAGS += -EL

arch/powerpc/include/asm/jump_label.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
#define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG)
1616
#define JUMP_LABEL_NOP_SIZE 4
1717

18+
#define JUMP_TABLE_ENTRY(key, label) \
19+
".pushsection __jump_table, \"aw\" \n\t" \
20+
".long 1b - ., " label " - . \n\t" \
21+
JUMP_ENTRY_TYPE key " - . \n\t" \
22+
".popsection \n\t"
23+
24+
#define ARCH_STATIC_BRANCH_ASM(key, label) \
25+
"1: nop \n\t" \
26+
JUMP_TABLE_ENTRY(key,label)
27+
1828
static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
1929
{
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"
30+
asm goto(
31+
ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]")
2632
: : "i" (&((char *)key)[branch]) : : l_yes);
2733

2834
return false;
@@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
3440
{
3541
asm goto("1:\n\t"
3642
"b %l[l_yes] # arch_static_branch_jump\n\t"
37-
".pushsection __jump_table, \"aw\"\n\t"
38-
".long 1b - ., %l[l_yes] - .\n\t"
39-
JUMP_ENTRY_TYPE "%c0 - .\n\t"
40-
".popsection \n\t"
43+
JUMP_TABLE_ENTRY("%c0", "%l[l_yes]")
4144
: : "i" (&((char *)key)[branch]) : : l_yes);
4245

4346
return false;

rust/Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,21 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
402402
-fstrict-flex-arrays=% -fmin-function-alignment=% \
403403
-fzero-init-padding-bits=% -mno-fdpic \
404404
-fdiagnostics-show-context -fdiagnostics-show-context=% \
405-
--param=% --param asan-% -fno-isolate-erroneous-paths-dereference
405+
--param=% --param asan-% -fno-isolate-erroneous-paths-dereference \
406+
-ffixed-r2 -mmultiple -mno-readonly-in-sdata
406407

407408
# Derived from `scripts/Makefile.clang`.
408409
BINDGEN_TARGET_x86 := x86_64-linux-gnu
409410
BINDGEN_TARGET_arm64 := aarch64-linux-gnu
410411
BINDGEN_TARGET_arm := arm-linux-gnueabi
411412
BINDGEN_TARGET_loongarch := loongarch64-linux-gnusf
413+
414+
ifdef CONFIG_PPC64
415+
BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu
416+
else
417+
BINDGEN_TARGET_powerpc := powerpc-linux-gnu
418+
endif
419+
412420
BINDGEN_TARGET_um := $(BINDGEN_TARGET_$(SUBARCH))
413421
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
414422

@@ -650,7 +658,8 @@ $(obj)/core.o: private skip_flags = $(core-skip_flags)
650658
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
651659
$(obj)/core.o: private rustc_target_flags = $(core-flags)
652660
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
653-
$(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE
661+
$(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE \
662+
| $(obj)/libproc_macro2.rlib $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
654663
+$(call if_changed_rule,rustc_library)
655664
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
656665
$(obj)/core.o: scripts/target.json

0 commit comments

Comments
 (0)