Skip to content

Commit 8c97587

Browse files
authored
Add support for s390x. (#9)
1 parent 5b8cb6a commit 8c97587

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- name: Install packages
8585
run: |
8686
sudo apt update
87-
sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross
87+
sudo apt install -y qemu-user gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu gcc-s390x-linux-gnu libc6-dev-armhf-cross libc6-dev-ppc64el-cross libc6-dev-powerpc-cross libc6-dev-armel-cross libc6-dev-arm64-cross libc6-dev-s390x-cross
8888
- name: Set OPT_CLFAGS
8989
run: |
9090
echo OPT_CFLAGS="${{ matrix.optimization }}" >> $GITHUB_ENV
@@ -115,6 +115,9 @@ jobs:
115115
- name: riscv64-linux-gnu
116116
run: |
117117
make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64
118+
- name: s390x-linux-gnu
119+
run: |
120+
make relro_pie_tests TARGET_PLATFORM=s390x-linux-gnu QEMU_ARCH=s390x
118121
119122
tests_on_macos:
120123
name: Tests on macOS

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,34 @@ RUN apt update \
1313
gcc-powerpc-linux-gnu \
1414
gcc-powerpc64le-linux-gnu \
1515
gcc-riscv64-linux-gnu \
16+
gcc-s390x-linux-gnu \
17+
gcc-sparc64-linux-gnu \
1618
libc6-dev-armhf-cross \
1719
libc6-dev-ppc64el-cross \
1820
libc6-dev-powerpc-cross \
1921
libc6-dev-armel-cross \
20-
libc6-dev-arm64-cross
22+
libc6-dev-arm64-cross \
23+
libc6-dev-s390x-cross \
24+
libc6-dev-sparc64-cross
2125

2226
WORKDIR /plthook
2327

2428
COPY . .
2529

2630
WORKDIR /plthook/test
2731

28-
ENV OPT_CFLAGS="-O3"
32+
ENV OPT_CFLAGS="-O1"
2933

3034
RUN echo "Running tests" \
35+
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
3136
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
3237
&& make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi \
3338
&& make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf \
3439
&& make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc \
3540
&& make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le \
36-
&& make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64
41+
&& make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 \
42+
&& make relro_pie_tests TARGET_PLATFORM=s390x-linux-gnu QEMU_ARCH=s390x
43+
44+
# TODO:
45+
# \
46+
# && make relro_pie_tests TARGET_PLATFORM=sparc64-linux-gnu QEMU_ARCH=sparc64

plthook_elf.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@
107107
#else
108108
#error unsupported RISCV implementation
109109
#endif
110-
#elif 0 /* disabled because not tested */ && (defined __sparcv9 || defined __sparc_v9__)
111-
#define R_JUMP_SLOT R_SPARC_JMP_SLOT
110+
#elif 0 /* disabled because not tested */ && (defined __s390__)
111+
#define R_JUMP_SLOT R_390_JMP_SLOT
112+
#define R_GLOBAL_DATA R_390_GLOB_DAT
113+
#elif defined __s390x__
114+
#define R_JUMP_SLOT R_390_JMP_SLOT
115+
#define R_GLOBAL_DATA R_390_GLOB_DAT
112116
#elif 0 /* disabled because not tested */ && (defined __sparc || defined __sparc__)
113117
#define R_JUMP_SLOT R_SPARC_JMP_SLOT
118+
#define R_GLOBAL_DATA R_SPARC_GLOB_DAT
119+
#elif 0 /* disabled because not tested */ && (defined __sparcv9 || defined __sparc_v9__)
120+
#define R_JUMP_SLOT R_SPARC_JMP_SLOT
121+
#define R_GLOBAL_DATA R_SPARC_GLOB_DAT
114122
#elif 0 /* disabled because not tested */ && (defined __ia64 || defined __ia64__)
115123
#define R_JUMP_SLOT R_IA64_IPLTMSB
116124
#else

0 commit comments

Comments
 (0)