Skip to content

Commit

Permalink
fix(ci): ensure relro is enabled for linux targets only
Browse files Browse the repository at this point in the history
  • Loading branch information
usagi-flow committed Aug 20, 2024
1 parent 14c275f commit 35cb4cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/evil-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ jobs:
run: "sudo apt update && sudo apt install -y clang"
if: ${{ !matrix.target.native}}

- name: Patch grammar build arguments
run: |
sed -i 's/command.arg("-Wl,-z,relro,-z,now");//g' helix-loader/src/grammar.rs
if: ${{ matrix.id == 'x86_64-pc-windows-gnu' }}

- name: Build (cross)
# TODO: let's first see if this works
#run: cargo xwin build --target ${{ matrix.target.id }} --profile release
Expand Down
10 changes: 3 additions & 7 deletions helix-loader/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,12 @@ fn build_tree_sitter_library(
}
command.arg("-xc").arg("-std=c11").arg(parser_path);

// HACK: relro is a linux hardening feature;
// it makes no sense (and tends to cause issues) when trying to enable for other targets
#[cfg(target_os = "linux")]
command.arg("-Wl,-z,relro,-z,now");
/*if cfg!(all(
if cfg!(all(
unix,
not(any(target_os = "macos", target_os = "illumos", target_os = "windows"))
not(any(target_os = "macos", target_os = "illumos"))
)) {
command.arg("-Wl,-z,relro,-z,now");
}*/
}
}

let output = command
Expand Down

0 comments on commit 35cb4cc

Please sign in to comment.