Skip to content

Commit

Permalink
Merge pull request #381 from serpent-os/tooling-flags-2025
Browse files Browse the repository at this point in the history
boulder: Numerous toolchain changes
  • Loading branch information
ikeycode authored Jan 17, 2025
2 parents f0022a8 + 0a484cd commit ecbd710
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 46 deletions.
8 changes: 4 additions & 4 deletions boulder/data/macros/actions/cargo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ actions:
command: |
cargo fetch -v --locked
dependencies:
- rust
- binary(cargo)

- cargo_build:
description: Build the rust project
command: |
cargo build %(options_cargo_release)
dependencies:
- rust
- binary(cargo)

- cargo_install:
description: Install the built binary
Expand All @@ -37,14 +37,14 @@ actions:
}
cargo_install
dependencies:
- rust
- binary(cargo)

- cargo_test:
description: Run tests
command: |
cargo test %(options_cargo_release) --workspace
dependencies:
- rust
- binary(cargo)

definitions:
# The default cargo build profile
Expand Down
12 changes: 6 additions & 6 deletions boulder/data/macros/actions/cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ actions:
command: |
cmake %(options_cmake)
dependencies:
- cmake
- binary(cmake)

- cmake_unity:
description: Perform cmake with unity build enabled
command: |
cmake -DCMAKE_UNITY_BUILD=ON %(options_cmake)
dependencies:
- cmake
- binary(cmake)

- cmake_build:
description: Build the cmake project
command: |
ninja -v -j "%(jobs)" -C "%(builddir)"
dependencies:
- ninja
- binary(ninja)

- cmake_install:
description: Install results of the build to the destination directory
command: |
DESTDIR="%(installroot)" ninja install -v -j "%(jobs)" -C "%(builddir)"
dependencies:
- ninja
- binary(ninja)

- cmake_test:
description: Run testsuite with ctest
command: |
ninja test -v -j "%(jobs)" -C "%(builddir)"
dependencies:
- cmake
- ninja
- binary(cmake)
- binary(ninja)

definitions:

Expand Down
18 changes: 9 additions & 9 deletions boulder/data/macros/actions/meson.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ actions:
test -e ./meson.build || ( echo "%%meson: The ./meson.build script could not be found" ; exit 1 )
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" meson setup %(options_meson)
dependencies:
- cmake
- meson
- pkgconf
- binary(cmake)
- binary(meson)
- binary(pkgconf)

- meson_unity:
description: Run meson with unity build enabled
command: |
test -e ./meson.build || ( echo "%%meson: The ./meson.build script could not be found" ; exit 1 )
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" meson setup --unity on %(options_meson)
dependencies:
- cmake
- meson
- pkgconf
- binary(cmake)
- binary(meson)
- binary(pkgconf)

- meson_build:
description: Build the meson project
command: |
meson compile -v -j "%(jobs)" -C "%(builddir)"
dependencies:
- meson
- binary(meson)

- meson_install:
description: Install results of the build to the destination directory
command: |
DESTDIR="%(installroot)" meson install --no-rebuild -C "%(builddir)"
dependencies:
- meson
- binary(meson)

- meson_test:
description: Run meson test
command: |
meson test --no-rebuild --print-errorlogs -j "%(jobs)" -C "%(builddir)"
dependencies:
- meson
- binary(meson)

definitions:

Expand Down
2 changes: 1 addition & 1 deletion boulder/data/macros/actions/misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ actions:
command: |
patch -f -p1 -i
dependencies:
- patch
- binary(patch)

- tmpfiles:
description: Create a tmpfiles.d file for the package with given content
Expand Down
2 changes: 1 addition & 1 deletion boulder/data/macros/actions/perl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ actions:
command: |
perl Makefile.PL PREFIX="%(prefix)" NO_PACKLIST=1 NO_PERLLOCAL=1 INSTALLDIRS=vendor DESTDIR="%(installroot)"
dependencies:
- perl
- binary(perl)

4 changes: 2 additions & 2 deletions boulder/data/macros/actions/pgo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actions:
}
boptim
dependencies:
- llvm-bolt
- binary(llvm-bolt)

- bolt_perf:
description: Collect perf data suitable for the bolt macros
Expand All @@ -53,7 +53,7 @@ actions:
}
bperf
dependencies:
- perf
- binary(perf)

- bolt_perf2bolt:
description: Convert perf data into bolt equivalent
Expand Down
14 changes: 7 additions & 7 deletions boulder/data/macros/actions/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ actions:
test -e ./setup.py || ( echo "%%python: The ./setup.py script could not be found" ; exit 1 )
python3 setup.py build
dependencies:
- python
- binary(python3)

- python_install:
description: Install python package to the destination directory
command: |
python3 setup.py install --root="%(installroot)"
dependencies:
- python
- binary(python3)
- python-packaging # auto deps handler

- pyproject_build:
description: Build a wheel for python PEP517 projects
command: |
python3 -m build --wheel --no-isolation
dependencies:
- python
- binary(python3)
- python-build
- python-wheel

