[PATCH] fix llvm linker issue with dbg.declare

Manman Ren mren at apple.com
Thu Jan 31 13:20:23 PST 2013


Hi Alexey,

The fix is check in at r174093.

Thanks,
Manman

On Jan 31, 2013, at 12:05 AM, Alexey Samsonov <samsonov at google.com> wrote:

> Hi Manman!
> 
> Sorry, I had to revert this in r174048.
> With this patch Clang crashes when compiling googletest sources with "-g -O2". See the error report:
> 
> $ ./bin/clang++ -O2 -g /usr/local/google/llvm/utils/unittest/googletest/gtest-all.cc -I /usr/local/google/llvm/utils/unittest/googletest/include -I /usr/local/google/llvm/include -I /usr/local/google/llvm_build_clang/include -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -c -o gtest.o
> function-local metadata used in wrong function
> metadata !{%"class.std::vector.14"* %array_}
>   %array_ = getelementptr inbounds %"class.testing::TestPartResultArray"* %this, i64 0, i32 0, !dbg !29957
> Broken module found, compilation aborted!
> 0  clang-3.3       0x0000000001133a45 llvm::sys::PrintStackTrace(_IO_FILE*) + 37
> 1  clang-3.3       0x0000000001133f33
> 2  libpthread.so.0 0x00007f209a219cb0
> 3  libc.so.6       0x00007f209966f425 gsignal + 53
> 4  libc.so.6       0x00007f2099672b8b abort + 379
> 5  clang-3.3       0x000000000109382e
> 6  clang-3.3       0x0000000001093526
> 7  clang-3.3       0x000000000107c3cc llvm::FPPassManager::runOnFunction(llvm::Function&) + 364
> 8  clang-3.3       0x000000000107c63b llvm::FPPassManager::runOnModule(llvm::Module&) + 43
> 9  clang-3.3       0x000000000107c98e llvm::MPPassManager::runOnModule(llvm::Module&) + 430
> 10 clang-3.3       0x000000000107d02b llvm::PassManagerImpl::run(llvm::Module&) + 539
> 11 clang-3.3       0x000000000107d19a llvm::PassManager::run(llvm::Module&) + 10
> 12 clang-3.3       0x0000000001150757 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 5799
> 13 clang-3.3       0x000000000114db6b
> 14 clang-3.3       0x00000000013b5753 clang::ParseAST(clang::Sema&, bool, bool) + 515
> 15 clang-3.3       0x000000000114cd6c clang::CodeGenAction::ExecuteAction() + 540
> 16 clang-3.3       0x000000000130ec01 clang::FrontendAction::Execute() + 113
> 17 clang-3.3       0x00000000012f1e8d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 909
> 18 clang-3.3       0x0000000001136775 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2901
> 19 clang-3.3       0x0000000000631a63 cc1_main(char const**, char const**, char const*, void*) + 675
> 20 clang-3.3       0x000000000062e494 main + 3140
> 21 libc.so.6       0x00007f209965a76d __libc_start_main + 237
> 22 clang-3.3       0x000000000062d725
> Stack dump:
> 0.	Program arguments: /usr/local/google/llvm_build_clang/bin/clang-3.3 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name gtest-all.cc -mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -g -coverage-file /usr/local/google/llvm_build_clang/gtest.o -resource-dir /usr/local/google/llvm_build_clang/bin/../lib/clang/3.3 -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /usr/local/google/llvm/utils/unittest/googletest/include -I /usr/local/google/llvm/include -I /usr/local/google/llvm_build_clang/include -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/google/llvm_build_clang/bin/../lib/clang/3.3/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdeprecated-macro -fdebug-compilation-dir /usr/local/google/llvm_build_clang -ferror-limit 19 -fmessage-length 212 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o gtest.o -x c++ /usr/local/google/llvm/utils/unittest/googletest/gtest-all.cc 
> 1.	<eof> parser at end of file
> 2.	Code generation
> 3.	Running pass 'Function Pass Manager' on module '/usr/local/google/llvm/utils/unittest/googletest/gtest-all.cc'.
> 4.	Running pass 'Module Verifier' on function '@_ZN7testing32ScopedFakeTestPartResultReporter20ReportTestPartResultERKNS_14TestPartResultE'
> clang-3: error: unable to execute command: Aborted (core dumped)
> clang-3: error: clang frontend command failed due to signal (use -v to see invocation)
> clang version 3.3 (trunk 174045)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> clang-3: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
> clang-3: note: diagnostic msg: 
> ********************
> 
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang-3: note: diagnostic msg: /tmp/gtest-all-Wfnt12.cpp
> clang-3: note: diagnostic msg: /tmp/gtest-all-Wfnt12.sh
> clang-3: note: diagnostic msg: 
> 
> ********************
> 
> Attaching the the compilation shell script.
> 
> 
> 
> On Wed, Jan 30, 2013 at 9:44 PM, Manman Ren <mren at apple.com> wrote:
> 
> Hi all,
> 
> Since I got no response on this patch and we need this patch soon, I committed at r173946.
> If you have any concern about this patch, please review after commit.
> 
> Thanks,
> Manman
> 
> On Jan 29, 2013, at 2:01 PM, Manman Ren <mren at apple.com> wrote:
> 
> >
> > ping
> >
> > Thanks,
> > Manman
> >
> > On Jan 28, 2013, at 3:21 PM, Manman Ren <mren at apple.com> wrote:
> >
> >>
> >> Hello,
> >>
> >> Given source IR:
> >> call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !14), !dbg !15
> >> we used to generate
> >> call void @llvm.dbg.declare(metadata !27, metadata !28), !dbg !29
> >> !27 = metadata !{null}
> >>
> >> With this patch, we will generate
> >> call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !27), !dbg !28
> >>
> >> Looking up %argc.addr in ValueMap will return null. Since %argc.addr is already
> >> correctly set up, we can use identity mapping.
> >>
> >> Please review,
> >>
> >> Thanks,
> >> Manman
> >>
> >> <linker.patch>_______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
> 
> -- 
> Alexey Samsonov, MSK
> <bug.sh>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130131/95f67f80/attachment.html>


More information about the llvm-commits mailing list