Skip to content

Commit

Permalink
github: Install libelf-dev kernel compile dependency and fixup PIE
Browse files Browse the repository at this point in the history
The Linux kernel has had a somewhat-flexible dependency on headers
provided by the libelf-dev package for a while. As long as we compiled
with the options `-fno-pie -no-pie`, however, the build would succeed.
Unfortunately, newer kernels don't like it when we manually specify
those options. They now complain that some parts of the code *must*
be compiled with PIE... Before we're able to add these newer kernels
to the test matrix, we must get ourselves out of this jam...

The solution that this commit implements is to only set those options
on the older kernels that actually require it. Around the time of Linux
4.9, the kernel updated its own makefile to add these options when
required. Only setting these flags when required prevents the problems
from cropping up.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
  • Loading branch information
jigpu committed Jun 8, 2023
1 parent a47088f commit cba0a88
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on: [ push, pull_request ]

env:
COMPILE_CFLAGS: -fno-pie -Werror
PREPARE_CFLAGS: -fno-pie
COMPILE_CFLAGS: -Werror
PREPARE_CFLAGS:

jobs:
compile:
Expand All @@ -12,24 +12,36 @@ jobs:
kernel: ["5.10", "4.14", "4.6", "4.5", "4.1", "3.19", "3.18", "3.17", "3.7"]
include:
- kernel: "3.7"
compile_cflags: -Wno-error=pointer-sign
compile_cflags: -fno-pie -Wno-error=pointer-sign
prepare_cflags: -fno-pie -no-pie
- kernel: "3.17"
compile_cflags: -Wno-error=format-truncation
compile_cflags: -fno-pie -Wno-error=format-truncation
prepare_cflags: -fno-pie -no-pie
- kernel: "3.18"
compile_cflags: -Wno-error=format-truncation
compile_cflags: -fno-pie -Wno-error=format-truncation
prepare_cflags: -fno-pie -no-pie
- kernel: "3.19"
compile_cflags: -Wno-error=format-truncation
compile_cflags: -fno-pie -Wno-error=format-truncation
prepare_cflags: -fno-pie -no-pie
- kernel: "4.1"
compile_cflags: -Wno-error=format-truncation
compile_cflags: -fno-pie -Wno-error=format-truncation
prepare_cflags: -fno-pie -no-pie
- kernel: "4.5"
compile_cflags: -Wno-error=format-truncation -Wno-error=pointer-sign
compile_cflags: -fno-pie -Wno-error=format-truncation -Wno-error=pointer-sign
prepare_cflags: -fno-pie -no-pie
- kernel: "4.6"
compile_cflags: -Wno-error=format-truncation -Wno-error=pointer-sign
compile_cflags: -fno-pie -Wno-error=format-truncation -Wno-error=pointer-sign
prepare_cflags: -fno-pie -no-pie
- kernel: "4.14"
compile_cflags: -Wno-error=format-truncation -Wno-error=pointer-sign
- kernel: "5.10"
compile_cflags: -Wno-error=format-truncation -Wno-error=pointer-sign
steps:
- name: Install dependencies
run: |
sudo apt-get install gcc-9-plugin-dev libelf-dev
gcc -print-file-name=plugin
- name: Checkout the repo
uses: actions/checkout@v2

Expand Down

0 comments on commit cba0a88

Please sign in to comment.