Update Source To libffi-27

This commit is contained in:
Thomas A 2023-02-02 13:20:13 -08:00
parent 7e2792f041
commit 06c4e8d527
168 changed files with 5910 additions and 1920 deletions

View File

@ -1,6 +1,6 @@
shallow_clone: true
# We're currently only testing 64-bit libffi built with Microsoft's
# We're currently only testing libffi built with Microsoft's
# tools.
# This matrix should be expanded to include at least:
# 32- and 64-bit gcc/cygwin
@ -8,9 +8,12 @@ shallow_clone: true
# 32- and 64-bit clang/mingw
# and perhaps more.
image: Visual Studio 2013
image: Visual Studio 2017
platform:
- x64
- x86
- arm
- arm64
environment:
global:
@ -18,33 +21,46 @@ environment:
CYG_CACHE: C:/cygwin/var/cache/setup
CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
matrix:
- VSVER: 12
- VSVER: 15
install:
- ps: >-
If ($env:Platform -Match "x86") {
$env:VCVARS_PLATFORM="x86"
$env:BUILD="x86-pc-cygwin"
$env:HOST="x86-pc-windows"
$env:BUILD="i686-pc-cygwin"
$env:HOST="i686-pc-cygwin"
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh"
$env:SRC_ARCHITECTURE="x86"
} ElseIf ($env:Platform -Match "arm64") {
$env:VCVARS_PLATFORM="x86_arm64"
$env:BUILD="i686-pc-cygwin"
$env:HOST="aarch64-w64-cygwin"
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -marm64"
$env:SRC_ARCHITECTURE="aarch64"
} ElseIf ($env:Platform -Match "arm") {
$env:VCVARS_PLATFORM="x86_arm"
$env:BUILD="i686-pc-cygwin"
$env:HOST="arm-w32-cygwin"
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -marm"
$env:SRC_ARCHITECTURE="arm"
} Else {
$env:VCVARS_PLATFORM="amd64"
$env:BUILD="x86_64-w64-cygwin"
$env:HOST="x86_64-w64-cygwin"
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -m64"
$env:SRC_ARCHITECTURE="x86"
}
- 'appveyor DownloadFile https://cygwin.com/setup-x86.exe -FileName setup.exe'
- 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P dejagnu >NUL'
- '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"'
- echo call VsDevCmd to set VS150COMNTOOLS
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
- ps: $env:VSCOMNTOOLS=(Get-Content ("env:VS" + "$env:VSVER" + "0COMNTOOLS"))
- echo "Using Visual Studio %VSVER%.0 at %VSCOMNTOOLS%"
- call "%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
- call "%VSCOMNTOOLS%..\..\vc\Auxiliary\Build\vcvarsall.bat" %VCVARS_PLATFORM%
build_script:
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./autogen.sh;)"
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./configure CC='/cygdrive/c/projects/libffi/msvcc.sh -m64' CXX='/cygdrive/c/projects/libffi/msvcc.sh -m64' LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' AR='/cygdrive/c/projects/libffi/.travis/ar-lib lib' NM='dumpbin -symbols' STRIP=':' --build=$BUILD --host=$HOST;)"
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; cp src/x86/ffitarget.h include; make; find .;)"
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; ./configure CC='%MSVCC%' CXX='%MSVCC%' LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' AR='/cygdrive/c/projects/libffi/.travis/ar-lib lib' NM='dumpbin -symbols' STRIP=':' --build=$BUILD --host=$HOST;)"
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; cp src/%SRC_ARCHITECTURE%/ffitarget.h include; make; find .;)"
- c:\cygwin\bin\sh -lc "(cd $OLDPWD; cp `find . -name 'libffi-?.dll'` $HOST/testsuite/; make check; cat `find ./ -name libffi.log`)"
# FIXME: "make check" currently fails. It just looks like msvcc needs
# to learn about -L and -l options. If you add "make check; cat `find
# ./ -name libffi.log" to the end of that build command you'll see
# what I mean.

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
* text=auto
*.sln text eol=crlf
*.vcxproj* text eol=crlf

View File

@ -3,10 +3,50 @@ sudo: required
language: cpp
# For qemu-powered targets, get the list of supported processors from
# travis by setting QEMU_CPU=help, then set -mcpu= for the compilers
# accordingly.
matrix:
include:
- os: linux
env: HOST=or1k-elf RUNTESTFLAGS="--target_board or1k-sim" DEJAGNU="/opt/.travis/site.exp"
- os: linux
env: HOST=m32r-elf RUNTESTFLAGS="--target_board m32r-sim" DEJAGNU="/opt/.travis/site.exp"
- os: linux
env: HOST=bfin-elf RUNTESTFLAGS="--target_board bfin-sim" DEJAGNU="/opt/.travis/site.exp"
# This configuration is still using the native x86 toolchain?
# - os: osx
# env: HOST=aarch64-apple-darwin13
- os: osx
env: HOST=arm-apple-darwin
env: HOST=x86_64-apple-darwin10
- os: linux
env: HOST=x86_64-w64-mingw32 MEVAL='export CC="x86_64-w64-mingw32-gcc" && CXX="x86_64-w64-mingw32-g++" RUNTESTFLAGS="--target_board wine-sim" DEJAGNU="$TRAVIS_BUILD_DIR/.travis/site.exp" CONFIGURE_OPTIONS=--disable-shared LIBFFI_TEST_OPTIMIZATION="-O2"
- os: linux
env: HOST=sh4-linux-gnu CONFIGURE_OPTIONS=--disable-shared QEMU_LD_PREFIX=/usr/sh4-linux-gnu
- os: linux
env: HOST=alpha-linux-gnu CONFIGURE_OPTIONS=--disable-shared QEMU_LD_PREFIX=/usr/alpha-linux-gnu
- os: linux
env: HOST=m68k-linux-gnu MEVAL='export CC="m68k-linux-gnu-gcc-8 -mcpu=547x" && CXX="m68k-linux-gnu-g++-8 -mcpu=547x"' CONFIGURE_OPTIONS=--disable-shared QEMU_LD_PREFIX=/usr/m68k-linux-gnu QEMU_CPU=cfv4e
- os: linux
env: HOST=s390x-linux-gnu MEVAL='export CC="s390x-linux-gnu-gcc-8" && CXX="s390x-linux-gnu-g++-8"' CONFIGURE_OPTIONS=--disable-shared QEMU_LD_PREFIX=/usr/s390x-linux-gnu QEMU_CPU=max
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O0"
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2"
- os: linux
env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O2 -fomit-frame-pointer"
# The sparc64 linux system in the GCC compile farm is non-responsive.
# - os: linux
# env: HOST=sparc64-linux-gnu
# Having problems getting logs for this one...
# - os: linux
# env: HOST=powerpc64le-unknown-linux-gnu
# - os: linux
# env: HOST=aarch64-linux-gnu
# The mips64 linux system in the GCC compile farm is not allowing logins
# - os: linux
# env: HOST=mips64el-linux-gnu
- os: linux
compiler: gcc
env: HOST=i386-pc-linux-gnu MEVAL='export CC="$CC -m32" && CXX="$CXX -m32"'
@ -27,8 +67,9 @@ before_install:
- if test x"$MEVAL" != x; then eval ${MEVAL}; fi
install:
- ./.travis/install.sh
- travis_wait 30 ./.travis/install.sh
script:
- if ! test x"$MEVAL" = x; then eval ${MEVAL}; fi
- travis_wait 115 sleep infinity &
- ./.travis/build.sh

58
.travis/bfin-sim.exp Normal file
View File

@ -0,0 +1,58 @@
# Copyright (C) 2010, 2019 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This is a list of toolchains that are supported on this board.
set_board_info target_install {bfin-elf}
# Load the generic configuration for this board. This will define a basic set
# of routines needed by the tool to communicate with the board.
load_generic_config "sim"
# basic-sim.exp is a basic description for the standard Cygnus simulator.
load_base_board_description "basic-sim"
# "bfin" is the name of the sim subdir in devo/sim.
setup_sim bfin
# No multilib options needed by default.
process_multilib_options ""
# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.
set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# Configuration settings for testsuites
set_board_info noargs 1
set_board_info gdb,nosignals 1
set_board_info gdb,noresults 1
set_board_info gdb,cannot_call_functions 1
set_board_info gdb,skip_float_tests 1
set_board_info gdb,can_reverse 1
set_board_info gdb,use_precord 1
# More time is needed
set_board_info gcc,timeout 800
set_board_info gdb,timeout 60
# Used by a few gcc.c-torture testcases to delimit how large the stack can
# be.
set_board_info gcc,stack_size 5000

View File

@ -0,0 +1,17 @@
#!/bin/bash
cd /opt
set -x
echo $PATH
export PATH=/usr/local/bin:$PATH
echo $PATH
ls -l /usr/local/bin
./configure --host=${HOST}
make
make dist
make check RUNTESTFLAGS="-a $RUNTESTFLAGS" || true

12
.travis/build-in-container.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
cd /opt
export QEMU_LD_PREFIX=/usr/${HOST}
./configure ${HOST+--host=$HOST --disable-shared}
make
make dist
make check RUNTESTFLAGS="-a $RUNTESTFLAGS" || true

View File

@ -1,7 +1,38 @@
#!/bin/bash
# exit this script if any commmand fails
# set -e
set -x
if [ -z ${QEMU_CPU+x} ]; then
export SET_QEMU_CPU=
else
export SET_QEMU_CPU="-e QEMU_CPU=${QEMU_CPU}"
fi
# Default to podman where available, docker otherwise.
# Override by setting the DOCKER environment variable.
if test -z "$DOCKER"; then
which podman > /dev/null 2>&1
if [ $? != 0 ]; then
export DOCKER=docker
else
export DOCKER=podman
fi
fi
function build_cfarm()
{
curl -u ${CFARM_AUTH} https://cfarm-test-libffi-libffi.apps.home.labdroid.net/test?host=${HOST}\&commit=${TRAVIS_COMMIT} | tee build.log
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo $(tail build.log | grep '^==LOGFILE==')
echo $(tail build.log | grep '^==LOGFILE==' | cut -b13-)
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
curl -u ${CFARM_AUTH} "$(tail build.log | grep '^==LOGFILE==' | cut -b13-)" > libffi.log
./rlgl l https://rl.gl
ID=$(./rlgl start)
./rlgl e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git libffi.log
exit $?
}
function build_linux()
{
@ -10,25 +41,102 @@ function build_linux()
make
make dist
make check RUNTESTFLAGS="-a $RUNTESTFLAGS"
cat */testsuite/libffi.log
./rlgl l https://rl.gl
ID=$(./rlgl start)
./rlgl e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git */testsuite/libffi.log
exit $?
}
function build_foreign_linux()
{
${DOCKER} run --rm -t -i -v `pwd`:/opt ${SET_QEMU_CPU} -e LIBFFI_TEST_OPTIMIZATION="${LIBFFI_TEST_OPTIMIZATION}" $2 bash -c /opt/.travis/build-in-container.sh
./rlgl l https://rl.gl
ID=$(./rlgl start)
./rlgl e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git */testsuite/libffi.log
exit $?
}
function build_cross_linux()
{
${DOCKER} run --rm -t -i -v `pwd`:/opt ${SET_QEMU_CPU} -e HOST="${HOST}" -e CC="${HOST}-gcc-8 ${GCC_OPTIONS}" -e CXX="${HOST}-g++-8 ${GCC_OPTIONS}" -e LIBFFI_TEST_OPTIMIZATION="${LIBFFI_TEST_OPTIMIZATION}" moxielogic/cross-ci-build-container:latest bash -c /opt/.travis/build-in-container.sh
./rlgl l https://rl.gl
ID=$(./rlgl start)
./rlgl e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git */testsuite/libffi.log
exit $?
}
function build_cross()
{
${DOCKER} pull quay.io/moxielogic/libffi-ci-${HOST}
${DOCKER} run --rm -t -i -v `pwd`:/opt -e HOST="${HOST}" -e CC="${HOST}-gcc ${GCC_OPTIONS}" -e CXX="${HOST}-g++ ${GCC_OPTIONS}" -e TRAVIS_BUILD_DIR=/opt -e DEJAGNU="${DEJAGNU}" -e RUNTESTFLAGS="${RUNTESTFLAGS}" -e LIBFFI_TEST_OPTIMIZATION="${LIBFFI_TEST_OPTIMIZATION}" quay.io/moxielogic/libffi-ci-${HOST} bash -c /opt/.travis/build-cross-in-container.sh
./rlgl l https://rl.gl
ID=$(./rlgl start)
./rlgl e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git */testsuite/libffi.log
exit $?
}
function build_ios()
{
which python
# export PYTHON_BIN=/usr/local/bin/python
./generate-darwin-source-and-headers.py
./generate-darwin-source-and-headers.py --only-ios
xcodebuild -showsdks
xcodebuild -project libffi.xcodeproj -target "libffi-iOS" -configuration Release -sdk iphoneos10.3
find ./
xcodebuild -project libffi.xcodeproj -target "libffi-iOS" -configuration Release -sdk iphoneos11.4
exit $?
}
function build_macosx()
{
which python
# export PYTHON_BIN=/usr/local/bin/python
./generate-darwin-source-and-headers.py --only-osx
xcodebuild -showsdks
xcodebuild -project libffi.xcodeproj -target "libffi-Mac" -configuration Release -sdk macosx10.13
exit $?
}
./autogen.sh
case "$HOST" in
arm-apple-darwin*)
./autogen.sh
build_ios
;;
x86_64-apple-darwin*)
./autogen.sh
build_macosx
;;
arm32v7-linux-gnu)
./autogen.sh
build_foreign_linux arm moxielogic/arm32v7-ci-build-container:latest
;;
aarch64-linux-gnu| powerpc64le-unknown-linux-gnu | mips64el-linux-gnu | sparc64-linux-gnu)
build_cfarm
;;
bfin-elf )
./autogen.sh
GCC_OPTIONS=-msim build_cross
;;
m32r-elf )
./autogen.sh
build_cross
;;
or1k-elf )
./autogen.sh
build_cross
;;
m68k-linux-gnu )
./autogen.sh
GCC_OPTIONS=-mcpu=547x build_cross_linux
;;
alpha-linux-gnu | sh4-linux-gnu | s390x-linux-gnu )
./autogen.sh
build_cross_linux
;;
*)
./autogen.sh
build_linux
;;
esac

View File

@ -2,21 +2,55 @@
set -x
if [[ $TRAVIS_OS_NAME != 'linux' ]]; then
brew update
# fix an issue with libtool on travis by reinstalling it
brew uninstall libtool;
brew install libtool dejagnu;
brew update > brew-update.log 2>&1
# fix an issue with libtool on travis by reinstalling it
brew uninstall libtool;
brew install libtool dejagnu;
# Download and extract the rlgl client
wget -qO - https://rl.gl/cli/rlgl-darwin-amd64.tgz | \
tar --strip-components=2 -xvzf - ./rlgl/rlgl
else
sudo apt-get update
sudo apt-get install dejagnu texinfo
case "$HOST" in
i386-pc-linux-gnu)
sudo apt-get install gcc-multilib g++-multilib
;;
moxie-elf)
echo 'deb http://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update -qq
sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
;;
esac
# Download and extract the rlgl client
wget -qO - http://rl.gl/cli/rlgl-linux-amd64.tgz | \
tar --strip-components=2 -xvzf - ./rlgl/rlgl
sudo apt-get clean # clear the cache
sudo apt-get update
case $HOST in
aarch64-linux-gnu | powerpc64le-unknown-linux-gnu | mips64el-linux-gnu | sparc64-linux-gnu)
;;
alpha-linux-gnu | arm32v7-linux-gnu | m68k-linux-gnu | sh4-linux-gnu | s390x-linux-gnu )
sudo apt-get install qemu-user-static
;;
hppa-linux-gnu )
sudo apt-get install -y qemu-user-static g++-5-hppa-linux-gnu
;;
i386-pc-linux-gnu)
sudo apt-get install gcc-multilib g++-multilib;
;;
moxie-elf)
echo 'deb https://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
sudo apt-get clean # clear the cache
sudo apt-get update ## -qq
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
;;
x86_64-w64-mingw32)
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine;
;;
i686-w32-mingw32)
sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 wine;
;;
esac
case $HOST in
arm32v7-linux-gnu | aarch64-linux-gnu | ppc64le-linux-gnu | s390x-linux-gnu)
# don't install host tools
;;
*)
sudo apt-get install dejagnu texinfo sharutils
;;
esac
fi

58
.travis/m32r-sim.exp Normal file
View File

@ -0,0 +1,58 @@
# Copyright (C) 2010, 2019 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This is a list of toolchains that are supported on this board.
set_board_info target_install {m32r-elf}
# Load the generic configuration for this board. This will define a basic set
# of routines needed by the tool to communicate with the board.
load_generic_config "sim"
# basic-sim.exp is a basic description for the standard Cygnus simulator.
load_base_board_description "basic-sim"
# "m32r" is the name of the sim subdir in devo/sim.
setup_sim m32r
# No multilib options needed by default.
process_multilib_options ""
# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.
set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# Configuration settings for testsuites
set_board_info noargs 1
set_board_info gdb,nosignals 1
set_board_info gdb,noresults 1
set_board_info gdb,cannot_call_functions 1
set_board_info gdb,skip_float_tests 1
set_board_info gdb,can_reverse 1
set_board_info gdb,use_precord 1
# More time is needed
set_board_info gcc,timeout 800
set_board_info gdb,timeout 60
# Used by a few gcc.c-torture testcases to delimit how large the stack can
# be.
set_board_info gcc,stack_size 5000

58
.travis/or1k-sim.exp Normal file
View File

@ -0,0 +1,58 @@
# Copyright (C) 2010, 2019 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This is a list of toolchains that are supported on this board.
set_board_info target_install {or1k-elf}
# Load the generic configuration for this board. This will define a basic set
# of routines needed by the tool to communicate with the board.
load_generic_config "sim"
# basic-sim.exp is a basic description for the standard Cygnus simulator.
load_base_board_description "basic-sim"
# "or1k" is the name of the sim subdir in devo/sim.
setup_sim or1k
# No multilib options needed by default.
process_multilib_options ""
# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.
set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# Configuration settings for testsuites
set_board_info noargs 1
set_board_info gdb,nosignals 1
set_board_info gdb,noresults 1
set_board_info gdb,cannot_call_functions 1
set_board_info gdb,skip_float_tests 1
set_board_info gdb,can_reverse 1
set_board_info gdb,use_precord 1
# More time is needed
set_board_info gcc,timeout 800
set_board_info gdb,timeout 60
# Used by a few gcc.c-torture testcases to delimit how large the stack can
# be.
set_board_info gcc,stack_size 5000

View File

