nethercote | 4388a40 | 2004-09-01 23:20:49 +0000 | [diff] [blame] | 1 | |
njn | 7375de3 | 2009-08-05 08:08:18 +0000 | [diff] [blame] | 2 | SUBDIRS = . tests |
nethercote | 4388a40 | 2004-09-01 23:20:49 +0000 | [diff] [blame] | 3 | |
nethercote | b35a8b9 | 2004-09-11 16:45:27 +0000 | [diff] [blame] | 4 | include $(top_srcdir)/Makefile.all.am |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 5 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 6 | #---------------------------------------------------------------------------- |
| 7 | # <tool>-<platform> stuff |
| 8 | #---------------------------------------------------------------------------- |
| 9 | |
| 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 |
| 18 | |
| 19 | |
| 20 | TOOL_LDADD_COMMON = -lgcc |
| 21 | TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \ |
| 22 | $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) $(TOOL_LDADD_COMMON) |
| 23 | if VGCONF_HAVE_PLATFORM_SEC |
| 24 | TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@ = \ |
| 25 | $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@) $(TOOL_LDADD_COMMON) |
| 26 | endif |
| 27 | |
| 28 | |
| 29 | TOOL_LDFLAGS_COMMON_LINUX = -static \ |
| 30 | -Wl,-defsym,valt_load_address=@VALT_LOAD_ADDRESS@ \ |
| 31 | -nodefaultlibs -nostartfiles -u _start |
| 32 | TOOL_LDFLAGS_COMMON_AIX5 = -static -Wl,-e_start_valgrind |
| 33 | TOOL_LDFLAGS_COMMON_DARWIN = -nodefaultlibs -nostartfiles \ |
| 34 | -Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld |
| 35 | |
| 36 | TOOL_LDFLAGS_X86_LINUX = \ |
| 37 | $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \ |
| 38 | -Wl,-T,$(top_builddir)/valt_load_address_x86_linux.lds |
| 39 | |
| 40 | TOOL_LDFLAGS_AMD64_LINUX = \ |
| 41 | $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \ |
| 42 | -Wl,-T,$(top_builddir)/valt_load_address_amd64_linux.lds |
| 43 | |
| 44 | TOOL_LDFLAGS_PPC32_LINUX = \ |
| 45 | $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \ |
| 46 | -Wl,-T,$(top_builddir)/valt_load_address_ppc32_linux.lds |
| 47 | |
| 48 | TOOL_LDFLAGS_PPC64_LINUX = \ |
| 49 | $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \ |
| 50 | -Wl,-T,$(top_builddir)/valt_load_address_ppc64_linux.lds |
| 51 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 52 | TOOL_LDFLAGS_ARM_LINUX = \ |
| 53 | $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \ |
| 54 | -Wl,-T,$(top_builddir)/valt_load_address_arm_linux.lds |
| 55 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 56 | TOOL_LDFLAGS_PPC32_AIX5 = \ |
| 57 | $(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@ |
| 58 | |
| 59 | TOOL_LDFLAGS_PPC64_AIX5 = \ |
| 60 | $(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@ -Wl,-bbigtoc |
| 61 | |
| 62 | TOOL_LDFLAGS_X86_DARWIN = \ |
| 63 | $(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386 \ |
| 64 | -Wl,-seg1addr,0xf0080000 \ |
| 65 | -Wl,-stack_addr,0xf0080000 -Wl,-stack_size,0x80000 \ |
| 66 | -Wl,-pagezero_size,0xf0000000 |
| 67 | |
| 68 | # pagezero can't be unmapped and remapped. Use stack instead. |
| 69 | # GrP fixme no stack guard |
| 70 | TOOL_LDFLAGS_AMD64_DARWIN = \ |
| 71 | $(TOOL_LDFLAGS_COMMON_DARWIN) -arch x86_64 \ |
| 72 | -Wl,-seg1addr,0x7fff55000000 \ |
| 73 | -Wl,-stack_addr,0x7fff50080000 -Wl,-stack_size,0x7ffe50080000 \ |
| 74 | -Wl,-pagezero_size,0x100000000 |
| 75 | |
| 76 | |
| 77 | BUILT_SOURCES = |
| 78 | CLEANFILES = |
| 79 | if VGCONF_PLATFORMS_INCLUDE_X86_LINUX |
| 80 | BUILT_SOURCES += $(top_builddir)/valt_load_address_x86_linux.lds |
| 81 | CLEANFILES += $(top_builddir)/valt_load_address_x86_linux.lds |
| 82 | endif |
| 83 | if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX |
| 84 | BUILT_SOURCES += $(top_builddir)/valt_load_address_amd64_linux.lds |
| 85 | CLEANFILES += $(top_builddir)/valt_load_address_amd64_linux.lds |
| 86 | endif |
| 87 | if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX |
| 88 | BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc32_linux.lds |
| 89 | CLEANFILES += $(top_builddir)/valt_load_address_ppc32_linux.lds |
| 90 | endif |
| 91 | if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX |
| 92 | BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc64_linux.lds |
| 93 | CLEANFILES += $(top_builddir)/valt_load_address_ppc64_linux.lds |
| 94 | endif |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 95 | if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX |
| 96 | BUILT_SOURCES += $(top_builddir)/valt_load_address_arm_linux.lds |
| 97 | CLEANFILES += $(top_builddir)/valt_load_address_arm_linux.lds |
| 98 | endif |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 99 | if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5 |
| 100 | # No need to generate $(top_builddir)/valt_load_address*.lds; the final |
| 101 | # executables can be linked to be at any address. They will be relocated by |
| 102 | # AIX kernel when they are loaded. |
| 103 | endif |
| 104 | if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 |
| 105 | # Ditto |
| 106 | endif |
| 107 | if VGCONF_OS_IS_DARWIN |
| 108 | # GrP untested, possibly hopeless |
| 109 | endif |
| 110 | |
| 111 | |
| 112 | # Generate a linker script for linking the binaries. This is the |
| 113 | # standard gcc linker script, except hacked so that an alternative |
| 114 | # load address can be specified by (1) asking gcc to use this script |
| 115 | # (-Wl,-T,valt_load_address.lds) and (2) setting the symbol |
| 116 | # valt_load_address to the required value |
| 117 | # (-Wl,-defsym,valt_load_address=0x70000000). |
| 118 | # |
| 119 | # Extract ld's default linker script and hack it to our needs. |
| 120 | # First we cut everything above and below the "=====..." lines at the top |
| 121 | # and bottom. |
| 122 | # Then we have to replace the load address with "valt_load_address". |
| 123 | # The line to replace in has one of the following two forms: |
| 124 | # |
| 125 | # . = 0x08048000 + SIZEOF_HEADERS; |
| 126 | # |
| 127 | # or |
| 128 | # PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS; |
| 129 | # |
| 130 | # So we search for the line with a hex value "+ SIZEOF_HEADERS", and replace |
| 131 | # all the hex values in that line with "valt_load_address". |
| 132 | $(top_builddir)/valt_load_address_x86_linux.lds: Makefile |
| 133 | $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 134 | -e '1,/^=====\+$$/d' \ |
| 135 | -e '/^=====\+$$/,/.\*/d' \ |
| 136 | -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' > $@ \ |
| 137 | || rm -f $@ |
| 138 | |
| 139 | $(top_builddir)/valt_load_address_amd64_linux.lds: Makefile |
| 140 | $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 141 | -e '1,/^=====\+$$/d' \ |
| 142 | -e '/^=====\+$$/,/.\*/d' \ |
| 143 | -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' > $@ \ |
| 144 | || rm -f $@ |
| 145 | |
| 146 | $(top_builddir)/valt_load_address_ppc32_linux.lds: Makefile |
| 147 | $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 148 | -e '1,/^=====\+$$/d' \ |
| 149 | -e '/^=====\+$$/,/.\*/d' \ |
| 150 | -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' > $@ \ |
| 151 | || rm -f $@ |
| 152 | |
| 153 | $(top_builddir)/valt_load_address_ppc64_linux.lds: Makefile |
| 154 | $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 155 | -e '1,/^=====\+$$/d' \ |
| 156 | -e '/^=====\+$$/,/.\*/d' \ |
| 157 | -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' > $@ \ |
| 158 | || rm -f $@ |
| 159 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 160 | $(top_builddir)/valt_load_address_arm_linux.lds: Makefile |
| 161 | $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 162 | -e '1,/^=====\+$$/d' \ |
| 163 | -e '/^=====\+$$/,/.\*/d' \ |
| 164 | -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' > $@ \ |
| 165 | || rm -f $@ |
| 166 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 167 | #---------------------------------------------------------------------------- |
| 168 | # vgpreload_<tool>-<platform>.a stuff |
| 169 | #---------------------------------------------------------------------------- |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 170 | |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 171 | LIBREPLACEMALLOC_X86_LINUX = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 172 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-linux.a |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 173 | |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 174 | LIBREPLACEMALLOC_AMD64_LINUX = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 175 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-linux.a |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 176 | |
| 177 | LIBREPLACEMALLOC_PPC32_LINUX = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 178 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-linux.a |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 179 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 180 | LIBREPLACEMALLOC_PPC64_LINUX = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 181 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64-linux.a |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 182 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 183 | LIBREPLACEMALLOC_ARM_LINUX = \ |
| 184 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-arm-linux.a |
| 185 | |
sewardj | 1eff82b | 2006-10-17 00:56:43 +0000 | [diff] [blame] | 186 | LIBREPLACEMALLOC_PPC32_AIX5 = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 187 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-aix5.a |
sewardj | 1eff82b | 2006-10-17 00:56:43 +0000 | [diff] [blame] | 188 | |
| 189 | LIBREPLACEMALLOC_PPC64_AIX5 = \ |
sewardj | 4d3f7a4 | 2009-02-22 23:40:31 +0000 | [diff] [blame] | 190 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64-aix5.a |
sewardj | 1eff82b | 2006-10-17 00:56:43 +0000 | [diff] [blame] | 191 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 192 | LIBREPLACEMALLOC_X86_DARWIN = \ |
| 193 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-darwin.a |
| 194 | |
| 195 | LIBREPLACEMALLOC_AMD64_DARWIN = \ |
| 196 | $(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-darwin.a |
| 197 | |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 198 | |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 199 | LIBREPLACEMALLOC_LDFLAGS_X86_LINUX = \ |
| 200 | -Wl,--whole-archive \ |
| 201 | $(LIBREPLACEMALLOC_X86_LINUX) \ |
| 202 | -Wl,--no-whole-archive |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 203 | |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 204 | LIBREPLACEMALLOC_LDFLAGS_AMD64_LINUX = \ |
| 205 | -Wl,--whole-archive \ |
| 206 | $(LIBREPLACEMALLOC_AMD64_LINUX) \ |
| 207 | -Wl,--no-whole-archive |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 208 | |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 209 | LIBREPLACEMALLOC_LDFLAGS_PPC32_LINUX = \ |
| 210 | -Wl,--whole-archive \ |
| 211 | $(LIBREPLACEMALLOC_PPC32_LINUX) \ |
| 212 | -Wl,--no-whole-archive |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 213 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 214 | LIBREPLACEMALLOC_LDFLAGS_PPC64_LINUX = \ |
| 215 | -Wl,--whole-archive \ |
| 216 | $(LIBREPLACEMALLOC_PPC64_LINUX) \ |
| 217 | -Wl,--no-whole-archive |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 218 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 219 | LIBREPLACEMALLOC_LDFLAGS_ARM_LINUX = \ |
| 220 | -Wl,--whole-archive \ |
| 221 | $(LIBREPLACEMALLOC_ARM_LINUX) \ |
| 222 | -Wl,--no-whole-archive |
| 223 | |
sewardj | 1eff82b | 2006-10-17 00:56:43 +0000 | [diff] [blame] | 224 | LIBREPLACEMALLOC_LDFLAGS_PPC32_AIX5 = \ |
| 225 | $(LIBREPLACEMALLOC_PPC32_AIX5) |
njn | b7fda4c | 2009-02-06 04:05:43 +0000 | [diff] [blame] | 226 | |
sewardj | 1eff82b | 2006-10-17 00:56:43 +0000 | [diff] [blame] | 227 | LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5 = \ |
| 228 | $(LIBREPLACEMALLOC_PPC64_AIX5) |
njn | 3e65340 | 2009-02-06 07:12:57 +0000 | [diff] [blame] | 229 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 230 | LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN = \ |
| 231 | $(LIBREPLACEMALLOC_X86_DARWIN) |
njn | 3e65340 | 2009-02-06 07:12:57 +0000 | [diff] [blame] | 232 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 233 | LIBREPLACEMALLOC_LDFLAGS_AMD64_DARWIN = \ |
| 234 | $(LIBREPLACEMALLOC_AMD64_DARWIN) |
njn | ac31b05 | 2009-02-12 00:30:02 +0000 | [diff] [blame] | 235 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 236 | #---------------------------------------------------------------------------- |
| 237 | # General stuff |
| 238 | #---------------------------------------------------------------------------- |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 239 | |
| 240 | all-local: inplace-noinst_PROGRAMS inplace-noinst_DSYMS |
| 241 | |
| 242 | clean-local: clean-noinst_DSYMS |
| 243 | |
| 244 | install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS |
njn | ac31b05 | 2009-02-12 00:30:02 +0000 | [diff] [blame] | 245 | |