Open bethebset opened 5 months ago
First of all, it looks like you are mixing up x64 inline assembly with a powerpc64 target? That is never going to work.
Secondly, have you tried a newer version of clang? 14.0 is very old now. You can try https://godbolt.org/ to experiment with different versions.
首先,看起来您正在将 x64 内联汇编与 powerpc64 目标混为一谈?这永远行不通。
其次,您是否尝试过较新版本的 clang?14.0 现在已经很旧了。您可以尝试 https://godbolt.org/ 尝试不同的版本。
Sorry, I accidentally posted the wrong code for x64.int MyOpen(char * filename,int Attrib)
{//__NR_open
//return syscall(SCN(1024), filename, Attrib, 0777);
int fp;
asm volatile (
"li 0, 1024\n"
"mr 3, %1\n"
"mr 4, %2\n"
"sc\n"
"mr %0, 3\n"
:"=r"(fp)
:"r" (filename),"r" (Attrib)
:"memory"
);
return fp;
}
Yes, this compiles fine with the "powerpc64 clang trunk" setting on Godbolt: https://godbolt.org/z/8aKMdWxEs .
So my next advice would be to try a more recent version of clang. 18.1.5 has been released very recently.
Yes, this compiles fine with the "powerpc64 clang trunk" setting on Godbolt: https://godbolt.org/z/8aKMdWxEs .
So my next advice would be to try a more recent version of clang. 18.1.5 has been released very recently.
Thanks for the suggestion, I've tried using it for authentication before, I just wanted to see if I could implement it with this release Because I have a rather large llvm 14.0 based project that I want to extend to the powerpc platform, but don't want to do the upgrades
I am not sure if there is any new clang 14 releases. From the website https://releases.llvm.org/, looks like when a new "big" release is published, there is no new fix packs for older "big" releases. I would suggest you upgrade your compiler to get a clean compile.
Yes, this compiles fine with the "powerpc64 clang trunk" setting on Godbolt: https://godbolt.org/z/8aKMdWxEs .
So my next advice would be to try a more recent version of clang. 18.1.5 has been released very recently.
I tried 18.0, and it's the same. It still gives me an error.
I am not sure if there is any new clang 14 releases. From the website https://releases.llvm.org/, looks like when a new "big" release is published, there is no new fix packs for older "big" releases. I would suggest you upgrade your compiler to get a clean compile.
Thanks a lot,I tried 18.0, and it's the same. It gives me the same error.
From https://godbolt.org/z/dPEW7hvnT, seems the case passes with both 18.0 and trunk. Could you please double confirm? Thanks.
@llvm/issue-subscribers-backend-powerpc
Author: Qizheng Tian (bethebset)
From https://godbolt.org/z/dPEW7hvnT, seems the case passes with both 18.0 and trunk. Could you please double confirm? Thanks.
Sorry, I realized that it's not this code that's the problem, it should be this section of my code that's the problem
void* another() {
char *p1, *p2
unsigned long Offset;
unsigned long a = 3;
__asm__ (
"bl label\n"
"label: mflr %0\n"
"b pos\n"
"pos: lis %1, pos@h\n"
"ori %1, %1, pos@l\n"
: "=r" (p1), "=r" (p2)
:
: "memory"
);
return (char *)p1 +a;
}
https://godbolt.org/z/1nWGGEoeE trunk clang still passes your code.
https://godbolt.org/z/1nWGGEoeE trunk clang still passes your code.
yes, I've also tried this
https://godbolt.org/z/1nWGGEoeE trunk clang still passes your code.
Is there something wrong with my inline assembly style? It's fine to write some random nop or other instructions.
Is there something wrong with my inline assembly style?
The inline assembly syntax is correct. But there is an unused variable *p2
which is assigned in the asm.
Is there something wrong with my inline assembly style?
The inline assembly syntax is correct. But there is an unused variable
*p2
which is assigned in the asm.
You're right, but I added it and it still compiles wrong!
You're right, but I added it and it still compiles wrong!
If you are going to verify your inline assembly syntax, maybe you can try what we tried in previous comment, use the compiler explorer. For your cases, I find all of them are able to compile... So don't know how should we help...
My source code are: int MyOpen(char * filename,int Attrib) {//__NR_open //return syscall(SCN(1024), filename, Attrib, 0777); int fp; asm volatile ( "li 0, 1024\n"
"mr 3, %1\n"
"mr 4, %2\n"
"sc\n"
"mr %0, 3\n"
:"=r"(fp) :"r" (filename),"r" (Attrib) :"memory" ); return fp; }
int main() { int fin = MyOpen("/home/test/hello.c",O_RDONLY ); return 0; } compile with: clang -m64 -target powerpc64-linux-gnu test.c -o test and get ERROR: error: Undefined temporary symbol .Ltmp2 2 warnings and 1 error generated.
On Ubuntu 22.04 Have a powerpc64 cross-compile environment
I'm a rookie and didn't find a good fit on google to solve the problem, please help me!