From 21842b5910e7f62368e2cedb12e9920dc9b3c78c Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Thu, 12 Jul 2007 08:47:15 +0000 Subject: Add D.U.M.A., the Electric Fence successor. diff --git a/config/debug/duma.in b/config/debug/duma.in new file mode 100644 index 0000000..7995b81 --- /dev/null +++ b/config/debug/duma.in @@ -0,0 +1,44 @@ +# D.U.M.A. - Detect Unintended Memory Access - Memory checker + +menuconfig DUMA + bool + prompt "D.U.M.A." + default n + depends on EXPERIMENTAL + help + D.U.M.A. - Detect Unintended Memory Access + A memory bound checker, with additional features. + Formerly known as Electric Fence. + +if DUMA + +config DUMA_A + bool + prompt "Build a static library" + default y + +config DUMA_SO + bool + prompt "Build a shared library" + default y if SHARED_LIBS + default n if ! SHARED_LIBS + +choice + bool + prompt "D.U.M.A. version" + +config DUMA_V_2_5_1 + bool + prompt "2_5_1" + +# CT_INSERT_VERSION_ABOVE +# Don't remove above line! +endchoice + +config DUMA_VERSION + string + default "2_5_1" if DUMA_V_2_5_1 +# CT_INSERT_VERSION_STRING_ABOVE +# Don't remove above line! + +endif diff --git a/patches/duma/2_5_1/100-cross-compile.patch b/patches/duma/2_5_1/100-cross-compile.patch new file mode 100644 index 0000000..5c189aa --- /dev/null +++ b/patches/duma/2_5_1/100-cross-compile.patch @@ -0,0 +1,110 @@ +diff -dur duma_2_5_1/Makefile duma_2_5_1.orig/Makefile +--- duma_2_5_1/Makefile 2006-06-18 06:02:13.000000000 +0200 ++++ duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200 +@@ -98,10 +98,6 @@ + LIBS=-lpthread + endif + +- +-CC=gcc +-CXX=g++ +-AR=ar + INSTALL=install + + ############################################################ +@@ -169,31 +165,31 @@ + + createconf: createconf.o + - rm -f createconf +- $(CC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf ++ $(HOSTCC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf + + tstheap: libduma.a tstheap.o + - rm -f tstheap +- $(CC) $(CFLAGS) tstheap.o libduma.a -o tstheap $(LIBS) ++ $(HOSTCC) $(CFLAGS) tstheap.o libduma.a -o tstheap $(LIBS) + + dumatest: libduma.a dumatest.o + - rm -f dumatest +- $(CC) $(CFLAGS) dumatest.o libduma.a -o dumatest $(LIBS) ++ $(HOSTCC) $(CFLAGS) dumatest.o libduma.a -o dumatest $(LIBS) + + dumatestpp: libduma.a dumatestpp.o dumapp.h + - rm -f dumatestpp +- $(CXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp $(LIBS) ++ $(HOSTCXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp $(LIBS) + + testoperators: libduma.a testoperators.o dumapp.h + - rm -f testoperators +- $(CXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators $(LIBS) ++ $(HOSTCXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators $(LIBS) + + tstheap_so: tstheap_so.o + - rm -f tstheap_so +- $(CC) $(CFLAGS) tstheap_so.o -o tstheap_so $(LIBS) ++ $(HOSTCC) $(CFLAGS) tstheap_so.o -o tstheap_so $(LIBS) + + dumatestpp_so: dumatestpp_so.o + - rm -f dumatestpp_so +- $(CXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so $(LIBS) ++ $(HOSTCXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so $(LIBS) + + + $(OBJECTS) tstheap.o dumatest.o dumatestpp.o: duma.h +@@ -211,7 +207,7 @@ + # define rules how to build objects for createconf + # + createconf.o: +- $(CC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@ ++ $(HOSTCC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@ + + + # +@@ -230,13 +226,6 @@ + print_so.o: print.c print.h + $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c print.c -o $@ + +-# DUMA_SO_OPTIONS needed cause duma.h is included explicitly +-tstheap_so.o: +- $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tstheap.c -o $@ +- +-dumatestpp_so.o: +- $(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumatestpp.cpp -o $@ +- + # + # define rules how to build objects for static library + # +@@ -259,17 +248,23 @@ + # + + dumatest.o: dumatest.c duma.h duma_config.h +- $(CC) $(CFLAGS) -c dumatest.c -o $@ ++ $(HOSTCC) $(CFLAGS) -c dumatest.c -o $@ + + dumatestpp.o: dumatestpp.cpp duma.h dumapp.h duma_config.h +- $(CXX) $(CPPFLAGS) -c dumatestpp.cpp -o $@ ++ $(HOSTCXX) $(CPPFLAGS) -c dumatestpp.cpp -o $@ + + tstheap.o: tstheap.c duma.h duma_config.h +- $(CC) $(CFLAGS) -c tstheap.c -o $@ ++ $(HOSTCC) $(CFLAGS) -c tstheap.c -o $@ + + testoperators.o: testoperators.cpp duma.h dumapp.h duma_config.h +- $(CXX) $(CPPFLAGS) -c testoperators.cpp -o $@ ++ $(HOSTCXX) $(CPPFLAGS) -c testoperators.cpp -o $@ ++ ++# DUMA_SO_OPTIONS needed cause duma.h is included explicitly ++tstheap_so.o: ++ $(HOSTCC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tstheap.c -o $@ + ++dumatestpp_so.o: ++ $(HOSTCXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumatestpp.cpp -o $@ + + # + # default rules +@@ -280,5 +275,3 @@ + #.cpp.o: + # $(CXX) $(CPPFLAGS) -c $< -o $@ + # +- +- diff --git a/patches/duma/2_5_1/200-separate_cpp.patch b/patches/duma/2_5_1/200-separate_cpp.patch new file mode 100644 index 0000000..d228731 --- /dev/null +++ b/patches/duma/2_5_1/200-separate_cpp.patch @@ -0,0 +1,20 @@ +diff -dur duma_2_5_1.orig/Makefile duma_2_5_1/Makefile +--- duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200 ++++ duma_2_5_1/Makefile 2007-07-11 17:50:46.000000000 +0200 +@@ -115,9 +115,14 @@ + dumatest.c tstheap.c dumatestpp.cpp testoperators.cpp \ + createconf.c + +-OBJECTS = dumapp.o duma.o sem_inc.o print.o ++OBJECTS = duma.o sem_inc.o print.o ++SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o ++ ++ifeq ($(DUMA_CPP),1) ++OBJECTS += dumapp.o ++SO_OBJECTS += dumapp_so.o ++endif + +-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o + + all: libduma.a $(DUMASO) tstheap dumatest dumatestpp testoperators tstheap_so dumatestpp_so + @ echo "Testing DUMA." diff --git a/scripts/build/debug/duma.sh b/scripts/build/debug/duma.sh new file mode 100644 index 0000000..e657944 --- /dev/null +++ b/scripts/build/debug/duma.sh @@ -0,0 +1,64 @@ +# Biuld script for D.U.M.A. + +is_enabled="${CT_DUMA}" + +do_print_filename() { + [ "${CT_DUMA}" = "y" ] || return 0 + echo "duma_${CT_DUMA_VERSION}" +} + +do_debug_duma_get() { + CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/ + # D.U.M.A. doesn't separate its name from its version with a dash, + # but with an underscore. Create a link so that crosstool-NG can + # work correctly: + cd "${CT_TARBALLS_DIR}" + duma_ext=`CT_GetFileExtension "duma_${CT_DUMA_VERSION}"` + rm -f "duma-${CT_DUMA_VERSION}${duma_ext}" + ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}" +} + +do_debug_duma_extract() { + CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}" + cd "${CT_SRC_DIR}" + rm -f "duma-${CT_DUMA_VERSION}" + ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}" +} + +do_debug_duma_build() { + CT_DoStep INFO "Installing D.U.M.A." + CT_DoLog EXTRA "Copying sources" + cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma" + CT_Pushd "${CT_BUILD_DIR}/build-duma" + + DUMA_CPP= + [ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1 + + libs= + [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a" + [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} libduma.so.0.0" + for lib in ${libs}; do + CT_DoLog EXTRA "Building library \"${lib}\"" + make HOSTCC="${CT_CC_NATIVE}" \ + HOSTCXX="${CT_CC_NATIVE}" \ + CC="${CT_TARGET}-gcc" \ + CXX="${CT_TARGET}-gcc" \ + DUMA_CPP="${DUMA_CPP}" \ + ${lib} 2>&1 |CT_DoLog ALL + CT_DoLog EXTRA "Installing library \"${lib}\"" + install -m 644 "${lib}" "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL + done + if [ "${CT_DUMA_SO}" = "y" ]; then + CT_DoLog EXTRA "Installing shared library links" + ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so.0" 2>&1 |CT_DoLog ALL + ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so" 2>&1 |CT_DoLog ALL + fi + CT_DoLog EXTRA "Installing LD_PRELOAD wrapper script" + mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin" + cp -v duma.sh \ + "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma" 2>&1 |CT_DoLog ALL + + CT_EndStep + CT_Popd +} + diff --git a/tools/addToolVersion.sh b/tools/addToolVersion.sh index 6473b27..eeec119 100755 --- a/tools/addToolVersion.sh +++ b/tools/addToolVersion.sh @@ -8,7 +8,7 @@ doHelp() { Usage: ${myname} [option] 'tool' in one of: --gcc, --binutils, --glibc, --uClibc, --linux, - --gdb, --dmalloc + --gdb, --dmalloc, --duma Valid options for all tools: --experimental, -x @@ -55,6 +55,7 @@ while [ $i -le $# ]; do --linux) cat=KERNEL; tool=linux; tool_prefix=kernel_; tool_suffix=;; --gdb) cat=GDB; tool=gdb; tool_prefix=debug/ tool_suffix=;; --dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug/ tool_suffix=;; + --duma) cat=DUMA; tool=duma; tool_prefix=debug/ tool_suffix=;; # Tools options: -x|--experimental) EXP=1; OBS=;; -o|--obsolete) OBS=1; EXP=;; -- cgit v0.10.2-6-g49f6