lanl / Byfl

Program analysis tool based on software performance counters
Other
56 stars 15 forks source link

byfl and C++11 atomics #1

Closed undertherain closed 10 years ago

undertherain commented 10 years ago

I'm trying to use byfl for C++ code with some features from the recent revision of the standard, particularly atomics.

Here is little code snippet to illustrate the issue:

#include <iostream>
#include <atomic>
int main(int argc, char * argv[])
{
    std::atomic<int> i;
    i=5;
    std::cout<<"Hello atmoic i = "<<i<<" !\n";
    return 0;
}

If I compile it with "g++ -std=c++11 hello.cpp" command - all is fine if I type "bf-g++ -std=c++11 hello.cpp" -the following message comes out:

blackbird@rc017[j:0,hello]$ bf-g++ -std=c++11 hello.cpp 
/tmp/hello-c7a4f9.o: In function `std::__atomic_base<int>::store(int, std::memory_order)':
/opt/gcc-4.8.3/include/c++/4.8.2/bits/atomic_base.h:474: undefined reference to `__atomic_store_4'
/tmp/hello-c7a4f9.o: In function `std::__atomic_base<int>::load(std::memory_order) const':
/opt/gcc-4.8.3/include/c++/4.8.2/bits/atomic_base.h:496: undefined reference to `__atomic_load_4'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
bf-g++: Aborting
spakin commented 10 years ago

It turns out that this is a DragonEgg bug. I just filed Bug 19393 in LLVM Bugzilla. Let's hope someone picks that up and fixes it.

For future reference, I tracked down the problem with the help of bf-g++'s -bf-disable option. When I used your reproducer and command like I received the same error message that you did, which is a good sign. The link also failed with -bf-disable=byfl, which exonerates Byfl. (Hooray!) However, your reproducer linked correctly when built with -bf-disable=dragonegg, which points the finger at DragonEgg as being the troublemaker.

Thanks for the bug report.