Skip to contentSkip to conversation

uclibc: fix issue with gdb 8.0

PATCH New Waldemar Brodkorb 3 participants 5 messages Aug 5, 2017 – Aug 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uclibc: fix issue with gdb 8.0

gdb 8.0 is now compiled and linked with C++, the thread_db headers need to use extern "C", to be usable for C++ code.

Fixes:
Issue when building gdbserver for m68k-coldfire:

thread-db.o: In function `thread_db_init()':
thread-db.c:(.text+0x5b6): undefined reference to td_ta_new(ps_prochandle*, td_thragent**)' thread-db.c:(.text+0x61e): undefined reference to td_thr_get_info(td_thrhandle const*, td_thrinfo*)' thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()'
...

---
 package/uclibc/0001-fix-issues-with-gdb-8.0.patch | 72 +++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 package/uclibc/0001-fix-issues-with-gdb-8.0.patch
package/uclibc/0001-fix-issues-with-gdb-8.0.patch new file +72 -0
new file mode 100644
index 0000000..20567e6
@@ -0,0 +1,72 @@
+From 111f01d432d542a153c1cad83def3a6ab57df7af Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <[email protected]>
+Date: Sat, 5 Aug 2017 11:28:07 +0200
+Subject: [PATCH] fix issues with gdb 8.0
+
+GDB 8.0 is compiled and linked with g++, but the
+linking of static targets (f.e. coldfire) fails,
+without declaring the functions in thread_db.h
+extern C.
+
+The compilation of gdb errors out with:
+thread-db.o: In function `thread_db_init()':
+thread-db.c:(.text+0x5b6): undefined reference to `td_ta_new(ps_prochandle*, td_thragent**)'
+thread-db.c:(.text+0x61e): undefined reference to `td_thr_get_info(td_thrhandle const*, td_thrinfo*)'
+thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()'
+..
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+---
+ libpthread/linuxthreads_db/thread_db.h | 7 +++++++
+ libpthread/nptl_db/thread_db.h         | 7 +++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/libpthread/linuxthreads_db/thread_db.h b/libpthread/linuxthreads_db/thread_db.h
+index 13c30af..ec79f60 100644
+--- a/libpthread/linuxthreads_db/thread_db.h
++++ b/libpthread/linuxthreads_db/thread_db.h
+@@ -27,6 +27,9 @@
+ #include <sys/types.h>
+ #include <sys/procfs.h>
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Error codes of the library.  */
+ typedef enum
+@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+ /* Resume execution of thread TH.  */
+ extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+ 
++#ifdef __cplusplus
++}
++#endif
++
+ #endif	/* thread_db.h */
+diff --git a/libpthread/nptl_db/thread_db.h b/libpthread/nptl_db/thread_db.h
+index 27ea69a..993842f 100644
+--- a/libpthread/nptl_db/thread_db.h
++++ b/libpthread/nptl_db/thread_db.h
+@@ -27,6 +27,9 @@
+ #include <sys/types.h>
+ #include <sys/procfs.h>
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Error codes of the library.  */
+ typedef enum
+@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+ /* Resume execution of thread TH.  */
+ extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+ 
++#ifdef __cplusplus
++}
++#endif
++
+ #endif	/* thread_db.h */
+-- 
+2.1.4
+
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 uclibc: fix issue with gdb 8.0

Hi Waldemar,

Le 05/08/2017 ? 12:49, Waldemar Brodkorb a ?crit :

Quoted 2 lines

gdb 8.0 is now compiled and linked with C++, the thread_db headers need to use extern "C", to be usable for C++ code.

I got the same issue with gdb-7.12.1.

gdb build fine with this patch applied and the one from Thomas [1]

[1] http://patchwork.ozlabs.org/patch/797022/

Best regards,
Romain

Quoted 94 lines

Fixes:
Issue when building gdbserver for m68k-coldfire:

