Fix GDB build fail on Aarch64 when -fno-common is enabled
authorMaxim Ostapenko <m.ostapenko@partner.samsung.com>
Mon, 16 Feb 2015 16:24:53 +0000 (20:24 +0400)
committerPedro Alves <palves@redhat.com>
Tue, 17 Feb 2015 09:10:49 +0000 (09:10 +0000)
Current trunk GDB (and gdb-7.8.1 too) fails to build on Aarch64 when
-fno-common is enabled.  It fails during link stage due to multiple
definition of `tdesc_aarch64':

...
[  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[  199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[  199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[  199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[  199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[  199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[  199s] collect2: error: ld returned 1 exit status
[  199s] make[2]: *** [gdb] Error 1
...

This happens because struct target_desc *tdesc_aarch64 is defined in
gdb/features/aarch64.c, which is included by two files
(gdb/aarch64-linux-nat.c and gdb/aarch64-tdep.c).

gdb/Changelog
2015-02-17  Max Ostapenko  <m.ostapenko@partner.samsung.com>

PR gdb/17984
* aarch64-linux-nat.c: Don't include features/aarch64.c anymore.
(aarch64_linux_read_description): Remove initialize_tdesc_aarch64
call.
* aarch64-tdep.h (tdesc_aarch64): Declare.

gdb/ChangeLog
gdb/aarch64-linux-nat.c
gdb/aarch64-tdep.h

index 396fbd0b981d18fc98e92819ce27ca8c0b1d7682..ba199055cfd132b43402447bd058ca5bf388ca08 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-17  Max Ostapenko  <m.ostapenko@partner.samsung.com>
+
+       PR gdb/17984
+       * aarch64-linux-nat.c: Don't include features/aarch64.c anymore.
+       (aarch64_linux_read_description): Remove initialize_tdesc_aarch64
+       call.
+       * aarch64-tdep.h (tdesc_aarch64): Declare.
+
 2015-02-12  Mark Wielaard  <mjw@redhat.com>
 
        * contrib/ari/gdb_ari.sh: Remove checks for "true" and "false".
index c58f68a5b087d2b5e5c8950eb38619d4bc8f62c8..aae48538bc01f4eb54ca977719baa4f176b9e645 100644 (file)
@@ -37,8 +37,6 @@
 
 #include "gregset.h"
 
-#include "features/aarch64.c"
-
 /* Defines ps_err_e, struct ps_prochandle.  */
 #include "gdb_proc_service.h"
 
@@ -830,7 +828,6 @@ aarch64_linux_child_post_startup_inferior (struct target_ops *self,
 static const struct target_desc *
 aarch64_linux_read_description (struct target_ops *ops)
 {
-  initialize_tdesc_aarch64 ();
   return tdesc_aarch64;
 }
 
index 6a7794d256b34b1c229f4dad7038c75e73be50bd..976ad32ddbc23052ee05d3b764a3c072aad94374 100644 (file)
@@ -90,4 +90,6 @@ struct gdbarch_tdep
   struct type *vnb_type;
 };
 
+extern struct target_desc *tdesc_aarch64;
+
 #endif /* aarch64-tdep.h */