Skip to content
Permalink
Browse files

Initial check-in.

  • Loading branch information...
emeryberger committed Jun 18, 2012
1 parent dd7123b commit f39b10390bd16aae1b5cb2c20e4044f6f5c22af8
Showing 449 changed files with 51,675 additions and 0 deletions.
109 Makefile
@@ -0,0 +1,109 @@
DIEHARD_TARGET = lib/libdiehard
DIEHARD_INCLUDE = -I./include -I./include/diehard

DIEHARDER_TARGET = lib/libdieharder
DIEHARDER_INCLUDE = -I./include -I./include/dieharder

ifdef diehard
TARGET = $(DIEHARD_TARGET)
INCLUDE = $(DIEHARD_INCLUDE)
else
TARGET = $(DIEHARDER_TARGET)
INCLUDE = $(DIEHARDER_INCLUDE)
endif

UNIX_SRC = gnu/gnuwrapper.cpp src/libdieharder.cpp
MACOS_SRC = mac/macwrapper.cpp src/libdieharder.cpp

REPLICATED_SRC = replicated/replicated.cpp

# MACOS_COMPILER = g++
MACOS_COMPILER = llvm-g++

MACOS_COMMAND_STANDALONE := $(MACOS_COMPILER) -mpreferred-stack-boundary=4 -m128bit-long-double -msse2 -arch i386 -arch x86_64 -g -O3 -W -Wall -DDIEHARD_MULTITHREADED=1 -DNDEBUG $(INCLUDE) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -dynamiclib -D'CUSTOM_PREFIX(x)=xx\#\#x' $(MACOS_SRC) -o $(TARGET).dylib

MACOS_COMMAND_DEBUG_STANDALONE := $(MACOS_COMPILER) -msse2 -arch i386 -arch x86_64 -g -W -Wall -DDIEHARD_MULTITHREADED=1 $(INCLUDE) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -dynamiclib -D'CUSTOM_PREFIX(x)=xx\#\#x' $(MACOS_SRC) -o $(TARGET).dylib

MACOS_COMMAND_REPLICATED := $(MACOS_COMPILER) -msse2 -pipe -O3 -finline-limit=65000 -fkeep-inline-functions -finline-functions -ffast-math -fomit-frame-pointer $(REPLICATED_SRC) -DDIEHARD_MULTITHREADED=1 -DNDEBUG $(INCLUDE) -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -dynamiclib $(MACOS_SRC) -o libdieharder_r.dylib

# LINUX_COMMAND_STANDALONE := g++ -m32 -malign-double -pipe -march=pentium4 -DNDEBUG $(INCLUDE) -D_REENTRANT=1 -DDIEHARD_MULTITHREADED=1 -shared -D'CUSTOM_PREFIX(x)=diehard\#\#x' $(UNIX_SRC) -Bsymbolic -o $(TARGET).so -ldl -lpthread

LINUX_COMMAND_STANDALONE := g++ -m32 -finline-functions -malign-double -pipe -march=pentium4 -O3 -DNDEBUG $(INCLUDE) -D_REENTRANT=1 -DDIEHARD_MULTITHREADED=1 -shared -D'CUSTOM_PREFIX(x)=diehard\#\#x' $(UNIX_SRC) -Bsymbolic -o $(TARGET).so -ldl -lpthread

LINUX_COMMAND_REPLICATED := g++ -malign-double -pipe -march=pentium4 -O3 -fno-rtti -finline-functions -ffast-math -fomit-frame-pointer -DNDEBUG $(INCLUDE) -D_REENTRANT=1 $(REPLICATED_SRC) -DDIEHARD_MULTITHREADED=1 -shared $(UNIX_SRC) -Bsymbolic -o libdieharder_r.so -ldl -lpthread

LINUX_64_COMMAND_STANDALONE := g++ -W -Wall -O3 -DNDEBUG -pipe -fPIC -m64 -march=nocona -ffast-math -g $(INCLUDE) -D_REENTRANT=1 -DDIEHARD_MULTITHREADED=1 -shared -D'CUSTOM_PREFIX(x)=diehard\#\#x' $(UNIX_SRC) -Bsymbolic -o $(TARGET).so -ldl -lpthread

