Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Upgrade to latest version of dyncall lib, which has Win64 fixes among…
…st other things.
  • Loading branch information
jnthn committed Nov 27, 2011
1 parent c9d6b20 commit 61a0eac
Show file tree
Hide file tree
Showing 261 changed files with 8,540 additions and 3,662 deletions.
1 change: 1 addition & 0 deletions 3rdparty/dyncall/AUTHORS
@@ -1,3 +1,4 @@
Daniel Adler <dadler@uni-goettingen.de>
Tassilo Philipp <tphilipp@potion-studios.com>
Olivier Chafik <olivier.chafik@gmail.com>

1 change: 1 addition & 0 deletions 3rdparty/dyncall/BUGS
@@ -0,0 +1 @@
- dyncall sparc64 port: works fine on Debian 6, but has issues on OpenBSD and Solaris regarding passing of float and double values.
39 changes: 32 additions & 7 deletions 3rdparty/dyncall/CMakeLists.txt
Expand Up @@ -21,21 +21,46 @@
cmake_minimum_required (VERSION 2.6)
project(DynCall)

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "dyncall enables dynamic invocation of machine-level function calls")
set(CPACK_PACKAGE_VENDOR "dyncall project")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Description.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
if(APPLE)
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/Description.txt")
endif(APPLE)
set(CPACK_PACKAGE_NAME "dyncall")
include(CPack)

# add cmake modules shipped with the package to cmake's module path.
# currently we have no use for this, but maybe later..
#set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsys/cmake/Modules" "${CMAKE_MODULE_PATH}")

# enable gcc as front-end to assembler for .S files
if(CMAKE_COMPILER_IS_GNUCC)

if(MSVC)
enable_language(ASM_MASM)
#if(CMAKE_SIZEOF_VOID_P MATCHES 8)
# set(CMAKE_ASM_COMPILER "ml64")
#else()
# set(CMAKE_ASM_COMPILER "ml")
#endif()
#set(CMAKE_ASM_COMPILER_ARG1 "/c")
#set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS asm)
#set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
elseif(CMAKE_COMPILER_IS_GNUCC)
# when used in shared libraries, -fPIC is required by several architectures
# and platforms (observed on AMD64, Solaris/Sparc).
# we enable it per default here.
add_definitions("-fPIC")
# enable gcc as front-end to assembler for .S files
set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
enable_language(ASM)
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
set(CMAKE_ASM_COMPILER_ARG1 "-c")
set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
enable_language(ASM)
endif()

# fix for AMD64: force -fPIC (even for static libs).
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
add_definitions("-fPIC")
endif()

add_subdirectory(dynload)
add_subdirectory(dyncall)
Expand Down
63 changes: 62 additions & 1 deletion 3rdparty/dyncall/ChangeLog
@@ -1,6 +1,67 @@
This file lists big/noteworthy changes, only...

