[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-19 Thread Louis Dionne via cfe-commits

https://github.com/ldionne closed 
https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-18 Thread Eric Miotto via cfe-commits

https://github.com/edymtt updated 
https://github.com/llvm/llvm-project/pull/77806

>From 1530d4c137642715d11b5b8b8e2aefcb7566d7c9 Mon Sep 17 00:00:00 2001
From: Eric Miotto 
Date: Thu, 18 Jan 2024 15:22:35 -0800
Subject: [PATCH] [CMake] Detect properly new linker introduced in Xcode 15

As explained in [1], this linker is functionally equivalent to the
classic one (`ld64`) for build system purposes -- in particular to
enable the use of order files to link `clang`.
For this reason, in addition to fixing the detection rename
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of
such detection more clear -- this should not cause any issue to
downstream users, from a quick serch in
Sourcegraph [2], only Swift uses the value of this variable (which I
will take care of updating in due time).

[1]:
https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking
[2]:
https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo
rdar://120740222
---
 clang/tools/driver/CMakeLists.txt | 4 ++--
 llvm/cmake/modules/AddLLVM.cmake  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a555..d70b92b0984e52 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d..5e989618552824 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-18 Thread Louis Dionne via cfe-commits

https://github.com/ldionne edited 
https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-17 Thread Eric Miotto via cfe-commits

https://github.com/edymtt updated 
https://github.com/llvm/llvm-project/pull/77806

>From c97e07011f2f780e29aa7cd5db9bfec8c3b4a6a8 Mon Sep 17 00:00:00 2001
From: Eric Miotto <1094986+edy...@users.noreply.github.com>
Date: Thu, 11 Jan 2024 08:27:21 -0800
Subject: [PATCH] [CMake] Detect properly new linker introduced in Xcode 15

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
is functionally equivalent to the classic one (`ld64`) for build system
purposes -- in particular to enable the use of order files to link
`clang`.
For this reason, in addition to fixing the detection rename
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of
such detection more clear -- this should not cause any issue to
downstream users, from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo)
only Swift uses the value of this variable (which I will take care of
updating in due time).

rdar://120740222
---
 clang/tools/driver/CMakeLists.txt | 4 ++--
 llvm/cmake/modules/AddLLVM.cmake  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a5553..d70b92b0984e52f 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d2..5e9896185528246 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-17 Thread Louis Dionne via cfe-commits

https://github.com/ldionne approved this pull request.


https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-17 Thread Louis Dionne via cfe-commits


@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")

ldionne wrote:

Ahhh, now this all makes sense! I hadn't noticed that you switched to 
`PROGRAM:ld`.

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-16 Thread Eric Miotto via cfe-commits

https://github.com/edymtt edited https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-16 Thread Eric Miotto via cfe-commits

https://github.com/edymtt edited https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-16 Thread Eric Miotto via cfe-commits


@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")

edymtt wrote:

Yes, that's the intent -- in fact we are not checking the `PROJECT` part 
anymore, but the `PROGRAM` one, which I found empirically remains more "stable" 
across Xcode versions (while not making the check needlessly complicated with 
regexes):

```
> .../Xcode14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
>  -v
@(#)PROGRAM:ld  PROJECT:ld64-857.1
...
```

```
> .../Xcode15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
>  -v
@(#)PROGRAM:ld  PROJECT:dyld-1022.1
...
```

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-16 Thread Louis Dionne via cfe-commits


@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")

ldionne wrote:

I'm not certain I understand -- isn't this patch missing something so that it 
keeps working on pre Xcode 15 toolchains? Libc++ supports Xcode 15 only, but 
the rest of LLVM probably supports older versions as well?

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-15 Thread Eric Miotto via cfe-commits

edymtt wrote:

(Rebased on top of recent changes to take format changes in 
`clang/docs/HLSL/FunctionCalls.rst`

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-15 Thread Eric Miotto via cfe-commits

https://github.com/edymtt updated 
https://github.com/llvm/llvm-project/pull/77806

>From 0a0162a13225512910d7ed10ee70811dea67dff0 Mon Sep 17 00:00:00 2001
From: Eric Miotto <1094986+edy...@users.noreply.github.com>
Date: Thu, 11 Jan 2024 08:27:21 -0800
Subject: [PATCH] [CMake] Detect properly new linker introduced in Xcode 15

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
is functionally equivalent to the classic one (`ld64`) for build system
purposes -- in particular to enable the use of order files to link
`clang`.
For this reason, in addition to fixing the detection rename
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of
such detection more clear -- this should not cause any issue to
downstream users, from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo)
only Swift uses the value of this variable (which I will take care of
updating in due time).

rdar://120740222
---
 clang/tools/driver/CMakeLists.txt | 4 ++--
 llvm/cmake/modules/AddLLVM.cmake  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a5553..d70b92b0984e52f 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d2..5e9896185528246 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread Eric Miotto via cfe-commits

