Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

C++11 atomics fail to link #19392

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR19393
Status NEW
Importance P normal
Reported by Scott Pakin (scott+llvm+bugzilla@pakin.org)
Reported on 2014-04-10 14:36:47 -0700
Last modified on 2014-04-10 14:36:59 -0700
Version trunk
Hardware PC Linux
CC llvm-bugs@lists.llvm.org, scott+llvm+bugzilla@pakin.org
Fixed by commit(s)
Attachments atomics.cpp (170 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 12362
Minimal reproducer, courtesy of Aleksandr Drozd

When using std::atomic, this works:

    $ g++ -std=c++11 -o atomics atomics.cpp

This doesn't:

    $ g++ -fplugin=/usr/local/lib/dragonegg.so -std=c++11 -o atomics atomics.cpp
    /tmp/ccYWBxLQ.o: In function `std::__atomic_base<int>::store(int, std::memory_order)':
    atomics.cpp:(.text._ZNSt13__atomic_baseIiE5storeEiSt12memory_order[_ZNSt13__atomic_baseIiE5storeEiSt12memory_order]+0x44): undefined reference to `__atomic_store_4'
    /tmp/ccYWBxLQ.o: In function `std::__atomic_base<int>::load(std::memory_order) const':
    atomics.cpp:(.text._ZNKSt13__atomic_baseIiE4loadESt12memory_order[_ZNKSt13__atomic_baseIiE4loadESt12memory_order]+0x38): undefined reference to `__atomic_load_4'
    collect2: error: ld returned 1 exit status

Here's what I'm running:

    $ g++ --version | head -1
    g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
    $ svn info | grep Revision
    Revision: 205933
    $ uname -a
    Linux morbo 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I've attached a minimal reproducer.

Thanks in advance for your attention,
-- Scott
Quuxplusone commented 10 years ago

Attached atomics.cpp (170 bytes, text/x-c++src): Minimal reproducer, courtesy of Aleksandr Drozd