@ -1,4 +1,4 @@
# Copyright (C) 2008, 2010, 2018 Anthony Green
# Copyright (C) 2008, 2010, 2018, 2019 Anthony Green
# Make sure we look in the right place for the board description files.
if ![info exists boards_dir] {
@ -11,8 +11,17 @@ verbose "Global Config File: target_triplet is $target_triplet" 2
global target_list
case "$target_triplet" in {
{ "bfin-elf" } {
set target_list "bfin-sim"
}
{ "m32r-elf" } {
set target_list "m32r-sim"
}
{ "moxie-elf" } {
set target_list "moxie-sim"
}
{ "or1k-elf" } {
set target_list "or1k-sim"
}
}

55
.travis/wine-sim.exp Normal file
View File

@ -0,0 +1,55 @@
# Copyright (C) 2010, 2019 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This is a list of toolchains that are supported on this board.
set_board_info target_install {i686-w64-mingw32}
# Load the generic configuration for this board. This will define a basic set
# of routines needed by the tool to communicate with the board.
load_generic_config "sim"
set_board_info sim "wineconsole --backend=curses"
set_board_info is_simulator 1
# No multilib options needed by default.
process_multilib_options ""
# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.
set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# Configuration settings for testsuites
set_board_info noargs 1
set_board_info gdb,nosignals 1
set_board_info gdb,noresults 1
set_board_info gdb,cannot_call_functions 1
set_board_info gdb,skip_float_tests 1
set_board_info gdb,can_reverse 1
set_board_info gdb,use_precord 1
# More time is needed
set_board_info gcc,timeout 800
set_board_info gdb,timeout 60
# Used by a few gcc.c-torture testcases to delimit how large the stack can
# be.
set_board_info gcc,stack_size 5000

View File

@ -1,584 +0,0 @@
2011-02-08 Andreas Tobler <andreast@fgznet.ch>
* testsuite/lib/libffi.exp: Tweak for stand-alone mode.
2009-12-25 Samuli Suominen <ssuominen@gentoo.org>
* configure.ac: Undefine _AC_ARG_VAR_PRECIOUS for autoconf 2.64.
* configure: Rebuilt.
* fficonfig.h.in: Rebuilt.
2009-06-16 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/cls_align_sint64.c,
testsuite/libffi.call/cls_align_uint64.c,
testsuite/libffi.call/cls_longdouble_va.c,
testsuite/libffi.call/cls_ulonglong.c,
testsuite/libffi.call/return_ll1.c,
testsuite/libffi.call/stret_medium2.c: Fix printf format
specifiers.
* testsuite/libffi.call/huge_struct.c: Ad x86 XFAILs.
* testsuite/libffi.call/float2.c: Fix dg-excess-errors.
* testsuite/libffi.call/ffitest.h,
testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define.
2009-06-12 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/cls_align_sint64.c,
testsuite/libffi.call/cls_align_uint64.c,
testsuite/libffi.call/cls_ulonglong.c,
testsuite/libffi.call/return_ll1.c,
testsuite/libffi.call/stret_medium2.c: Fix printf format
specifiers.
testsuite/libffi.special/unwindtest.cc: include stdint.h.
2009-06-11 Timothy Wall <twall@users.sf.net>
* Makefile.am,
configure.ac,
include/ffi.h.in,
include/ffi_common.h,
src/closures.c,
src/dlmalloc.c,
src/x86/ffi.c,
src/x86/ffitarget.h,
src/x86/win64.S (new),
README: Added win64 support (mingw or MSVC)
* Makefile.in,
include/Makefile.in,
man/Makefile.in,
testsuite/Makefile.in,
configure,
aclocal.m4: Regenerated
* ltcf-c.sh: properly escape cygwin/w32 path
* man/ffi_call.3: Clarify size requirements for return value.
* src/x86/ffi64.c: Fix filename in comment.
* src/x86/win32.S: Remove unused extern.
* testsuite/libffi.call/closure_fn0.c,
testsuite/libffi.call/closure_fn1.c,
testsuite/libffi.call/closure_fn2.c,
testsuite/libffi.call/closure_fn3.c,
testsuite/libffi.call/closure_fn4.c,
testsuite/libffi.call/closure_fn5.c,
testsuite/libffi.call/closure_fn6.c,
testsuite/libffi.call/closure_stdcall.c,
testsuite/libffi.call/cls_12byte.c,
testsuite/libffi.call/cls_16byte.c,
testsuite/libffi.call/cls_18byte.c,
testsuite/libffi.call/cls_19byte.c,
testsuite/libffi.call/cls_1_1byte.c,
testsuite/libffi.call/cls_20byte.c,
testsuite/libffi.call/cls_20byte1.c,
testsuite/libffi.call/cls_24byte.c,
testsuite/libffi.call/cls_2byte.c,
testsuite/libffi.call/cls_3_1byte.c,
testsuite/libffi.call/cls_3byte1.c,
testsuite/libffi.call/cls_3byte2.c,
testsuite/libffi.call/cls_4_1byte.c,
testsuite/libffi.call/cls_4byte.c,
testsuite/libffi.call/cls_5_1_byte.c,
testsuite/libffi.call/cls_5byte.c,
testsuite/libffi.call/cls_64byte.c,
testsuite/libffi.call/cls_6_1_byte.c,
testsuite/libffi.call/cls_6byte.c,
testsuite/libffi.call/cls_7_1_byte.c,
testsuite/libffi.call/cls_7byte.c,
testsuite/libffi.call/cls_8byte.c,
testsuite/libffi.call/cls_9byte1.c,
testsuite/libffi.call/cls_9byte2.c,
testsuite/libffi.call/cls_align_double.c,
testsuite/libffi.call/cls_align_float.c,
testsuite/libffi.call/cls_align_longdouble.c,
testsuite/libffi.call/cls_align_longdouble_split.c,
testsuite/libffi.call/cls_align_longdouble_split2.c,
testsuite/libffi.call/cls_align_pointer.c,
testsuite/libffi.call/cls_align_sint16.c,
testsuite/libffi.call/cls_align_sint32.c,
testsuite/libffi.call/cls_align_sint64.c,
testsuite/libffi.call/cls_align_uint16.c,
testsuite/libffi.call/cls_align_uint32.c,
testsuite/libffi.call/cls_align_uint64.c,
testsuite/libffi.call/cls_dbls_struct.c,
testsuite/libffi.call/cls_double.c,
testsuite/libffi.call/cls_double_va.c,
testsuite/libffi.call/cls_float.c,
testsuite/libffi.call/cls_longdouble.c,
testsuite/libffi.call/cls_longdouble_va.c,
testsuite/libffi.call/cls_multi_schar.c,
testsuite/libffi.call/cls_multi_sshort.c,
testsuite/libffi.call/cls_multi_sshortchar.c,
testsuite/libffi.call/cls_multi_uchar.c,
testsuite/libffi.call/cls_multi_ushort.c,
testsuite/libffi.call/cls_multi_ushortchar.c,
testsuite/libffi.call/cls_pointer.c,
testsuite/libffi.call/cls_pointer_stack.c,
testsuite/libffi.call/cls_schar.c,
testsuite/libffi.call/cls_sint.c,
testsuite/libffi.call/cls_sshort.c,
testsuite/libffi.call/cls_uchar.c,
testsuite/libffi.call/cls_uint.c,
testsuite/libffi.call/cls_ulonglong.c,
testsuite/libffi.call/cls_ushort.c,
testsuite/libffi.call/err_bad_abi.c,
testsuite/libffi.call/err_bad_typedef.c,
testsuite/libffi.call/float2.c,
testsuite/libffi.call/huge_struct.c,
testsuite/libffi.call/nested_struct.c,
testsuite/libffi.call/nested_struct1.c,
testsuite/libffi.call/nested_struct10.c,
testsuite/libffi.call/nested_struct2.c,
testsuite/libffi.call/nested_struct3.c,
testsuite/libffi.call/nested_struct4.c,
testsuite/libffi.call/nested_struct5.c,
testsuite/libffi.call/nested_struct6.c,
testsuite/libffi.call/nested_struct7.c,
testsuite/libffi.call/nested_struct8.c,
testsuite/libffi.call/nested_struct9.c,
testsuite/libffi.call/problem1.c,
testsuite/libffi.call/return_ldl.c,
testsuite/libffi.call/return_ll1.c,
testsuite/libffi.call/stret_large.c,
testsuite/libffi.call/stret_large2.c,
testsuite/libffi.call/stret_medium.c,
testsuite/libffi.call/stret_medium2.c,
testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
of checking for MMAP. Use intptr_t instead of long casts.
2009-06-04 Andrew Haley <aph@redhat.com>
* src/powerpc/ffitarget.h: Fix misapplied merge from gcc.
2009-06-04 Andrew Haley <aph@redhat.com>
* src/mips/o32.S,
src/mips/n32.S: Fix licence formatting.
2009-06-04 Andrew Haley <aph@redhat.com>
* src/x86/darwin.S: Fix licence formatting.
src/x86/win32.S: Likewise.
src/sh64/sysv.S: Likewise.
src/sh/sysv.S: Likewise.
2009-06-04 Andrew Haley <aph@redhat.com>
* src/sh64/ffi.c: Remove lint directives. Was missing from merge
of Andreas Tobler's patch from 2006-04-22.
2009-06-04 Andrew Haley <aph@redhat.com>
* src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of
2007-03-07.
2008-12-26 Timothy Wall <twall@users.sf.net>
* testsuite/libffi.call/cls_longdouble.c,
testsuite/libffi.call/cls_longdouble_va.c,
testsuite/libffi.call/cls_align_longdouble.c,
testsuite/libffi.call/cls_align_longdouble_split.c,
testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected
failures on x86_64 cygwin/mingw.
2008-12-22 Timothy Wall <twall@users.sf.net>
* testsuite/libffi.call/closure_fn0.c,
testsuite/libffi.call/closure_fn1.c,
testsuite/libffi.call/closure_fn2.c,
testsuite/libffi.call/closure_fn3.c,
testsuite/libffi.call/closure_fn4.c,
testsuite/libffi.call/closure_fn5.c,
testsuite/libffi.call/closure_fn6.c,
testsuite/libffi.call/closure_loc_fn0.c,
testsuite/libffi.call/closure_stdcall.c,
testsuite/libffi.call/cls_align_pointer.c,
testsuite/libffi.call/cls_pointer.c,
testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
pointer to integer (intptr_t).
* testsuite/libffi.call/cls_longdouble.c: disable for win64.
2008-12-19 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.8.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-11-11 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.7.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-08-25 Andreas Tobler <a.tobler@schweiz.org>
* src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and
FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT.
Adjust copyright notice.
* src/powerpc/ffi.c: Add two new flags to indicate if we have one
register or two register to use for FFI_SYSV structs.
(ffi_prep_cif_machdep): Pass the right register flag introduced above.
(ffi_closure_helper_SYSV): Fix the return type for
FFI_SYSV_TYPE_SMALL_STRUCT. Comment.
Adjust copyright notice.
2008-07-24 Anthony Green <green@redhat.com>
* testsuite/libffi.call/cls_dbls_struct.c,
testsuite/libffi.call/cls_double_va.c,
testsuite/libffi.call/cls_longdouble.c,
testsuite/libffi.call/cls_longdouble_va.c,
testsuite/libffi.call/cls_pointer.c,
testsuite/libffi.call/cls_pointer_stack.c,
testsuite/libffi.call/err_bad_abi.c: Clean up failures from
compiler warnings.
2008-07-17 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.6.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision. Add documentation.
* README: Update for new release.
2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
* src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned
int.
2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
* src/sh/sysv.S: Add .note.GNU-stack on Linux.
* src/sh64/sysv.S: Likewise.
2008-04-03 Anthony Green <green@redhat.com>
* libffi.pc.in (Libs): Add -L${libdir}.
* configure.ac: Bump version to 3.0.5.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-04-03 Anthony Green <green@redhat.com>
Xerces Ranby <xerxes@zafena.se>
* include/ffi.h.in: Wrap definition of target architecture to
protect from double definitions.
2008-03-22 Moriyoshi Koizumi <moriyoshi@gmail.com>
* src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in
closure_loc_fn0.c.
* testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0):
New test.
2008-03-04 Anthony Green <green@redhat.com>
Blake Chaffin
hos@tamanegi.org
* testsuite/libffi.call/cls_align_longdouble_split2.c
testsuite/libffi.call/cls_align_longdouble_split.c
testsuite/libffi.call/cls_dbls_struct.c
testsuite/libffi.call/cls_double_va.c
testsuite/libffi.call/cls_longdouble.c
testsuite/libffi.call/cls_longdouble_va.c
testsuite/libffi.call/cls_pointer.c
testsuite/libffi.call/cls_pointer_stack.c
testsuite/libffi.call/err_bad_abi.c
testsuite/libffi.call/err_bad_typedef.c
testsuite/libffi.call/huge_struct.c
testsuite/libffi.call/stret_large2.c
testsuite/libffi.call/stret_large.c
testsuite/libffi.call/stret_medium2.c
testsuite/libffi.call/stret_medium.c: New tests from Apple.
2008-02-26 Jakub Jelinek <jakub@redhat.com>
Anthony Green <green@redhat.com>
* src/alpha/osf.S: Add .note.GNU-stack on Linux.
* src/s390/sysv.S: Likewise.
* src/powerpc/linux64.S: Likewise.
* src/powerpc/linux64_closure.S: Likewise.
* src/powerpc/ppc_closure.S: Likewise.
* src/powerpc/sysv.S: Likewise.
* src/x86/unix64.S: Likewise.
* src/x86/sysv.S: Likewise.
* src/sparc/v8.S: Likewise.
* src/sparc/v9.S: Likewise.
* src/m68k/sysv.S: Likewise.
* src/ia64/unix.S: Likewise.
* src/arm/sysv.S: Likewise.
2008-02-26 Anthony Green <green@redhat.com>
Thomas Heller <theller@ctypes.org>
* src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C
comment.
2008-02-26 Anthony Green <green@redhat.org>
Thomas Heller <theller@ctypes.org>
* include/ffi.h.in: Change void (*)() to void (*)(void).
2008-02-26 Anthony Green <green@redhat.org>
Thomas Heller <theller@ctypes.org>
* src/alpha/ffi.c: Change void (*)() to void (*)(void).
src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c,
src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c,
src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S,
src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c,
src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c,
src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S,
src/x86/ffi64.c: Ditto.
2008-02-24 Anthony Green <green@redhat.org>
* configure.ac: Accept openbsd*, not just openbsd.
Bump version to 3.0.4.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-02-22 Anthony Green <green@redhat.com>
* README: Clean up list of tested platforms.
2008-02-22 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.3.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release. Clean up test docs.
2008-02-22 Bjoern Koenig <bkoenig@alpha-tierchen.de>
Andreas Tobler <a.tobler@schweiz.org>
* configure.ac: Add amd64-*-freebsd* target.
* configure: Regenerate.
2008-02-22 Thomas Heller <theller@ctypes.org>
* configure.ac: Add x86 OpenBSD support.
* configure: Rebuilt.
2008-02-21 Thomas Heller <theller@ctypes.org>
* README: Change "make test" to "make check".
2008-02-21 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.2.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-02-21 Björn König <bkoenig@alpha-tierchen.de>
* src/x86/freebsd.S: New file.
* configure.ac: Add x86 FreeBSD support.
* Makefile.am: Ditto.
2008-02-15 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.1.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* libtool-version: Increment revision.
* README: Update for new release.
2008-02-15 David Daney <ddaney@avtrex.com>
* src/mips/ffi.c: Remove extra '>' from include directive.
(ffi_prep_closure_loc): Use clear_location instead of tramp.
2008-02-15 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 3.0.0.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
2008-02-15 David Daney <ddaney@avtrex.com>
* src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
Define (conditionally), and use it to include cachectl.h.
(ffi_prep_closure_loc): Fix cache flushing.
* src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.
2008-02-15 Anthony Green <green@redhat.com>
* man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3:
Update dates and remove all references to ffi_prep_closure.
* configure.ac: Bump version to 2.99.9.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
2008-02-15 Anthony Green <green@redhat.com>
* man/ffi_prep_closure.3: Delete.
* man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3.
(man_MANS): Ditto.
* man/Makefile.in: Rebuilt.
* configure.ac: Bump version to 2.99.8.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 2.99.7.
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
* include/ffi.h.in LICENSE src/debug.c src/closures.c
src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h
src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c
src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S
src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c
src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c
src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S
src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h
src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c
src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S
src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h
src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h
src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S
src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h
src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S
src/arm/ffitarget.h src/prep_cif.c: Update license text.
2008-02-14 Anthony Green <green@redhat.com>
* README: Update tested platforms.
* configure.ac: Bump version to 2.99.6.
* configure: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* configure.ac: Bump version to 2.99.5.
* configure: Rebuilt.
* Makefile.am (EXTRA_DIST): Add darwin64.S
* Makefile.in: Rebuilt.
* testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree.
* LICENSE: Update WARRANTY.
2008-02-14 Anthony Green <green@redhat.com>
* libffi.pc.in (libdir): Fix libdir definition.
* configure.ac: Bump version to 2.99.4.
* configure: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* README: Update.
* libffi.info: New file.
* doc/stamp-vti: New file.
* configure.ac: Bump version to 2.99.3.
* configure: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* Makefile.am (SUBDIRS): Add man dir.
* Makefile.in: Rebuilt.
* configure.ac: Create Makefile.
* configure: Rebuilt.
* man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3
man/Makefile.am man/Makefile.in: New files.
2008-02-14 Tom Tromey <tromey@redhat.com>
* aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt.
* mdate-sh, texinfo.tex: New files.
* Makefile.am (info_TEXINFOS): New variable.
* doc/libffi.texi: New file.
* doc/version.texi: Likewise.
2008-02-14 Anthony Green <green@redhat.com>
* Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET).
(lib_LTLIBRARIES): Define.
(toolexeclib_LIBRARIES): Undefine.
* Makefile.in: Rebuilt.
* configure.ac: Reset version to 2.99.1.
* configure.in: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@.
* configure.ac: Reset version to 2.99.1.
* configure.in: Rebuilt.
* Makefile.am (EXTRA_DIST): Add ChangeLog.libffi.
* Makefile.in: Rebuilt.
* LICENSE: Update copyright notice.
2008-02-14 Anthony Green <green@redhat.com>
* include/Makefile.am (nodist_includes_HEADERS): Define. Don't
distribute ffitarget.h or ffi.h from the build include dir.
* Makefile.in: Rebuilt.
2008-02-14 Anthony Green <green@redhat.com>
* include/Makefile.am (includesdir): Install headers under libdir.
(pkgconfigdir): Define. Install libffi.pc.
* include/Makefile.in: Rebuilt.
* libffi.pc.in: Create.
* libtool-version: Increment CURRENT
* configure.ac: Add libffi.pc.in
* configure: Rebuilt.
2008-02-03 Anthony Green <green@redhat.com>
* include/Makefile.am (includesdir): Fix header install with
DESTDIR.
* include/Makefile.in: Rebuilt.
2008-02-03 Timothy Wall <twall@users.sf.net>
* src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return
offset based on code pointer, not data pointer.
2008-02-01 Anthony Green <green@redhat.com>
* include/Makefile.am: Fix header installs.
* Makefile.am: Ditto.
* include/Makefile.in: Rebuilt.
* Makefile.in: Ditto.
2008-02-01 Anthony Green <green@redhat.com>
* src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL,
FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last
patch.
2008-01-31 Anthony Green <green@redhat.com>
* Makefile.am (EXTRA_DIST): Add missing files.
* testsuite/Makefile.am: Ditto.
* Makefile.in, testsuite/Makefile.in: Rebuilt.
2008-01-31 Timothy Wall <twall@users.sf.net>
* testsuite/libffi.call/closure_stdcall.c: Add test for stdcall
closures.
* src/x86/ffitarget.h: Increase size of trampoline for stdcall
closures.
* src/x86/win32.S: Add assembly for stdcall closure.
* src/x86/ffi.c: Initialize stdcall closure trampoline.
2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
PR libffi/34612
* src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
returning struct.
* testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
tests.
2008-01-30 Anthony Green <green@redhat.com>
* Makefile.am, include/Makefile.am: Move headers to
libffi_la_SOURCES for new automake.
* Makefile.in, include/Makefile.in: Rebuilt.
* testsuite/lib/wrapper.exp: Copied from gcc tree to allow for
execution outside of gcc tree.
* testsuite/lib/target-libpath.exp: Ditto.
* testsuite/lib/libffi-dg.exp: Many changes to allow for execution
outside of gcc tree.

View File

