From 2670dbb40f6aa181ef0898804c6e95ff6ce91f2c Mon Sep 17 00:00:00 2001 From: LunaTheFoxgirl Date: Wed, 20 Nov 2024 06:24:39 +0100 Subject: [PATCH] Fix objc link flag being added on non-darwin platforms --- driver/linker-gcc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/driver/linker-gcc.cpp b/driver/linker-gcc.cpp index 26197b3d39..50f5252749 100644 --- a/driver/linker-gcc.cpp +++ b/driver/linker-gcc.cpp @@ -715,7 +715,6 @@ void ArgsBuilder::addDefaultPlatformLibs() { // fallthrough case llvm::Triple::Darwin: case llvm::Triple::MacOSX: - this->addObjcStdlibLinkFlags(triple); case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD: case llvm::Triple::OpenBSD: @@ -738,6 +737,13 @@ void ArgsBuilder::addDefaultPlatformLibs() { break; } + if (triple.isOSDarwin()) { + + // libobjc is more or less required, so we link against it here. + // This could be prettier, though. + this->addObjcStdlibLinkFlags(triple); + } + if (triple.isWindowsGNUEnvironment()) { // This is really more of a kludge, as linking in the Winsock functions // should be handled by the pragma(lib, ...) in std.socket, but it