-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.am
268 lines (239 loc) · 8.35 KB
/
Makefile.am
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
AUTOMAKE_OPTIONS = foreign 1.7 dist-bzip2
include $(top_srcdir)/Makefile.all.am
TOOLS = memcheck \
cachegrind \
callgrind \
massif \
lackey \
none \
helgrind \
drd \
catchconv
EXP_TOOLS = exp-ptrcheck
# DDD: once all tools work on Darwin, TEST_TOOLS and TEST_EXP_TOOLS can be
# replaced with TOOLS and EXP_TOOLS.
if !VGCONF_OS_IS_DARWIN
TEST_TOOLS = $(TOOLS)
TEST_EXP_TOOLS = $(EXP_TOOLS)
else
TEST_TOOLS = memcheck \
cachegrind \
callgrind \
massif \
lackey \
none
TEST_EXP_TOOLS =
endif
# Put docs last because building the HTML is slow and we want to get
# everything else working before we try it.
SUBDIRS = include coregrind . tests perf auxprogs $(TOOLS) $(EXP_TOOLS) docs
DIST_SUBDIRS = $(SUBDIRS)
SUPP_FILES = \
glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp glibc-2.5.supp \
glibc-2.6.supp glibc-2.7.supp glibc-2.X.supp.in \
aix5libc.supp xfree-3.supp xfree-4.supp \
glibc-2.34567-NPTL-helgrind.supp \
glibc-2.2-LinuxThreads-helgrind.supp \
glibc-2.X-drd.supp \
exp-ptrcheck.supp \
darwin9.supp
DEFAULT_SUPP_FILES = @DEFAULT_SUPP@
# We include all the base .supp files in the distribution, but not
# default.supp, as it is built from the base .supp files at compile-time.
# The "val" in "val_DATA" ties in with $(valdir), defined in
# Makefile.all.am. From the automake info pages:
#
# Sometimes the standard directories--even as augmented by Automake--are
# not enough. In particular it is sometimes useful, for clarity, to
# install objects in a subdirectory of some predefined directory. To this
# end, Automake allows you to extend the list of possible installation
# directories. A given prefix (e.g., `zar') is valid if a variable of the
# same name with `dir' appended is defined (e.g., `zardir').
#
dist_noinst_DATA = $(SUPP_FILES)
val_DATA = default.supp
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = valgrind.pc
incincdir = $(includedir)/valgrind
nodist_incinc_HEADERS = $(VEX_PUBLIC_HDRS)
BUILT_SOURCES = default.supp valgrind.pc
CLEANFILES = default.supp
if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
BUILT_SOURCES += valt_load_address_x86_linux.lds
CLEANFILES += valt_load_address_x86_linux.lds
endif
if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX
BUILT_SOURCES += valt_load_address_amd64_linux.lds
CLEANFILES += valt_load_address_amd64_linux.lds
endif
if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX
BUILT_SOURCES += valt_load_address_ppc32_linux.lds
CLEANFILES += valt_load_address_ppc32_linux.lds
endif
if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX
BUILT_SOURCES += valt_load_address_ppc64_linux.lds
CLEANFILES += valt_load_address_ppc64_linux.lds
endif
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
# No need to generate valt_load_address*.lds; the final executables
# can be linked to be at any address. They will be relocated by
# AIX kernel when they are loaded.
endif
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
# Ditto
endif
if VGCONF_OS_IS_DARWIN
# GrP untested, possibly hopeless
endif
default.supp: $(DEFAULT_SUPP_FILES)
echo "# This is a generated file, composed of the following suppression rules:" > default.supp
echo "# " $(DEFAULT_SUPP_FILES) >> default.supp
cat $(DEFAULT_SUPP_FILES) >> default.supp
## Preprend @PERL@ because tests/vg_regtest isn't executable
regtest: check
@PERL@ tests/vg_regtest $(TEST_TOOLS) $(TEST_EXP_TOOLS)
nonexp-regtest: check
@PERL@ tests/vg_regtest $(TEST_TOOLS)
exp-regtest: check
@PERL@ tests/vg_regtest $(TEST_EXP_TOOLS)
## Preprend @PERL@ because tests/vg_perf isn't executable
perf: check
@PERL@ perf/vg_perf perf
# Nb: no need to include any Makefile.am files here, or files included from
# them, as automake includes them automatically.
EXTRA_DIST = \
README_DEVELOPERS \
README_PACKAGERS \
README_MISSING_SYSCALL_OR_IOCTL \
valgrind.spec.in valgrind.pc.in \
$(vex_primary_sources) \
vg-in-place
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(valdir)
all-local: default.supp
mkdir -p $(inplacedir)
rm -f $(inplacedir)/default.supp
ln -s ../default.supp $(inplacedir)
clean-local:
rm -rf $(inplacedir)
# These list the bits of vex we need to install
VEX_PUBLIC_HDRS = \
@VEX_DIR@/pub/libvex_guest_amd64.h \
@VEX_DIR@/pub/libvex_ir.h \
@VEX_DIR@/pub/libvex_guest_ppc32.h \
@VEX_DIR@/pub/libvex_guest_ppc64.h \
@VEX_DIR@/pub/libvex_basictypes.h \
@VEX_DIR@/pub/libvex_guest_offsets.h \
@VEX_DIR@/pub/libvex_emwarn.h \
@VEX_DIR@/pub/libvex.h \
@VEX_DIR@/pub/libvex_trc_values.h \
@VEX_DIR@/pub/libvex_guest_arm.h \
@VEX_DIR@/pub/libvex_guest_x86.h
# These list the bits of vex we need to copy into the tarball
vex_primary_sources = \
VEX/quote.txt \
VEX/newline.txt \
VEX/HACKING.README \
VEX/LICENSE.README \
VEX/LICENSE.GPL \
VEX/Makefile \
VEX/auxprogs/genoffsets.c \
VEX/pub/libvex_guest_amd64.h \
VEX/pub/libvex_ir.h \
VEX/pub/libvex_guest_ppc32.h \
VEX/pub/libvex_guest_ppc64.h \
VEX/pub/libvex_basictypes.h \
VEX/pub/libvex_guest_offsets.h \
VEX/pub/libvex_emwarn.h \
VEX/pub/libvex.h \
VEX/pub/libvex_trc_values.h \
VEX/pub/libvex_guest_arm.h \
VEX/pub/libvex_guest_x86.h \
VEX/priv/ir/irmatch.c \
VEX/priv/ir/irmatch.h \
VEX/priv/ir/irdefs.c \
VEX/priv/ir/iropt.c \
VEX/priv/ir/iropt.h \
VEX/priv/host-ppc/isel.c \
VEX/priv/host-ppc/hdefs.c \
VEX/priv/host-ppc/hdefs.h \
VEX/priv/main/vex_svnversion.h \
VEX/priv/main/vex_globals.c \
VEX/priv/main/vex_globals.h \
VEX/priv/main/vex_main.c \
VEX/priv/main/vex_util.c \
VEX/priv/main/vex_util.h \
VEX/priv/guest-arm/ghelpers.c \
VEX/priv/guest-arm/gdefs.h \
VEX/priv/guest-arm/toIR.c \
VEX/priv/guest-x86/ghelpers.c \
VEX/priv/guest-x86/gdefs.h \
VEX/priv/guest-x86/toIR.c \
VEX/priv/guest-generic/g_generic_x87.c \
VEX/priv/guest-generic/g_generic_x87.h \
VEX/priv/guest-generic/bb_to_IR.c \
VEX/priv/guest-generic/bb_to_IR.h \
VEX/priv/host-arm/isel.c \
VEX/priv/host-arm/hdefs.c \
VEX/priv/host-arm/hdefs.h \
VEX/priv/host-x86/isel.c \
VEX/priv/host-x86/hdefs.c \
VEX/priv/host-x86/hdefs.h \
VEX/priv/guest-amd64/ghelpers.c \
VEX/priv/guest-amd64/gdefs.h \
VEX/priv/guest-amd64/toIR.c \
VEX/priv/guest-ppc/ghelpers.c \
VEX/priv/guest-ppc/gdefs.h \
VEX/priv/guest-ppc/toIR.c \
VEX/priv/host-generic/reg_alloc2.c \
VEX/priv/host-generic/h_generic_regs.c \
VEX/priv/host-generic/h_generic_regs.h \
VEX/priv/host-generic/h_generic_simd64.c \
VEX/priv/host-generic/h_generic_simd64.h \
VEX/priv/host-amd64/isel.c \
VEX/priv/host-amd64/hdefs.c \
VEX/priv/host-amd64/hdefs.h
# Generate a linker script for linking the binaries. This is the
# standard gcc linker script, except hacked so that an alternative
# load address can be specified by (1) asking gcc to use this script
# (-Wl,-T,valt_load_address.lds) and (2) setting the symbol
# valt_load_address to the required value
# (-Wl,-defsym,valt_load_address=0x70000000).
#
# Extract ld's default linker script and hack it to our needs.
# First we cut everything above and below the "=====..." lines at the top
# and bottom.
# Then we have to replace the load address with "valt_load_address".
# The line to replace in has one of the following two forms:
#
# . = 0x08048000 + SIZEOF_HEADERS;
#
# or
# PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
#
# So we search for the line with a hex value "+ SIZEOF_HEADERS", and replace
# all the hex values in that line with "valt_load_address".
valt_load_address_x86_linux.lds: Makefile
$(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/,/.\*/d' \
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|| rm -f $@
valt_load_address_amd64_linux.lds: Makefile
$(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/,/.\*/d' \
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|| rm -f $@
valt_load_address_ppc32_linux.lds: Makefile
$(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/,/.\*/d' \
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|| rm -f $@
valt_load_address_ppc64_linux.lds: Makefile
$(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/,/.\*/d' \
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|| rm -f $@