Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion libcxx/cmake/caches/AIX.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
set(CMAKE_C_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-G -Wl,-bcdtors:all:-2147483548:s" CACHE STRING "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@

// Make sure the install_name is /usr/lib.
//
// In particular, make sure we don't use any @rpath in the load commands. When building as
// a system library, it is important to hardcode the installation paths in the dylib, because
// various tools like dyld and ld64 will treat us specially if they recognize us as being a
// system library.
// In particular, make sure we don't use any @rpath-relative paths in the load commands.
// When building as a system library, it is important to hardcode the installation paths
// in the dylib, because various tools like dyld and ld64 will treat us specially if they
// recognize us as being a system library.
//
// TODO: We currently don't do that correctly in the CMake build.
//
// XRUNX: otool -L "%{lib}/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib'
// XRUNX: ! otool -l "%{lib}/libc++.1.dylib" | grep -E "LC_RPATH|@loader_path|@rpath"
// XRUNX: otool -l "%{lib}/libc++.1.dylib" | grep --invert-match -E "@loader_path|@rpath"

// Make sure we don't set a RPATH when we build the library. Since we are building a system
// library, we are supposed to find our dependencies at the usual system-provided locations,
// which doesn't require setting a RPATH in the library itself.
//
// RUN: otool -l "%{lib}/libc++.1.dylib" | grep --invert-match -e "LC_RPATH"

// Make sure the compatibility_version of libc++ is 1.0.0.
// Failure to respect this can result in applications not being able to find libc++
Expand Down
38 changes: 38 additions & 0 deletions libcxx/test/libcxx/vendor/llvm/apple-install-properties.sh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// REQUIRES: stdlib=libc++ && target={{.+}}-apple-{{.+}}

// This file checks various properties of the installation of libc++ when built as
// part of the LLVM releases, on Apple platforms.

// Make sure we install the libc++ headers in the right location.
//
// RUN: stat "%{include}/__config"

// Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
//
// RUN: stat "%{lib}/libc++.1.dylib"
// RUN: stat "%{lib}/libc++experimental.a"

// Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
//
// RUN: stat "%{lib}/libc++.dylib"
// RUN: readlink "%{lib}/libc++.dylib" | grep "libc++.1.dylib"

// Make sure we don't set a RPATH when we build the library. Since we are building a system
// library, we are supposed to find our dependencies at the usual system-provided locations,
// which doesn't require setting a RPATH in the library itself.
//
// RUN: otool -l "%{lib}/libc++.1.dylib" | grep --invert-match -e "LC_RPATH"

// Make sure the compatibility_version of libc++ is 1.0.0.
// Failure to respect this can result in applications not being able to find libc++
// when they are loaded by dyld, if the compatibility version was bumped.
//
// RUN: otool -L "%{lib}/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@
// TODO: We currently don't do that correctly in the CMake build.
//
// XRUNX: otool -L "%{lib}/libc++abi.dylib" | grep '/usr/lib/libc++abi.dylib'
// XRUNX: ! otool -l "%{lib}/libc++abi.dylib" | grep -E "LC_RPATH|@loader_path|@rpath"
// XRUNX: otool -l "%{lib}/libc++abi.dylib" | grep --invert-match -E "LC_RPATH|@loader_path|@rpath"

// Make sure we don't set a RPATH when we build the library. Since we are building a system
// library, we are supposed to find our dependencies at the usual system-provided locations,
// which doesn't require setting a RPATH in the library itself.
//
// RUN: otool -l "%{lib}/libc++abi.dylib" | grep --invert-match -e "LC_RPATH"

// Make sure the compatibility_version of libc++abi is 1.0.0. Failure to respect this can result
// in applications not being able to find libc++abi when they are loaded by dyld, if the
Expand Down
37 changes: 37 additions & 0 deletions libcxxabi/test/vendor/llvm/apple-install-properties.sh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// REQUIRES: stdlib=libc++ && target={{.+}}-apple-{{.+}}

// This file checks various properties of the installation of libc++abi when built as
// part of the LLVM releases, on Apple platforms.

// Make sure we install the libc++abi headers in the right location.
//
// RUN: stat "%{include}/cxxabi.h"

// Make sure we install libc++abi.dylib in the right location.
//
// RUN: stat "%{lib}/libc++abi.1.dylib"

// Make sure we install a symlink from libc++abi.dylib to libc++abi.1.dylib.
//
// RUN: stat "%{lib}/libc++abi.dylib"
// RUN: readlink "%{lib}/libc++abi.dylib" | grep "libc++abi.1.dylib"

// Make sure we don't set a RPATH when we build the library. Since we are building a system
// library, we are supposed to find our dependencies at the usual system-provided locations,
// which doesn't require setting a RPATH in the library itself.
//
// RUN: otool -l "%{lib}/libc++abi.dylib" | grep --invert-match -e "LC_RPATH"

// Make sure the compatibility_version of libc++abi is 1.0.0. Failure to respect this can result
// in applications not being able to find libc++abi when they are loaded by dyld, if the
// compatibility version was bumped.
//
// RUN: otool -L "%{lib}/libc++abi.dylib" | grep "libc++abi.1.dylib" | grep "compatibility version 1.0.0"
2 changes: 2 additions & 0 deletions runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This file handles building LLVM runtime sub-projects.
cmake_minimum_required(VERSION 3.20.0)

set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)

# Add path for custom and the LLVM build's modules to the CMake module path.
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
Expand Down