blob: 48d01a1d62da1381ad59226418b168d0e7714049 [file] [log] [blame]
Andrew Geissler4b7c1152020-11-30 19:55:29 -06001__ILP32__ is defined for all 32bit architectures with clang e.g.
2which is right but it is causing issues on non-x86 architectures
3where this condition becomes true and wrongly starts using this
4code, this issue is hidden with gcc becuase gcc does not define
5__ILP32__ for all 32bit architectures but for selected 64bit arches
6who choose to use 32bit ABI e.g. x32
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10--- a/src/debug.c
11+++ b/src/debug.c
12@@ -944,7 +944,7 @@ static void *getMcontextEip(ucontext_t *
13 /* Linux */
14 #if defined(__riscv) && __riscv_xlen == 32
15 return (void*) uc->uc_mcontext.__gregs[REG_PC];
16- #elif defined(__i386__) || defined(__ILP32__)
17+ #elif defined(__i386__) || (defined(__X86_64__) && defined(__ILP32__))
18 return (void*) uc->uc_mcontext.gregs[14]; /* Linux 32 */
19 #elif defined(__X86_64__) || defined(__x86_64__)
20 return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */
21@@ -1125,7 +1125,7 @@ void logRegisters(ucontext_t *uc) {
22 );
23 logStackContent((void**)uc->uc_mcontext.__gregs[REG_SP]);
24 /* Linux x86 */
25- #elif defined(__i386__) || defined(__ILP32__)
26+ #elif defined(__i386__) || ( defined(__X86_64__) && defined(__ILP32__))
27 serverLog(LL_WARNING,
28 "\n"
29 "EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n"