You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(9) |
2
(13) |
3
(12) |
4
(4) |
5
(5) |
|
6
(5) |
7
(16) |
8
(9) |
9
(14) |
10
(15) |
11
(7) |
12
(2) |
|
13
(7) |
14
(9) |
15
(8) |
16
(6) |
17
|
18
(2) |
19
(4) |
|
20
|
21
(7) |
22
(12) |
23
(6) |
24
(2) |
25
(3) |
26
(2) |
|
27
(2) |
28
(5) |
29
(7) |
30
(10) |
|
|
|
|
From: Philippe W. <phi...@sk...> - 2010-06-02 21:19:19
|
> I still do not understand why vgdb can "force" the process to execute code by just changing > the program counter. Is this PC change detected by the kernel and interpreted as a request > to put the process back into user context (if it was waiting in a syscall), as it is needed > to result in execution of the code? My understanding: the kernel scheduler job is to make a process sleep or run basically by saving or restoring the registers of the process to put asleep or to resume. When the process is stopped by ptrace, the SETREGS ptrace modifies the saved registers of the stopped process. When the is process is continued, the kernel restores these saved registers and ensures the processor starts executing instructions at the restored program counter. But this just a guess, I did not look at the linux kernel code. Philippe |
|
From: Julian S. <js...@ac...> - 2010-06-02 21:13:32
|
Bart, Just ignore all that. I can see what the problem is: https://bugs.kde.org/show_bug.cgi?id=193413#c18 although I can't see how to fix it right now. Urr. J On Wednesday 02 June 2010, Julian Seward wrote: > On Wednesday 02 June 2010, Bart Van Assche wrote: > > Hello Julian, > > > > The output I get with r11145 on openSUSE 11.2 is as follows: > > > > $ ./vg-in-place --tool=none /bin/ls > > valgrind: mmap(0x400000, 94208) failed in UME with error 22 (Invalid > > argument). valgrind: this can be caused by executables with very large > > text, data or bss segments. > > Hmm, that does sound like a gold-esque linking problem, yes. > > * is this a from distclean build? For r11141, a make clean isn't enough, > it really requires a from-distclean build. > > * the build should produce some lines "link_tool_exe: ...." > Can you show one of them? > > * what does /usr/bin/ld --version produce? > > J > > --------------------------------------------------------------------------- >--- ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: Julian S. <js...@ac...> - 2010-06-02 20:47:16
|
On Wednesday 02 June 2010, Bart Van Assche wrote: > Hello Julian, > > The output I get with r11145 on openSUSE 11.2 is as follows: > > $ ./vg-in-place --tool=none /bin/ls > valgrind: mmap(0x400000, 94208) failed in UME with error 22 (Invalid > argument). valgrind: this can be caused by executables with very large > text, data or bss segments. Hmm, that does sound like a gold-esque linking problem, yes. * is this a from distclean build? For r11141, a make clean isn't enough, it really requires a from-distclean build. * the build should produce some lines "link_tool_exe: ...." Can you show one of them? * what does /usr/bin/ld --version produce? J |
|
From: Bart V. A. <bva...@ac...> - 2010-06-02 19:39:33
|
Hello Julian,
The output I get with r11145 on openSUSE 11.2 is as follows:
$ ./vg-in-place --tool=none /bin/ls
valgrind: mmap(0x400000, 94208) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data
or bss segments.
$ ./vg-in-place -v -v -d -d --tool=none /bin/ls
--22839:1:debuglog DebugLog system started by Stage 1, level 2 logging requested
--22839:1:launcher tool 'none' requested
--22839:2:launcher selecting platform for '/bin/ls'
--22839:2:launcher selecting platform for '/bin/ls'
--22839:2:launcher opened '/bin/ls'
--22839:2:launcher read 4096 bytes from '/bin/ls'
--22839:2:launcher selected platform 'amd64-linux'
--22839:1:launcher selected platform 'amd64-linux'
--22839:1:launcher launching
/home/bart/software/valgrind/./.in_place/none-amd64-linux
--22839:1:debuglog DebugLog system started by Stage 2 (main), level 2
logging requested
--22839:1:main Welcome to Valgrind version 3.6.0.SVN debug logging
--22839:1:main Checking current stack is plausible
--22839:1:main Checking initial stack was noted
--22839:1:main Starting the address space manager
--22839:2:aspacem sp_at_startup = 0x7fff130cdc90 (supplied)
--22839:2:aspacem minAddr = 0x0004000000 (computed)
--22839:2:aspacem maxAddr = 0x07ffffffff (computed)
--22839:2:aspacem cStart = 0x0004000000 (computed)
--22839:2:aspacem vStart = 0x0402000000 (computed)
--22839:2:aspacem suggested_clstack_top = 0x07ff000fff (computed)
--22839:2:aspacem <<< SHOW_SEGMENTS: Initial layout (5 segments, 0 segnames)
--22839:2:aspacem 0: RSVN 0000000000-0003ffffff 64m ----- SmFixed
--22839:2:aspacem 1: 0004000000-0401ffffff 16352m
--22839:2:aspacem 2: RSVN 0402000000-0402000fff 4096 ----- SmFixed
--22839:2:aspacem 3: 0402001000-07ffffffff 16351m
--22839:2:aspacem 4: RSVN 0800000000-ffffffffffffffff 16383e ----- SmFixed
--22839:2:aspacem >>>
--22839:2:aspacem Reading /proc/self/maps
--22839:2:aspacem <<< SHOW_SEGMENTS: With contents of
/proc/self/maps (18 segments, 1 segnames)
--22839:2:aspacem ( 0) /home/bart/software/valgrind/none/none-amd64-linux
--22839:2:aspacem 0: RSVN 0000000000-00003fffff 4194304 ----- SmFixed
--22839:2:aspacem 1: FILE 0000400000-0000400fff 4096 r----
d=0x902 i=6087151 o=0 (0)
--22839:2:aspacem 2: RSVN 0000401000-0003ffffff 59m ----- SmFixed
--22839:2:aspacem 3: 0004000000-0037ffffff 832m
--22839:2:aspacem 4: FILE 0038000000-00381cafff 1880064 r-x--
d=0x902 i=6087151 o=2097152 (0)
--22839:2:aspacem 5: 00381cb000-00383c9fff 2093056
--22839:2:aspacem 6: FILE 00383ca000-00383ccfff 12288 rw---
d=0x902 i=6087151 o=3973120 (0)
--22839:2:aspacem 7: ANON 00383cd000-0038d4cfff 9961472 rw---
--22839:2:aspacem 8: 0038d4d000-0401ffffff 15506m
--22839:2:aspacem 9: RSVN 0402000000-0402000fff 4096 ----- SmFixed
--22839:2:aspacem 10: 0402001000-07ffffffff 16351m
--22839:2:aspacem 11: RSVN 0800000000-7fff130aefff 131036g ----- SmFixed
--22839:2:aspacem 12: ANON 7fff130af000-7fff130cffff 135168 rw---
--22839:2:aspacem 13: RSVN 7fff130d0000-7fff131adfff 909312 ----- SmFixed
--22839:2:aspacem 14: ANON 7fff131ae000-7fff131aefff 4096 r-x--
--22839:2:aspacem 15: RSVN 7fff131af000-ffffffffff5fffff 16383e
----- SmFixed
--22839:2:aspacem 16: ANON ffffffffff600000-ffffffffff600fff 4096 r-x--
--22839:2:aspacem 17: RSVN ffffffffff601000-ffffffffffffffff
9m ----- SmFixed
--22839:2:aspacem >>>
--22839:1:main Address space manager is running
--22839:1:main Starting the dynamic memory manager
--22839:1:mallocfr newSuperblock at 0x402001000 (pszB 4194272) owner
VALGRIND/tool
--22839:1:main Dynamic memory manager is running
--22839:1:main Initialise m_debuginfo
--22839:1:main VG_(libdir) = /home/bart/software/valgrind/./.in_place
--22839:1:main Getting launcher's name ...
--22839:1:main ... /home/bart/software/valgrind/coregrind/valgrind
--22839:1:main Get hardware capabilities ...
--22839:1:main ... arch = AMD64, hwcaps = amd64-sse3-cx16
--22839:1:main Getting the working directory at startup
--22839:1:main ... /home/bart/software/valgrind
--22839:1:main Split up command line
--22839:1:main (early_) Process Valgrind's command line options
--22839:1:main Create initial image
--22839:1:initimg Loading client
valgrind: mmap(0x400000, 94208) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data
or bss segments.
Bart.
On Wed, Jun 2, 2010 at 2:31 AM, <sv...@va...> wrote:
> Author: sewardj
> Date: 2010-06-02 01:31:34 +0100 (Wed, 02 Jun 2010)
> New Revision: 11141
>
> Log:
> Add a new program (link_tool_exe.c) and use this to link the tool
> executables. Gets rid of the linker script kludgery and uniformly
> uses -Ttext=0x38000000 (or whatever) on Linux, so as to accomodate
> both traditional ld and gold. Should fix #193413 although I have
> been unable to test it. Using a whole new program seems like
> overkill, but this is infrastructure to support static linking of
> the tool executables on MacOS too.
>
>
> Added:
> trunk/coregrind/link_tool_exe.c
> Modified:
> trunk/Makefile.all.am
> trunk/Makefile.tool.am
> trunk/cachegrind/Makefile.am
> trunk/callgrind/Makefile.am
> trunk/coregrind/Makefile.am
> trunk/drd/Makefile.am
> trunk/exp-bbv/Makefile.am
> trunk/exp-ptrcheck/Makefile.am
> trunk/helgrind/Makefile.am
> trunk/lackey/Makefile.am
> trunk/massif/Makefile.am
> trunk/memcheck/Makefile.am
> trunk/none/Makefile.am
>
>
> Modified: trunk/Makefile.all.am
> ===================================================================
> --- trunk/Makefile.all.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/Makefile.all.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -37,8 +37,10 @@
> inplace-noinst_PROGRAMS: $(noinst_PROGRAMS)
> mkdir -p $(inplacedir); \
> for f in $(noinst_PROGRAMS) ; do \
> - rm -f $(inplacedir)/$$f; \
> - ln -f -s ../$(subdir)/$$f $(inplacedir); \
> + if [ $$f != link_tool_exe ] ; then \
> + rm -f $(inplacedir)/$$f; \
> + ln -f -s ../$(subdir)/$$f $(inplacedir); \
> + fi; \
> done
>
> # Similar to inplace-noinst_PROGRAMS
> @@ -55,7 +57,9 @@
> install-noinst_PROGRAMS: $(noinst_PROGRAMS)
> $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
> for f in $(noinst_PROGRAMS); do \
> - $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
> + if [ $$f != link_tool_exe ] ; then \
> + $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
> + fi; \
> done
>
> # Similar to install-noinst_PROGRAMS.
>
> Modified: trunk/Makefile.tool.am
> ===================================================================
> --- trunk/Makefile.tool.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/Makefile.tool.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -26,32 +26,28 @@
> endif
>
>
> -TOOL_LDFLAGS_COMMON_LINUX = -static \
> - -Wl,-defsym,valt_load_address=@VALT_LOAD_ADDRESS@ \
> - -nodefaultlibs -nostartfiles -u _start
> -TOOL_LDFLAGS_COMMON_AIX5 = -static -Wl,-e_start_valgrind
> -TOOL_LDFLAGS_COMMON_DARWIN = -nodefaultlibs -nostartfiles \
> +TOOL_LDFLAGS_COMMON_LINUX = \
> + -static -nodefaultlibs -nostartfiles -u _start
> +TOOL_LDFLAGS_COMMON_AIX5 = \
> + -static -Wl,-e_start_valgrind
> +TOOL_LDFLAGS_COMMON_DARWIN = \
> + -nodefaultlibs -nostartfiles \
> -Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld
>
> TOOL_LDFLAGS_X86_LINUX = \
> - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
> - -Wl,-T,$(top_builddir)/valt_load_address_x86_linux.lds
> + $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
>
> TOOL_LDFLAGS_AMD64_LINUX = \
> - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
> - -Wl,-T,$(top_builddir)/valt_load_address_amd64_linux.lds
> + $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
>
> TOOL_LDFLAGS_PPC32_LINUX = \
> - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
> - -Wl,-T,$(top_builddir)/valt_load_address_ppc32_linux.lds
> + $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
>
> TOOL_LDFLAGS_PPC64_LINUX = \
> - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
> - -Wl,-T,$(top_builddir)/valt_load_address_ppc64_linux.lds
> + $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
>
> TOOL_LDFLAGS_ARM_LINUX = \
> - $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
> - -Wl,-T,$(top_builddir)/valt_load_address_arm_linux.lds
> + $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
>
> TOOL_LDFLAGS_PPC32_AIX5 = \
> $(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@
> @@ -74,96 +70,6 @@
> -Wl,-pagezero_size,0x100000000
>
>
> -BUILT_SOURCES =
> -CLEANFILES =
> -if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
> -BUILT_SOURCES += $(top_builddir)/valt_load_address_x86_linux.lds
> -CLEANFILES += $(top_builddir)/valt_load_address_x86_linux.lds
> -endif
> -if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX
> -BUILT_SOURCES += $(top_builddir)/valt_load_address_amd64_linux.lds
> -CLEANFILES += $(top_builddir)/valt_load_address_amd64_linux.lds
> -endif
> -if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX
> -BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc32_linux.lds
> -CLEANFILES += $(top_builddir)/valt_load_address_ppc32_linux.lds
> -endif
> -if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX
> -BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc64_linux.lds
> -CLEANFILES += $(top_builddir)/valt_load_address_ppc64_linux.lds
> -endif
> -if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX
> -BUILT_SOURCES += $(top_builddir)/valt_load_address_arm_linux.lds
> -CLEANFILES += $(top_builddir)/valt_load_address_arm_linux.lds
> -endif
> -if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
> -# No need to generate $(top_builddir)/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
> -
> -
> -# 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".
> -$(top_builddir)/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 $@
> -
> -$(top_builddir)/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 $@
> -
> -$(top_builddir)/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 $@
> -
> -$(top_builddir)/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 $@
> -
> -$(top_builddir)/valt_load_address_arm_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 $@
> -
> #----------------------------------------------------------------------------
> # vgpreload_<tool>-<platform>.a stuff
> #----------------------------------------------------------------------------
>
> Modified: trunk/cachegrind/Makefile.am
> ===================================================================
> --- trunk/cachegrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/cachegrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -55,6 +55,13 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> $(CACHEGRIND_SOURCES_COMMON)
> @@ -68,6 +75,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
>
>
> Modified: trunk/callgrind/Makefile.am
> ===================================================================
> --- trunk/callgrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/callgrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -65,6 +65,13 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> $(CALLGRIND_SOURCES_COMMON)
> @@ -78,5 +85,11 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
>
> Modified: trunk/coregrind/Makefile.am
> ===================================================================
> --- trunk/coregrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/coregrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -422,6 +422,27 @@
> endif
>
> #----------------------------------------------------------------------------
> +# link_tool_exe, the wrapper for the system linker
> +#----------------------------------------------------------------------------
> +
> +noinst_PROGRAMS += link_tool_exe
> +
> +link_tool_exe_SOURCES = link_tool_exe.c
> +link_tool_exe_CPPFLAGS = $(AM_CPPFLAGS_PRI)
> +link_tool_exe_CFLAGS = $(AM_CFLAGS_PRI)
> +link_tool_exe_CCASFLAGS = $(AM_CCASFLAGS_PRI)
> +link_tool_exe_LDFLAGS = $(AM_CFLAGS_PRI)
> +
> +# force link_tool_exe to be built before libcoregrind.a is, and hence
> +# before any of the tool executables are linked, since they in turn
> +# are dependent on libcoregrind.a. Unfortunately this doesn't give a
> +# dependence on link_tool_exe.c: ideally if link_tool_exe.c is
> +# changed, then 'make' rebuilds link_tool_exe, but the tool
> +# executables themselves are not relinked. I can't figure out how
> +# to get that to happen.
> +BUILT_SOURCES += link_tool_exe
> +
> +#----------------------------------------------------------------------------
> # General stuff
> #----------------------------------------------------------------------------
>
>
> Added: trunk/coregrind/link_tool_exe.c
> ===================================================================
> --- trunk/coregrind/link_tool_exe.c (rev 0)
> +++ trunk/coregrind/link_tool_exe.c 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -0,0 +1,104 @@
> +
> +/* This program handles linking the tool executables, statically and
> + at an alternative load address. Linking them statically sidesteps
> + all sorts of complications to do with having two copies of the
> + dynamic linker (valgrind's and the client's) coexisting in the same
> + process. The alternative load address is needed because Valgrind
> + itself will load the client at whatever address it specifies, which
> + is almost invariably the default load address. Hence we can't
> + allow Valgrind itself (viz, the tool executable) to be loaded at
> + that address.
> +
> + Unfortunately there's no standard way to do 'static link at
> + alternative address', so this program handles the per-platform
> + hoop-jumping.
> +*/
> +
> +/* What we get passed here is:
> + first arg
> + the alternative load address
> + all the rest of the args
> + the gcc invokation to do the final link, that
> + the build system would have done, left to itself
> +
> + We just let assertions fail rather than do proper error reporting.
> + We don't expect the users to run this directly. It is only run
> + from as part of the build process, with carefully constrained
> + inputs.
> +*/
> +
> +#if defined(VGO_linux)
> +
> +// Don't NDEBUG this; the asserts are necesary for
> +// safety checks.
> +#include <assert.h>
> +#include <string.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +int main ( int argc, char** argv )
> +{
> + int i;
> + size_t reqd = 0;
> +
> + // expect at least: alt-load-address gcc -o foo bar.o
> + assert(argc > 5);
> +
> + // check for plausible-ish alt load address
> + char* ala = argv[1];
> + assert(ala[0] == '0');
> + assert(ala[1] == 'x');
> +
> + // We'll need to invoke this to do the linking
> + char* gcc = argv[2];
> +
> + // and the 'restargs' are argv[3 ..]
> +
> + // so, build up the complete command here:
> + // 'gcc' -static -Ttext='ala' 'restargs'
> +
> + // first, do length safety checks
> + reqd += 1+ strlen(gcc);
> + reqd += 1+ 100/*let's say*/ + strlen(ala);
> + for (i = 3; i < argc; i++)
> + reqd += 1+ strlen(argv[i]);
> +
> + reqd += 1;
> + char* cmd = calloc(reqd,1);
> + assert(cmd);
> +
> + char ttext[100];
> + assert(strlen(ala) < 30);
> + memset(ttext, 0, sizeof(ttext));
> + sprintf(ttext, " -static -Wl,-Ttext=%s", ala);
> +
> + strcpy(cmd, gcc);
> + strcat(cmd, ttext);
> + for (i = 3; i < argc; i++) {
> + strcat(cmd, " ");
> + strcat(cmd, argv[i]);
> + }
> +
> + assert(cmd[reqd-1] == 0);
> +
> + if (0) printf("\n");
> + printf("link_tool_exe: %s\n", cmd);
> + if (0) printf("\n");
> +
> + int r = system(cmd);
> +
> + free(cmd);
> +
> + // return the result of system. Note, we should handle it
> + // properly; that would involve using WEXITSTATUS on the
> + // value system gives back to us.
> + return r;
> +}
> +
> +#elif defined(VGO_darwin)
> +
> +#error Daaaawin
> +
> +#else
> +# error "Unsupported OS"
> +#endif
>
> Modified: trunk/drd/Makefile.am
> ===================================================================
> --- trunk/drd/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/drd/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -66,7 +66,8 @@
> drd_semaphore.c \
> drd_suppression.c
>
> -drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(DRD_SOURCES_COMMON)
> +drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(DRD_SOURCES_COMMON)
> drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -77,8 +78,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(DRD_SOURCES_COMMON)
> +drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(DRD_SOURCES_COMMON)
> drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -89,6 +98,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> #----------------------------------------------------------------------------
> @@ -120,6 +135,7 @@
> vgpreload_drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
> $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
> $(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> vgpreload_drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
> $(VGPRELOAD_DRD_SOURCES_COMMON)
>
> Modified: trunk/exp-bbv/Makefile.am
> ===================================================================
> --- trunk/exp-bbv/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/exp-bbv/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -13,7 +13,8 @@
>
> BBV_SOURCES_COMMON = bbv_main.c
>
> -exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(BBV_SOURCES_COMMON)
> +exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(BBV_SOURCES_COMMON)
> exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -24,8 +25,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(BBV_SOURCES_COMMON)
> +exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(BBV_SOURCES_COMMON)
> exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -36,4 +45,10 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> Modified: trunk/exp-ptrcheck/Makefile.am
> ===================================================================
> --- trunk/exp-ptrcheck/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/exp-ptrcheck/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -38,6 +38,13 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> $(EXP_PTRCHECK_SOURCES_COMMON)
> @@ -51,6 +58,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> #----------------------------------------------------------------------------
> @@ -79,6 +92,7 @@
> vgpreload_exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
> $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
> $(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> vgpreload_exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
> $(VGPRELOAD_EXP_PTRCHECK_SOURCES_COMMON)
>
> Modified: trunk/helgrind/Makefile.am
> ===================================================================
> --- trunk/helgrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/helgrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -35,7 +35,8 @@
> hg_wordset.c \
> libhb_core.c
>
> -helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(HELGRIND_SOURCES_COMMON)
> +helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(HELGRIND_SOURCES_COMMON)
> helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -46,8 +47,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(HELGRIND_SOURCES_COMMON)
> +helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(HELGRIND_SOURCES_COMMON)
> helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -58,6 +67,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> #----------------------------------------------------------------------------
> @@ -86,6 +101,7 @@
> vgpreload_helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
> $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
> $(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> vgpreload_helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
> $(VGPRELOAD_HELGRIND_SOURCES_COMMON)
>
> Modified: trunk/lackey/Makefile.am
> ===================================================================
> --- trunk/lackey/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/lackey/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -13,7 +13,8 @@
>
> LACKEY_SOURCES_COMMON = lk_main.c
>
> -lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(LACKEY_SOURCES_COMMON)
> +lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(LACKEY_SOURCES_COMMON)
> lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -24,8 +25,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(LACKEY_SOURCES_COMMON)
> +lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(LACKEY_SOURCES_COMMON)
> lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -36,5 +45,11 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
>
> Modified: trunk/massif/Makefile.am
> ===================================================================
> --- trunk/massif/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/massif/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -23,7 +23,8 @@
>
> MASSIF_SOURCES_COMMON = ms_main.c
>
> -massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(MASSIF_SOURCES_COMMON)
> +massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(MASSIF_SOURCES_COMMON)
> massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -34,8 +35,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(MASSIF_SOURCES_COMMON)
> +massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(MASSIF_SOURCES_COMMON)
> massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -46,6 +55,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> #----------------------------------------------------------------------------
> @@ -71,6 +86,7 @@
> vgpreload_massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
> $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
> $(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> vgpreload_massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES =
> vgpreload_massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = \
>
> Modified: trunk/memcheck/Makefile.am
> ===================================================================
> --- trunk/memcheck/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/memcheck/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -31,7 +31,8 @@
> mc_machine.c \
> mc_errors.c
>
> -memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(MEMCHECK_SOURCES_COMMON)
> +memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(MEMCHECK_SOURCES_COMMON)
> memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -42,8 +43,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(MEMCHECK_SOURCES_COMMON)
> +memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(MEMCHECK_SOURCES_COMMON)
> memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -54,6 +63,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
> mc_main.o: CFLAGS += -fomit-frame-pointer
> @@ -84,6 +99,7 @@
> vgpreload_memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
> $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
> $(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> vgpreload_memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
> $(VGPRELOAD_MEMCHECK_SOURCES_COMMON)
>
> Modified: trunk/none/Makefile.am
> ===================================================================
> --- trunk/none/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
> +++ trunk/none/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
> @@ -13,7 +13,8 @@
>
> NONE_SOURCES_COMMON = nl_main.c
>
> -none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(NONE_SOURCES_COMMON)
> +none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
> + $(NONE_SOURCES_COMMON)
> none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
> @@ -24,8 +25,16 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
> none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
> +none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
> + $(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
> +
> if VGCONF_HAVE_PLATFORM_SEC
> -none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(NONE_SOURCES_COMMON)
> +none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
> + $(NONE_SOURCES_COMMON)
> none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
> $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
> @@ -36,6 +45,12 @@
> $(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
> none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
> $(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
> +none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
> + $(top_builddir)/coregrind/link_tool_exe \
> + @VALT_LOAD_ADDRESS@ \
> + $(LINK) \
> + $(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
> + $(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
> endif
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|
|
From: <sv...@va...> - 2010-06-02 19:33:03
|
Author: bart
Date: 2010-06-02 20:32:51 +0100 (Wed, 02 Jun 2010)
New Revision: 11145
Log:
Replaced dynamic initialization of DRD_(pthread_cond_initializer) by static initialization.
Added:
trunk/drd/drd_cond_initializer.c
Modified:
trunk/drd/Makefile.am
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/Makefile.am
===================================================================
--- trunk/drd/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
+++ trunk/drd/Makefile.am 2010-06-02 19:32:51 UTC (rev 11145)
@@ -56,6 +56,7 @@
drd_clientobj.c \
drd_clientreq.c \
drd_cond.c \
+ drd_cond_initializer.c \
drd_error.c \
drd_hb.c \
drd_load_store.c \
Added: trunk/drd/drd_cond_initializer.c
===================================================================
--- trunk/drd/drd_cond_initializer.c (rev 0)
+++ trunk/drd/drd_cond_initializer.c 2010-06-02 19:32:51 UTC (rev 11145)
@@ -0,0 +1,8 @@
+/* Make the value of PTHREAD_COND_INITIALIZER available to DRD. */
+
+#include "drd_cond.h"
+#include <pthread.h>
+
+static pthread_cond_t pthread_cond_initializer = PTHREAD_COND_INITIALIZER;
+Addr DRD_(pthread_cond_initializer) = (Addr)&pthread_cond_initializer;
+int DRD_(pthread_cond_initializer_size) = sizeof(pthread_cond_initializer);
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2010-06-02 11:58:27 UTC (rev 11144)
+++ trunk/drd/drd_pthread_intercepts.c 2010-06-02 19:32:51 UTC (rev 11145)
@@ -134,7 +134,6 @@
static void DRD_(init)(void) __attribute__((constructor));
static void DRD_(check_threading_library)(void);
static void DRD_(set_main_thread_state)(void);
-static void DRD_(set_pthread_cond_initializer)(void);
/* Function definitions. */
@@ -153,7 +152,6 @@
{
DRD_(check_threading_library)();
DRD_(set_main_thread_state)();
- DRD_(set_pthread_cond_initializer)();
}
/**
@@ -343,21 +341,6 @@
pthread_self(), 0, 0, 0, 0);
}
-/** Tell DRD which value PTHREAD_COND_INITIALIZER has. */
-static void DRD_(set_pthread_cond_initializer)(void)
-{
- int res;
-
- static pthread_cond_t pthread_cond_initializer = PTHREAD_COND_INITIALIZER;
-
- // Make sure that DRD knows about the main thread's POSIX thread ID.
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREAD_COND_INITIALIZER,
- &pthread_cond_initializer,
- sizeof(pthread_cond_initializer),
- 0, 0, 0);
-}
-
-
/*
* Note: as of today there exist three different versions of pthread_create
* in Linux:
|
Author: sewardj
Date: 2010-06-02 12:58:27 +0100 (Wed, 02 Jun 2010)
New Revision: 11144
Log:
An infrastructural change, intended to improve 64-bit support on
MacOSX and hence improve support on MacOSX 10.6, which is 64-bit
by default:
Link the tool executables statically on MacOSX, as they are on Linux.
This sidesteps a couple of problems:
* no need to play address space games by mmaping huge blocks
at startup. This gets rid of the ~4 second startup delay
for all programs in 64-bit mode on MacOSX.
* only one copy of dyld exists in the process space, instead
of two having to coexist
Changes in the patch:
* various tweaking of -fno-PIC etc for Darwin, so as to ensure
that the tool executable code isn't PIC and so can be linked
statically
* Fix a conceptual hole which (afaik) has never been noticed
before: the configure.in must specify the alternative load
address (valt_) for the primary and secondary platforms
separately. This has only not been noticed till now because
the alt load address has been the same on all Linux platforms
(0x38000000).
FTR, for 32-bit Darwin, I'm using 0x38000000 (as on Linux ..
well, it works, so might as well) and for 64-bit,
0x138000000 (the x86 address + 4G), so as to avoid pagezero.
* add a bit more debug printing to m_ume/macho.c. Also take
care not to honour client pagezero map requests either in
32- or 64-bit mode.
* get rid of dyld_stub_binding_helper stubs, whatever they are,
in coregrind/m_start-{x86,amd64}-darwin.S.
* get rid of the munmap of address-space-filling segments in
m_main.c.
* m_main: add own implementation of __udivdi3 and __umoddi3.
Need to move this somewhere sane.
* link_tool_exe.c: change darwin case handling to do a simple
static link, and mostly ignore the invokation command line
we're given.
Modified:
branches/MACOSX106/Makefile.all.am
branches/MACOSX106/Makefile.tool.am
branches/MACOSX106/auxprogs/Makefile.am
branches/MACOSX106/cachegrind/Makefile.am
branches/MACOSX106/callgrind/Makefile.am
branches/MACOSX106/configure.in
branches/MACOSX106/coregrind/Makefile.am
branches/MACOSX106/coregrind/link_tool_exe.c
branches/MACOSX106/coregrind/m_main.c
branches/MACOSX106/coregrind/m_start-amd64-darwin.S
branches/MACOSX106/coregrind/m_start-x86-darwin.S
branches/MACOSX106/coregrind/m_ume/macho.c
branches/MACOSX106/drd/Makefile.am
branches/MACOSX106/exp-bbv/Makefile.am
branches/MACOSX106/exp-ptrcheck/Makefile.am
branches/MACOSX106/helgrind/Makefile.am
branches/MACOSX106/lackey/Makefile.am
branches/MACOSX106/massif/Makefile.am
branches/MACOSX106/memcheck/Makefile.am
branches/MACOSX106/none/Makefile.am
Modified: branches/MACOSX106/Makefile.all.am
===================================================================
--- branches/MACOSX106/Makefile.all.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/Makefile.all.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -100,7 +100,8 @@
# stack traces, since users often see stack traces extending
# into (and through) the preloads.
if VGCONF_OS_IS_DARWIN
-AM_CFLAGS_PIC = -dynamic -O -g -fno-omit-frame-pointer -fno-strict-aliasing -mno-dynamic-no-pic
+AM_CFLAGS_PIC = -dynamic -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
+ -mno-dynamic-no-pic -fpic -fPIC
else
AM_CFLAGS_PIC = -fpic -O -g -fno-omit-frame-pointer -fno-strict-aliasing
endif
@@ -171,8 +172,9 @@
AM_FLAG_M3264_X86_DARWIN = -arch i386
AM_CFLAGS_X86_DARWIN = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
- -mmacosx-version-min=10.5 -fno-stack-protector \
- -mdynamic-no-pic
+ -mmacosx-version-min=10.5 \
+ -fno-stack-protector -fno-pic -fno-PIC
+
AM_CCASFLAGS_X86_DARWIN = $(AM_CPPFLAGS_X86_DARWIN) -arch i386 -g
AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64
Modified: branches/MACOSX106/Makefile.tool.am
===================================================================
--- branches/MACOSX106/Makefile.tool.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/Makefile.tool.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -56,20 +56,20 @@
$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@ -Wl,-bbigtoc
TOOL_LDFLAGS_X86_DARWIN = \
- $(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386 \
- -Wl,-seg1addr,0xf0080000 \
- -Wl,-stack_addr,0xf0080000 -Wl,-stack_size,0x80000 \
- -Wl,-pagezero_size,0xf0000000
+ $(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386
-# pagezero can't be unmapped and remapped. Use stack instead.
-# GrP fixme no stack guard
TOOL_LDFLAGS_AMD64_DARWIN = \
- $(TOOL_LDFLAGS_COMMON_DARWIN) -arch x86_64 \
- -Wl,-seg1addr,0x7fff55000000 \
- -Wl,-stack_addr,0x7fff50080000 -Wl,-stack_size,0x7ffe50080000 \
- -Wl,-pagezero_size,0x100000000
+ $(TOOL_LDFLAGS_COMMON_DARWIN) -arch x86_64
+# NB for 64-bit darwin. We may want to set -Wl,-pagezero_size to
+# something smaller than the default of 4G, so as to facilitate
+# loading clients who are also linked thusly (currently m_ume.c
+# will fail to load them). Although such setting is probably
+# better done in link_tool_exe.c.
+#
+# -Wl,-pagezero_size,0x100000000
+
#----------------------------------------------------------------------------
# vgpreload_<tool>-<platform>.a stuff
#----------------------------------------------------------------------------
Modified: branches/MACOSX106/auxprogs/Makefile.am
===================================================================
--- branches/MACOSX106/auxprogs/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/auxprogs/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -29,4 +29,6 @@
valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI)
valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI)
-
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+valgrind_listener_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
Modified: branches/MACOSX106/cachegrind/Makefile.am
===================================================================
--- branches/MACOSX106/cachegrind/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/cachegrind/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -26,6 +26,9 @@
cg_merge_CFLAGS = $(AM_CFLAGS_PRI)
cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI)
cg_merge_LDFLAGS = $(AM_CFLAGS_PRI)
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+cg_merge_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
#----------------------------------------------------------------------------
# cachegrind-<platform>
@@ -57,7 +60,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -77,7 +80,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/callgrind/Makefile.am
===================================================================
--- branches/MACOSX106/callgrind/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/callgrind/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -67,7 +67,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -87,7 +87,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/configure.in
===================================================================
--- branches/MACOSX106/configure.in 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/configure.in 2010-06-02 11:58:27 UTC (rev 11144)
@@ -358,35 +358,52 @@
AC_MSG_CHECKING([for a supported CPU/OS combination])
+# NB. The load address for a given platform may be specified in more
+# than one place, in some cases, depending on whether we're doing a biarch,
+# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
+# Be careful to give consistent values in all subcases. Also, all four
+# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
+# even if it is to "0xUNSET".
+#
case "$ARCH_MAX-$VGCONF_OS" in
x86-linux)
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
amd64-linux)
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0x38000000"
+ valt_load_address_sec_inner="0x28000000"
fi
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc32-linux)
@@ -394,11 +411,17 @@
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc64-aix5)
+ valt_load_address_pri_norml="0xUNSET"
+ valt_load_address_pri_inner="0xUNSET"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC=""
@@ -415,29 +438,35 @@
VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
fi
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc64-linux)
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC="ppc32"
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0x38000000"
+ valt_load_address_sec_inner="0x28000000"
fi
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
x86-darwin)
@@ -445,38 +474,50 @@
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
- valt_load_address_normal="0x0"
- valt_load_address_inner="0x0"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
amd64-darwin)
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
+ valt_load_address_pri_norml="0x138000000"
+ valt_load_address_pri_inner="0x128000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
VGCONF_ARCH_PRI_CAPS="x86"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
+ valt_load_address_pri_norml="0x138000000"
+ valt_load_address_pri_inner="0x128000000"
+ valt_load_address_sec_norml="0x38000000"
+ valt_load_address_sec_inner="0x28000000"
fi
- valt_load_address_normal="0x0"
- valt_load_address_inner="0x0"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
arm-linux)
VGCONF_ARCH_PRI="arm"
VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
- valt_load_address_normal="0x38000000"
- valt_load_address_inner="0x28000000"
+ valt_load_address_pri_norml="0x38000000"
+ valt_load_address_pri_inner="0x28000000"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
;;
*)
@@ -484,6 +525,10 @@
VGCONF_ARCH_SEC="unknown"
VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
+ valt_load_address_pri_norml="0xUNSET"
+ valt_load_address_pri_inner="0xUNSET"
+ valt_load_address_sec_norml="0xUNSET"
+ valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
;;
@@ -569,7 +614,8 @@
# Check if this should be built as an inner Valgrind, to be run within
# another Valgrind. Choose the load address accordingly.
-AC_SUBST(VALT_LOAD_ADDRESS)
+AC_SUBST(VALT_LOAD_ADDRESS_PRI)
+AC_SUBST(VALT_LOAD_ADDRESS_SEC)
AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
[AC_ARG_ENABLE(inner,
[ --enable-inner enables self-hosting],
@@ -577,9 +623,11 @@
[vg_cv_inner=no])])
if test "$vg_cv_inner" = yes; then
AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
- VALT_LOAD_ADDRESS=$valt_load_address_inner
+ VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
+ VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
else
- VALT_LOAD_ADDRESS=$valt_load_address_normal
+ VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
+ VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
fi
Modified: branches/MACOSX106/coregrind/Makefile.am
===================================================================
--- branches/MACOSX106/coregrind/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -54,12 +54,18 @@
valgrind_CFLAGS = $(AM_CFLAGS_PRI)
valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_LDFLAGS = $(AM_CFLAGS_PRI)
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+valgrind_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
no_op_client_for_valgrind_SOURCES = no_op_client_for_valgrind.c
no_op_client_for_valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI)
no_op_client_for_valgrind_CFLAGS = $(AM_CFLAGS_PRI)
no_op_client_for_valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
no_op_client_for_valgrind_LDFLAGS = $(AM_CFLAGS_PRI)
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+no_op_client_for_valgrind_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
#----------------------------------------------------------------------------
# Darwin Mach stuff
Modified: branches/MACOSX106/coregrind/link_tool_exe.c
===================================================================
--- branches/MACOSX106/coregrind/link_tool_exe.c 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/link_tool_exe.c 2010-06-02 11:58:27 UTC (rev 11144)
@@ -105,9 +105,53 @@
#elif defined(VGO_darwin)
-/* Run the specified command as-is; ignore the specified load address
- (argv[1]). */
+/* Plan is: look at the specified gcc invokation. Ignore all parts of
+ it except the *.a, *.o and -o outfile parts. Wrap them up in a new
+ command which looks (eg) as follows:
+ (64-bit):
+
+ /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.5 \
+ -o memcheck-amd64-darwin -u __start -e __start \
+ -image_base 0x138000000 -stack_addr 0x13c000000 \
+ -stack_size 0x800000 \
+ memcheck_amd*.o \
+ ../coregrind/libcoregrind-amd64-darwin.a \
+ ../VEX/libvex-amd64-darwin.a
+
+ (32-bit)
+
+ /usr/bin/ld -static -arch i386 -macosx_version_min 10.5 \
+ -o memcheck-x86-darwin -u __start -e __start \
+ -image_base 0x38000000 -stack_addr 0x3c000000 \
+ -stack_size 0x800000 \
+ memcheck_x86*.o \
+ ../coregrind/libcoregrind-x86-darwin.a \
+ ../VEX/libvex-x86-darwin.a
+
+ The addresses shown above will actually work, although "for real" we
+ of course need to take it from argv[1]. In these examples the stack
+ is placed 64M after the executable start. It is probably safer to
+ place it 64M before the executable's start point, so the executable
+ + data + bss can grow arbitrarily in future without colliding with
+ the stack.
+
+ There's one more twist: this executable (for the program in this
+ file) could be compiled as either 32- or 64-bit. That has no
+ bearing at all on the word size of the executable for which we are
+ linking. We need to know the latter since we need to hand to the
+ linker, "-arch x86_64" or "-arch i386". Fortunately we can figure
+ this out by scanning the gcc invokation, which itself must contain
+ either "-arch x86_64" or "-arch i386".
+*/
+
+/* user configurable constants: how far before the exe should we
+ place the stack? */
+#define TX_STACK_OFFSET_BEFORE_TEXT (64 * 1024 * 1024)
+/* and how big should the stack be */
+#define TX_STACK_SIZE (8 * 1024 * 1024)
+
+
// Don't NDEBUG this; the asserts are necesary for
// safety checks.
#include <assert.h>
@@ -115,44 +159,113 @@
#include <stdio.h>
#include <stdlib.h>
+static void add_to ( char** str, size_t* str_sz, char* to_add )
+{
+ size_t needed = strlen(to_add) +2/*paranoia*/;
+ size_t currlen = strlen(*str);
+ assert(currlen < *str_sz);
+
+ while (needed >= *str_sz - currlen) {
+ *str = realloc(*str, 2 * *str_sz);
+ assert(*str);
+ (*str_sz) *= 2;
+ }
+
+ assert(currlen < *str_sz);
+ assert(needed < *str_sz - currlen);
+ strcat(*str, to_add);
+}
+
+static int/*bool*/ is_dota_or_doto ( char* str )
+{
+ assert(str);
+ size_t n = strlen(str);
+ if (n < 2) return 0;
+ if (str[n-2] == '.' && (str[n-1] == 'a' || str[n-1] == 'o'))
+ return 1;
+ return 0;
+}
+
+/* Run the specified command as-is; ignore the specified load address
+ (argv[1]). */
+
int main ( int argc, char** argv )
{
- int i;
- size_t reqd = 0;
+ int i;
// expect at least: alt-load-address gcc -o foo bar.o
assert(argc > 5);
- // check for plausible-ish alt load address
- char* ala = argv[1];
- assert(ala[0] == '0');
- assert(ala[1] == 'x');
+ // check for plausible-ish alt load address, and get hold
+ // of it
+ char* ala_str = argv[1];
+ unsigned long long int ala = 0;
- // command to run is argv[2 ..]
+ assert(ala_str[0] == '0');
+ assert(ala_str[1] == 'x');
- // so, build up the complete command here:
- // argv[2 ..]
+ int r = sscanf(ala_str, "0x%llx", &ala);
+ assert(r == 1);
- // first, do length safety checks
- for (i = 2; i < argc; i++)
- reqd += 1+ strlen(argv[i]);
+ // get hold of the outfile name
+ char* outfile_name = NULL;
+ for (i = 1; i < argc-1; i++) {
+ if (0 == strcmp(argv[i], "-o")) {
+ outfile_name = argv[i+1];
+ break;
+ }
+ }
+ assert(outfile_name);
- reqd += 1;
- char* cmd = calloc(reqd,1);
+ // get hold of the string following -arch
+ char* arch_str = NULL;
+ for (i = 1; i < argc-1; i++) {
+ if (0 == strcmp(argv[i], "-arch")) {
+ arch_str = argv[i+1];
+ break;
+ }
+ }
+ assert(arch_str);
+
+ // build the command line
+ size_t cmd_sz = 1;
+ char* cmd = calloc(cmd_sz, 1);
assert(cmd);
- for (i = 2; i < argc; i++) {
- strcat(cmd, " ");
- strcat(cmd, argv[i]);
+ add_to(&cmd, &cmd_sz, "/usr/bin/ld");
+ add_to(&cmd, &cmd_sz, " -static");
+ add_to(&cmd, &cmd_sz, " -arch ");
+ add_to(&cmd, &cmd_sz, arch_str);
+ add_to(&cmd, &cmd_sz, " -macosx_version_min 10.5");
+ add_to(&cmd, &cmd_sz, " -o ");
+ add_to(&cmd, &cmd_sz, outfile_name);
+ add_to(&cmd, &cmd_sz, " -u __start -e __start");
+
+ char buf[40];
+ sprintf(buf, "0x%llx", ala);
+ add_to(&cmd, &cmd_sz, " -image_base ");
+ add_to(&cmd, &cmd_sz, buf);
+
+ sprintf(buf, "0x%llx", ala - TX_STACK_OFFSET_BEFORE_TEXT);
+ add_to(&cmd, &cmd_sz, " -stack_addr ");
+ add_to(&cmd, &cmd_sz, buf);
+
+ sprintf(buf, "0x%llx", (unsigned long long int)TX_STACK_SIZE);
+ add_to(&cmd, &cmd_sz, " -stack_size ");
+ add_to(&cmd, &cmd_sz, buf);
+
+ for (i = 3; i < argc; i++) {
+ if (is_dota_or_doto(argv[i])) {
+ add_to(&cmd, &cmd_sz, " ");
+ add_to(&cmd, &cmd_sz, argv[i]);
+ }
}
- assert(cmd[reqd-1] == 0);
-
- if (0) printf("\n");
+ if (1) printf("\n");
printf("link_tool_exe: %s\n", cmd);
- if (0) printf("\n");
+ if (1) printf("\n");
- int r = system(cmd);
+ r = system(cmd);
free(cmd);
Modified: branches/MACOSX106/coregrind/m_main.c
===================================================================
--- branches/MACOSX106/coregrind/m_main.c 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/m_main.c 2010-06-02 11:58:27 UTC (rev 11144)
@@ -1523,45 +1523,6 @@
# endif
//--------------------------------------------------------------
- // Darwin only: munmap address-space-filling segments
- // (oversized pagezero or stack)
- // p: none
- //--------------------------------------------------------------
- // DDD: comments from Greg Parker why these address-space-filling segments
- // are necessary:
- //
- // The memory maps are there to make sure that Valgrind's copies of libc
- // and dyld load in a non-default location, so that the inferior's own
- // libc and dyld do load in the default locations. (The kernel performs
- // the work of loading several things as described by the executable's
- // load commands, including the executable itself, dyld, the main
- // thread's stack, and the page-zero segment.) There might be a way to
- // fine-tune it so the maps are smaller but still do the job.
- //
- // The post-launch mmap behavior can be cleaned up - looks like we don't
- // unmap as much as we should - which would improve post-launch
- // performance.
- //
- // Hmm, there might be an extra-clever way to give Valgrind a custom
- // MH_DYLINKER that performs the "bootloader" work of loading dyld in an
- // acceptable place and then unloading itself. Then no mmaps would be
- // needed. I'll have to think about that one.
- //
- // [I can't work out where the address-space-filling segments are
- // created in the first place. --njn]
- //
-#if defined(VGO_darwin)
-# if VG_WORDSIZE == 4
- VG_(do_syscall2)(__NR_munmap, 0x00000000, 0xf0000000);
-# else
- // open up client space
- VG_(do_syscall2)(__NR_munmap, 0x100000000, 0x700000000000-0x100000000);
- // open up client stack and dyld
- VG_(do_syscall2)(__NR_munmap, 0x7fff5c000000, 0x4000000);
-# endif
-#endif
-
- //--------------------------------------------------------------
// Ensure we're on a plausible stack.
// p: logging
//--------------------------------------------------------------
@@ -3069,6 +3030,324 @@
#endif
+////////////////////////////////////////////////////////////////
+
+/* For static linking on x86-darwin, we need to supply our own 64-bit
+ integer division code, else the link dies thusly:
+
+ ld_classic: Undefined symbols:
+ ___udivdi3
+ ___umoddi3
+*/
+#if defined(VGP_x86_darwin)
+
+/* Routines for doing signed/unsigned 64 x 64 ==> 64 div and mod
+ (udivdi3, umoddi3, divdi3, moddi3) using only 32 x 32 ==> 32
+ division. Cobbled together from
+
+ http://www.hackersdelight.org/HDcode/divlu.c
+ http://www.hackersdelight.org/HDcode/divls.c
+ http://www.hackersdelight.org/HDcode/newCode/divDouble.c
+
+ The code from those three files is covered by the following license,
+ as it appears at:
+
+ http://www.hackersdelight.org/permissions.htm
+
+ You are free to use, copy, and distribute any of the code on
+ this web site, whether modified by you or not. You need not give
+ attribution. This includes the algorithms (some of which appear
+ in Hacker's Delight), the Hacker's Assistant, and any code
+ submitted by readers. Submitters implicitly agree to this.
+*/
+
+/* Long division, unsigned (64/32 ==> 32).
+ This procedure performs unsigned "long division" i.e., division of a
+64-bit unsigned dividend by a 32-bit unsigned divisor, producing a
+32-bit quotient. In the overflow cases (divide by 0, or quotient
+exceeds 32 bits), it returns a remainder of 0xFFFFFFFF (an impossible
+value).
+ The dividend is u1 and u0, with u1 being the most significant word.
+The divisor is parameter v. The value returned is the quotient.
+ Max line length is 57, to fit in hacker.book. */
+
+static Int nlz32(UInt x)
+{
+ Int n;
+ if (x == 0) return(32);
+ n = 0;
+ if (x <= 0x0000FFFF) {n = n +16; x = x <<16;}
+ if (x <= 0x00FFFFFF) {n = n + 8; x = x << 8;}
+ if (x <= 0x0FFFFFFF) {n = n + 4; x = x << 4;}
+ if (x <= 0x3FFFFFFF) {n = n + 2; x = x << 2;}
+ if (x <= 0x7FFFFFFF) {n = n + 1;}
+ return n;
+}
+
+/* 64 x 32 ==> 32 unsigned division, using only 32 x 32 ==> 32
+ division as a primitive. */
+static UInt divlu2(UInt u1, UInt u0, UInt v, UInt *r)
+{
+ const UInt b = 65536; // Number base (16 bits).
+ UInt un1, un0, // Norm. dividend LSD's.
+ vn1, vn0, // Norm. divisor digits.
+ q1, q0, // Quotient digits.
+ un32, un21, un10, // Dividend digit pairs.
+ rhat; // A remainder.
+ Int s; // Shift amount for norm.
+
+ if (u1 >= v) { // If overflow, set rem.
+ if (r != NULL) // to an impossible value,
+ *r = 0xFFFFFFFF; // and return the largest
+ return 0xFFFFFFFF;} // possible quotient.
+
+ s = nlz32(v); // 0 <= s <= 31.
+ v = v << s; // Normalize divisor.
+ vn1 = v >> 16; // Break divisor up into
+ vn0 = v & 0xFFFF; // two 16-bit digits.
+
+ un32 = (u1 << s) | ((u0 >> (32 - s)) & (-s >> 31));
+ un10 = u0 << s; // Shift dividend left.
+
+ un1 = un10 >> 16; // Break right half of
+ un0 = un10 & 0xFFFF; // dividend into two digits.
+
+ q1 = un32/vn1; // Compute the first
+ rhat = un32 - q1*vn1; // quotient digit, q1.
+ again1:
+ if (q1 >= b || q1*vn0 > b*rhat + un1) {
+ q1 = q1 - 1;
+ rhat = rhat + vn1;
+ if (rhat < b) goto again1;}
+
+ un21 = un32*b + un1 - q1*v; // Multiply and subtract.
+
+ q0 = un21/vn1; // Compute the second
+ rhat = un21 - q0*vn1; // quotient digit, q0.
+ again2:
+ if (q0 >= b || q0*vn0 > b*rhat + un0) {
+ q0 = q0 - 1;
+ rhat = rhat + vn1;
+ if (rhat < b) goto again2;}
+
+ if (r != NULL) // If remainder is wanted,
+ *r = (un21*b + un0 - q0*v) >> s; // return it.
+ return q1*b + q0;
+}
+
+
+/* 64 x 32 ==> 32 signed division, using only 32 x 32 ==> 32 division
+ as a primitive. */
+static Int divls(Int u1, UInt u0, Int v, Int *r)
+{
+ Int q, uneg, vneg, diff, borrow;
+
+ uneg = u1 >> 31; // -1 if u < 0.
+ if (uneg) { // Compute the absolute
+ u0 = -u0; // value of the dividend u.
+ borrow = (u0 != 0);
+ u1 = -u1 - borrow;}
+
+ vneg = v >> 31; // -1 if v < 0.
+ v = (v ^ vneg) - vneg; // Absolute value of v.
+
+ if ((UInt)u1 >= (UInt)v) goto overflow;
+
+ q = divlu2(u1, u0, v, (UInt *)r);
+
+ diff = uneg ^ vneg; // Negate q if signs of
+ q = (q ^ diff) - diff; // u and v differed.
+ if (uneg && r != NULL)
+ *r = -*r;
+
+ if ((diff ^ q) < 0 && q != 0) { // If overflow,
+ overflow: // set remainder
+ if (r != NULL) // to an impossible value,
+ *r = 0x80000000; // and return the largest
+ q = 0x80000000;} // possible neg. quotient.
+ return q;
+}
+
+
+
+/* This file contains a program for doing 64/64 ==> 64 division, on a
+machine that does not have that instruction but that does have
+instructions for "long division" (64/32 ==> 32). Code for unsigned
+division is given first, followed by a simple program for doing the
+signed version by using the unsigned version.
+ These programs are useful in implementing "long long" (64-bit)
+arithmetic on a machine that has the long division instruction. It will
+work on 64- and 32-bit machines, provided the compiler implements long
+long's (64-bit integers). It is desirable that the machine have the
+Count Leading Zeros instruction.
+ In the GNU world, these programs are known as __divdi3 and __udivdi3,
+and similar names are used here.
+ This material is not in HD, but may be in a future edition.
+Max line length is 57, to fit in hacker.book. */
+
+
+static Int nlz64(ULong x)
+{
+ Int n;
+ if (x == 0) return(64);
+ n = 0;
+ if (x <= 0x00000000FFFFFFFFULL) {n = n + 32; x = x << 32;}
+ if (x <= 0x0000FFFFFFFFFFFFULL) {n = n + 16; x = x << 16;}
+ if (x <= 0x00FFFFFFFFFFFFFFULL) {n = n + 8; x = x << 8;}
+ if (x <= 0x0FFFFFFFFFFFFFFFULL) {n = n + 4; x = x << 4;}
+ if (x <= 0x3FFFFFFFFFFFFFFFULL) {n = n + 2; x = x << 2;}
+ if (x <= 0x7FFFFFFFFFFFFFFFULL) {n = n + 1;}
+ return n;
+}
+
+// ---------------------------- udivdi3 --------------------------------
+
+ /* The variables u0, u1, etc. take on only 32-bit values, but they
+ are declared long long to avoid some compiler warning messages and to
+ avoid some unnecessary EXTRs that the compiler would put in, to
+ convert long longs to ints.
+
+ First the procedure takes care of the case in which the divisor is a
+ 32-bit quantity. There are two subcases: (1) If the left half of the
+ dividend is less than the divisor, one execution of DIVU is all that
+ is required (overflow is not possible). (2) Otherwise it does two
+ divisions, using the grade school method, with variables used as
+ suggested below.
+
+ q1 q0
+ ________
+ v) u1 u0
+ q1*v
+ ____
+ k u0 */
+
+/* These macros must be used with arguments of the appropriate type
+(unsigned long long for DIVU and long long for DIVS. They are
+simulations of the presumed machines ops. I.e., they look at only the
+low-order 32 bits of the divisor, they return garbage if the division
+overflows, and they return garbage in the high-order half of the
+quotient doubleword.
+ In practice, these would be replaced with uses of the machine's DIVU
+and DIVS instructions (e.g., by using the GNU "asm" facility). */
+
+static UInt DIVU ( ULong u, UInt v )
+{
+ UInt uHi = (UInt)(u >> 32);
+ UInt uLo = (UInt)u;
+ return divlu2(uHi, uLo, v, NULL);
+}
+
+static Int DIVS ( Long u, Int v )
+{
+ Int uHi = (Int)(u >> 32);
+ UInt uLo = (UInt)u;
+ return divls(uHi, uLo, v, NULL);
+}
+
+/* 64 x 64 ==> 64 unsigned division, using only 32 x 32 ==> 32
+ division as a primitive. */
+static ULong udivdi3(ULong u, ULong v)
+{
+ ULong u0, u1, v1, q0, q1, k, n;
+
+ if (v >> 32 == 0) { // If v < 2**32:
+ if (u >> 32 < v) // If u/v cannot overflow,
+ return DIVU(u, v) // just do one division.
+ & 0xFFFFFFFF;
+ else { // If u/v would overflow:
+ u1 = u >> 32; // Break u up into two
+ u0 = u & 0xFFFFFFFF; // halves.
+ q1 = DIVU(u1, v) // First quotient digit.
+ & 0xFFFFFFFF;
+ k = u1 - q1*v; // First remainder, < v.
+ q0 = DIVU((k << 32) + u0, v) // 2nd quot. digit.
+ & 0xFFFFFFFF;
+ return (q1 << 32) + q0;
+ }
+ }
+ // Here v >= 2**32.
+ n = nlz64(v); // 0 <= n <= 31.
+ v1 = (v << n) >> 32; // Normalize the divisor
+ // so its MSB is 1.
+ u1 = u >> 1; // To ensure no overflow.
+ q1 = DIVU(u1, v1) // Get quotient from
+ & 0xFFFFFFFF; // divide unsigned insn.
+ q0 = (q1 << n) >> 31; // Undo normalization and
+ // division of u by 2.
+ if (q0 != 0) // Make q0 correct or
+ q0 = q0 - 1; // too small by 1.
+ if ((u - q0*v) >= v)
+ q0 = q0 + 1; // Now q0 is correct.
+ return q0;
+}
+
+
+// ----------------------------- divdi3 --------------------------------
+
+/* This routine presumes that smallish cases (those which can be done in
+one execution of DIVS) are common. If this is not the case, the test for
+this case should be deleted.
+ Note that the test for when DIVS can be used is not entirely
+accurate. For example, DIVS is not used if v = 0xFFFFFFFF8000000,
+whereas if could be (if u is sufficiently small in magnitude). */
+
+// ------------------------------ cut ----------------------------------
+
+static ULong my_llabs ( Long x )
+{
+ ULong t = x >> 63;
+ return (x ^ t) - t;
+}
+
+/* 64 x 64 ==> 64 signed division, using only 32 x 32 ==> 32 division
+ as a primitive. */
+static Long divdi3(Long u, Long v)
+{
+ ULong au, av;
+ Long q, t;
+ au = my_llabs(u);
+ av = my_llabs(v);
+ if (av >> 31 == 0) { // If |v| < 2**31 and
+ // if (v << 32 >> 32 == v) { // If v is in range and
+ if (au < av << 31) { // |u|/|v| cannot
+ q = DIVS(u, v); // overflow, use DIVS.
+ return (q << 32) >> 32;
+ }
+ }
+ q = udivdi3(au,av); // Invoke udivdi3.
+ t = (u ^ v) >> 63; // If u, v have different
+ return (q ^ t) - t; // signs, negate q.
+}
+
+// ---------------------------- end cut --------------------------------
+
+ULong __udivdi3 (ULong u, ULong v)
+{
+ return udivdi3(u,v);
+}
+
+Long __divdi3 (Long u, Long v)
+{
+ return divdi3(u,v);
+}
+
+ULong __umoddi3 (ULong u, ULong v)
+{
+ ULong q = __udivdi3(u, v);
+ ULong r = u - q * v;
+ return r;
+}
+
+Long __moddi3 (Long u, Long v)
+{
+ Long q = __divdi3(u, v);
+ Long r = u - q * v;
+ return r;
+}
+
+#endif
+
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/MACOSX106/coregrind/m_start-amd64-darwin.S
===================================================================
--- branches/MACOSX106/coregrind/m_start-amd64-darwin.S 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/m_start-amd64-darwin.S 2010-06-02 11:58:27 UTC (rev 11144)
@@ -32,26 +32,6 @@
#include "pub_core_basics_asm.h"
- .text
- .align 3,0x90
-Ldyld_stub_binding_helper:
- pushq %r11
- leaq ___dso_handle(%rip), %r11
- pushq %r11
- jmpq *Ldyld_lazy_symbol_binding_entry_point(%rip)
-
- .dyld
- .align 3
-Ldyld_lazy_symbol_binding_entry_point:
- .quad 0
- .quad 0
- .quad 0
- .quad 0
- .quad 0
- .quad Ldyld_stub_binding_helper
- .quad 0
-
-
// Memory layout established by kernel:
//
// 0
Modified: branches/MACOSX106/coregrind/m_start-x86-darwin.S
===================================================================
--- branches/MACOSX106/coregrind/m_start-x86-darwin.S 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/m_start-x86-darwin.S 2010-06-02 11:58:27 UTC (rev 11144)
@@ -32,24 +32,6 @@
#include "pub_core_basics_asm.h"
- .text
- .align 2,0x90
-Ldyld_stub_binding_helper:
- pushl $__mh_execute_header
- jmpl *Ldyld_lazy_symbol_binding_entry_point
-
- .dyld
- .align 2
-Ldyld_lazy_symbol_binding_entry_point:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long Ldyld_stub_binding_helper
- .long 0
-
-
// Memory layout established by kernel:
//
// 0
Modified: branches/MACOSX106/coregrind/m_ume/macho.c
===================================================================
--- branches/MACOSX106/coregrind/m_ume/macho.c 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/coregrind/m_ume/macho.c 2010-06-02 11:58:27 UTC (rev 11144)
@@ -73,11 +73,11 @@
VG_(printf)("%s", str);
}
-static void check_mmap(SysRes res, Addr base, SizeT len)
+static void check_mmap(SysRes res, Addr base, SizeT len, HChar* who)
{
if (sr_isError(res)) {
- VG_(printf)("valgrind: mmap(0x%llx, %lld) failed in UME.\n",
- (ULong)base, (Long)len);
+ VG_(printf)("valgrind: mmap(0x%llx, %lld) failed in UME (%s).\n",
+ (ULong)base, (Long)len, who);
VG_(exit)(1);
}
}
@@ -173,6 +173,19 @@
// GrP fixme mark __UNIXSTACK as SF_STACK
+ // Don't honour the client's request to map PAGEZERO. Why not?
+ // Because when the kernel loaded the valgrind tool executable,
+ // it will have mapped pagezero itself. So further attempts
+ // to map it when loading the client are guaranteed to fail.
+#if VG_WORDSIZE == 4
+ if (segcmd->vmaddr == 0 && 0 == VG_(strcmp)(segcmd->segname, SEG_PAGEZERO)) {
+ if (segcmd->vmsize != 0x1000) {
+ print("bad executable (__PAGEZERO is not 4 KB)\n");
+ return -1;
+ }
+ return 0;
+ }
+#endif
#if VG_WORDSIZE == 8
if (segcmd->vmaddr == 0 && 0 == VG_(strcmp)(segcmd->segname, SEG_PAGEZERO)) {
if (segcmd->vmsize != 0x100000000) {
@@ -213,10 +226,11 @@
vmsize = VG_PGROUNDUP(segcmd->vmsize);
if (filesize > 0) {
addr = (Addr)segcmd->vmaddr;
+ VG_(debugLog)(2, "ume", "mmap fixed (file) (%#lx, %lu)\n", addr, filesize);
res = VG_(am_mmap_named_file_fixed_client)(addr, filesize, prot, fd,
offset + segcmd->fileoff,
filename);
- check_mmap(res, addr, filesize);
+ check_mmap(res, addr, filesize, "load_segment1");
}
// Zero-fill the remainder of the segment, if any
@@ -229,8 +243,9 @@
// page-aligned part
SizeT length = vmsize - filesize;
addr = (Addr)(filesize + segcmd->vmaddr);
+ VG_(debugLog)(2, "ume", "mmap fixed (anon) (%#lx, %lu)\n", addr, length);
res = VG_(am_mmap_anon_fixed_client)(addr, length, prot);
- check_mmap(res, addr, length);
+ check_mmap(res, addr, length, "load_segment2");
}
return 0;
@@ -343,7 +358,7 @@
SysRes res;
res = VG_(am_mmap_anon_fixed_client)(stackbase, stacksize, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC);
- check_mmap(res, stackbase, stacksize);
+ check_mmap(res, stackbase, stacksize, "load_unixthread1");
if (out_stack_start) *out_stack_start = (vki_uint8_t *)stackbase;
} else {
// custom stack - mapped via __UNIXTHREAD segment
Modified: branches/MACOSX106/drd/Makefile.am
===================================================================
--- branches/MACOSX106/drd/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/drd/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -80,7 +80,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -100,7 +100,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/exp-bbv/Makefile.am
===================================================================
--- branches/MACOSX106/exp-bbv/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/exp-bbv/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -27,7 +27,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -47,7 +47,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/exp-ptrcheck/Makefile.am
===================================================================
--- branches/MACOSX106/exp-ptrcheck/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/exp-ptrcheck/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -40,7 +40,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -60,7 +60,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/helgrind/Makefile.am
===================================================================
--- branches/MACOSX106/helgrind/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/helgrind/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -49,7 +49,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -69,7 +69,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/lackey/Makefile.am
===================================================================
--- branches/MACOSX106/lackey/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/lackey/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -27,7 +27,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -47,7 +47,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/massif/Makefile.am
===================================================================
--- branches/MACOSX106/massif/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/massif/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -37,7 +37,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -57,7 +57,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/memcheck/Makefile.am
===================================================================
--- branches/MACOSX106/memcheck/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/memcheck/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -45,7 +45,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -65,7 +65,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
Modified: branches/MACOSX106/none/Makefile.am
===================================================================
--- branches/MACOSX106/none/Makefile.am 2010-06-02 11:13:19 UTC (rev 11143)
+++ branches/MACOSX106/none/Makefile.am 2010-06-02 11:58:27 UTC (rev 11144)
@@ -27,7 +27,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_PRI@ \
$(LINK) \
$(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
$(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
@@ -47,7 +47,7 @@
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
$(top_builddir)/coregrind/link_tool_exe \
- @VALT_LOAD_ADDRESS@ \
+ @VALT_LOAD_ADDRESS_SEC@ \
$(LINK) \
$(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
$(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
|
|
From: <sv...@va...> - 2010-06-02 11:13:28
|
Author: sewardj Date: 2010-06-02 12:13:19 +0100 (Wed, 02 Jun 2010) New Revision: 11143 Log: Make a copy of trunk r11142 for the purposes of improving support for MacOSX 10.6 (Snow Leopard). Added: branches/MACOSX106/ Copied: branches/MACOSX106 (from rev 11142, trunk) |
|
From: Alexander P. <gl...@go...> - 2010-06-02 05:51:14
|
Nightly build on mcgrind ( Darwin 9.8.0 i386 ) Started at 2010-06-02 09:06:02 MSD Ended at 2010-06-02 09:25:19 MSD Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 443 tests, 16 stderr failures, 1 stdout failure, 0 post failures == memcheck/tests/null_socket (stdout) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) none/tests/async-sigs (stderr) none/tests/faultstatus (stderr) none/tests/pth_blockedsig (stderr) none/tests/require-text-symbol-2 (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/rwlock_race (stderr) helgrind/tests/tc06_two_races_xml (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc23_bogus_condwait (stderr) -- Alexander Potapenko Software Engineer Google Moscow |
|
From: Philippe W. <phi...@sk...> - 2010-06-02 05:24:43
|
> I more or less only counted the low-level features needed. > Why can't we start off with the external notifications be a feature > on top of the low-level services, independent from gdbserver? > As this is an internal protocol, we can change it when we decide to merge > gdbserver later (even with VG releases inbetween). For sure, the framework provided by gdbserver stuff is too heavy for just the objective of improving (at short term) the way callgrind is waken up. The ptrace basis can be kept for that, but the current way with which VG gives info to vgdb (FIFOs, shared mem) can probably be replaced by a simpler mechanism (e.g. callgrind could write in a file the needed info such as the address to invoke, where the list of VG threads are, etc). > My suggestion was not to get rid of (1), as (2) sometimes forwards the request to (1). > > The question was more: if I know that I am on a system with ptrace working (simply check the > version of the running linux kernel), there is no reason to first do (1), and after 100ms (2). > I always could directly start with (2), getting rid of the 100ms latency (?). For gdbserver (gdb debugging VG through vgdb relay), I think that in most cases, VG will read the data sent by vgdb faster than if trying to waking it up via ptrace, SIGSTOP, suspend all threads, invoke reading code, resume the threads (as all this are heavy operations) : the "lightweight" polling can be done often enough so that a "running" VG (which is what happens most of the time) will react directly. If the latency is annoying for some applications, effectively, your suggestion is worth trying. What you suggest above can be somewhat tested by giving to VG a huge --vgdb-poll parameter and giving --max-invoke-ms=1 to vgdb. |
|
From: Tom H. <th...@cy...> - 2010-06-02 02:50:24
|
Nightly build on lloyd ( x86_64, Fedora 7 ) Started at 2010-06-02 03:05:12 BST Ended at 2010-06-02 03:50:10 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 542 tests, 1 stderr failure, 0 stdout failures, 0 post failures == helgrind/tests/tc06_two_races_xml (stderr) |
|
From: <sv...@va...> - 2010-06-02 00:47:09
|
Author: sewardj
Date: 2010-06-02 01:46:58 +0100 (Wed, 02 Jun 2010)
New Revision: 11142
Log:
Make link_tool_exe.c work for MacOSX. This un-breaks the MacOS build
following r11141.
Modified:
trunk/coregrind/link_tool_exe.c
Modified: trunk/coregrind/link_tool_exe.c
===================================================================
--- trunk/coregrind/link_tool_exe.c 2010-06-02 00:31:34 UTC (rev 11141)
+++ trunk/coregrind/link_tool_exe.c 2010-06-02 00:46:58 UTC (rev 11142)
@@ -27,8 +27,14 @@
inputs.
*/
+/* ------------------------- LINUX ------------------------- */
+
#if defined(VGO_linux)
+/* Scheme is simple: pass the specified command to the linker as-is,
+ except, add "-static" and "-Ttext=<argv[1]>" to it.
+*/
+
// Don't NDEBUG this; the asserts are necesary for
// safety checks.
#include <assert.h>
@@ -95,10 +101,68 @@
return r;
}
+/* ------------------------- LINUX ------------------------- */
+
#elif defined(VGO_darwin)
-#error Daaaawin
+/* Run the specified command as-is; ignore the specified load address
+ (argv[1]). */
+// Don't NDEBUG this; the asserts are necesary for
+// safety checks.
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ( int argc, char** argv )
+{
+ int i;
+ size_t reqd = 0;
+
+ // expect at least: alt-load-address gcc -o foo bar.o
+ assert(argc > 5);
+
+ // check for plausible-ish alt load address
+ char* ala = argv[1];
+ assert(ala[0] == '0');
+ assert(ala[1] == 'x');
+
+ // command to run is argv[2 ..]
+
+ // so, build up the complete command here:
+ // argv[2 ..]
+
+ // first, do length safety checks
+ for (i = 2; i < argc; i++)
+ reqd += 1+ strlen(argv[i]);
+
+ reqd += 1;
+ char* cmd = calloc(reqd,1);
+ assert(cmd);
+
+ for (i = 2; i < argc; i++) {
+ strcat(cmd, " ");
+ strcat(cmd, argv[i]);
+ }
+
+ assert(cmd[reqd-1] == 0);
+
+ if (0) printf("\n");
+ printf("link_tool_exe: %s\n", cmd);
+ if (0) printf("\n");
+
+ int r = system(cmd);
+
+ free(cmd);
+
+ // return the result of system. Note, we should handle it
+ // properly; that would involve using WEXITSTATUS on the
+ // value system gives back to us.
+ return r;
+}
+
+
#else
# error "Unsupported OS"
#endif
|
|
From: Josef W. <Jos...@gm...> - 2010-06-02 00:42:51
|
On Tuesday 01 June 2010, Philippe Waroquiers wrote: > > Actually, how does this work at all? I had problems finding a man page where it is exactly described > > what should happen when a process waiting in a syscall is "interrupted" by ptrace. The man page > > on my system says that on PTRACE_ATTACH/TRACEME, a SIGSTOP signal is sent to the process. Why > > is this different to other signals? Why does the kernel need to do any special handling? > > SIGSTOP and SIGKILL are two special signals : the kernel never passes these signals to the process. Ok. > If after SIGSTOP, the only actions done by gdb (or vgdb) is to read data, and then continue the process, > then nothing special is to be done by the kernel: it just "continues" the syscall that the process was busy > doing, because the ptraced process did not execute anything, and "stayed in the same kernel context". > > But in our case, after SIGSTOP, vgdb (or gdb, if you use gdb to "call code" in the debugged process) > will "force" the process to execute some code (e.g. the gdbserver code) a.o. by setting > the program counter register and then continuing the process. I still do not understand why vgdb can "force" the process to execute code by just changing the program counter. Is this PC change detected by the kernel and interpreted as a request to put the process back into user context (if it was waiting in a syscall), as it is needed to result in execution of the code? > > For PTRACE_ATTACH, the man page states "The calling process actually becomes the parent of the > > child process for most purposes". I really would like external notifications to always work. > > However, the previous sentences suggests that ptrace modifies the environment in a way which > > is not always acceptable (?). > > The parent is changed only during the time the process is being ptraced, which in our case is during the > execution of the "forced" code to be invoked (e.g. gdbserver code). Once vgdb (or gdb) detaches > from the process, the original parent is restored. I believe all that is quite transparent, as this is used by > gdb, strace + I did hundreds of "vgdb 'interrupts'" of firefox, without seeing anything special. Ok, that sounds good. Josef |
|
From: <sv...@va...> - 2010-06-02 00:31:44
|
Author: sewardj
Date: 2010-06-02 01:31:34 +0100 (Wed, 02 Jun 2010)
New Revision: 11141
Log:
Add a new program (link_tool_exe.c) and use this to link the tool
executables. Gets rid of the linker script kludgery and uniformly
uses -Ttext=0x38000000 (or whatever) on Linux, so as to accomodate
both traditional ld and gold. Should fix #193413 although I have
been unable to test it. Using a whole new program seems like
overkill, but this is infrastructure to support static linking of
the tool executables on MacOS too.
Added:
trunk/coregrind/link_tool_exe.c
Modified:
trunk/Makefile.all.am
trunk/Makefile.tool.am
trunk/cachegrind/Makefile.am
trunk/callgrind/Makefile.am
trunk/coregrind/Makefile.am
trunk/drd/Makefile.am
trunk/exp-bbv/Makefile.am
trunk/exp-ptrcheck/Makefile.am
trunk/helgrind/Makefile.am
trunk/lackey/Makefile.am
trunk/massif/Makefile.am
trunk/memcheck/Makefile.am
trunk/none/Makefile.am
Modified: trunk/Makefile.all.am
===================================================================
--- trunk/Makefile.all.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/Makefile.all.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -37,8 +37,10 @@
inplace-noinst_PROGRAMS: $(noinst_PROGRAMS)
mkdir -p $(inplacedir); \
for f in $(noinst_PROGRAMS) ; do \
- rm -f $(inplacedir)/$$f; \
- ln -f -s ../$(subdir)/$$f $(inplacedir); \
+ if [ $$f != link_tool_exe ] ; then \
+ rm -f $(inplacedir)/$$f; \
+ ln -f -s ../$(subdir)/$$f $(inplacedir); \
+ fi; \
done
# Similar to inplace-noinst_PROGRAMS
@@ -55,7 +57,9 @@
install-noinst_PROGRAMS: $(noinst_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
for f in $(noinst_PROGRAMS); do \
- $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
+ if [ $$f != link_tool_exe ] ; then \
+ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
+ fi; \
done
# Similar to install-noinst_PROGRAMS.
Modified: trunk/Makefile.tool.am
===================================================================
--- trunk/Makefile.tool.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/Makefile.tool.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -26,32 +26,28 @@
endif
-TOOL_LDFLAGS_COMMON_LINUX = -static \
- -Wl,-defsym,valt_load_address=@VALT_LOAD_ADDRESS@ \
- -nodefaultlibs -nostartfiles -u _start
-TOOL_LDFLAGS_COMMON_AIX5 = -static -Wl,-e_start_valgrind
-TOOL_LDFLAGS_COMMON_DARWIN = -nodefaultlibs -nostartfiles \
+TOOL_LDFLAGS_COMMON_LINUX = \
+ -static -nodefaultlibs -nostartfiles -u _start
+TOOL_LDFLAGS_COMMON_AIX5 = \
+ -static -Wl,-e_start_valgrind
+TOOL_LDFLAGS_COMMON_DARWIN = \
+ -nodefaultlibs -nostartfiles \
-Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld
TOOL_LDFLAGS_X86_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
- -Wl,-T,$(top_builddir)/valt_load_address_x86_linux.lds
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
TOOL_LDFLAGS_AMD64_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
- -Wl,-T,$(top_builddir)/valt_load_address_amd64_linux.lds
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
TOOL_LDFLAGS_PPC32_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
- -Wl,-T,$(top_builddir)/valt_load_address_ppc32_linux.lds
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
TOOL_LDFLAGS_PPC64_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
- -Wl,-T,$(top_builddir)/valt_load_address_ppc64_linux.lds
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
TOOL_LDFLAGS_ARM_LINUX = \
- $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
- -Wl,-T,$(top_builddir)/valt_load_address_arm_linux.lds
+ $(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@
TOOL_LDFLAGS_PPC32_AIX5 = \
$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@
@@ -74,96 +70,6 @@
-Wl,-pagezero_size,0x100000000
-BUILT_SOURCES =
-CLEANFILES =
-if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
-BUILT_SOURCES += $(top_builddir)/valt_load_address_x86_linux.lds
-CLEANFILES += $(top_builddir)/valt_load_address_x86_linux.lds
-endif
-if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX
-BUILT_SOURCES += $(top_builddir)/valt_load_address_amd64_linux.lds
-CLEANFILES += $(top_builddir)/valt_load_address_amd64_linux.lds
-endif
-if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX
-BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc32_linux.lds
-CLEANFILES += $(top_builddir)/valt_load_address_ppc32_linux.lds
-endif
-if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX
-BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc64_linux.lds
-CLEANFILES += $(top_builddir)/valt_load_address_ppc64_linux.lds
-endif
-if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX
-BUILT_SOURCES += $(top_builddir)/valt_load_address_arm_linux.lds
-CLEANFILES += $(top_builddir)/valt_load_address_arm_linux.lds
-endif
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
-# No need to generate $(top_builddir)/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
-
-
-# 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".
-$(top_builddir)/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 $@
-
-$(top_builddir)/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 $@
-
-$(top_builddir)/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 $@
-
-$(top_builddir)/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 $@
-
-$(top_builddir)/valt_load_address_arm_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 $@
-
#----------------------------------------------------------------------------
# vgpreload_<tool>-<platform>.a stuff
#----------------------------------------------------------------------------
Modified: trunk/cachegrind/Makefile.am
===================================================================
--- trunk/cachegrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/cachegrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -55,6 +55,13 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
$(CACHEGRIND_SOURCES_COMMON)
@@ -68,6 +75,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
Modified: trunk/callgrind/Makefile.am
===================================================================
--- trunk/callgrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/callgrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -65,6 +65,13 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
$(CALLGRIND_SOURCES_COMMON)
@@ -78,5 +85,11 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
Modified: trunk/coregrind/Makefile.am
===================================================================
--- trunk/coregrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/coregrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -422,6 +422,27 @@
endif
#----------------------------------------------------------------------------
+# link_tool_exe, the wrapper for the system linker
+#----------------------------------------------------------------------------
+
+noinst_PROGRAMS += link_tool_exe
+
+link_tool_exe_SOURCES = link_tool_exe.c
+link_tool_exe_CPPFLAGS = $(AM_CPPFLAGS_PRI)
+link_tool_exe_CFLAGS = $(AM_CFLAGS_PRI)
+link_tool_exe_CCASFLAGS = $(AM_CCASFLAGS_PRI)
+link_tool_exe_LDFLAGS = $(AM_CFLAGS_PRI)
+
+# force link_tool_exe to be built before libcoregrind.a is, and hence
+# before any of the tool executables are linked, since they in turn
+# are dependent on libcoregrind.a. Unfortunately this doesn't give a
+# dependence on link_tool_exe.c: ideally if link_tool_exe.c is
+# changed, then 'make' rebuilds link_tool_exe, but the tool
+# executables themselves are not relinked. I can't figure out how
+# to get that to happen.
+BUILT_SOURCES += link_tool_exe
+
+#----------------------------------------------------------------------------
# General stuff
#----------------------------------------------------------------------------
Added: trunk/coregrind/link_tool_exe.c
===================================================================
--- trunk/coregrind/link_tool_exe.c (rev 0)
+++ trunk/coregrind/link_tool_exe.c 2010-06-02 00:31:34 UTC (rev 11141)
@@ -0,0 +1,104 @@
+
+/* This program handles linking the tool executables, statically and
+ at an alternative load address. Linking them statically sidesteps
+ all sorts of complications to do with having two copies of the
+ dynamic linker (valgrind's and the client's) coexisting in the same
+ process. The alternative load address is needed because Valgrind
+ itself will load the client at whatever address it specifies, which
+ is almost invariably the default load address. Hence we can't
+ allow Valgrind itself (viz, the tool executable) to be loaded at
+ that address.
+
+ Unfortunately there's no standard way to do 'static link at
+ alternative address', so this program handles the per-platform
+ hoop-jumping.
+*/
+
+/* What we get passed here is:
+ first arg
+ the alternative load address
+ all the rest of the args
+ the gcc invokation to do the final link, that
+ the build system would have done, left to itself
+
+ We just let assertions fail rather than do proper error reporting.
+ We don't expect the users to run this directly. It is only run
+ from as part of the build process, with carefully constrained
+ inputs.
+*/
+
+#if defined(VGO_linux)
+
+// Don't NDEBUG this; the asserts are necesary for
+// safety checks.
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ( int argc, char** argv )
+{
+ int i;
+ size_t reqd = 0;
+
+ // expect at least: alt-load-address gcc -o foo bar.o
+ assert(argc > 5);
+
+ // check for plausible-ish alt load address
+ char* ala = argv[1];
+ assert(ala[0] == '0');
+ assert(ala[1] == 'x');
+
+ // We'll need to invoke this to do the linking
+ char* gcc = argv[2];
+
+ // and the 'restargs' are argv[3 ..]
+
+ // so, build up the complete command here:
+ // 'gcc' -static -Ttext='ala' 'restargs'
+
+ // first, do length safety checks
+ reqd += 1+ strlen(gcc);
+ reqd += 1+ 100/*let's say*/ + strlen(ala);
+ for (i = 3; i < argc; i++)
+ reqd += 1+ strlen(argv[i]);
+
+ reqd += 1;
+ char* cmd = calloc(reqd,1);
+ assert(cmd);
+
+ char ttext[100];
+ assert(strlen(ala) < 30);
+ memset(ttext, 0, sizeof(ttext));
+ sprintf(ttext, " -static -Wl,-Ttext=%s", ala);
+
+ strcpy(cmd, gcc);
+ strcat(cmd, ttext);
+ for (i = 3; i < argc; i++) {
+ strcat(cmd, " ");
+ strcat(cmd, argv[i]);
+ }
+
+ assert(cmd[reqd-1] == 0);
+
+ if (0) printf("\n");
+ printf("link_tool_exe: %s\n", cmd);
+ if (0) printf("\n");
+
+ int r = system(cmd);
+
+ free(cmd);
+
+ // return the result of system. Note, we should handle it
+ // properly; that would involve using WEXITSTATUS on the
+ // value system gives back to us.
+ return r;
+}
+
+#elif defined(VGO_darwin)
+
+#error Daaaawin
+
+#else
+# error "Unsupported OS"
+#endif
Modified: trunk/drd/Makefile.am
===================================================================
--- trunk/drd/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/drd/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -66,7 +66,8 @@
drd_semaphore.c \
drd_suppression.c
-drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(DRD_SOURCES_COMMON)
+drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(DRD_SOURCES_COMMON)
drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -77,8 +78,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(DRD_SOURCES_COMMON)
+drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(DRD_SOURCES_COMMON)
drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -89,6 +98,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
#----------------------------------------------------------------------------
@@ -120,6 +135,7 @@
vgpreload_drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
$(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+
if VGCONF_HAVE_PLATFORM_SEC
vgpreload_drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
$(VGPRELOAD_DRD_SOURCES_COMMON)
Modified: trunk/exp-bbv/Makefile.am
===================================================================
--- trunk/exp-bbv/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/exp-bbv/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -13,7 +13,8 @@
BBV_SOURCES_COMMON = bbv_main.c
-exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(BBV_SOURCES_COMMON)
+exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(BBV_SOURCES_COMMON)
exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -24,8 +25,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(BBV_SOURCES_COMMON)
+exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(BBV_SOURCES_COMMON)
exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -36,4 +45,10 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
Modified: trunk/exp-ptrcheck/Makefile.am
===================================================================
--- trunk/exp-ptrcheck/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/exp-ptrcheck/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -38,6 +38,13 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
$(EXP_PTRCHECK_SOURCES_COMMON)
@@ -51,6 +58,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
#----------------------------------------------------------------------------
@@ -79,6 +92,7 @@
vgpreload_exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
$(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+
if VGCONF_HAVE_PLATFORM_SEC
vgpreload_exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
$(VGPRELOAD_EXP_PTRCHECK_SOURCES_COMMON)
Modified: trunk/helgrind/Makefile.am
===================================================================
--- trunk/helgrind/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/helgrind/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -35,7 +35,8 @@
hg_wordset.c \
libhb_core.c
-helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(HELGRIND_SOURCES_COMMON)
+helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(HELGRIND_SOURCES_COMMON)
helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -46,8 +47,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(HELGRIND_SOURCES_COMMON)
+helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(HELGRIND_SOURCES_COMMON)
helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -58,6 +67,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
#----------------------------------------------------------------------------
@@ -86,6 +101,7 @@
vgpreload_helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
$(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+
if VGCONF_HAVE_PLATFORM_SEC
vgpreload_helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
$(VGPRELOAD_HELGRIND_SOURCES_COMMON)
Modified: trunk/lackey/Makefile.am
===================================================================
--- trunk/lackey/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/lackey/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -13,7 +13,8 @@
LACKEY_SOURCES_COMMON = lk_main.c
-lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(LACKEY_SOURCES_COMMON)
+lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(LACKEY_SOURCES_COMMON)
lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -24,8 +25,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(LACKEY_SOURCES_COMMON)
+lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(LACKEY_SOURCES_COMMON)
lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -36,5 +45,11 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
Modified: trunk/massif/Makefile.am
===================================================================
--- trunk/massif/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/massif/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -23,7 +23,8 @@
MASSIF_SOURCES_COMMON = ms_main.c
-massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(MASSIF_SOURCES_COMMON)
+massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(MASSIF_SOURCES_COMMON)
massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -34,8 +35,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(MASSIF_SOURCES_COMMON)
+massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(MASSIF_SOURCES_COMMON)
massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -46,6 +55,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
#----------------------------------------------------------------------------
@@ -71,6 +86,7 @@
vgpreload_massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
$(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+
if VGCONF_HAVE_PLATFORM_SEC
vgpreload_massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES =
vgpreload_massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = \
Modified: trunk/memcheck/Makefile.am
===================================================================
--- trunk/memcheck/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/memcheck/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -31,7 +31,8 @@
mc_machine.c \
mc_errors.c
-memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(MEMCHECK_SOURCES_COMMON)
+memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(MEMCHECK_SOURCES_COMMON)
memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -42,8 +43,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(MEMCHECK_SOURCES_COMMON)
+memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(MEMCHECK_SOURCES_COMMON)
memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -54,6 +63,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
mc_main.o: CFLAGS += -fomit-frame-pointer
@@ -84,6 +99,7 @@
vgpreload_memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) \
$(LIBREPLACEMALLOC_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+
if VGCONF_HAVE_PLATFORM_SEC
vgpreload_memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = \
$(VGPRELOAD_MEMCHECK_SOURCES_COMMON)
Modified: trunk/none/Makefile.am
===================================================================
--- trunk/none/Makefile.am 2010-05-29 18:43:43 UTC (rev 11140)
+++ trunk/none/Makefile.am 2010-06-02 00:31:34 UTC (rev 11141)
@@ -13,7 +13,8 @@
NONE_SOURCES_COMMON = nl_main.c
-none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = $(NONE_SOURCES_COMMON)
+none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = \
+ $(NONE_SOURCES_COMMON)
none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = \
@@ -24,8 +25,16 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@)
none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
+none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
+ $(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS)
+
if VGCONF_HAVE_PLATFORM_SEC
-none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = $(NONE_SOURCES_COMMON)
+none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = \
+ $(NONE_SOURCES_COMMON)
none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS = \
$(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS = \
@@ -36,6 +45,12 @@
$(TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@)
none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS = \
$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
+none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
+ $(top_builddir)/coregrind/link_tool_exe \
+ @VALT_LOAD_ADDRESS@ \
+ $(LINK) \
+ $(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
+ $(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS)
endif
|