我正在使用 Developer Studio 12.5 附带的 SunCC 编译器在 Solaris 11.3 上构建Botan 。我对库或 Solaris 不太熟悉,我需要一些努力才能找到问题。
编译在一个名为divide.cpp
. 我已将其简化为以下测试用例。根据Sun Studio 12 编译器中 Oracle 的 GCC 风格的 asm 内联支持,ASM 格式良好。Clang、GCC 和 ICC 愉快地使用代码。
$ /opt/developerstudio12.5/bin/CC -m64 -std=c++11 test.cxx -c
"test.cxx", [main]:ube: error: Invalid reference to argument '1' in GASM Inlining
CC: ube failed for test.cxx
$ cat test.cxx
#include <iostream>
#include <stdint.h>
typedef uint64_t word;
inline word multadd(word a, word b, word* c)
{
asm(
"mulq %[b] \n\t"
"addq %[c],%[a] \n\t"
"adcq $0,%[carry] \n\t"
: [a]"=a"(a), [b]"=rm"(b), [carry]"=&d"(*c)
: "0"(a), "1"(b), [c]"g"(*c) : "cc");
return a;
}
int main(int argc, char* argv[])
{
word a, b, c, d;
std::cin >> a >> b >> c;
d = multadd(a, b, &c);
return 0;
}
我找不到有关错误字符串的有用信息Invalid reference to argument 'N' in GASM Inlining
。我在 Oracle 板上的内联汇编器上发现了 sunCC 扼流圈。但答案是 UBE 有问题并购买支持合同以了解更多信息。
我有三个问题:
错误信息表示什么?
如何让 SunCC 提供源文件和行号?
我该如何解决这个问题?
如果我将b
参数更改为 just =m
,则会产生相同的错误。如果我将b
参数更改为 just =r
,则会生成不同的错误:
asm(
"mulq %[b] \n\t"
"addq %[c],%[a] \n\t"
"adcq $0,%[carry] \n\t"
: [a]"=a"(a), [b]"=r"(b), [carry]"=&d"(*c)
: "0"(a), "1"(b), [c]"g"(*c) : "cc");
结果:
$ /opt/developerstudio12.5/bin/CC -m64 -std=c++11 test.cxx -c
Assembler: test.cxx
"<null>", line 205 : Invalid instruction argument
Near line: "mulq %rcx "
"<null>", line 206 : Invalid instruction argument
Near line: " addq %rbx,%rax "
"<null>", line 207 : Invalid instruction argument
Near line: " adcq $0,%rdx "
CC: ube failed for test.cxx