Use ptrdiff_t for rseq_offset
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 2 Feb 2022 16:11:58 +0000 (11:11 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 3 Feb 2022 01:21:19 +0000 (20:21 -0500)
glibc changes the type of __rseq_offset from int to ptrdiff_t before
the official 2.35 release. Adapt to this change.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaaef60957cf33f5536817fa92136239fe9e9ab74

include/rseq/rseq-x86.h
include/rseq/rseq.h
src/rseq.c

index cb4aa0525045a460b6a700128830c650cd5e183c..c6963b92a5aae80b36a58fea0f14583f661aafa9 100644 (file)
@@ -137,7 +137,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  [v]                   "m" (*v),
                  [expect]              "r" (expect),
                  [newv]                "r" (newv)
@@ -208,7 +208,7 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expectnot]           "r" (expectnot),
@@ -264,7 +264,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* final store input */
                  [v]                   "m" (*v),
                  [count]               "er" (count)
@@ -323,7 +323,7 @@ int rseq_offset_deref_addv(intptr_t *ptr, long off, intptr_t inc, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* final store input */
                  [ptr]                 "m" (*ptr),
                  [off]                 "er" (off),
@@ -384,7 +384,7 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* try store input */
                  [v2]                  "m" (*v2),
                  [newv2]               "r" (newv2),
@@ -466,7 +466,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* cmp2 input */
                  [v2]                  "m" (*v2),
                  [expect2]             "r" (expect2),
@@ -578,7 +578,7 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 #endif
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expect]              "r" (expect),
@@ -657,7 +657,7 @@ int rseq_deref_loadoffp(intptr_t *p, long voffp, intptr_t *load, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [rseq_offset]         "r" ((long)rseq_offset),
+                 [rseq_offset]         "r" (rseq_offset),
                  /* final store input */
                  [p]                   "m" (*p),
                  [voffp]               "er" (voffp),
index 4495a7b71015422ab5b0e951b2fd54e3b2bf548c..d791e1c39f10946423c92de4d89d42bace85bb81 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sched.h>
+#include <stddef.h>
 #include <rseq/rseq-abi.h>
 #include <rseq/compiler.h>
 
@@ -60,7 +61,7 @@ extern "C" {
 # endif
 
 /* Offset from the thread pointer to the rseq area.  */
-extern int rseq_offset;
+extern ptrdiff_t rseq_offset;
 /* Size of the registered rseq area.  0 if the registration was
    unsuccessful.  */
 extern unsigned int rseq_size;
index fe14e8473546d78e7f83b056cd26961a1308cd27..adfb62b2ebda53b35cb742a9ee8a898be1241d84 100644 (file)
 #include <signal.h>
 #include <limits.h>
 #include <dlfcn.h>
+#include <stddef.h>
 
 #include <rseq/rseq.h>
 
-static const int *libc_rseq_offset_p;
+static const ptrdiff_t *libc_rseq_offset_p;
 static const unsigned int *libc_rseq_size_p;
 static const unsigned int *libc_rseq_flags_p;
 
 /* Offset from the thread pointer to the rseq area.  */
-int rseq_offset;
+ptrdiff_t rseq_offset;
 
 /* Size of the registered rseq area.  0 if the registration was
    unsuccessful.  */
This page took 0.044669 seconds and 4 git commands to generate.