More cygwin fixes
This commit is contained in:
0
.pc/aix-fix/.timestamp
Normal file
0
.pc/aix-fix/.timestamp
Normal file
4792
.pc/aix-fix/ChangeLog
Normal file
4792
.pc/aix-fix/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
1359
.pc/aix-fix/src/powerpc/ffi_darwin.c
Normal file
1359
.pc/aix-fix/src/powerpc/ffi_darwin.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +1,5 @@
|
||||
stand-alone
|
||||
aix-fix
|
||||
mint
|
||||
win32
|
||||
win32_tests
|
||||
|
||||
0
.pc/mint/.timestamp
Normal file
0
.pc/mint/.timestamp
Normal file
4797
.pc/mint/ChangeLog
Normal file
4797
.pc/mint/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
352
.pc/mint/README
Normal file
352
.pc/mint/README
Normal file
@@ -0,0 +1,352 @@
|
||||
Status
|
||||
======
|
||||
|
||||
libffi-3.0.11 was released on *****************. Check the libffi web
|
||||
page for updates: <URL:http://sourceware.org/libffi/>.
|
||||
|
||||
|
||||
What is libffi?
|
||||
===============
|
||||
|
||||
Compilers for high level languages generate code that follow certain
|
||||
conventions. These conventions are necessary, in part, for separate
|
||||
compilation to work. One such convention is the "calling
|
||||
convention". The "calling convention" is essentially a set of
|
||||
assumptions made by the compiler about where function arguments will
|
||||
be found on entry to a function. A "calling convention" also specifies
|
||||
where the return value for a function is found.
|
||||
|
||||
Some programs may not know at the time of compilation what arguments
|
||||
are to be passed to a function. For instance, an interpreter may be
|
||||
told at run-time about the number and types of arguments used to call
|
||||
a given function. Libffi can be used in such programs to provide a
|
||||
bridge from the interpreter program to compiled code.
|
||||
|
||||
The libffi library provides a portable, high level programming
|
||||
interface to various calling conventions. This allows a programmer to
|
||||
call any function specified by a call interface description at run
|
||||
time.
|
||||
|
||||
FFI stands for Foreign Function Interface. A foreign function
|
||||
interface is the popular name for the interface that allows code
|
||||
written in one language to call code written in another language. The
|
||||
libffi library really only provides the lowest, machine dependent
|
||||
layer of a fully featured foreign function interface. A layer must
|
||||
exist above libffi that handles type conversions for values passed
|
||||
between the two languages.
|
||||
|
||||
|
||||
Supported Platforms
|
||||
===================
|
||||
|
||||
Libffi has been ported to many different platforms.
|
||||
For specific configuration details and testing status, please
|
||||
refer to the wiki page here:
|
||||
|
||||
http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.11
|
||||
|
||||
At the time of release, the following basic configurations have been
|
||||
tested:
|
||||
|
||||
|--------------+------------------|
|
||||
| Architecture | Operating System |
|
||||
|--------------+------------------|
|
||||
| Alpha | Linux |
|
||||
| Alpha | Tru64 |
|
||||
| ARM | Linux |
|
||||
| ARM | iOS |
|
||||
| AVR32 | Linux |
|
||||
| HPPA | HPUX |
|
||||
| IA-64 | Linux |
|
||||
| M68K | RTEMS |
|
||||
| MIPS | IRIX |
|
||||
| MIPS | Linux |
|
||||
| MIPS | RTEMS |
|
||||
| MIPS64 | Linux |
|
||||
| PowerPC | AMIGA |
|
||||
| PowerPC | Linux |
|
||||
| PowerPC | Mac OSX |
|
||||
| PowerPC | FreeBSD |
|
||||
| PowerPC64 | Linux |
|
||||
| S390 | Linux |
|
||||
| S390X | Linux |
|
||||
| SPARC | Linux |
|
||||
| SPARC | Solaris |
|
||||
| SPARC64 | Linux |
|
||||
| SPARC64 | FreeBSD |
|
||||
| X86 | FreeBSD |
|
||||
| X86 | Interix |
|
||||
| X86 | kFreeBSD |
|
||||
| X86 | Linux |
|
||||
| X86 | Linux/x32 |
|
||||
| X86 | Mac OSX |
|
||||
| X86 | OpenBSD |
|
||||
| X86 | OS/2 |
|
||||
| X86 | Solaris |
|
||||
| X86 | Windows/Cygwin |
|
||||
| X86 | Windows/MingW |
|
||||
| X86-64 | FreeBSD |
|
||||
| X86-64 | Linux |
|
||||
| X86-64 | OpenBSD |
|
||||
| X86-64 | Windows/MingW |
|
||||
|--------------+------------------|
|
||||
|
||||
Please send additional platform test results to
|
||||
libffi-discuss@sourceware.org and feel free to update the wiki page
|
||||
above.
|
||||
|
||||
Installing libffi
|
||||
=================
|
||||
|
||||
First you must configure the distribution for your particular
|
||||
system. Go to the directory you wish to build libffi in and run the
|
||||
"configure" program found in the root directory of the libffi source
|
||||
distribution.
|
||||
|
||||
You may want to tell configure where to install the libffi library and
|
||||
header files. To do that, use the --prefix configure switch. Libffi
|
||||
will install under /usr/local by default.
|
||||
|
||||
If you want to enable extra run-time debugging checks use the the
|
||||
--enable-debug configure switch. This is useful when your program dies
|
||||
mysteriously while using libffi.
|
||||
|
||||
Another useful configure switch is --enable-purify-safety. Using this
|
||||
will add some extra code which will suppress certain warnings when you
|
||||
are using Purify with libffi. Only use this switch when using
|
||||
Purify, as it will slow down the library.
|
||||
|
||||
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 LD=link CPP=\"cl -nologo -EP\"
|
||||
|
||||
For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64".
|
||||
You may also need to specify --build appropriately. 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.)
|
||||
|
||||
For iOS builds, refer to the build-ios.sh script for guidance.
|
||||
|
||||
Configure has many other options. Use "configure --help" to see them all.
|
||||
|
||||
Once configure has finished, type "make". Note that you must be using
|
||||
GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
|
||||
|
||||
To ensure that libffi is working as advertised, type "make check".
|
||||
This will require that you have DejaGNU installed.
|
||||
|
||||
To install the library and header files, type "make install".
|
||||
|
||||
|
||||
History
|
||||
=======
|
||||
|
||||
See the ChangeLog files for details.
|
||||
|
||||
3.0.11 MMM-DD-YY
|
||||
Lots of build fixes.
|
||||
Add Amiga newer MacOS support.
|
||||
Add Linux/x32 support.
|
||||
Add thiscall and fastcall support on Windows.
|
||||
Fix Octeon and MC68881 support.
|
||||
Fix code pessimizations.
|
||||
|
||||
3.0.10 Aug-23-11
|
||||
Add support for Apple's iOS.
|
||||
Add support for ARM VFP ABI.
|
||||
Add RTEMS support for MIPS and M68K.
|
||||
Fix instruction cache clearing problems on
|
||||
ARM and SPARC.
|
||||
Fix the N64 build on mips-sgi-irix6.5.
|
||||
Enable builds with Microsoft's compiler.
|
||||
Enable x86 builds with Oracle's Solaris compiler.
|
||||
Fix support for calling code compiled with Oracle's Sparc
|
||||
Solaris compiler.
|
||||
Testsuite fixes for Tru64 Unix.
|
||||
Additional platform support.
|
||||
|
||||
3.0.9 Dec-31-09
|
||||
Add AVR32 and win64 ports. Add ARM softfp support.
|
||||
Many fixes for AIX, Solaris, HP-UX, *BSD.
|
||||
Several PowerPC and x86-64 bug fixes.
|
||||
Build DLL for windows.
|
||||
|
||||
3.0.8 Dec-19-08
|
||||
Add *BSD, BeOS, and PA-Linux support.
|
||||
|
||||
3.0.7 Nov-11-08
|
||||
Fix for ppc FreeBSD.
|
||||
(thanks to Andreas Tobler)
|
||||
|
||||
3.0.6 Jul-17-08
|
||||
Fix for closures on sh.
|
||||
Mark the sh/sh64 stack as non-executable.
|
||||
(both thanks to Kaz Kojima)
|
||||
|
||||
3.0.5 Apr-3-08
|
||||
Fix libffi.pc file.
|
||||
Fix #define ARM for IcedTea users.
|
||||
Fix x86 closure bug.
|
||||
|
||||
3.0.4 Feb-24-08
|
||||
Fix x86 OpenBSD configury.
|
||||
|
||||
3.0.3 Feb-22-08
|
||||
Enable x86 OpenBSD thanks to Thomas Heller, and
|
||||
x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
|
||||
Clean up test instruction in README.
|
||||
|
||||
3.0.2 Feb-21-08
|
||||
Improved x86 FreeBSD support.
|
||||
Thanks to Björn König.
|
||||
|
||||
3.0.1 Feb-15-08
|
||||
Fix instruction cache flushing bug on MIPS.
|
||||
Thanks to David Daney.
|
||||
|
||||
3.0.0 Feb-15-08
|
||||
Many changes, mostly thanks to the GCC project.
|
||||
Cygnus Solutions is now Red Hat.
|
||||
|
||||
[10 years go by...]
|
||||
|
||||
1.20 Oct-5-98
|
||||
Raffaele Sena produces ARM port.
|
||||
|
||||
1.19 Oct-5-98
|
||||
Fixed x86 long double and long long return support.
|
||||
m68k bug fixes from Andreas Schwab.
|
||||
Patch for DU assembler compatibility for the Alpha from Richard
|
||||
Henderson.
|
||||
|
||||
1.18 Apr-17-98
|
||||
Bug fixes and MIPS configuration changes.
|
||||
|
||||
1.17 Feb-24-98
|
||||
Bug fixes and m68k port from Andreas Schwab. PowerPC port from
|
||||
Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
|
||||
|
||||
1.16 Feb-11-98
|
||||
Richard Henderson produces Alpha port.
|
||||
|
||||
1.15 Dec-4-97
|
||||
Fixed an n32 ABI bug. New libtool, auto* support.
|
||||
|
||||
1.14 May-13-97
|
||||
libtool is now used to generate shared and static libraries.
|
||||
Fixed a minor portability problem reported by Russ McManus
|
||||
<mcmanr@eq.gs.com>.
|
||||
|
||||
1.13 Dec-2-96
|
||||
Added --enable-purify-safety to keep Purify from complaining
|
||||
about certain low level code.
|
||||
Sparc fix for calling functions with < 6 args.
|
||||
Linux x86 a.out fix.
|
||||
|
||||
1.12 Nov-22-96
|
||||
Added missing ffi_type_void, needed for supporting void return
|
||||
types. Fixed test case for non MIPS machines. Cygnus Support
|
||||
is now Cygnus Solutions.
|
||||
|
||||
1.11 Oct-30-96
|
||||
Added notes about GNU make.
|
||||
|
||||
1.10 Oct-29-96
|
||||
Added configuration fix for non GNU compilers.
|
||||
|
||||
1.09 Oct-29-96
|
||||
Added --enable-debug configure switch. Clean-ups based on LCLint
|
||||
feedback. ffi_mips.h is always installed. Many configuration
|
||||
fixes. Fixed ffitest.c for sparc builds.
|
||||
|
||||
1.08 Oct-15-96
|
||||
Fixed n32 problem. Many clean-ups.
|
||||
|
||||
1.07 Oct-14-96
|
||||
Gordon Irlam rewrites v8.S again. Bug fixes.
|
||||
|
||||
1.06 Oct-14-96
|
||||
Gordon Irlam improved the sparc port.
|
||||
|
||||
1.05 Oct-14-96
|
||||
Interface changes based on feedback.
|
||||
|
||||
1.04 Oct-11-96
|
||||
Sparc port complete (modulo struct passing bug).
|
||||
|
||||
1.03 Oct-10-96
|
||||
Passing struct args, and returning struct values works for
|
||||
all architectures/calling conventions. Expanded tests.
|
||||
|
||||
1.02 Oct-9-96
|
||||
Added SGI n32 support. Fixed bugs in both o32 and Linux support.
|
||||
Added "make test".
|
||||
|
||||
1.01 Oct-8-96
|
||||
Fixed float passing bug in mips version. Restructured some
|
||||
of the code. Builds cleanly with SGI tools.
|
||||
|
||||
1.00 Oct-7-96
|
||||
First release. No public announcement.
|
||||
|
||||
|
||||
Authors & Credits
|
||||
=================
|
||||
|
||||
libffi was originally written by Anthony Green <green@redhat.com>.
|
||||
|
||||
The developers of the GNU Compiler Collection project have made
|
||||
innumerable valuable contributions. See the ChangeLog file for
|
||||
details.
|
||||
|
||||
Some of the ideas behind libffi were inspired by Gianni Mariani's free
|
||||
gencall library for Silicon Graphics machines.
|
||||
|
||||
The closure mechanism was designed and implemented by Kresten Krab
|
||||
Thorup.
|
||||
|
||||
Major processor architecture ports were contributed by the following
|
||||
developers:
|
||||
|
||||
alpha Richard Henderson
|
||||
arm Raffaele Sena
|
||||
cris Simon Posnjak, Hans-Peter Nilsson
|
||||
frv Anthony Green
|
||||
ia64 Hans Boehm
|
||||
m32r Kazuhiro Inaoka
|
||||
m68k Andreas Schwab
|
||||
mips Anthony Green, Casey Marshall
|
||||
mips64 David Daney
|
||||
pa Randolph Chung, Dave Anglin, Andreas Tobler
|
||||
powerpc Geoffrey Keating, Andreas Tobler,
|
||||
David Edelsohn, John Hornkvist
|
||||
powerpc64 Jakub Jelinek
|
||||
s390 Gerhard Tonn, Ulrich Weigand
|
||||
sh Kaz Kojima
|
||||
sh64 Kaz Kojima
|
||||
sparc Anthony Green, Gordon Irlam
|
||||
x86 Anthony Green, Jon Beniston
|
||||
x86-64 Bo Thorsen
|
||||
|
||||
Jesper Skov and Andrew Haley both did more than their fair share of
|
||||
stepping through the code and tracking down bugs.
|
||||
|
||||
Thanks also to Tom Tromey for bug fixes, documentation and
|
||||
configuration help.
|
||||
|
||||
Thanks to Jim Blandy, who provided some useful feedback on the libffi
|
||||
interface.
|
||||
|
||||
Andreas Tobler has done a tremendous amount of work on the testsuite.
|
||||
|
||||
Alex Oliva solved the executable page problem for SElinux.
|
||||
|
||||
The list above is almost certainly incomplete and inaccurate. I'm
|
||||
happy to make corrections or additions upon request.
|
||||
|
||||
If you have a problem, or have found a bug, please send a note to the
|
||||
author at green@moxielogic.com, or the project mailing list at
|
||||
libffi-discuss@sourceware.org.
|
||||
289
.pc/mint/src/m68k/ffi.c
Normal file
289
.pc/mint/src/m68k/ffi.c
Normal file
@@ -0,0 +1,289 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
ffi.c
|
||||
|
||||
m68k Foreign Function Interface
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#include <ffi.h>
|
||||
#include <ffi_common.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __rtems__
|
||||
void rtems_cache_flush_multiple_data_lines( const void *, size_t );
|
||||
#else
|
||||
#include <sys/syscall.h>
|
||||
#include <asm/cachectl.h>
|
||||
#endif
|
||||
|
||||
void ffi_call_SYSV (extended_cif *,
|
||||
unsigned, unsigned,
|
||||
void *, void (*fn) ());
|
||||
void *ffi_prep_args (void *stack, extended_cif *ecif);
|
||||
void ffi_closure_SYSV (ffi_closure *);
|
||||
void ffi_closure_struct_SYSV (ffi_closure *);
|
||||
unsigned int ffi_closure_SYSV_inner (ffi_closure *closure,
|
||||
void *resp, void *args);
|
||||
|
||||
/* ffi_prep_args is called by the assembly routine once stack space has
|
||||
been allocated for the function's arguments. */
|
||||
|
||||
void *
|
||||
ffi_prep_args (void *stack, extended_cif *ecif)
|
||||
{
|
||||
unsigned int i;
|
||||
void **p_argv;
|
||||
char *argp;
|
||||
ffi_type **p_arg;
|
||||
void *struct_value_ptr;
|
||||
|
||||
argp = stack;
|
||||
|
||||
if (ecif->cif->rtype->type == FFI_TYPE_STRUCT
|
||||
&& !ecif->cif->flags)
|
||||
struct_value_ptr = ecif->rvalue;
|
||||
else
|
||||
struct_value_ptr = NULL;
|
||||
|
||||
p_argv = ecif->avalue;
|
||||
|
||||
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
|
||||
i != 0;
|
||||
i--, p_arg++)
|
||||
{
|
||||
size_t z;
|
||||
|
||||
z = (*p_arg)->size;
|
||||
if (z < sizeof (int))
|
||||
{
|
||||
switch ((*p_arg)->type)
|
||||
{
|
||||
case FFI_TYPE_SINT8:
|
||||
*(signed int *) argp = (signed int) *(SINT8 *) *p_argv;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT8:
|
||||
*(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT16:
|
||||
*(signed int *) argp = (signed int) *(SINT16 *) *p_argv;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT16:
|
||||
*(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
memcpy (argp + sizeof (int) - z, *p_argv, z);
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT (0);
|
||||
}
|
||||
z = sizeof (int);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (argp, *p_argv, z);
|
||||
|
||||
/* Align if necessary. */
|
||||
if ((sizeof(int) - 1) & z)
|
||||
z = ALIGN(z, sizeof(int));
|
||||
}
|
||||
|
||||
p_argv++;
|
||||
argp += z;
|
||||
}
|
||||
|
||||
return struct_value_ptr;
|
||||
}
|
||||
|
||||
#define CIF_FLAGS_INT 1
|
||||
#define CIF_FLAGS_DINT 2
|
||||
#define CIF_FLAGS_FLOAT 4
|
||||
#define CIF_FLAGS_DOUBLE 8
|
||||
#define CIF_FLAGS_LDOUBLE 16
|
||||
#define CIF_FLAGS_POINTER 32
|
||||
#define CIF_FLAGS_STRUCT1 64
|
||||
#define CIF_FLAGS_STRUCT2 128
|
||||
|
||||
/* Perform machine dependent cif processing */
|
||||
ffi_status
|
||||
ffi_prep_cif_machdep (ffi_cif *cif)
|
||||
{
|
||||
/* Set the return type flag */
|
||||
switch (cif->rtype->type)
|
||||
{
|
||||
case FFI_TYPE_VOID:
|
||||
cif->flags = 0;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
switch (cif->rtype->size)
|
||||
{
|
||||
case 1:
|
||||
cif->flags = CIF_FLAGS_STRUCT1;
|
||||
break;
|
||||
case 2:
|
||||
cif->flags = CIF_FLAGS_STRUCT2;
|
||||
break;
|
||||
case 4:
|
||||
cif->flags = CIF_FLAGS_INT;
|
||||
break;
|
||||
case 8:
|
||||
cif->flags = CIF_FLAGS_DINT;
|
||||
break;
|
||||
default:
|
||||
cif->flags = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case FFI_TYPE_FLOAT:
|
||||
cif->flags = CIF_FLAGS_FLOAT;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_DOUBLE:
|
||||
cif->flags = CIF_FLAGS_DOUBLE;
|
||||
break;
|
||||
|
||||
#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE)
|
||||
case FFI_TYPE_LONGDOUBLE:
|
||||
cif->flags = CIF_FLAGS_LDOUBLE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_POINTER:
|
||||
cif->flags = CIF_FLAGS_POINTER;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_UINT64:
|
||||
cif->flags = CIF_FLAGS_DINT;
|
||||
break;
|
||||
|
||||
default:
|
||||
cif->flags = CIF_FLAGS_INT;
|
||||
break;
|
||||
}
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue)
|
||||
{
|
||||
extended_cif ecif;
|
||||
|
||||
ecif.cif = cif;
|
||||
ecif.avalue = avalue;
|
||||
|
||||
/* If the return value is a struct and we don't have a return value
|
||||
address then we need to make one. */
|
||||
|
||||
if (rvalue == NULL
|
||||
&& cif->rtype->type == FFI_TYPE_STRUCT
|
||||
&& cif->rtype->size > 8)
|
||||
ecif.rvalue = alloca (cif->rtype->size);
|
||||
else
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
case FFI_SYSV:
|
||||
ffi_call_SYSV (&ecif, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT (0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif)
|
||||
{
|
||||
unsigned int i;
|
||||
void **p_argv;
|
||||
char *argp;
|
||||
ffi_type **p_arg;
|
||||
|
||||
argp = stack;
|
||||
p_argv = avalue;
|
||||
|
||||
for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
|
||||
{
|
||||
size_t z;
|
||||
|
||||
z = (*p_arg)->size;
|
||||
if (z <= 4)
|
||||
{
|
||||
*p_argv = (void *) (argp + 4 - z);
|
||||
|
||||
z = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p_argv = (void *) argp;
|
||||
|
||||
/* Align if necessary */
|
||||
if ((sizeof(int) - 1) & z)
|
||||
z = ALIGN(z, sizeof(int));
|
||||
}
|
||||
|
||||
p_argv++;
|
||||
argp += z;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args)
|
||||
{
|
||||
ffi_cif *cif;
|
||||
void **arg_area;
|
||||
|
||||
cif = closure->cif;
|
||||
arg_area = (void**) alloca (cif->nargs * sizeof (void *));
|
||||
|
||||
ffi_prep_incoming_args_SYSV(args, arg_area, cif);
|
||||
|
||||
(closure->fun) (cif, resp, arg_area, closure->user_data);
|
||||
|
||||
return cif->flags;
|
||||
}
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure* closure,
|
||||
ffi_cif* cif,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data,
|
||||
void *codeloc)
|
||||
{
|
||||
if (cif->abi != FFI_SYSV)
|
||||
return FFI_BAD_ABI;
|
||||
|
||||
*(unsigned short *)closure->tramp = 0x207c;
|
||||
*(void **)(closure->tramp + 2) = codeloc;
|
||||
*(unsigned short *)(closure->tramp + 6) = 0x4ef9;
|
||||
if (cif->rtype->type == FFI_TYPE_STRUCT
|
||||
&& !cif->flags)
|
||||
*(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV;
|
||||
else
|
||||
*(void **)(closure->tramp + 8) = ffi_closure_SYSV;
|
||||
|
||||
#ifdef __rtems__
|
||||
rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE );
|
||||
#else
|
||||
syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE,
|
||||
FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE);
|
||||
#endif
|
||||
|
||||
closure->cif = cif;
|
||||
closure->user_data = user_data;
|
||||
closure->fun = fun;
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
270
.pc/mint/src/m68k/sysv.S
Normal file
270
.pc/mint/src/m68k/sysv.S
Normal file
@@ -0,0 +1,270 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
|
||||
sysv.S - Copyright (c) 1998, 2012 Andreas Schwab
|
||||
Copyright (c) 2008 Red Hat, Inc.
|
||||
|
||||
m68k 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>
|
||||
|
||||
#ifdef HAVE_AS_CFI_PSEUDO_OP
|
||||
#define CFI_STARTPROC() .cfi_startproc
|
||||
#define CFI_OFFSET(reg,off) .cfi_offset reg,off
|
||||
#define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off
|
||||
#define CFI_ENDPROC() .cfi_endproc
|
||||
#else
|
||||
#define CFI_STARTPROC()
|
||||
#define CFI_OFFSET(reg,off)
|
||||
#define CFI_DEF_CFA(reg,off)
|
||||
#define CFI_ENDPROC()
|
||||
#endif
|
||||
|
||||
.text
|
||||
|
||||
.globl ffi_call_SYSV
|
||||
.type ffi_call_SYSV,@function
|
||||
.align 4
|
||||
|
||||
ffi_call_SYSV:
|
||||
CFI_STARTPROC()
|
||||
link %fp,#0
|
||||
CFI_OFFSET(14,-8)
|
||||
CFI_DEF_CFA(14,8)
|
||||
move.l %d2,-(%sp)
|
||||
CFI_OFFSET(2,-12)
|
||||
|
||||
| Make room for all of the new args.
|
||||
sub.l 12(%fp),%sp
|
||||
|
||||
| Call ffi_prep_args
|
||||
move.l 8(%fp),-(%sp)
|
||||
pea 4(%sp)
|
||||
#if !defined __PIC__
|
||||
jsr ffi_prep_args
|
||||
#else
|
||||
bsr.l ffi_prep_args@PLTPC
|
||||
#endif
|
||||
addq.l #8,%sp
|
||||
|
||||
| Pass pointer to struct value, if any
|
||||
move.l %a0,%a1
|
||||
|
||||
| Call the function
|
||||
move.l 24(%fp),%a0
|
||||
jsr (%a0)
|
||||
|
||||
| Remove the space we pushed for the args
|
||||
add.l 12(%fp),%sp
|
||||
|
||||
| Load the pointer to storage for the return value
|
||||
move.l 20(%fp),%a1
|
||||
|
||||
| Load the return type code
|
||||
move.l 16(%fp),%d2
|
||||
|
||||
| If the return value pointer is NULL, assume no return value.
|
||||
| NOTE: On the mc68000, tst on an address register is not supported.
|
||||
#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
|
||||
cmp.w #0, %a1
|
||||
#else
|
||||
tst.l %a1
|
||||
#endif
|
||||
jbeq noretval
|
||||
|
||||
btst #0,%d2
|
||||
jbeq retlongint
|
||||
move.l %d0,(%a1)
|
||||
jbra epilogue
|
||||
|
||||
retlongint:
|
||||
btst #1,%d2
|
||||
jbeq retfloat
|
||||
move.l %d0,(%a1)
|
||||
move.l %d1,4(%a1)
|
||||
jbra epilogue
|
||||
|
||||
retfloat:
|
||||
btst #2,%d2
|
||||
jbeq retdouble
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.s %fp0,(%a1)
|
||||
#else
|
||||
move.l %d0,(%a1)
|
||||
#endif
|
||||
jbra epilogue
|
||||
|
||||
retdouble:
|
||||
btst #3,%d2
|
||||
jbeq retlongdouble
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.d %fp0,(%a1)
|
||||
#else
|
||||
move.l %d0,(%a1)+
|
||||
move.l %d1,(%a1)
|
||||
#endif
|
||||
jbra epilogue
|
||||
|
||||
retlongdouble:
|
||||
btst #4,%d2
|
||||
jbeq retpointer
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.x %fp0,(%a1)
|
||||
#else
|
||||
move.l %d0,(%a1)+
|
||||
move.l %d1,(%a1)+
|
||||
move.l %d2,(%a1)
|
||||
#endif
|
||||
jbra epilogue
|
||||
|
||||
retpointer:
|
||||
btst #5,%d2
|
||||
jbeq retstruct1
|
||||
move.l %a0,(%a1)
|
||||
jbra epilogue
|
||||
|
||||
retstruct1:
|
||||
btst #6,%d2
|
||||
jbeq retstruct2
|
||||
move.b %d0,(%a1)
|
||||
jbra epilogue
|
||||
|
||||
retstruct2:
|
||||
btst #7,%d2
|
||||
jbeq noretval
|
||||
move.w %d0,(%a1)
|
||||
|
||||
noretval:
|
||||
epilogue:
|
||||
move.l (%sp)+,%d2
|
||||
unlk %fp
|
||||
rts
|
||||
CFI_ENDPROC()
|
||||
.size ffi_call_SYSV,.-ffi_call_SYSV
|
||||
|
||||
.globl ffi_closure_SYSV
|
||||
.type ffi_closure_SYSV, @function
|
||||
.align 4
|
||||
|
||||
ffi_closure_SYSV:
|
||||
CFI_STARTPROC()
|
||||
link %fp,#-12
|
||||
CFI_OFFSET(14,-8)
|
||||
CFI_DEF_CFA(14,8)
|
||||
move.l %sp,-12(%fp)
|
||||
pea 8(%fp)
|
||||
pea -12(%fp)
|
||||
move.l %a0,-(%sp)
|
||||
#if !defined __PIC__
|
||||
jsr ffi_closure_SYSV_inner
|
||||
#else
|
||||
bsr.l ffi_closure_SYSV_inner@PLTPC
|
||||
#endif
|
||||
|
||||
lsr.l #1,%d0
|
||||
jne 1f
|
||||
jcc .Lcls_epilogue
|
||||
move.l -12(%fp),%d0
|
||||
.Lcls_epilogue:
|
||||
unlk %fp
|
||||
rts
|
||||
1:
|
||||
lea -12(%fp),%a0
|
||||
lsr.l #2,%d0
|
||||
jne 1f
|
||||
jcs .Lcls_ret_float
|
||||
move.l (%a0)+,%d0
|
||||
move.l (%a0),%d1
|
||||
jra .Lcls_epilogue
|
||||
.Lcls_ret_float:
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.s (%a0),%fp0
|
||||
#else
|
||||
move.l (%a0),%d0
|
||||
#endif
|
||||
jra .Lcls_epilogue
|
||||
1:
|
||||
lsr.l #2,%d0
|
||||
jne 1f
|
||||
jcs .Lcls_ret_ldouble
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.d (%a0),%fp0
|
||||
#else
|
||||
move.l (%a0)+,%d0
|
||||
move.l (%a0),%d1
|
||||
#endif
|
||||
jra .Lcls_epilogue
|
||||
.Lcls_ret_ldouble:
|
||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||
fmove.x (%a0),%fp0
|
||||
#else
|
||||
move.l (%a0)+,%d0
|
||||
move.l (%a0)+,%d1
|
||||
move.l (%a0),%d2
|
||||
#endif
|
||||
jra .Lcls_epilogue
|
||||
1:
|
||||
lsr.l #2,%d0
|
||||
jne .Lcls_ret_struct2
|
||||
jcs .Lcls_ret_struct1
|
||||
move.l (%a0),%a0
|
||||
move.l %a0,%d0
|
||||
jra .Lcls_epilogue
|
||||
.Lcls_ret_struct1:
|
||||
move.b (%a0),%d0
|
||||
jra .Lcls_epilogue
|
||||
.Lcls_ret_struct2:
|
||||
move.w (%a0),%d0
|
||||
jra .Lcls_epilogue
|
||||
CFI_ENDPROC()
|
||||
|
||||
.size ffi_closure_SYSV,.-ffi_closure_SYSV
|
||||
|
||||
.globl ffi_closure_struct_SYSV
|
||||
.type ffi_closure_struct_SYSV, @function
|
||||
.align 4
|
||||
|
||||
ffi_closure_struct_SYSV:
|
||||
CFI_STARTPROC()
|
||||
link %fp,#0
|
||||
CFI_OFFSET(14,-8)
|
||||
CFI_DEF_CFA(14,8)
|
||||
move.l %sp,-12(%fp)
|
||||
pea 8(%fp)
|
||||
move.l %a1,-(%sp)
|
||||
move.l %a0,-(%sp)
|
||||
#if !defined __PIC__
|
||||
jsr ffi_closure_SYSV_inner
|
||||
#else
|
||||
bsr.l ffi_closure_SYSV_inner@PLTPC
|
||||
#endif
|
||||
unlk %fp
|
||||
rts
|
||||
CFI_ENDPROC()
|
||||
.size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV
|
||||
|
||||
#if defined __ELF__ && defined __linux__
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
#endif
|
||||
0
.pc/win32/.timestamp
Normal file
0
.pc/win32/.timestamp
Normal file
4802
.pc/win32/ChangeLog
Normal file
4802
.pc/win32/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
1119
.pc/win32/src/x86/win32.S
Normal file
1119
.pc/win32/src/x86/win32.S
Normal file
File diff suppressed because it is too large
Load Diff
45
.pc/win32/testsuite/libffi.call/strlen2_win32.c
Normal file
45
.pc/win32/testsuite/libffi.call/strlen2_win32.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* Area: ffi_call
|
||||
Purpose: Check fastcall strlen call on X86_WIN32 systems.
|
||||
Limitations: none.
|
||||
PR: none.
|
||||
Originator: From the original ffitest.c */
|
||||
|
||||
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
|
||||
|
||||
#include "ffitest.h"
|
||||
|
||||
static size_t __attribute__((fastcall)) my_fastcall_strlen(char *s)
|
||||
{
|
||||
return (strlen(s));
|
||||
}
|
||||
|
||||
int d
|
||||
int main (void)
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[MAX_ARGS];
|
||||
void *values[MAX_ARGS];
|
||||
ffi_arg rint;
|
||||
char *s;
|
||||
args[0] = &ffi_type_pointer;
|
||||
values[0] = (void*) &s;
|
||||
|
||||
/* Initialize the cif */
|
||||
CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1,
|
||||
&ffi_type_sint, args) == FFI_OK);
|
||||
|
||||
s = "a";
|
||||
ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
|
||||
CHECK(rint == 1);
|
||||
|
||||
s = "1234567";
|
||||
ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
|
||||
CHECK(rint == 7);
|
||||
|
||||
s = "1234567890123456789012345";
|
||||
ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
|
||||
CHECK(rint == 25);
|
||||
|
||||
printf("fastcall strlen tests passed\n");
|
||||
exit(0);
|
||||
}
|
||||
0
.pc/win32_tests/.timestamp
Normal file
0
.pc/win32_tests/.timestamp
Normal file
4808
.pc/win32_tests/ChangeLog
Normal file
4808
.pc/win32_tests/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
263
.pc/win32_tests/testsuite/lib/target-libpath.exp
Normal file
263
.pc/win32_tests/testsuite/lib/target-libpath.exp
Normal file
@@ -0,0 +1,263 @@
|
||||
# Copyright (C) 2004, 2005, 2007 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
|
||||
# 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 GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca)
|
||||
|
||||
set orig_environment_saved 0
|
||||
set orig_ld_library_path_saved 0
|
||||
set orig_ld_run_path_saved 0
|
||||
set orig_shlib_path_saved 0
|
||||
set orig_ld_libraryn32_path_saved 0
|
||||
set orig_ld_library64_path_saved 0
|
||||
set orig_ld_library_path_32_saved 0
|
||||
set orig_ld_library_path_64_saved 0
|
||||
set orig_dyld_library_path_saved 0
|
||||
|
||||
|
||||
#######################################
|
||||
# proc set_ld_library_path_env_vars { }
|
||||
#######################################
|
||||
|
||||
proc set_ld_library_path_env_vars { } {
|
||||
global ld_library_path
|
||||
global orig_environment_saved
|
||||
global orig_ld_library_path_saved
|
||||
global orig_ld_run_path_saved
|
||||
global orig_shlib_path_saved
|
||||
global orig_ld_libraryn32_path_saved
|
||||
global orig_ld_library64_path_saved
|
||||
global orig_ld_library_path_32_saved
|
||||
global orig_ld_library_path_64_saved
|
||||
global orig_dyld_library_path_saved
|
||||
global orig_ld_library_path
|
||||
global orig_ld_run_path
|
||||
global orig_shlib_path
|
||||
global orig_ld_libraryn32_path
|
||||
global orig_ld_library64_path
|
||||
global orig_ld_library_path_32
|
||||
global orig_ld_library_path_64
|
||||
global orig_dyld_library_path
|
||||
global GCC_EXEC_PREFIX
|
||||
|
||||
# Set the relocated compiler prefix, but only if the user hasn't specified one.
|
||||
if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } {
|
||||
setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX"
|
||||
}
|
||||
|
||||
# Setting the ld library path causes trouble when testing cross-compilers.
|
||||
if { [is_remote target] } {
|
||||
return
|
||||
}
|
||||
|
||||
if { $orig_environment_saved == 0 } {
|
||||
global env
|
||||
|
||||
set orig_environment_saved 1
|
||||
|
||||
# Save the original environment.
|
||||
if [info exists env(LD_LIBRARY_PATH)] {
|
||||
set orig_ld_library_path "$env(LD_LIBRARY_PATH)"
|
||||
set orig_ld_library_path_saved 1
|
||||
}
|
||||
if [info exists env(LD_RUN_PATH)] {
|
||||
set orig_ld_run_path "$env(LD_RUN_PATH)"
|
||||
set orig_ld_run_path_saved 1
|
||||
}
|
||||
if [info exists env(SHLIB_PATH)] {
|
||||
set orig_shlib_path "$env(SHLIB_PATH)"
|
||||
set orig_shlib_path_saved 1
|
||||
}
|
||||
if [info exists env(LD_LIBRARYN32_PATH)] {
|
||||
set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)"
|
||||
set orig_ld_libraryn32_path_saved 1
|
||||
}
|
||||
if [info exists env(LD_LIBRARY64_PATH)] {
|
||||
set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)"
|
||||
set orig_ld_library64_path_saved 1
|
||||
}
|
||||
if [info exists env(LD_LIBRARY_PATH_32)] {
|
||||
set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)"
|
||||
set orig_ld_library_path_32_saved 1
|
||||
}
|
||||
if [info exists env(LD_LIBRARY_PATH_64)] {
|
||||
set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)"
|
||||
set orig_ld_library_path_64_saved 1
|
||||
}
|
||||
if [info exists env(DYLD_LIBRARY_PATH)] {
|
||||
set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
|
||||
set orig_dyld_library_path_saved 1
|
||||
}
|
||||
}
|
||||
|
||||
# We need to set ld library path in the environment. Currently,
|
||||
# unix.exp doesn't set the environment correctly for all systems.
|
||||
# It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a
|
||||
# program. We also need the environment set for compilations, etc.
|
||||
#
|
||||
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
|
||||
# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
|
||||
# (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH),
|
||||
# Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64),
|
||||
# and HP-UX (SHLIB_PATH). In some cases, the variables are independent
|
||||
# of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the
|
||||
# variable is not defined.
|
||||
#
|
||||
# Doing this is somewhat of a hack as ld_library_path gets repeated in
|
||||
# SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
|
||||
if { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
|
||||
} else {
|
||||
setenv LD_LIBRARY_PATH "$ld_library_path"
|
||||
}
|
||||
if { $orig_ld_run_path_saved } {
|
||||
setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path"
|
||||
} else {
|
||||
setenv LD_RUN_PATH "$ld_library_path"
|
||||
}
|
||||
# The default shared library dynamic path search for 64-bit
|
||||
# HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH.
|
||||
# LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we
|
||||
# set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent.
|
||||
if { $orig_shlib_path_saved } {
|
||||
setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path"
|
||||
} else {
|
||||
setenv SHLIB_PATH "$ld_library_path"
|
||||
}
|
||||
if { $orig_ld_libraryn32_path_saved } {
|
||||
setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path"
|
||||
} elseif { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path"
|
||||
} else {
|
||||
setenv LD_LIBRARYN32_PATH "$ld_library_path"
|
||||
}
|
||||
if { $orig_ld_library64_path_saved } {
|
||||
setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path"
|
||||
} elseif { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path"
|
||||
} else {
|
||||
setenv LD_LIBRARY64_PATH "$ld_library_path"
|
||||
}
|
||||
if { $orig_ld_library_path_32_saved } {
|
||||
setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32"
|
||||
} elseif { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path"
|
||||
} else {
|
||||
setenv LD_LIBRARY_PATH_32 "$ld_library_path"
|
||||
}
|
||||
if { $orig_ld_library_path_64_saved } {
|
||||
setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64"
|
||||
} elseif { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path"
|
||||
} else {
|
||||
setenv LD_LIBRARY_PATH_64 "$ld_library_path"
|
||||
}
|
||||
if { $orig_dyld_library_path_saved } {
|
||||
setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
|
||||
} else {
|
||||
setenv DYLD_LIBRARY_PATH "$ld_library_path"
|
||||
}
|
||||
|
||||
verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# proc restore_ld_library_path_env_vars { }
|
||||
#######################################
|
||||
|
||||
proc restore_ld_library_path_env_vars { } {
|
||||
global orig_environment_saved
|
||||
global orig_ld_library_path_saved
|
||||
global orig_ld_run_path_saved
|
||||
global orig_shlib_path_saved
|
||||
global orig_ld_libraryn32_path_saved
|
||||
global orig_ld_library64_path_saved
|
||||
global orig_ld_library_path_32_saved
|
||||
global orig_ld_library_path_64_saved
|
||||
global orig_dyld_library_path_saved
|
||||
global orig_ld_library_path
|
||||
global orig_ld_run_path
|
||||
global orig_shlib_path
|
||||
global orig_ld_libraryn32_path
|
||||
global orig_ld_library64_path
|
||||
global orig_ld_library_path_32
|
||||
global orig_ld_library_path_64
|
||||
global orig_dyld_library_path
|
||||
|
||||
if { $orig_environment_saved == 0 } {
|
||||
return
|
||||
}
|
||||
|
||||
if { $orig_ld_library_path_saved } {
|
||||
setenv LD_LIBRARY_PATH "$orig_ld_library_path"
|
||||
} elseif [info exists env(LD_LIBRARY_PATH)] {
|
||||
unsetenv LD_LIBRARY_PATH
|
||||
}
|
||||
if { $orig_ld_run_path_saved } {
|
||||
setenv LD_RUN_PATH "$orig_ld_run_path"
|
||||
} elseif [info exists env(LD_RUN_PATH)] {
|
||||
unsetenv LD_RUN_PATH
|
||||
}
|
||||
if { $orig_shlib_path_saved } {
|
||||
setenv SHLIB_PATH "$orig_shlib_path"
|
||||
} elseif [info exists env(SHLIB_PATH)] {
|
||||
unsetenv SHLIB_PATH
|
||||
}
|
||||
if { $orig_ld_libraryn32_path_saved } {
|
||||
setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path"
|
||||
} elseif [info exists env(LD_LIBRARYN32_PATH)] {
|
||||
unsetenv LD_LIBRARYN32_PATH
|
||||
}
|
||||
if { $orig_ld_library64_path_saved } {
|
||||
setenv LD_LIBRARY64_PATH "$orig_ld_library64_path"
|
||||
} elseif [info exists env(LD_LIBRARY64_PATH)] {
|
||||
unsetenv LD_LIBRARY64_PATH
|
||||
}
|
||||
if { $orig_ld_library_path_32_saved } {
|
||||
setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32"
|
||||
} elseif [info exists env(LD_LIBRARY_PATH_32)] {
|
||||
unsetenv LD_LIBRARY_PATH_32
|
||||
}
|
||||
if { $orig_ld_library_path_64_saved } {
|
||||
setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64"
|
||||
} elseif [info exists env(LD_LIBRARY_PATH_64)] {
|
||||
unsetenv LD_LIBRARY_PATH_64
|
||||
}
|
||||
if { $orig_dyld_library_path_saved } {
|
||||
setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path"
|
||||
} elseif [info exists env(DYLD_LIBRARY_PATH)] {
|
||||
unsetenv DYLD_LIBRARY_PATH
|
||||
}
|
||||
}
|
||||
|
||||
#######################################
|
||||
# proc get_shlib_extension { }
|
||||
#######################################
|
||||
|
||||
proc get_shlib_extension { } {
|
||||
global shlib_ext
|
||||
|
||||
if { [ istarget *-*-darwin* ] } {
|
||||
set shlib_ext "dylib"
|
||||
} elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } {
|
||||
set shlib_ext "dll"
|
||||
} elseif { [ istarget hppa*-*-hpux* ] } {
|
||||
set shlib_ext "sl"
|
||||
} else {
|
||||
set shlib_ext "so"
|
||||
}
|
||||
return $shlib_ext
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user