|
82 | 82 | # https://github.com/ldc-developers/ldc/issues/4462:
|
83 | 83 | # When using LTO, we need to explicitly export ~all symbols for plugin support via `ld64 -exported_symbol '__*'`.
|
84 | 84 | # Additionally `-w` to suppress resulting linker warnings.
|
| 85 | + # |
| 86 | + # We also need to work around issues with the used LDC v1.35.0 host/bootstrap compiler: |
| 87 | + # * Specify a macOS triple with OS version. And exclude LTO-able host druntime/Phobos because precompiled without OS version. |
| 88 | + # * Manually specify the path to the bundled libLTO.dylib (broken for *universal* packages for LDC <= v1.40.0). |
85 | 89 | extra_cmake_flags: >-
|
86 | 90 | -DBUILD_LTO_LIBS=ON
|
87 |
| - -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w" |
| 91 | + -DD_COMPILER_FLAGS="-O -flto=full -L-exported_symbol '-L__*' -L-w -flto-binary=$PWD/../bootstrap-ldc/lib-x86_64/libLTO.dylib -mtriple=x86_64-apple-macos$MACOSX_DEPLOYMENT_TARGET" |
88 | 92 | -DEXTRA_CXXFLAGS=-flto=full
|
89 | 93 | with_pgo: true
|
90 | 94 |
|
|
95 | 99 | -DBUILD_LTO_LIBS=ON
|
96 | 100 | extra_cmake_flags: >-
|
97 | 101 | -DBUILD_LTO_LIBS=ON
|
98 |
| - -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w" |
| 102 | + -DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w -flto-binary=$PWD/../bootstrap-ldc/lib-arm64/libLTO.dylib" |
99 | 103 | -DEXTRA_CXXFLAGS=-flto=full
|
100 | 104 | with_pgo: true
|
101 | 105 |
|
@@ -161,16 +165,21 @@ jobs:
|
161 | 165 | llvm_version: ${{ matrix.llvm_version || env.LLVM_VERSION }}
|
162 | 166 | arch: ${{ matrix.arch }}
|
163 | 167 | - name: Build bootstrap LDC
|
164 |
| - if: matrix.os != 'macos-15' |
| 168 | + if: runner.os != 'macOS' |
165 | 169 | uses: ./.github/actions/2-build-bootstrap
|
166 | 170 | with:
|
167 | 171 | cmake_flags: ${{ matrix.bootstrap_cmake_flags }}
|
168 | 172 | arch: ${{ matrix.arch }}
|
169 |
| - # FIXME: on macOS arm64, LLVM 18 (from LDC) and LLVM 17 (from Xcode 16) seem incompatible, |
170 |
| - # leading to sporadic 'libc++abi: Pure virtual function called!' compiler crashes |
171 |
| - - name: 'macOS 15: Use host LDC (with Xcode-compatible LLVM version) as bootstrap LDC' |
172 |
| - if: matrix.os == 'macos-15' |
173 |
| - run: ln -s $(dirname $(dirname $(which ldmd2))) ../bootstrap-ldc |
| 173 | + # FIXME: on macOS, mixing newer LLVM from bootstrap LDC with older LLVM from Xcode clang is problematic, |
| 174 | + # leading to sporadic 'libc++abi: Pure virtual function called!' compiler crashes etc. |
| 175 | + - name: 'macOS: Use host LDC (with Xcode-compatible LLVM version) as bootstrap LDC' |
| 176 | + if: runner.os == 'macOS' |
| 177 | + run: | |
| 178 | + ln -s $(dirname $(dirname $(which ldmd2))) ../bootstrap-ldc |
| 179 | + # work around a v1.35.0 bug - need to rename libLTO-ldc.dylib to make it loadable |
| 180 | + if [[ '${{ matrix.arch }}' == 'x86_64' ]]; then |
| 181 | + mv ../bootstrap-ldc/lib-x86_64/libLTO-ldc.dylib ../bootstrap-ldc/lib-x86_64/libLTO.dylib |
| 182 | + fi |
174 | 183 | - name: Build LDC with PGO instrumentation & gather profile from compiling default libs
|
175 | 184 | if: matrix.with_pgo
|
176 | 185 | uses: ./.github/actions/2a-build-pgo
|
|
0 commit comments