edymtt wrote:

macOS testing triggered on https://github.com/apple/llvm-project/pull/7962

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [CMake] Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread Eric Miotto via cfe-commits

https://github.com/edymtt edited https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] CMake: Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread Eric Miotto via cfe-commits

https://github.com/edymtt updated 
https://github.com/llvm/llvm-project/pull/77806

>From 7a7f803cfb986f80e00a2615da6d861acbc1bab8 Mon Sep 17 00:00:00 2001
From: Eric Miotto <1094986+edy...@users.noreply.github.com>
Date: Thu, 11 Jan 2024 08:27:21 -0800
Subject: [PATCH] [CMake] Detect properly new linker introduced in Xcode 15

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
is functionally equivalent to the classic one (`ld64`) for build system
purposes -- in particular to enable the use of order files to link
`clang`.
For this reason, in addition to fixing the detection rename
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of
such detection more clear -- this should not cause any issue to
downstream users, from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo)
only Swift uses the value of this variable (which I will take care of
updating in due time).

rdar://120740222
---
 clang/tools/driver/CMakeLists.txt | 4 ++--
 llvm/cmake/modules/AddLLVM.cmake  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a555..d70b92b0984e52 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d..5e989618552824 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] CMake: Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Eric Miotto (edymtt)


Changes

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
 is functionally equivalent to the classic one (`ld64`) for build system 
purposes -- in particular to enable the use of order files to link `clang`.
For this reason, in addition to fixing the detection rename 
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of such 
detection more clear -- this should not cause any issue to downstream users, 
from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txtpatternType=standardsm=1groupBy=repo)
 only Swift uses the value of this variable (which I will take care of updating 
in due time).

rdar://120740222

---
Full diff: https://github.com/llvm/llvm-project/pull/77806.diff


2 Files Affected:

- (modified) clang/tools/driver/CMakeLists.txt (+2-2) 
- (modified) llvm/cmake/modules/AddLLVM.cmake (+3-3) 


``diff
diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a555..d70b92b0984e52 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d..5e989618552824 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

``




https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] CMake: Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread via cfe-commits

github-actions[bot] wrote:

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/77806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] CMake: Detect properly new linker introduced in Xcode 15 (PR #77806)

2024-01-11 Thread Eric Miotto via cfe-commits

https://github.com/edymtt created 
https://github.com/llvm/llvm-project/pull/77806

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
 is functionally equivalent to the classic one (`ld64`) for build system 
purposes -- in particular to enable the use of order files to link `clang`.
For this reason, in addition to fixing the detection rename 
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of such 
detection more clear -- this should not cause any issue to downstream users, 
from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo)
 only Swift uses the value of this variable (which I will take care of updating 
in due time).

rdar://120740222

>From 3658468430908c88af4cc0bcaa38107f1c5cbf8f Mon Sep 17 00:00:00 2001
From: Eric Miotto <1094986+edy...@users.noreply.github.com>
Date: Thu, 11 Jan 2024 08:27:21 -0800
Subject: [PATCH] CMake: Detect properly new linker introduced in Xcode 15

[This 
linker](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking)
is functionally equivalent to the classic one (`ld64`) for build system
purposes -- in particular to enable the use of order files to link
`clang`.
For this reason, in addition to fixing the detection rename
`LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of
such detection more clear -- this should not cause any issue to
downstream users, from a quick serch in
[Sourcegraph](https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt=standard=1=repo)
only Swift uses the value of this variable (which I will take care of
updating in due time).

rdar://120740222
---
 clang/tools/driver/CMakeLists.txt | 4 ++--
 llvm/cmake/modules/AddLLVM.cmake  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 2182486f93a555..d70b92b0984e52 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -103,10 +103,10 @@ if (APPLE)
 endif()
 
 if(CLANG_ORDER_FILE AND
-(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
+(LLVM_LINKER_IS_APPLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
   include(LLVMCheckLinkerFlag)
 
-  if (LLVM_LINKER_IS_LD64 OR (LLVM_LINKER_IS_LLD AND APPLE))
+  if (LLVM_LINKER_IS_APPLE OR (LLVM_LINKER_IS_LLD AND APPLE))
 set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
   elseif (LLVM_LINKER_IS_GOLD)
 set(LINKER_ORDER_FILE_OPTION 
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 14c0837c35964d..5e989618552824 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -211,10 +211,10 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 )
 
   if(APPLE)
-if("${stderr}" MATCHES "PROJECT:ld64")
+if("${stderr}" MATCHES "PROGRAM:ld")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_LD64 YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: ld64")
+  set(LLVM_LINKER_IS_APPLE YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Apple")
 elseif("${stderr}" MATCHES "^LLD" OR
"${stdout}" MATCHES "^LLD")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits