Skip to content

[compiler-rt][Mips] Fix mips SP register definition #124493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,28 @@
# include <asm/ptrace.h>
#endif
#include <sys/user.h> // for user_regs_struct
#if SANITIZER_ANDROID && SANITIZER_MIPS
# include <asm/reg.h> // for mips SP register in sys/user.h
#endif
#include <sys/wait.h> // for signal-related stuff

#ifdef sa_handler
# undef sa_handler
#endif

#ifdef sa_sigaction
# undef sa_sigaction
#endif

#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_libc.h"
#include "sanitizer_linux.h"
#include "sanitizer_mutex.h"
#include "sanitizer_placement_new.h"
# if SANITIZER_MIPS
// clang-format off
# include <asm/sgidefs.h> // <asm/sgidefs.h> must be included before <asm/reg.h>
# include <asm/reg.h> // for mips SP register
// clang-format on
# endif
# include <sys/wait.h> // for signal-related stuff

# ifdef sa_handler
# undef sa_handler
# endif

# ifdef sa_sigaction
# undef sa_sigaction
# endif

# include "sanitizer_common.h"
# include "sanitizer_flags.h"
# include "sanitizer_libc.h"
# include "sanitizer_linux.h"
# include "sanitizer_mutex.h"
# include "sanitizer_placement_new.h"

// Sufficiently old kernel headers don't provide this value, but we can still
// call prctl with it. If the runtime kernel is new enough, the prctl call will
Expand Down Expand Up @@ -510,11 +513,7 @@ typedef pt_regs regs_struct;

#elif defined(__mips__)
typedef struct user regs_struct;
# if SANITIZER_ANDROID
# define REG_SP regs[EF_R29]
# else
# define REG_SP regs[EF_REG29]
# endif
# define REG_SP regs[EF_R29]

#elif defined(__aarch64__)
typedef struct user_pt_regs regs_struct;
Expand Down