-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (64 loc) · 2.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
BINPATH = bin
OBJ =\
$(BINPATH)/asm1.o\
$(BINPATH)/asm2.o\
$(BINPATH)/asm3.o\
$(BINPATH)/asm4.o\
$(BINPATH)/asm5.o\
$(BINPATH)/asm6.o\
$(BINPATH)/asm6c.o\
$(BINPATH)/asm7.o\
$(BINPATH)/asm8.o
BIN =\
$(BINPATH)/simple1\
$(BINPATH)/simple2\
$(BINPATH)/simple3\
$(BINPATH)/asm1\
$(BINPATH)/asm2\
$(BINPATH)/asm3\
$(BINPATH)/asm4\
$(BINPATH)/asm5\
$(BINPATH)/asm6\
$(BINPATH)/asm6c\
$(BINPATH)/asm7\
$(BINPATH)/asm8\
$(BINPATH)/sc1\
$(BINPATH)/sc2
JNK =\
shellcoding-riscv.tar.gz
all: c asm compressed shellcode
c:
gcc -O0 -fpic src/simple1.c -o $(BINPATH)/simple1
gcc -O0 -fpic src/simple2.c -o $(BINPATH)/simple2
gcc -O0 -fpic src/simple3.c -o $(BINPATH)/simple3
asm:
gcc -march=rv64g -c src/asm1.s -o $(BINPATH)/asm1.o
ld $(BINPATH)/asm1.o -o $(BINPATH)/asm1
gcc -march=rv64g -c src/asm2.s -o $(BINPATH)/asm2.o
ld $(BINPATH)/asm2.o -o $(BINPATH)/asm2
gcc -march=rv64g -c src/asm3.s -o $(BINPATH)/asm3.o
ld $(BINPATH)/asm3.o -o $(BINPATH)/asm3
gcc -march=rv64g -c src/asm4.s -o $(BINPATH)/asm4.o
ld $(BINPATH)/asm4.o -o $(BINPATH)/asm4
gcc -march=rv64g -c src/asm5.s -o $(BINPATH)/asm5.o
ld $(BINPATH)/asm5.o -o $(BINPATH)/asm5
gcc -march=rv64g -c src/asm6.s -o $(BINPATH)/asm6.o
ld $(BINPATH)/asm6.o -o $(BINPATH)/asm6
gcc -march=rv64g -c src/asm7.s -o $(BINPATH)/asm7.o
ld $(BINPATH)/asm7.o -o $(BINPATH)/asm7
gcc -march=rv64g -z execstack -c src/asm8.s -o $(BINPATH)/asm8.o
ld $(BINPATH)/asm8.o -z execstack -o $(BINPATH)/asm8
compressed:
gcc -march=rv64gc -c src/asm6c.s -o $(BINPATH)/asm6c.o
ld $(BINPATH)/asm6c.o -o $(BINPATH)/asm6c
gcc -march=rv64gc -c src/asm7.s -o $(BINPATH)/asm7c.o
ld $(BINPATH)/asm7c.o -o $(BINPATH)/asm7c
clean:
rm -f $(OBJ) $(BIN) $(JNK)
shellcode:
gcc -DSC1 -g -fno-stack-protector -z execstack src/sctester.c -o $(BINPATH)/sc1
gcc -DSC2 -g -fno-stack-protector -z execstack src/sctester.c -o $(BINPATH)/sc2
package: c asm shellcode
tar cvzf riscv-$(shell date +%s).tar.gz $(BINPATH)/*
.PHONY:
all clean asm shellcode package c