Skip to content

Commit b6fee73

Browse files
committed
Overhaul dependency management.
A (cut-down) version of Zydis and lindw are now included in a new contrib/ directory. The build system now uses these versions rather than downloading code or relying on dynamic loading. This makes the code self-contained, and simplifies the build process.
1 parent 03375cf commit b6fee73

File tree

204 files changed

+100021
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+100021
-155
lines changed

Makefile

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#CXX=clang++
33

44
CXXFLAGS = -std=c++11 -Wall -Wno-reorder -fPIC -pie -march=native \
5-
-DVERSION=$(shell cat VERSION)
5+
-DVERSION=$(shell cat VERSION) -Wl,-rpath=/usr/share/e9tool/lib/
66

77
E9PATCH_OBJS=\
88
src/e9patch/e9CFR.o \
@@ -33,10 +33,21 @@ E9TOOL_OBJS=\
3333
src/e9tool/e9tool.o \
3434
src/e9tool/e9types.o \
3535
src/e9tool/e9x86_64.o
36+
E9TOOL_LIBS=\
37+
contrib/zydis/libZydis.a \
38+
contrib/libdw/libdw.a
39+
E9TOOL_CXXFLAGS=\
40+
-I src/e9tool/ -Wno-unused-function \
41+
-I contrib/libdw/ \
42+
-I contrib/zydis/include/ \
43+
-I contrib/zydis/dependencies/zycore/include/
44+
E9TOOL_LDFLAGS=\
45+
-Wl,--dynamic-list=src/e9tool/e9tool.syms \
46+
-lpthread -ldl -lz
3647

3748
release: CXXFLAGS += -O2 -D NDEBUG
3849
release: $(E9PATCH_OBJS)
39-
$(CXX) $(CXXFLAGS) $(E9PATCH_OBJS) -o e9patch $(LDFLAGS)
50+
$(CXX) $(CXXFLAGS) $(E9PATCH_OBJS) -o e9patch
4051
strip e9patch
4152

4253
debug: CXXFLAGS += -O0 -g
@@ -47,25 +58,21 @@ sanitize: CXXFLAGS += -O0 -g -fsanitize=address
4758
sanitize: $(E9PATCH_OBJS)
4859
$(CXX) $(CXXFLAGS) $(E9PATCH_OBJS) -o e9patch
4960

50-
tool: CXXFLAGS += -O2 -I src/e9tool/ -I zydis/include/ \
51-
-I zydis/dependencies/zycore/include/ -Wno-unused-function
52-
tool: $(E9TOOL_OBJS)
53-
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) -o e9tool libZydis.a \
54-
-Wl,--dynamic-list=src/e9tool/e9tool.syms -ldl $(LDFLAGS)
61+
tool: CXXFLAGS += -O2 $(E9TOOL_CXXFLAGS)
62+
tool: $(E9TOOL_OBJS) $(E9TOOL_LIBS)
63+
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) $(E9TOOL_LIBS) -o e9tool \
64+
$(E9TOOL_LDFLAGS) -Wl,-Map=output.map
5565
strip e9tool
5666

57-
tool.debug: CXXFLAGS += -O0 -g -I src/e9tool/ -I zydis/include/ \
58-
-I zydis/dependencies/zycore/include/ -Wno-unused-function
59-
tool.debug: $(E9TOOL_OBJS)
60-
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) -o e9tool libZydis.a \
61-
-Wl,--dynamic-list=src/e9tool/e9tool.syms -ldl
67+
tool.debug: CXXFLAGS += -O0 -g $(E9TOOL_CXXFLAGS)
68+
tool.debug: $(E9TOOL_OBJS) $(E9TOOL_LIBS)
69+
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) $(E9TOOL_LIBS) -o e9tool \
70+
$(E9TOOL_LDFLAGS)
6271