LINUX_64_COMMAND_REPLICATED := g++ -O1 -DNDEBUG -pipe -fPIC -march=nocona -m64 -g $(INCLUDE) -D_REENTRANT=1 $(REPLICATED_SRC) -DDIEHARD_MULTITHREADED=1 -shared $(UNIX_SRC) -Bsymbolic -o libdieharder_r.so -ldl -lpthread

SOLARIS_SPARC32_COMMAND_STANDALONE := CC -xtarget=ultra2 -xildoff -xO5 -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG $(INCLUDE) -DDIEHARD_MULTITHREADED=1 -G -PIC $(UNIX_SRC) sparc-interchange.il -o $(TARGET).so -lthread -ldl -lCrun

SOLARIS_SPARC32_COMMAND_REPLICATED := CC -xtarget=ultra2 -dalign -xbuiltin=%all -xO5 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG $(INCLUDE) $(REPLICATED_SRC) -DDIEHARD_MULTITHREADED=1 -G -PIC $(UNIX_SRC) sparc-interchange.il -o libdieharder_r.so -lthread -ldl -lCrun

SOLARIS_SPARC64_COMMAND_STANDALONE := CC -xcode=pic13 -xtarget=ultra2 -m64 -dalign -xbuiltin=%all -xO5 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG $(INCLUDE) -DDIEHARD_MULTITHREADED=1 -G -PIC $(UNIX_SRC) sparc-interchange.il -o $(TARGET).so -lthread -ldl -lCrun

SOLARIS_SPARC64_COMMAND_REPLICATED := CC -xcode=pic13 -xtarget=ultra2 -m64 -dalign -xbuiltin=%all -xO5 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG $(INCLUDE) $(REPLICATED_SRC) -DDIEHARD_MULTITHREADED=1 -G -PIC $(UNIX_SRC) sparc-interchange.il -o libdieharder_r.so -lthread -ldl -lCrun

# After compiling:
# setenv LD_PRELOAD "$cwd/$(TARGET).so"
# and whenever g++ supports thread-level storage on Solaris...
# g++ -fPIC -O3 -finline-limit=65000 -mcpu=ultrasparc -DNDEBUG $(INCLUDE) -D_REENTRANT=1 -DDIEHARD_MULTITHREADED=1 -shared $(UNIX_SRC) -o $(TARGET).so

DEPS = $(UNIX_SRC) $(MACOS_SRC) bitmap.h \
bumpalloc.h heapshield.cpp largeheap.h lockheap.h log2.h \
marsaglia.h mmapalloc.h mmapwrapper.h platformspecific.h \
randomheap.h diehardheap.h randomminiheap.h \
randomnumbergenerator.h realrandomvalue.h sassert.h \
sparc-interchange.il staticif.h staticlog.h \
usewinhard.cpp version.h wrapper.cpp

.PHONY: macos linux solaris

all:
@echo "Type make <target>, where target is one of the following: "
@echo " linux-x86"
@echo " linux-x86-64"
@echo " solaris-sparc"
@echo " solaris-sparc-64"
@echo " macos"
@echo "Add -replicated to make library for replicated execution."

linux-x86:
$(LINUX_COMMAND_STANDALONE)

linux-x86-replicated:
$(LINUX_COMMAND_REPLICATED)

linux-x86-64:
$(LINUX_64_COMMAND_STANDALONE)

linux-x86-64-replicated:
$(LINUX_64_COMMAND_REPLICATED)

solaris-sparc:
$(SOLARIS_SPARC32_COMMAND_STANDALONE)

solaris-sparc-replicated:
$(SOLARIS_SPARC32_COMMAND_REPLICATED)

solaris-sparc-64:
$(SOLARIS_SPARC64_COMMAND_STANDALONE)

solaris-sparc-64-replicated:
$(SOLARIS_SPARC64_COMMAND_REPLICATED)

macos:
$(MACOS_COMMAND_STANDALONE)

macos-debug:
$(MACOS_COMMAND_DEBUG_STANDALONE)

macos-replicated:
$(MACOS_COMMAND_REPLICATED)


