Skip to contentSkip to conversation

ltrace: Fix build on mips

PATCH In review Khem Raj 3 participants 6 messages Sep 6, 2019 – Sep 8, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 ltrace: Fix build on mips

Newer kernel UAPI headers for mips have moved these needed defines around

---
 .../ltrace/ltrace/include_unistd_nr.patch     | 30 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch
meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch new file +30 -0
new file mode 100644
index 0000000000..e4490bbb9e
@@ -0,0 +1,30 @@
+kernel headers have restructured mips syscall generation in kernel
+in recent versions, however, ltrace still has logic to define the
+syscall numbers based on old logic, this patch includes the legacy
+UAPI headers to get these defines
+
+Fixes errors e.g.
+../../../../git/sysdeps/linux-gnu/mips/trace.c:138:29: error: '__NR_O32_Linux' undeclared (first use in this function)
+  const int syscallbase[] = {__NR_O32_Linux, __NR_N32_Linux,
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+--- a/sysdeps/linux-gnu/mips/trace.c
++++ b/sysdeps/linux-gnu/mips/trace.c
+@@ -34,6 +34,16 @@
+ #include <assert.h>
+ #include <asm/unistd.h>
+ 
++#ifndef __NR_O32_Linux
++#include <asm/unistd_nr_o32.h>
++#endif
++#ifndef __NR_N32_Linux
++#include <asm/unistd_nr_n64.h>
++#endif
++#ifndef __NR_N64_Linux
++#include <asm/unistd_nr_n32.h>
++#endif
++
+ #include "backend.h"
+ #include "common.h"
+ #include "debug.h"
meta-oe/recipes-devtools/ltrace/ltrace_git.bb +1 -0
index 3dc269c80e..ead637cb7e 100644
@@ -27,6 +27,7 @@ SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http
            file://0001-mips-plt.c-Delete-include-error.h.patch \
            file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
            file://0001-hook-Do-not-append-int-to-std-string.patch \
+           file://include_unistd_nr.patch \
            "
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.23.0
#1 lore raw
Quoted 4 lines · Khem Raj

Newer kernel UAPI headers for mips have moved these needed defines around

warrior too?

Quoted 54 lines
---
 .../ltrace/ltrace/include_unistd_nr.patch     | 30 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch
meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch new file +30 -0
new file mode 100644
index 0000000000..e4490bbb9e
@@ -0,0 +1,30 @@
+kernel headers have restructured mips syscall generation in kernel
+in recent versions, however, ltrace still has logic to define the
+syscall numbers based on old logic, this patch includes the legacy
+UAPI headers to get these defines
+
+Fixes errors e.g.
+../../../../git/sysdeps/linux-gnu/mips/trace.c:138:29: error: '__NR_O32_Linux' undeclared (first use in this function)
+  const int syscallbase[] = {__NR_O32_Linux, __NR_N32_Linux,
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+--- a/sysdeps/linux-gnu/mips/trace.c
++++ b/sysdeps/linux-gnu/mips/trace.c
+@@ -34,6 +34,16 @@
+ #include <assert.h>
+ #include <asm/unistd.h>
+ 
++#ifndef __NR_O32_Linux
++#include <asm/unistd_nr_o32.h>
++#endif
++#ifndef __NR_N32_Linux
++#include <asm/unistd_nr_n64.h>
++#endif
++#ifndef __NR_N64_Linux
++#include <asm/unistd_nr_n32.h>
++#endif
++
+ #include "backend.h"
+ #include "common.h"
+ #include "debug.h"
meta-oe/recipes-devtools/ltrace/ltrace_git.bb +1 -0
index 3dc269c80e..ead637cb7e 100644
@@ -27,6 +27,7 @@ SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http
            file://0001-mips-plt.c-Delete-include-error.h.patch \
            file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
            file://0001-hook-Do-not-append-int-to-std-string.patch \
+           file://include_unistd_nr.patch \
            "
 S = "${WORKDIR}/git"
 
author
#2 lore raw

I think yes

Quoted 72 lines · On Fri, Sep 6, 2019 at 5:12 PM akuster808 <[email protected]> wrote:
Quoted 4 lines · Khem Raj

Newer kernel UAPI headers for mips have moved these needed defines around

warrior too?

Quoted 5 lines
---
 .../ltrace/ltrace/include_unistd_nr.patch     | 30 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644

meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch

Quoted 2 lines

diff --git

a/meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch b/meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch

meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch line 7

Quoted 12 lines

new file mode 100644
index 0000000000..e4490bbb9e

meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch new file +7 -0
@@ -0,0 +1,30 @@
+kernel headers have restructured mips syscall generation in kernel
+in recent versions, however, ltrace still has logic to define the
+syscall numbers based on old logic, this patch includes the legacy
+UAPI headers to get these defines
+
+Fixes errors e.g.
+../../../../git/sysdeps/linux-gnu/mips/trace.c:138:29: error:

'__NR_O32_Linux' undeclared (first use in this function)

Review

Quoted 24 lines
meta-oe/recipes-devtools/ltrace/ltrace/include_unistd_nr.patch new file +23 -0
+  const int syscallbase[] = {__NR_O32_Linux, __NR_N32_Linux,
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+--- a/sysdeps/linux-gnu/mips/trace.c
++++ b/sysdeps/linux-gnu/mips/trace.c
+@@ -34,6 +34,16 @@
+ #include <assert.h>
+ #include <asm/unistd.h>
+
++#ifndef __NR_O32_Linux
++#include <asm/unistd_nr_o32.h>
++#endif
++#ifndef __NR_N32_Linux
++#include <asm/unistd_nr_n64.h>
++#endif
++#ifndef __NR_N64_Linux
++#include <asm/unistd_nr_n32.h>
++#endif
++
+ #include "backend.h"
+ #include "common.h"
+ #include "debug.h"
(quoted diff) +0 -0

b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb

meta-oe/recipes-devtools/ltrace/ltrace_git.bb SRC_URI = "git://

Quoted 4 lines

index 3dc269c80e..ead637cb7e 100644

meta-oe/recipes-devtools/ltrace/ltrace_git.bb +0 -0
@@ -27,6 +27,7 @@ SRC_URI = "git://

github.com/sparkleholic/ltrace.git;branch=master;protocol=http

meta-oe/recipes-devtools/ltrace/ltrace_git.bb SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http · line 33

Quoted 2 lines
meta-oe/recipes-devtools/ltrace/ltrace_git.bb +0 -0
            file://0001-mips-plt.c-Delete-include-error.h.patch \
 

file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \

Quoted 5 lines
meta-oe/recipes-devtools/ltrace/ltrace_git.bb +1 -0
            file://0001-hook-Do-not-append-int-to-std-string.patch \
+           file://include_unistd_nr.patch \
            "
 S = "${WORKDIR}/git"
 
#3 lore raw
In reply to akuster808
Quoted 8 lines · On Fri, Sep 06, 2019 at 05:12:24PM -0700, akuster808 wrote:
Quoted 4 lines · Khem Raj

Newer kernel UAPI headers for mips have moved these needed defines around

warrior too?
...

No, this is not a problem with the UAPI headers in warrior.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#4 lore raw
Quoted 6 lines · Adrian Bunk
Quoted 4 lines · On Fri, Sep 06, 2019 at 05:12:24PM -0700, akuster808 wrote:
Quoted 3 lines · Khem Raj

Newer kernel UAPI headers for mips have moved these needed defines around

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

warrior too?
...

No, this is not a problem with the UAPI headers in warrior.

anything that's using kernel 5.0+ UAPI headers has this problem and warrior is using 5.0
for linux-libc headers. see [1]

[1] https://github.com/torvalds/linux/commit/9bcbf97c62931f27ab2c52f0848dec0cd48aee78

#5 lore raw
Quoted 12 lines · Khem Raj
Quoted 11 lines · Adrian Bunk
Quoted 8 lines · On Fri, Sep 06, 2019 at 05:12:24PM -0700, akuster808 wrote:
Quoted 4 lines · Khem Raj

Newer kernel UAPI headers for mips have moved these needed defines around

warrior too?
...

Quoted 7 lines
Quoted 1 line

No, this is not a problem with the UAPI headers in warrior.

anything that's using kernel 5.0+ UAPI headers has this problem and warrior is using 5.0
for linux-libc headers. see [1]

[1] https://github.com/torvalds/linux/commit/9bcbf97c62931f27ab2c52f0848dec0cd48aee78

Thanks for correcting me, I was looking at the wrong commit.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed