mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
selftests/powerpc: Fix compilation issue due to asm label
We are using 'dscr_insn' as a label in inline asm to identify if a
SIGILL was generated by the mtspr instruction at that point. However,
with inline assembly, the compiler is still free to duplicate the asm
statement for optimization purposes, which results in the label being
defined twice with the error:
/tmp/ccerQCql.s:874: Error: symbol `dscr_insn' is already defined
With different compiler versions, we may also see:
/tmp/ccJzLDlN.o:(.toc+0x0): undefined reference to `dscr_insn'
Remove the use of the label in the inline assembly. Instead, just look
for the offending instruction in the signal handler.
Fixes: d2bf793237
("selftests/powerpc: Add test to verify rfi flush across a system call")
Reported-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Tested-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
69f8117f17
commit
1936f094e1
@ -25,7 +25,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
static char auxv[4096];
|
static char auxv[4096];
|
||||||
extern unsigned int dscr_insn[];
|
|
||||||
|
|
||||||
int read_auxv(char *buf, ssize_t buf_size)
|
int read_auxv(char *buf, ssize_t buf_size)
|
||||||
{
|
{
|
||||||
@ -247,7 +246,8 @@ static void sigill_handler(int signr, siginfo_t *info, void *unused)
|
|||||||
ucontext_t *ctx = (ucontext_t *)unused;
|
ucontext_t *ctx = (ucontext_t *)unused;
|
||||||
unsigned long *pc = &UCONTEXT_NIA(ctx);
|
unsigned long *pc = &UCONTEXT_NIA(ctx);
|
||||||
|
|
||||||
if (*pc == (unsigned long)&dscr_insn) {
|
/* mtspr 3,RS to check for move to DSCR below */
|
||||||
|
if ((*((unsigned int *)*pc) & 0xfc1fffff) == 0x7c0303a6) {
|
||||||
if (!warned++)
|
if (!warned++)
|
||||||
printf("WARNING: Skipping over dscr setup. Consider running 'ppc64_cpu --dscr=1' manually.\n");
|
printf("WARNING: Skipping over dscr setup. Consider running 'ppc64_cpu --dscr=1' manually.\n");
|
||||||
*pc += 4;
|
*pc += 4;
|
||||||
@ -271,5 +271,5 @@ void set_dscr(unsigned long val)
|
|||||||
init = 1;
|
init = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
asm volatile("dscr_insn: mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
|
asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user