This is an archive of the discontinued LLVM Phabricator instance.

Link libatomic.so during 32-bit builds.
Needs ReviewPublic

Authored by ZeGentzy on Oct 3 2019, 5:15 PM.

Details

Reviewers
chandlerc
Summary

The 32-bit version of LLVM failed on my computer with linker errors
saying that the __atomic_{load,store} symbols were undefined. See
https://gentz.rocks/files/1570147715/llvm_link_fail for full error log.

The 32-bit version of libatomic.so exposes no __atomic_*_8, unlike the
64-bit version of the library. Instead, 32-bit programs that want to use
non power of two atomics or atomics that are greater than 32-bits need the
__atomic_* functions.

Previously, the 32-bit LLVM builds would successfully compile the file
defined in check_working_cxx_atomics64 and think they don't need to
link in libatomic.so.

The reason for this is unknown to me. std::atomic<uint64_t> compiles
yet std::atomic<double> does not. Anyways, I've modified the tests to
test for both.

We also remove some code dupe between the 32-bit and 64-bit versions.

We also also unify the 64-bit version in CheckAtomic.cmake with the code in
CheckLibcxxAtomic.cmake. It appears that when CheckLibcxxAtomic.cmake was
made, CheckAtomic.cmake did not have a 64-bit version, but that is no longer
the case, so I see no reason not to merge them.

Diff Detail

Event Timeline

ZeGentzy created this revision.Oct 3 2019, 5:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2019, 5:15 PM

Hey @chandlerc, you seam to be the code owner for CMake stuff, so, could you take some time to look at these changes or forward them to the appropriate people? Thanks!

Also, can you think of a better name than pop_libatomics_vars? I realize it's not a good one, but my mind went blank trying to think of something.

ZeGentzy updated this revision to Diff 223344.Oct 4 2019, 5:30 PM
ZeGentzy edited the summary of this revision. (Show Details)Oct 5 2019, 12:28 PM

Merry Christmas! Also, ping.