Expand All @@ -30,7 +30,7 @@ actions:
command: |
python3 -m installer --destdir="%(installroot)" dist/*.whl
dependencies:
- python
- binary(python3)
- python-installer

# TODO: Investigate whether providing additional -opt1.pyc and -opt2.pyc from increasing
Expand All @@ -41,11 +41,11 @@ actions:
command: |
function python_compile() {
if [ -z "$1" ]; then
python -m compileall -q %(installroot) || exit 1
python3 -m compileall -q %(installroot) || exit 1
else
python -m compileall -q $* || exit 1
python3 -m compileall -q $* || exit 1
fi
}
python_compile
dependencies:
- python
- binary(python3)
107 changes: 96 additions & 11 deletions boulder/data/macros/arch/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,16 @@ defaultTuningGroups :
- avxwidth
- base
- bindnow
- build-id
- compress-debug
- debug
- fat-lto
- fortify
- frame-pointer
- harden
- icf
- lto
- lto-errors
- optimize
- relr
- symbolic
Expand All @@ -131,11 +136,28 @@ tuning :
enabled: debug-std
default: std

# Debug symbol compression
- compress-debug:
options:
- none:
enabled: compress-debug-none
- zlib:
enabled: compress-debug-zlib
- zstd:
enabled: compress-debug-zstd
disabled: compress-debug-none
default: zstd

# Toggle frame-pointer
- frame-pointer:
enabled: no-omit-frame-pointer
disabled: omit-frame-pointer

# Toggle build-id
- build-id:
enabled: build-id
disabled: build-id-none

# Enable bindnow functionality
- bindnow:
enabled: bindnow
Expand Down Expand Up @@ -189,7 +211,7 @@ tuning :
enabled: lto-full
- thin:
enabled: lto-thin
default: full
default: thin

# Enable LTOextra. Requires the equivalent lto option
- ltoextra:
Expand All @@ -198,7 +220,16 @@ tuning :
enabled: ltoextra-full
- thin:
enabled: ltoextra-thin
default: full
default: thin

# Enable LTO errors
- lto-errors:
enabled: lto-errors

# Toggle fat LTO objects
- fat-lto:
enabled: fat-lto
disabled: fat-lto-none

# Enable ICF
- icf:
Expand Down Expand Up @@ -387,18 +418,22 @@ flags :
- lto-full:
rust : "-C lto=fat -C linker-plugin-lto -C embed-bitcode=yes"
gnu:
c : "-flto=%(jobs)"
cxx : "-flto=%(jobs)"
ld : "-flto=%(jobs)"
c : "-flto=%(jobs) -flto-partition=one"
cxx : "-flto=%(jobs) -flto-partition=one"
ld : "-flto=%(jobs) -flto-partition=one"
llvm:
c : "-flto"
cxx : "-flto"
c : "-flto=full"
cxx : "-flto=full"
d : "-flto=full"
ld : "-flto"
ld : "-flto=full"

# Enable Thin-LTO optimisations (OFF)
# Enable Thin-LTO optimisations (ON)
- lto-thin:
rust : "-C lto=thin -C linker-plugin-lto -C embed-bitcode=yes"
gnu:
c : "-flto=%(jobs)"
cxx : "-flto=%(jobs)"
ld : "-flto=%(jobs)"
llvm:
c : "-flto=thin"
cxx : "-flto=thin"
Expand All @@ -420,6 +455,56 @@ flags :
c : "-fwhole-program-vtables"
cxx : "-fwhole-program-vtables"

# Enable Fat LTO Objects. Note that this is only necessary when building static objects with LLVM that are used in a GCC build (ON)
- fat-lto:
c : "-ffat-lto-objects"
cxx : "-ffat-lto-objects"

# Disable Fat LTO Objects (OFF)
- fat-lto-none:
c : "-fno-fat-lto-objects"
cxx : "-fno-fat-lto-objects"

# Toggle LTO warning errors. If these throw an error it is likely that there will be runtime problems with LTO (ON)
- lto-errors:
gnu:
c : "-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
cxx : "-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
llvm:
c : "-Werror=odr -Werror=strict-aliasing"
cxx : "-Werror=odr -Werror=strict-aliasing"

# Enable build-id (ON)
- build-id:
ld : "-Wl,--build-id=sha1"
rust : "-C link-args=-Wl,--build-id=sha1"

# Disable build-id (OFF)
- build-id-none:
ld : "-Wl,--build-id=none"
rust : "-C link-args=-Wl,--build-id=none"

# Compress debug symbols with Zstd (ON)
- compress-debug-zstd:
c : "-Wa,--compress-debug-sections=zstd"
cxx : "-Wa,--compress-debug-sections=zstd"
ld : "-Wl,--compress-debug-sections=zstd"
rust : "-C link-args=-Wl,--compress-debug-sections=zstd"

# Compress debug symbols with zlib (OFF)
- compress-debug-zlib:
c : "-Wa,--compress-debug-sections=zlib"
cxx : "-Wa,--compress-debug-sections=zlib"
ld : "-Wl,--compress-debug-sections=zlib"
rust : "-C link-args=-Wl,--compress-debug-sections=zlib"

# Don't compress debug symbols (OFF)
- compress-debug-none:
c : "-Wa,--compress-debug-sections=none"
cxx : "-Wa,--compress-debug-sections=none"
ld : "-Wl,--compress-debug-sections=none"
rust : "-C link-args=-Wl,--compress-debug-sections=none"

# Enable ALL LLVM ICF optimisations (OFF)
- icf-all:
llvm:
Expand All @@ -445,8 +530,8 @@ flags :
# Toggle options you want to use with llvm-bolt (OFF)
- bolt:
gnu:
c : "-fno-reorder-blocks-and-partition"
cxx : "-fno-reorder-blocks-and-partition"
c : "-fno-reorder-blocks-and-partition"
cxx : "-fno-reorder-blocks-and-partition"
ld : "-Wl,-q"
llvm:
c : "-fno-split-machine-functions"
Expand Down
Loading

0 comments on commit ecbd710

Please sign in to comment.