Skip to content

Commit c9b3ded

Browse files
Enable BPF target in LLVM backend by default (#85630)
Adding the BPF target to the LLVM backend, allows eBPF programs to be built using the clang that ships with the OSS toolchains. Should be a low-risk change, which I've tested locally by explicitly specifying the `--llvm-targets-to-build` flag: ```console % build/Ninja-ReleaseAssert/llvm-linux-aarch64/bin/clang -print-targets | grep bpf bpf - BPF (host endian) bpfeb - BPF (big endian) bpfel - BPF (little endian) % touch empty.c % build/Ninja-ReleaseAssert/llvm-linux-aarch64/bin/clang -target bpf -c empty.c -o empty.o % file empty.o empty.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), not stripped ``` Looks like a negligible increase in build time vs previous PR toolchain builds: | Job | Build script analyzer total | LLVM time (sec) | |----------------------|-----------------------------|-------------------| | #1584 (this PR)[^0] | 2hr 21m 53s | 1178.85 | | #1583 (previous)[^1] | 2hr 22m 8s | 1171.51 | | ...failed runs... | ...failed runs... | ...failed runs... | | #1578 (previous)[^2] | 2hr 22m 40s | 1171.47 | | #1577 (previous)[^3] | 2hr 21m 48s | 1168.54 | | #1576 (previous)[^4] | 2hr 20m 39s | 1174.80 | And an increased of size comparison of PR toolchain(s) vs last nightly main, it looks like it's gone up a bit, but not by this PR: | PR | `stat -c %s` | Link | |-------------|--------------|----------------------------------------------------------------| | — | 1187466342 | swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu20.04.tar.gz[^5] | | This PR | 1212116532 | pull-request/85630/1584/ubuntu2204/PR-ubuntu2204.tar.gz[^6] | | Previous PR | 1213404191 | pull-request/85358/1583/ubuntu2204/PR-ubuntu2204.tar.gz[^7] | | Previous PR | 1213116282 | pull-request/79684/1578/ubuntu2204/PR-ubuntu2204.tar.gz[^8] | [^0]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1584/consoleText [^1]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1583/consoleText [^2]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1578/consoleText [^3]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1577/consoleText [^4]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1576/consoleText [^5]: https://download.swift.org/development/ubuntu2004/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu20.04.tar.gz [^6]: https://download.swift.org/tmp/pull-request/85630/1584/ubuntu2204/PR-ubuntu2204.tar.gz [^7]: https://download.swift.org/tmp/pull-request/85358/1583/ubuntu2204/PR-ubuntu2204.tar.gz [^8]: https://download.swift.org/tmp/pull-request/79684/1578/ubuntu2204/PR-ubuntu2204.tar.gz
1 parent 90e1214 commit c9b3ded

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ def create_argument_parser():
14511451
help='enable building llvm using modules')
14521452

14531453
option('--llvm-targets-to-build', store,
1454-
default='X86;ARM;AArch64;PowerPC;SystemZ;Mips;RISCV;WebAssembly;AVR',
1454+
default='X86;ARM;AArch64;PowerPC;SystemZ;Mips;RISCV;WebAssembly;AVR;BPF',
14551455
help='LLVM target generators to build')
14561456

14571457
option('--llvm-ninja-targets', append,

utils/build_swift/tests/expected_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
'llvm_max_parallel_lto_link_jobs':
256256
defaults.LLVM_MAX_PARALLEL_LTO_LINK_JOBS,
257257
'llvm_targets_to_build':
258-
'X86;ARM;AArch64;PowerPC;SystemZ;Mips;RISCV;WebAssembly;AVR',
258+
'X86;ARM;AArch64;PowerPC;SystemZ;Mips;RISCV;WebAssembly;AVR;BPF',
259259
'tsan_libdispatch_test': False,
260260
'long_test': False,
261261
'lto_type': None,

0 commit comments

Comments
 (0)