public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h>.
@ 2021-02-02  3:04 Érico Nogueira
  2021-02-02  3:22 ` Dmitry V. Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Érico Nogueira @ 2021-02-02  3:04 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Érico Rolim

From: Érico Rolim <erico.erc@gmail.com>

Necessary on musl for struct pt_regs definition, doesn't affect the
build on glibc.

Signed-off-by: Érico Rolim <erico.erc@gmail.com>
---

Sending a v2 with the main difference being a slightly different commit
message and signed-off-by line.

I'm a bit hesitant on this being the correct patch, so I'd ask that you
only merge if you think it makes total sense, otherwise I'd like to sit
on it for a bit. For the record, it has been in use in Void Linux since
the end of 2019.

 backends/ChangeLog     | 4 ++++
 backends/ppc_initreg.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index f22cd57f..eb15c81d 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-01  Érico Nogueira  <ericonr@disroot.org>
+
+	* ppc_initreg.c: Also include <asm/ptrace.h>.
+
 2020-12-12  Dmitry V. Levin  <ldv@altlinux.org>
 
 	* aarch64_retval.c (aarch64_return_value_location): Fix spelling typo
diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c
index 0e0d3599..72cdb860 100644
--- a/backends/ppc_initreg.c
+++ b/backends/ppc_initreg.c
@@ -32,6 +32,7 @@
 
 #include <stdlib.h>
 #if defined(__powerpc__) && defined(__linux__)
+# include <asm/ptrace.h>
 # include <sys/ptrace.h>
 # include <sys/user.h>
 #endif
-- 
2.30.0


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

* Re: [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h>.
  2021-02-02  3:04 [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h> Érico Nogueira
@ 2021-02-02  3:22 ` Dmitry V. Levin
  2021-02-05 15:06   ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2021-02-02  3:22 UTC (permalink / raw)
  To: Érico Nogueira; +Cc: elfutils-devel, Érico Rolim

On Tue, Feb 02, 2021 at 12:04:03AM -0300, Érico Nogueira via Elfutils-devel wrote:
> From: Érico Rolim <erico.erc@gmail.com>
> 
> Necessary on musl for struct pt_regs definition, doesn't affect the
> build on glibc.
> 
> Signed-off-by: Érico Rolim <erico.erc@gmail.com>
> ---
> 
> Sending a v2 with the main difference being a slightly different commit
> message and signed-off-by line.
> 
> I'm a bit hesitant on this being the correct patch, so I'd ask that you
> only merge if you think it makes total sense, otherwise I'd like to sit
> on it for a bit. For the record, it has been in use in Void Linux since
> the end of 2019.

I'm afraid this won't work as is.

The reason why glibc doesn't require this change is that its
sysdeps/unix/sysv/linux/powerpc/sys/user.h contains #include <asm/ptrace.h>
since the very beginning of this file back in 1998.

As you probably know, <asm/ptrace.h> and <sys/ptrace.h> are not as
compatible as we would like them to be, this is the reason why e.g.
elfutils commit 4482d0009a99b1773f2426479b666b08f57af9d5 moved
#include <sys/ptrace.h> before #include <sys/user.h>.

Said that, I think it's safe to include <asm/ptrace.h> right before
<sys/user.h> on powerpc since in glibc the latter includes the former.

>  backends/ChangeLog     | 4 ++++
>  backends/ppc_initreg.c | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/backends/ChangeLog b/backends/ChangeLog
> index f22cd57f..eb15c81d 100644
> --- a/backends/ChangeLog
> +++ b/backends/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-02-01  Érico Nogueira  <ericonr@disroot.org>
> +
> +	* ppc_initreg.c: Also include <asm/ptrace.h>.
> +
>  2020-12-12  Dmitry V. Levin  <ldv@altlinux.org>
>  
>  	* aarch64_retval.c (aarch64_return_value_location): Fix spelling typo
> diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c
> index 0e0d3599..72cdb860 100644
> --- a/backends/ppc_initreg.c
> +++ b/backends/ppc_initreg.c
> @@ -32,6 +32,7 @@
>  
>  #include <stdlib.h>
>  #if defined(__powerpc__) && defined(__linux__)
> +# include <asm/ptrace.h>
>  # include <sys/ptrace.h>
>  # include <sys/user.h>
>  #endif
> -- 
> 2.30.0

-- 
ldv

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

* Re: [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h>.
  2021-02-02  3:22 ` Dmitry V. Levin
@ 2021-02-05 15:06   ` Mark Wielaard
  2021-02-05 17:47     ` Érico Nogueira
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2021-02-05 15:06 UTC (permalink / raw)
  To: Dmitry V. Levin, Érico Nogueira; +Cc: Érico Rolim, elfutils-devel

Hi,

On Tue, 2021-02-02 at 06:22 +0300, Dmitry V. Levin wrote:
> Said that, I think it's safe to include <asm/ptrace.h> right before
> <sys/user.h> on powerpc since in glibc the latter includes the former.

So that would move the <asm/ptrace> include after the <sys/ptrace>
include. Érico, would that work in your case?

Thanks,

Mark

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

* Re: [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h>.
  2021-02-05 15:06   ` Mark Wielaard
@ 2021-02-05 17:47     ` Érico Nogueira
  0 siblings, 0 replies; 4+ messages in thread
From: Érico Nogueira @ 2021-02-05 17:47 UTC (permalink / raw)
  To: Mark Wielaard, Dmitry V. Levin; +Cc: elfutils-devel



Em 05/02/2021 12:06, Mark Wielaard escreveu:
> Hi,
> 
> On Tue, 2021-02-02 at 06:22 +0300, Dmitry V. Levin wrote:
>> Said that, I think it's safe to include <asm/ptrace.h> right before
>> <sys/user.h> on powerpc since in glibc the latter includes the former.
> 
> So that would move the <asm/ptrace> include after the <sys/ptrace>
> include. Érico, would that work in your case?

It seems to build correctly, and struct pt_regs will have been defined 
before any of its fields are used. I can send a v3 with this change, then.

Thank you both :)

> 
> Thanks,
> 
> Mark
> 

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

end of thread, other threads:[~2021-02-05 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  3:04 [PATCH v2] backends/ppc_initreg.c: include <asm/ptrace.h> Érico Nogueira
2021-02-02  3:22 ` Dmitry V. Levin
2021-02-05 15:06   ` Mark Wielaard
2021-02-05 17:47     ` Érico Nogueira

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).