Version 0.6 (upcoming)
Version 0.7 (upcoming)
architecture:
o added subproject: portasm - portable (GNU AS,+Apple and MASM) assembly framework
o added support for sparc (32-bit) (tested on linux/debian)
o added support for sparc (64-bit) (tested on linux/debian, buggy on openbsd)
o added support for Solaris and SunPro compiler for i386, x86_64, sparc and sparc64
o improved auto-detection via preprocessor defines
dyncall updates:
o uses portasm (GNU,Apple,Microsoft) common sources for x86,x64,ppc32,arm32_arm
o bug fixes for x64/win64 calling convention
o added support for mingw32-w64 on x64
o improved cdecl x86 calling convention: stack always 16 byte aligned
o updated API and initial support for structs (for x86/AMD64)
o initial support for syscalls on x86, added x86 int80h linux/bsd
o added Minix port (stable)
o optimized vector buffer for small type pushing
o minor fix for amd64/sysv: alignment to 32-byte
o bug fix for ppc32/sysv: ellipsis calls work now
o updated API, introduced DC_CALL_C_ELLIPSIS_VARARGS
o changed interface: dcMode does not reset internally anymore
dyncallback updates:
o uses portasm for x86,x64
o added Solaris/x86/sunpro port (stable)
o added Minix port (unstable)
o updates source, uses relative includes
dynload updates:
o fixes for missing includes (dyncall_alloc.h)
o fixes for self-resolving symbols on windows
o removed Dbghelf.lib dependency
o bug fixes for cygwin/x86
o fixes for beos/haiku
buildsys additions:
o added zero-config (BSD,GNU,SUN) make files (Makefile.embedded)
o added in/out-of-source configure2 w/ (BSD,GNU) make files (Makefile.generic')
o added bootstrap lua script (download/build)
o Nmakefile: more tests included (resolve_self)
o improved cross-compilation for iOS (upgrade to 4.3 sdk)
o darwin 8.0 support
buildsys/gmake updates:
o added support for msvc/x64 tool-chain
o default settings for build-dir changed to '.'
o cleanup: removed top-level Make{Prolog,Epilog,Rules} files and updated all sub-projects and tests
buildsys/cmake updates:
o updated find module scripts (see cmake/Modules)
o added support for using dyncall as sub-project (via *Config.cmake files)
see details in README.CMake
o fixes for msvc and ml
o fixes for CPack
o fixes for universal builds on Mac OS X
o supports SunPro with *.S files.
documentation updates:
o added dyncallback documentation
o updated dyncall documentation
o minor updates
tests:
o added flexible test suite for calls (call_suite) based on Lua and C
o added syscall test
o updates to resolve-self test (adding additional link flags to export symbols)
o improved dir name portability (renamed plain_c++ -> plain_cxx)
o renamed *.cpp -> *.cc files (OpenBSD/Sun make has no implicit rules for cpp)

Version 0.6
building:
o new build systems: CMake and Plan9's mk
o buildsys/gmake tool chain update: pcc and iphone sdk
Expand Down
7 changes: 7 additions & 0 deletions 3rdparty/dyncall/Description.txt
@@ -0,0 +1,7 @@
DynCall Project

The dyncall library encapsulates architecture-, OS- and compiler-specific function call semantics in a virtual "bind argument parameters from left to right and then call" interface allowing programmers to call C functions in a completely dynamic manner. In other words, instead of calling a function directly, the dyncall library provides a mechanism to push the function parameters manually and to issue the call afterwards.
This means, that a program can determine at runtime what function to call, and what parameters to pass to it. The library is written in C and assembly and provides a very simple C interface to program against.

The library comes in very handy to power flexible message systems, dynamic function call dispatch mechanisms, closure implementations or even to bridge different programming languages.
When it comes to language bindings, the dyncall library provides a clean and portable C interface to dynamically issue calls to foreign code using small call kernels written in assembly. Instead of providing code for every bridged function call, which unnecessarily results in code bloat, only a couple of instructions are used to invoke every possible call.
16 changes: 11 additions & 5 deletions 3rdparty/dyncall/GNUmakefile
@@ -1,6 +1,9 @@
#//////////////////////////////////////////////////////////////////////////////
# Package: dyncall
# File: GNUmakefile
# Description: Top-level buildsys/gmake GNUmakefile
# License:
#
# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>,
# Copyright (c) 2007,2011 Daniel Adler <dadler@uni-goettingen.de>,
# Tassilo Philipp <tphilipp@potion-studios.com>
#
# Permission to use, copy, modify, and distribute this software for any
Expand All @@ -15,11 +18,14 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#//////////////////////////////////////////////////////////////////////////////

TOP = .
TOP = .
GMAKE_TOP ?= $(TOP)/buildsys/gmake
include $(GMAKE_TOP)/prolog.gmake

DIRS = dyncall dynload dyncallback
include $(TOP)/MakeRules

include $(GMAKE_TOP)/epilog.gmake

.PHONY: test doc
test:
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/dyncall/LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2007-2009 Daniel Adler <dadler@uni-goettingen.de>,
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>

Permission to use, copy, modify, and distribute this software for any
Expand Down
15 changes: 15 additions & 0 deletions 3rdparty/dyncall/License.txt
@@ -0,0 +1,15 @@
Copyright (c) 2007-2010 Daniel Adler <dadler@uni-goettingen.de>,
Tassilo Philipp <tphilipp@potion-studios.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

2 changes: 0 additions & 2 deletions 3rdparty/dyncall/MakeEpilog

This file was deleted.

3 changes: 0 additions & 3 deletions 3rdparty/dyncall/MakeProlog

This file was deleted.

3 changes: 0 additions & 3 deletions 3rdparty/dyncall/MakeRules

This file was deleted.

15 changes: 15 additions & 0 deletions 3rdparty/dyncall/Makefile.M
@@ -0,0 +1,15 @@
#include "buildsys/dynmake/Makefile.base.M"

all:
cd dyncall _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
cd dynload _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)
cd dyncallback _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)

clean:
cd dyncall _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean
cd dynload _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean
cd dyncallback _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE) clean

tests:
cd test _(SHELL_COMMAND_SEPARATOR) _(MAKE) _(MAKEFLAGS_USER) _(MAKEFLAG_FILE) _(MAKE_DEFAULT_FILE)

36 changes: 36 additions & 0 deletions 3rdparty/dyncall/Makefile.embedded
@@ -0,0 +1,36 @@
MAKEFILE = Makefile.embedded
MAKE_CMD = ${MAKE} -f ${MAKEFILE}
.PHONY: all tests clean bsd linux sun sun-64bit sun-gcc sun-gcc-64bit
all:
cd dynload ; ${MAKE_CMD}
cd dyncall ; ${MAKE_CMD}
cd dyncallback ; ${MAKE_CMD}
tests:
cd test ; ${MAKE_CMD}
clean:
cd dynload ; ${MAKE_CMD} clean
cd dyncall ; ${MAKE_CMD} clean
cd dyncallback ; ${MAKE_CMD} clean
cd test ; ${MAKE_CMD} clean
bsd:
${MAKE_CMD} all
linux:
${MAKE_CMD} all
linux64:
CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
minix-gcc:
cd dyncall ; CC=gcc CFLAGS= ${MAKE_CMD}
cd dyncallback ; CC=gcc CFLAGS= ${MAKE_CMD}
osx:
${MAKE_CMD} all
osx-universal:
CFLAGS="${CFLAGS} -arch i386 -arch x86_64 -arch ppc" ASFLAGS="${ASFLAGS} -arch i386 -arch x86_64 -arch ppc" AR="libtool" ARFLAGS="-static -o" ${MAKE_CMD} all
sun:
CFLAGS="${CFLAGS}" ${MAKE_CMD} all
sun-64bit:
CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
sun-gcc:
CC=gcc CFLAGS="${CFLAGS} -fPIC" ${MAKE_CMD} all
sun-gcc-64bit:
CC=gcc CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all