@ -1,40 +0,0 @@
2004-01-14 Kelley Cook <kcook@gcc.gnu.org>
* configure.in: Add in AC_PREREQ(2.13)
2003-02-20 Alexandre Oliva <aoliva@redhat.com>
* configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
config.status.
* configure: Rebuilt.
2002-01-27 Alexandre Oliva <aoliva@redhat.com>
* configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST.
Remove USE_LIBDIR conditional.
* Makefile.am (toolexecdir, toolexeclibdir): Don't override.
* Makefile.in, configure: Rebuilt.
Mon Aug 9 18:33:38 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* include/Makefile.in: Rebuilt.
* Makefile.in: Rebuilt
* Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native
builds.
Use USE_LIBDIR.
* configure: Rebuilt.
* configure.in (USE_LIBDIR): Define for native builds.
Use lowercase in configure --help explanations.
1999-08-08 Anthony Green <green@cygnus.com>
* include/ffi.h.in (FFI_FN): Remove `...'.
1999-08-08 Anthony Green <green@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (AM_CFLAGS): Compile with -fexceptions.
* src/x86/sysv.S: Add exception handling metadata.

File diff suppressed because it is too large Load Diff

View File

@ -1,764 +0,0 @@
The libffi version 1 ChangeLog archive.
Version 1 of libffi had per-directory ChangeLogs. Current and future
versions have a single ChangeLog file in the root directory. The
version 1 ChangeLogs have all been concatenated into this file for
future reference only.
--- libffi ----------------------------------------------------------------
Mon Oct 5 02:17:50 1998 Anthony Green <green@cygnus.com>
* configure.in: Boosted rev.
* configure, Makefile.in, aclocal.m4: Rebuilt.
* README: Boosted rev and updated release notes.
Mon Oct 5 01:03:03 1998 Anthony Green <green@cygnus.com>
* configure.in: Boosted rev.
* configure, Makefile.in, aclocal.m4: Rebuilt.
* README: Boosted rev and updated release notes.
1998-07-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* m68k/ffi.c (ffi_prep_cif_machdep): Use bitmask for cif->flags.
Correctly handle small structures.
(ffi_prep_args): Also handle small structures.
(ffi_call): Pass size of return type to ffi_call_SYSV.
* m68k/sysv.S: Adjust for above changes. Correctly align small
structures in the return value.
* types.c (uint64, sint64) [M68K]: Change alignment to 4.
Fri Apr 17 17:26:58 1998 Anthony Green <green@hoser.cygnus.com>
* configure.in: Boosted rev.
* configure,Makefile.in,aclocal.m4: Rebuilt.
* README: Boosted rev and added release notes.
Sun Feb 22 00:50:41 1998 Geoff Keating <geoffk@ozemail.com.au>
* configure.in: Add PowerPC config bits.
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* configure.in: Add m68k config bits. Change AC_CANONICAL_SYSTEM
to AC_CANONICAL_HOST, this is not a compiler. Use $host instead
of $target. Remove AC_CHECK_SIZEOF(char), we already know the
result. Fix argument of AC_ARG_ENABLE.
* configure, fficonfig.h.in: Rebuilt.
Tue Feb 10 20:53:40 1998 Richard Henderson <rth@cygnus.com>
* configure.in: Add Alpha config bits.
Tue May 13 13:39:20 1997 Anthony Green <green@hoser.cygnus.com>
* README: Updated dates and reworded Irix comments.
* configure.in: Removed AC_PROG_RANLIB.
* Makefile.in, aclocal.m4, config.guess, config.sub, configure,
ltmain.sh, */Makefile.in: libtoolized again and rebuilt with
automake and autoconf.
Sat May 10 18:44:50 1997 Tom Tromey <tromey@cygnus.com>
* configure, aclocal.m4: Rebuilt.
* configure.in: Don't compute EXTRADIST; now handled in
src/Makefile.in. Removed macros implied by AM_INIT_AUTOMAKE.
Don't run AM_MAINTAINER_MODE.
Thu May 8 14:34:05 1997 Anthony Green <green@hoser.cygnus.com>
* missing, ltmain.sh, ltconfig.sh: Created. These are new files
required by automake and libtool.
* README: Boosted rev to 1.14. Added notes.
* acconfig.h: Moved PACKAGE and VERSION for new automake.
* configure.in: Changes for libtool.
* Makefile.am (check): make test now make check. Uses libtool now.
* Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt.
Thu May 1 16:27:07 1997 Anthony Green <green@hoser.cygnus.com>
* missing: Added file required by new automake.
Tue Nov 26 14:10:42 1996 Anthony Green <green@csk3.cygnus.com>
* acconfig.h: Added USING_PURIFY flag. This is defined when
--enable-purify-safety was used at configure time.
* configure.in (allsources): Added --enable-purify-safety switch.
(VERSION): Boosted rev to 1.13.
* configure: Rebuilt.
Fri Nov 22 06:46:12 1996 Anthony Green <green@rtl.cygnus.com>
* configure.in (VERSION): Boosted rev to 1.12.
Removed special CFLAGS hack for gcc.
* configure: Rebuilt.
* README: Boosted rev to 1.12. Added notes.
* Many files: Cygnus Support changed to Cygnus Solutions.
Wed Oct 30 11:15:25 1996 Anthony Green <green@rtl.cygnus.com>
* configure.in (VERSION): Boosted rev to 1.11.
* configure: Rebuilt.
* README: Boosted rev to 1.11. Added notes about GNU make.
Tue Oct 29 12:25:12 1996 Anthony Green <green@rtl.cygnus.com>
* configure.in: Fixed -Wall trick.
(VERSION): Boosted rev.
* configure: Rebuilt
* acconfig.h: Needed for --enable-debug configure switch.
* README: Boosted rev to 1.09. Added more notes on building
libffi, and LCLint.
* configure.in: Added --enable-debug switch. Boosted rev to
1.09.
* configure: Rebuilt
Tue Oct 15 13:11:28 1996 Anthony Green <green@hoser.cygnus.com>
* configure.in (VERSION): Boosted rev to 1.08
* configure: Rebuilt.
* README: Added n32 bug fix notes.
* Makefile.am: Added "make lint" production.
* Makefile.in: Rebuilt.
Mon Oct 14 10:54:46 1996 Anthony Green <green@rtl.cygnus.com>
* README: Added web page reference.
* configure.in, README: Boosted rev to 1.05
* configure: Rebuilt.
* README: Fixed n32 sample code.
Fri Oct 11 17:09:28 1996 Anthony Green <green@rtl.cygnus.com>
* README: Added sparc notes.
* configure.in, README: Boosted rev to 1.04.
* configure: Rebuilt.
Thu Oct 10 10:31:03 1996 Anthony Green <green@rtl.cygnus.com>
* configure.in, README: Boosted rev to 1.03.
* configure: Rebuilt.
* README: Added struct notes.
* Makefile.am (EXTRA_DIST): Added LICENSE to distribution.
* Makefile.in: Rebuilt.
* README: Removed Linux section. No special notes now
because aggregates arg/return types work.
Wed Oct 9 16:16:42 1996 Anthony Green <green@rtl.cygnus.com>
* README, configure.in (VERSION): Boosted rev to 1.02
* configure: Rebuilt.
Tue Oct 8 11:56:33 1996 Anthony Green <green@rtl.cygnus.com>
* README (NOTE): Added n32 notes.
* Makefile.am: Added test production.
* Makefile: Rebuilt
* README: spell checked!
* configure.in (VERSION): Boosted rev to 1.01
* configure: Rebuilt.
Mon Oct 7 15:50:22 1996 Anthony Green <green@rtl.cygnus.com>
* configure.in: Added nasty bit to support SGI tools.
* configure: Rebuilt.
* README: Added SGI notes. Added note about automake bug.
Mon Oct 7 11:00:28 1996 Anthony Green <green@hoser.cygnus.com>
* README: Rewrote intro, and fixed examples.
Fri Oct 4 10:19:55 1996 Anthony Green <green@hoser.cygnus.com>
* configure.in: -D$TARGET is no longer used as a compiler switch.
It is now inserted into ffi.h at configure time.
* configure: Rebuilt.
* FFI_ABI and FFI_STATUS are now ffi_abi and ffi_status.
Thu Oct 3 13:47:34 1996 Anthony Green <green@hoser.cygnus.com>
* README, LICENSE: Created. Wrote some docs.
* configure.in: Don't barf on i586-unknown-linuxaout.
Added EXTRADIST code for "make dist".
* configure: Rebuilt.
* */Makefile.in: Rebuilt with patched automake.
Tue Oct 1 17:12:25 1996 Anthony Green <green@rtl.cygnus.com>
* Makefile.am, aclocal.m4, config.guess, config.sub,
configure.in, fficonfig.h.in, install-sh, mkinstalldirs,
stamp-h.in: Created
* Makefile.in, configure: Generated
--- libffi/include --------------------------------------------------------
Tue Feb 24 13:09:36 1998 Anthony Green <green@gerbil.cygnus.com>
* ffi_mips.h: Updated FFI_TYPE_STRUCT_* values based on
ffi.h.in changes. This is a work-around for SGI's "simple"
assembler.
Sun Feb 22 00:51:55 1998 Geoff Keating <geoffk@ozemail.com.au>
* ffi.h.in: PowerPC support.
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* ffi.h.in: Add m68k support.
(FFI_TYPE_LONGDOUBLE): Make it a separate value.
Tue Feb 10 20:55:16 1998 Richard Henderson <rth@cygnus.com>
* ffi.h.in (SIZEOF_ARG): Use a pointer type by default.
* ffi.h.in: Alpha support.
Fri Nov 22 06:48:45 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in, ffi_common.h: Cygnus Support -> Cygnus Solutions.
Wed Nov 20 22:31:01 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.h.in: Added ffi_type_void definition.
Tue Oct 29 12:22:40 1996 Anthony Green <green@rtl.cygnus.com>
* Makefile.am (hack_DATA): Always install ffi_mips.h.
* ffi.h.in: Removed FFI_DEBUG. It's now in the correct
place (acconfig.h).
Added #include <stddef.h> for size_t definition.
Tue Oct 15 17:23:35 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.h.in, ffi_common.h, ffi_mips.h: More clean up.
Commented out #define of FFI_DEBUG.
Tue Oct 15 13:01:06 1996 Anthony Green <green@rtl.cygnus.com>
* ffi_common.h: Added bool definition.
* ffi.h.in, ffi_common.h: Clean up based on LCLint output.
Added funny /*@...@*/ comments to annotate source.
Mon Oct 14 12:29:23 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in: Interface changes based on feedback from Jim
Blandy.
Fri Oct 11 16:49:35 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in: Small change for sparc support.
Thu Oct 10 14:53:37 1996 Anthony Green <green@rtl.cygnus.com>
* ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for
special structure return types.
Wed Oct 9 13:55:57 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in: Added SIZEOF_ARG definition for X86
Tue Oct 8 11:40:36 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in (FFI_FN): Added macro for eliminating compiler warnings.
Use it to case your function pointers to the proper type.
* ffi_mips.h (SIZEOF_ARG): Added magic to fix type promotion bug.
* Makefile.am (EXTRA_DIST): Added ffi_mips.h to EXTRA_DIST.
* Makefile: Rebuilt.
* ffi_mips.h: Created. Moved all common mips definitions here.
Mon Oct 7 10:58:12 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.h.in: The SGI assember is very picky about parens. Redefined
some macros to avoid problems.
* ffi.h.in: Added FFI_DEFAULT_ABI definitions. Also added
externs for pointer, and 64bit integral ffi_types.
Fri Oct 4 09:51:37 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.h.in: Added FFI_ABI member to ffi_cif and changed
function prototypes accordingly.
Added #define @TARGET@. Now programs including ffi.h don't
have to specify this themselves.
Thu Oct 3 15:36:44 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.h.in: Changed ffi_prep_cif's values from void* to void**
* Makefile.am (EXTRA_DIST): Added EXTRA_DIST for "make dist"
to work.
* Makefile.in: Regenerated.
Wed Oct 2 10:16:59 1996 Anthony Green <green@hoser.cygnus.com>
* Makefile.am: Created
* Makefile.in: Generated
* ffi_common.h: Added rcsid comment
Tue Oct 1 17:13:51 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.h.in, ffi_common.h: Created
--- libffi/src ------------------------------------------------------------
Mon Oct 5 02:17:50 1998 Anthony Green <green@cygnus.com>
* arm/ffi.c, arm/sysv.S: Created.
* Makefile.am: Added arm files.
* Makefile.in: Rebuilt.
Mon Oct 5 01:41:38 1998 Anthony Green <green@rtl.cygnus.com>
* Makefile.am (libffi_la_LDFLAGS): Incremented revision.
Sun Oct 4 16:27:17 1998 Anthony Green <green@cygnus.com>
* alpha/osf.S (ffi_call_osf): Patch for DU assembler.
* ffitest.c (main): long long and long double return values work
for x86.
Fri Apr 17 11:50:58 1998 Anthony Green <green@hoser.cygnus.com>
* Makefile.in: Rebuilt.
* ffitest.c (main): Floating point tests not executed for systems
with broken lond double (SunOS 4 w/ GCC).
* types.c: Fixed x86 alignment info for long long types.
Thu Apr 16 07:15:28 1998 Anthony Green <green@ada.cygnus.com>
* ffitest.c: Added more notes about GCC bugs under Irix 6.
Wed Apr 15 08:42:22 1998 Anthony Green <green@hoser.cygnus.com>
* ffitest.c (struct5): New test function.
(main): New test with struct5.
Thu Mar 5 10:48:11 1998 Anthony Green <green@tootie.to.cygnus.com>
* prep_cif.c (initialize_aggregate): Fix assertion for
nested structures.
Tue Feb 24 16:33:41 1998 Anthony Green <green@hoser.cygnus.com>
* prep_cif.c (ffi_prep_cif): Added long double support for sparc.
Sun Feb 22 00:52:18 1998 Geoff Keating <geoffk@ozemail.com.au>
* powerpc/asm.h: New file.
* powerpc/ffi.c: New file.
* powerpc/sysv.S: New file.
* Makefile.am: PowerPC port.
* ffitest.c (main): Allow all tests to run even in presence of gcc
bug on PowerPC.
1998-02-17 Anthony Green <green@hoser.cygnus.com>
* mips/ffi.c: Fixed comment typo.
* x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat):
Fixed x86 long double return handling.
* types.c: Fixed x86 long double alignment info.
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* types.c: Add m68k support.
* ffitest.c (floating): Add long double parameter.
(return_ll, ldblit): New functions to test long long and long
double return value.
(main): Fix type error in assignment of ts[1-4]_type.elements.
Add tests for long long and long double arguments and return
values.
* prep_cif.c (ffi_prep_cif) [M68K]: Don't allocate argument for
struct value pointer.
* m68k/ffi.c, m68k/sysv.S: New files.
* Makefile.am: Add bits for m68k port. Add kludge to work around
automake deficiency.
(test): Don't require "." in $PATH.
* Makefile.in: Rebuilt.
Wed Feb 11 07:36:50 1998 Anthony Green <green@hoser.cygnus.com>
* Makefile.in: Rebuilt.
Tue Feb 10 20:56:00 1998 Richard Henderson <rth@cygnus.com>
* alpha/ffi.c, alpha/osf.S: New files.
* Makefile.am: Alpha port.
Tue Nov 18 14:12:07 1997 Anthony Green <green@hoser.cygnus.com>
* mips/ffi.c (ffi_prep_cif_machdep): Initialize rstruct_flag
for n32.
Tue Jun 3 17:18:20 1997 Anthony Green <green@hoser.cygnus.com>
* ffitest.c (main): Added hack to get structure tests working
correctly.
Sat May 10 19:06:42 1997 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (EXTRA_DIST): Explicitly list all distributable
files in subdirs.
(VERSION, CC): Removed.
Thu May 8 17:19:01 1997 Anthony Green <green@hoser.cygnus.com>
* Makefile.am: Many changes for new automake and libtool.
* Makefile.in: Rebuilt.
Fri Nov 22 06:57:56 1996 Anthony Green <green@rtl.cygnus.com>
* ffitest.c (main): Fixed test case for non mips machines.
Wed Nov 20 22:31:59 1996 Anthony Green <green@hoser.cygnus.com>
* types.c: Added ffi_type_void declaration.
Tue Oct 29 13:07:19 1996 Anthony Green <green@rtl.cygnus.com>
* ffitest.c (main): Fixed character constants.
(main): Emit warning for structure test 3 failure on Sun.
* Makefile.am (VPATH): Fixed VPATH def'n so automake won't
strip it out.
Moved distdir hack from libffi to automake.
(ffitest): Added missing -c for $(COMPILE) (change in automake).
* Makefile.in: Rebuilt.
Tue Oct 15 13:08:20 1996 Anthony Green <green@hoser.cygnus.com>
* Makefile.am: Added "make lint" production.
* Makefile.in: Rebuilt.
* prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro.
Clean up based on LCLint output. Added funny /*@...@*/ comments to
annotate source.
* ffitest.c, debug.c: Cleaned up code.
Mon Oct 14 12:26:56 1996 Anthony Green <green@rtl.cygnus.com>
* ffitest.c: Changes based on interface changes.
* prep_cif.c (ffi_prep_cif): Cleaned up interface based on
feedback from Jim Blandy.
Fri Oct 11 15:53:18 1996 Anthony Green <green@rtl.cygnus.com>
* ffitest.c: Reordered tests while porting to sparc.
Made changes to handle lame structure passing for sparc.
Removed calls to fflush().
* prep_cif.c (ffi_prep_cif): Added special case for sparc
aggregate type arguments.
Thu Oct 10 09:56:51 1996 Anthony Green <green@rtl.cygnus.com>
* ffitest.c (main): Added structure passing/returning tests.
* prep_cif.c (ffi_prep_cif): Perform proper initialization
of structure return types if needed.
(initialize_aggregate): Bug fix
Wed Oct 9 16:04:20 1996 Anthony Green <green@rtl.cygnus.com>
* types.c: Added special definitions for x86 (double doesn't
need double word alignment).
* ffitest.c: Added many tests
Tue Oct 8 09:19:22 1996 Anthony Green <green@rtl.cygnus.com>
* prep_cif.c (ffi_prep_cif): Fixed assertion.
* debug.c (ffi_assert): Must return a non void now.
* Makefile.am: Added test production.
* Makefile: Rebuilt.
* ffitest.c (main): Created.
* types.c: Created. Stripped common code out of */ffi.c.
* prep_cif.c: Added missing stdlib.h include.
* debug.c (ffi_type_test): Used "a" to eliminate compiler
warnings in non-debug builds. Included ffi_common.h.
Mon Oct 7 15:36:42 1996 Anthony Green <green@rtl.cygnus.com>
* Makefile.am: Added a rule for .s -> .o
This is required by the SGI compiler.
* Makefile: Rebuilt.
Fri Oct 4 09:51:08 1996 Anthony Green <green@hoser.cygnus.com>
* prep_cif.c (initialize_aggregate): Moved abi specification
to ffi_prep_cif().
Thu Oct 3 15:37:37 1996 Anthony Green <green@hoser.cygnus.com>
* prep_cif.c (ffi_prep_cif): Changed values from void* to void**.
(initialize_aggregate): Fixed aggregate type initialization.
* Makefile.am (EXTRA_DIST): Added support code for "make dist".
* Makefile.in: Regenerated.
Wed Oct 2 11:41:57 1996 Anthony Green <green@hoser.cygnus.com>
* debug.c, prep_cif: Created.
* Makefile.am: Added debug.o and prep_cif.o to OBJ.
* Makefile.in: Regenerated.
* Makefile.am (INCLUDES): Added missing -I../include
* Makefile.in: Regenerated.
Tue Oct 1 17:11:51 1996 Anthony Green <green@rtl.cygnus.com>
* error.c, Makefile.am: Created.
* Makefile.in: Generated.
--- libffi/src/x86 --------------------------------------------------------
Sun Oct 4 16:27:17 1998 Anthony Green <green@cygnus.com>
* sysv.S (retlongdouble): Fixed long long return value support.
* ffi.c (ffi_prep_cif_machdep): Ditto.
Wed May 13 04:30:33 1998 Anthony Green <green@raft.ppp.tsoft.net>
* ffi.c (ffi_prep_cif_machdep): Fixed long double return value
support.
Wed Apr 15 08:43:20 1998 Anthony Green <green@hoser.cygnus.com>
* ffi.c (ffi_prep_args): small struct support was missing.
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
* objects.mak: Removed.
Mon Dec 2 15:12:58 1996 Tom Tromey <tromey@cygnus.com>
* sysv.S: Use .balign, for a.out Linux boxes.
Tue Oct 15 13:06:50 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.c: Clean up based on LCLint output.
Added funny /*@...@*/ comments to annotate source.
Fri Oct 11 16:43:38 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c (ffi_call): Added assertion for bad ABIs.
Wed Oct 9 13:57:27 1996 Anthony Green <green@rtl.cygnus.com>
* sysv.S (retdouble): Fixed double return problems.
* ffi.c (ffi_call): Corrected fn arg definition.
(ffi_prep_cif_machdep): Fixed double return problems
Tue Oct 8 12:12:49 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c: Moved ffi_type definitions to types.c.
(ffi_prep_args): Fixed type promotion bug.
Mon Oct 7 15:53:06 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c (FFI_*_TYPEDEF): Removed redundant ';'
Fri Oct 4 09:54:53 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.c (ffi_call): Removed FFI_ABI arg, and swapped
remaining args.
Wed Oct 2 10:07:05 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.c, sysv.S, objects.mak: Created.
(ffi_prep_cif): cif->rvalue no longer initialized to NULL.
(ffi_prep_cif_machdep): Moved machine independent cif processing
to src/prep_cif.c. Introduced ffi_prep_cif_machdep().
--- libffi/src/mips -------------------------------------------------------
Tue Feb 17 17:18:07 1998 Anthony Green <green@hoser.cygnus.com>
* o32.S: Fixed typo in comment.
* ffi.c (ffi_prep_cif_machdep): Fixed argument processing.
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
* o32.s, n32.s: Wrappers for SGI tool support.
* objects.mak: Removed.
Tue Oct 29 14:37:45 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c (ffi_prep_args): Changed int z to size_t z.
Tue Oct 15 13:17:25 1996 Anthony Green <green@hoser.cygnus.com>
* n32.S: Fixed bad stack munging.
* ffi.c: Moved prototypes for ffi_call_?32() to here from
ffi_mips.h because extended_cif is not defined in ffi_mips.h.
Mon Oct 14 12:42:02 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c: Interface changes based on feedback from Jim Blandy.
Thu Oct 10 11:22:16 1996 Anthony Green <green@rtl.cygnus.com>
* n32.S, ffi.c: Lots of changes to support passing and
returning structures with the n32 calling convention.
* n32.S: Fixed fn pointer bug.
* ffi.c (ffi_prep_cif_machdep): Fix for o32 structure
return values.
(ffi_prep_args): Fixed n32 structure passing when structures
partially fit in registers.
Wed Oct 9 13:49:25 1996 Anthony Green <green@rtl.cygnus.com>
* objects.mak: Added n32.o.
* n32.S: Created.
* ffi.c (ffi_prep_args): Added magic to support proper
n32 processing.
Tue Oct 8 10:37:35 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c: Moved ffi_type definitions to types.c.
(ffi_prep_args): Fixed type promotion bug.
* o32.S: This code is only built for o32 compiles.
A lot of the #define cruft has moved to ffi_mips.h.
* ffi.c (ffi_prep_cif_machdep): Fixed arg flags. Second arg
is only processed if the first is either a float or double.
Mon Oct 7 15:33:59 1996 Anthony Green <green@rtl.cygnus.com>
* o32.S: Modified to compile under each of o32, n32 and n64.
* ffi.c (FFI_*_TYPEDEF): Removed redundant ';'
Fri Oct 4 09:53:25 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.c (ffi_call): Removed FFI_ABI arg, and swapped
remaining args.
Wed Oct 2 17:41:22 1996 Anthony Green <green@rtl.cygnus.com>
* o32.S: Removed crufty definitions.
Wed Oct 2 12:53:42 1996 Anthony Green <green@hoser.cygnus.com>
* ffi.c (ffi_prep_cif): cif->rvalue no longer initialized to NULL.
(ffi_prep_cif_machdep): Moved all machine independent cif processing
to src/prep_cif.c. Introduced ffi_prep_cif_machdep. Return types
of FFI_TYPE_STRUCT are no different than FFI_TYPE_INT.
Tue Oct 1 17:11:02 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c, o32.S, object.mak: Created
--- libffi/src/sparc ------------------------------------------------------
Tue Feb 24 16:33:18 1998 Anthony Green <green@hoser.cygnus.com>
* ffi.c (ffi_prep_args): Added long double support.
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
* objects.mak: Removed.
Thu May 1 16:07:56 1997 Anthony Green <green@hoser.cygnus.com>
* v8.S: Fixed minor portability problem reported by
Russ McManus <mcmanr@eq.gs.com>.
Tue Nov 26 14:12:43 1996 Anthony Green <green@csk3.cygnus.com>
* v8.S: Used STACKFRAME define elsewhere.
* ffi.c (ffi_prep_args): Zero out space when USING_PURIFY
is set.
(ffi_prep_cif_machdep): Allocate the correct stack frame
space for functions with < 6 args.
Tue Oct 29 15:08:55 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c (ffi_prep_args): int z is now size_t z.
Mon Oct 14 13:31:24 1996 Anthony Green <green@rtl.cygnus.com>
* v8.S (ffi_call_V8): Gordon rewrites this again. It looks
great now.
* ffi.c (ffi_call): The comment about hijacked registers
is no longer valid after gordoni hacked v8.S.
* v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler.
* v8.S, ffi.c: ffi_call() had changed to accept more than
two args, so v8.S had to change (because it hijacks incoming
arg registers).
* ffi.c: Interface changes based on feedback from Jim Blandy.
Thu Oct 10 17:48:16 1996 Anthony Green <green@rtl.cygnus.com>
* ffi.c, v8.S, objects.mak: Created.

View File

@ -1,4 +1,4 @@
libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others.
libffi - Copyright (c) 1996-2019 Anthony Green, Red Hat, Inc and others.
See source files for details.
Permission is hereby granted, free of charge, to any person obtaining

View File

@ -14,15 +14,14 @@ if BUILD_DOCS
SUBDIRS += doc
endif
EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj \
ChangeLog.libffi ChangeLog.libffi-3.1 \
EXTRA_DIST = LICENSE ChangeLog.old \
m4/libtool.m4 m4/lt~obsolete.m4 \
m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
m4/ltversion.m4 src/debug.c msvcc.sh \
generate-darwin-source-and-headers.py \
libffi.xcodeproj/project.pbxproj \
libtool-ldflags libtool-version configure.host README.md \
libffi.map.in
libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl
# local.exp is generated by configure
DISTCLEANFILES = local.exp
@ -77,41 +76,32 @@ noinst_HEADERS = \
src/xtensa/ffitarget.h \
src/dlmalloc.c
EXTRA_libffi_la_SOURCES = \
src/aarch64/ffi.c src/aarch64/sysv.S \
src/alpha/ffi.c src/alpha/osf.S \
src/arc/ffi.c src/arc/arcompact.S \
src/arm/ffi.c src/arm/sysv.S \
src/avr32/ffi.c src/avr32/sysv.S \
src/bfin/ffi.c src/bfin/sysv.S \
src/cris/ffi.c src/cris/sysv.S \
src/frv/ffi.c src/frv/eabi.S \
src/ia64/ffi.c src/ia64/unix.S \
src/m32r/ffi.c src/m32r/sysv.S \
src/m68k/ffi.c src/m68k/sysv.S \
src/m88k/ffi.c src/m88k/obsd.S \
src/metag/ffi.c src/metag/sysv.S \
src/microblaze/ffi.c src/microblaze/sysv.S \
src/mips/ffi.c src/mips/o32.S src/mips/n32.S \
src/moxie/ffi.c src/moxie/eabi.S \
src/nios2/ffi.c src/nios2/sysv.S \
src/or1k/ffi.c src/or1k/sysv.S \
src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \
src/powerpc/sysv.S src/powerpc/linux64.S \
src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \
src/powerpc/aix.S src/powerpc/darwin.S src/powerpc/aix_closure.S \
src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
src/riscv/ffi.c src/riscv/sysv.S \
src/s390/ffi.c src/s390/sysv.S \
src/sh/ffi.c src/sh/sysv.S \
src/sh64/ffi.c src/sh64/sysv.S \
src/sparc/ffi.c src/sparc/ffi64.c src/sparc/v8.S src/sparc/v9.S \
src/tile/ffi.c src/tile/tile.S \
src/vax/ffi.c src/vax/elfbsd.S \
src/x86/ffi.c src/x86/sysv.S \
src/x86/ffiw64.c src/x86/win64.S \
src/x86/ffi64.c src/x86/unix64.S \
EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \
src/aarch64/win64_armasm.S src/alpha/ffi.c src/alpha/osf.S \
src/arc/ffi.c src/arc/arcompact.S src/arm/ffi.c \
src/arm/sysv.S src/arm/ffi.c src/arm/sysv_msvc_arm32.S \
src/avr32/ffi.c src/avr32/sysv.S src/bfin/ffi.c \
src/bfin/sysv.S src/cris/ffi.c src/cris/sysv.S src/frv/ffi.c \
src/frv/eabi.S src/ia64/ffi.c src/ia64/unix.S src/m32r/ffi.c \
src/m32r/sysv.S src/m68k/ffi.c src/m68k/sysv.S src/m88k/ffi.c \
src/m88k/obsd.S src/metag/ffi.c src/metag/sysv.S \
src/microblaze/ffi.c src/microblaze/sysv.S src/mips/ffi.c \
src/mips/o32.S src/mips/n32.S src/moxie/ffi.c \
src/moxie/eabi.S src/nios2/ffi.c src/nios2/sysv.S \
src/or1k/ffi.c src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S \
src/pa/hpux32.S src/powerpc/ffi.c src/powerpc/ffi_sysv.c \
src/powerpc/ffi_linux64.c src/powerpc/sysv.S \
src/powerpc/linux64.S src/powerpc/linux64_closure.S \
src/powerpc/ppc_closure.S src/powerpc/aix.S \
src/powerpc/darwin.S src/powerpc/aix_closure.S \
src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
src/riscv/ffi.c src/riscv/sysv.S src/s390/ffi.c \
src/s390/sysv.S src/sh/ffi.c src/sh/sysv.S src/sh64/ffi.c \
src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \
src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \
src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \
src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \
src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \
src/xtensa/ffi.c src/xtensa/sysv.S
TARGET_OBJ = @TARGET_OBJ@
@ -140,9 +130,9 @@ endif
if LIBFFI_BUILD_VERSIONED_SHLIB_SUN
libffi_version_script = -Wl,-M,libffi.map-sun
libffi_version_dep = libffi.map-sun
libffi.map-sun : libffi.map $(top_srcdir)/../contrib/make_sunver.pl \
libffi.map-sun : libffi.map $(top_srcdir)/make_sunver.pl \
$(libffi_la_OBJECTS) $(libffi_la_LIBADD)
perl $(top_srcdir)/../contrib/make_sunver.pl libffi.map \
perl $(top_srcdir)/make_sunver.pl libffi.map \
`echo $(libffi_la_OBJECTS) $(libffi_la_LIBADD) | \
sed 's,\([^/ ]*\)\.l\([ao]\),.libs/\1.\2,g'` \
> $@ || (rm -f $@ ; exit 1)
@ -163,4 +153,7 @@ AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS)
dist-hook:
d=`(cd $(distdir); pwd)`; (cd doc; make pdf; cp *.pdf $$d/doc)
if [ -d $(top_srcdir)/.git ] ; then (cd $(top_srcdir); git log --no-decorate) ; else echo 'See git log for history.' ; fi > $(distdir)/ChangeLog
s=`awk '/was released on/{ print NR; exit}' $(top_srcdir)/README.md`; tail -n +$$(($$s-1)) $(top_srcdir)/README.md > $(distdir)/README.md

View File

@ -4,7 +4,7 @@ Status
[![Build Status](https://travis-ci.org/libffi/libffi.svg?branch=master)](https://travis-ci.org/libffi/libffi)
[![Build status](https://ci.appveyor.com/api/projects/status/8lko9vagbx4w2kxq?svg=true)](https://ci.appveyor.com/project/atgreen/libffi)
libffi-3.3-rc0 was released on April 2, 2018. Check the libffi web
libffi-3.3 was released on November 23, 2019. Check the libffi web
page for updates: <URL:http://sourceware.org/libffi/>.
@ -51,11 +51,13 @@ tested:
| --------------- | ---------------- | ----------------------- |
| AArch64 (ARM64) | iOS | Clang |
| AArch64 | Linux | GCC |
| AArch64 | Windows | MSVC |
| Alpha | Linux | GCC |
| Alpha | Tru64 | GCC |
| ARC | Linux | GCC |
| ARM | Linux | GCC |
| ARM | iOS | GCC |
| ARM | Windows | MSVC |
| AVR32 | Linux | GCC |
| Blackfin | uClinux | GCC |
| HPPA | HPUX | GCC |
@ -152,7 +154,7 @@ It's also possible to build libffi on Windows platforms with
Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
wrapper script during configuration like so:
path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP"
path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL"
For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
``CXX="path/to/msvcc.sh -m64"``. You may also need to specify
@ -161,13 +163,18 @@ For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
It is also possible to build libffi on Windows platforms with the LLVM
project's clang-cl compiler, like below:
path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
When building with MSVC under a MingW environment, you may need to
remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
command. ('cygpath' is not present in MingW, and is not required when
using MingW-style paths.)
To build static library for ARM64 with MSVC using visual studio solution, msvc_build folder have
aarch64/Ffi_staticLib.sln
required header files in aarch64/aarch64_include/
SPARC Solaris builds require the use of the GNU assembler and linker.
Point ``AS`` and ``LD`` environment variables at those tool prior to
configuration.
@ -190,13 +197,18 @@ History
See the git log for details at http://github.com/libffi/libffi.
3.3 TBD
3.3 Nov-23-19
Add RISC-V support.
New API in support of GO closures.
Add IEEE754 binary128 long double support for 64-bit Power
Default to Microsoft's 64 bit long double ABI with Visual C++.
GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
Many new tests cases and bug fixes.
GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
Add Windows on ARM64 (WOA) support.
Add Windows 32-bit ARM support.
Raw java (gcj) API deprecated.
Add pre-built PDF documentation to source distribution.
Many new tests cases and bug fixes.
3.2.1 Nov-12-14
Build fix for non-iOS AArch64 targets.
@ -412,7 +424,9 @@ developers:
aarch64 Marcus Shawcroft, James Greenhalgh
alpha Richard Henderson
arc Hackers at Synopsis
arm Raffaele Sena
avr32 Bradley Smith
blackfin Alexandre Keunecke I. de Mendonca
cris Simon Posnjak, Hans-Peter Nilsson
frv Anthony Green
@ -420,6 +434,7 @@ developers:
m32r Kazuhiro Inaoka
m68k Andreas Schwab
m88k Miod Vallat
metag Hackers at Imagination Technologies
microblaze Nathan Rossi
mips Anthony Green, Casey Marshall
mips64 David Daney
@ -430,6 +445,7 @@ developers:
powerpc Geoffrey Keating, Andreas Tobler,
David Edelsohn, John Hornkvist
powerpc64 Jakub Jelinek
riscv Michael Knyszek, Andrew Waterman, Stef O'Rear
s390 Gerhard Tonn, Ulrich Weigand
sh Kaz Kojima
sh64 Kaz Kojima

View File

@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
AC_PREREQ(2.68)
AC_INIT([libffi], [3.3-rc0], [http://github.com/libffi/libffi/issues])
AC_INIT([libffi], [3.3], [http://github.com/libffi/libffi/issues])
AC_CONFIG_HEADERS([fficonfig.h])
AC_CANONICAL_SYSTEM
@ -270,7 +270,7 @@ if test "x$GCC" = "xyes"; then
echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c
libffi_cv_hidden_visibility_attribute=no
if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
if grep '\.hidden.*foo' conftest.s >/dev/null; then
if egrep '(\.hidden|\.private_extern).*foo' conftest.s >/dev/null; then
libffi_cv_hidden_visibility_attribute=yes
fi
fi
@ -292,7 +292,11 @@ AM_CONDITIONAL(BUILD_DOCS, [test x$enable_docs = xyes])
AH_BOTTOM([
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
#ifdef LIBFFI_ASM
#ifdef __APPLE__
#define FFI_HIDDEN(name) .private_extern name
#else
#define FFI_HIDDEN(name) .hidden name
#endif
#else
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
#endif

View File

@ -6,6 +6,11 @@
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
# Most of the time we can define all the variables all at once...
case "${host}" in
aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
TARGET=ARM_WIN64; TARGETDIR=aarch64
MSVC=1
;;
aarch64*-*-*)
TARGET=AARCH64; TARGETDIR=aarch64
SOURCES="ffi.c sysv.S"
@ -23,6 +28,11 @@ case "${host}" in
SOURCES="ffi.c arcompact.S"
;;
arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
TARGET=ARM_WIN32; TARGETDIR=arm
MSVC=1
;;
arm*-*-*)
TARGET=ARM; TARGETDIR=arm
SOURCES="ffi.c sysv.S"
@ -64,7 +74,7 @@ case "${host}" in
TARGET=X86_FREEBSD; TARGETDIR=x86
;;
i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix* \
i?86-*-cygwin* | i?86-*-mingw* | i?86-*-win* | i?86-*-os2* | i?86-*-interix* \
| x86_64-*-cygwin* | x86_64-*-mingw* | x86_64-*-win* )
TARGETDIR=x86
if test $ac_cv_sizeof_size_t = 4; then
@ -74,12 +84,6 @@ case "${host}" in
fi
if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
MSVC=1
if test $ac_cv_sizeof_size_t = 4; then
# libffi does not support microsoft tools for 32-bit windows
# hosts. Try porting src/x86/sysv.S to intel assembly
# format.
UNSUPPORTED=1
fi
fi
# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
# We must also check with_cross_host to decide if this is a native
@ -174,7 +178,7 @@ case "${host}" in
SOURCES="ffi.c sysv.S"
;;
or1k*-linux*)
or1k*-*-*)
TARGET=OR1K; TARGETDIR=or1k
SOURCES="ffi.c sysv.S"
;;
@ -248,6 +252,12 @@ esac
# ... but some of the cases above share configury.
case "${TARGET}" in
ARM_WIN32)
SOURCES="ffi.c sysv_msvc_arm32.S"
;;
ARM_WIN64)
SOURCES="ffi.c win64_armasm.S"
;;
MIPS)
SOURCES="ffi.c o32.S n32.S"
;;
@ -265,7 +275,11 @@ case "${TARGET}" in
SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S"
;;
X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
SOURCES="ffi.c sysv.S"
if test "$MSVC" = 1; then
SOURCES="ffi.c sysv_intel.S"
else
SOURCES="ffi.c sysv.S"
fi
;;
X86_64)
if test x"$TARGET_X32" = xyes; then

View File

@ -52,11 +52,13 @@ extern "C" {
/* TODO: Add arm64_32 and armv7k support to support watchOS unconditionally */
#ifdef __LP64__
#define FFI_AVAILABLE_APPLE API_AVAILABLE(macos(10.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0), watchos(6.0))
#define FFI_AVAILABLE_APPLE_2019 API_AVAILABLE(macos(10.15)) SPI_AVAILABLE(ios(13.0), tvos(13.0), watchos(6.0))
#define FFI_AVAILABLE_APPLE API_AVAILABLE(macos(10.0), iosmac(13.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0), watchos(6.0))
#define FFI_AVAILABLE_APPLE_2019 API_AVAILABLE(macos(10.15), iosmac(13.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0), watchos(6.0))
#define FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 API_DEPRECATED("Deprecated", macos(10.15, 10.16), iosmac(13.0, 14.0)) SPI_DEPRECATED("Deprecated", ios(13.0, 14.0), tvos(13.0, 14.0), watchos(6.0, 7.0))
#else
#define FFI_AVAILABLE_APPLE API_AVAILABLE(macos(10.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
#define FFI_AVAILABLE_APPLE_2019 API_AVAILABLE(macos(10.15)) SPI_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
#define FFI_AVAILABLE_APPLE API_AVAILABLE(macos(10.0), iosmac(13.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
#define FFI_AVAILABLE_APPLE_2019 API_AVAILABLE(macos(10.15), iosmac(13.0)) SPI_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
#define FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 API_DEPRECATED("Deprecated", macos(10.15, 10.16), iosmac(13.0, 14.0)) SPI_DEPRECATED("Deprecated", ios(13.0, 14.0), tvos(13.0, 14.0)) API_UNAVAILABLE(watchos)
#endif
/* ---- System configuration information --------------------------------- */
@ -290,18 +292,18 @@ FFI_AVAILABLE_APPLE_2019 FFI_API size_t ffi_raw_size (ffi_cif *cif);
and doubles are followed by an empty 64-bit word. */
#if !FFI_NATIVE_RAW_API
FFI_AVAILABLE_APPLE_2019 FFI_API
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_java_raw *avalue);
#endif
FFI_AVAILABLE_APPLE_2019 FFI_API
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
FFI_AVAILABLE_APPLE_2019 FFI_API
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
FFI_AVAILABLE_APPLE_2019 FFI_API
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API
size_t ffi_java_raw_size (ffi_cif *cif);
/* ---- Definitions for closures ----------------------------------------- */
@ -357,8 +359,10 @@ ffi_prep_closure_loc (ffi_closure*,
void *user_data,
void*codeloc);
#if defined(__x86_64__) || defined(__arm64__)
FFI_AVAILABLE_APPLE_2019
ffi_closure * ffi_find_closure_for_code_np(void *code);
#endif
#ifdef __sgi
# pragma pack 8
@ -428,13 +432,13 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
void *codeloc);
#if !FFI_NATIVE_RAW_API
FFI_AVAILABLE_APPLE_2019 FFI_API ffi_status
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API ffi_status
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data);
FFI_AVAILABLE_APPLE_2019 FFI_API ffi_status
FFI_AVAILABLE_APPLE_2019_DEPRECATED_2020 FFI_API ffi_status
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
@ -444,7 +448,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
#endif /* FFI_CLOSURES */
#if FFI_GO_CLOSURES
#if defined(FFI_GO_CLOSURES) && FFI_GO_CLOSURES
typedef struct {
void *tramp;

View File

@ -51,13 +51,7 @@ typedef enum ffi_abi
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
// If the Python framework is going to link to this library,
// it needs the legacy closure api.
#if defined(DARLING)
#define FFI_LEGACY_CLOSURE_API 1
#else
#define FFI_LEGACY_CLOSURE_API 0
#endif
#define FFI_NATIVE_RAW_API 0
#if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE

View File

@ -1,7 +1,8 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename libffi.info
@settitle libffi
@include version.texi
@settitle libffi: the portable foreign function interface library
@setchapternewpage off
@c %**end of header
@ -12,32 +13,43 @@
@syncodeindex pg cp
@syncodeindex tp cp
@include version.texi
@copying
This manual is for Libffi, a portable foreign-function interface
This manual is for libffi, a portable foreign function interface
library.
Copyright @copyright{} 2008, 2010, 2011 Red Hat, Inc.
Copyright @copyright{} 2008--2019 Anthony Green and Red Hat, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version. A copy of the license is included in the
section entitled ``GNU General Public License''.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@end quotation
@end copying
@dircategory Development
@direntry
* libffi: (libffi). Portable foreign-function interface library.
* libffi: (libffi). Portable foreign function interface library.
@end direntry
@titlepage
@title Libffi
@title libffi: a foreign function interface library
@subtitle For Version @value{VERSION} of libffi
@author Anthony Green
@page
@vskip 0pt plus 1filll
@insertcopying

View File

@ -1,4 +1,4 @@
@set UPDATED 2 April 2018
@set UPDATED-MONTH April 2018
@set EDITION 3.3-rc0
@set VERSION 3.3-rc0
@set UPDATED 22 November 2019
@set UPDATED-MONTH November 2019
@set EDITION 3.3
@set VERSION 3.3

View File

@ -1,5 +1,5 @@
/* -----------------------------------------------------------------*-C-*-
libffi @VERSION@ - Copyright (c) 2011, 2014 Anthony Green
libffi @VERSION@ - Copyright (c) 2011, 2014, 2019 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person
@ -288,15 +288,15 @@ FFI_API
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_java_raw *avalue);
ffi_java_raw *avalue) __attribute__((deprecated));
#endif
FFI_API
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
FFI_API
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) __attribute__((deprecated));
FFI_API
size_t ffi_java_raw_size (ffi_cif *cif);
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
/* ---- Definitions for closures ----------------------------------------- */
@ -421,19 +421,19 @@ FFI_API ffi_status
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data);
void *user_data) __attribute__((deprecated));
FFI_API ffi_status
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc);
void *codeloc) __attribute__((deprecated));
#endif
#endif /* FFI_CLOSURES */
#if FFI_GO_CLOSURES
#if defined(FFI_GO_CLOSURES) && FFI_GO_CLOSURES
typedef struct {
void *tramp;

View File

@ -77,7 +77,7 @@ void ffi_type_test(ffi_type *a, char *file, int line);
/* v cast to size_t and aligned up to a multiple of a */
#define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
/* v cast to size_t and aligned down to a multiple of a */
#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
#define FFI_ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
/* Perform machine dependent cif processing */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
@ -99,6 +99,10 @@ ffi_status ffi_prep_cif_core(ffi_cif *cif,
ffi_type *rtype,
ffi_type **atypes);
/* Translate a data pointer to a code pointer. Needed for closures on
some targets. */
void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
/* Extended cif, used in callback from assembly routine */
typedef struct
{

View File

@ -71,7 +71,7 @@ LIBFFI_CLOSURE_7.0 {
} LIBFFI_BASE_7.0;
#endif
#if FFI_GO_CLOSURES
#if defined(FFI_GO_CLOSURES) && FFI_GO_CLOSURES
LIBFFI_GO_CLOSURE_7.0 {
global:
ffi_call_go;

View File

@ -2,7 +2,7 @@ AC_DEFUN([GCC_AS_CFI_PSEUDO_OP],
[AC_CACHE_CHECK([assembler .cfi pseudo-op support],
gcc_cv_as_cfi_pseudo_op, [
gcc_cv_as_cfi_pseudo_op=unknown
AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
AC_TRY_COMPILE([asm (".cfi_sections\n\t.cfi_startproc\n\t.cfi_endproc");],,
[gcc_cv_as_cfi_pseudo_op=yes],
[gcc_cv_as_cfi_pseudo_op=no])
])

View File

@ -23,33 +23,12 @@
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
#serial 8
AC_DEFUN([AX_APPEND_FLAG],
[dnl

View File

@ -29,33 +29,12 @@
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 5
#serial 6
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF

View File

@ -44,7 +44,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 16
#serial 17
AC_DEFUN([AX_COMPILER_VENDOR],
[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
@ -56,6 +56,7 @@ AC_DEFUN([AX_COMPILER_VENDOR],
clang: __clang__
cray: _CRAYC
fujitsu: __FUJITSU
sdcc: SDCC, __SDCC
gnu: __GNUC__
sun: __SUNPRO_C,__SUNPRO_CC
hp: __HP_cc,__HP_aCC

View File

@ -31,33 +31,12 @@
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 13
#serial 14
AC_DEFUN([AX_CONFIGURE_ARGS],[
# [$]@ is unusable in 2.60+ but earlier autoconf had no ac_configure_args

View File

@ -37,7 +37,7 @@
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2014 Tsukasa Oi
# Copyright (c) 2017 Alexey Kopytov
# Copyright (c) 2017-2018 Alexey Kopytov
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -65,7 +65,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 20
#serial 22
AC_DEFUN([AX_GCC_ARCHFLAG],
[AC_REQUIRE([AC_PROG_CC])
@ -108,7 +108,7 @@ case $host_cpu in
*2?6[[ad]]?:*:*:*) ax_gcc_arch="sandybridge corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*3?6[[ae]]?:*:*:*) ax_gcc_arch="ivybridge core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*3?6[[cf]]?:*:*:*|*4?6[[56]]?:*:*:*) ax_gcc_arch="haswell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*3?6d?:*:*:*) ax_gcc_arch="broadwell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*3?6d?:*:*:*|*4?6[[7f]]?:*:*:*|*5?66?:*:*:*) ax_gcc_arch="broadwell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*1?6c?:*:*:*|*2?6[[67]]?:*:*:*|*3?6[[56]]?:*:*:*) ax_gcc_arch="bonnell atom core2 pentium-m pentium3 pentiumpro" ;;
*3?67?:*:*:*|*[[45]]?6[[ad]]?:*:*:*) ax_gcc_arch="silvermont atom core2 pentium-m pentium3 pentiumpro" ;;
*000?f[[012]]?:*:*:*|?f[[012]]?:*:*:*|f[[012]]?:*:*:*) ax_gcc_arch="pentium4 pentiumpro" ;;
@ -198,6 +198,10 @@ case $host_cpu in
*POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
*POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
603ev|8240) ax_gcc_arch="$cputype 603e 603";;
*POWER7*) ax_gcc_arch="power7";;
*POWER8*) ax_gcc_arch="power8";;
*POWER9*) ax_gcc_arch="power9";;
*POWER10*) ax_gcc_arch="power10";;
*) ax_gcc_arch=$cputype ;;
esac
ax_gcc_arch="$ax_gcc_arch powerpc"

View File

@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28302.56
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ffi_staticLib_arm64", "Ffi_staticLib.vcxproj", "{115502C0-BE05-4767-BF19-5C87D805FAD6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|ARM64.ActiveCfg = Debug|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|ARM64.Build.0 = Debug|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|x64.ActiveCfg = Debug|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|x86.ActiveCfg = Debug|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|ARM64.ActiveCfg = Release|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|ARM64.Build.0 = Release|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|x64.ActiveCfg = Release|ARM64
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|x86.ActiveCfg = Release|ARM64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {241C54C7-20DD-4897-9376-E6B6D1B43BD5}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{115502C0-BE05-4767-BF19-5C87D805FAD6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>FfistaticLib</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<ProjectName>Ffi_staticLib_arm64</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>FFI_BUILDING_DLL;_DEBUG;_LIB;USE_DL_PREFIX;ARM64;_M_ARM64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include;.\aarch64_include;..\..\src\aarch64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<BrowseInformation>true</BrowseInformation>
<OmitFramePointers>
</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>FFI_BUILDING_DLL;USE_DL_PREFIX;ARM64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\include;.\aarch64_include;..\..\src\aarch64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OmitFramePointers>true</OmitFramePointers>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalUsingDirectories>..\..\src;..\..\src\aarch64;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include=".\aarch64_include\ffi.h" />
<ClInclude Include=".\aarch64_include\fficonfig.h" />
<ClInclude Include="..\..\src\aarch64\ffitarget.h" />
<ClInclude Include="..\include\ffi_cfi.h" />
<ClInclude Include="..\include\ffi_common.h" />
<ClInclude Include="..\..\src\aarch64\internal.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\closures.c" />
<ClCompile Include="..\..\src\dlmalloc.c" />
<ClCompile Include="..\..\src\aarch64\ffi.c" />
<ClCompile Include="..\..\src\prep_cif.c" />
<ClCompile Include="..\..\src\types.c" />
</ItemGroup>
<!--ItemGroup>
<Object Include="..\..\..\..\Downloads\libffi-master-win64\src\aarch64\win64_armasm.obj" />
</ItemGroup-->
<ItemGroup>
<CustomBuild Include="..\..\src\aarch64\win64_armasm.S">
<!--ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild -->
<Command>
cl /FA /EP /nologo /I"..\..\include" /I".\aarch64_include" /I"..\..\src\aarch64" "%(FullPath)" &gt; $(IntDir)win64_armasm.i
armasm64 $(IntDir)win64_armasm.i /I"src\" /I"..\..\include" /I"..\..\src\aarch64" -o "$(IntDir)win64_armasm.obj"
</Command>
<Outputs>win64_armasm.obj;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\ffi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\ffi_cfi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\ffi_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\fficonfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\ffitarget.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\internal.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\closures.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\dlmalloc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ffi.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\prep_cif.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\types.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\win64_armasm.S" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -0,0 +1,511 @@
/* -----------------------------------------------------------------*-C-*-
libffi 3.3-rc0 - Copyright (c) 2011, 2014 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the ``Software''), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
/* -------------------------------------------------------------------
Most of the API is documented in doc/libffi.texi.
The raw API is designed to bypass some of the argument packing and
unpacking on architectures for which it can be avoided. Routines
are provided to emulate the raw API if the underlying platform
doesn't allow faster implementation.
More details on the raw API can be found in:
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
and
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
-------------------------------------------------------------------- */
#ifndef LIBFFI_H
#define LIBFFI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Specify which architecture libffi is configured for. */
#ifndef AARCH64
#define AARCH64
#endif
/* ---- System configuration information --------------------------------- */
#include <ffitarget.h>
#ifndef LIBFFI_ASM
#if defined(_MSC_VER) && !defined(__clang__)
#define __attribute__(X)
#endif
#include <stddef.h>
#include <limits.h>
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
But we can find it either under the correct ANSI name, or under GNU
C's internal name. */
#define FFI_64_BIT_MAX 9223372036854775807
#ifdef LONG_LONG_MAX
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
#else
# ifdef LLONG_MAX
# define FFI_LONG_LONG_MAX LLONG_MAX
# ifdef _AIX52 /* or newer has C99 LLONG_MAX */
# undef FFI_64_BIT_MAX
# define FFI_64_BIT_MAX 9223372036854775807LL
# endif /* _AIX52 or newer */
# else
# ifdef __GNUC__
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
# endif
# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */
# ifndef __PPC64__
# if defined (__IBMC__) || defined (__IBMCPP__)
# define FFI_LONG_LONG_MAX LONGLONG_MAX
# endif
# endif /* __PPC64__ */
# undef FFI_64_BIT_MAX
# define FFI_64_BIT_MAX 9223372036854775807LL
# endif
# endif
#endif
/* The closure code assumes that this works on pointers, i.e. a size_t
can hold a pointer. */
typedef struct _ffi_type
{
size_t size;
unsigned short alignment;
unsigned short type;
struct _ffi_type **elements;
} ffi_type;
/* Need minimal decorations for DLLs to work on Windows. GCC has
autoimport and autoexport. Always mark externally visible symbols
as dllimport for MSVC clients, even if it means an extra indirection
when using the static version of the library.
Besides, as a workaround, they can define FFI_BUILDING if they
*know* they are going to link with the static library. */
#if defined _MSC_VER
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
# define FFI_API __declspec(dllexport)
# elif !defined FFI_BUILDING /* Importing libffi.DLL */
# define FFI_API __declspec(dllimport)
# else /* Building/linking static library */
# define FFI_API
# endif
#else
# define FFI_API
#endif
/* The externally visible type declarations also need the MSVC DLL
decorations, or they will not be exported from the object file. */
#if defined LIBFFI_HIDE_BASIC_TYPES
# define FFI_EXTERN FFI_API
#else
# define FFI_EXTERN extern FFI_API
#endif
#ifndef LIBFFI_HIDE_BASIC_TYPES
#if SCHAR_MAX == 127
# define ffi_type_uchar ffi_type_uint8
# define ffi_type_schar ffi_type_sint8
#else
#error "char size not supported"
#endif
#if SHRT_MAX == 32767
# define ffi_type_ushort ffi_type_uint16
# define ffi_type_sshort ffi_type_sint16
#elif SHRT_MAX == 2147483647
# define ffi_type_ushort ffi_type_uint32
# define ffi_type_sshort ffi_type_sint32
#else
#error "short size not supported"
#endif
#if INT_MAX == 32767
# define ffi_type_uint ffi_type_uint16
# define ffi_type_sint ffi_type_sint16
#elif INT_MAX == 2147483647
# define ffi_type_uint ffi_type_uint32
# define ffi_type_sint ffi_type_sint32
#elif INT_MAX == 9223372036854775807
# define ffi_type_uint ffi_type_uint64
# define ffi_type_sint ffi_type_sint64
#else
#error "int size not supported"
#endif
#if LONG_MAX == 2147483647
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
#error "no 64-bit data type supported"
# endif
#elif LONG_MAX != FFI_64_BIT_MAX
#error "long size not supported"
#endif
#if LONG_MAX == 2147483647
# define ffi_type_ulong ffi_type_uint32
# define ffi_type_slong ffi_type_sint32
#elif LONG_MAX == FFI_64_BIT_MAX
# define ffi_type_ulong ffi_type_uint64
# define ffi_type_slong ffi_type_sint64
#else
#error "long size not supported"
#endif
/* These are defined in types.c. */
FFI_EXTERN ffi_type ffi_type_void;
FFI_EXTERN ffi_type ffi_type_uint8;
FFI_EXTERN ffi_type ffi_type_sint8;
FFI_EXTERN ffi_type ffi_type_uint16;
FFI_EXTERN ffi_type ffi_type_sint16;
FFI_EXTERN ffi_type ffi_type_uint32;
FFI_EXTERN ffi_type ffi_type_sint32;
FFI_EXTERN ffi_type ffi_type_uint64;
FFI_EXTERN ffi_type ffi_type_sint64;
FFI_EXTERN ffi_type ffi_type_float;
FFI_EXTERN ffi_type ffi_type_double;
FFI_EXTERN ffi_type ffi_type_pointer;
#ifndef _M_ARM64
FFI_EXTERN ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
#endif
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
FFI_EXTERN ffi_type ffi_type_complex_float;
FFI_EXTERN ffi_type ffi_type_complex_double;
#if 1
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
#else
#define ffi_type_complex_longdouble ffi_type_complex_double
#endif
#endif
#endif /* LIBFFI_HIDE_BASIC_TYPES */
typedef enum {
FFI_OK = 0,
FFI_BAD_TYPEDEF,
FFI_BAD_ABI
} ffi_status;
typedef struct {
ffi_abi abi;
unsigned nargs;
ffi_type **arg_types;
ffi_type *rtype;
unsigned bytes;
unsigned flags;
#ifdef FFI_EXTRA_CIF_FIELDS
FFI_EXTRA_CIF_FIELDS;
#endif
} ffi_cif;
/* ---- Definitions for the raw API -------------------------------------- */
#ifndef FFI_SIZEOF_ARG
# if LONG_MAX == 2147483647
# define FFI_SIZEOF_ARG 4
# elif LONG_MAX == FFI_64_BIT_MAX
# define FFI_SIZEOF_ARG 8
# endif
#endif
#ifndef FFI_SIZEOF_JAVA_RAW
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
#endif
typedef union {
ffi_sarg sint;
ffi_arg uint;
float flt;
char data[FFI_SIZEOF_ARG];
void* ptr;
} ffi_raw;
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
/* This is a special case for mips64/n32 ABI (and perhaps others) where
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
typedef union {
signed int sint;
unsigned int uint;
float flt;
char data[FFI_SIZEOF_JAVA_RAW];
void* ptr;
} ffi_java_raw;
#else
typedef ffi_raw ffi_java_raw;
#endif
FFI_API
void ffi_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_raw *avalue);
FFI_API void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
FFI_API void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
FFI_API size_t ffi_raw_size (ffi_cif *cif);
/* This is analogous to the raw API, except it uses Java parameter
packing, even on 64-bit machines. I.e. on 64-bit machines longs
and doubles are followed by an empty 64-bit word. */
FFI_API
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_java_raw *avalue);
FFI_API
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
FFI_API
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
FFI_API
size_t ffi_java_raw_size (ffi_cif *cif);
/* ---- Definitions for closures ----------------------------------------- */
#if FFI_CLOSURES
#ifdef _MSC_VER
__declspec(align(8))
#endif
typedef struct {
#if 0
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
void *user_data;
} ffi_closure
#ifdef __GNUC__
__attribute__((aligned (8)))
#endif
;
#ifndef __GNUC__
# ifdef __sgi
# pragma pack 0
# endif
#endif
FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *);
FFI_API ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data)
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 405)
__attribute__((deprecated ("use ffi_prep_closure_loc instead")))
#elif defined(__GNUC__) && __GNUC__ >= 3
__attribute__((deprecated))
#endif
;
FFI_API ffi_status
ffi_prep_closure_loc (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void*codeloc);
#ifdef __sgi
# pragma pack 8
#endif
typedef struct {
#if 0
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
#endif
ffi_cif *cif;
#if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
#endif
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
void *user_data;
} ffi_raw_closure;
typedef struct {
#if 0
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
#endif
ffi_cif *cif;
#if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the translation, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
#endif
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
void *user_data;
} ffi_java_raw_closure;
FFI_API ffi_status
ffi_prep_raw_closure (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data);
FFI_API ffi_status
ffi_prep_raw_closure_loc (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data,
void *codeloc);
FFI_API ffi_status
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data);
FFI_API ffi_status
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc);
#endif /* FFI_CLOSURES */
#if defined(FFI_GO_CLOSURES) && FFI_GO_CLOSURES
typedef struct {
void *tramp;
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
} ffi_go_closure;
FFI_API ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*));
FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
void **avalue, void *closure);
#endif /* FFI_GO_CLOSURES */
/* ---- Public interface definition -------------------------------------- */
FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
ffi_type *rtype,
ffi_type **atypes);
FFI_API
ffi_status ffi_prep_cif_var(ffi_cif *cif,
ffi_abi abi,
unsigned int nfixedargs,
unsigned int ntotalargs,
ffi_type *rtype,
ffi_type **atypes);
FFI_API
void ffi_call(ffi_cif *cif,
void (*fn)(void),
void *rvalue,
void **avalue);
FFI_API
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
size_t *offsets);
/* Useful for eliminating compiler warnings. */
#define FFI_FN(f) ((void (*)(void))f)
/* ---- Definitions shared with assembly code ---------------------------- */
#endif
/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#ifndef _M_ARM64
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15
/* This should always refer to the last type code (for sanity checks). */
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,219 @@
/* fficonfig.h. Generated from fficonfig.h.in by configure. */
/* fficonfig.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define to the flags needed for the .section .eh_frame directive. */
#define EH_FRAME_FLAGS "a"
/* Define this if you want extra debugging. */
/* #undef FFI_DEBUG */
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
/* #undef FFI_EXEC_TRAMPOLINE_TABLE */
/* Define this if you want to enable pax emulated trampolines */
/* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */
/* Cannot use malloc on this target, so, we revert to alternative means */
/* #undef FFI_MMAP_EXEC_WRIT */
/* Define this if you do not want support for the raw API. */
/* #undef FFI_NO_RAW_API */
/* Define this if you do not want support for aggregate types. */
/* #undef FFI_NO_STRUCTS */
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/*#define HAVE_ALLOCA_H 1 */
/* Define if your assembler supports .cfi_* directives. */
#define HAVE_AS_CFI_PSEUDO_OP 1
/* Define if your assembler supports .register. */
/* #undef HAVE_AS_REGISTER_PSEUDO_OP */
/* Define if the compiler uses zarch features. */
/* #undef HAVE_AS_S390_ZARCH */
/* Define if your assembler and linker support unaligned PC relative relocs.
*/
/* #undef HAVE_AS_SPARC_UA_PCREL */
/* Define if your assembler supports unwind section type. */
/* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */
/* Define if your assembler supports PC relative relocs. */
/* #undef HAVE_AS_X86_PCREL */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define if __attribute__((visibility("hidden"))) is supported. */
#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have the long double type and it is bigger than a double */
#define HAVE_LONG_DOUBLE 1
/* Define if you support more than one size of the long double type */
/* #undef HAVE_LONG_DOUBLE_VARIANT */
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkostemp' function. */
#define HAVE_MKOSTEMP 1
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define if mmap with MAP_ANON(YMOUS) works. */
#define HAVE_MMAP_ANON 1
/* Define if mmap of /dev/zero works. */
#define HAVE_MMAP_DEV_ZERO 1
/* Define if read-only mmap of a plain file works. */
#define HAVE_MMAP_FILE 1
/* Define if .eh_frame sections should be read-only. */
#define HAVE_RO_EH_FRAME 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
//#define HAVE_STDLIB_H 0
#define LACKS_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if GNU symbol versioning is used for libatomic. */
#define LIBFFI_GNU_SYMBOL_VERSIONING 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "libffi"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libffi"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libffi 3.3-rc0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libffi"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "3.3-rc0"
/* The size of `double', as computed by sizeof. */
#define SIZEOF_DOUBLE 8
/* The size of `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 8
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 8
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if symbols are underscored. */
/* #undef SYMBOL_UNDERSCORE */
/* Define this if you are using Purify and want to suppress spurious messages.
*/
/* #undef USING_PURIFY */
/* Version number of package */
#define VERSION "3.3-rc0"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
#ifdef LIBFFI_ASM
#ifdef __APPLE__
#define FFI_HIDDEN(name) .private_extern name
#else
#define FFI_HIDDEN(name) .hidden name
#endif
#else
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
#endif
#else
#ifdef LIBFFI_ASM
#define FFI_HIDDEN(name)
#else
#define FFI_HIDDEN
#endif
#endif