clean:
rm -f $(TARGET).so libdieharder_r.so $(TARGET).dylib



@@ -0,0 +1,47 @@
CFLAGS = /Iinclude /Zi /Ox /Oy /DNDEBUG /MD /DDIEHARD_REPLICATED=0

DEPS = Makefile.win32 \
winhard.cpp bitmap.h diehard.h \
bumpalloc.h diehardheap.h heapshield.cpp largeheap.h lock.h lockheap.h log2.h \
marsaglia.h mmapalloc.h mmapwrapper.h platformspecific.h \
randomheap.h randomminiheap.h \
randomnumbergenerator.h realrandomvalue.h sassert.h \
sparc-interchange.il staticif.h staticlog.h \
staticforloop.h \
usewinhard.cpp version.h wrapper.cpp libdiehard.cpp

all: winhard.dll usewinhard.obj diehard.exe diehard-system.dll
#all: diehard.exe diehard-system.dll
copy diehard-system.dll c:\windows\system32

prepare-release:
@del diehard.exe
@cl /DDIEHARD_RELEASE=1 /Imadcodehook /MT diehard.cpp user32.lib madcodehook\madchook.lib
@copy diehard.exe ..\build
@copy diehard-system.dll ..\build
@copy madCodeHook\madCHook.dll ..\build
@echo Build complete.

prepare:
@copy diehard.exe ..\build
@copy diehard-system.dll ..\build
@copy madCodeHook\madCHook.dll ..\build
@echo Build complete.

usewinhard.obj: usewinhard.cpp
cl $(CFLAGS) /nologo /c usewinhard.cpp

winhard.dll: winhard.obj $(DEPS)
cl /LD winhard.obj /link /base:0x63000000 kernel32.lib user32.lib msvcrt.lib advapi32.lib /subsystem:console /dll /incremental:no /entry:HardDllMain

winhard.obj: $(DEPS)
cl $(CFLAGS) /nologo /c winhard.cpp

diehard.exe: diehard.cpp $(DEPS)
cl /Imadcodehook /MT diehard.cpp user32.lib advapi32.lib madcodehook\madchook.lib

diehard-system.dll: diehard-system.cpp $(DEPS)
cl /ImadCodeHook /I.. /Oityb1 /D_MT=1 /DNDEBUG /LD /DDIEHARD_REPLICATED=0 /DDIEHARD_DIEFAST=0 diehard-system.cpp madCodeHook\madCHook.lib kernel32.lib user32.lib shell32.lib advapi32.lib /link /entry:_DllMainCRTStartup@12

clean:
del winhard.dll winhard.obj usewinhard.obj diehard-system.dll
46 NEWS
@@ -0,0 +1,46 @@
---------------------
DieHard release notes
---------------------

version 1.2:
* Added 64-bit support.

version 1.1:
* Dramatically reduced memory consumption.
* Fixed logic (for Windows) that protects against double free errors.
* Fixed the MWC random number generator, enhancing randomness.
* More robust whitelist processing for DieHard system, for
Windows protection.

release 1.0.2:
* Fixed a race condition in Windows injection logic.
* Added support for posix_memalign.
* free now ignores invalid offsets, and frees the object anyway.
This allows DieHard to cleanly support memalign.

release 1.0.1:
* Fixed a bug in some string functions (for Windows).
* Fixed a minor bug in random heap selection.
* Added notification messages for when DieHard detects
and prevents certain errors.

release 1.0:
* Introduced adaptive version, which grows only as needed.
* Added HeapShield (blocks heap-based overflows).

release 0.3 (December 28, 2005):
* Added "red zones" around heap metadata to prevent
corruption by buffer overflows.
* Added support for Microsoft Visual Studio 2005.
* Changed behavior of DieHard to initialize unallocated
memory to zeros (standalone version only).


release 0.2 (December 2, 2005):
* Added atomic updates of bitmap for scalability on
multiprocessor/multicore platforms.
* Ported to Solaris Sun Workshop compilers.


release 0.1 (November 23, 2005):
* Initial release.
Binary file not shown.
Binary file not shown.

0 comments on commit f39b103

Please sign in to comment.
You can’t perform that action at this time.