Skip to content

Commit 5db08bc

Browse files
committed
Add base for MIPS, it requires work to be done because it does not have PLT, instead we must hook the GOT.
1 parent 829875a commit 5db08bc

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ RUN apt update \
1414
gcc-powerpc64le-linux-gnu \
1515
gcc-riscv64-linux-gnu \
1616
gcc-s390x-linux-gnu \
17-
gcc-sparc64-linux-gnu \
1817
gcc-14-loongarch64-linux-gnu \
18+
gcc-mips64-linux-gnuabi64 \
19+
gcc-mips64el-linux-gnuabi64 \
20+
gcc-sparc64-linux-gnu \
1921
libc6-dev-armhf-cross \
2022
libc6-dev-ppc64el-cross \
2123
libc6-dev-powerpc-cross \
2224
libc6-dev-armel-cross \
2325
libc6-dev-arm64-cross \
2426
libc6-dev-s390x-cross \
25-
libc6-dev-sparc64-cross \
26-
libc6-dev-loong64-cross
27+
libc6-dev-loong64-cross \
28+
libc6-dev-mips64-cross \
29+
libc6-dev-mips64el-cross \
30+
libc6-dev-sparc64-cross
2731

2832
WORKDIR /plthook
2933

@@ -34,10 +38,10 @@ WORKDIR /plthook/test
3438
ENV OPT_CFLAGS="-O2"
3539

3640
RUN echo "Running tests" \
37-
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
38-
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
3941
&& make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabi \
4042
&& make relro_pie_tests TARGET_PLATFORM=arm-linux-gnueabihf \
43+
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
44+
&& make relro_pie_tests TARGET_PLATFORM=aarch64-linux-gnu \
4145
&& make relro_pie_tests TARGET_PLATFORM=powerpc-linux-gnu QEMU_ARCH=ppc \
4246
&& make relro_pie_tests TARGET_PLATFORM=powerpc64le-linux-gnu QEMU_ARCH=ppc64le \
4347
&& make relro_pie_tests TARGET_PLATFORM=riscv64-linux-gnu QEMU_ARCH=riscv64 \
@@ -46,4 +50,6 @@ RUN echo "Running tests" \
4650

4751
# TODO:
4852
# \
53+
# && make relro_pie_tests TARGET_PLATFORM=mips64-linux-gnuabi64 QEMU_ARCH=mips64 \
54+
# && make relro_pie_tests TARGET_PLATFORM=mips64el-linux-gnuabi64 QEMU_ARCH=mips64el \
4955
# && make relro_pie_tests TARGET_PLATFORM=sparc64-linux-gnu QEMU_ARCH=sparc64

plthook_elf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
#elif defined __loongarch64
117117
#define R_JUMP_SLOT R_LARCH_JUMP_SLOT
118118
#define R_GLOBAL_DATA R_LARCH_64
119+
#elif 0 /* disabled because not working, needs to patch the GOT instead of PLT */ && defined __mips__
120+
#define R_JUMP_SLOT R_MIPS_JUMP_SLOT
121+
#define R_GLOBAL_DATA R_MIPS_GLOB_DAT
119122
#elif 0 /* disabled because not tested */ && (defined __sparc || defined __sparc__)
120123
#define R_JUMP_SLOT R_SPARC_JMP_SLOT
121124
#define R_GLOBAL_DATA R_SPARC_GLOB_DAT

0 commit comments

Comments
 (0)