View File

@ -19,7 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __arm64__
#if defined(__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@ -27,6 +27,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <ffi.h>
#include <ffi_common.h>
#include "internal.h"
#ifdef _M_ARM64
#include <windows.h> /* FlushInstructionCache */
#endif
#if __has_feature(ptrauth_calls)
#include <ptrauth.h>
@ -79,6 +82,8 @@ ffi_clear_cache (void *start, void *end)
sys_icache_invalidate (start, (char *)end - (char *)start);
#elif defined (__GNUC__)
__builtin___clear_cache (start, end);
#elif defined (_M_ARM64)
FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
#else
#error "Missing builtin to flush instruction cache"
#endif
@ -320,6 +325,9 @@ extend_integer_type (void *source, int type)
}
}
#if defined(_MSC_VER)
void extend_hfa_type (void *dest, void *src, int h);
#else
static void
extend_hfa_type (void *dest, void *src, int h)
{
@ -355,10 +363,10 @@ extend_hfa_type (void *dest, void *src, int h)
" b 1f\n"
" nop\n"
" ldp q16, q17, [%3]\n" /* Q4 */
" ldp q18, q19, [%3, #16]\n"
" ldp q18, q19, [%3, #32]\n"
" b 4f\n"
" ldp q16, q17, [%3]\n" /* Q3 */
" ldr q18, [%3, #16]\n"
" ldr q18, [%3, #32]\n"
" b 3f\n"
" ldp q16, q17, [%3]\n" /* Q2 */
" b 2f\n"
@ -373,7 +381,11 @@ extend_hfa_type (void *dest, void *src, int h)
: "r"(f * 12), "r"(dest), "r"(src)
: "memory", "v16", "v17", "v18", "v19");
}
#endif
#if defined(_MSC_VER)
void* compress_hfa_type (void *dest, void *src, int h);
#else
static void *
compress_hfa_type (void *dest, void *reg, int h)
{
@ -442,6 +454,7 @@ compress_hfa_type (void *dest, void *reg, int h)
}
return dest;
}
#endif
/* Either allocate an appropriate register for the argument type, or if
none are available, allocate a stack slot and return a pointer
@ -594,8 +607,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
The frame uses 40 bytes for: lr, fp, rvalue, flags, sp */
context = alloca (sizeof(struct call_context) + stack_bytes + 40 + rsize);
stack = context + 1;
frame = stack + stack_bytes;
rvalue = (rsize ? frame + 40 : orig_rvalue);
frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes);
rvalue = (rsize ? (void*)((uintptr_t)frame + 40) : orig_rvalue);
arg_init (&state);
for (i = 0, nargs = cif->nargs; i < nargs; i++)
@ -657,6 +670,22 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
if (h)
{
int elems = 4 - (h & 3);
#ifdef _M_ARM64 /* for handling armasm calling convention */
if (cif->is_variadic)
{
if (state.ngrn + elems <= N_X_ARG_REG)
{
dest = &context->x[state.ngrn];
state.ngrn += elems;
extend_hfa_type(dest, a, h);
break;
}
state.nsrn = N_X_ARG_REG;
dest = allocate_to_stack(&state, stack, ty->alignment, s);
}
else
{
#endif /* for handling armasm calling convention */
if (state.nsrn + elems <= N_V_ARG_REG)
{
dest = &context->v[state.nsrn];
@ -666,6 +695,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
}
state.nsrn = N_V_ARG_REG;
dest = allocate_to_stack (&state, stack, ty->alignment, s);
#ifdef _M_ARM64 /* for handling armasm calling convention */
}
#endif /* for handling armasm calling convention */
}
else if (s > 16)
{
@ -687,7 +719,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
X registers, then the argument is copied into
consecutive X registers. */
dest = &context->x[state.ngrn];
state.ngrn += n;
state.ngrn += (unsigned int)n;
}
else
{
@ -788,6 +820,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
*(UINT64 *)(tramp + 16) = (uintptr_t)start;
ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
/* Also flush the cache for code mapping. */
#ifdef _M_ARM64
// Not using dlmalloc.c for Windows ARM64 builds
// so calling ffi_data_to_code_pointer() isn't necessary
unsigned char *tramp_code = tramp;
#else
unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
#endif
ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
#endif
closure->cif = cif;
@ -902,55 +944,78 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
if (h)
{
n = 4 - (h & 3);
if (state.nsrn + n <= N_V_ARG_REG)
{
void *reg = &context->v[state.nsrn];
state.nsrn += n;
#ifdef _M_ARM64 /* for handling armasm calling convention */
if (cif->is_variadic)
{
if (state.ngrn + n <= N_X_ARG_REG)
{
void *reg = &context->x[state.ngrn];
state.ngrn += (unsigned int)n;
/* Eeek! We need a pointer to the structure, however the
homogeneous float elements are being passed in individual
registers, therefore for float and double the structure
is not represented as a contiguous sequence of bytes in
our saved register context. We don't need the original
contents of the register storage, so we reformat the
structure into the same memory. */
avalue[i] = compress_hfa_type(reg, reg, h);
}
else
{
state.ngrn = N_X_ARG_REG;
state.nsrn = N_V_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
}
}
else
{
#endif /* for handling armasm calling convention */
if (state.nsrn + n <= N_V_ARG_REG)
{
void *reg = &context->v[state.nsrn];
state.nsrn += (unsigned int)n;
avalue[i] = compress_hfa_type(reg, reg, h);
}
else
{
state.nsrn = N_V_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
}
#ifdef _M_ARM64 /* for handling armasm calling convention */
}
#endif /* for handling armasm calling convention */
}
else if (s > 16)
{
/* Replace Composite type of size greater than 16 with a
pointer. */
avalue[i] = *(void **)
allocate_int_to_reg_or_stack (context, &state, stack,
sizeof (void *));
}
else
{
n = (s + 7) / 8;
if (state.ngrn + n <= N_X_ARG_REG)
{
avalue[i] = &context->x[state.ngrn];
state.ngrn += (unsigned int)n;
}
else
{
state.ngrn = N_X_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
}
}
break;
/* Eeek! We need a pointer to the structure, however the
homogeneous float elements are being passed in individual
registers, therefore for float and double the structure
is not represented as a contiguous sequence of bytes in
our saved register context. We don't need the original
contents of the register storage, so we reformat the
structure into the same memory. */
avalue[i] = compress_hfa_type (reg, reg, h);
}
else
{
state.nsrn = N_V_ARG_REG;
avalue[i] = allocate_to_stack (&state, stack,
ty->alignment, s);
}
}
else if (s > 16)
{
/* Replace Composite type of size greater than 16 with a
pointer. */
avalue[i] = *(void **)
allocate_int_to_reg_or_stack (context, &state, stack,
sizeof (void *));
}
else
{
n = (s + 7) / 8;
if (state.ngrn + n <= N_X_ARG_REG)
{
avalue[i] = &context->x[state.ngrn];
state.ngrn += n;
}
else
{
state.ngrn = N_X_ARG_REG;
avalue[i] = allocate_to_stack (&state, stack,
ty->alignment, s);
}
}
break;
default:
abort();
}
default:
abort();
}
#if defined (__APPLE__)
if (i + 1 == cif->aarch64_nfixedargs)
@ -973,4 +1038,4 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
#endif /* FFI_CLOSURES */
#endif /* __arm64__ */
#endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/

View File

@ -32,6 +32,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
#elif defined(_M_ARM64)
#define FFI_SIZEOF_ARG 8
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
#else
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
@ -65,17 +69,24 @@ typedef enum ffi_abi
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif
#ifdef _M_ARM64
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
#endif
/* ---- Internal ---- */
#if defined (__APPLE__)
#define FFI_TARGET_SPECIFIC_VARIADIC
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
#else
/* iOS reserves x18 for the system. Disable Go closures until
#elif !defined(_M_ARM64)
/* iOS and Windows reserve x18 for the system. Disable Go closures until
a new static chain is chosen. */
#define FFI_GO_CLOSURES 1
#endif
#ifndef _M_ARM64
/* No complex type on Windows */
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
#endif

View File