thread-db.o: In function `thread_db_init()':
thread-db.c:(.text+0x5b6): undefined reference to td_ta_new(ps_prochandle*, td_thragent**)' thread-db.c:(.text+0x61e): undefined reference to td_thr_get_info(td_thrhandle const*, td_thrinfo*)' thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()'
...>

---
 package/uclibc/0001-fix-issues-with-gdb-8.0.patch | 72 +++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 package/uclibc/0001-fix-issues-with-gdb-8.0.patch
package/uclibc/0001-fix-issues-with-gdb-8.0.patch new file +72 -0
new file mode 100644
index 0000000..20567e6
@@ -0,0 +1,72 @@
+From 111f01d432d542a153c1cad83def3a6ab57df7af Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <[email protected]>
+Date: Sat, 5 Aug 2017 11:28:07 +0200
+Subject: [PATCH] fix issues with gdb 8.0
+
+GDB 8.0 is compiled and linked with g++, but the
+linking of static targets (f.e. coldfire) fails,
+without declaring the functions in thread_db.h
+extern C.
+
+The compilation of gdb errors out with:
+thread-db.o: In function `thread_db_init()':
+thread-db.c:(.text+0x5b6): undefined reference to `td_ta_new(ps_prochandle*, td_thragent**)'
+thread-db.c:(.text+0x61e): undefined reference to `td_thr_get_info(td_thrhandle const*, td_thrinfo*)'
+thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()'
+..
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+---
+ libpthread/linuxthreads_db/thread_db.h | 7 +++++++
+ libpthread/nptl_db/thread_db.h         | 7 +++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/libpthread/linuxthreads_db/thread_db.h b/libpthread/linuxthreads_db/thread_db.h
+index 13c30af..ec79f60 100644
+--- a/libpthread/linuxthreads_db/thread_db.h
++++ b/libpthread/linuxthreads_db/thread_db.h
+@@ -27,6 +27,9 @@
+ #include <sys/types.h>
+ #include <sys/procfs.h>
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Error codes of the library.  */
+ typedef enum
+@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+ /* Resume execution of thread TH.  */
+ extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+ 
++#ifdef __cplusplus
++}
++#endif
++
+ #endif	/* thread_db.h */
+diff --git a/libpthread/nptl_db/thread_db.h b/libpthread/nptl_db/thread_db.h
+index 27ea69a..993842f 100644
+--- a/libpthread/nptl_db/thread_db.h
++++ b/libpthread/nptl_db/thread_db.h
+@@ -27,6 +27,9 @@
+ #include <sys/types.h>
+ #include <sys/procfs.h>
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Error codes of the library.  */
+ typedef enum
+@@ -455,4 +458,8 @@ extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+ /* Resume execution of thread TH.  */
+ extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+ 
++#ifdef __cplusplus
++}
++#endif
++
+ #endif	/* thread_db.h */
+-- 
+2.1.4
+
#2 lore raw

PATCH 1/1 uclibc: fix issue with gdb 8.0

Hi,
Romain Naour wrote,

Quoted 7 lines

Hi Waldemar,

Le 05/08/2017 ? 12:49, Waldemar Brodkorb a ?crit :

Quoted 2 lines

gdb 8.0 is now compiled and linked with C++, the thread_db headers need to use extern "C", to be usable for C++ code.

I got the same issue with gdb-7.12.1.

Yeah, when --disable-build-with-cxx is _not_ used the problem happens even for earlier versions. May be the commit message should be adjusted before pushing.

Quoted 5 lines

gdb build fine with this patch applied and the one from Thomas [1]

[1] http://patchwork.ozlabs.org/patch/797022/

Thanks for testing,
Waldemar

#3 lore raw

PATCH 1/1 uclibc: fix issue with gdb 8.0

Quoted 6 lines · Waldemar Brodkorb

Hi,
Romain Naour wrote,

Quoted 3 lines

Hi Waldemar,

Le 05/08/2017 ? 12:49, Waldemar Brodkorb a ?crit :

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

gdb 8.0 is now compiled and linked with C++, the thread_db headers need to use extern "C", to be usable for C++ code.

I got the same issue with gdb-7.12.1.

Yeah, when --disable-build-with-cxx is _not_ used the problem happens even for earlier versions. May be the commit message should be adjusted before pushing.

I applied to master but forgot to update the commit message :-(

Regards,
Arnout

Quoted 6 lines
Quoted 6 lines

gdb build fine with this patch applied and the one from Thomas [1]

[1] http://patchwork.ozlabs.org/patch/797022/

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH 1/1 uclibc: fix issue with gdb 8.0

Quoted 12 lines · Arnout Vandecappelle
Quoted 9 lines · Waldemar Brodkorb

Hi,
Romain Naour wrote,

Quoted 6 lines

Hi Waldemar,

Le 05/08/2017 ? 12:49, Waldemar Brodkorb a ?crit :

Quoted 2 lines

gdb 8.0 is now compiled and linked with C++, the thread_db headers need to use extern "C", to be usable for C++ code.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I got the same issue with gdb-7.12.1.

Yeah, when --disable-build-with-cxx is _not_ used the problem happens even for earlier versions. May be the commit message should be adjusted before pushing.

I applied to master but forgot to update the commit message :-(

Apparently I hadn't pushed it yet so now I did update the commit message :-)

But this probably means there's some other patch for which I forgot to send the
'applied to master' mail.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF