Bug 473604 - Fix bug472219.c compile failure with Clang 16
[valgrind.git] / Makefile.tool.am
blob4ce6d5ab0d435c79692d5fec9e23abfd8c089a44
2 SUBDIRS = . tests
4 include $(top_srcdir)/Makefile.all.am
6 #----------------------------------------------------------------------------
7 # <tool>-<platform> stuff
8 #----------------------------------------------------------------------------
10 TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@ = \
11         $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \
12         $(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
13 if VGCONF_HAVE_PLATFORM_SEC
14 TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@ = \
15         $(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \
16         $(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
17 endif
19 TOOL_LDADD_COMMON = -lgcc
20 TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \
21         $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) $(TOOL_LDADD_COMMON)
22 if VGCONF_HAVE_PLATFORM_SEC
23 TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@ = \
24         $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@) $(TOOL_LDADD_COMMON)
25 endif
27 if !COMPILER_IS_CLANG
28 TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ += \
29         $(top_builddir)/coregrind/libgcc-sup-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
30 if VGCONF_HAVE_PLATFORM_SEC
31 TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@ += \
32         $(top_builddir)/coregrind/libgcc-sup-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
33 endif
34 endif
37 # -Wl,--build-id=none is needed when linking tools with a linker that only
38 # knows -Ttext and not -Ttext-segment. Without this flag newer ld versions
39 # (2.20 and later) create a .note.gnu.build-id at the default text segment
40 # address, which of course means the resulting executable
41 # is unusable. So we have to tell ld not to generate that, with
42 # --build-id=none unless the linker supports -Ttext-segment.
43 TOOL_LDFLAGS_COMMON_LINUX = \
44         -static -nodefaultlibs -nostartfiles -u _start @FLAG_NO_BUILD_ID@
45 TOOL_LDFLAGS_COMMON_DARWIN = \
46         -nodefaultlibs -nostartfiles -Wl,-u,__start -Wl,-e,__start
47 TOOL_LDFLAGS_COMMON_SOLARIS = \
48         -static -nodefaultlibs -nostartfiles -u _start \
49         -Wl,-M,/usr/lib/ld/map.noexstk
50 TOOL_LDFLAGS_COMMON_FREEBSD = -static \
51         -nodefaultlibs -nostartfiles -Wl,-u,_start @FLAG_NO_BUILD_ID@
53 TOOL_LDFLAGS_X86_LINUX = \
54         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
56 TOOL_LDFLAGS_X86_FREEBSD = \
57         $(TOOL_LDFLAGS_COMMON_FREEBSD) @FLAG_M32@
59 TOOL_LDFLAGS_AMD64_LINUX = \
60         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
62 TOOL_LDFLAGS_AMD64_FREEBSD = \
63         $(TOOL_LDFLAGS_COMMON_FREEBSD) @FLAG_M64@
65 TOOL_LDFLAGS_PPC32_LINUX = \
66         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
68 TOOL_LDFLAGS_PPC64BE_LINUX = \
69         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
71 TOOL_LDFLAGS_PPC64LE_LINUX = \
72         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
74 TOOL_LDFLAGS_ARM_LINUX = \
75         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
77 TOOL_LDFLAGS_ARM64_LINUX = \
78         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
80 TOOL_LDFLAGS_S390X_LINUX = \
81         $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ @FLAG_S390_PGSTE@
83 TOOL_LDFLAGS_X86_DARWIN = \
84         $(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386
86 TOOL_LDFLAGS_AMD64_DARWIN = \
87         $(TOOL_LDFLAGS_COMMON_DARWIN) -arch x86_64
89 # MIPS Linux default start symbol is __start, not _start like on x86 or amd
90 TOOL_LDFLAGS_MIPS32_LINUX = \
91         -static -nodefaultlibs -nostartfiles -u __start @FLAG_NO_BUILD_ID@ \
92         @FLAG_M32@
94 TOOL_LDFLAGS_NANOMIPS_LINUX = \
95         -static -nodefaultlibs -nostartfiles -u __start @FLAG_NO_BUILD_ID@ \
96         @FLAG_M32@ -Wl,-no-relax
98 TOOL_LDFLAGS_MIPS64_LINUX = \
99         -static -nodefaultlibs -nostartfiles -u __start @FLAG_NO_BUILD_ID@ \
100         @FLAG_M64@
102 TOOL_LDFLAGS_X86_SOLARIS = \
103         $(TOOL_LDFLAGS_COMMON_SOLARIS) @FLAG_M32@
105 TOOL_LDFLAGS_AMD64_SOLARIS = \
106         $(TOOL_LDFLAGS_COMMON_SOLARIS) @FLAG_M64@
108 # On Android we must ask for non-executable stack, not sure why.
109 if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX
110 if VGCONF_PLATVARIANT_IS_ANDROID
111 TOOL_LDFLAGS_ARM_LINUX += -Wl,-z,noexecstack
112 endif
113 endif
115 # NB for 64-bit darwin.  We may want to set -Wl,-pagezero_size to
116 # something smaller than the default of 4G, so as to facilitate
117 # loading clients who are also linked thusly (currently m_ume.c
118 # will fail to load them).  Although such setting is probably
119 # better done in link_tool_exe.c.
121 #       -Wl,-pagezero_size,0x100000000
124 #----------------------------------------------------------------------------
125 # vgpreload_<tool>-<platform>.a stuff
126 #----------------------------------------------------------------------------
128 LIBREPLACEMALLOC_X86_LINUX = \
129         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-linux.a
131 LIBREPLACEMALLOC_AMD64_LINUX = \
132         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-linux.a
134 LIBREPLACEMALLOC_PPC32_LINUX = \
135         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-linux.a
137 LIBREPLACEMALLOC_PPC64BE_LINUX = \
138         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64be-linux.a
140 LIBREPLACEMALLOC_PPC64LE_LINUX = \
141         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64le-linux.a
143 LIBREPLACEMALLOC_X86_FREEBSD = \
144         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-freebsd.a
146 LIBREPLACEMALLOC_ARM_LINUX = \
147         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-arm-linux.a
149 LIBREPLACEMALLOC_ARM64_LINUX = \
150         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-arm64-linux.a
152 LIBREPLACEMALLOC_AMD64_FREEBSD = \
153         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-freebsd.a
155 LIBREPLACEMALLOC_X86_DARWIN = \
156         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-darwin.a
158 LIBREPLACEMALLOC_AMD64_DARWIN = \
159         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-darwin.a
161 LIBREPLACEMALLOC_S390X_LINUX = \
162         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-s390x-linux.a
164 LIBREPLACEMALLOC_MIPS32_LINUX = \
165         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-mips32-linux.a
167 LIBREPLACEMALLOC_MIPS64_LINUX = \
168         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-mips64-linux.a
170 LIBREPLACEMALLOC_X86_SOLARIS = \
171         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-solaris.a
173 LIBREPLACEMALLOC_AMD64_SOLARIS = \
174         $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-solaris.a
176 LIBREPLACEMALLOC_LDFLAGS_X86_LINUX = \
177         -Wl,--whole-archive \
178         $(LIBREPLACEMALLOC_X86_LINUX) \
179         -Wl,--no-whole-archive
181 LIBREPLACEMALLOC_LDFLAGS_AMD64_LINUX = \
182         -Wl,--whole-archive \
183         $(LIBREPLACEMALLOC_AMD64_LINUX) \
184         -Wl,--no-whole-archive
186 LIBREPLACEMALLOC_LDFLAGS_PPC32_LINUX = \
187         -Wl,--whole-archive \
188         $(LIBREPLACEMALLOC_PPC32_LINUX) \
189         -Wl,--no-whole-archive
191 LIBREPLACEMALLOC_LDFLAGS_PPC64BE_LINUX = \
192         -Wl,--whole-archive \
193         $(LIBREPLACEMALLOC_PPC64BE_LINUX) \
194         -Wl,--no-whole-archive
196 LIBREPLACEMALLOC_LDFLAGS_PPC64LE_LINUX = \
197         -Wl,--whole-archive \
198         $(LIBREPLACEMALLOC_PPC64LE_LINUX) \
199         -Wl,--no-whole-archive
201 LIBREPLACEMALLOC_LDFLAGS_ARM_LINUX = \
202         -Wl,--whole-archive \
203         $(LIBREPLACEMALLOC_ARM_LINUX) \
204         -Wl,--no-whole-archive
206 LIBREPLACEMALLOC_LDFLAGS_ARM64_LINUX = \
207         -Wl,--whole-archive \
208         $(LIBREPLACEMALLOC_ARM64_LINUX) \
209         -Wl,--no-whole-archive
211 LIBREPLACEMALLOC_LDFLAGS_X86_FREEBSD = \
212         -Wl,--whole-archive \
213         $(LIBREPLACEMALLOC_X86_FREEBSD) \
214         -Wl,--no-whole-archive
216 LIBREPLACEMALLOC_LDFLAGS_AMD64_FREEBSD = \
217         -Wl,--whole-archive \
218         $(LIBREPLACEMALLOC_AMD64_FREEBSD) \
219         -Wl,--no-whole-archive
221 LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN = \
222         $(LIBREPLACEMALLOC_X86_DARWIN)
224 LIBREPLACEMALLOC_LDFLAGS_AMD64_DARWIN = \
225         $(LIBREPLACEMALLOC_AMD64_DARWIN)
227 LIBREPLACEMALLOC_LDFLAGS_S390X_LINUX = \
228         -Wl,--whole-archive \
229         $(LIBREPLACEMALLOC_S390X_LINUX) \
230         -Wl,--no-whole-archive
232 LIBREPLACEMALLOC_LDFLAGS_MIPS32_LINUX = \
233         -Wl,--whole-archive \
234         $(LIBREPLACEMALLOC_MIPS32_LINUX) \
235         -Wl,--no-whole-archive
237 LIBREPLACEMALLOC_LDFLAGS_MIPS64_LINUX = \
238         -Wl,--whole-archive \
239         $(LIBREPLACEMALLOC_MIPS64_LINUX) \
240         -Wl,--no-whole-archive
242 LIBREPLACEMALLOC_LDFLAGS_X86_SOLARIS = \
243         -Wl,--whole-archive \
244         $(LIBREPLACEMALLOC_X86_SOLARIS) \
245         -Wl,--no-whole-archive
247 LIBREPLACEMALLOC_LDFLAGS_AMD64_SOLARIS = \
248         -Wl,--whole-archive \
249         $(LIBREPLACEMALLOC_AMD64_SOLARIS) \
250         -Wl,--no-whole-archive
252 #----------------------------------------------------------------------------
253 # General stuff
254 #----------------------------------------------------------------------------
256 all-local: inplace-noinst_PROGRAMS inplace-noinst_DSYMS
258 clean-local: clean-noinst_DSYMS
260 install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS
262 uninstall-local: uninstall-noinst_PROGRAMS uninstall-noinst_DSYMS