Skip to content

Commit 600589d

Browse files
committed
[compiler-rt][Mips] Fix mips SP register definition
The mainline Linux kernel defines EF_R29, not EF_REG29 [1]. Further, the asm/reg.h header requires _MIPS_SIM_* to be defined, which reside in asm/sgidefs.h [2]. [1]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/reg.h#L151 [2]: https://github.com/torvalds/linux/blob/v6.13/arch/mips/include/uapi/asm/sgidefs.h#L33-L35 Signed-off-by: Jens Reidel <[email protected]>
1 parent 4df287a commit 600589d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@
3737
# include <asm/ptrace.h>
3838
#endif
3939
#include <sys/user.h> // for user_regs_struct
40-
#if SANITIZER_ANDROID && SANITIZER_MIPS
41-
# include <asm/reg.h> // for mips SP register in sys/user.h
40+
#if SANITIZER_MIPS
41+
// clang-format off
42+
# include <asm/sgidefs.h> // <asm/sgidefs.h> must be included before <asm/reg.h>
43+
# include <asm/reg.h> // for mips SP register
44+
// clang-format on
4245
#endif
4346
#include <sys/wait.h> // for signal-related stuff
4447

@@ -510,11 +513,7 @@ typedef pt_regs regs_struct;
510513

511514
#elif defined(__mips__)
512515
typedef struct user regs_struct;
513-
# if SANITIZER_ANDROID
514516
# define REG_SP regs[EF_R29]
515-
# else
516-
# define REG_SP regs[EF_REG29]
517-
# endif
518517

519518
#elif defined(__aarch64__)
520519
typedef struct user_pt_regs regs_struct;

0 commit comments

Comments
 (0)