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

macOS: Don't link lib{pthread,m} as platform libs #4580

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
os: macos-14
host_dc: ldc-beta
llvm_version: 17.0.5
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
cmake_flags: -DBUILD_SHARED_LIBS=ON -DRT_SUPPORT_SANITIZERS=ON -DD_COMPILER_FLAGS=-platformlib= -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
- job_name: macOS 14, LLVM 16, latest LDC beta
os: macos-14
host_dc: ldc-beta
llvm_version: 16.0.5
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
cmake_flags: -DBUILD_SHARED_LIBS=OFF -DD_COMPILER_FLAGS=-platformlib= -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/zstd/lib
- job_name: Ubuntu 20.04, LLVM 15, latest LDC beta
os: ubuntu-20.04
host_dc: ldc-beta
Expand Down
9 changes: 5 additions & 4 deletions driver/linker-gcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ void ArgsBuilder::addDefaultPlatformLibs() {

switch (triple.getOS()) {
case llvm::Triple::Linux:
addSoname = true;
if (triple.getEnvironment() == llvm::Triple::Android) {
addSoname = true;
args.push_back("-ldl");
args.push_back("-lm");
break;
Expand All @@ -682,15 +682,16 @@ void ArgsBuilder::addDefaultPlatformLibs() {
args.push_back("-lrt");
args.push_back("-ldl");
// fallthrough
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::FreeBSD:
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::DragonFly:
addSoname = true;
args.push_back("-lpthread");
args.push_back("-lm");
// fallthrough
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
addSoname = true;
break;

case llvm::Triple::Solaris:
Expand Down
2 changes: 2 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ if("${C_SYSTEM_LIBS}" STREQUAL "AUTO")
set(C_SYSTEM_LIBS m pthread rt dl)
elseif("${TARGET_SYSTEM}" MATCHES "FreeBSD")
set(C_SYSTEM_LIBS m pthread execinfo z)
elseif("${TARGET_SYSTEM}" MATCHES "APPLE")
set(C_SYSTEM_LIBS )
else()
set(C_SYSTEM_LIBS m pthread)
endif()
Expand Down
Loading