m4: Fix build on musl/ppc

Message ID 20220310043116.476846-1-raj.khem@gmail.com
State Accepted, archived
Commit 41ccf5b38506608032754beaff393f74e0403fd1
Headers show
Series m4: Fix build on musl/ppc | expand

Commit Message

Khem Raj March 10, 2022, 4:31 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/m4/m4-1.4.19.inc        |  1 +
 .../0001-sigsegv-Fix-build-on-ppc-musl.patch  | 37 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch

Comments

Alexander Kanavin March 10, 2022, 6:26 a.m. UTC | #1
Submit upstream first please :)


Ale

On Thu 10. Mar 2022 at 5.31, Khem Raj <raj.khem@gmail.com> wrote:

> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/m4/m4-1.4.19.inc        |  1 +
>  .../0001-sigsegv-Fix-build-on-ppc-musl.patch  | 37 +++++++++++++++++++
>  2 files changed, 38 insertions(+)
>  create mode 100644
> meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
>
> diff --git a/meta/recipes-devtools/m4/m4-1.4.19.inc
> b/meta/recipes-devtools/m4/m4-1.4.19.inc
> index 2785a3d22cd..2adf4de6f2f 100644
> --- a/meta/recipes-devtools/m4/m4-1.4.19.inc
> +++ b/meta/recipes-devtools/m4/m4-1.4.19.inc
> @@ -8,6 +8,7 @@ inherit autotools texinfo ptest gettext
>
>  SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \
>             file://ac_config_links.patch \
> +           file://0001-sigsegv-Fix-build-on-ppc-musl.patch \
>             "
>  SRC_URI:append:class-target = " file://run-ptest \
>                                  file://serial-tests-config.patch \
> diff --git
> a/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
> b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
> new file mode 100644
> index 00000000000..8f2ad81c0c5
> --- /dev/null
> +++ b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
> @@ -0,0 +1,37 @@
> +From 36d5e26f606e070553eb0fff1f738e61970be5d7 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Wed, 9 Mar 2022 20:22:20 -0800
> +Subject: [PATCH] sigsegv: Fix build on ppc/musl
> +
> +mcontext is not a standard layout so glibc and musl differ sadly.
> +
> +Fixes
> +../../m4-1.4.19/lib/sigsegv.c: In function 'sigsegv_handler':
>
>
>  ../../m4-1.4.19/lib/sigsegv.c:223:75: error: 'mcontext_t' has no member
> named 'uc_regs'; did you mean 'gregs'?
>                                           223 | #    define
> SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_mcontext.uc_regs->gregs[1]
>                                                        |
>                                                        ^~~~~~~
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + lib/sigsegv.c | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/lib/sigsegv.c b/lib/sigsegv.c
> +index 696a152..fa0c465 100644
> +--- a/lib/sigsegv.c
> ++++ b/lib/sigsegv.c
> +@@ -217,10 +217,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
> + #   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_mcontext.gp_regs[1]
> + #  else /* 32-bit */
> + /* both should be equivalent */
> +-#   if 0
> +-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_mcontext.regs->gpr[1]
> ++#   if ! defined __GLIBC__
> ++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_regs->gregs[1]
> + #   else
> +-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_mcontext.uc_regs->gregs[1]
> ++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *)
> ucp)->uc_mcontext.uc_regs->gregs[1]
> + #   endif
> + #  endif
> +
> +--
> +2.35.1
> +
> --
> 2.35.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163000):
> https://lists.openembedded.org/g/openembedded-core/message/163000
> Mute This Topic: https://lists.openembedded.org/mt/89680211/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Khem Raj March 10, 2022, 7:35 a.m. UTC | #2
On Wed, Mar 9, 2022 at 10:27 PM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> Submit upstream first please :)
>

its already sent but it has not appeared on ml yet since I am not
subscribed to m4 ml I guess.

