|
From: <sv...@va...> - 2005-08-08 12:15:04
|
Author: sewardj
Date: 2005-08-08 13:14:46 +0100 (Mon, 08 Aug 2005)
New Revision: 4342
Log:
Nasty build-system hackery to get coregrind/ built as a library
against which tools are statically linked. Currently what is here at
the moment is able to construct a statically linked (?) binary
valgrind_memcheck and install it in $(prefix)/bin. Note, the resulting
binary does not work yet.
There is an appalling kludge which would benefit from the attention of
people more skilled than me in the Art Of Automake:
In coregrind, I fundamentally want automake to build 'libcoregrind.a'.
And automake is all set up to do that. Except .. automake constructs
the .a by using /usr/bin/ar, which is a problem because some of the
inputs to libcoregrind.a are themselves .a files (specifically, the
results of building any m_modulename/ directory). And so ar barfs.
My horrible hack is tell automake that the name of 'ar' is in fact 'ld
-r -o'. Since ld is able to accept both .o and .a files as input this
works, except that the resulting libcoregrind.a is actually a .o file.
If anybody knows how to fix this properly I would be happy to hear
from you.
Other changes:
- renamed all aspects of the magic linker script 'stage2.lds' to
'valt_load_address.lds' and lift it up to the top level directory,
since all tools will need to see it when they are linked.
- got rid of everything to do with PIE
Other kludges:
- load_tool() in m_main.c is now kludged to (1) just return &VG_(tool_inf=
o)
and (2) to return a hardwired preloadpath. These will need to be
fixed properly.
Modified:
branches/ASPACEM/Makefile.am
branches/ASPACEM/Makefile.core-AM_CPPFLAGS.am
branches/ASPACEM/configure.in
branches/ASPACEM/coregrind/Makefile.am
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/memcheck/Makefile.am
branches/ASPACEM/memcheck/tests/Makefile.am
Modified: branches/ASPACEM/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/Makefile.am 2005-08-08 08:59:42 UTC (rev 4341)
+++ branches/ASPACEM/Makefile.am 2005-08-08 12:14:46 UTC (rev 4342)
@@ -31,8 +31,8 @@
incincdir =3D $(includedir)/valgrind
nodist_incinc_HEADERS =3D $(VEX_PUBLIC_HDRS)
=20
-BUILT_SOURCES =3D default.supp valgrind.pc
-
+BUILT_SOURCES =3D default.supp valgrind.pc valt_load_address.lds
+CLEANFILES =3D valt_load_address.lds
DISTCLEANFILES =3D default.supp
=20
default.supp: $(SUPP_FILES)
@@ -140,3 +140,32 @@
VEX/priv/host-amd64/isel.c \
VEX/priv/host-amd64/hdefs.c \
VEX/priv/host-amd64/hdefs.h
+
+
+# Generate a linker script for linking the binaries. This is the
+# standard gcc linker script, except hacked so that an alternative
+# load address can be specified by (1) asking gcc to use this script
+# (-Wl,-T,valt_load_address.lds) and (2) setting the symbol
+# valt_load_address to the required value
+# (-Wl,-defsym,valt_load_address=3D0x70000000).
+#
+# Extract ld's default linker script and hack it to our needs.
+# First we cut everything above and below the "=3D=3D=3D=3D=3D..." 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:
+#
+# . =3D 0x08048000 + SIZEOF_HEADERS;
+#
+# or
+# PROVIDE (__executable_start =3D 0x08048000); . =3D 0x08048000 + SIZE=
OF_HEADERS;
+#
+# So we search for the line with a hex value "+ SIZEOF_HEADERS", and rep=
lace
+# all the hex values in that line with "valt_load_address".
+valt_load_address.lds: Makefile
+ $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
+ -e '1,/^=3D=3D=3D=3D=3D\+$$/d' \
+ -e '/^=3D=3D=3D=3D=3D\+$$/d' \
+ -e '/\. =3D 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_lo=
ad_address/g' > $@ \
+ || rm -f $@
+
Modified: branches/ASPACEM/Makefile.core-AM_CPPFLAGS.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/Makefile.core-AM_CPPFLAGS.am 2005-08-08 08:59:42 UTC=
(rev 4341)
+++ branches/ASPACEM/Makefile.core-AM_CPPFLAGS.am 2005-08-08 12:14:46 UTC=
(rev 4342)
@@ -14,6 +14,6 @@
PIC_AM_CFLAGS =3D $(BASE_AM_CFLAGS) -fpic -fno-omit-frame-pointer
=20
AM_CPPFLAGS =3D $(add_includes)
-AM_CFLAGS =3D $(WERROR) @PIE_AM_CFLAGS@ $(BASE_AM_CFLAGS)
+AM_CFLAGS =3D $(WERROR) $(BASE_AM_CFLAGS)
AM_CCASFLAGS =3D $(add_includes) @ARCH_CORE_AM_CCASFLAGS@ -Wa,-gstabs
=20
Modified: branches/ASPACEM/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/configure.in 2005-08-08 08:59:42 UTC (rev 4341)
+++ branches/ASPACEM/configure.in 2005-08-08 12:14:46 UTC (rev 4342)
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT(Valgrind, 3.1.SVN, val...@li...)
+AC_INIT(Valgrind, 3.1.ASPACEM, val...@li...)
AC_CONFIG_SRCDIR(coregrind/m_main.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
@@ -111,7 +111,7 @@
AC_SUBST(VG_ARCH)
AC_SUBST(VG_ARCH_ALL)
VG_ARCH_ALL=3D"amd64 ppc32 x86"
-AC_SUBST(KICKSTART_BASE)
+AC_SUBST(VALT_LOAD_ADDRESS)
AC_SUBST(ARCH_CORE_AM_CFLAGS)
AC_SUBST(ARCH_TOOL_AM_CFLAGS)
AC_SUBST(ARCH_CORE_AM_CCASFLAGS)
@@ -120,7 +120,7 @@
i?86)=20
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH=3D"x86"
- KICKSTART_BASE=3D"0xb0000000"
+ VALT_LOAD_ADDRESS=3D"0xb0000000"
ARCH_CORE_AM_CFLAGS=3D"@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
ARCH_TOOL_AM_CFLAGS=3D"@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
ARCH_CORE_AM_CCASFLAGS=3D"@FLAG_M32@"
@@ -132,7 +132,7 @@
# XXX: relocations under amd64's "small model" are 32-bit signed
# quantities; therefore going above 0x7fffffff doesn't work... t=
his is
# a problem.
- KICKSTART_BASE=3D"0x70000000"
+ VALT_LOAD_ADDRESS=3D"0x70000000"
ARCH_CORE_AM_CFLAGS=3D"-m64 -fomit-frame-pointer @PREFERRED_STAC=
K_BOUNDARY@"=20
# XXX: need to use -fpic, otherwise when linking tools I get thi=
s error
# message:
@@ -147,7 +147,7 @@
powerpc*)
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH=3D"ppc32"
- KICKSTART_BASE=3D"0x70000000"
+ VALT_LOAD_ADDRESS=3D"0x70000000"
ARCH_CORE_AM_CFLAGS=3D""
ARCH_TOOL_AM_CFLAGS=3D"-fpic"
ARCH_CORE_AM_CCASFLAGS=3D"-Wa,-maltivec"
@@ -416,19 +416,6 @@
fi
=20
=20
-# Check for PIE support in the compiler and linker
-AC_SUBST(PIE_AM_CFLAGS)
-AC_CACHE_CHECK([for PIE support], vg_cv_pie,
- [AC_ARG_ENABLE(pie, [ --enable-pie platform supports=
PIE linking],
- [vg_cv_pie=3D$enableval],
- [vg_cv_pie=3Dno] )])
-if test "$vg_cv_pie" =3D yes; then
-AC_DEFINE([HAVE_PIE], 1, [can create position-independent executables])
-PIE_AM_CFLAGS=3D"-fpie"
-fi
-AM_CONDITIONAL(USE_PIE, test "$vg_cv_pie" =3D "yes")
-
-
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
Modified: branches/ASPACEM/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/Makefile.am 2005-08-08 08:59:42 UTC (rev 4=
341)
+++ branches/ASPACEM/coregrind/Makefile.am 2005-08-08 12:14:46 UTC (rev 4=
342)
@@ -23,11 +23,17 @@
=20
default.supp: $(SUPP_FILES)
=20
-bin_PROGRAMS =3D \
- valgrind
+## XXXXXXXXXXXXX JRS 8 Aug 05: the next three lines constitute an
+## appalling hack. Although we purportedly create a .a file, in fact
+## it is really a .o (relocatable ELF object) file. The root reason
+## is that some of the inputs to libcoregrind.a are themselves .a files,
+## and I don't know how to get /usr/bin/ar to accept .a files as inputs.
+noinst_LIBRARIES =3D libcoregrind.a
+libcoregrind_a_AR =3D $(LD) --whole-archive -r -o
+RANLIB =3D echo "Not really ranlib-ing"
+## end of hack
=20
val_PROGRAMS =3D \
- stage2 \
vg_preload_core.so
=20
noinst_HEADERS =3D \
@@ -80,18 +86,10 @@
vki_unistd-ppc32-linux.h\
vki_unistd-x86-linux.h
=20
-BUILT_SOURCES =3D stage2.lds
-CLEANFILES =3D stage2.lds
+BUILT_SOURCES =3D=20
+CLEANFILES =3D=20
=20
-valgrind_SOURCES =3D \
- stage1.c \
- m_debuglog.c \
- m_ume.c
-valgrind_DEPENDENCIES =3D
-valgrind_LDFLAGS=3D-static -g
-valgrind_LDADD=3D
-
-stage2_SOURCES =3D \
+libcoregrind_a_SOURCES =3D \
m_cpuid.S \
m_debugger.c \
m_debuglog.c \
@@ -126,7 +124,7 @@
m_ume.c
=20
## Nb: libscheduler.a must precede libdispatch.a in this list.
-stage2_extra=3D \
+libcoregrind_a_extra=3D \
m_debuginfo/libdebuginfo.a \
m_demangle/libdemangle.a \
m_scheduler/libscheduler.a \
@@ -136,36 +134,27 @@
m_syswrap/libsyswrap.a \
@VEX_DIR@/libvex.a
=20
-## These ones must be linked in with the --whole-archive flag, because t=
hey
-## wouldn't get pulled into stage2 otherwise (because they contain symbo=
ls
-## only referred to by tool shared objects).
-stage2_extra2 =3D \
+## These ones must be linked in with the --whole-archive flag, because
+## they wouldn't get pulled into libcoregrind otherwise (because they
+## contain symbols only referred to by tool shared objects).
+libcoregrind_a_extra2 =3D \
m_replacemalloc/libreplacemalloc_core.a
=20
## Nb: older versions of automake don't seem to like having +=3D within =
an
## if-then-else, so we have to use these variables for the common parts.
-st2_DEPS_common =3D \
- $(stage2_extra) \
- $(stage2_extra2)
+libcoregrind_a_DEPS_common =3D \
+ $(libcoregrind_a_extra) \
+ $(libcoregrind_a_extra2)
=20
st2_LDFLAGS_common =3D \
-Wl,--export-dynamic -g \
- -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive
+ -Wl,--whole-archive $(libcoregrind_a_extra2) -Wl,--no-whole-archive
=20
-if USE_PIE
-stage2_DEPENDENCIES =3D $(st2_DEPS_common)
-stage2_LDFLAGS =3D \
- $(st2_LDFLAGS_common) \
- -pie
-else
-stage2_DEPENDENCIES =3D $(st2_DEPS_common) stage2.lds
-stage2_LDFLAGS =3D \
- $(st2_LDFLAGS_common) \
- -Wl,-defsym,kickstart_base=3D@KICKSTART_BASE@ -Wl,-T,stage2.lds
-endif
+libcoregrind_a_DEPENDENCIES =3D $(libcoregrind_a_DEPS_common)
+libcoregrind_a_LIBFLAGS =3D \
+ $(st2_LDFLAGS_common)
=20
-stage2_LDADD=3D $(stage2_extra) \
- -ldl
+libcoregrind_a_LIBADD=3D $(libcoregrind_a_extra) $(libcoregrind_a_extra2=
)
=20
vg_preload_core_so_SOURCES =3D vg_preloaded.c
vg_preload_core_so_CFLAGS =3D $(AM_CFLAGS) -fpic
@@ -175,28 +164,8 @@
-Wl,--soname,vg_preload_core.so \
-Wl,-z,initfirst
=20
-# Extract ld's default linker script and hack it to our needs.
-# First we cut everything above and below the "=3D=3D=3D=3D=3D..." lines=
at the top
-# and bottom.
-# Then we have to replace the load address with "kickstart_base".
-# The line to replace in has one of the following two forms:
-#
-# . =3D 0x08048000 + SIZEOF_HEADERS;
-#
-# or
-# PROVIDE (__executable_start =3D 0x08048000); . =3D 0x08048000 + SIZE=
OF_HEADERS;
-#
-# So we search for the line with a hex value "+ SIZEOF_HEADERS", and rep=
lace
-# all the hex values in that line with "kickstart_base".
-stage2.lds: Makefile
- $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
- -e '1,/^=3D=3D=3D=3D=3D\+$$/d' \
- -e '/^=3D=3D=3D=3D=3D\+$$/d' \
- -e '/\. =3D 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/kicksta=
rt_base/g' > $@ \
- || rm -f $@
-
@VEX_DIR@/libvex.a: @VEX_DIR@/priv/main/vex_svnversion.h
- $(MAKE) -C @VEX_DIR@ libvex.a EXTRA_CFLAGS=3D"@PIE_AM_CFLAGS@"
+ $(MAKE) -C @VEX_DIR@ libvex.a
=20
@VEX_DIR@/priv/main/vex_svnversion.h:
$(MAKE) -C @VEX_DIR@ version
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-08-08 08:59:42 UTC (rev 4341=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-08-08 12:14:46 UTC (rev 4342=
)
@@ -1026,81 +1026,86 @@
static void load_tool( const char *toolname,
ToolInfo** toolinfo_out, char **preloadpath_out )
{
- Bool ok;
- int len =3D strlen(VG_(libdir)) + strlen(toolname) + 16;
- char buf[len];
- void* handle;
- ToolInfo* toolinfo;
- char* preloadpath =3D NULL;
+ extern ToolInfo VG_(tool_info);
+ *toolinfo_out =3D &VG_(tool_info);
+ /* HHHHHHHHACCCCCCCCCCK */
+ *preloadpath_out =3D "/home/sewardj/VgASPACE/aspace/coregrind/vg_prel=
oad_core.so";
=20
- // XXX: allowing full paths for --tool option -- does it make sense?
- // Doesn't allow for vgpreload_<tool>.so.
-
- if (strchr(toolname, '/') !=3D 0) {
- /* toolname contains '/', and so must be a pathname */
- handle =3D dlopen(toolname, RTLD_NOW);
- } else {
- /* just try in the libdir */
- snprintf(buf, len, "%s/vgtool_%s.so", VG_(libdir), toolname);
- handle =3D dlopen(buf, RTLD_NOW);
-
- if (handle !=3D NULL) {
- snprintf(buf, len, "%s/vgpreload_%s.so", VG_(libdir), toolname);
- if (access(buf, R_OK) =3D=3D 0) {
- preloadpath =3D strdup(buf);
- vg_assert(NULL !=3D preloadpath);
- }
- }
- }
-
- ok =3D (NULL !=3D handle);
- if (!ok) {
- fprintf(stderr, "Can't open tool \"%s\": %s\n", toolname, dlerror(=
));
- goto bad_load;
- }
-
- toolinfo =3D dlsym(handle, "vgPlain_tool_info");
- ok =3D (NULL !=3D toolinfo);
- if (!ok) {
- fprintf(stderr, "Tool \"%s\" doesn't define its ToolInfo - "
- "add VG_DETERMINE_INTERFACE_VERSION?\n", toolname)=
;
- goto bad_load;
- }
-
- ok =3D (toolinfo->sizeof_ToolInfo =3D=3D sizeof(*toolinfo) &&
- toolinfo->interface_version =3D=3D VG_CORE_INTERFACE_VERSION &&
- toolinfo->tl_pre_clo_init !=3D NULL);
- if (!ok) {=20
- fprintf(stderr, "Error:\n"
- " Tool and core interface versions do not match.\n"
- " Interface version used by core is: %d (size %d)\n"
- " Interface version used by tool is: %d (size %d)\n"
- " The version numbers must match.\n",
- VG_CORE_INTERFACE_VERSION,=20
- (Int)sizeof(*toolinfo),
- toolinfo->interface_version,
- toolinfo->sizeof_ToolInfo);
- fprintf(stderr, " You need to at least recompile, and possibly up=
date,\n");
- if (VG_CORE_INTERFACE_VERSION > toolinfo->interface_version)
- fprintf(stderr, " your tool to work with this version of Valgr=
ind.\n");
- else
- fprintf(stderr, " your version of Valgrind to work with this t=
ool.\n");
- goto bad_load;
- }
-
- vg_assert(NULL !=3D toolinfo);
- *toolinfo_out =3D toolinfo;
- *preloadpath_out =3D preloadpath;
- return;
-
-
- bad_load:
- if (handle !=3D NULL)
- dlclose(handle);
-
- fprintf(stderr, "valgrind: couldn't load tool\n");
- list_tools();
- exit(127);
+//zz Bool ok;
+//zz int len =3D strlen(VG_(libdir)) + strlen(toolname) + 16;
+//zz char buf[len];
+//zz void* handle;
+//zz ToolInfo* toolinfo;
+//zz char* preloadpath =3D NULL;
+//zz=20
+//zz // XXX: allowing full paths for --tool option -- does it make se=
nse?
+//zz // Doesn't allow for vgpreload_<tool>.so.
+//zz=20
+//zz if (strchr(toolname, '/') !=3D 0) {
+//zz /* toolname contains '/', and so must be a pathname */
+//zz handle =3D dlopen(toolname, RTLD_NOW);
+//zz } else {
+//zz /* just try in the libdir */
+//zz snprintf(buf, len, "%s/vgtool_%s.so", VG_(libdir), toolname);
+//zz handle =3D dlopen(buf, RTLD_NOW);
+//zz=20
+//zz if (handle !=3D NULL) {
+//zz snprintf(buf, len, "%s/vgpreload_%s.so", VG_(libdir), toolname);
+//zz if (access(buf, R_OK) =3D=3D 0) {
+//zz preloadpath =3D strdup(buf);
+//zz vg_assert(NULL !=3D preloadpath);
+//zz }
+//zz }
+//zz }
+//zz=20
+//zz ok =3D (NULL !=3D handle);
+//zz if (!ok) {
+//zz fprintf(stderr, "Can't open tool \"%s\": %s\n", toolname, dle=
rror());
+//zz goto bad_load;
+//zz }
+//zz=20
+//zz toolinfo =3D dlsym(handle, "vgPlain_tool_info");
+//zz ok =3D (NULL !=3D toolinfo);
+//zz if (!ok) {
+//zz fprintf(stderr, "Tool \"%s\" doesn't define its ToolInfo - "
+//zz "add VG_DETERMINE_INTERFACE_VERSION?\n", tool=
name);
+//zz goto bad_load;
+//zz }
+//zz=20
+//zz ok =3D (toolinfo->sizeof_ToolInfo =3D=3D sizeof(*toolinfo) &&
+//zz toolinfo->interface_version =3D=3D VG_CORE_INTERFACE_VERSI=
ON &&
+//zz toolinfo->tl_pre_clo_init !=3D NULL);
+//zz if (!ok) {=20
+//zz fprintf(stderr, "Error:\n"
+//zz " Tool and core interface versions do not match.\n"
+//zz " Interface version used by core is: %d (size %d)\n"
+//zz " Interface version used by tool is: %d (size %d)\n"
+//zz " The version numbers must match.\n",
+//zz VG_CORE_INTERFACE_VERSION,=20
+//zz (Int)sizeof(*toolinfo),
+//zz toolinfo->interface_version,
+//zz toolinfo->sizeof_ToolInfo);
+//zz fprintf(stderr, " You need to at least recompile, and possib=
ly update,\n");
+//zz if (VG_CORE_INTERFACE_VERSION > toolinfo->interface_version)
+//zz fprintf(stderr, " your tool to work with this version of =
Valgrind.\n");
+//zz else
+//zz fprintf(stderr, " your version of Valgrind to work with t=
his tool.\n");
+//zz goto bad_load;
+//zz }
+//zz=20
+//zz vg_assert(NULL !=3D toolinfo);
+//zz *toolinfo_out =3D toolinfo;
+//zz *preloadpath_out =3D preloadpath;
+//zz return;
+//zz=20
+//zz=20
+//zz bad_load:
+//zz if (handle !=3D NULL)
+//zz dlclose(handle);
+//zz=20
+//zz fprintf(stderr, "valgrind: couldn't load tool\n");
+//zz list_tools();
+//zz exit(127);
}
=20
=20
Modified: branches/ASPACEM/memcheck/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/memcheck/Makefile.am 2005-08-08 08:59:42 UTC (rev 43=
41)
+++ branches/ASPACEM/memcheck/Makefile.am 2005-08-08 12:14:46 UTC (rev 43=
42)
@@ -3,7 +3,8 @@
## Build Memcheck at a higher optimisation level
AM_CFLAGS +=3D -O2
=20
-val_PROGRAMS =3D vgtool_memcheck.so vgpreload_memcheck.so
+val_PROGRAMS =3D vgpreload_memcheck.so
+bin_PROGRAMS =3D valgrind_memcheck
=20
vgpreload_memcheck_so_SOURCES =3D \
mac_replace_strmem.c
@@ -14,14 +15,20 @@
$(LIBREPLACEMALLOC) \
-Wl,--no-whole-archive
=20
-vgtool_memcheck_so_SOURCES =3D \
+valgrind_memcheck_DEPENDENCIES =3D $(top_srcdir)/coregrind/libcoregrind.=
a
+valgrind_memcheck_SOURCES =3D \
mac_leakcheck.c \
mac_malloc_wrappers.c \
mc_main.c \
mac_shared.c \
mc_translate.c
-vgtool_memcheck_so_LDFLAGS =3D -shared
+valgrind_memcheck_LDFLAGS =3D \
+ $(top_srcdir)/coregrind/libcoregrind.a
=20
+# \
+# -Wl,-T,$(top_srcdir)/valt_load_address.lds \
+# -Wl,-defsym,valt_load_address=3D@VALT_LOAD_ADDRESS@
+
mcincludedir =3D $(includedir)/valgrind
=20
mcinclude_HEADERS =3D \
Modified: branches/ASPACEM/memcheck/tests/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/memcheck/tests/Makefile.am 2005-08-08 08:59:42 UTC (=
rev 4341)
+++ branches/ASPACEM/memcheck/tests/Makefile.am 2005-08-08 12:14:46 UTC (=
rev 4342)
@@ -133,18 +133,9 @@
new_override_SOURCES =3D new_override.cpp
=20
# Valgrind unit self-tests
-## If we support PIE, build hello as a PIE, otherwise vgtest_ume cannot =
load
-## (I'm not completely sure why, since stage2 can load both PIEs and non=
-PIEs,
-## maybe it's because stage2 is loaded up high; anyway, it doesn't real=
ly
-## matter so long as vgtest_ume can load hello ok. --njn)
-if USE_PIE
-hello_CFLAGS =3D $(AM_CFLAGS) -fpie
-hello_LDFLAGS =3D -pie
-else
-hello_LDFLAGS =3D -Wl,-defsym,kickstart_base=3D0x50000000 \
- -Wl,-T,../../coregrind/stage2.lds
-hello_DEPENDENCIES =3D ../../coregrind/stage2.lds
-endif
+hello_LDFLAGS =3D -Wl,-defsym,valt_load_address=3D0x50000000 \
+ -Wl,-T,../../../valt_load_address.lds
+hello_DEPENDENCIES =3D ../../../valt_load_address.lds
=20
vgtest_ume_CFLAGS =3D -DVGA_$(VG_ARCH) -DVGO_$(VG_OS)
vgtest_ume_LDADD =3D ../../coregrind/m_ume.o
|
|
Re: [Valgrind-developers] valgrind: r4342 - in branches/ASPACEM: . coregrind memcheck memcheck/tests
From: Tom H. <to...@co...> - 2005-08-10 04:50:05
|
In message <200...@ja...>
sv...@va... wrote:
> There is an appalling kludge which would benefit from the attention of
> people more skilled than me in the Art Of Automake:
>
> In coregrind, I fundamentally want automake to build 'libcoregrind.a'.
> And automake is all set up to do that. Except .. automake constructs
> the .a by using /usr/bin/ar, which is a problem because some of the
> inputs to libcoregrind.a are themselves .a files (specifically, the
> results of building any m_modulename/ directory). And so ar barfs.
>
> My horrible hack is tell automake that the name of 'ar' is in fact 'ld
> -r -o'. Since ld is able to accept both .o and .a files as input this
> works, except that the resulting libcoregrind.a is actually a .o file.
Well is there any reason whey coregrind has to built into a library
rather than a relocatable object (which is what it sounds like you are
doing now, but with the wrong extension).
The only real advantage of a library is that unused code can be left
out but how much of coregrind will not be pulled in by a tool?
> If anybody knows how to fix this properly I would be happy to hear
> from you.
Well Amazon delivered my copy of the automake book today so once I've
read that I might have some ideas ;-)
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|