File tree 6 files changed +78
-6
lines changed
6 files changed +78
-6
lines changed Original file line number Diff line number Diff line change 3
3
4
4
BUILD_DIR=" build-ci"
5
5
6
- cmake -B ${BUILD_DIR}
6
+ PIE=
7
+
8
+ __usage__ ()
9
+ {
10
+ echo -e "
11
+ github-ci [options]
12
+
13
+ --pie=[ON|OFF]
14
+
15
+ -h, --help
16
+ " | more
17
+
18
+ exit ${1-0}
19
+ }
20
+
21
+ TEMP=$( getopt \
22
+ --options h \
23
+ --long pie: \
24
+ --long help \
25
+ -n github-ci -- " $@ " )
26
+
27
+ test $? ! = 0 && __usage__ 1
28
+
29
+ eval set -- " $TEMP "
30
+
31
+ while true ; do
32
+ case $1 in
33
+ --pie)
34
+ shift
35
+ PIE=$1
36
+ shift
37
+ ;;
38
+ -h|--help)
39
+ shift
40
+ __usage__
41
+ ;;
42
+ --)
43
+ shift
44
+ break
45
+ ;;
46
+ esac
47
+ done
48
+
49
+ cmake -B ${BUILD_DIR} ${PIE: +-DCONFIG_BUILD_PIE_EXE=${PIE} }
50
+
7
51
tree -d ${BUILD_DIR}
8
52
make -C ${BUILD_DIR} -j$( nproc)
9
53
sudo make -C ${BUILD_DIR} install
Original file line number Diff line number Diff line change 4
4
cat /etc/os-release
5
5
systemd-detect-virt || true
6
6
uname -a
7
+ free -g
8
+ nproc
9
+ lscpu
7
10
# Fedora base container doesn't contain ip command.
8
11
ip addr || true
9
12
gcc --version
13
+ ldconfig --version
10
14
echo cwd=$PWD
11
15
ls -al
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ permissions:
9
9
jobs :
10
10
test_ulpatch :
11
11
runs-on : ubuntu-latest
12
+ strategy :
13
+ fail-fast : false
12
14
steps :
13
15
- uses : actions/checkout@v4
14
16
- name : Install dependencies
25
27
test_ulpatch_fedora :
26
28
runs-on : ubuntu-latest
27
29
strategy :
30
+ fail-fast : false
28
31
matrix :
29
32
fedora-version : [38, 41]
33
+ pie : [OFF, ON]
30
34
container :
31
35
image : " fedora:${{matrix.fedora-version}}"
32
36
# These options are required to be able to run lldb inside the container
@@ -40,16 +44,16 @@ jobs:
40
44
sudo dnf install -y binutils-devel capstone-devel cmake \
41
45
elfutils-devel elfutils-libelf-devel gcc gcc-c++ \
42
46
glibc-devel libunwind-devel tree util-linux rpm-build \
43
- git dnf-plugins-core
47
+ git dnf-plugins-core procps-ng
44
48
sudo dnf builddep -y ulpatch.spec
45
49
- name : System info
46
50
run : ./.github/include/sysinfo.sh
47
51
- name : Build binary
48
- run : ./.github/include/ci.sh
52
+ run : ./.github/include/ci.sh --pie=${{matrix.pie}}
49
53
- name : Running ulpatch_test
50
54
run : ulpatch_test
51
55
- name : Build RPMS
52
56
working-directory : /workdir/ulpatch/
53
57
run : |
54
58
./archive.sh
55
- ./rpmbuild.sh
59
+ ./rpmbuild.sh --pie ${{matrix.pie}}
Original file line number Diff line number Diff line change 1
1
# Build
2
2
build
3
+ build-ci
3
4
CMakeCache.txt
4
5
CMakeFiles
5
6
cmake_install.cmake
Original file line number Diff line number Diff line change 4
4
# Use half of CPU cores
5
5
np=$(( $(nproc) / 2 ))
6
6
7
+ pie=
7
8
without_capstone=
8
9
without_libunwind=
9
10
nodebuginfo=
10
11
11
12
__usage__ () {
12
13
echo -e "
14
+ --pie [ON|OFF]
15
+
13
16
--without-capstone build without capstone
14
17
--without-libunwind build without libunwind
15
18
@@ -21,6 +24,7 @@ __usage__() {
21
24
22
25
TEMP=$( getopt --options h \
23
26
--long help \
27
+ --long pie: \
24
28
--long without-capstone \
25
29
--long without-libunwind \
26
30
--long nodebuginfo \
@@ -35,6 +39,11 @@ while true ; do
35
39
shift
36
40
__usage__
37
41
;;
42
+ --pie)
43
+ shift
44
+ pie=$1
45
+ shift
46
+ ;;
38
47
--without-capstone)
39
48
shift
40
49
without_capstone=YES
@@ -54,11 +63,15 @@ while true ; do
54
63
esac
55
64
done
56
65
66
+ PIE=
67
+ [[ ${pie} == ON ]] && PIE=ON
68
+
57
69
rpmbuild -ba \
58
70
--define " _topdir $PWD " \
59
71
--define " _sourcedir $PWD " \
60
72
--define " _smp_mflags -j${np} " \
61
73
${without_capstone: +--without capstone} \
62
74
${without_libunwind: +--without libunwind} \
63
75
${nodebuginfo: +--nodebuginfo} \
76
+ ${PIE: +--define " pie 1" } \
64
77
ulpatch.spec
Original file line number Diff line number Diff line change 17
17
%define with_capstone 0%{?!_without_capstone:1 }
18
18
%define with_libunwind 0%{?!_without_libunwind:1 }
19
19
20
+ # Compile executions as PIE or not
21
+ %define build_pie 0%{?pie }
22
+
20
23
Name: ulpatch
21
24
# The version number must be consistent with the CMakeLists.txt in the
22
25
# top-level directory.
23
26
Version: 0.5.12
24
- Release: 2 %{?dist }
27
+ Release: 3 %{?dist }
25
28
Summary: Userspace Live Patch Toolset
26
29
27
30
License: GPL-2.0 or later
@@ -115,6 +118,9 @@ cmake -DCMAKE_BUILD_TYPE=Release \
115
118
%if " %{toolchain}" == " clang"
116
119
-DCMAKE_C_COMPILER=clang \
117
120
%endif
121
+ %if %{build_pie }
122
+ -DCONFIG_BUILD_PIE_EXE=ON \
123
+ %endif
118
124
%if ! %{?with_ulftrace }
119
125
-DCONFIG_BUILD_ULFTRACE=OFF \
120
126
%endif
183
189
%{_datadir }/ulpatch/ulpatches/printf.ulp
184
190
185
191
%changelog
186
- *
Thu Jan 02 2025 Rong Tao <[email protected] > -
0.5.12-2
192
+ *
Thu Jan 02 2025 Rong Tao <[email protected] > -
0.5.12-3
187
193
- Not release yet.
188
194
You can’t perform that action at this time.
0 commit comments