Skip to contentSkip to conversation

package/gdb: fix gnulib issue with musl and uClibc toolchains

PATCH New Romain Naour 2 participants 6 messages Jul 23, 2016 – Jul 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

gnulib whant to use rpl_gettimeofday due bad guessing when cross-compiling with musl and uClibc toolchains.

tracepoint-ipa.o: In function `get_timestamp':
tracepoint.c:(.text+0x147): undefined reference to `rpl_gettimeofday' Makefile:329: recipe for target 'libinproctrace.so' failed

reported upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=19798

---
 ...fix-bad-guessing-when-cross-compiling-wit.patch | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 package/gdb/7.11.1/0001-gdb-gnulib-fix-bad-guessing-when-cross-compiling-wit.patch
package/gdb/7.11.1/0001-gdb-gnulib-fix-bad-guessing-when-cross-compiling-wit.patch new file +65 -0
new file mode 100644
index 0000000..1ad0f5c
@@ -0,0 +1,65 @@
+From 5696f95f7a6c214319a10edbdb4037ebec7a02f7 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sat, 23 Jul 2016 18:39:15 +0200
+Subject: [PATCH] gdb/gnulib: fix bad guessing when cross-compiling with musl
+ and uClibc toolchains
+
+Commit b2234a55a9065eeb2aba8d26706c63facd34f3ef disable gettimeofday
+replacement with rpl_gettimeofday for glibc toolchains but the same
+fix is needed for musl and uClibc toolchains.
+
+Otherwise the build fail with this error:
+tracepoint-ipa.o: In function `get_timestamp':
+tracepoint.c:(.text+0x147): undefined reference to `rpl_gettimeofday'
+Makefile:329: recipe for target 'libinproctrace.so' failed
+
+"It's a bit nasty.  Basically there are a lot of configure tests being
+done in order to figure out if the used runtime routines adhere to the
+standard(s).  A couple of those tests concern gettimeofday(). The last
+one wants to check if gettimeofday() and localtime() share a static
+buffer (apparently a MacOS X issue)" [2]
+
+[1] https://sourceware.org/bugzilla/show_bug.cgi?id=19798
+[2] http://www.riscos.info/pipermail/gcc/2014-April/006093.html
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ gdb/gnulib/configure                 | 4 +++-
+ gdb/gnulib/import/m4/gettimeofday.m4 | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/gdb/gnulib/configure b/gdb/gnulib/configure
+index 540bad3..c5f6078 100644
+--- a/gdb/gnulib/configure
++++ b/gdb/gnulib/configure
+@@ -13520,8 +13520,10 @@ else
+   if test "$cross_compiling" = yes; then :
+   # When cross-compiling:
+       case "$host_os" in
+-                # Guess all is fine on glibc systems.
++                # Guess all is fine on glibc/musl/uClibc systems.
+         *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++        *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++        *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+       esac
+diff --git a/gdb/gnulib/import/m4/gettimeofday.m4 b/gdb/gnulib/import/m4/gettimeofday.m4
+index ce246e1..7984252 100644
+--- a/gdb/gnulib/import/m4/gettimeofday.m4
++++ b/gdb/gnulib/import/m4/gettimeofday.m4
+@@ -109,8 +109,10 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
+      [gl_cv_func_gettimeofday_clobber=yes],
+      [# When cross-compiling:
+       case "$host_os" in
+-                # Guess all is fine on glibc systems.
++                # Guess all is fine on glibc/musl/uClibc systems.
+         *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++        *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++        *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+       esac
+-- 
+2.5.5
+
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

Hello,

Quoted 6 lines · Romain Naour

gnulib whant to use rpl_gettimeofday due bad guessing when cross-compiling with musl and uClibc toolchains.

tracepoint-ipa.o: In function `get_timestamp':
tracepoint.c:(.text+0x147): undefined reference to `rpl_gettimeofday' Makefile:329: recipe for target 'libinproctrace.so' failed

I tested the following defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2016.05-1162-g94c7298.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_PACKAGE_GDB_DEBUGGER=y
# BR2_TARGET_ROOTFS_TAR is not set

and did not encounter any problem.

If you can still reproduce the problem, isn't it solved by:

GDB_CONF_ENV += gl_cv_func_gettimeofday_clobber=no

?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

Hi Thomas,

Le 24/07/2016 ? 15:55, Thomas Petazzoni a ?crit :

Quoted 31 lines

Hello,

Quoted 6 lines · Romain Naour

gnulib whant to use rpl_gettimeofday due bad guessing when cross-compiling with musl and uClibc toolchains.

tracepoint-ipa.o: In function `get_timestamp':
tracepoint.c:(.text+0x147): undefined reference to `rpl_gettimeofday' Makefile:329: recipe for target 'libinproctrace.so' failed

I tested the following defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2016.05-1162-g94c7298.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_PACKAGE_GDB_DEBUGGER=y
# BR2_TARGET_ROOTFS_TAR is not set

Quoted 5 lines

and did not encounter any problem.

If you can still reproduce the problem, isn't it solved by:

GDB_CONF_ENV += gl_cv_func_gettimeofday_clobber=no

Ha! yes, gdb build fine with this! (musl and uClibc)

Do you want to fix this locally (Reported-by) or I should resend a patch ?

Thanks,
Romain

Quoted 7 lines

?

Thanks,

Thomas

#3 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

Hello Romain,

Quoted 21 lines · Romain Naour
Quoted 21 lines

I tested the following defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2016.05-1162-g94c7298.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_PACKAGE_GDB_DEBUGGER=y
# BR2_TARGET_ROOTFS_TAR is not set

Quoted 1 line
Quoted 1 line

and did not encounter any problem.

Seems like you missed this part of my e-mail. I was *not* able to reproduce the build problem.

Quoted 7 lines
Quoted 3 lines

If you can still reproduce the problem, isn't it solved by:

GDB_CONF_ENV += gl_cv_func_gettimeofday_clobber=no

Ha! yes, gdb build fine with this! (musl and uClibc)

Do you want to fix this locally (Reported-by) or I should resend a patch ?

Please send a patch, but please indicate which configuration fails for you, as I was unable to reproduce the issue.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

Hi Thomas,

Le 24/07/2016 ? 16:17, Thomas Petazzoni a ?crit :

Quoted 25 lines

Hello Romain,

Quoted 21 lines · Romain Naour
Quoted 21 lines

I tested the following defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2016.05-1162-g94c7298.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_PACKAGE_GDB_DEBUGGER=y
# BR2_TARGET_ROOTFS_TAR is not set

Quoted 4 lines
Quoted 1 line
Quoted 1 line

and did not encounter any problem.

Seems like you missed this part of my e-mail. I was *not* able to reproduce the build problem.

Sorry...

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

If you can still reproduce the problem, isn't it solved by:

GDB_CONF_ENV += gl_cv_func_gettimeofday_clobber=no

Ha! yes, gdb build fine with this! (musl and uClibc)

Do you want to fix this locally (Reported-by) or I should resend a patch ?

Please send a patch, but please indicate which configuration fails for you, as I was unable to reproduce the issue.

The issue appear with gdb 7.11.1 only, that's due to bundled gnulib version has been updated.
We didn't see this issue in the autobuilders since gdb 7.11.1 is not tested (not the default Kconfig choice)

Anyway, I tested your proposal with gdb 7.11.1 and it working well :)

I'll resend the patch in a moment.

Best regards,
Romain

Quoted 5 lines

Thanks!

Thomas

#5 lore raw

PATCH 1/1 package/gdb: fix gnulib issue with musl and uClibc toolchains

Hello,

Quoted 4 lines · Romain Naour

The issue appear with gdb 7.11.1 only, that's due to bundled gnulib version has been updated.
We didn't see this issue in the autobuilders since gdb 7.11.1 is not tested (not the default Kconfig choice)

Aah, ok! I indeed tested with gdb 7.10 and not 7.11. I think the fact that it happens only starting with gdb 7.11 was missing in your commit log :-)

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com