-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed Checking missing-syscalls for O32 #37411
Comments
Unfortunately the backend does not support O32 ABI on 64-bit CPU so this fix just suppresses the error and leads to other errors and/or incorrectly generated code. |
Hi Simon, Thanks for your response! and congratulations for new code owner of MIPS backend. My motivation is Compiling Linux kernel with LLVM[1] but our GCC toolchain[2] is able to pass the O32 ABI checking. And I have learned MIPS Software Standards (ABIs) in the Chapter 11 of 'See MIPS Run'[3], MIPS Architecture in the Chapter 6 of 'Digital Design and Computer Architecture'[4]. Please teach me how to fix the issue correctly, not like my monkey patch, thanks a lot!
Regards, |
In short, it's a difficult task. If you really need to support O32 ABI on 64-bit CPUs, I would recommend to start from the backend. Take a look at test/MC/Mips test cases with the By the way, a) could you switch to mips32r2 option? b) could you use or build and use a toolchain with N64 ABI support? |
Thanks for your teaching! I will try to implement it and let you to review the patch.
Loongson 3A3000[1] is MIPS64r2, so I couldn't switch to mips32r2, correct? My LLVM toolchain[2] support N64 ABI, is there something wrong, please teach me, thanks a lot!
int main(int argc, char *argv[]) { $ /opt/llvm-git/bin/clang hello.c Section Headers: There are no section groups in this file. Program Headers: Section to Segment mapping: Dynamic section at offset 0x3d8 contains 26 entries: There are no relocations in this file. The decoding of unwind sections for machine type MIPS R3000 is not currently supported. Symbol table '.dynsym' contains 15 entries: Symbol table '.symtab' contains 75 entries: Histogram for bucket list length (total of 3 buckets): Version symbols section '.gnu.version' contains 15 entries: Version needs section '.gnu.version_r' contains 1 entries: Displaying notes found at file offset 0x00000cac with length 0x00000020: Primary GOT: Reserved entries: Local entries: Global entries: Regards, |
|
Thanks for your teaching!
It also confused me, but GCC is able to work #37411 #c0
$ llvm-mc cpload.s -arch=mips64el -mcpu=mips64r2 -target-abi o32 -filetype=obj -o cpload-llvm-o32.o cpload-llvm-o32.o: file format ELF64-mips Disassembly of section .text: Why there is R_MIPS_NONE? $ gcc -c cpload.s -mabi=32 -o cpload-gnu-o32.o cpload-gnu-o32.o: file format ELF32-mips Disassembly of section .text: Regards, |
With the ugly monkey patch, LLVM is able to pass the testcase[1] Checking missing-syscalls for O32, and go forward[2]
Regards, |
The similar issue: $ make CC=/opt/loong-llvm/bin/clang Regards, |
llvm-mc generates 64-bit ELF file. For 64-bit MIPS files llvm-objdump prints relocations accordingly to the N64 ABI specification. In that case each relocation record might contain up to three relocations. See p. 40 at [1]. [1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/elf64-2.4.pdf |
Sorry for my late response! So is my output correct? Regards, |
It depends on what you want to geе. If you run gcc with "-mabi=32 -mips64" options, you get 32-bit binaries with MIPS64 instructions. You output from the llvm-mc shows that you get 64-bit binaries. |
Thanks for your teaching!
#37411 #c3 Could you give me some hint about how to support O32 ABI on 64-bit CPUs? thanks a lot! Regards, |
There is no plan on support O32 for MIPS64 due to lack of resources. But I'm ready to accept and review any related patches. |
mentioned in issue llvm/llvm-bugzilla-archive#38128 |
Extended Description
Hi LLVM developers,
I am building Linux Kernel[1] with LLVM toolchain[2] for mips64el.
But it failed Checking missing-syscalls for O32:
error: ABI 'o32' is not supported on CPU 'mips64r2'
Kbuild:98: recipe for target 'missing-syscalls' failed
make[1]: *** [missing-syscalls] Error 1
GCC is able to work:
...
Checking missing-syscalls for O32
CHK include/generated/timeconst.h
CHK include/generated/bounds.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
...
So ugly workaround patch:
diff --git a/lib/Basic/Targets/Mips.cpp b/lib/Basic/Targets/Mips.cpp
index cbd5a01..59dd34b 100644
--- a/lib/Basic/Targets/Mips.cpp
+++ b/lib/Basic/Targets/Mips.cpp
@@ -207,8 +207,7 @@ bool MipsTargetInfo::validateTarget(DiagnosticsEngine &Diags) const {
// FIXME: It's valid to use O32 on a 64-bit CPU but the backend can't handle
// this yet. It's better to fail here than on the backend assertion.
if (processorSupportsG#64 () && ABI == "o32") {
}
// 64-bit ABI's require 64-bit CPU's.
Target: mips64el-redhat-linux
Thread model: posix
InstalledDir: /opt/llvm-git/bin
Found candidate GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Selected GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Candidate multilib: .;
Selected multilib: .;
Regards,
Leslie Zhai
The text was updated successfully, but these errors were encountered: