Commit Graph

1123 Commits

Author SHA1 Message Date
Anthony Green
6239c28741 Add experimental moxie travis build 2018-03-13 22:13:44 -04:00
Anthony Green
01db31d94e Update moxie sub opcode 2018-03-13 20:41:55 -04:00
Anthony Green
e8f5a43033 Fix appveyor badge 2018-03-13 09:27:00 -04:00
Anthony Green
d1689dd3bf Fix travis badge. Add REAME.md to dist files 2018-03-13 09:24:37 -04:00
Anthony Green
785351fbc2 Preformat release notes 2018-03-13 09:21:49 -04:00
Anthony Green
8c7fbd1616 Preformat release notes 2018-03-13 09:20:44 -04:00
Anthony Green
54f31b0056 Try to fix table 2018-03-13 09:17:57 -04:00
Anthony Green
3a29a27a86 Clean up markdown table 2018-03-13 09:14:40 -04:00
Anthony Green
fbfc3b048f Move to markdown 2018-03-13 09:12:21 -04:00
Anthony Green
a31d3d3ba6 Add travis and appveyor build badges 2018-03-13 09:11:24 -04:00
Anthony Green
16313cb274 Support compiler specific warning suppression flags 2018-03-13 08:52:30 -04:00
Anthony Green
cca6d1fb54 Support compiler specific warning suppression flags 2018-03-13 08:51:34 -04:00
Anthony Green
9291f941c2 Add bhaible's missing Makefile 2018-03-13 08:37:21 -04:00
Anthony Green
bede01d82e Remove stray directory 2018-03-13 07:53:33 -04:00
Anthony Green
9aefbb1031 Update version number to next pre-release 2018-03-13 07:51:02 -04:00
Anthony Green
ddf7a8f751 Update test list for dist 2018-03-13 07:47:57 -04:00
Anthony Green
6186261cb3 Add Bruno Haible and Bill Triggs' libffi testsuite 2018-03-12 21:53:18 -04:00
Anthony Green
4e8f79d558 Next release will be 3.3 2018-03-11 18:21:46 -04:00
Stef O'Rear
3840d49aaa New RISC-V port (#281)
* Add RISC-V support

This patch adds support for the RISC-V architecture (https://riscv.org).

This patch has been tested using QEMU user-mode emulation and GCC 7.2.0
in the following configurations:

* -march=rv32imac -mabi=ilp32
* -march=rv32g -mabi=ilp32d
* -march=rv64imac -mabi=lp64
* -march=rv64g -mabi=lp64d

The ABI currently can be found at
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md .

* Add RISC-V to README

* RISC-V: fix configure.host
2018-03-11 08:55:15 -04:00
Anthony Green
dca52b55bc Merge pull request #406 from trofi/master
ia64: fix variadic function closures with FP arguments
2018-03-11 08:50:01 -04:00
Anthony Green
83d9aba3a4 Merge pull request #407 from trofi/ia64-small-struct
ia64: fix small struct return
2018-03-11 08:48:42 -04:00
Anthony Green
ab15405693 Merge pull request #409 from andreas-schwab/master
Revert "Fix passing struct by value on aarch64"
2018-03-11 08:46:58 -04:00
Andreas Schwab
e66fd67820 Revert "Fix passing struct by value on aarch64"
This reverts commit 482b37f004.

That was actually a bug in python, see <https://bugs.python.org/issue30353>.
2018-02-20 10:47:09 +01:00
Sergei Trofimovich
b58caef7fd ia64: fix small struct return
This change fixes libffi.call/struct10.c failure on ia64:
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test

.Lst_small_struct handles returns for structs less than 32 bytes
(following ia64 return value ABI [1]). Subroutine does roughly the
following:

```
    mov [sp+0]  = r8
    mov [sp+8]  = r9
    mov [sp+16] = r10
    mov [sp+24] = r11
    memcpy(destination, source=sp, 12);
```

The problem: ia64 ABI guarantees that top 16 bytes of stack are
scratch space for callee function. Thus it can clobber it. [1]
says (7.1 Procedure Frames):
"""
* Scratch area. This 16-byte region is provided as scratch storage
  for procedures that are called by the current procedure. Leaf
  procedures do not need to allocate this region. A procedure may
  use the 16 bytes at the top of its own frame as scratch memory,
  but the contents of this area are not preserved by a procedure call.
"""

In our case 16 top bytes are clobbered by a PLT resolver when memcpy()
is called for the first time. As a result memcpy implementation reads
already clobbered data frop top of stack.

The fix is simple: allocate 16 bytes of scrats space prior to memcpy()
call.

[1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf

Bug: https://bugs.gentoo.org/634190
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2018-02-17 19:01:29 +00:00
Sergei Trofimovich
45da2fcbcd new test: return small struct
The bug originally was discovered in https://bugs.gentoo.org/634190
where complicated callback was returning invalid data on ia64.

This change adds minimal reproducer that fails only on ia64 as:

FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O2 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O3 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -Os execution test

Test passes on amd64. The fix is in the following commit.

Bug: https://bugs.gentoo.org/634190
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2018-02-17 18:53:02 +00:00
Sergei Trofimovich
11de69ddb7 ia64: fix variadic function closures with FP arguments
libffi test framework already flagged failures as:

```
    FAIL: libffi.call/cls_double_va.c -W -Wall -Wno-psabi -O0 output pattern test, is 7.0
    res: 4
    0.0
    res: 4
    ? should match 7.0
    ?es: 4
    ?.0
    res: 4
```

Failure happens here at

```c
    // testsuite/libffi.call/cls_double_va.c
    ...
    char*  format    = "%.1f\n";
    double doubleArg = 7;
    ...
    CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL,
                               code) == FFI_OK);
    res = ((int(*)(char*, ...))(code))(format, doubleArg);
```

libffi expects 'doubleArg' to be located in 'f9' (second FP argument) but
gcc placed it to 'r33' (second GR).

ia64 software [1] manual described argument passing ABI in
"8.5.2 Register Parameters" as:

"""
    If an actual parameter is known to correspond to a floating-point
    formal parameter, the following rules apply:
    a) The actual parameter is passed in the next available floating-point
       parameter register, if one is available. Floating-point parameter
       registers are allocated as needed from the range f8-f15, starting
       with f8.
    b) If all available floating-point parameter registers have been used,
       the actual parameter is passed in the appropriate general register(s).
       (This case can occur only as a result of homogeneous floating-point
       aggregates, described below.)

    If a floating-point actual parameter is known to correspond to
    a variable-argument specification in  the formal parameter list,
    the following rule applies:
    c) The actual parameter is passed in the appropriate general
       register(s).

    If the compiler cannot determine, at the point of call,
    whether the corresponding formal parameter is a varargs parameter,
    it must generate code that satisfies both of the above conditions.
    (The compiler’s determination may be based on prototype declarations,
    language standard assumptions,  analysis, or other user options or
    information.)
"""

We have [c] case here and gcc uses only GR for parameter passing.

The change binds known variadic arguments ro GRs instead of FPs as those
are always expected to be initialized for all variadic call types.

This fixes all 10 failures on ia64-unknown-linux-gnu:

```
                 === libffi Summary ===
    -# of expected passes            1945
    -# of unexpected failures        10
    +
    +# of expected passes            1955
```

[1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2018-02-11 12:17:32 +00:00
Anthony Green
9429968b82 Merge pull request #403 from frida/fix/x86-sysv-pic-closure-regression
Fix x86 SysV closure in PIC mode
2018-02-10 23:23:33 -05:00
Anthony Green
f08b2be627 Merge pull request #405 from andreas-schwab/master
Fix passing struct by value on aarch64
2018-02-10 23:21:49 -05:00
Andreas Schwab
482b37f004 Fix passing struct by value on aarch64
This fixes the ctypes test in the python testsuite.
2018-02-07 12:50:14 +01:00
Ole André Vadla Ravnås
28d3b61bdd Fix x86 SysV closure in PIC mode
The assembly single-line comments swallowed up the remaining assembly
code of the macros due to lack of line-endings.

This is a regression introduced in b7f6d7a.
2018-01-21 01:27:22 +01:00
Anthony Green
c194448ef0 adjust env usage in travis 2018-01-10 09:38:15 -05:00
Anthony Green
5314b10671 test static lib 2018-01-10 07:22:51 -05:00
Anthony Green
bec6135dff Merge pull request #393 from thejunkjon/master
Linker error "recompile with -fPIC" for x86_64
2018-01-10 07:20:04 -05:00
Anthony Green
f6ecf10ca0 Merge pull request #401 from wzssyqa/jr-r6
mips/ffi.c: fix encoding for jr on r6
2018-01-05 16:51:44 -05:00
YunQiang Su
746dbe3a6a mips/ffi.c: fix encoding for jr on r6
mips/ffi.c: instruction jr has a different encoding for r6
2018-01-03 10:07:41 +08:00
Anthony Green
c50ba182f4 Merge pull request #398 from emaste/master
Enable symbol versioning when ld is LLVM's lld
2018-01-01 15:18:46 -05:00
Anthony Green
54cb3e2345 Merge pull request #396 from wzssyqa/master
mips/n32.S: disable .set mips4 on mips r6
2017-12-31 07:46:05 -05:00
Ed Maste
af6949b7af Enable symbol versioning when ld is LLVM's lld
Fixes #397
2017-12-17 23:08:52 -05:00
YunQiang Su
94c102aa69 Not set mips on mips r6
MIPS release changed encodes of some instructions, include ll/sc etc.

if .set mips4 on mips r6, as will generate some wrong encode of some instructions.
2017-12-10 14:25:01 +08:00
jon
d15581c696 Updating calls to ffi_closure_unix64_inner and ffi_closure_win64_inner to use PLT. Without this fix, statically linking libffi causes the linker error i.e. 'requires dynamic R_X86_64_PC32 reloc against ffi_closure_unix64_inner which may overflow at runtime; recompile with -fPIC)' 2017-12-01 00:34:30 -08:00
Anthony Green
716bfd8317 Merge pull request #387 from trofi/master
Makefile.am: add 'src/s390/internal.h' to source tarball
2017-11-05 09:02:37 -05:00
Sergei Trofimovich
cd5e9f8b87 Makefile.am: add 'src/s390/internal.h' to source tarball
commit 2f530de168
("s390: Reorganize assembly") introduced new header
(similar to other arches) but did not add it to source
tarball.

As a result build from 'make dist' tarballs failed as:

```
../src/s390/ffi.c:34:10: fatal error: internal.h: No such file or directory
 #include "internal.h"
          ^~~~~~~~~~~~
```

To fix it the change adds file to 'Makefile.am'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-11-05 13:56:42 +00:00
Anthony Green
4fdbb0578e Merge pull request #320 from 0-wiz-0/master
Support NetBSD with mprotect.
2017-11-03 07:05:31 -04:00
Anthony Green
b302bc3dfe Merge pull request #322 from compnerd/aarch64-base
aarch64: fix index base register for AArch64
2017-11-03 07:03:55 -04:00
Anthony Green
14eac93869 Merge pull request #384 from yan12125/fix-sgidefs-checking
Fix linux detection (closes #303)
2017-11-03 06:49:03 -04:00
Yen Chi Hsuan
9fc9dc535e Fix linux detection (closes #303) 2017-10-27 16:12:56 +08:00
Saleem Abdulrasool
1fb788ac89 aarch64: fix index base register for AArch64
The base is passed in `x3`, not in `x2`.  This fixes the indexing base
so that the right value is used.
2017-10-26 19:13:10 -07:00
Anthony Green
ad15ae762c Merge pull request #298 from frida/fix/ios-trampoline-table-complexity
Simplify iOS trampoline table allocation
2017-10-25 13:16:49 -04:00
Anthony Green
dc2ff5baab Merge pull request #323 from compnerd/x86-alloca-alignment
x86: align alloca to 16-byte boundary
2017-10-25 13:11:40 -04:00
Anthony Green
927da71662 Merge pull request #379 from jlj/master
Xcode build improvements
2017-10-25 13:05:53 -04:00