Skip to content

Commit a3d91eb

Browse files
committed
Fix “This version of lld does not support linking”
1 parent f97b5b1 commit a3d91eb

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
FROM alpine:3.20
22

3-
RUN apk add cmake ninja clang lld python3 git
3+
RUN apk add cmake ninja clang lld python3 git patch
44

55
ENV CC=clang CXX=clang++
66

7+
COPY build.sh /work/build.sh
8+
COPY patches /work/patches
9+
COPY llvm-project /work/llvm-project
10+
RUN patch -p1 -d /work/llvm-project < /work/patches/lld-support-macho-files.patch
11+
712
WORKDIR /work
813

914
ENTRYPOINT [ "/bin/sh" ]

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ root="${PWD}"
66
stage="${root}/build/bin"
77
install="${root}/build/install"
88

9-
rm -rf "${install}" "${stage}" output
9+
rm -rf "${install}" "${stage}" output/toolset.tar.gz
1010
mkdir -p "${install}" "${stage}" output
1111

1212
echo "[info] Building..."

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ services:
33
build:
44
context: .
55
volumes:
6-
- .:/work
7-
- build:/work/build
6+
- ./output:/work/output
87
container_name: builder
98
stdin_open: true
109
tty: true

patches/lld-support-macho-files.patch

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
2+
index 47135196b369..c3f7c434ffca 100644
3+
--- a/lld/MachO/InputFiles.cpp
4+
+++ b/lld/MachO/InputFiles.cpp
5+
@@ -157,11 +157,6 @@ static bool checkCompatibility(const InputFile *input) {
6+
if (platformInfos.empty())
7+
return true;
8+
9+
- // Swift LLVM fork downstream change start
10+
- error("This version of lld does not support linking for platform " + getPlatformName(platformInfos.front().target.Platform));
11+
- return false;
12+
- // Swift LLVM fork downstream change end
13+
-
14+
auto it = find_if(platformInfos, [&](const PlatformInfo &info) {
15+
return removeSimulator(info.target.Platform) ==
16+
removeSimulator(config->platform());

0 commit comments

Comments
 (0)