public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [AArch64] Fix testcase compilation failure
@ 2022-07-05 13:37 Luis Machado
  2022-07-05 14:49 ` Luis Machado
  2022-07-11 11:58 ` [PATCH,v2] " Luis Machado
  0 siblings, 2 replies; 4+ messages in thread
From: Luis Machado @ 2022-07-05 13:37 UTC (permalink / raw)
  To: gdb-patches

Newer distros carry newer headers that contain MTE definitions.  Account
for that fact in the MTE testcases and define constants conditionally to
prevent compilation failures.
---
 gdb/testsuite/gdb.arch/aarch64-mte-gcore.c |  9 ++++++++-
 gdb/testsuite/gdb.arch/aarch64-mte.c       | 11 ++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c b/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
index 6840acac33a..d19b5217e16 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
@@ -39,14 +39,21 @@
 #define PROT_MTE  0x20
 #endif
 
-/* From include/uapi/linux/prctl.h */
 #ifndef PR_SET_TAGGED_ADDR_CTRL
 #define PR_SET_TAGGED_ADDR_CTRL 55
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
+#endif
+
+/* From include/uapi/linux/prctl.h */
+#ifndef PR_MTE_TCF_SHIFT
 #define PR_MTE_TCF_SHIFT	1
+#define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_TCF_ASYNC	(2UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TAG_SHIFT	3
+#define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
 #endif
 
 void
diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.c b/gdb/testsuite/gdb.arch/aarch64-mte.c
index bd7f1a6cf53..14057253035 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mte.c
@@ -30,15 +30,23 @@
 #include <sys/prctl.h>
 
 /* From arch/arm64/include/uapi/asm/hwcap.h */
+#ifndef HWCAP2_MTE
 #define HWCAP2_MTE              (1 << 18)
+#endif
 
 /* From arch/arm64/include/uapi/asm/mman.h */
+#ifndef PROT_MTE
 #define PROT_MTE  0x20
+#endif
 
-/* From include/uapi/linux/prctl.h */
+#ifndef PR_SET_TAGGED_ADDR_CTRL
 #define PR_SET_TAGGED_ADDR_CTRL 55
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
+#endif
+
+/* From include/uapi/linux/prctl.h */
+#ifndef PR_MTE_TCF_SHIFT
 #define PR_MTE_TCF_SHIFT	1
 #define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
@@ -46,6 +54,7 @@
 #define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TAG_SHIFT	3
 #define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
+#endif
 
 void
 access_memory (unsigned char *tagged_ptr, unsigned char *untagged_ptr)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [AArch64] Fix testcase compilation failure
  2022-07-05 13:37 [PATCH] [AArch64] Fix testcase compilation failure Luis Machado
@ 2022-07-05 14:49 ` Luis Machado
  2022-07-11 11:58 ` [PATCH,v2] " Luis Machado
  1 sibling, 0 replies; 4+ messages in thread
From: Luis Machado @ 2022-07-05 14:49 UTC (permalink / raw)
  To: gdb-patches

Oops... This actually fixes a testcase that I'm re-working for the MTE corefile submission (aarch64-mte-gcore.c),
which is local to my tree.

I'll incorporate that hunk to the upcoming v5 iteration of the MTE corefile patch.

The remaining hunk (fixing aarch64-mte.c) is what should be pushed.