@ -19,7 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __arm64__
#if defined(__aarch64__) || defined(__arm64__)
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
@ -82,7 +82,15 @@ CNAME(ffi_call_SYSV):
SIGN_LR_WITH_REG(x1)
/* Use a stack frame allocated by our caller. */
cfi_def_cfa(x1, 32);
#if __has_feature(ptrauth_calls) && defined(__APPLE__)
/* darwin's libunwind assumes that the cfa is the sp and that's the data
* used to sign the lr. In order to allow unwinding through this
* function it is necessary to point the cfa at the signing register.
*/
cfi_def_cfa(x1, 0);
#else
cfi_def_cfa(x1, 40);
#endif
stp x29, x30, [x1]
mov x9, sp
str x9, [x1, #32]
@ -374,6 +382,29 @@ CNAME(ffi_closure_SYSV):
.size CNAME(ffi_closure_SYSV), . - CNAME(ffi_closure_SYSV)
#endif
#if FFI_EXEC_TRAMPOLINE_TABLE
#ifdef __MACH__
#include <mach/machine/vm_param.h>
.align PAGE_MAX_SHIFT
CNAME(ffi_closure_trampoline_table_page):
.rept PAGE_MAX_SIZE / FFI_TRAMPOLINE_SIZE
adr x16, -PAGE_MAX_SIZE
ldp x17, x16, [x16]
br x16
nop /* each entry in the trampoline config page is 2*sizeof(void*) so the trampoline itself cannot be smaller that 16 bytes */
.endr
.globl CNAME(ffi_closure_trampoline_table_page)
FFI_HIDDEN(CNAME(ffi_closure_trampoline_table_page))
#ifdef __ELF__
.type CNAME(ffi_closure_trampoline_table_page), #function
.size CNAME(ffi_closure_trampoline_table_page), . - CNAME(ffi_closure_trampoline_table_page)
#endif
#endif
#endif /* FFI_EXEC_TRAMPOLINE_TABLE */
#ifdef FFI_GO_CLOSURES
.align 4
CNAME(ffi_go_closure_SYSV_V):

506
src/aarch64/win64_armasm.S Normal file
View File

@ -0,0 +1,506 @@
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_cfi.h>
#include "internal.h"
OPT 2 /*disable listing */
/* For some macros to add unwind information */
#include "ksarm64.h"
OPT 1 /*re-enable listing */
#define BE(X) 0
#define PTR_REG(n) x##n
#define PTR_SIZE 8
IMPORT ffi_closure_SYSV_inner
EXPORT ffi_call_SYSV
EXPORT ffi_closure_SYSV_V
EXPORT ffi_closure_SYSV
EXPORT extend_hfa_type
EXPORT compress_hfa_type
#ifdef FFI_GO_CLOSURES
EXPORT ffi_go_closure_SYSV_V
EXPORT ffi_go_closure_SYSV
#endif
TEXTAREA, ALLIGN=8
/* ffi_call_SYSV
extern void ffi_call_SYSV (void *stack, void *frame,
void (*fn)(void), void *rvalue,
int flags, void *closure);
Therefore on entry we have:
x0 stack
x1 frame
x2 fn
x3 rvalue
x4 flags
x5 closure
*/
NESTED_ENTRY ffi_call_SYSV_fake
/* For unwind information, Windows has to store fp and lr */
PROLOG_SAVE_REG_PAIR x29, x30, #-32!
ALTERNATE_ENTRY ffi_call_SYSV
/* Use a stack frame allocated by our caller. */
stp x29, x30, [x1]
mov x29, x1
mov sp, x0
mov x9, x2 /* save fn */
mov x8, x3 /* install structure return */
#ifdef FFI_GO_CLOSURES
/*mov x18, x5 install static chain */
#endif
stp x3, x4, [x29, #16] /* save rvalue and flags */
/* Load the vector argument passing registers, if necessary. */
tbz x4, #AARCH64_FLAG_ARG_V_BIT, ffi_call_SYSV_L1
ldp q0, q1, [sp, #0]
ldp q2, q3, [sp, #32]
ldp q4, q5, [sp, #64]
ldp q6, q7, [sp, #96]
ffi_call_SYSV_L1
/* Load the core argument passing registers, including
the structure return pointer. */
ldp x0, x1, [sp, #16*N_V_ARG_REG + 0]
ldp x2, x3, [sp, #16*N_V_ARG_REG + 16]
ldp x4, x5, [sp, #16*N_V_ARG_REG + 32]
ldp x6, x7, [sp, #16*N_V_ARG_REG + 48]
/* Deallocate the context, leaving the stacked arguments. */
add sp, sp, #CALL_CONTEXT_SIZE
blr x9 /* call fn */
ldp x3, x4, [x29, #16] /* reload rvalue and flags */
/* Partially deconstruct the stack frame. */
mov sp, x29
ldp x29, x30, [x29]
/* Save the return value as directed. */
adr x5, ffi_call_SYSV_return
and w4, w4, #AARCH64_RET_MASK
add x5, x5, x4, lsl #3
br x5
/* Note that each table entry is 2 insns, and thus 8 bytes.
For integer data, note that we're storing into ffi_arg
and therefore we want to extend to 64 bits; these types
have two consecutive entries allocated for them. */
ALIGN 4
ffi_call_SYSV_return
ret /* VOID */
nop
str x0, [x3] /* INT64 */
ret
stp x0, x1, [x3] /* INT128 */
ret
brk #1000 /* UNUSED */
ret
brk #1000 /* UNUSED */
ret
brk #1000 /* UNUSED */
ret
brk #1000 /* UNUSED */
ret
brk #1000 /* UNUSED */
ret
st4 { v0.s, v1.s, v2.s, v3.s }[0], [x3] /* S4 */
ret
st3 { v0.s, v1.s, v2.s }[0], [x3] /* S3 */
ret
stp s0, s1, [x3] /* S2 */
ret
str s0, [x3] /* S1 */
ret
st4 { v0.d, v1.d, v2.d, v3.d }[0], [x3] /* D4 */
ret
st3 { v0.d, v1.d, v2.d }[0], [x3] /* D3 */
ret
stp d0, d1, [x3] /* D2 */
ret
str d0, [x3] /* D1 */
ret
str q3, [x3, #48] /* Q4 */
nop
str q2, [x3, #32] /* Q3 */
nop
stp q0, q1, [x3] /* Q2 */
ret
str q0, [x3] /* Q1 */
ret
uxtb w0, w0 /* UINT8 */
str x0, [x3]
ret /* reserved */
nop
uxth w0, w0 /* UINT16 */
str x0, [x3]
ret /* reserved */
nop
mov w0, w0 /* UINT32 */
str x0, [x3]
ret /* reserved */
nop
sxtb x0, w0 /* SINT8 */
str x0, [x3]
ret /* reserved */
nop
sxth x0, w0 /* SINT16 */
str x0, [x3]
ret /* reserved */
nop
sxtw x0, w0 /* SINT32 */
str x0, [x3]
ret /* reserved */
nop
NESTED_END ffi_call_SYSV_fake
/* ffi_closure_SYSV
Closure invocation glue. This is the low level code invoked directly by
the closure trampoline to setup and call a closure.
On entry x17 points to a struct ffi_closure, x16 has been clobbered
all other registers are preserved.
We allocate a call context and save the argument passing registers,
then invoked the generic C ffi_closure_SYSV_inner() function to do all
the real work, on return we load the result passing registers back from
the call context.
*/
#define ffi_closure_SYSV_FS (8*2 + CALL_CONTEXT_SIZE + 64)
NESTED_ENTRY ffi_closure_SYSV_V
PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS!
/* Save the argument passing vector registers. */
stp q0, q1, [sp, #16 + 0]
stp q2, q3, [sp, #16 + 32]
stp q4, q5, [sp, #16 + 64]
stp q6, q7, [sp, #16 + 96]
b ffi_closure_SYSV_save_argument
NESTED_END ffi_closure_SYSV_V
NESTED_ENTRY ffi_closure_SYSV
PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS!
ffi_closure_SYSV_save_argument
/* Save the argument passing core registers. */
stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0]
stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16]
stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32]
stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48]
/* Load ffi_closure_inner arguments. */
ldp PTR_REG(0), PTR_REG(1), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET] /* load cif, fn */
ldr PTR_REG(2), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET+PTR_SIZE*2] /* load user_data */
do_closure
add x3, sp, #16 /* load context */
add x4, sp, #ffi_closure_SYSV_FS /* load stack */
add x5, sp, #16+CALL_CONTEXT_SIZE /* load rvalue */
mov x6, x8 /* load struct_rval */
bl ffi_closure_SYSV_inner
/* Load the return value as directed. */
adr x1, ffi_closure_SYSV_return_base
and w0, w0, #AARCH64_RET_MASK
add x1, x1, x0, lsl #3
add x3, sp, #16+CALL_CONTEXT_SIZE
br x1
/* Note that each table entry is 2 insns, and thus 8 bytes. */
ALIGN 8
ffi_closure_SYSV_return_base
b ffi_closure_SYSV_epilog /* VOID */
nop
ldr x0, [x3] /* INT64 */
b ffi_closure_SYSV_epilog
ldp x0, x1, [x3] /* INT128 */
b ffi_closure_SYSV_epilog
brk #1000 /* UNUSED */
nop
brk #1000 /* UNUSED */
nop
brk #1000 /* UNUSED */
nop
brk #1000 /* UNUSED */
nop
brk #1000 /* UNUSED */
nop
ldr s3, [x3, #12] /* S4 */
nop
ldr s2, [x3, #8] /* S3 */
nop
ldp s0, s1, [x3] /* S2 */
b ffi_closure_SYSV_epilog
ldr s0, [x3] /* S1 */
b ffi_closure_SYSV_epilog
ldr d3, [x3, #24] /* D4 */
nop
ldr d2, [x3, #16] /* D3 */
nop
ldp d0, d1, [x3] /* D2 */
b ffi_closure_SYSV_epilog
ldr d0, [x3] /* D1 */
b ffi_closure_SYSV_epilog
ldr q3, [x3, #48] /* Q4 */
nop
ldr q2, [x3, #32] /* Q3 */
nop
ldp q0, q1, [x3] /* Q2 */
b ffi_closure_SYSV_epilog
ldr q0, [x3] /* Q1 */
b ffi_closure_SYSV_epilog
ldrb w0, [x3, #BE(7)] /* UINT8 */
b ffi_closure_SYSV_epilog
brk #1000 /* reserved */
nop
ldrh w0, [x3, #BE(6)] /* UINT16 */
b ffi_closure_SYSV_epilog
brk #1000 /* reserved */
nop
ldr w0, [x3, #BE(4)] /* UINT32 */
b ffi_closure_SYSV_epilog
brk #1000 /* reserved */
nop
ldrsb x0, [x3, #BE(7)] /* SINT8 */
b ffi_closure_SYSV_epilog
brk #1000 /* reserved */
nop
ldrsh x0, [x3, #BE(6)] /* SINT16 */
b ffi_closure_SYSV_epilog
brk #1000 /* reserved */
nop
ldrsw x0, [x3, #BE(4)] /* SINT32 */
nop
/* reserved */
ffi_closure_SYSV_epilog
EPILOG_RESTORE_REG_PAIR x29, x30, #ffi_closure_SYSV_FS!
EPILOG_RETURN
NESTED_END ffi_closure_SYSV
#ifdef FFI_GO_CLOSURES
NESTED_ENTRY ffi_go_closure_SYSV_V
PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS!
/* Save the argument passing vector registers. */
stp q0, q1, [sp, #16 + 0]
stp q2, q3, [sp, #16 + 32]
stp q4, q5, [sp, #16 + 64]
stp q6, q7, [sp, #16 + 96]
b ffi_go_closure_SYSV_save_argument
NESTED_END ffi_go_closure_SYSV_V
NESTED_ENTRY ffi_go_closure_SYSV
PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS!
ffi_go_closure_SYSV_save_argument
/* Save the argument passing core registers. */
stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0]
stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16]
stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32]
stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48]
/* Load ffi_closure_inner arguments. */
ldp PTR_REG(0), PTR_REG(1), [x18, #PTR_SIZE]/* load cif, fn */
mov x2, x18 /* load user_data */
b do_closure
NESTED_END ffi_go_closure_SYSV
#endif /* FFI_GO_CLOSURES */
/* void extend_hfa_type (void *dest, void *src, int h) */
LEAF_ENTRY extend_hfa_type
adr x3, extend_hfa_type_jump_base
and w2, w2, #AARCH64_RET_MASK
sub x2, x2, #AARCH64_RET_S4
add x3, x3, x2, lsl #4
br x3
ALIGN 4
extend_hfa_type_jump_base
ldp s16, s17, [x1] /* S4 */
ldp s18, s19, [x1, #8]
b extend_hfa_type_store_4
nop
ldp s16, s17, [x1] /* S3 */
ldr s18, [x1, #8]
b extend_hfa_type_store_3
nop
ldp s16, s17, [x1] /* S2 */
b extend_hfa_type_store_2
nop
nop
ldr s16, [x1] /* S1 */
b extend_hfa_type_store_1
nop
nop
ldp d16, d17, [x1] /* D4 */
ldp d18, d19, [x1, #16]
b extend_hfa_type_store_4
nop
ldp d16, d17, [x1] /* D3 */
ldr d18, [x1, #16]
b extend_hfa_type_store_3
nop
ldp d16, d17, [x1] /* D2 */
b extend_hfa_type_store_2
nop
nop
ldr d16, [x1] /* D1 */
b extend_hfa_type_store_1
nop
nop
ldp q16, q17, [x1] /* Q4 */
ldp q18, q19, [x1, #16]
b extend_hfa_type_store_4
nop
ldp q16, q17, [x1] /* Q3 */
ldr q18, [x1, #16]
b extend_hfa_type_store_3
nop
ldp q16, q17, [x1] /* Q2 */
b extend_hfa_type_store_2
nop
nop
ldr q16, [x1] /* Q1 */
b extend_hfa_type_store_1
extend_hfa_type_store_4
str q19, [x0, #48]
extend_hfa_type_store_3
str q18, [x0, #32]
extend_hfa_type_store_2
str q17, [x0, #16]
extend_hfa_type_store_1
str q16, [x0]
ret
LEAF_END extend_hfa_type
/* void compress_hfa_type (void *dest, void *reg, int h) */
LEAF_ENTRY compress_hfa_type
adr x3, compress_hfa_type_jump_base
and w2, w2, #AARCH64_RET_MASK
sub x2, x2, #AARCH64_RET_S4
add x3, x3, x2, lsl #4
br x3
ALIGN 4
compress_hfa_type_jump_base
ldp q16, q17, [x1] /* S4 */
ldp q18, q19, [x1, #32]
st4 { v16.s, v17.s, v18.s, v19.s }[0], [x0]
ret
ldp q16, q17, [x1] /* S3 */
ldr q18, [x1, #32]
st3 { v16.s, v17.s, v18.s }[0], [x0]
ret
ldp q16, q17, [x1] /* S2 */
st2 { v16.s, v17.s }[0], [x0]
ret
nop
ldr q16, [x1] /* S1 */
st1 { v16.s }[0], [x0]
ret
nop
ldp q16, q17, [x1] /* D4 */
ldp q18, q19, [x1, #32]
st4 { v16.d, v17.d, v18.d, v19.d }[0], [x0]
ret
ldp q16, q17, [x1] /* D3 */
ldr q18, [x1, #32]
st3 { v16.d, v17.d, v18.d }[0], [x0]
ret
ldp q16, q17, [x1] /* D2 */
st2 { v16.d, v17.d }[0], [x0]
ret
nop
ldr q16, [x1] /* D1 */
st1 { v16.d }[0], [x0]
ret
nop
ldp q16, q17, [x1] /* Q4 */
ldp q18, q19, [x1, #32]
b compress_hfa_type_store_q4
nop
ldp q16, q17, [x1] /* Q3 */
ldr q18, [x1, #32]
b compress_hfa_type_store_q3
nop
ldp q16, q17, [x1] /* Q2 */
stp q16, q17, [x0]
ret
nop
ldr q16, [x1] /* Q1 */
str q16, [x0]
ret
compress_hfa_type_store_q4
str q19, [x0, #48]
compress_hfa_type_store_q3
str q18, [x0, #32]
stp q16, q17, [x0]
ret
LEAF_END compress_hfa_type
END

View File

@ -28,7 +28,7 @@
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifdef __arm__
#if defined(__arm__) || defined(_M_ARM)
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_common.h>
@ -36,6 +36,11 @@
#include <stdlib.h>
#include "internal.h"
#if defined(_MSC_VER) && defined(_M_ARM)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if FFI_EXEC_TRAMPOLINE_TABLE
#ifdef __MACH__
@ -43,7 +48,11 @@
#endif
#else
#ifndef _M_ARM
extern unsigned int ffi_arm_trampoline[2] FFI_HIDDEN;
#else
extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN;
#endif
#endif
/* Forward declares. */
@ -89,10 +98,20 @@ ffi_put_arg (ffi_type *ty, void *src, void *dst)
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
#ifndef _MSC_VER
case FFI_TYPE_FLOAT:
#endif
*(UINT32 *)dst = *(UINT32 *)src;
break;
#ifdef _MSC_VER
// casting a float* to a UINT32* doesn't work on Windows
case FFI_TYPE_FLOAT:
*(uintptr_t *)dst = 0;
*(float *)dst = *(float *)src;
break;
#endif
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_DOUBLE:
@ -579,15 +598,28 @@ ffi_prep_closure_loc (ffi_closure * closure,
config[0] = closure;
config[1] = closure_func;
#else
memcpy (closure->tramp, ffi_arm_trampoline, 8);
#ifndef _M_ARM
memcpy(closure->tramp, ffi_arm_trampoline, 8);
#else
// cast away function type so MSVC doesn't set the lower bit of the function pointer
memcpy(closure->tramp, (void*)((uintptr_t)ffi_arm_trampoline & 0xFFFFFFFE), FFI_TRAMPOLINE_CLOSURE_OFFSET);
#endif
#if defined (__QNX__)
msync(closure->tramp, 8, 0x1000000); /* clear data map */
msync(codeloc, 8, 0x1000000); /* clear insn map */
#elif defined(_MSC_VER)
FlushInstructionCache(GetCurrentProcess(), closure->tramp, FFI_TRAMPOLINE_SIZE);
#else
__clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */
__clear_cache(codeloc, codeloc + 8); /* clear insn map */
#endif
#ifdef _M_ARM
*(void(**)(void))(closure->tramp + FFI_TRAMPOLINE_CLOSURE_FUNCTION) = closure_func;
#else
*(void (**)(void))(closure->tramp + 8) = closure_func;
#endif
#endif
closure->cif = cif;
@ -793,7 +825,7 @@ place_vfp_arg (ffi_cif *cif, int h)
}
/* Found regs to allocate. */
cif->vfp_used |= new_used;
cif->vfp_args[cif->vfp_nargs++] = reg;
cif->vfp_args[cif->vfp_nargs++] = (signed char)reg;
/* Update vfp_reg_free. */
if (cif->vfp_used & (1 << cif->vfp_reg_free))
@ -815,7 +847,7 @@ place_vfp_arg (ffi_cif *cif, int h)
static void
layout_vfp_args (ffi_cif * cif)
{
int i;
unsigned int i;
/* Init VFP fields */
cif->vfp_used = 0;
cif->vfp_nargs = 0;
@ -830,4 +862,4 @@ layout_vfp_args (ffi_cif * cif)
}
}
#endif /* __arm__ */
#endif /* __arm__ or _M_ARM */

View File

@ -43,7 +43,7 @@ typedef enum ffi_abi {
FFI_SYSV,
FFI_VFP,
FFI_LAST_ABI,
#ifdef __ARM_PCS_VFP
#if defined(__ARM_PCS_VFP) || defined(_M_ARM)
FFI_DEFAULT_ABI = FFI_VFP,
#else
FFI_DEFAULT_ABI = FFI_SYSV,
@ -57,7 +57,9 @@ typedef enum ffi_abi {
signed char vfp_args[16] \
#define FFI_TARGET_SPECIFIC_VARIADIC
#ifndef _M_ARM
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
/* ---- Definitions for closures ----------------------------------------- */
@ -74,8 +76,13 @@ typedef enum ffi_abi {
#error "No trampoline table implementation"
#endif
#else
#ifdef _MSC_VER
#define FFI_TRAMPOLINE_SIZE 16
#define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12
#else
#define FFI_TRAMPOLINE_SIZE 12
#endif
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif

View File

@ -86,7 +86,6 @@
#define ARM_FUNC_START(name) \
.globl CNAME(name); \
.private_extern CNAME(name); \
FFI_HIDDEN(CNAME(name)); \
ARM_FUNC_START_LOCAL(name)

311
src/arm/sysv_msvc_arm32.S Normal file
View File

@ -0,0 +1,311 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc.
Copyright (c) 2011 Plausible Labs Cooperative, Inc.
Copyright (c) 2019 Microsoft Corporation.
ARM Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_cfi.h>
#include "internal.h"
#include "ksarm.h"
; 8 byte aligned AREA to support 8 byte aligned jump tables
MACRO
NESTED_ENTRY_FFI $FuncName, $AreaName, $ExceptHandler
; compute the function's labels
__DeriveFunctionLabels $FuncName
; determine the area we will put the function into
__FuncArea SETS "|.text|"
IF "$AreaName" != ""
__FuncArea SETS "$AreaName"
ENDIF
; set up the exception handler itself
__FuncExceptionHandler SETS ""
IF "$ExceptHandler" != ""
__FuncExceptionHandler SETS "|$ExceptHandler|"
ENDIF
; switch to the specified area, jump tables require 8 byte alignment
AREA $__FuncArea,CODE,CODEALIGN,ALIGN=3,READONLY
; export the function name
__ExportProc $FuncName
; flush any pending literal pool stuff
ROUT
; reset the state of the unwind code tracking
__ResetUnwindState
MEND
; MACRO
; TABLE_ENTRY $Type, $Table
;$Type_$Table
; MEND
#define E(index,table) return_##index##_##table
; r0: stack
; r1: frame
; r2: fn
; r3: vfp_used
; fake entry point exists only to generate exists only to
; generate .pdata for exception unwinding
NESTED_ENTRY_FFI ffi_call_VFP_fake
PROLOG_PUSH {r11, lr} ; save fp and lr for unwind
ALTERNATE_ENTRY ffi_call_VFP
cmp r3, #3 ; load only d0 if possible
vldrle d0, [r0]
vldmgt r0, {d0-d7}
add r0, r0, #64 ; discard the vfp register args
b ffi_call_SYSV
NESTED_END ffi_call_VFP_fake
; fake entry point exists only to generate exists only to
; generate .pdata for exception unwinding
NESTED_ENTRY_FFI ffi_call_SYSV_fake
PROLOG_PUSH {r11, lr} ; save fp and lr for unwind
ALTERNATE_ENTRY ffi_call_SYSV
stm r1, {fp, lr}
mov fp, r1
mov sp, r0 ; install the stack pointer
mov lr, r2 ; move the fn pointer out of the way
ldr ip, [fp, #16] ; install the static chain
ldmia sp!, {r0-r3} ; move first 4 parameters in registers.
blx lr ; call fn
; Load r2 with the pointer to storage for the return value
; Load r3 with the return type code
ldr r2, [fp, #8]
ldr r3, [fp, #12]
; Deallocate the stack with the arguments.
mov sp, fp
; Store values stored in registers.
ALIGN 8
lsl r3, #3
add r3, r3, pc
add r3, #8
mov pc, r3
E(ARM_TYPE_VFP_S, ffi_call)
ALIGN 8
vstr s0, [r2]
pop {fp,pc}
E(ARM_TYPE_VFP_D, ffi_call)
ALIGN 8
vstr d0, [r2]
pop {fp,pc}
E(ARM_TYPE_VFP_N, ffi_call)
ALIGN 8
vstm r2, {d0-d3}
pop {fp,pc}
E(ARM_TYPE_INT64, ffi_call)
ALIGN 8
str r1, [r2, #4]
nop
E(ARM_TYPE_INT, ffi_call)
ALIGN 8
str r0, [r2]
pop {fp,pc}
E(ARM_TYPE_VOID, ffi_call)
ALIGN 8
pop {fp,pc}
nop
E(ARM_TYPE_STRUCT, ffi_call)
ALIGN 8
cmp r3, #ARM_TYPE_STRUCT
pop {fp,pc}
NESTED_END ffi_call_SYSV_fake
IMPORT |ffi_closure_inner_SYSV|
/*
int ffi_closure_inner_SYSV
(
cif, ; r0
fun, ; r1
user_data, ; r2
frame ; r3
)
*/
NESTED_ENTRY_FFI ffi_go_closure_SYSV
stmdb sp!, {r0-r3} ; save argument regs
ldr r0, [ip, #4] ; load cif
ldr r1, [ip, #8] ; load fun
mov r2, ip ; load user_data
b ffi_go_closure_SYSV_0
NESTED_END ffi_go_closure_SYSV
; r3: ffi_closure
; fake entry point exists only to generate exists only to
; generate .pdata for exception unwinding
NESTED_ENTRY_FFI ffi_closure_SYSV_fake
PROLOG_PUSH {r11, lr} ; save fp and lr for unwind
ALTERNATE_ENTRY ffi_closure_SYSV
ldmfd sp!, {ip,r0} ; restore fp (r0 is used for stack alignment)
stmdb sp!, {r0-r3} ; save argument regs
ldr r0, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET] ; ffi_closure->cif
ldr r1, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+4] ; ffi_closure->fun
ldr r2, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+8] ; ffi_closure->user_data
ALTERNATE_ENTRY ffi_go_closure_SYSV_0
add ip, sp, #16 ; compute entry sp
sub sp, sp, #64+32 ; allocate frame parameter (sizeof(vfp_space) = 64, sizeof(result) = 32)
mov r3, sp ; set frame parameter
stmdb sp!, {ip,lr}
bl ffi_closure_inner_SYSV ; call the Python closure
; Load values returned in registers.
add r2, sp, #64+8 ; address of closure_frame->result
bl ffi_closure_ret ; move result to correct register or memory for type
ldmfd sp!, {ip,lr}
mov sp, ip ; restore stack pointer
mov pc, lr
NESTED_END ffi_closure_SYSV_fake
IMPORT |ffi_closure_inner_VFP|
/*
int ffi_closure_inner_VFP
(
cif, ; r0
fun, ; r1
user_data, ; r2
frame ; r3
)
*/
NESTED_ENTRY_FFI ffi_go_closure_VFP
stmdb sp!, {r0-r3} ; save argument regs
ldr r0, [ip, #4] ; load cif
ldr r1, [ip, #8] ; load fun
mov r2, ip ; load user_data
b ffi_go_closure_VFP_0
NESTED_END ffi_go_closure_VFP
; fake entry point exists only to generate exists only to
; generate .pdata for exception unwinding
; r3: closure
NESTED_ENTRY_FFI ffi_closure_VFP_fake
PROLOG_PUSH {r11, lr} ; save fp and lr for unwind
ALTERNATE_ENTRY ffi_closure_VFP
ldmfd sp!, {ip,r0} ; restore fp (r0 is used for stack alignment)
stmdb sp!, {r0-r3} ; save argument regs
ldr r0, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET] ; load cif
ldr r1, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+4] ; load fun
ldr r2, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+8] ; load user_data
ALTERNATE_ENTRY ffi_go_closure_VFP_0
add ip, sp, #16 ; compute entry sp
sub sp, sp, #32 ; save space for closure_frame->result
vstmdb sp!, {d0-d7} ; push closure_frame->vfp_space
mov r3, sp ; save closure_frame
stmdb sp!, {ip,lr}
bl ffi_closure_inner_VFP
; Load values returned in registers.
add r2, sp, #64+8 ; load result
bl ffi_closure_ret
ldmfd sp!, {ip,lr}
mov sp, ip ; restore stack pointer
mov pc, lr
NESTED_END ffi_closure_VFP_fake
/* Load values returned in registers for both closure entry points.
Note that we use LDM with SP in the register set. This is deprecated
by ARM, but not yet unpredictable. */
NESTED_ENTRY_FFI ffi_closure_ret
stmdb sp!, {fp,lr}
ALIGN 8
lsl r0, #3
add r0, r0, pc
add r0, #8
mov pc, r0
E(ARM_TYPE_VFP_S, ffi_closure)
ALIGN 8
vldr s0, [r2]
b call_epilogue
E(ARM_TYPE_VFP_D, ffi_closure)
ALIGN 8
vldr d0, [r2]
b call_epilogue
E(ARM_TYPE_VFP_N, ffi_closure)
ALIGN 8
vldm r2, {d0-d3}
b call_epilogue
E(ARM_TYPE_INT64, ffi_closure)
ALIGN 8
ldr r1, [r2, #4]
nop
E(ARM_TYPE_INT, ffi_closure)
ALIGN 8
ldr r0, [r2]
b call_epilogue
E(ARM_TYPE_VOID, ffi_closure)
ALIGN 8
b call_epilogue
nop
E(ARM_TYPE_STRUCT, ffi_closure)
ALIGN 8
b call_epilogue
call_epilogue
ldmfd sp!, {fp,pc}
NESTED_END ffi_closure_ret
AREA |.trampoline|, DATA, THUMB, READONLY
EXPORT |ffi_arm_trampoline|
|ffi_arm_trampoline| DATA
thisproc adr ip, thisproc
stmdb sp!, {ip, r0}
ldr pc, [pc, #0]
DCD 0
;ENDP
END

View File

@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc.
closures.c - Copyright (c) 2019 Anthony Green
Copyright (c) 2007, 2009, 2010 Red Hat, Inc.
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc
Copyright (c) 2011 Plausible Labs Cooperative, Inc.
@ -122,7 +123,7 @@ ffi_closure_free (void *ptr)
# define FFI_MMAP_EXEC_WRIT 1
# define HAVE_MNTENT 1
# endif
# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)
# if defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)
/* Windows systems may have Data Execution Protection (DEP) enabled,
which requires the use of VirtualMalloc/VirtualFree to alloc/free
executable memory. */
@ -436,7 +437,7 @@ ffi_closure_free (void *ptr)
#endif
#include <string.h>
#include <stdio.h>
#if !defined(X86_WIN32) && !defined(X86_WIN64)
#if !defined(X86_WIN32) && !defined(X86_WIN64) && !defined(_M_ARM64)
#ifdef HAVE_MNTENT
#include <mntent.h>
#endif /* HAVE_MNTENT */
@ -562,7 +563,7 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED;
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
static void dlmalloc_stats(void) MAYBE_UNUSED;
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
/* Use these for mmap and munmap within dlmalloc.c. */
static void *dlmmap(void *, size_t, int, int, int, off_t);
static int dlmunmap(void *, size_t);
@ -576,7 +577,7 @@ static int dlmunmap(void *, size_t);
#undef mmap
#undef munmap
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
/* A mutex used to synchronize access to *exec* variables in this file. */
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -840,7 +841,13 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
close (execfd);
goto retry_open;
}
ftruncate (execfd, offset);
if (ftruncate (execfd, offset) != 0)
{
/* Fixme : Error logs can be added here. Returning an error for
* ftruncte() will not add any advantage as it is being
* validating in the error case. */
}
return MFAIL;
}
else if (!offset
@ -852,7 +859,12 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
if (start == MFAIL)
{
munmap (ptr, length);
ftruncate (execfd, offset);
if (ftruncate (execfd, offset) != 0)
{
/* Fixme : Error logs can be added here. Returning an error for
* ftruncte() will not add any advantage as it is being
* validating in the error case. */
}
return start;
}
@ -947,7 +959,7 @@ segment_holding_code (mstate m, char* addr)
}
#endif
#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
/* Allocate a chunk of memory with the given size. Returns a pointer
to the writable address, and sets *CODE to the executable
@ -972,6 +984,20 @@ ffi_closure_alloc (size_t size, void **code)
return ptr;
}
void *
ffi_data_to_code_pointer (void *data)
{
msegmentptr seg = segment_holding (gm, data);
/* We expect closures to be allocated with ffi_closure_alloc(), in
which case seg will be non-NULL. However, some users take on the
burden of managing this memory themselves, in which case this
we'll just return data. */
if (seg)
return add_segment_exec_offset (data, seg);
else
return data;
}
/* Release a chunk of memory allocated with ffi_closure_alloc. If
FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the
writable or the executable address given. Otherwise, only the
@ -1011,6 +1037,12 @@ ffi_closure_free (void *ptr)
free (ptr);
}
void *
ffi_data_to_code_pointer (void *data)
{
return data;
}
# endif /* ! FFI_MMAP_EXEC_WRIT */
#endif /* FFI_CLOSURES */

View File

@ -107,7 +107,7 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
count += z;
}
return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8)));
return (stack + ((count > 24) ? 24 : FFI_ALIGN_DOWN(count, 8)));
}
/* Perform machine dependent cif processing */

View File

@ -61,7 +61,7 @@ unsigned int ffi_prep_args(char *stack, extended_cif *ecif)
argp -= z;
/* Align if necessary */
argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4);
argp = (char *) FFI_ALIGN_DOWN(FFI_ALIGN_DOWN(argp, (*p_arg)->alignment), 4);
if (z < sizeof(int)) {
z = sizeof(int);

View File

@ -100,7 +100,7 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
count += z;
}
return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8)));
return (stack + ((count > 24) ? 24 : FFI_ALIGN_DOWN(count, 8)));
}
/* Perform machine dependent cif processing */

View File

@ -297,10 +297,18 @@ ffi_closure_pa32:
.LSCIE1:
.word 0x0 ;# CIE Identifier Tag
.byte 0x1 ;# CIE Version
#ifdef __PIC__
.ascii "zR\0" ;# CIE Augmentation: 'z' - data, 'R' - DW_EH_PE_... data
#else
.ascii "\0" ;# CIE Augmentation
#endif
.uleb128 0x1 ;# CIE Code Alignment Factor
.sleb128 4 ;# CIE Data Alignment Factor
.byte 0x2 ;# CIE RA Column
#ifdef __PIC__
.uleb128 0x1 ;# Augmentation size
.byte 0x1b ;# FDE Encoding (DW_EH_PE_pcrel|DW_EH_PE_sdata4)
#endif
.byte 0xc ;# DW_CFA_def_cfa
.uleb128 0x1e
.uleb128 0x0
@ -310,9 +318,15 @@ ffi_closure_pa32:
.word .LEFDE1-.LASFDE1 ;# FDE Length
.LASFDE1:
.word .LASFDE1-.Lframe1 ;# FDE CIE offset
.word .LFB1 ;# FDE initial location
#ifdef __PIC__
.word .LFB1-. ;# FDE initial location
#else
.word .LFB1 ;# FDE initial location
#endif
.word .LFE1-.LFB1 ;# FDE address range
#ifdef __PIC__
.uleb128 0x0 ;# Augmentation size: no data
#endif
.byte 0x4 ;# DW_CFA_advance_loc4
.word .LCFI11-.LFB1
.byte 0x83 ;# DW_CFA_offset, column 0x3
@ -338,8 +352,15 @@ ffi_closure_pa32:
.word .LEFDE2-.LASFDE2 ;# FDE Length
.LASFDE2:
.word .LASFDE2-.Lframe1 ;# FDE CIE offset
#ifdef __PIC__
.word .LFB2-. ;# FDE initial location
#else
.word .LFB2 ;# FDE initial location
#endif
.word .LFE2-.LFB2 ;# FDE address range
#ifdef __PIC__
.uleb128 0x0 ;# Augmentation size: no data
#endif
.byte 0x4 ;# DW_CFA_advance_loc4
.word .LCFI21-.LFB2
.byte 0x83 ;# DW_CFA_offset, column 0x3

View File

@ -85,8 +85,9 @@ ffi_call_int (ffi_cif *cif,
can write r3 and r4 to memory without worrying about struct size.
For ELFv2 ABI, use a bounce buffer for homogeneous structs too,
for similar reasons. */
unsigned long smst_buffer[8];
for similar reasons. This bounce buffer must be aligned to 16
bytes for use with homogeneous structs of vectors (float128). */
float128 smst_buffer[8];
extended_cif ecif;
ecif.cif = cif;
@ -121,8 +122,9 @@ ffi_call_int (ffi_cif *cif,
# endif
/* The SYSV ABI returns a structure of up to 8 bytes in size
left-padded in r3/r4, and the ELFv2 ABI similarly returns a
structure of up to 8 bytes in size left-padded in r3. */
if (rsize <= 8)
structure of up to 8 bytes in size left-padded in r3. But
note that a structure of a single float is not paddded. */
if (rsize <= 8 && (cif->flags & FLAG_RETURNS_FP) == 0)
memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize);
else
#endif

View File

@ -38,7 +38,8 @@
/* About the LINUX64 ABI. */
enum {
NUM_GPR_ARG_REGISTERS64 = 8,
NUM_FPR_ARG_REGISTERS64 = 13
NUM_FPR_ARG_REGISTERS64 = 13,
NUM_VEC_ARG_REGISTERS64 = 12,
};
enum { ASM_NEEDS_REGISTERS64 = 4 };
@ -63,10 +64,31 @@ ffi_prep_types_linux64 (ffi_abi abi)
static unsigned int
discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
discover_homogeneous_aggregate (ffi_abi abi,
const ffi_type *t,
unsigned int *elnum)
{
switch (t->type)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
/* 64-bit long doubles are equivalent to doubles. */
if ((abi & FFI_LINUX_LONG_DOUBLE_128) == 0)
{
*elnum = 1;
return FFI_TYPE_DOUBLE;
}
/* IBM extended precision values use unaligned pairs
of FPRs, but according to the ABI must be considered
distinct from doubles. They are also limited to a
maximum of four members in a homogeneous aggregate. */
else if ((abi & FFI_LINUX_LONG_DOUBLE_IEEE128) == 0)
{
*elnum = 2;
return FFI_TYPE_LONGDOUBLE;
}
/* Fall through. */
#endif
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
*elnum = 1;
@ -79,7 +101,7 @@ discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
while (*el)
{
unsigned int el_elt, el_elnum = 0;
el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
el_elt = discover_homogeneous_aggregate (abi, *el, &el_elnum);
if (el_elt == 0
|| (base_elt && base_elt != el_elt))
return 0;
@ -110,13 +132,23 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
{
ffi_type **ptr;
unsigned bytes;
unsigned i, fparg_count = 0, intarg_count = 0;
unsigned i, fparg_count = 0, intarg_count = 0, vecarg_count = 0;
unsigned flags = cif->flags;
unsigned int elt, elnum;
unsigned elt, elnum, rtype;
#if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE
/* If compiled without long double support.. */
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
/* If compiled without long double support... */
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0 ||
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
return FFI_BAD_ABI;
#elif !defined(__VEC__)
/* If compiled without vector register support (used by assembly)... */
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
return FFI_BAD_ABI;
#else
/* If the IEEE128 flag is set, but long double is only 64 bits wide... */
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0 &&
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
return FFI_BAD_ABI;
#endif
@ -138,10 +170,19 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
#endif
/* Return value handling. */
switch (cif->rtype->type)
rtype = cif->rtype->type;
#if _CALL_ELF == 2
homogeneous:
#endif
switch (rtype)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
flags |= FLAG_RETURNS_VEC;
break;
}
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
flags |= FLAG_RETURNS_128BITS;
/* Fall through. */
@ -164,19 +205,18 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
case FFI_TYPE_STRUCT:
#if _CALL_ELF == 2
elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
elt = discover_homogeneous_aggregate (cif->abi, cif->rtype, &elnum);
if (elt)
{
if (elt == FFI_TYPE_DOUBLE)
flags |= FLAG_RETURNS_64BITS;
flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST;
break;
}
{
flags |= FLAG_RETURNS_SMST;
rtype = elt;
goto homogeneous;
}
if (cif->rtype->size <= 16)
{
flags |= FLAG_RETURNS_SMST;
break;
}
{
flags |= FLAG_RETURNS_SMST;
break;
}
#endif
intarg_count++;
flags |= FLAG_RETVAL_REFERENCE;
@ -198,6 +238,15 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
vecarg_count++;
/* Align to 16 bytes, plus the 16-byte argument. */
intarg_count = (intarg_count + 3) & ~0x1;
if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
flags |= FLAG_ARG_NEEDS_PSAVE;
break;
}
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
{
fparg_count++;
@ -224,7 +273,18 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
intarg_count = FFI_ALIGN (intarg_count, align);
}
intarg_count += ((*ptr)->size + 7) / 8;
elt = discover_homogeneous_aggregate (*ptr, &elnum);
elt = discover_homogeneous_aggregate (cif->abi, *ptr, &elnum);
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
if (elt == FFI_TYPE_LONGDOUBLE &&
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
vecarg_count += elnum;
if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
flags |= FLAG_ARG_NEEDS_PSAVE;
break;
}
else
#endif
if (elt)
{
fparg_count += elnum;
@ -263,10 +323,17 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
flags |= FLAG_FP_ARGUMENTS;
if (intarg_count > 4)
flags |= FLAG_4_GPR_ARGUMENTS;
if (vecarg_count != 0)
flags |= FLAG_VEC_ARGUMENTS;
/* Space for the FPR registers, if needed. */
if (fparg_count != 0)
bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
/* Space for the vector registers, if needed, aligned to 16 bytes. */
if (vecarg_count != 0) {
bytes = (bytes + 15) & ~0xF;
bytes += NUM_VEC_ARG_REGISTERS64 * sizeof (float128);
}
/* Stack space. */
#if _CALL_ELF == 2
@ -349,6 +416,8 @@ ffi_prep_cif_linux64_var (ffi_cif *cif,
|--------------------------------------------| |
| FPR registers f1-f13 (optional) 13*8 | |
|--------------------------------------------| |
| VEC registers v2-v13 (optional) 12*16 | |
|--------------------------------------------| |
| Parameter save area | |
|--------------------------------------------| |
| TOC save area 8 | |
@ -378,6 +447,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
unsigned long *ul;
float *f;
double *d;
float128 *f128;
size_t p;
} valp;
@ -391,11 +461,16 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
valp rest;
valp next_arg;
/* 'fpr_base' points at the space for fpr3, and grows upwards as
/* 'fpr_base' points at the space for f1, and grows upwards as
we use FPR registers. */
valp fpr_base;
unsigned int fparg_count;
/* 'vec_base' points at the space for v2, and grows upwards as
we use vector registers. */
valp vec_base;
unsigned int vecarg_count;
unsigned int i, words, nargs, nfixedargs;
ffi_type **ptr;
double double_tmp;
@ -412,6 +487,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
unsigned long **ul;
float **f;
double **d;
float128 **f128;
} p_argv;
unsigned long gprvalue;
unsigned long align;
@ -426,11 +502,21 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
#endif
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
fparg_count = 0;
/* Place the vector args below the FPRs, if used, else the GPRs. */
if (ecif->cif->flags & FLAG_FP_ARGUMENTS)
vec_base.p = fpr_base.p & ~0xF;
else
vec_base.p = gpr_base.p;
vec_base.f128 -= NUM_VEC_ARG_REGISTERS64;
vecarg_count = 0;
next_arg.ul = gpr_base.ul;
/* Check that everything starts aligned properly. */
FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
FFI_ASSERT (((unsigned long) gpr_base.c & 0xF) == 0);
FFI_ASSERT (((unsigned long) gpr_end.c & 0xF) == 0);
FFI_ASSERT (((unsigned long) vec_base.c & 0xF) == 0);
FFI_ASSERT ((bytes & 0xF) == 0);
/* Deal with return values that are actually pass-by-reference. */
@ -455,6 +541,22 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
next_arg.p = FFI_ALIGN (next_arg.p, 16);
if (next_arg.ul == gpr_end.ul)
next_arg.ul = rest.ul;
if (vecarg_count < NUM_VEC_ARG_REGISTERS64 && i < nfixedargs)
*vec_base.f128++ = **p_argv.f128;
else
*next_arg.f128 = **p_argv.f128;
if (++next_arg.f128 == gpr_end.f128)
next_arg.f128 = rest.f128;
vecarg_count++;
FFI_ASSERT (__LDBL_MANT_DIG__ == 113);
FFI_ASSERT (flags & FLAG_VEC_ARGUMENTS);
break;
}
if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
{
double_tmp = (*p_argv.d)[0];
@ -492,7 +594,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
/* Fall through. */
#endif
case FFI_TYPE_DOUBLE:
#if _CALL_ELF != 2
do_double:
#endif
double_tmp = **p_argv.d;
if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
{
@ -511,7 +615,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
break;
case FFI_TYPE_FLOAT:
#if _CALL_ELF != 2
do_float:
#endif
double_tmp = **p_argv.f;
if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
{
@ -548,9 +654,13 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
if (align > 16)
align = 16;
if (align > 1)
next_arg.p = FFI_ALIGN (next_arg.p, align);
{
next_arg.p = FFI_ALIGN (next_arg.p, align);
if (next_arg.ul == gpr_end.ul)
next_arg.ul = rest.ul;
}
}
elt = discover_homogeneous_aggregate (*ptr, &elnum);
elt = discover_homogeneous_aggregate (ecif->cif->abi, *ptr, &elnum);
if (elt)
{
#if _CALL_ELF == 2
@ -558,9 +668,29 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
void *v;
float *f;
double *d;
float128 *f128;
} arg;
arg.v = *p_argv.v;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
if (elt == FFI_TYPE_LONGDOUBLE &&
(ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
do
{
if (vecarg_count < NUM_VEC_ARG_REGISTERS64
&& i < nfixedargs)
*vec_base.f128++ = *arg.f128++;
else
*next_arg.f128 = *arg.f128++;
if (++next_arg.f128 == gpr_end.f128)
next_arg.f128 = rest.f128;
vecarg_count++;
}
while (--elnum != 0);
}
else
#endif
if (elt == FFI_TYPE_FLOAT)
{
do
@ -576,11 +706,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
fparg_count++;
}
while (--elnum != 0);
if ((next_arg.p & 3) != 0)
{
if (++next_arg.f == gpr_end.f)
next_arg.f = rest.f;
}
if ((next_arg.p & 7) != 0)
if (++next_arg.f == gpr_end.f)
next_arg.f = rest.f;
}
else
do
@ -733,17 +861,20 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
void *user_data,
void *rvalue,
unsigned long *pst,
ffi_dblfl *pfr)
ffi_dblfl *pfr,
float128 *pvec)
{
/* rvalue is the pointer to space for return value in closure assembly */
/* pst is the pointer to parameter save area
(r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
/* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
/* pvec is the pointer to where v2-v13 are stored in ffi_closure_LINUX64 */
void **avalue;
ffi_type **arg_types;
unsigned long i, avn, nfixedargs;
ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
float128 *end_pvec = pvec + NUM_VEC_ARG_REGISTERS64;
unsigned long align;
avalue = alloca (cif->nargs * sizeof (void *));
@ -813,7 +944,7 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
if (align > 1)
pst = (unsigned long *) FFI_ALIGN ((size_t) pst, align);
}
elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
elt = discover_homogeneous_aggregate (cif->abi, arg_types[i], &elnum);
if (elt)
{
#if _CALL_ELF == 2
@ -822,6 +953,7 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
unsigned long *ul;
float *f;
double *d;
float128 *f128;
size_t p;
} to, from;
@ -829,6 +961,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
aggregate size is not greater than the space taken by
the registers so store back to the register/parameter
save arrays. */
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
if (elt == FFI_TYPE_LONGDOUBLE &&
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
if (pvec + elnum <= end_pvec)
to.v = pvec;
else
to.v = pst;
}
else
#endif
if (pfr + elnum <= end_pfr)
to.v = pfr;
else
@ -836,6 +979,23 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
avalue[i] = to.v;
from.ul = pst;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
if (elt == FFI_TYPE_LONGDOUBLE &&
(cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
do
{
if (pvec < end_pvec && i < nfixedargs)
*to.f128 = *pvec++;
else
*to.f128 = *from.f128;
to.f128++;
from.f128++;
}
while (--elnum != 0);
}
else
#endif
if (elt == FFI_TYPE_FLOAT)
{
do
@ -891,7 +1051,18 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
if (((unsigned long) pst & 0xF) != 0)
++pst;
if (pvec < end_pvec && i < nfixedargs)
avalue[i] = pvec++;
else
avalue[i] = pst;
pst += 2;
break;
}
else if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
{
if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
{
@ -915,7 +1086,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
/* Fall through. */
#endif
case FFI_TYPE_DOUBLE:
#if _CALL_ELF != 2
do_double:
#endif
/* On the outgoing stack all values are aligned to 8 */
/* there are 13 64bit floating point registers */
@ -930,7 +1103,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
break;
case FFI_TYPE_FLOAT:
#if _CALL_ELF != 2
do_float:
#endif
if (pfr < end_pfr && i < nfixedargs)
{
/* Float values are stored as doubles in the
@ -962,13 +1137,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
/* Tell ffi_closure_LINUX64 how to perform return type promotions. */
if ((cif->flags & FLAG_RETURNS_SMST) != 0)
{
if ((cif->flags & FLAG_RETURNS_FP) == 0)
if ((cif->flags & (FLAG_RETURNS_FP | FLAG_RETURNS_VEC)) == 0)
return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
else if ((cif->flags & FLAG_RETURNS_VEC) != 0)
return FFI_V2_TYPE_VECTOR_HOMOG;
else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
return FFI_V2_TYPE_DOUBLE_HOMOG;
else
return FFI_V2_TYPE_FLOAT_HOMOG;
}
if ((cif->flags & FLAG_RETURNS_VEC) != 0)
return FFI_V2_TYPE_VECTOR;
return cif->rtype->type;
}
#endif

View File

@ -31,22 +31,24 @@
enum {
/* The assembly depends on these exact flags. */
/* These go in cr7 */
FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */
FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */
FLAG_RETURNS_NOTHING = 1 << (31-30),
FLAG_RETURNS_FP = 1 << (31-29),
FLAG_RETURNS_64BITS = 1 << (31-28),
FLAG_RETURNS_VEC = 1 << (31-28),
/* This goes in cr6 */
FLAG_RETURNS_128BITS = 1 << (31-27),
/* These go in cr6 */
FLAG_RETURNS_64BITS = 1 << (31-27),
FLAG_RETURNS_128BITS = 1 << (31-26),
FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */
FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */
/* These go in cr1 */
FLAG_ARG_NEEDS_COPY = 1 << (31- 7), /* Used by sysv code */
FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, /* Used by linux64 code */
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
FLAG_4_GPR_ARGUMENTS = 1 << (31- 5),
FLAG_RETVAL_REFERENCE = 1 << (31- 4)
FLAG_RETVAL_REFERENCE = 1 << (31- 4),
FLAG_VEC_ARGUMENTS = 1 << (31- 3),
};
typedef union
@ -55,6 +57,14 @@ typedef union
double d;
} ffi_dblfl;
#if defined(__FLOAT128_TYPE__)
typedef _Float128 float128;
#elif defined(__FLOAT128__)
typedef __float128 float128;
#else
typedef __int128 float128;
#endif
void FFI_HIDDEN ffi_closure_SYSV (void);
void FFI_HIDDEN ffi_go_closure_sysv (void);
void FFI_HIDDEN ffi_call_SYSV(extended_cif *, void (*)(void), void *,
@ -91,4 +101,5 @@ int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_cif *,
void (*) (ffi_cif *, void *,
void **, void *),
void *, void *,
unsigned long *, ffi_dblfl *);
unsigned long *, ffi_dblfl *,
float128 *);

View File

@ -91,15 +91,19 @@ typedef enum ffi_abi {
/* This and following bits can reuse FFI_COMPAT values. */
FFI_LINUX_STRUCT_ALIGN = 1,
FFI_LINUX_LONG_DOUBLE_128 = 2,
FFI_LINUX_LONG_DOUBLE_IEEE128 = 4,
FFI_DEFAULT_ABI = (FFI_LINUX
# ifdef __STRUCT_PARM_ALIGN__
| FFI_LINUX_STRUCT_ALIGN
# endif
# ifdef __LONG_DOUBLE_128__
| FFI_LINUX_LONG_DOUBLE_128
# ifdef __LONG_DOUBLE_IEEE128__
| FFI_LINUX_LONG_DOUBLE_IEEE128
# endif
# endif
),
FFI_LAST_ABI = 12
FFI_LAST_ABI = 16
# else
/* This bit, always set in new code, must not be set in any of the
@ -167,9 +171,11 @@ typedef enum ffi_abi {
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_PPC_TYPE_LAST + 2)
/* Used by ELFv2 for homogenous structure returns. */
#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_PPC_TYPE_LAST + 1)
#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_PPC_TYPE_LAST + 2)
#define FFI_V2_TYPE_SMALL_STRUCT (FFI_PPC_TYPE_LAST + 3)
#define FFI_V2_TYPE_VECTOR (FFI_PPC_TYPE_LAST + 1)
#define FFI_V2_TYPE_VECTOR_HOMOG (FFI_PPC_TYPE_LAST + 2)
#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_PPC_TYPE_LAST + 3)
#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_PPC_TYPE_LAST + 4)
#define FFI_V2_TYPE_SMALL_STRUCT (FFI_PPC_TYPE_LAST + 5)
#if _CALL_ELF == 2
# define FFI_TRAMPOLINE_SIZE 32

View File

@ -101,40 +101,70 @@ ffi_call_LINUX64:
ld %r2, 8(%r29)
# endif
/* Now do the call. */
/* Set up cr1 with bits 4-7 of the flags. */
mtcrf 0x40, %r31
/* Set up cr1 with bits 3-7 of the flags. */
mtcrf 0xc0, %r31
/* Get the address to call into CTR. */
mtctr %r12
/* Load all those argument registers. */
ld %r3, -32-(8*8)(%r28)
ld %r4, -32-(7*8)(%r28)
ld %r5, -32-(6*8)(%r28)
ld %r6, -32-(5*8)(%r28)
addi %r29, %r28, -32-(8*8)
ld %r3, (0*8)(%r29)
ld %r4, (1*8)(%r29)
ld %r5, (2*8)(%r29)
ld %r6, (3*8)(%r29)
bf- 5, 1f
ld %r7, -32-(4*8)(%r28)
ld %r8, -32-(3*8)(%r28)
ld %r9, -32-(2*8)(%r28)
ld %r10, -32-(1*8)(%r28)
ld %r7, (4*8)(%r29)
ld %r8, (5*8)(%r29)
ld %r9, (6*8)(%r29)
ld %r10, (7*8)(%r29)
1:
/* Load all the FP registers. */
bf- 6, 2f
lfd %f1, -32-(21*8)(%r28)
lfd %f2, -32-(20*8)(%r28)
lfd %f3, -32-(19*8)(%r28)
lfd %f4, -32-(18*8)(%r28)
lfd %f5, -32-(17*8)(%r28)
lfd %f6, -32-(16*8)(%r28)
lfd %f7, -32-(15*8)(%r28)
lfd %f8, -32-(14*8)(%r28)
lfd %f9, -32-(13*8)(%r28)
lfd %f10, -32-(12*8)(%r28)
lfd %f11, -32-(11*8)(%r28)
lfd %f12, -32-(10*8)(%r28)
lfd %f13, -32-(9*8)(%r28)
addi %r29, %r29, -(14*8)
lfd %f1, ( 1*8)(%r29)
lfd %f2, ( 2*8)(%r29)
lfd %f3, ( 3*8)(%r29)
lfd %f4, ( 4*8)(%r29)
lfd %f5, ( 5*8)(%r29)
lfd %f6, ( 6*8)(%r29)
lfd %f7, ( 7*8)(%r29)
lfd %f8, ( 8*8)(%r29)
lfd %f9, ( 9*8)(%r29)
lfd %f10, (10*8)(%r29)
lfd %f11, (11*8)(%r29)
lfd %f12, (12*8)(%r29)
lfd %f13, (13*8)(%r29)
2:
/* Load all the vector registers. */
bf- 3, 3f
addi %r29, %r29, -16
lvx %v13, 0, %r29
addi %r29, %r29, -16
lvx %v12, 0, %r29
addi %r29, %r29, -16
lvx %v11, 0, %r29
addi %r29, %r29, -16
lvx %v10, 0, %r29
addi %r29, %r29, -16
lvx %v9, 0, %r29
addi %r29, %r29, -16
lvx %v8, 0, %r29
addi %r29, %r29, -16
lvx %v7, 0, %r29
addi %r29, %r29, -16
lvx %v6, 0, %r29
addi %r29, %r29, -16
lvx %v5, 0, %r29
addi %r29, %r29, -16
lvx %v4, 0, %r29
addi %r29, %r29, -16
lvx %v3, 0, %r29
addi %r29, %r29, -16
lvx %v2, 0, %r29
3:
/* Make the call. */
ld %r11, 8(%r28)
bctrl
@ -152,6 +182,7 @@ ffi_call_LINUX64:
bt 31, .Lstruct_return_value
bt 30, .Ldone_return_value
bt 29, .Lfp_return_value
bt 28, .Lvec_return_value
std %r3, 0(%r30)
/* Fall through... */
@ -167,12 +198,16 @@ ffi_call_LINUX64:
ld %r31, -8(%r1)
blr
.Lvec_return_value:
stvx %v2, 0, %r30
b .Ldone_return_value
.Lfp_return_value:
.cfi_def_cfa_register 28
bf 28, .Lfloat_return_value
stfd %f1, 0(%r30)
mtcrf 0x02, %r31 /* cr6 */
bf 27, .Ldone_return_value
bf 27, .Lfloat_return_value
stfd %f1, 0(%r30)
bf 26, .Ldone_return_value
stfd %f2, 8(%r30)
b .Ldone_return_value
.Lfloat_return_value:
@ -180,8 +215,9 @@ ffi_call_LINUX64:
b .Ldone_return_value
.Lstruct_return_value:
bf 29, .Lsmall_struct
bf 28, .Lfloat_homog_return_value
bf 29, .Lvec_homog_or_small_struct
mtcrf 0x02, %r31 /* cr6 */
bf 27, .Lfloat_homog_return_value
stfd %f1, 0(%r30)
stfd %f2, 8(%r30)
stfd %f3, 16(%r30)
@ -203,6 +239,25 @@ ffi_call_LINUX64:
stfs %f8, 28(%r30)
b .Ldone_return_value
.Lvec_homog_or_small_struct:
bf 28, .Lsmall_struct
stvx %v2, 0, %r30
addi %r30, %r30, 16
stvx %v3, 0, %r30
addi %r30, %r30, 16
stvx %v4, 0, %r30
addi %r30, %r30, 16
stvx %v5, 0, %r30
addi %r30, %r30, 16
stvx %v6, 0, %r30
addi %r30, %r30, 16
stvx %v7, 0, %r30
addi %r30, %r30, 16
stvx %v8, 0, %r30
addi %r30, %r30, 16
stvx %v9, 0, %r30
b .Ldone_return_value
.Lsmall_struct:
std %r3, 0(%r30)
std %r4, 8(%r30)

View File

@ -61,9 +61,15 @@ ffi_closure_LINUX64:
# endif
# if _CALL_ELF == 2
# 32 byte special reg save area + 64 byte parm save area
# + 64 byte retval area + 13*8 fpr save area + round to 16
# define STACKFRAME 272
# ifdef __VEC__
# 32 byte special reg save area + 64 byte parm save area
# + 128 byte retval area + 13*8 fpr save area + 12*16 vec save area + round to 16
# define STACKFRAME 528
# else
# 32 byte special reg save area + 64 byte parm save area
# + 64 byte retval area + 13*8 fpr save area + round to 16
# define STACKFRAME 272
# endif
# define PARMSAVE 32
# define RETVAL PARMSAVE+64
# else
@ -143,9 +149,38 @@ ffi_closure_LINUX64:
stfd %f12, -104+(11*8)(%r1)
stfd %f13, -104+(12*8)(%r1)
# load up the pointer to the saved fpr registers */
# load up the pointer to the saved fpr registers
addi %r8, %r1, -104
# ifdef __VEC__
# load up the pointer to the saved vector registers
# 8 bytes padding for 16-byte alignment at -112(%r1)
addi %r9, %r8, -24
stvx %v13, 0, %r9
addi %r9, %r9, -16
stvx %v12, 0, %r9
addi %r9, %r9, -16
stvx %v11, 0, %r9
addi %r9, %r9, -16
stvx %v10, 0, %r9
addi %r9, %r9, -16
stvx %v9, 0, %r9
addi %r9, %r9, -16
stvx %v8, 0, %r9
addi %r9, %r9, -16
stvx %v7, 0, %r9
addi %r9, %r9, -16
stvx %v6, 0, %r9
addi %r9, %r9, -16
stvx %v5, 0, %r9
addi %r9, %r9, -16
stvx %v4, 0, %r9
addi %r9, %r9, -16
stvx %v3, 0, %r9
addi %r9, %r9, -16
stvx %v2, 0, %r9
# endif
# load up the pointer to the result storage
addi %r6, %r1, -STACKFRAME+RETVAL
@ -313,6 +348,16 @@ ffi_closure_LINUX64:
.cfi_def_cfa_offset 0
blr
.cfi_def_cfa_offset STACKFRAME
# case FFI_V2_TYPE_VECTOR
addi %r3, %r1, RETVAL
lvx %v2, 0, %r3
mtlr %r0
b .Lfinish
# case FFI_V2_TYPE_VECTOR_HOMOG
addi %r3, %r1, RETVAL
lvx %v2, 0, %r3
addi %r3, %r3, 16
b .Lmorevector
# case FFI_V2_TYPE_FLOAT_HOMOG
lfs %f1, RETVAL+0(%r1)
lfs %f2, RETVAL+4(%r1)
@ -332,6 +377,25 @@ ffi_closure_LINUX64:
.cfi_def_cfa_offset 0
blr
.cfi_def_cfa_offset STACKFRAME
.Lmorevector:
lvx %v3, 0, %r3
addi %r3, %r3, 16
lvx %v4, 0, %r3
addi %r3, %r3, 16
lvx %v5, 0, %r3
mtlr %r0
addi %r3, %r3, 16
lvx %v6, 0, %r3
addi %r3, %r3, 16
lvx %v7, 0, %r3
addi %r3, %r3, 16
lvx %v8, 0, %r3
addi %r3, %r3, 16
lvx %v9, 0, %r3
addi %r1, %r1, STACKFRAME
.cfi_def_cfa_offset 0
blr
.cfi_def_cfa_offset STACKFRAME
.Lmorefloat:
lfs %f4, RETVAL+12(%r1)
mtlr %r0

View File

@ -129,7 +129,9 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
cif->rtype = rtype;
cif->flags = 0;
#ifdef _M_ARM64
cif->is_variadic = isvariadic;
#endif
#if HAVE_LONG_DOUBLE_VARIANT
ffi_prep_types (abi);
#endif
@ -199,7 +201,7 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
bytes = 6*4;
#endif
bytes += STACK_ARG_SIZE((*ptr)->size);
bytes += (unsigned int)STACK_ARG_SIZE((*ptr)->size);
}
#endif
}

View File

@ -29,7 +29,7 @@
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifdef __i386__
#if defined(__i386__) || defined(_M_IX86)
#include <ffi.h>
#include <ffi_common.h>
#include <stdint.h>
@ -51,6 +51,13 @@
# define __declspec(x) __attribute__((x))
#endif
#if defined(_MSC_VER) && defined(_M_IX86)
/* Stack is not 16-byte aligned on Windows. */
#define STACK_ALIGN(bytes) (bytes)
#else
#define STACK_ALIGN(bytes) FFI_ALIGN (bytes, 16)
#endif
/* Perform machine dependent cif processing. */
ffi_status FFI_HIDDEN
ffi_prep_cif_machdep(ffi_cif *cif)
@ -177,7 +184,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
bytes = FFI_ALIGN (bytes, t->alignment);
bytes += FFI_ALIGN (t->size, FFI_SIZEOF_ARG);
}
cif->bytes = FFI_ALIGN (bytes, 16);
cif->bytes = bytes;
return FFI_OK;
}
@ -285,7 +292,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
}
}
bytes = cif->bytes;
bytes = STACK_ALIGN (cif->bytes);
stack = alloca(bytes + sizeof(*frame) + rsize);
argp = (dir < 0 ? stack + bytes : stack);
frame = (struct call_frame *)(stack + bytes);
@ -431,7 +438,7 @@ ffi_closure_inner (struct closure_frame *frame, char *stack)
rvalue = frame->rettemp;
pabi = &abi_params[cabi];
dir = pabi->dir;
argp = (dir < 0 ? stack + cif->bytes : stack);
argp = (dir < 0 ? stack + STACK_ALIGN (cif->bytes) : stack);
switch (flags)
{
@ -699,7 +706,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *avalue)
}
}
bytes = cif->bytes;
bytes = STACK_ALIGN (cif->bytes);
argp = stack =
(void *)((uintptr_t)alloca(bytes + sizeof(*frame) + rsize + 15) & ~16);
frame = (struct call_frame *)(stack + bytes);

View File

@ -451,9 +451,11 @@ ffi_prep_cif_machdep (ffi_cif *cif)
case FFI_TYPE_DOUBLE:
flags = UNIX64_RET_XMM64;
break;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
flags = UNIX64_RET_X87;
break;
#endif
case FFI_TYPE_STRUCT:
n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse);
if (n == 0)

View File

@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifdef __x86_64__
#if defined(__x86_64__) || defined(_M_AMD64)
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>

View File

@ -794,7 +794,7 @@ ENDF(C(ffi_closure_raw_THISCALL))
# define COMDAT(X) \
.section __TEXT,__text,coalesced,pure_instructions; \
.weak_definition X; \
.private_extern X
FFI_HIDDEN(X)
#elif defined __ELF__ && !(defined(__sun__) && defined(__svr4__))
# define COMDAT(X) \
.section .text.X,"axG",@progbits,X,comdat; \

995
src/x86/sysv_intel.S Normal file
View File

@ -0,0 +1,995 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 2017 Anthony Green
- Copyright (c) 2013 The Written Word, Inc.
- Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc.
X86 Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifndef __x86_64__
#ifdef _MSC_VER
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_cfi.h>
#include "internal.h"
#define C2(X, Y) X ## Y
#define C1(X, Y) C2(X, Y)
#define L(X) C1(L, X)
# define ENDF(X) X ENDP
/* This macro allows the safe creation of jump tables without an
actual table. The entry points into the table are all 8 bytes.
The use of ORG asserts that we're at the correct location. */
/* ??? The clang assembler doesn't handle .org with symbolic expressions. */
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
# define E(BASE, X) ALIGN 8
#else
# define E(BASE, X) ALIGN 8; ORG BASE + X * 8
#endif
.686P
.MODEL FLAT
EXTRN @ffi_closure_inner@8:PROC
_TEXT SEGMENT
/* This is declared as
void ffi_call_i386(struct call_frame *frame, char *argp)
__attribute__((fastcall));
Thus the arguments are present in
ecx: frame
edx: argp
*/
ALIGN 16
PUBLIC @ffi_call_i386@8
@ffi_call_i386@8 PROC
L(UW0):
cfi_startproc
#if !HAVE_FASTCALL
mov ecx, [esp+4]
mov edx, [esp+8]
#endif
mov eax, [esp] /* move the return address */
mov [ecx], ebp /* store ebp into local frame */
mov [ecx+4], eax /* store retaddr into local frame */
/* New stack frame based off ebp. This is a itty bit of unwind
trickery in that the CFA *has* changed. There is no easy way
to describe it correctly on entry to the function. Fortunately,
it doesn't matter too much since at all points we can correctly
unwind back to ffi_call. Note that the location to which we
moved the return address is (the new) CFA-4, so from the
perspective of the unwind info, it hasn't moved. */
mov ebp, ecx
L(UW1):
// cfi_def_cfa(%ebp, 8)
// cfi_rel_offset(%ebp, 0)
mov esp, edx /* set outgoing argument stack */
mov eax, [20+R_EAX*4+ebp] /* set register arguments */
mov edx, [20+R_EDX*4+ebp]
mov ecx, [20+R_ECX*4+ebp]
call dword ptr [ebp+8]
mov ecx, [12+ebp] /* load return type code */
mov [ebp+8], ebx /* preserve %ebx */
L(UW2):
// cfi_rel_offset(%ebx, 8)
and ecx, X86_RET_TYPE_MASK
lea ebx, [L(store_table) + ecx * 8]
mov ecx, [ebp+16] /* load result address */
jmp ebx
ALIGN 8
L(store_table):
E(L(store_table), X86_RET_FLOAT)
fstp DWORD PTR [ecx]
jmp L(e1)
E(L(store_table), X86_RET_DOUBLE)
fstp QWORD PTR [ecx]
jmp L(e1)
E(L(store_table), X86_RET_LDOUBLE)
fstp QWORD PTR [ecx]
jmp L(e1)
E(L(store_table), X86_RET_SINT8)
movsx eax, al
mov [ecx], eax
jmp L(e1)
E(L(store_table), X86_RET_SINT16)
movsx eax, ax
mov [ecx], eax
jmp L(e1)
E(L(store_table), X86_RET_UINT8)
movzx eax, al
mov [ecx], eax
jmp L(e1)
E(L(store_table), X86_RET_UINT16)
movzx eax, ax
mov [ecx], eax
jmp L(e1)
E(L(store_table), X86_RET_INT64)
mov [ecx+4], edx
/* fallthru */
E(L(store_table), X86_RET_int 32)
mov [ecx], eax
/* fallthru */
E(L(store_table), X86_RET_VOID)
L(e1):
mov ebx, [ebp+8]
mov esp, ebp
pop ebp
L(UW3):
// cfi_remember_state
// cfi_def_cfa(%esp, 4)
// cfi_restore(%ebx)
// cfi_restore(%ebp)
ret
L(UW4):
// cfi_restore_state
E(L(store_table), X86_RET_STRUCTPOP)
jmp L(e1)
E(L(store_table), X86_RET_STRUCTARG)
jmp L(e1)
E(L(store_table), X86_RET_STRUCT_1B)
mov [ecx], al
jmp L(e1)
E(L(store_table), X86_RET_STRUCT_2B)
mov [ecx], ax
jmp L(e1)
/* Fill out the table so that bad values are predictable. */
E(L(store_table), X86_RET_UNUSED14)
int 3
E(L(store_table), X86_RET_UNUSED15)
int 3
L(UW5):
// cfi_endproc
ENDF(@ffi_call_i386@8)
/* The inner helper is declared as
void ffi_closure_inner(struct closure_frame *frame, char *argp)
__attribute_((fastcall))
Thus the arguments are placed in
ecx: frame
edx: argp
*/
/* Macros to help setting up the closure_data structure. */
#if HAVE_FASTCALL
# define closure_FS (40 + 4)
# define closure_CF 0
#else
# define closure_FS (8 + 40 + 12)
# define closure_CF 8
#endif
FFI_CLOSURE_SAVE_REGS MACRO
mov [esp + closure_CF+16+R_EAX*4], eax
mov [esp + closure_CF+16+R_EDX*4], edx
mov [esp + closure_CF+16+R_ECX*4], ecx
ENDM
FFI_CLOSURE_COPY_TRAMP_DATA MACRO
mov edx, [eax+FFI_TRAMPOLINE_SIZE] /* copy cif */
mov ecx, [eax+FFI_TRAMPOLINE_SIZE+4] /* copy fun */
mov eax, [eax+FFI_TRAMPOLINE_SIZE+8]; /* copy user_data */
mov [esp+closure_CF+28], edx
mov [esp+closure_CF+32], ecx
mov [esp+closure_CF+36], eax
ENDM
#if HAVE_FASTCALL
FFI_CLOSURE_PREP_CALL MACRO
mov ecx, esp /* load closure_data */
lea edx, [esp+closure_FS+4] /* load incoming stack */
ENDM
#else
FFI_CLOSURE_PREP_CALL MACRO
lea ecx, [esp+closure_CF] /* load closure_data */
lea edx, [esp+closure_FS+4] /* load incoming stack */
mov [esp], ecx
mov [esp+4], edx
ENDM
#endif
FFI_CLOSURE_CALL_INNER MACRO UWN
call @ffi_closure_inner@8
ENDM
FFI_CLOSURE_MASK_AND_JUMP MACRO LABEL
and eax, X86_RET_TYPE_MASK
lea edx, [LABEL+eax*8]
mov eax, [esp+closure_CF] /* optimiztic load */
jmp edx
ENDM
ALIGN 16
PUBLIC ffi_go_closure_EAX
ffi_go_closure_EAX PROC C
L(UW6):
// cfi_startproc
sub esp, closure_FS
L(UW7):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
mov edx, [eax+4] /* copy cif */
mov ecx, [eax +8] /* copy fun */
mov [esp+closure_CF+28], edx
mov [esp+closure_CF+32], ecx
mov [esp+closure_CF+36], eax /* closure is user_data */
jmp L(do_closure_i386)
L(UW8):
// cfi_endproc
ENDF(ffi_go_closure_EAX)
ALIGN 16
PUBLIC ffi_go_closure_ECX
ffi_go_closure_ECX PROC C
L(UW9):
// cfi_startproc
sub esp, closure_FS
L(UW10):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
mov edx, [ecx+4] /* copy cif */
mov eax, [ecx+8] /* copy fun */
mov [esp+closure_CF+28], edx
mov [esp+closure_CF+32], eax
mov [esp+closure_CF+36], ecx /* closure is user_data */
jmp L(do_closure_i386)
L(UW11):
// cfi_endproc
ENDF(ffi_go_closure_ECX)
/* The closure entry points are reached from the ffi_closure trampoline.
On entry, %eax contains the address of the ffi_closure. */
ALIGN 16
PUBLIC ffi_closure_i386
ffi_closure_i386 PROC C
L(UW12):
// cfi_startproc
sub esp, closure_FS
L(UW13):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closures. */
L(do_closure_i386)::
FFI_CLOSURE_PREP_CALL
FFI_CLOSURE_CALL_INNER(14)
FFI_CLOSURE_MASK_AND_JUMP L(C1(load_table,2))
ALIGN 8
L(load_table2):
E(L(load_table2), X86_RET_FLOAT)
fld dword ptr [esp+closure_CF]
jmp L(e2)
E(L(load_table2), X86_RET_DOUBLE)
fld qword ptr [esp+closure_CF]
jmp L(e2)
E(L(load_table2), X86_RET_LDOUBLE)
fld qword ptr [esp+closure_CF]
jmp L(e2)
E(L(load_table2), X86_RET_SINT8)
movsx eax, al
jmp L(e2)
E(L(load_table2), X86_RET_SINT16)
movsx eax, ax
jmp L(e2)
E(L(load_table2), X86_RET_UINT8)
movzx eax, al
jmp L(e2)
E(L(load_table2), X86_RET_UINT16)
movzx eax, ax
jmp L(e2)
E(L(load_table2), X86_RET_INT64)
mov edx, [esp+closure_CF+4]
jmp L(e2)
E(L(load_table2), X86_RET_INT32)
nop
/* fallthru */
E(L(load_table2), X86_RET_VOID)
L(e2):
add esp, closure_FS
L(UW16):
// cfi_adjust_cfa_offset(-closure_FS)
ret
L(UW17):
// cfi_adjust_cfa_offset(closure_FS)
E(L(load_table2), X86_RET_STRUCTPOP)
add esp, closure_FS
L(UW18):
// cfi_adjust_cfa_offset(-closure_FS)
ret 4
L(UW19):
// cfi_adjust_cfa_offset(closure_FS)
E(L(load_table2), X86_RET_STRUCTARG)
jmp L(e2)
E(L(load_table2), X86_RET_STRUCT_1B)
movzx eax, al
jmp L(e2)
E(L(load_table2), X86_RET_STRUCT_2B)
movzx eax, ax
jmp L(e2)
/* Fill out the table so that bad values are predictable. */
E(L(load_table2), X86_RET_UNUSED14)
int 3
E(L(load_table2), X86_RET_UNUSED15)
int 3
L(UW20):
// cfi_endproc
ENDF(ffi_closure_i386)
ALIGN 16
PUBLIC ffi_go_closure_STDCALL
ffi_go_closure_STDCALL PROC C
L(UW21):
// cfi_startproc
sub esp, closure_FS
L(UW22):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
mov edx, [ecx+4] /* copy cif */
mov eax, [ecx+8] /* copy fun */
mov [esp+closure_CF+28], edx
mov [esp+closure_CF+32], eax
mov [esp+closure_CF+36], ecx /* closure is user_data */
jmp L(do_closure_STDCALL)
L(UW23):
// cfi_endproc
ENDF(ffi_go_closure_STDCALL)
/* For REGISTER, we have no available parameter registers, and so we
enter here having pushed the closure onto the stack. */
ALIGN 16
PUBLIC ffi_closure_REGISTER
ffi_closure_REGISTER PROC C
L(UW24):
// cfi_startproc
// cfi_def_cfa(%esp, 8)
// cfi_offset(%eip, -8)
sub esp, closure_FS-4
L(UW25):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
mov ecx, [esp+closure_FS-4] /* load retaddr */
mov eax, [esp+closure_FS] /* load closure */
mov [esp+closure_FS], ecx /* move retaddr */
jmp L(do_closure_REGISTER)
L(UW26):
// cfi_endproc
ENDF(ffi_closure_REGISTER)
/* For STDCALL (and others), we need to pop N bytes of arguments off
the stack following the closure. The amount needing to be popped
is returned to us from ffi_closure_inner. */
ALIGN 16
PUBLIC ffi_closure_STDCALL
ffi_closure_STDCALL PROC C
L(UW27):
// cfi_startproc
sub esp, closure_FS
L(UW28):
// cfi_def_cfa_offset(closure_FS + 4)
FFI_CLOSURE_SAVE_REGS
/* Entry point from ffi_closure_REGISTER. */
L(do_closure_REGISTER)::
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closure. */
L(do_closure_STDCALL)::
FFI_CLOSURE_PREP_CALL
FFI_CLOSURE_CALL_INNER(29)
mov ecx, eax
shr ecx, X86_RET_POP_SHIFT /* isolate pop count */
lea ecx, [esp+closure_FS+ecx] /* compute popped esp */
mov edx, [esp+closure_FS] /* move return address */
mov [ecx], edx
/* From this point on, the value of %esp upon return is %ecx+4,
and we've copied the return address to %ecx to make return easy.
There's no point in representing this in the unwind info, as
there is always a window between the mov and the ret which
will be wrong from one point of view or another. */
FFI_CLOSURE_MASK_AND_JUMP L(C1(load_table,3))
ALIGN 8
L(load_table3):
E(L(load_table3), X86_RET_FLOAT)
fld DWORD PTR [esp+closure_CF]
mov esp, ecx
ret
E(L(load_table3), X86_RET_DOUBLE)
fld QWORD PTR [esp+closure_CF]
mov esp, ecx
ret
E(L(load_table3), X86_RET_LDOUBLE)
fld QWORD PTR [esp+closure_CF]
mov esp, ecx
ret
E(L(load_table3), X86_RET_SINT8)
movsx eax, al
mov esp, ecx
ret
E(L(load_table3), X86_RET_SINT16)
movsx eax, ax
mov esp, ecx
ret
E(L(load_table3), X86_RET_UINT8)
movzx eax, al
mov esp, ecx
ret
E(L(load_table3), X86_RET_UINT16)
movzx eax, ax
mov esp, ecx
ret
E(L(load_table3), X86_RET_INT64)
mov edx, [esp+closure_CF+4]
mov esp, ecx
ret
E(L(load_table3), X86_RET_int 32)
mov esp, ecx
ret
E(L(load_table3), X86_RET_VOID)
mov esp, ecx
ret
E(L(load_table3), X86_RET_STRUCTPOP)
mov esp, ecx
ret
E(L(load_table3), X86_RET_STRUCTARG)
mov esp, ecx
ret
E(L(load_table3), X86_RET_STRUCT_1B)
movzx eax, al
mov esp, ecx
ret
E(L(load_table3), X86_RET_STRUCT_2B)
movzx eax, ax
mov esp, ecx
ret
/* Fill out the table so that bad values are predictable. */
E(L(load_table3), X86_RET_UNUSED14)
int 3
E(L(load_table3), X86_RET_UNUSED15)
int 3
L(UW31):
// cfi_endproc
ENDF(ffi_closure_STDCALL)
#if !FFI_NO_RAW_API
#define raw_closure_S_FS (16+16+12)
ALIGN 16
PUBLIC ffi_closure_raw_SYSV
ffi_closure_raw_SYSV PROC C
L(UW32):
// cfi_startproc
sub esp, raw_closure_S_FS
L(UW33):
// cfi_def_cfa_offset(raw_closure_S_FS + 4)
mov [esp+raw_closure_S_FS-4], ebx
L(UW34):
// cfi_rel_offset(%ebx, raw_closure_S_FS-4)
mov edx, [eax+FFI_TRAMPOLINE_SIZE+8] /* load cl->user_data */
mov [esp+12], edx
lea edx, [esp+raw_closure_S_FS+4] /* load raw_args */
mov [esp+8], edx
lea edx, [esp+16] /* load &res */
mov [esp+4], edx
mov ebx, [eax+FFI_TRAMPOLINE_SIZE] /* load cl->cif */
mov [esp], ebx
call DWORD PTR [eax+FFI_TRAMPOLINE_SIZE+4] /* call cl->fun */
mov eax, [ebx+20] /* load cif->flags */
and eax, X86_RET_TYPE_MASK
// #ifdef __PIC__
// call __x86.get_pc_thunk.bx
// L(pc4):
// lea ecx, L(load_table4)-L(pc4)(%ebx, %eax, 8), %ecx
// #else
lea ecx, [L(load_table4)+eax+8]
// #endif
mov ebx, [esp+raw_closure_S_FS-4]
L(UW35):
// cfi_restore(%ebx)
mov eax, [esp+16] /* Optimistic load */
jmp dword ptr [ecx]
ALIGN 8
L(load_table4):
E(L(load_table4), X86_RET_FLOAT)
fld DWORD PTR [esp +16]
jmp L(e4)
E(L(load_table4), X86_RET_DOUBLE)
fld QWORD PTR [esp +16]
jmp L(e4)
E(L(load_table4), X86_RET_LDOUBLE)
fld QWORD PTR [esp +16]
jmp L(e4)
E(L(load_table4), X86_RET_SINT8)
movsx eax, al
jmp L(e4)
E(L(load_table4), X86_RET_SINT16)
movsx eax, ax
jmp L(e4)
E(L(load_table4), X86_RET_UINT8)
movzx eax, al
jmp L(e4)
E(L(load_table4), X86_RET_UINT16)
movzx eax, ax
jmp L(e4)
E(L(load_table4), X86_RET_INT64)
mov edx, [esp+16+4]
jmp L(e4)
E(L(load_table4), X86_RET_int 32)
nop
/* fallthru */
E(L(load_table4), X86_RET_VOID)
L(e4):
add esp, raw_closure_S_FS
L(UW36):
// cfi_adjust_cfa_offset(-raw_closure_S_FS)
ret
L(UW37):
// cfi_adjust_cfa_offset(raw_closure_S_FS)
E(L(load_table4), X86_RET_STRUCTPOP)
add esp, raw_closure_S_FS
L(UW38):
// cfi_adjust_cfa_offset(-raw_closure_S_FS)
ret 4
L(UW39):
// cfi_adjust_cfa_offset(raw_closure_S_FS)
E(L(load_table4), X86_RET_STRUCTARG)
jmp L(e4)
E(L(load_table4), X86_RET_STRUCT_1B)
movzx eax, al
jmp L(e4)
E(L(load_table4), X86_RET_STRUCT_2B)
movzx eax, ax
jmp L(e4)
/* Fill out the table so that bad values are predictable. */
E(L(load_table4), X86_RET_UNUSED14)
int 3
E(L(load_table4), X86_RET_UNUSED15)
int 3
L(UW40):
// cfi_endproc
ENDF(ffi_closure_raw_SYSV)
#define raw_closure_T_FS (16+16+8)
ALIGN 16
PUBLIC ffi_closure_raw_THISCALL
ffi_closure_raw_THISCALL PROC C
L(UW41):
// cfi_startproc
/* Rearrange the stack such that %ecx is the first argument.
This means moving the return address. */
pop edx
L(UW42):
// cfi_def_cfa_offset(0)
// cfi_register(%eip, %edx)
push ecx
L(UW43):
// cfi_adjust_cfa_offset(4)
push edx
L(UW44):
// cfi_adjust_cfa_offset(4)
// cfi_rel_offset(%eip, 0)
sub esp, raw_closure_T_FS
L(UW45):
// cfi_adjust_cfa_offset(raw_closure_T_FS)
mov [esp+raw_closure_T_FS-4], ebx
L(UW46):
// cfi_rel_offset(%ebx, raw_closure_T_FS-4)
mov edx, [eax+FFI_TRAMPOLINE_SIZE+8] /* load cl->user_data */
mov [esp+12], edx
lea edx, [esp+raw_closure_T_FS+4] /* load raw_args */
mov [esp+8], edx
lea edx, [esp+16] /* load &res */
mov [esp+4], edx
mov ebx, [eax+FFI_TRAMPOLINE_SIZE] /* load cl->cif */
mov [esp], ebx
call DWORD PTR [eax+FFI_TRAMPOLINE_SIZE+4] /* call cl->fun */
mov eax, [ebx+20] /* load cif->flags */
and eax, X86_RET_TYPE_MASK
// #ifdef __PIC__
// call __x86.get_pc_thunk.bx
// L(pc5):
// leal L(load_table5)-L(pc5)(%ebx, %eax, 8), %ecx
// #else
lea ecx, [L(load_table5)+eax*8]
//#endif
mov ebx, [esp+raw_closure_T_FS-4]
L(UW47):
// cfi_restore(%ebx)
mov eax, [esp+16] /* Optimistic load */
jmp DWORD PTR [ecx]
AlIGN 4
L(load_table5):
E(L(load_table5), X86_RET_FLOAT)
fld DWORD PTR [esp +16]
jmp L(e5)
E(L(load_table5), X86_RET_DOUBLE)
fld QWORD PTR [esp +16]
jmp L(e5)
E(L(load_table5), X86_RET_LDOUBLE)
fld QWORD PTR [esp+16]
jmp L(e5)
E(L(load_table5), X86_RET_SINT8)
movsx eax, al
jmp L(e5)
E(L(load_table5), X86_RET_SINT16)
movsx eax, ax
jmp L(e5)
E(L(load_table5), X86_RET_UINT8)
movzx eax, al
jmp L(e5)
E(L(load_table5), X86_RET_UINT16)
movzx eax, ax
jmp L(e5)
E(L(load_table5), X86_RET_INT64)
mov edx, [esp+16+4]
jmp L(e5)
E(L(load_table5), X86_RET_int 32)
nop
/* fallthru */
E(L(load_table5), X86_RET_VOID)
L(e5):
add esp, raw_closure_T_FS
L(UW48):
// cfi_adjust_cfa_offset(-raw_closure_T_FS)
/* Remove the extra %ecx argument we pushed. */
ret 4
L(UW49):
// cfi_adjust_cfa_offset(raw_closure_T_FS)
E(L(load_table5), X86_RET_STRUCTPOP)
add esp, raw_closure_T_FS
L(UW50):
// cfi_adjust_cfa_offset(-raw_closure_T_FS)
ret 8
L(UW51):
// cfi_adjust_cfa_offset(raw_closure_T_FS)
E(L(load_table5), X86_RET_STRUCTARG)
jmp L(e5)
E(L(load_table5), X86_RET_STRUCT_1B)
movzx eax, al
jmp L(e5)
E(L(load_table5), X86_RET_STRUCT_2B)
movzx eax, ax
jmp L(e5)
/* Fill out the table so that bad values are predictable. */
E(L(load_table5), X86_RET_UNUSED14)
int 3
E(L(load_table5), X86_RET_UNUSED15)
int 3
L(UW52):
// cfi_endproc
ENDF(ffi_closure_raw_THISCALL)
#endif /* !FFI_NO_RAW_API */
#ifdef X86_DARWIN
# define COMDAT(X) \
.section __TEXT,__text,coalesced,pure_instructions; \
.weak_definition X; \
FFI_HIDDEN(X)
#elif defined __ELF__ && !(defined(__sun__) && defined(__svr4__))
# define COMDAT(X) \
.section .text.X,"axG",@progbits,X,comdat; \
PUBLIC X; \
FFI_HIDDEN(X)
#else
# define COMDAT(X)
#endif
// #if defined(__PIC__)
// COMDAT(C(__x86.get_pc_thunk.bx))
// C(__x86.get_pc_thunk.bx):
// movl (%esp), %ebx
// ret
// ENDF(C(__x86.get_pc_thunk.bx))
// # if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
// COMDAT(C(__x86.get_pc_thunk.dx))
// C(__x86.get_pc_thunk.dx):
// movl (%esp), %edx
// ret
// ENDF(C(__x86.get_pc_thunk.dx))
// #endif /* DARWIN || HIDDEN */
// #endif /* __PIC__ */
#if 0
/* Sadly, OSX cctools-as doesn't understand .cfi directives at all. */
#ifdef __APPLE__
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EHFrame0:
#elif defined(X86_WIN32)
.section .eh_frame,"r"
#elif defined(HAVE_AS_X86_64_UNWIND_SECTION_TYPE)
.section .eh_frame,EH_FRAME_FLAGS,@unwind
#else
.section .eh_frame,EH_FRAME_FLAGS,@progbits
#endif
#ifdef HAVE_AS_X86_PCREL
# define PCREL(X) X - .
#else
# define PCREL(X) X@rel
#endif
/* Simplify advancing between labels. Assume DW_CFA_advance_loc1 fits. */
#define ADV(N, P) .byte 2, L(N)-L(P)
.balign 4
L(CIE):
.set L(set0),L(ECIE)-L(SCIE)
.long L(set0) /* CIE Length */
L(SCIE):
.long 0 /* CIE Identifier Tag */
.byte 1 /* CIE Version */
.ascii "zR\0" /* CIE Augmentation */
.byte 1 /* CIE Code Alignment Factor */
.byte 0x7c /* CIE Data Alignment Factor */
.byte 0x8 /* CIE RA Column */
.byte 1 /* Augmentation size */
.byte 0x1b /* FDE Encoding (pcrel sdata4) */
.byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp offset 4 */
.byte 0x80+8, 1 /* DW_CFA_offset, %eip offset 1*-4 */
.balign 4
L(ECIE):
.set L(set1),L(EFDE1)-L(SFDE1)
.long L(set1) /* FDE Length */
L(SFDE1):
.long L(SFDE1)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW0)) /* Initial location */
.long L(UW5)-L(UW0) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW1, UW0)
.byte 0xc, 5, 8 /* DW_CFA_def_cfa, %ebp 8 */
.byte 0x80+5, 2 /* DW_CFA_offset, %ebp 2*-4 */
ADV(UW2, UW1)
.byte 0x80+3, 0 /* DW_CFA_offset, %ebx 0*-4 */
ADV(UW3, UW2)
.byte 0xa /* DW_CFA_remember_state */
.byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp 4 */
.byte 0xc0+3 /* DW_CFA_restore, %ebx */
.byte 0xc0+5 /* DW_CFA_restore, %ebp */
ADV(UW4, UW3)
.byte 0xb /* DW_CFA_restore_state */
.balign 4
L(EFDE1):
.set L(set2),L(EFDE2)-L(SFDE2)
.long L(set2) /* FDE Length */
L(SFDE2):
.long L(SFDE2)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW6)) /* Initial location */
.long L(UW8)-L(UW6) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW7, UW6)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE2):
.set L(set3),L(EFDE3)-L(SFDE3)
.long L(set3) /* FDE Length */
L(SFDE3):
.long L(SFDE3)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW9)) /* Initial location */
.long L(UW11)-L(UW9) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW10, UW9)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE3):
.set L(set4),L(EFDE4)-L(SFDE4)
.long L(set4) /* FDE Length */
L(SFDE4):
.long L(SFDE4)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW12)) /* Initial location */
.long L(UW20)-L(UW12) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW13, UW12)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX
ADV(UW14, UW13)
.byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */
ADV(UW15, UW14)
.byte 0xc0+3 /* DW_CFA_restore %ebx */
ADV(UW16, UW15)
#else
ADV(UW16, UW13)
#endif
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
ADV(UW17, UW16)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
ADV(UW18, UW17)
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
ADV(UW19, UW18)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE4):
.set L(set5),L(EFDE5)-L(SFDE5)
.long L(set5) /* FDE Length */
L(SFDE5):
.long L(SFDE5)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW21)) /* Initial location */
.long L(UW23)-L(UW21) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW22, UW21)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE5):
.set L(set6),L(EFDE6)-L(SFDE6)
.long L(set6) /* FDE Length */
L(SFDE6):
.long L(SFDE6)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW24)) /* Initial location */
.long L(UW26)-L(UW24) /* Address range */
.byte 0 /* Augmentation size */
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
.byte 0x80+8, 2 /* DW_CFA_offset %eip, 2*-4 */
ADV(UW25, UW24)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE6):
.set L(set7),L(EFDE7)-L(SFDE7)
.long L(set7) /* FDE Length */
L(SFDE7):
.long L(SFDE7)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW27)) /* Initial location */
.long L(UW31)-L(UW27) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW28, UW27)
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX
ADV(UW29, UW28)
.byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */
ADV(UW30, UW29)
.byte 0xc0+3 /* DW_CFA_restore %ebx */
#endif
.balign 4
L(EFDE7):
#if !FFI_NO_RAW_API
.set L(set8),L(EFDE8)-L(SFDE8)
.long L(set8) /* FDE Length */
L(SFDE8):
.long L(SFDE8)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW32)) /* Initial location */
.long L(UW40)-L(UW32) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW33, UW32)
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
ADV(UW34, UW33)
.byte 0x80+3, 2 /* DW_CFA_offset %ebx 2*-4 */
ADV(UW35, UW34)
.byte 0xc0+3 /* DW_CFA_restore %ebx */
ADV(UW36, UW35)
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
ADV(UW37, UW36)
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
ADV(UW38, UW37)
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
ADV(UW39, UW38)
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE8):
.set L(set9),L(EFDE9)-L(SFDE9)
.long L(set9) /* FDE Length */
L(SFDE9):
.long L(SFDE9)-L(CIE) /* FDE CIE offset */
.long PCREL(L(UW41)) /* Initial location */
.long L(UW52)-L(UW41) /* Address range */
.byte 0 /* Augmentation size */
ADV(UW42, UW41)
.byte 0xe, 0 /* DW_CFA_def_cfa_offset */
.byte 0x9, 8, 2 /* DW_CFA_register %eip, %edx */
ADV(UW43, UW42)
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
ADV(UW44, UW43)
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
.byte 0x80+8, 2 /* DW_CFA_offset %eip 2*-4 */
ADV(UW45, UW44)
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
ADV(UW46, UW45)
.byte 0x80+3, 3 /* DW_CFA_offset %ebx 3*-4 */
ADV(UW47, UW46)
.byte 0xc0+3 /* DW_CFA_restore %ebx */
ADV(UW48, UW47)
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
ADV(UW49, UW48)
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
ADV(UW50, UW49)
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
ADV(UW51, UW50)
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
.balign 4
L(EFDE9):
#endif /* !FFI_NO_RAW_API */
#ifdef _WIN32
.def @feat.00;
.scl 3;
.type 0;
.endef
PUBLIC @feat.00
@feat.00 = 1
#endif
#endif /* ifndef _MSC_VER */
#endif /* ifndef __x86_64__ */
#if defined __ELF__ && defined __linux__
.section .note.GNU-stack,"",@progbits
#endif
#endif
END

