@@ -3,32 +3,69 @@ FCF_NONE := $(shell \
33 then true; \
44 else echo -fcf-protection=none; fi)
55
6- all :
6+ BASE ::= test test.pie bugs test.libc libtest.so test_c test_c.debug example.so
7+ TRAMPOLINE ::= inst patch dl init fini
8+ IN ::= $(wildcard * .in)
9+ EXE ::= $(IN:.in=.exe )
10+
11+ check : regtest $(EXE )
12+ ./$^
13+
14+ % .exe : in=$(shell head -1 $< )
15+ % .exe : % .in $(BASE ) $(TRAMPOLINE )
16+ ../../e9tool $(E9TOOL_OPTIONS ) -M ' addr >= &"entry"' $(in ) \
17+ -E data..data_END -E data2...text -E .text..begin -o $@
18+
19+ test :
720 gcc -x assembler-with-cpp -o test test.s -no-pie -nostdlib \
821 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
922 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
23+
24+ test.pie :
1025 gcc -x assembler-with-cpp -o test.pie test.s -pie -nostdlib \
1126 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
1227 -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
1328 -Wl,--export-dynamic
29+
30+ bugs :
1431 gcc -x assembler-with-cpp -o bugs bugs.s -no-pie -nostdlib \
1532 -Wl,--section-start=.text =0xa000000 -Wl,--section-start=.bss=0xc000000 \
1633 -Wl,-z -Wl,max-page-size=4096 -DPIE=0
34+
35+ test.libc :
1736 gcc -x assembler-with-cpp -o test.libc test_libc.s -pie -Wl,--export-dynamic
37+
38+ libtest.so :
1839 gcc -x assembler-with-cpp -shared -o libtest.so libtest.s
40+
41+ test_c :
1942 gcc -O2 -fPIC $(FCF_NONE ) -pie -o test_c test_c.c \
2043 -Wl,--export-dynamic -U_FORTIFY_SOURCE
2144 strip test_c
45+
46+ test_c.debug :
2247 gcc -O0 -g -fPIC -pie -o test_c.debug test_c.c
48+
49+ inst :
2350 ../../e9compile.sh inst.c -I ../../examples/
51+
52+ patch :
2453 ../../e9compile.sh patch.cpp -std=c++11 -I ../../examples/
54+
55+ dl :
2556 NO_SIMD_CHECK=1 ../../e9compile.sh dl.c -I ../../examples/
57+
58+ init :
2659 ../../e9compile.sh init.c -I ../../examples/
60+
61+ fini :
2762 ../../e9compile.sh fini.c -I ../../examples/
63+
64+ example.so :
2865 g++ -std=c++11 -fPIC -shared -o example.so -O2 \
2966 ../../examples/plugins/example.cpp -I ../../src/e9tool/
30- g++ -std=c++11 -pie -fPIC -o regtest regtest.cpp -O2
3167
32- clean :
33- rm -f * .log * .out * .exe test test.pie test.libc libtest.so inst inst.o \
34- patch patch.o init init.o regtest
68+ clean-check :
69+ rm -f $(BASE ) $(TRAMPOLINE ) $(EXE )
70+
71+ .PHONY : check clean-check
0 commit comments