63-
tool.sanitize: CXXFLAGS += -O0 -g -I src/e9tool/ -I zydis/include/ \
64-
-I zydis/dependencies/zycore/include/ -Wno-unused-function \
65-
-fsanitize=address
66-
tool.sanitize: $(E9TOOL_OBJS)
67-
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) -o e9tool libZydis.a \
68-
-Wl,--dynamic-list=src/e9tool/e9tool.syms -ldl
72+
tool.sanitize: CXXFLAGS += -O0 -g -fsanitize=address $(E9TOOL_CXXFLAGS)
73+
tool.sanitize: $(E9TOOL_OBJS) $(E9TOOL_LIBS)
74+
$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) $(E9TOOL_LIBS) -o e9tool \
75+
$(E9TOOL_LDFLAGS)
6976

7077
tool.clean:
7178
rm -rf $(E9TOOL_OBJS) e9tool
@@ -86,6 +93,12 @@ loader_pe:
8693
src/e9patch/e9elf.o: loader_elf
8794
src/e9patch/e9pe.o: loader_pe
8895

96+
contrib/zydis/libZydis.a:
97+
(cd contrib/zydis/; make)
98+
99+
contrib/libdw/libdw.a:
100+
(cd contrib/libdw/; make)
101+
89102
clean:
90103
rm -rf $(E9PATCH_OBJS) e9patch \
91104
src/e9patch/e9loader.c e9loader.out e9loader.o e9loader.bin

build.sh

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,6 @@ do
3636
shift
3737
done
3838

39-
TARGET=`readlink zydis`
40-
if [ ! -d zydis ]
41-
then
42-
ZYDIS_VERSION=3f5a3ad8e16658c62d7033e9373232d19480d3cc
43-
ZYCORE_VERSION=5c341bf141fe9274c9037c542274ead19fb645d8
44-
45-
echo -e "${GREEN}$0${OFF}: downloading zydis-$ZYDIS_VERSION.zip..."
46-
wget -O zydis-$ZYDIS_VERSION.zip https://github.com/zyantific/zydis/archive/$ZYDIS_VERSION.zip
47-
48-
echo -e "${GREEN}$0${OFF}: downloading zycore-$ZYCORE_VERSION.zip..."
49-
wget -O zycore-$ZYCORE_VERSION.zip https://github.com/zyantific/zycore-c/archive/$ZYCORE_VERSION.zip
50-
51-
echo -e "${GREEN}$0${OFF}: extracting zydis-$ZYDIS_VERSION.zip..."
52-
unzip zydis-$ZYDIS_VERSION.zip
53-
rm -f zydis-$ZYDIS_VERSION.zip
54-
55-
echo -e "${GREEN}$0${OFF}: extracting zycore-$ZYCORE_VERSION.zip..."
56-
unzip zycore-$ZYCORE_VERSION.zip
57-
rm -f zycore-$ZYCORE_VERSION.zip
58-
59-
echo -e "${GREEN}$0${OFF}: building Zydis..."
60-
mv zydis-$ZYDIS_VERSION zydis/
61-
rm -rf zydis/dependencies/zycore/
62-
mv zycore-c-$ZYCORE_VERSION zydis/dependencies/zycore/
63-
rm -rf zycore-c-$ZYCORE_VERSION
64-
cat << EOF > zydis/include/ZydisExportConfig.h
65-
#ifndef ZYDIS_EXPORT_H
66-
#define ZYDIS_EXPORT_H
67-
#define ZYDIS_EXPORT
68-
#define ZYDIS_NO_EXPORT
69-
#define ZYDIS_DEPRECATED __attribute__ ((__deprecated__))
70-
#define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
71-
#define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
72-
#define ZYDIS_NO_DEPRECATED
73-
#endif
74-
EOF
75-
cat << EOF > zydis/include/ZycoreExportConfig.h
76-
#ifndef ZYCORE_EXPORT_H
77-
#define ZYCORE_EXPORT_H
78-
#define ZYCORE_EXPORT
79-
#define ZYCORE_NO_EXPORT
80-
#define ZYCORE_DEPRECATED __attribute__ ((__deprecated__))
81-
#define ZYCORE_DEPRECATED_EXPORT ZYCORE_EXPORT ZYCORE_DEPRECATED
82-
#define ZYCORE_DEPRECATED_NO_EXPORT ZYCORE_NO_EXPORT ZYCORE_DEPRECATED
83-
#define ZYCORE_NO_DEPRECATED
84-
#endif
85-
EOF
86-
make -f Makefile.zydis -j `nproc`
87-
fi
88-
8939
echo -e "${GREEN}$0${OFF}: building e9patch and e9tool..."
9040
make tool.clean clean
9141
make -j `nproc` tool release

