Skip to contentSkip to conversation

disas/arm-a64.cc: Fix build error

PATCH In review Gavin Shan 4 participants 4 messages Mar 20, 2021 – Apr 6, 2021

lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

PATCH 1/2 disas/arm-a64.cc: Fix build error

This fixes the following build error with gcc v11.0.0:

  # gcc --version
  gcc (GCC) 11.0.0 20210210 (Red Hat 11.0.0-0)

[969/2604] Compiling C++ object libcommon.fa.p/disas_arm-a64.cc.o
FAILED: libcommon.fa.p/disas_arm-a64.cc.o

    :
  In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                   from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                   from /usr/include/glib-2.0/glib/gtypes.h:32,
                   from /usr/include/glib-2.0/glib/galloca.h:32,
                   from /usr/include/glib-2.0/glib.h:30,
                   from /home/gavin/sandbox/qemu.main/include/glib-compat.h:32,
                   from /home/gavin/sandbox/qemu.main/include/qemu/osdep.h:126,
                   from ../disas/arm-a64.cc:21:
  /usr/include/c++/11/type_traits:56:3: error: template with C linkage
     56 |   template<typename _Tp, _Tp __v>
        |   ^~~~~~~~
  ../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
     20 | extern "C" {
        | ^~~~~~~~~~
---
 disas/arm-a64.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
disas/arm-a64.cc +2 -2
index 9fa779e175..8545c04038 100644
@@ -17,13 +17,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "vixl/a64/disasm-a64.h"
+
 extern "C" {
 #include "qemu/osdep.h"
 #include "disas/dis-asm.h"
 }
 
-#include "vixl/a64/disasm-a64.h"
-
 using namespace vixl;
 
 static Decoder *vixl_decoder = NULL;
Signature · 1 line
2.23.0
Reviewed-by on v1 1/2
#1 lore raw
Quoted 52 lines · Gavin Shan

This fixes the following build error with gcc v11.0.0:

  # gcc --version
  gcc (GCC) 11.0.0 20210210 (Red Hat 11.0.0-0)

[969/2604] Compiling C++ object libcommon.fa.p/disas_arm-a64.cc.o
FAILED: libcommon.fa.p/disas_arm-a64.cc.o

    :
  In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                   from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                   from /usr/include/glib-2.0/glib/gtypes.h:32,
                   from /usr/include/glib-2.0/glib/galloca.h:32,
                   from /usr/include/glib-2.0/glib.h:30,
                   from /home/gavin/sandbox/qemu.main/include/glib-compat.h:32,
                   from /home/gavin/sandbox/qemu.main/include/qemu/osdep.h:126,
                   from ../disas/arm-a64.cc:21:
  /usr/include/c++/11/type_traits:56:3: error: template with C linkage
     56 |   template<typename _Tp, _Tp __v>
        |   ^~~~~~~~
  ../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
     20 | extern "C" {
        | ^~~~~~~~~~
---
 disas/arm-a64.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
disas/arm-a64.cc +2 -2
index 9fa779e175..8545c04038 100644
@@ -17,13 +17,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "vixl/a64/disasm-a64.h"
+
 extern "C" {
 #include "qemu/osdep.h"
 #include "disas/dis-asm.h"
 }
 
-#include "vixl/a64/disasm-a64.h"
-
 using namespace vixl;
 
 static Decoder *vixl_decoder = NULL;
Signature · 1 line
2.23.0

This error occurs when c++ compiler is used. With the fix, build pass.

#2 lore raw
In reply to Gavin Shan

+Christian for
https://www.mail-archive.com/[email protected]/msg785090.html

Quoted 49 lines · Gavin Shan

This fixes the following build error with gcc v11.0.0:

  # gcc --version
  gcc (GCC) 11.0.0 20210210 (Red Hat 11.0.0-0)

[969/2604] Compiling C++ object libcommon.fa.p/disas_arm-a64.cc.o
FAILED: libcommon.fa.p/disas_arm-a64.cc.o

    :
  In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                   from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                   from /usr/include/glib-2.0/glib/gtypes.h:32,
                   from /usr/include/glib-2.0/glib/galloca.h:32,
                   from /usr/include/glib-2.0/glib.h:30,
                   from /home/gavin/sandbox/qemu.main/include/glib-compat.h:32,
                   from /home/gavin/sandbox/qemu.main/include/qemu/osdep.h:126,
                   from ../disas/arm-a64.cc:21:
  /usr/include/c++/11/type_traits:56:3: error: template with C linkage
     56 |   template<typename _Tp, _Tp __v>
        |   ^~~~~~~~
  ../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
     20 | extern "C" {
        | ^~~~~~~~~~
---
 disas/arm-a64.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
disas/arm-a64.cc +2 -2
index 9fa779e175..8545c04038 100644
@@ -17,13 +17,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "vixl/a64/disasm-a64.h"
+
 extern "C" {
 #include "qemu/osdep.h"
 #include "disas/dis-asm.h"
 }
 
-#include "vixl/a64/disasm-a64.h"
-
 using namespace vixl;
 
 static Decoder *vixl_decoder = NULL;
#3 lore raw
In reply to Gavin Shan

Still worth 6.0 IMO.

Quoted 7 lines · Gavin Shan

This fixes the following build error with gcc v11.0.0:

  # gcc --version
  gcc (GCC) 11.0.0 20210210 (Red Hat 11.0.0-0)

[969/2604] Compiling C++ object libcommon.fa.p/disas_arm-a64.cc.o
FAILED: libcommon.fa.p/disas_arm-a64.cc.o

Quoted 15 lines
    :
  In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                   from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                   from /usr/include/glib-2.0/glib/gtypes.h:32,
                   from /usr/include/glib-2.0/glib/galloca.h:32,
                   from /usr/include/glib-2.0/glib.h:30,
                   from /home/gavin/sandbox/qemu.main/include/glib-compat.h:32,
                   from /home/gavin/sandbox/qemu.main/include/qemu/osdep.h:126,
                   from ../disas/arm-a64.cc:21:
  /usr/include/c++/11/type_traits:56:3: error: template with C linkage
     56 |   template<typename _Tp, _Tp __v>
        |   ^~~~~~~~
  ../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
     20 | extern "C" {
        | ^~~~~~~~~~

+Kamil & Eric for:

https://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg03321.html
https://www.mail-archive.com/[email protected]/msg450478.html

Quoted 27 lines
---
 disas/arm-a64.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
disas/arm-a64.cc +2 -2
index 9fa779e175..8545c04038 100644
@@ -17,13 +17,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "vixl/a64/disasm-a64.h"
+
 extern "C" {
 #include "qemu/osdep.h"
 #include "disas/dis-asm.h"
 }
 
-#include "vixl/a64/disasm-a64.h"
-
 using namespace vixl;
 
 static Decoder *vixl_decoder = NULL;