This is an archive of the discontinued LLVM Phabricator instance.

Use __atomic_exchange_n with GCC instead of Clang's __sync_swap
ClosedPublic

Authored by rnk on Oct 3 2014, 11:26 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 14390.Oct 3 2014, 11:26 AM
rnk retitled this revision from to Use __atomic_exchange_n with GCC instead of Clang's __sync_swap.
rnk updated this object.
rnk added a subscriber: Unknown Object (MLST).

Alternatively, I could do what the comment says and use C++11 atomics. Do we know if we can do that yet?

majnemer added inline comments.
src/cxa_default_handlers.cpp
109–110 ↗(On Diff #14390)

How about we just use __atomic_exchange_n instead of #ifdefing between the two?

Also, I'm pretty sure we can just use __ATOMIC_ACQ_REL here.

124–125 ↗(On Diff #14390)

Ditto.

rnk updated this revision to Diff 14396.Oct 3 2014, 12:44 PM

Look ma, no ifdefs!

majnemer added inline comments.Oct 3 2014, 12:48 PM
src/cxa_handlers.cpp
105 ↗(On Diff #14396)

Why is the extern "C" removed from here? Looks unrelated.

rnk added inline comments.Oct 3 2014, 12:54 PM
src/cxa_handlers.cpp
105 ↗(On Diff #14396)

I forgot to mention in the description that this was also necessary to silence this warning:
../projects/libcxxabi/src/cxa_handlers.cpp:105:24: warning: ‘cxa_new_handler’ initialized and declared ‘extern’
extern "C" new_handler
cxa_new_handler = 0;

majnemer accepted this revision.Oct 3 2014, 1:04 PM
majnemer added a reviewer: majnemer.

LGTM

This revision is now accepted and ready to land.Oct 3 2014, 1:04 PM
rnk closed this revision.Oct 3 2014, 1:13 PM
rnk updated this revision to Diff 14401.

Closed by commit rL219012 (authored by @rnk).

The removal of the extern "C" introduced a binary compatibility regression as mentioned here:

https://llvm.org/bugs/show_bug.cgi?id=23238