Skip to content

Commit 9f42bf2

Browse files
committed
Reimplement the E9Patch loader.
In the new version, most of the code is written in C++ rather than generated machine code. This is a much better design, and makes it easier to extend. The new loader should also be faster.
1 parent 7773cc7 commit 9f42bf2

13 files changed

Lines changed: 609 additions & 846 deletions

File tree

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ tool.debug: e9tool.o
5252
-Wl,--export-dynamic -ldl
5353

5454
loader:
55-
$(CXX) -std=c++11 -Wall -fno-stack-protector -fpie -Os -c \
56-
src/e9patch/e9loader.cpp
57-
$(CXX) -nostdlib -o e9loader.out e9loader.o -Wl,--entry=_entry
58-
objcopy --dump-section .text=e9loader.bin e9loader.out
59-
xxd -i e9loader.bin > src/e9patch/e9loader.c
55+
$(CXX) -std=c++11 -Wall -fno-stack-protector -Wno-unused-function -fPIC \
56+
-mno-mmx -mno-sse -mno-avx -mno-avx2 -mno-avx512f -msoft-float \
57+
-Os -c src/e9patch/e9loader_elf.cpp
58+
$(CXX) -pie -nostdlib -o e9loader_elf.bin e9loader_elf.o -T e9loader.ld
59+
xxd -i e9loader_elf.bin > src/e9patch/e9loader_elf.c
6060

6161
src/e9patch/e9alloc.o: CXXFLAGS += -Wno-unused-function
6262

e9loader.ld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SECTIONS
2+
{
3+
.text : { *(.text .rodata .rodata.*) }
4+
}
5+
OUTPUT_FORMAT(binary)

0 commit comments

Comments
 (0)