Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SingleSource/Atomic] Add preliminary tests for atomic builtins. #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Conditionally test with libclang_rt.atomic; always test with -latomic.
Logikable committed Feb 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9dc1b025d793f06594273549bf727eb5ea787c0b
13 changes: 10 additions & 3 deletions SingleSource/UnitTests/Atomic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,8 +2,15 @@
execute_process(COMMAND ${CMAKE_C_COMPILER} --print-file-name=libclang_rt.atomic.so
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That library isn't built by default, so almost nobody will have a copy. I assume we need to have some conditionals here to skip testing if the library isn't present?

Potentially we should additionally integration-test against -latomic (even if that comes via GCC), since that's what real users actually specify.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I'm not great with CMake -- what are better ways to do what I have here?

OUTPUT_VARIABLE _path_to_libatomic
OUTPUT_STRIP_TRAILING_WHITESPACE)
get_filename_component(_libatomic_dir ${_path_to_libatomic} DIRECTORY)
add_link_options("LINKER:${_path_to_libatomic},-rpath=${_libatomic_dir}")
if(NOT _path_to_libatomic STREQUAL "libclang_rt.atomic.so")
get_directory_property(CURRENT_LINK_OPTIONS LINK_OPTIONS)
get_filename_component(_libatomic_dir ${_path_to_libatomic} DIRECTORY)
add_link_options("LINKER:${_path_to_libatomic},-rpath=${_libatomic_dir}")

llvm_singlesource()
llvm_singlesource(PREFIX "libclang_rt-atomic-")
set_directory_properties(LINK_OPTIONS ${CURRENT_LINK_OPTIONS})
endif()

add_link_options("LINKER:-latomic")
llvm_singlesource(PREFIX "latomic-")