[LLVMbugs] [Bug 19869] New: clang cannot find crtbegin.o and libgcc on Debian/mips64el
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 27 09:49:12 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19869
Bug ID: 19869
Summary: clang cannot find crtbegin.o and libgcc on
Debian/mips64el
Product: clang
Version: trunk
Hardware: SGI
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: wzssyqa at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
I built clang with a patch on Debian/MIPS64el, while it cannot find crtbegin.o
and libgcc etc, which lye in
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/
the output of clang -v is like
(gdb) run -v hello.c
Starting program: /usr/bin/clang -v hello.c
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/mips64el-linux-gnuabi64/libthread_db.so.1".
Debian clang version 3.5.0-2 (trunk) (based on LLVM 3.5.0)
Target: mips64el-unknown-linux-gnuabi64
Thread model: posix
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.7
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.7.3
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.8
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.8.2
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.9
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/4.9.0
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.7
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.7.3
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.8
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.8.2
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.9
Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/4.9.0
"/usr/lib/llvm-3.5/bin/clang" -cc1 -triple mips64el-unknown-linux-gnuabi64 -S
-disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model
static -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases
-target-cpu mips64r2 -target-abi n64 -mfloat-abi hard -target-linker-version
2.24.51.20140425 -v -resource-dir /usr/lib/llvm-3.5/bin/../lib/clang/3.5.0
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-3.5/bin/../lib/clang/3.5.0/include -internal-externc-isystem
/usr/include/mips64el-linux-gnuabi64 -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fno-dwarf-directory-asm
-fdebug-compilation-dir /tmp/xxx -ferror-limit 19 -fmessage-length 204
-mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-o /tmp/hello-772f6f.s -x c hello.c
clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target
mips64el-unknown-linux-gnuabi64
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/llvm-3.5/bin/../lib/clang/3.5.0/include
/usr/include/mips64el-linux-gnuabi64
/usr/include
End of search list.
"/usr/bin/as" -march mips64r2 -mabi 64 -EL -o /tmp/hello-d5f4b4.o
/tmp/hello-772f6f.s
"/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker
/lib64/ld.so.1 -o a.out /usr/lib/mips64el-linux-gnuabi64/crt1.o
/usr/lib/mips64el-linux-gnuabi64/crti.o crtbegin.o
-L/lib/mips64el-linux-gnuabi64 -L/lib/../lib64
-L/usr/lib/mips64el-linux-gnuabi64 -L/usr/lib/llvm-3.5/bin/../lib -L/lib
-L/usr/lib /tmp/hello-d5f4b4.o -lgcc --as-needed -lgcc_s --no-as-needed -lc
-lgcc --as-needed -lgcc_s --no-as-needed crtend.o
/usr/lib/mips64el-linux-gnuabi64/crtn.o
/usr/bin/ld.bfd.real: cannot find crtbegin.o: No such file or directory
/usr/bin/ld.bfd.real: cannot find -lgcc
/usr/bin/ld.bfd.real: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Inferior 1 (process 6621) exited with code 01]
with the same patch, clang 3.3 works well
buildd at clash:/tmp/xxx$ clang -v hello.c
Debian clang version 3.3-16 (branches/release_33) (based on LLVM 3.3)
Target: mips64el-unknown-linux-gnuabi64
Thread model: posix
"/usr/bin/clang" -cc1 -triple mips64el-unknown-linux-gnuabi64 -S -disable-free
-disable-llvm-verifier -main-file-name hello.c -mrelocation-model static
-mdisable-fp-elim -fmath-errno -mconstructor-aliases -fuse-init-array
-target-cpu mips64 -target-abi n64 -mfloat-abi hard -target-linker-version 2.24
-v -resource-dir /usr/bin/../lib/clang/3.3 -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.3/include -internal-isystem
/usr/include/clang/3.3/include/ -internal-externc-isystem
/usr/include/mips64el-linux-gnuabi64 -internal-externc-isystem
/usr/include/mips64el-linux-gnuabi64 -internal-externc-isystem /usr/include
-fno-dwarf-directory-asm -fdebug-compilation-dir /tmp/xxx -ferror-limit 19
-fmessage-length 204 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -o /tmp/hello-2vLJd9.s -x
c hello.c
clang -cc1 version 3.3 based upon LLVM 3.3 default target
mips64el-unknown-linux-gnuabi64
ignoring nonexistent directory "/usr/bin/../lib/clang/3.3/include"
ignoring duplicate directory "/usr/include/mips64el-linux-gnuabi64"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include/clang/3.3/include
/usr/include/mips64el-linux-gnuabi64
/usr/include
End of search list.
"/usr/bin/as" -march mips64 -mabi 64 -EL -o /tmp/hello-8EkBe9.o
/tmp/hello-2vLJd9.s
"/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker
/lib64/ld.so.1 -o a.out
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64/crt1.o
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64/crti.o
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/crtbegin.o
-L/usr/lib/gcc/mips64el-linux-gnuabi64/4.9
-L/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64
-L/lib/mips64el-linux-gnuabi64 -L/lib/../lib64
-L/usr/lib/mips64el-linux-gnuabi64
-L/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../.. -L/lib -L/usr/lib
/tmp/hello-8EkBe9.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/crtend.o
/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64/crtn.o
/usr/bin/ld.bfd.real: /tmp/hello-8EkBe9.o: warning: linking abicalls files with
non-abicalls files
The patch is
Index: llvm-toolchain-snapshot_3.5~svn201651/clang/lib/Driver/ToolChains.cpp
===================================================================
--- llvm-toolchain-snapshot_3.5~svn201651.orig/clang/lib/Driver/ToolChains.cpp
2014-02-19 09:46:39.989351664 +0100
+++ llvm-toolchain-snapshot_3.5~svn201651/clang/lib/Driver/ToolChains.cpp
2014-02-19 09:46:43.433569829 +0100
@@ -1322,11 +1322,13 @@
static const char *const MIPS64LibDirs[] = { "/lib64", "/lib" };
static const char *const MIPS64Triples[] = { "mips64-linux-gnu",
- "mips-mti-linux-gnu" };
+ "mips-mti-linux-gnu",
+ "mips64-linux-gnuabi64" };
static const char *const MIPS64ELLibDirs[] = { "/lib64", "/lib" };
static const char *const MIPS64ELTriples[] = { "mips64el-linux-gnu",
"mips-mti-linux-gnu",
- "mips64el-linux-android" };
+ "mips64el-linux-android",
+ "mips64el-linux-gnuabi64" };
static const char *const PPCLibDirs[] = { "/lib32", "/lib" };
static const char *const PPCTriples[] = {
@@ -2767,6 +2769,14 @@
if (llvm::sys::fs::exists(SysRoot + "/lib/mipsel-linux-gnu"))
return "mipsel-linux-gnu";
return TargetTriple.str();
+ case llvm::Triple::mips64:
+ if (llvm::sys::fs::exists(SysRoot + "/lib/mips64-linux-gnuabi64"))
+ return "mips64-linux-gnuabi64";
+ return TargetTriple.str();
+ case llvm::Triple::mips64el:
+ if (llvm::sys::fs::exists(SysRoot + "/lib/mips64el-linux-gnuabi64"))
+ return "mips64el-linux-gnuabi64";
+ return TargetTriple.str();
case llvm::Triple::ppc:
if (llvm::sys::fs::exists(SysRoot + "/lib/powerpc-linux-gnuspe"))
return "powerpc-linux-gnuspe";
@@ -3120,6 +3130,12 @@
const StringRef MIPSELMultiarchIncludeDirs[] = {
"/usr/include/mipsel-linux-gnu"
};
+ const StringRef MIPS64MultiarchIncludeDirs[] = {
+ "/usr/include/mips64-linux-gnuabi64"
+ };
+ const StringRef MIPS64ELMultiarchIncludeDirs[] = {
+ "/usr/include/mips64el-linux-gnuabi64"
+ };
const StringRef PPCMultiarchIncludeDirs[] = {
"/usr/include/powerpc-linux-gnu"
};
@@ -3142,6 +3158,10 @@
MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;
} else if (getTriple().getArch() == llvm::Triple::mipsel) {
MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs;
+ } else if (getTriple().getArch() == llvm::Triple::mips64) {
+ MultiarchIncludeDirs = MIPS64MultiarchIncludeDirs;
+ } else if (getTriple().getArch() == llvm::Triple::mips64el) {
+ MultiarchIncludeDirs = MIPS64ELMultiarchIncludeDirs;
} else if (getTriple().getArch() == llvm::Triple::ppc) {
MultiarchIncludeDirs = PPCMultiarchIncludeDirs;
} else if (getTriple().getArch() == llvm::Triple::ppc64) {
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140527/16b5bc16/attachment.html>
More information about the llvm-bugs
mailing list