Package: clang Version: 3.0-6 Severity: grave Tags: patch x-debbugs-cc: debian-rele...@lists.debian.org
RT in cc because of proposed TPU upload. Unfortunately it seems that the changes in 3.0-6 fixed clang on armel but not on armhf. root@debian:/# clang -v test.c Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0) Target: arm-unknown-linux-gnueabihf Thread model: posix clang: warning: unknown platform, assuming -mfloat-abi=soft "/usr/bin/clang" -cc1 -triple armv4t-unknown-linux-gnueabihf -S -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -target-abi apcs-gnu -target-cpu arm7tdmi -msoft-float -mfloat-abi soft -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -target-linker-version 2.22 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.0 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem /usr/include/arm-linux-gnueabihf -internal-externc-isystem /usr/include -ferror-limit 19 -fmessage-length 80 -fno-signed-char -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-TUFgUO.s -x c test.c clang -cc1 version 3.0 based upon llvm 3.0 hosted on arm-unknown-linux-gnueabihf ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include" ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include" ignoring duplicate directory "/usr/local/include" ignoring duplicate directory "/usr/include/arm-linux-gnueabihf" ignoring duplicate directory "/usr/include/arm-linux-gnueabihf" ignoring duplicate directory "/usr/include/arm-linux-gnueabihf" ignoring duplicate directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/include/arm-linux-gnueabihf /usr/include /usr/include/clang/3.0/include/ /usr/lib/gcc/arm-linux-gnueabihf/4.6/include/ /usr/lib/gcc/arm-linux-gnueabihf/4.6/include-fixed/ End of search list. "/usr/bin/as" -o /tmp/test-8d1iPt.o /tmp/test-TUFgUO.s "/usr/bin/ld" -X --hash-style=both --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux.so.3 -o a.out crt1.o crti.o /usr/lib/gcc/arm-linux-gnueabihf/4.6/crtbegin.o -L/usr/lib/gcc/arm-linux-gnueabihf/4.6 -L/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../.. -L/lib -L/usr/lib /tmp/test-8d1iPt.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/arm-linux-gnueabihf/4.6/crtend.o crtn.o /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory clang: error: linker command failed with exit code 1 (use -v to see invocation) root@debian:/# I decided to first look at the warning about float abi, this seems to have been a simple case of a missing condition in the logic that decides what float ABI to use. While fixing that I also noticed that the code uses "softfp" by default on armel when for debian armel it should be using "soft" by default (since debian supports hardware without a fpu) so I changed that too. Reading that code also gave me a hint on how to fix the code that made the path descisions which I proceeded to do. Then I had to fix the dynamic linker path for armhf. This is sufficient to make clang work with the gold linker on armhf. Unfortunately the bfd linker fails with an assertion failure. I intend to file a seperate bug report about this but still I think working with one or the two linker choices debian offers is better than working with neither. While working on the fixes I also found the clean target was not cleaning up properly and so fixed it. I have attatched a diff which I would like to upload to TPU are the maintainer and release team happy with this? I have tested that the patch does not break linking on armel with either bfd or gold. P.S. it seems the version in unstable has regressed from the version in testing and does not link a trivial test app successfully on either armel or armhf I have not investigated details of that (IMO fixing wheezy is more important than fixing a package that is in sid and unlikely to make it for wheezy).
diff -Nru clang-3.0/debian/changelog clang-3.0/debian/changelog --- clang-3.0/debian/changelog 2012-02-25 13:05:54.000000000 +0000 +++ clang-3.0/debian/changelog 2012-11-13 12:15:15.000000000 +0000 @@ -1,3 +1,14 @@ +clang (3.0-6.1) wheezy; urgency=low + + * Non-maintainer upload. + * 26-set-correct-float-abi.diff: Fix default float abis for armel and armhf + * 24-path-multiarch.diff: Fix paths for armhf + * 27-dynamic-linker.patch: Fix dynamic linker path for armhf + * debian/rules: fix clean target to remove generated file + tools/clang/include/clang/Debian/debian_path.h + + -- Peter Michael Green <plugw...@debian.org> Mon, 12 Nov 2012 22:04:07 +0000 + clang (3.0-6) unstable; urgency=low * Improve the soname patch diff -Nru clang-3.0/debian/patches/24-path-multiarch.diff clang-3.0/debian/patches/24-path-multiarch.diff --- clang-3.0/debian/patches/24-path-multiarch.diff 2012-02-25 13:05:16.000000000 +0000 +++ clang-3.0/debian/patches/24-path-multiarch.diff 2012-11-12 22:03:48.000000000 +0000 @@ -1,8 +1,8 @@ Index: clang-3.0/tools/clang/lib/Driver/ToolChains.cpp =================================================================== ---- clang-3.0.orig/tools/clang/lib/Driver/ToolChains.cpp 2012-02-25 13:20:26.235542936 +0100 -+++ clang-3.0/tools/clang/lib/Driver/ToolChains.cpp 2012-02-25 13:21:02.951542117 +0100 -@@ -1785,6 +1785,15 @@ +--- clang-3.0.orig/tools/clang/lib/Driver/ToolChains.cpp 2012-11-12 21:17:23.000000000 +0000 ++++ clang-3.0/tools/clang/lib/Driver/ToolChains.cpp 2012-11-12 22:03:25.000000000 +0000 +@@ -1785,6 +1785,19 @@ if (llvm::sys::fs::exists(SysRoot + "/lib/x86_64-unknown-linux-gnu")) return "x86_64-unknown-linux-gnu"; return TargetTriple.str(); @@ -11,8 +11,12 @@ + return "powerpc-linux-gnu"; + return TargetTriple.str(); + case llvm::Triple::arm: -+ if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabi")) -+ return "arm-linux-gnueabi"; ++ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABI) ++ if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabi")) ++ return "arm-linux-gnueabi"; ++ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) ++ if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabihf")) ++ return "arm-linux-gnueabihf"; + return TargetTriple.str(); + } diff -Nru clang-3.0/debian/patches/26-set-correct-float-abi.diff clang-3.0/debian/patches/26-set-correct-float-abi.diff --- clang-3.0/debian/patches/26-set-correct-float-abi.diff 1970-01-01 00:00:00.000000000 +0000 +++ clang-3.0/debian/patches/26-set-correct-float-abi.diff 2012-11-13 12:03:39.000000000 +0000 @@ -0,0 +1,37 @@ +Description: set correct float abi settings for armel and armhf + debian armel supports systems that don't have a fpu so should use a "float abi" + setting of soft by default. + + Debian armhf needs a float abi setting of "hard" +Author: Peter Michael Green <plugw...@debian.org> + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: <vendor|upstream|other>, <url of original patch> +Bug: <url in upstream bugtracker> +Bug-Debian: http://bugs.debian.org/<bugnumber> +Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> +Forwarded: <no|not-needed|url proving that it has been forwarded> +Reviewed-By: <name and email of someone who approved the patch> +Last-Update: <YYYY-MM-DD> + +Index: clang-3.0/tools/clang/lib/Driver/Tools.cpp +=================================================================== +--- clang-3.0.orig/tools/clang/lib/Driver/Tools.cpp 2012-11-12 22:03:29.000000000 +0000 ++++ clang-3.0/tools/clang/lib/Driver/Tools.cpp 2012-11-13 12:03:33.000000000 +0000 +@@ -583,7 +583,11 @@ + + case llvm::Triple::Linux: { + if (getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUEABI) { +- FloatABI = "softfp"; ++ FloatABI = "soft"; ++ break; ++ } ++ if (getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) { ++ FloatABI = "hard"; + break; + } + } diff -Nru clang-3.0/debian/patches/27-dynamic-linker.diff clang-3.0/debian/patches/27-dynamic-linker.diff --- clang-3.0/debian/patches/27-dynamic-linker.diff 1970-01-01 00:00:00.000000000 +0000 +++ clang-3.0/debian/patches/27-dynamic-linker.diff 2012-11-13 12:12:44.000000000 +0000 @@ -0,0 +1,33 @@ +Description: set correct dynamic linker path for armhf + armhf uses a different dynamic linker path from armel +Author: Peter Michael Green <plugw...@debian.org> + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: <vendor|upstream|other>, <url of original patch> +Bug: <url in upstream bugtracker> +Bug-Debian: http://bugs.debian.org/<bugnumber> +Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> +Forwarded: <no|not-needed|url proving that it has been forwarded> +Reviewed-By: <name and email of someone who approved the patch> +Last-Update: <YYYY-MM-DD> + +Index: clang-3.0/tools/clang/lib/Driver/Tools.cpp +=================================================================== +--- clang-3.0.orig/tools/clang/lib/Driver/Tools.cpp 2012-11-13 12:04:59.000000000 +0000 ++++ clang-3.0/tools/clang/lib/Driver/Tools.cpp 2012-11-13 12:04:59.000000000 +0000 +@@ -4315,7 +4315,10 @@ + CmdArgs.push_back("/lib/ld-linux.so.2"); + else if (ToolChain.getArch() == llvm::Triple::arm || + ToolChain.getArch() == llvm::Triple::thumb) +- CmdArgs.push_back("/lib/ld-linux.so.3"); ++ if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) ++ CmdArgs.push_back("/lib/ld-linux-armhf.so.3"); ++ else ++ CmdArgs.push_back("/lib/ld-linux.so.3"); + else if (ToolChain.getArch() == llvm::Triple::ppc) + CmdArgs.push_back("/lib/ld.so.1"); + else if (ToolChain.getArch() == llvm::Triple::ppc64) diff -Nru clang-3.0/debian/patches/series clang-3.0/debian/patches/series --- clang-3.0/debian/patches/series 2012-02-25 13:05:54.000000000 +0000 +++ clang-3.0/debian/patches/series 2012-11-13 12:14:01.000000000 +0000 @@ -6,3 +6,5 @@ 23-strlcpy_strlcat_warning_removed.diff 24-path-multiarch.diff 25-amdfam10.diff +26-set-correct-float-abi.diff +27-dynamic-linker.diff diff -Nru clang-3.0/debian/rules clang-3.0/debian/rules --- clang-3.0/debian/rules 2011-10-04 12:58:06.000000000 +0000 +++ clang-3.0/debian/rules 2012-11-13 12:09:43.000000000 +0000 @@ -36,5 +36,6 @@ endif $(RM) -r $(D)/debian/ccache find utils -name '*.py[co]' | xargs rm -f + $(RM) tools/clang/include/clang/Debian/debian_path.h .PHONY: clean