On 7/5/22 14:37, Luis Machado via Gdb-patches wrote:
> Newer distros carry newer headers that contain MTE definitions.  Account
> for that fact in the MTE testcases and define constants conditionally to
> prevent compilation failures.
> ---
>   gdb/testsuite/gdb.arch/aarch64-mte-gcore.c |  9 ++++++++-
>   gdb/testsuite/gdb.arch/aarch64-mte.c       | 11 ++++++++++-
>   2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c b/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
> index 6840acac33a..d19b5217e16 100644
> --- a/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
> +++ b/gdb/testsuite/gdb.arch/aarch64-mte-gcore.c
> @@ -39,14 +39,21 @@
>   #define PROT_MTE  0x20
>   #endif
>   
> -/* From include/uapi/linux/prctl.h */
>   #ifndef PR_SET_TAGGED_ADDR_CTRL
>   #define PR_SET_TAGGED_ADDR_CTRL 55
>   #define PR_GET_TAGGED_ADDR_CTRL 56
>   #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
> +#endif
> +
> +/* From include/uapi/linux/prctl.h */
> +#ifndef PR_MTE_TCF_SHIFT
>   #define PR_MTE_TCF_SHIFT	1
> +#define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
> +#define PR_MTE_TCF_ASYNC	(2UL << PR_MTE_TCF_SHIFT)
> +#define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TAG_SHIFT	3
> +#define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
>   #endif
>   
>   void
> diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.c b/gdb/testsuite/gdb.arch/aarch64-mte.c
> index bd7f1a6cf53..14057253035 100644
> --- a/gdb/testsuite/gdb.arch/aarch64-mte.c
> +++ b/gdb/testsuite/gdb.arch/aarch64-mte.c
> @@ -30,15 +30,23 @@
>   #include <sys/prctl.h>
>   
>   /* From arch/arm64/include/uapi/asm/hwcap.h */
> +#ifndef HWCAP2_MTE
>   #define HWCAP2_MTE              (1 << 18)
> +#endif
>   
>   /* From arch/arm64/include/uapi/asm/mman.h */
> +#ifndef PROT_MTE
>   #define PROT_MTE  0x20
> +#endif
>   
> -/* From include/uapi/linux/prctl.h */
> +#ifndef PR_SET_TAGGED_ADDR_CTRL
>   #define PR_SET_TAGGED_ADDR_CTRL 55
>   #define PR_GET_TAGGED_ADDR_CTRL 56
>   #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
> +#endif
> +
> +/* From include/uapi/linux/prctl.h */
> +#ifndef PR_MTE_TCF_SHIFT
>   #define PR_MTE_TCF_SHIFT	1
>   #define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
> @@ -46,6 +54,7 @@
>   #define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TAG_SHIFT	3
>   #define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
> +#endif
>   
>   void
>   access_memory (unsigned char *tagged_ptr, unsigned char *untagged_ptr)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH,v2] [AArch64] Fix testcase compilation failure
  2022-07-05 13:37 [PATCH] [AArch64] Fix testcase compilation failure Luis Machado
  2022-07-05 14:49 ` Luis Machado
@ 2022-07-11 11:58 ` Luis Machado
  2022-07-19 13:37   ` Luis Machado
  1 sibling, 1 reply; 4+ messages in thread
From: Luis Machado @ 2022-07-11 11:58 UTC (permalink / raw)
  To: gdb-patches

v2:

- Removed unused constants

--

Newer distros carry newer headers that contains MTE definitions.  Account
for that fact in the MTE testcases and define constants conditionally to
prevent compilation failures.
---
 gdb/testsuite/gdb.arch/aarch64-mte.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.c b/gdb/testsuite/gdb.arch/aarch64-mte.c
index bd7f1a6cf53..fc38d58fe5e 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mte.c
@@ -30,22 +30,27 @@
 #include <sys/prctl.h>
 
 /* From arch/arm64/include/uapi/asm/hwcap.h */
+#ifndef HWCAP2_MTE
 #define HWCAP2_MTE              (1 << 18)
+#endif
 
 /* From arch/arm64/include/uapi/asm/mman.h */
+#ifndef PROT_MTE
 #define PROT_MTE  0x20
+#endif
 
-/* From include/uapi/linux/prctl.h */
+#ifndef PR_SET_TAGGED_ADDR_CTRL
 #define PR_SET_TAGGED_ADDR_CTRL 55
-#define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
+#endif
+
+/* From include/uapi/linux/prctl.h */
+#ifndef PR_MTE_TCF_SHIFT
 #define PR_MTE_TCF_SHIFT	1
-#define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_ASYNC	(2UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TAG_SHIFT	3
-#define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
+#endif
 
 void
 access_memory (unsigned char *tagged_ptr, unsigned char *untagged_ptr)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH,v2] [AArch64] Fix testcase compilation failure
  2022-07-11 11:58 ` [PATCH,v2] " Luis Machado
@ 2022-07-19 13:37   ` Luis Machado
  0 siblings, 0 replies; 4+ messages in thread
From: Luis Machado @ 2022-07-19 13:37 UTC (permalink / raw)
  To: gdb-patches

On 7/11/22 12:58, Luis Machado via Gdb-patches wrote:
> v2:
> 
> - Removed unused constants
> 
> --
> 
> Newer distros carry newer headers that contains MTE definitions.  Account
> for that fact in the MTE testcases and define constants conditionally to
> prevent compilation failures.
> ---
>   gdb/testsuite/gdb.arch/aarch64-mte.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.c b/gdb/testsuite/gdb.arch/aarch64-mte.c
> index bd7f1a6cf53..fc38d58fe5e 100644
> --- a/gdb/testsuite/gdb.arch/aarch64-mte.c
> +++ b/gdb/testsuite/gdb.arch/aarch64-mte.c
> @@ -30,22 +30,27 @@
>   #include <sys/prctl.h>
>   
>   /* From arch/arm64/include/uapi/asm/hwcap.h */
> +#ifndef HWCAP2_MTE
>   #define HWCAP2_MTE              (1 << 18)
> +#endif
>   
>   /* From arch/arm64/include/uapi/asm/mman.h */
> +#ifndef PROT_MTE
>   #define PROT_MTE  0x20
> +#endif
>   
> -/* From include/uapi/linux/prctl.h */
> +#ifndef PR_SET_TAGGED_ADDR_CTRL
>   #define PR_SET_TAGGED_ADDR_CTRL 55
> -#define PR_GET_TAGGED_ADDR_CTRL 56
>   #define PR_TAGGED_ADDR_ENABLE	(1UL << 0)
> +#endif
> +
> +/* From include/uapi/linux/prctl.h */
> +#ifndef PR_MTE_TCF_SHIFT
>   #define PR_MTE_TCF_SHIFT	1
> -#define PR_MTE_TCF_NONE		(0UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TCF_SYNC		(1UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TCF_ASYNC	(2UL << PR_MTE_TCF_SHIFT)
> -#define PR_MTE_TCF_MASK		(3UL << PR_MTE_TCF_SHIFT)
>   #define PR_MTE_TAG_SHIFT	3
> -#define PR_MTE_TAG_MASK		(0xffffUL << PR_MTE_TAG_SHIFT)
> +#endif
>   
>   void
>   access_memory (unsigned char *tagged_ptr, unsigned char *untagged_ptr)

Pushed now.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-19 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 13:37 [PATCH] [AArch64] Fix testcase compilation failure Luis Machado
2022-07-05 14:49 ` Luis Machado
2022-07-11 11:58 ` [PATCH,v2] " Luis Machado
2022-07-19 13:37   ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).