>
> Ale
>
> On Thu 10. Mar 2022 at 5.31, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  meta/recipes-devtools/m4/m4-1.4.19.inc        |  1 +
>>  .../0001-sigsegv-Fix-build-on-ppc-musl.patch  | 37 +++++++++++++++++++
>>  2 files changed, 38 insertions(+)
>>  create mode 100644 meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
>>
>> diff --git a/meta/recipes-devtools/m4/m4-1.4.19.inc b/meta/recipes-devtools/m4/m4-1.4.19.inc
>> index 2785a3d22cd..2adf4de6f2f 100644
>> --- a/meta/recipes-devtools/m4/m4-1.4.19.inc
>> +++ b/meta/recipes-devtools/m4/m4-1.4.19.inc
>> @@ -8,6 +8,7 @@ inherit autotools texinfo ptest gettext
>>
>>  SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \
>>             file://ac_config_links.patch \
>> +           file://0001-sigsegv-Fix-build-on-ppc-musl.patch \
>>             "
>>  SRC_URI:append:class-target = " file://run-ptest \
>>                                  file://serial-tests-config.patch \
>> diff --git a/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
>> new file mode 100644
>> index 00000000000..8f2ad81c0c5
>> --- /dev/null
>> +++ b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
>> @@ -0,0 +1,37 @@
>> +From 36d5e26f606e070553eb0fff1f738e61970be5d7 Mon Sep 17 00:00:00 2001
>> +From: Khem Raj <raj.khem@gmail.com>
>> +Date: Wed, 9 Mar 2022 20:22:20 -0800
>> +Subject: [PATCH] sigsegv: Fix build on ppc/musl
>> +
>> +mcontext is not a standard layout so glibc and musl differ sadly.
>> +
>> +Fixes
>> +../../m4-1.4.19/lib/sigsegv.c: In function 'sigsegv_handler':                                                                                                                               ../../m4-1.4.19/lib/sigsegv.c:223:75: error: 'mcontext_t' has no member named 'uc_regs'; did you mean 'gregs'?                                                                                223 | #    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]                                                                                               |                                                                           ^~~~~~~
>> +
>> +Upstream-Status: Pending
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +---
>> + lib/sigsegv.c | 6 +++---
>> + 1 file changed, 3 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/lib/sigsegv.c b/lib/sigsegv.c
>> +index 696a152..fa0c465 100644
>> +--- a/lib/sigsegv.c
>> ++++ b/lib/sigsegv.c
>> +@@ -217,10 +217,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
>> + #   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1]
>> + #  else /* 32-bit */
>> + /* both should be equivalent */
>> +-#   if 0
>> +-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
>> ++#   if ! defined __GLIBC__
>> ++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_regs->gregs[1]
>> + #   else
>> +-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
>> ++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
>> + #   endif
>> + #  endif
>> +
>> +--
>> +2.35.1
>> +
>> --
>> 2.35.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#163000): https://lists.openembedded.org/g/openembedded-core/message/163000
>> Mute This Topic: https://lists.openembedded.org/mt/89680211/1686489
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>

Patch

diff --git a/meta/recipes-devtools/m4/m4-1.4.19.inc b/meta/recipes-devtools/m4/m4-1.4.19.inc
index 2785a3d22cd..2adf4de6f2f 100644
--- a/meta/recipes-devtools/m4/m4-1.4.19.inc
+++ b/meta/recipes-devtools/m4/m4-1.4.19.inc
@@ -8,6 +8,7 @@  inherit autotools texinfo ptest gettext
 
 SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \
            file://ac_config_links.patch \
+           file://0001-sigsegv-Fix-build-on-ppc-musl.patch \
            "
 SRC_URI:append:class-target = " file://run-ptest \
                                 file://serial-tests-config.patch \
diff --git a/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
new file mode 100644
index 00000000000..8f2ad81c0c5
--- /dev/null
+++ b/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch
@@ -0,0 +1,37 @@ 
+From 36d5e26f606e070553eb0fff1f738e61970be5d7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 9 Mar 2022 20:22:20 -0800
+Subject: [PATCH] sigsegv: Fix build on ppc/musl
+
+mcontext is not a standard layout so glibc and musl differ sadly.
+
+Fixes
+../../m4-1.4.19/lib/sigsegv.c: In function 'sigsegv_handler':                                                                                                                               ../../m4-1.4.19/lib/sigsegv.c:223:75: error: 'mcontext_t' has no member named 'uc_regs'; did you mean 'gregs'?                                                                                223 | #    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]                                                                                               |                                                                           ^~~~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/sigsegv.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/sigsegv.c b/lib/sigsegv.c
+index 696a152..fa0c465 100644
+--- a/lib/sigsegv.c
++++ b/lib/sigsegv.c
+@@ -217,10 +217,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
+ #   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1]
+ #  else /* 32-bit */
+ /* both should be equivalent */
+-#   if 0
+-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
++#   if ! defined __GLIBC__
++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_regs->gregs[1]
+ #   else
+-#    define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
++#      define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
+ #   endif
+ #  endif
+ 
+-- 
+2.35.1
+