【问题标题】:GCC Error: extended registers have no high halvesGCC 错误:扩展寄存器没有高半部分
【发布时间】:2017-08-29 19:01:16
【问题描述】:

我正在尝试使用 gcc-4.9.1. 编译 64 位 C 库在使用 -O2 编译时,我在不同的地方收到以下错误。 -O0 编译工作正常。

Error:
error: extended registers have no high halves

知道为什么会出现此错误消息以及如何解决它。它指向的行号是函数的结尾。

编译器选项是:

 -march=x86-64 -fno-omit-frame-pointer -m64 -Wno-pointer-sign
 -Wno-error=address -ggdb -gdwarf-2 -g2 -feliminate-unused-debug-types 

【问题讨论】:

标签: c gcc gcc4.9


【解决方案1】:

好像在这个patch中添加了这个错误:

+   /* Irritantingly AMD extended registers use different naming convention
+      from the normal registers.  */
+   if (REX_INT_REG_P (x))
+   {
+       switch (code)
+     {
+     case 5:
+       error ("Extended registers have no high halves\n");
+       break;
+     case 1:
+       fprintf (file, "r%ib", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 2:
+       fprintf (file, "r%iw", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 4:
+       fprintf (file, "r%id", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 8:
+       fprintf (file, "r%i", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     default:
+       error ("Unsupported operand size for extended register.\n");
+       break;
+      }
+       return;
+   }

尝试不带-march=x86-64选项重新编译。

【讨论】:

  • 这不是说你应该使用不同的约束模式吗?
  • 嗯,我的第一个猜测是默认架构会自行纠正问题……但这只是猜测。
猜你喜欢
  • 1970-01-01
  • 2018-06-06
  • 1970-01-01
  • 1970-01-01
  • 2017-05-25
  • 1970-01-01
  • 1970-01-01
  • 2015-02-06
  • 1970-01-01
相关资源
最近更新 更多