View File

@ -6,109 +6,114 @@ EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
CLEANFILES = *.exe core* *.log *.sum
EXTRA_DIST = lib/target-libpath.exp lib/libffi.exp lib/wrapper.exp \
libffi.call/strlen4.c libffi.call/cls_multi_sshort.c \
libffi.call/cls_align_longdouble_split2.c libffi.call/cls_1_1byte.c \
libffi.call/struct10.c libffi.call/cls_uint_va.c \
libffi.call/many_mixed.c libffi.call/float.c libffi.call/struct5.c \
libffi.call/return_fl3.c libffi.call/cls_3_1byte.c \
libffi.call/return_fl1.c libffi.call/cls_many_mixed_args.c \
libffi.call/cls_20byte1.c libffi.call/cls_pointer_stack.c \
libffi.call/cls_align_float.c libffi.call/call.exp \
libffi.call/pyobjc-tc.c libffi.call/float_va.c \
libffi.call/cls_5_1_byte.c libffi.call/cls_9byte1.c \
libffi.call/cls_align_uint32.c libffi.call/stret_medium.c \
libffi.call/cls_3byte1.c libffi.call/cls_align_uint64.c \
libffi.call/cls_longdouble_va.c libffi.call/cls_align_pointer.c \
libffi.call/cls_19byte.c libffi.call/cls_ushort.c \
libffi.call/cls_align_sint32.c libffi.call/struct8.c \
libffi.call/pr1172638.c libffi.call/cls_ulonglong.c \
libffi.call/cls_struct_va1.c libffi.call/cls_9byte2.c \
libffi.call/closure_fn5.c libffi.call/cls_5byte.c \
libffi.call/cls_3float.c libffi.call/return_sc.c \
libffi.call/cls_schar.c libffi.call/closure_fn4.c \
libffi.call/cls_uchar_va.c libffi.call/closure_fn0.c \
libffi.call/huge_struct.c libffi.call/va_struct1.c \
libffi.call/cls_ushort_va.c libffi.call/struct9.c libffi.call/va_1.c \
libffi.call/cls_64byte.c libffi.call/va_struct2.c \
libffi.call/cls_longdouble.c libffi.call/return_fl2.c \
libffi.call/cls_ulong_va.c libffi.call/cls_6_1_byte.c \
libffi.call/cls_align_uint16.c libffi.call/closure_fn2.c \
libffi.call/align_mixed.c libffi.call/unwindtest_ffi_call.cc \
libffi.call/cls_multi_ushortchar.c libffi.call/cls_8byte.c \
libffi.call/ffitest.h libffi.call/nested_struct8.c \
libffi.call/cls_pointer.c libffi.call/nested_struct2.c \
libffi.call/nested_struct.c libffi.call/struct4.c \
libffi.call/cls_multi_schar.c libffi.call/cls_align_longdouble_split.c \
libffi.call/cls_uchar.c libffi.call/return_ldl.c \
libffi.call/nested_struct9.c libffi.call/cls_float.c \
libffi.call/stret_medium2.c libffi.call/closure_loc_fn0.c \
libffi.call/float3.c libffi.call/cls_6byte.c libffi.call/return_sl.c \
libffi.call/closure_simple.c libffi.call/return_dbl1.c \
libffi.call/cls_align_double.c libffi.call/cls_multi_uchar.c \
libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
libffi.call/closure_fn3.c libffi.call/return_ll1.c \
libffi.call/return_dbl2.c libffi.call/cls_align_sint64.c \
libffi.call/nested_struct1.c libffi.call/negint.c \
libffi.call/nested_struct3.c libffi.call/unwindtest.cc \
libffi.call/struct2.c libffi.call/struct3.c libffi.call/return_fl.c \
libffi.call/nested_struct5.c libffi.call/cls_multi_ushort.c \
libffi.call/nested_struct11.c libffi.call/cls_multi_sshortchar.c \
libffi.call/cls_align_longdouble.c libffi.call/cls_dbls_struct.c \
libffi.call/cls_many_mixed_float_double.c libffi.call/stret_large.c \
libffi.call/stret_large2.c libffi.call/cls_align_sint16.c \
libffi.call/cls_2byte.c libffi.call/offsets.c libffi.call/struct7.c \
libffi.call/nested_struct4.c libffi.call/problem1.c \
libffi.call/va_struct3.c libffi.call/testclosure.c \
libffi.call/float1.c libffi.call/nested_struct6.c \
libffi.call/cls_4byte.c libffi.call/cls_24byte.c \
libffi.call/uninitialized.c libffi.call/many2.c \
libffi.call/nested_struct10.c libffi.call/struct6.c \
libffi.call/strlen2.c libffi.call/float2.c libffi.call/cls_uint.c \
libffi.call/cls_12byte.c libffi.call/return_ul.c \
libffi.call/cls_sint.c libffi.call/cls_7_1_byte.c \
libffi.call/struct1.c libffi.call/cls_sshort.c \
libffi.call/cls_16byte.c libffi.call/strlen3.c \
libffi.call/nested_struct7.c libffi.call/cls_double_va.c \
libffi.call/return_dbl.c libffi.call/cls_3byte2.c libffi.call/float4.c \
libffi.call/cls_double.c libffi.call/many.c libffi.call/cls_7byte.c \
libffi.call/strlen.c libffi.call/closure_fn6.c libffi.call/return_uc.c \
libffi.call/closure_fn1.c libffi.call/cls_20byte.c \
libffi.call/cls_18byte.c libffi.call/err_bad_abi.c \
libffi.call/many_double.c libffi.call/return_ll.c \
libffi.call/promotion.c libffi.complex/complex_defs_longdouble.inc \
libffi.complex/cls_align_complex_float.c \
libffi.complex/cls_complex_va_float.c \
libffi.complex/cls_complex_struct_float.c \
libffi.complex/return_complex2_longdouble.c \
libffi.complex/cls_complex_float.c \
libffi.complex/return_complex_longdouble.c \
libffi.complex/return_complex2_float.c libffi.complex/cls_complex.inc \
libffi.complex/cls_complex_va_longdouble.c \
libffi.complex/return_complex_double.c \
libffi.complex/return_complex.inc libffi.complex/many_complex.inc \
libffi.complex/complex_float.c libffi.complex/cls_align_complex.inc \
libffi.complex/return_complex2_double.c \
libffi.complex/many_complex_float.c libffi.complex/ffitest.h \
libffi.complex/return_complex1_double.c \
libffi.complex/cls_complex_struct_longdouble.c \
libffi.complex/complex_defs_double.inc \
libffi.complex/cls_complex_va_double.c \
libffi.complex/many_complex_double.c \
libffi.complex/return_complex2.inc \
libffi.complex/return_complex1_float.c \
libffi.complex/complex_longdouble.c \
libffi.complex/complex_defs_float.inc \
libffi.complex/cls_complex_double.c \
libffi.complex/cls_align_complex_double.c \
libffi.complex/cls_align_complex_longdouble.c \
libffi.complex/complex_double.c libffi.complex/cls_complex_va.inc \
libffi.complex/many_complex_longdouble.c libffi.complex/complex.inc \
libffi.complex/return_complex1_longdouble.c \
libffi.complex/complex_int.c libffi.complex/cls_complex_longdouble.c \
libffi.complex/cls_complex_struct_double.c \
libffi.complex/return_complex1.inc libffi.complex/complex.exp \
libffi.complex/cls_complex_struct.inc \
libffi.complex/return_complex_float.c libffi.go/closure1.c \
libffi.go/aa-direct.c libffi.go/ffitest.h libffi.go/go.exp \
libffi.go/static-chain.h config/default.exp
EXTRA_DIST = lib/target-libpath.exp lib/libffi.exp lib/wrapper.exp \
libffi.call/strlen4.c libffi.call/struct10.c libffi.call/many_mixed.c \
libffi.call/float.c libffi.call/struct5.c libffi.call/return_fl3.c \
libffi.call/return_fl1.c libffi.call/call.exp libffi.call/pyobjc-tc.c \
libffi.call/float_va.c libffi.call/struct8.c libffi.call/pr1172638.c \
libffi.call/return_sc.c libffi.call/va_struct1.c \
libffi.call/align_stdcall.c libffi.call/struct9.c libffi.call/va_1.c \
libffi.call/va_struct2.c libffi.call/return_fl2.c \
libffi.call/align_mixed.c libffi.call/ffitest.h libffi.call/struct4.c \
libffi.call/return_ldl.c libffi.call/float3.c libffi.call/return_sl.c \
libffi.call/return_dbl1.c libffi.call/err_bad_typedef.c \
libffi.call/return_ll1.c libffi.call/return_dbl2.c \
libffi.call/negint.c libffi.closures/nested_struct3.c \
libffi.call/struct2.c libffi.call/struct3.c libffi.call/return_fl.c \
libffi.call/offsets.c libffi.call/struct7.c libffi.call/va_struct3.c \
libffi.call/float1.c libffi.call/uninitialized.c libffi.call/many2.c \
libffi.call/struct6.c libffi.call/strlen2.c libffi.call/float2.c \
libffi.call/return_ul.c libffi.call/struct1.c libffi.call/strlen3.c \
libffi.call/return_dbl.c libffi.call/float4.c libffi.call/many.c \
libffi.call/strlen.c libffi.call/return_uc.c libffi.call/many_double.c \
libffi.call/return_ll.c libffi.call/promotion.c \
libffi.complex/complex_defs_longdouble.inc \
libffi.complex/cls_align_complex_float.c \
libffi.complex/cls_complex_va_float.c \
libffi.complex/cls_complex_struct_float.c \
libffi.complex/return_complex2_longdouble.c \
libffi.complex/cls_complex_float.c \
libffi.complex/return_complex_longdouble.c \
libffi.complex/return_complex2_float.c libffi.complex/cls_complex.inc \
libffi.complex/cls_complex_va_longdouble.c \
libffi.complex/return_complex_double.c \
libffi.complex/return_complex.inc libffi.complex/many_complex.inc \
libffi.complex/complex_float.c libffi.complex/cls_align_complex.inc \
libffi.complex/return_complex2_double.c \
libffi.complex/many_complex_float.c libffi.complex/ffitest.h \
libffi.complex/return_complex1_double.c \
libffi.complex/cls_complex_struct_longdouble.c \
libffi.complex/complex_defs_double.inc \
libffi.complex/cls_complex_va_double.c \
libffi.complex/many_complex_double.c \
libffi.complex/return_complex2.inc \
libffi.complex/return_complex1_float.c \
libffi.complex/complex_longdouble.c \
libffi.complex/complex_defs_float.inc \
libffi.complex/cls_complex_double.c \
libffi.complex/cls_align_complex_double.c \
libffi.complex/cls_align_complex_longdouble.c \
libffi.complex/complex_double.c libffi.complex/cls_complex_va.inc \
libffi.complex/many_complex_longdouble.c libffi.complex/complex.inc \
libffi.complex/return_complex1_longdouble.c \
libffi.complex/complex_int.c libffi.complex/cls_complex_longdouble.c \
libffi.complex/cls_complex_struct_double.c \
libffi.complex/return_complex1.inc libffi.complex/complex.exp \
libffi.complex/cls_complex_struct.inc \
libffi.complex/return_complex_float.c libffi.go/closure1.c \
libffi.go/aa-direct.c libffi.go/ffitest.h libffi.go/go.exp \
libffi.go/static-chain.h config/default.exp \
libffi.closures/cls_multi_sshort.c \
libffi.closures/cls_align_longdouble_split2.c \
libffi.closures/cls_1_1byte.c libffi.closures/cls_uint_va.c \
libffi.closures/cls_3_1byte.c libffi.closures/cls_many_mixed_args.c \
libffi.closures/cls_20byte1.c libffi.closures/cls_pointer_stack.c \
libffi.closures/cls_align_float.c libffi.closures/cls_5_1_byte.c \
libffi.closures/cls_9byte1.c libffi.closures/cls_align_uint32.c \
libffi.closures/stret_medium.c libffi.closures/cls_3byte1.c \
libffi.closures/cls_align_uint64.c libffi.closures/cls_longdouble_va.c \
libffi.closures/cls_align_pointer.c libffi.closures/cls_19byte.c \
libffi.closures/cls_ushort.c libffi.closures/cls_align_sint32.c \
libffi.closures/cls_ulonglong.c libffi.closures/cls_struct_va1.c \
libffi.closures/cls_9byte2.c libffi.closures/closure_fn5.c \
libffi.closures/cls_5byte.c libffi.closures/cls_3float.c \
libffi.closures/closure.exp libffi.closures/cls_schar.c \
libffi.closures/closure_fn4.c libffi.closures/cls_uchar_va.c \
libffi.closures/closure_fn0.c libffi.closures/huge_struct.c \
libffi.closures/cls_ushort_va.c \
libffi.closures/cls_64byte.c libffi.closures/cls_longdouble.c \
libffi.closures/cls_ulong_va.c libffi.closures/cls_6_1_byte.c \
libffi.closures/cls_align_uint16.c libffi.closures/closure_fn2.c \
libffi.closures/unwindtest_ffi_call.cc \
libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_8byte.c \
libffi.closures/ffitest.h libffi.closures/nested_struct8.c \
libffi.closures/cls_pointer.c libffi.closures/nested_struct2.c \
libffi.closures/nested_struct.c libffi.closures/cls_multi_schar.c \
libffi.closures/cls_align_longdouble_split.c \
libffi.closures/cls_uchar.c libffi.closures/nested_struct9.c \
libffi.closures/cls_float.c libffi.closures/stret_medium2.c \
libffi.closures/closure_loc_fn0.c libffi.closures/cls_6byte.c \
libffi.closures/closure_simple.c libffi.closures/cls_align_double.c \
libffi.closures/cls_multi_uchar.c libffi.closures/cls_4_1byte.c \
libffi.closures/closure_fn3.c libffi.closures/cls_align_sint64.c \
libffi.closures/nested_struct1.c libffi.closures/unwindtest.cc \
libffi.closures/nested_struct5.c libffi.closures/cls_multi_ushort.c \
libffi.closures/nested_struct11.c \
libffi.closures/cls_multi_sshortchar.c \
libffi.closures/cls_align_longdouble.c \
libffi.closures/cls_dbls_struct.c \
libffi.closures/cls_many_mixed_float_double.c \
libffi.closures/stret_large.c libffi.closures/stret_large2.c \
libffi.closures/cls_align_sint16.c libffi.closures/cls_2byte.c \
libffi.closures/nested_struct4.c libffi.closures/problem1.c \
libffi.closures/testclosure.c libffi.closures/nested_struct6.c \
libffi.closures/cls_4byte.c libffi.closures/cls_24byte.c \
libffi.closures/nested_struct10.c libffi.closures/cls_uint.c \
libffi.closures/cls_12byte.c libffi.closures/cls_sint.c \
libffi.closures/cls_7_1_byte.c libffi.closures/cls_sshort.c \
libffi.closures/cls_16byte.c libffi.closures/nested_struct7.c \
libffi.closures/cls_double_va.c libffi.closures/cls_3byte2.c \
libffi.closures/cls_double.c libffi.closures/cls_7byte.c \
libffi.closures/closure_fn6.c libffi.closures/closure_fn1.c \
libffi.closures/cls_20byte.c libffi.closures/cls_18byte.c \
libffi.closures/err_bad_abi.c