contrib/libdw/AUTHORS

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Aaron Merey
2+
Adam Markey
3+
Adrian Ratiu
4+
Ahelenia Ziemiańska
5+
Akihiko Odaki
6+
Alexander Cherepanov
7+
Alexander Kanavin
8+
Alexander Miller
9+
Alice Zhang
10+
Andreas Krebbel
11+
Andreas Schwab
12+
Andrei Homescu
13+
Anthony G. Basile
14+
Ben Woodard
15+
Chih-Hung Hsieh
16+
Claudio Rodrigo Pereyra Diaz
17+
Colin Cross
18+
Cornelius Neckenig
19+
Daniel Cabrera
20+
David Abdurachmanov
21+
Di Chen
22+
Dima Kogan
23+
Dimitris Glezos
24+
Dmitry V. Levin
25+
Dodji Seketeli
26+
Domingo Becker
27+
Eduardo Santiago
28+
Eli Schwartz
29+
Érico Nogueira
30+
Érico Rolim
31+
Filipe Brandenburger
32+
Florian Weimer
33+
Francesco Tombolini
34+
Frank Ch. Eigler
35+
Geert Warrink
36+
Gladys Guerrero
37+
Gustavo Romero
38+
Hayatsu Shunsuke
39+
H.J. Lu
40+
Hyu_gabaru Ryu_ichi
41+
Jakub Jelinek
42+
Jan Kratochvil
43+
Jan Pokorný
44+
Jason P. Leasure
45+
Jean Pihet
46+
Jeff Kenton
47+
Jim Wilson
48+
John M Mellor-Crummey
49+
John Ogness
50+
Jonathan Lebon
51+
Jonathon Anderson
52+
Jose E. Marchesi
53+
Josh Stone
54+
Joshua Watt
55+
Kevin Cernekee
56+
kiyoto hashida
57+
Konrad Kleine
58+
Kurt Roeckx
59+
Kyle McMartin
60+
Lei Zhang
61+
Lubomir Rintel
62+
Luca Boccassi
63+
Luiz Angelo Daros de Luca
64+
Mao Han
65+
Marek Polacek
66+
Mark Wielaard
67+
Martin Liska
68+
Masatake YAMATO
69+
Matt Fleming
70+
Matthias Klose
71+
Matthias Maennich
72+
Max Filippov
73+
Michael Forney
74+
Michael Münch
75+
Mike Frysinger
76+
Milian Wolff
77+
Namhyung Kim
78+
Noah Sanci
79+
Noriko Mizumoto
80+
Omar Sandoval
81+
Petr Machata
82+
Pino Toscano
83+
Piotr Drąg
84+
Ravi Bangoria
85+
Richard Henderson
86+
Roland McGrath
87+
Rosen Penev
88+
Ross Burton
89+
Saleem Abdulrasool
90+
Sergei Trofimovich
91+
Srđan Milaković
92+
Steven Chamberlain
93+
Thomas Canniot
94+
Thomas Spura
95+
Timm Bäder
96+
Tom Tromey
97+
Ulf Hermann
98+
Ulrich Drepper
99+
Wei Liu
100+
William Cohen
101+
Yonghong Song
102+
Yulia Poyarkova
103+
Yunlian Jiang
104+
Yuri Chornoivan

0 commit comments

Comments
 (0)