|
| 1 | +.PHONY: check clean-check |
| 2 | + |
1 | 3 | FCF_NONE := $(shell \ |
2 | 4 | if gcc -fcf-protection=none --version 2>&1 | grep -q 'unrecognized'; \ |
3 | 5 | then true; \ |
4 | 6 | else echo -fcf-protection=none; fi) |
5 | 7 |
|
6 | | -all: |
| 8 | +BASE ::= test test.pie bugs test.libc libtest.so test_c test_c.debug example.so |
| 9 | +TRAMPOLINE ::= inst patch dl init fini |
| 10 | +IN ::= $(wildcard *.in) |
| 11 | +EXE ::= $(IN:.in=.exe) |
| 12 | + |
| 13 | +check: regtest $(EXE) |
| 14 | + ./$^ |
| 15 | + |
| 16 | +%.exe: in=$(shell head -1 $<) |
| 17 | +%.exe: %.in $(BASE) $(TRAMPOLINE) |
| 18 | + ../../e9tool $(E9TOOL_OPTIONS) -M 'addr >= &"entry"' $(in)\ |
| 19 | + -E data..data_END -E data2...text -E .text..begin -o $@ |
| 20 | + |
| 21 | +test: |
7 | 22 | gcc -x assembler-with-cpp -o test test.s -no-pie -nostdlib \ |
8 | 23 | -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \ |
9 | 24 | -Wl,-z -Wl,max-page-size=4096 -DPIE=0 |
| 25 | + |
| 26 | +test.pie: |
10 | 27 | gcc -x assembler-with-cpp -o test.pie test.s -pie -nostdlib \ |
11 | 28 | -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \ |
12 | 29 | -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \ |
13 | 30 | -Wl,--export-dynamic |
| 31 | + |
| 32 | +bugs: |
14 | 33 | gcc -x assembler-with-cpp -o bugs bugs.s -no-pie -nostdlib \ |
15 | 34 | -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \ |
16 | 35 | -Wl,-z -Wl,max-page-size=4096 -DPIE=0 |
| 36 | + |
| 37 | +test.libc: |
17 | 38 | gcc -x assembler-with-cpp -o test.libc test_libc.s -pie -Wl,--export-dynamic |
| 39 | + |
| 40 | +libtest.so: |
18 | 41 | gcc -x assembler-with-cpp -shared -o libtest.so libtest.s |
| 42 | + |
| 43 | +test_c: |
19 | 44 | gcc -O2 -fPIC $(FCF_NONE) -pie -o test_c test_c.c \ |
20 | 45 | -Wl,--export-dynamic -U_FORTIFY_SOURCE |
21 | 46 | strip test_c |
| 47 | + |
| 48 | +test_c.debug: |
22 | 49 | gcc -O0 -g -fPIC -pie -o test_c.debug test_c.c |
| 50 | + |
| 51 | +inst: |
23 | 52 | ../../e9compile.sh inst.c -I ../../examples/ |
| 53 | + |
| 54 | +patch: |
24 | 55 | ../../e9compile.sh patch.cpp -std=c++11 -I ../../examples/ |
| 56 | + |
| 57 | +dl: |
25 | 58 | NO_SIMD_CHECK=1 ../../e9compile.sh dl.c -I ../../examples/ |
| 59 | + |
| 60 | +init: |
26 | 61 | ../../e9compile.sh init.c -I ../../examples/ |
| 62 | + |
| 63 | +fini: |
27 | 64 | ../../e9compile.sh fini.c -I ../../examples/ |
| 65 | + |
| 66 | +example.so: |
28 | 67 | g++ -std=c++11 -fPIC -shared -o example.so -O2 \ |
29 | 68 | ../../examples/plugins/example.cpp -I ../../src/e9tool/ |
30 | | - g++ -std=c++11 -pie -fPIC -o regtest regtest.cpp -O2 |
31 | | - echo "XXX" > FILE.txt |
32 | | - chmod 0640 FILE.txt |
33 | 69 |
|
34 | | -clean: |
35 | | - rm -f *.log *.out *.exe test test.pie test.libc libtest.so inst inst.o \ |
36 | | - patch patch.o init init.o regtest |
| 70 | +clean-check: |
| 71 | + rm -f $(BASE) $(TRAMPOLINE) $(EXE) |
| 72 | + rm -f *.out |
0 commit comments