View File

@ -1,4 +1,4 @@
# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011, 2014, 2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -24,11 +24,6 @@ load_lib libgloss.exp
load_gcc_lib target-libpath.exp
load_gcc_lib wrapper.exp
proc check_effective_target_gccbug { } {
global has_gccbug
return $has_gccbug
}
# Return 1 if the target matches the effective target 'arg', 0 otherwise.
# This can be used with any check_* proc that takes no argument and
# returns only 1 or 0. It could be used with check_* procs that take
@ -266,6 +261,12 @@ proc libffi-dg-test { prog do_what extra_tool_flags } {
return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags]
}
proc libffi-dg-prune { target_triplet text } {
# We get this with some qemu emulated systems (eg. ppc64le-linux-gnu)
regsub -all "(^|\n)\[^\n\]*unable to perform all requested operations" $text "" text
return $text
}
proc libffi-init { args } {
global gluefile wrap_flags;
global srcdir
@ -476,23 +477,37 @@ proc libffi-dg-runtest { testcases default-extra-flags } {
proc run-many-tests { testcases extra_flags } {
global compiler_vendor
global has_gccbug
global env
switch $compiler_vendor {
"clang" {
set common "-W -Wall"
set optimizations { "-O0" "-O2" "-Os" }
set common "-W -Wall"
if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "-O0" "-O2" }
}
}
"gnu" {
set common "-W -Wall -Wno-psabi"
set optimizations { "-O0" "-O2" "-Os" "-O2 -fomit-frame-pointer" }
if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "-O0" "-O2" }
}
}
default {
# Assume we are using the vendor compiler.
set common ""
set optimizations { "" }
if [info exists env(LIBFFI_TEST_OPTIMIZATION)] {
set optimizations [ list $env(LIBFFI_TEST_OPTIMIZATION) ]
} else {
set optimizations { "" }
}
}
}
info exists env(LD_LIBRARY_PATH)
set targetabis { "" }
if [string match $compiler_vendor "gnu"] {
if [libffi_feature_test "#ifdef __i386__"] {
@ -523,17 +538,6 @@ proc run-many-tests { testcases extra_flags } {
foreach opt $optimizations {
foreach abi $abis {
set options [concat $common $opt $abi]
set has_gccbug false;
if { [string match $compiler_vendor "gnu"] \
&& [string match "*MSABI*" $abi] \
&& ( ( [string match "*DGTEST=57 *" $common] \
&& [string match "*call.c*" $testname] ) \
|| ( [string match "*DGTEST=54 *" $common] \
&& [string match "*callback*" $testname] ) \
|| [string match "*DGTEST=55 *" $common] \
|| [string match "*DGTEST=56 *" $common] ) } then {
set has_gccbug true;
}
verbose "Testing $testname, $options" 1
dg-test $test $options ""
}

View File

@ -32,10 +32,21 @@ if { [string match $compiler_vendor "microsoft"] } {
set additional_options "";
}
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]]
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.c]]
run-many-tests $tlist $additional_options
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.cc]]
# No C++ for or1k
if { [istarget "or1k-*-*"] } {
foreach test $tlist {
unsupported "$test"
}
} else {
run-many-tests $tlist $additional_options
}
dg-finish
# Local Variables:

View File

@ -33,19 +33,20 @@ int main (void)
f = 3.14159;
#if 1
/* This is ifdef'd out for now. long double support under SunOS/gcc
is pretty much non-existent. You'll get the odd bus error in library
routines like printf(). */
#if defined(__sun) && defined(__GNUC__)
/* long double support under SunOS/gcc is pretty much non-existent.
You'll get the odd bus error in library routines like printf() */
#else
printf ("%Lf\n", ldblit(f));
#endif
ld = 666;
ffi_call(&cif, FFI_FN(ldblit), &ld, values);
#if 1
/* This is ifdef'd out for now. long double support under SunOS/gcc
is pretty much non-existent. You'll get the odd bus error in library
routines like printf(). */
#if defined(__sun) && defined(__GNUC__)
/* long double support under SunOS/gcc is pretty much non-existent.
You'll get the odd bus error in library routines like printf() */
#else
printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
#endif

View File

@ -5,7 +5,7 @@
Originator: ARM Ltd. */
/* { dg-do run } */
/* { dg-output "" { xfail avr32*-*-* } } */
/* { dg-output "" { xfail avr32*-*-* m68k-*-* alpha-*-* } } */
#include "ffitest.h"
#include <stdarg.h>

View File

@ -0,0 +1,67 @@
# Copyright (C) 2003, 2006, 2009, 2010, 2014, 2019 Free Software Foundation, Inc.
# Copyright (C) 2019 Anthony Green
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
dg-init
libffi-init
global srcdir subdir
if { [string match $compiler_vendor "microsoft"] } {
# -wd4005 macro redefinition
# -wd4244 implicit conversion to type of smaller size
# -wd4305 truncation to smaller type
# -wd4477 printf %lu of uintptr_t
# -wd4312 implicit conversion to type of greater size
# -wd4311 pointer truncation to unsigned long
# -EHsc C++ Exception Handling (no SEH exceptions)
set additional_options "-wd4005 -wd4244 -wd4305 -wd4477 -wd4312 -wd4311 -EHsc";
} else {
set additional_options "";
}
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.c]]
if { [libffi_feature_test "#if FFI_CLOSURES"] } {
run-many-tests $tlist ""
} else {
foreach test $tlist {
unsupported "$test"
}
}
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.cc]]
# No C++ for or1k
if { [istarget "or1k-*-*"] } {
foreach test $tlist {
unsupported "$test"
}
} else {
if { [libffi_feature_test "#if FFI_CLOSURES"] } {
run-many-tests $tlist $additional_options
} else {
foreach test $tlist {
unsupported "$test"
}
}
}
dg-finish
# Local Variables:
# tcl-indent-level:4
# End:

Some files were not shown because too many files have changed in this diff Show More