Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang driver does not propagate -Bprefix to gcc toolchain #18237

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18238
Status NEW
Importance P normal
Reported by David Fang (fang@csl.cornell.edu)
Reported on 2013-12-12 19:39:38 -0800
Last modified on 2013-12-15 18:51:20 -0800
Version trunk
Hardware Macintosh MacOS X
CC geek4civic@gmail.com, iains-llvm@btconnect.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
/Volumes/Isolde/sources/LLVM-svn/gcc40-cmake-build/bin/clang++ -v -
B/sw/lib/odcctools/bin -I/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/include -fno-
common -no-integrated-as -fno-dwarf2-cfi-asm -fPIC -fvisibility-inlines-hidden -
Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -Wnon-
virtual-dtor -isysroot /Developer/SDKs/MacOSX10.4u.sdk -dynamiclib -Wl,-
headerpad_max_install_names  -undefined dynamic_lookup -target 10.4 -
L/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/clang/3.5/lib/darwin -
lclang_rt.ppc -o
../../../../lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib -
install_name /Users/fang/local/src/LLVM-svn/gcc40-stage2-
build/lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
CMakeFiles/RTAsan.osx.dir/asan_allocator2.cc.o ...
clang version 3.5
Target: 10.4
Thread model: posix
Selected GCC installation:
 "/sw/bin/g++" -v -I /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/include -fno-common -fno-dwarf2-cfi-asm -fPIC -fvisibility-inlines-hidden -pedantic -isysroot /Developer/SDKs/MacOSX10.4u.sdk -dynamiclib -undefined dynamic_lookup -L/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/clang/3.5/lib/darwin -install_name /Users/fang/local/src/LLVM-svn/gcc40-stage2-build/lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib -o ../../../../lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib -Wl,-headerpad_max_install_names -lclang_rt.ppc CMakeFiles/RTAsan.osx.dir/asan_allocator2.cc.o ...
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -
enable-werror --prefix=/usr --mandir=/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --
with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-
apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)
 /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool -dynamic -arch_only ppc -install_name /Users/fang/local/src/LLVM-svn/gcc40-stage2-build/lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib -noall_load -macosx_version_min 10.3 -multiply_defined suppress -syslibroot /Developer/SDKs/MacOSX10.4u.sdk -undefined dynamic_lookup -weak_reference_mismatches non-weak -o ../../../../lib/clang/3.5/lib/darwin/libclang_rt.asan_osx_dynamic.dylib /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/crt3.o -L/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/clang/3.5/lib/darwin -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../.. -headerpad_max_install_names -lclang_rt.ppc CMakeFiles/RTAsan.osx.dir/asan_allocator2.cc.o ... -lstdc++ -lgcc_s.10.4 -lgcc -lSystemStubs -lSystem

While I passed -Bprefix to clang++, the above g++ command-line is missing -B
altogether.

I have newer cctools in /sw/lib/odcctools/bin, including a newer linker.  Stage-
1 was linked using -Bprefix (works).
Quuxplusone commented 10 years ago
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 2acde8b..e6a14b8 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -4658,6 +4658,9 @@ void darwin::Assemble::ConstructJob(Compilation &C, const
JobAction &JA,
   // Derived from asm spec.
   AddDarwinArch(Args, CmdArgs);

+  // We probably want to allow use of newer assemblers.
+  // Args.AddAllArgs(CmdArgs, options::OPT_B);
+
   // Use -force_cpusubtype_ALL on x86 by default.
   if (getToolChain().getArch() == llvm::Triple::x86 ||
       getToolChain().getArch() == llvm::Triple::x86_64 ||
@@ -4971,6 +4974,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobA
ction &JA,
   // we follow suite for ease of comparison.
   AddLinkArgs(C, Args, CmdArgs, Inputs);

+  Args.AddAllArgs(CmdArgs, options::OPT_B);
   Args.AddAllArgs(CmdArgs, options::OPT_d_Flag);
   Args.AddAllArgs(CmdArgs, options::OPT_s);
   Args.AddAllArgs(CmdArgs, options::OPT_t);