26 changes: 26 additions & 0 deletions 3rdparty/dyncall/Makefile.generic
@@ -0,0 +1,26 @@
MAKEFILE ?= Makefile.generic
MAKE_CMD = ${MAKE} -f ${MAKEFILE}

.PHONY: all clean install test osx-universal linux bsd

all:
cd dyncall ; ${MAKE_CMD}
cd dynload ; ${MAKE_CMD}
cd dyncallback ; ${MAKE_CMD}

clean:
cd dyncall ; ${MAKE_CMD} clean
cd dynload ; ${MAKE_CMD} clean
cd dyncallback ; ${MAKE_CMD} clean

install:
cd dyncall ; ${MAKE_CMD} install
cd dynload ; ${MAKE_CMD} install
cd dyncallback ; ${MAKE_CMD} install

test:
cd test ; ${MAKE_CMD}

osx-universal:
${MAKE_CMD} CPPFLAGS="-arch i386 -arch ppc -arch x86_64" MKLIB="libtool -static -o"

68 changes: 62 additions & 6 deletions 3rdparty/dyncall/README.CMake
Expand Up @@ -3,15 +3,24 @@ Notes on building with CMake

Build with CMake (in-source)
----------------------------

cd <dyncall-source-dir>
cmake .
make -f Makefile

NOTE: The "-f Makefile" flag !
If you build in-source make sure to specify the makefile with "-f Makefile".
Otherwise the GNUmakfile files will be used by make that originate from
buildsys/gmake.
On Unix:
cmake .
make -f Makefile

NOTE: The "-f Makefile" flag !
If you build in-source make sure to specify the makefile with "-f Makefile".
Otherwise the GNUmakfile files will be used by make that originate from
buildsys/gmake.

On Windows:
cmake . -G "NMake Makefiles"
nmake /f Makefile

NOTE: Assembly Support is broken for Visual Studio Generators in CMake
So we support NMake for now only.

Install in a specific location
------------------------------
Expand All @@ -28,3 +37,50 @@ Using from other CMake-based projects
Under buildsys/cmake/Modules you find some Find*() scripts
which you might find useful.


Make Universal Binary
---------------------
cmake -DCMAKE_OSX_ARCHITECTURES="i386;x86_64;ppc"


CMake Framework
---------------
The project name is "DynCall".
Each library in the source tree represents a target (not a sub-project!).
Support scripts for 'find_package' are at buildsys/cmake/Modules.

find_package( [DynLoad | DynCall | DynCallback] )

will set the variables:

Dyn*_INCLUDE_DIRS
Dyn*_LIBRARIES


Using dyncall libraries in other CMake projects
-----------------------------------------------
find_package(DynLoad REQUIRED)
add_includes(${DynLoad_INCLUDE_DIRS})
target_link_libraries( ... ${DynLoad_LIBRARIES})


Use as sub-project within CMake top-level project
-------------------------------------------------

add_subdirectory(path/to/dyncall/project/tree)
set(DynLoad_DIR ${DynCall_SOURCE_DIR}/dynload)
set(DynCall_DIR ${DynCall_SOURCE_DIR}/dyncall)
set(DynCallback_DIR ${DynCall_SOURCE_DIR}/dyncallback)

has the effect, that the 'find_package' works from within the project source
tree.


Building for SPARC64 Architectures
----------------------------------

Supported Compilers: GCC, SunPro
Add -m64 to C, C++ and ASM flags, e.g.

$ cmake -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_ASM_CXX_FLAGS=-m64

26 changes: 26 additions & 0 deletions 3rdparty/dyncall/README.Configure2
@@ -0,0 +1,26 @@
Some experiences with configure2 and Makefile.generic

NetBSD/FreeBSD:

Embedded
Default NetBSD make:
make -f Makefile.generic
(cd test ; LDFLAGS=-lm make -f Makefile.generic)

Configure:
in-source:
./configure2
make
make install DESTDIR=/tmp
Out-of-source:
mkdir build
cd build
../configure2
make

OpenBSD:
Embedded
Default OpenBSD make:
make -f Makefile.generic
(cd test ; LDFLAGS=-lm make -f Makefile.generic all-c)

0 comments on commit 61a0eac

Please sign in to comment.