Skip to content

Commit

Permalink
Fix arm64 build after llvm 18.1.3 upgrade (take 2)
Browse files Browse the repository at this point in the history
Instead of compiling the whole sys/arm64/arm64/vfp.c file without
-mgeneral-regs-only, which might have unwanted side effects, add
".arch_extension fp" / ".arch_extension nofp" pairs to the inline
assembly.

PR:		276104
Suggested by:	andrew
MFC after:	1 month
  • Loading branch information
DimitryAndric committed Apr 7, 2024
1 parent f4d93b6 commit 61e482f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sys/arm64/arm64/vfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ vfp_store(struct vfpstate *state)

vfp_state = state->vfp_regs;
__asm __volatile(
".arch_extension fp\n"
"mrs %0, fpcr \n"
"mrs %1, fpsr \n"
"stp q0, q1, [%2, #16 * 0]\n"
Expand All @@ -128,6 +129,7 @@ vfp_store(struct vfpstate *state)
"stp q26, q27, [%2, #16 * 26]\n"
"stp q28, q29, [%2, #16 * 28]\n"
"stp q30, q31, [%2, #16 * 30]\n"
".arch_extension nofp\n"
: "=&r"(fpcr), "=&r"(fpsr) : "r"(vfp_state));

state->vfp_fpcr = fpcr;
Expand All @@ -145,6 +147,7 @@ vfp_restore(struct vfpstate *state)
fpsr = state->vfp_fpsr;

__asm __volatile(
".arch_extension fp\n"
"ldp q0, q1, [%2, #16 * 0]\n"
"ldp q2, q3, [%2, #16 * 2]\n"
"ldp q4, q5, [%2, #16 * 4]\n"
Expand All @@ -163,6 +166,7 @@ vfp_restore(struct vfpstate *state)
"ldp q30, q31, [%2, #16 * 30]\n"
"msr fpcr, %0 \n"
"msr fpsr, %1 \n"
".arch_extension nofp\n"
: : "r"(fpcr), "r"(fpsr), "r"(vfp_state));
}

Expand Down
3 changes: 1 addition & 2 deletions sys/conf/files.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ arm64/arm64/uma_machdep.c standard
arm64/arm64/undefined.c standard
arm64/arm64/unwind.c optional ddb | kdtrace_hooks | stack \
compile-with "${NORMAL_C:N-fsanitize*:N-fno-sanitize*}"
arm64/arm64/vfp.c standard \
compile-with "${NORMAL_C:N-mgeneral-regs-only}"
arm64/arm64/vfp.c standard
arm64/arm64/vm_machdep.c standard

arm64/coresight/coresight.c standard
Expand Down

0 comments on commit 61e482f

Please sign in to comment.