98 Commits (e23882fb234a2fa7dc12bd4206ec2dd230f4f69e)

Author SHA1 Message Date
David Chisnall e23882fb23 Rewrite the selector table in C++.
This replaces a few home-grown datastructures with third-party ones that
get a lot more testing:

 - The home-grown hopscotch hash table is moved to using robin map.  The
   original was designed to be lock free, but we've been using it behind
   a lock for ages.
 - The selector list is now a std::vector.
 - The types list now use std::forward_list.

This also removes a couple of code paths that haven't been used since we
started using the new ABI data structures internally and upgrading at
load time.

The new code tries to differentiate in the static type system between
registered and unregistered selectors.  The check for whether a selector
is registered is fragile and depends on no selector being mapped or
allocated in memory below the total number of selectors.  This check can
now disappear on most code paths.

On a single test machine (not guaranteed to be representative) the test
suite now completes around 20% faster.
3 years ago
David Chisnall 7c23a07bb4 Various CMake cleanups and modernisations.
This adds a dependency on a version of CMake with support for Objective-C,
removing a number of hacks to make CMake work and introduces a few
modernisations:

 - Options use CMake's `option` mechanism.
 - A lot of things now use generator expressions, which should improve the
   things like the multi-config Ninja generator.
 - We no longer depend on hacks to build in CI.

At the same time, a few other things are simplified:

 - There is no longer support for building without C++ support and we depend on
   a C++ standard library, not just a runtime. This makes it possible to use
   more C++ features inside the runtime.
 - We no longer support clang-cl on Windows and instead require clang.exe.
 - Support for the Boehm GC has been removed.
3 years ago
Frederik Seiffert 35ac9bc072 Don't pass ANDROID_ARM_NEON testing C++ runtime
Fixes building for Android arm64-v8a with NDK r25, which no longer supports this flag. Since we were passing this unconditionally we were previously inadvertently disabling NEON support if the flag wasn't set.
3 years ago
Bernard Cafarelli 2deec335f6 Add pthreads to link libraries, not link flags
This fixes linking errors with --as-needed like:
ld: libobjc.so.4.6: undefined reference to `pthread_mutexattr_destroy'

Fixes #180
5 years ago
Niels Grewe 014f386f58 Add support for libc++abi.
Extends C++ interop with autodetected support for libc++abi in addition to the existing support for libcxxrt and libsubc++.

Fixes #142.
5 years ago
Frederik Seiffert ac9a837e69 Fix eh_trampoline.s generation when cross compiling. 5 years ago
David Chisnall 7914c5707a Fix cross building.
When we stopped using CXXFLAGS in eh_personality.s generation, we lost
the ability to propagate -m32 or -target through, so cross-compile
didn't work.  These flags are now passed through correctly, so (so
'-pipe -O2' will appear as two arguments, rather than being combined as
a single value that then causes clang to abort with an unknown argument
error, which was the original motivation for this change).

This is the correct fix for #177
5 years ago
David Chisnall 365e53632e Don't use CXXFLAGS when compiling eh_trampoline.cc
The way that we were doing this didn't handle multiple flags and we
actually don't want the user to override these flags because that file
needs to be compiled in a very specific way.

Fixes #177
5 years ago
David Chisnall 00ca954ae6 Check that the submodule exits.
Print an informative message if someone forgets to fetch the
submodule.
5 years ago
David Chisnall a575db7392 Fix C++ runtime detection.
- Don't try to detect libc++abi.  It doesn't actually work, so don't
   try it.
 - Correctly try to link the standard library.

This should fix the build on GNU/Linux systems with libc++abi.so
installed (including our Ubuntu CI!).
5 years ago
Frederik Seiffert cca84b183c Fix building without ObjC++ support. 6 years ago
David Chisnall b39a42252e Hide ARC warnings behind an off-by-default flag. 6 years ago
David Chisnall 65d6b279a0 Rework C++ exception interop again.
We now, the first time we encounter a foreign exception, throw a C++
exception through a frame that has a custom personality function and
probe the layout of the __cxa_exception structure.
We then use the offsets learned from this along with the public ABI
functions for allocating the structure.

At the same time, add a test that we are correctly setting the count of
uncaught exceptions.

Fixes #146
6 years ago
David Chisnall 76e081dc48 Initial run-time detection of C++ EH ABI variant.
On Itanium C++ ABI platforms, there are a lot of different variations
that have subtly different structure layouts.  This commit adds a
run-time test that throws a C++ exception through a function that has
its personality function replaced with a wrapper so that we can inspect
a C++ exception in controlled conditions.

Initially, this just detects the exception type value used for C++
exceptions.
6 years ago
Niels Grewe ecdc4ffbd4 check both for the full and the short name of the C++ ABI library, unset cache if the library is not usable 6 years ago
Niels Grewe 5578072611
Write a correct .pc file for gnustep-make installs
Fixes #140
6 years ago
David Chisnall 8e59872681 Require C++14 in CMake. 6 years ago
Niels Grewe 8249036318 generate a pkg-config file 6 years ago
David Chisnall 55819ce107 Move the libstdc++ code path to a separate file.
We need to #include <exception> for this to work, but this brings in the
public definition of `std::type_info` and, unfortunately, that breaks
the private definition that we need in this compilation unit.
6 years ago
David Chisnall 3f38f691af Rework ARC code as C++.
Move the weak references hash table to use a well-tested third-party
implementation instead of the hand-rolled version.
7 years ago
Frederik Seiffert 61eee9e0a2 Pass on Android toolchain flags for CXX runtime check. 7 years ago
Jordan Schidlowsky f5f452bcb9 cmake fails when project is used in other cmake projects. CMAKE_CURRENT_LIST_DIR should be a more portable path 7 years ago
David Chisnall 52ca9b207b Make it easier to override the assembler on Windows.
This is necessary for building with Visual Studio (msbuild)
7 years ago
Niels Grewe e627c14b5f fix(libBlocksRuntime compatibility): Install proper compatibiltiy headers for libBlocksRuntime 7 years ago
David Chisnall c489cc909d Fix header symlink installation. 7 years ago
David Chisnall 455a4758f1 Make CMake install the dll on Windows. 7 years ago
David Chisnall f4be4d5696 Disable old ABI compat by default on Windows. 7 years ago
Marvin Scholz c498a65fe6 Add missing header file to CMakeLists 8 years ago
David Chisnall f7a21aaf4d Bump the CPack version to 2.0. 8 years ago
David Chisnall 2978cbb760 Don't try to symlink headers on Windows 8 years ago
David Chisnall bab334acd4 Fix cmake configuration for Windows builds. 8 years ago
David Chisnall 934cd13a7a Initial pass at Windows support.
All tests now pass with the new ABI on x86-64, with the new ABI.  Some
of the code is ugly and other platforms are probably broken.
8 years ago
David Chisnall c9e8743095 GC some dead code and move another legacy-compat file under the correct
option.
8 years ago
David Chisnall 2934a98503 Support building without support for old ABIs. 8 years ago
David Chisnall b81df02b91 Merge branch 'master' into newabi
Simplify the setSubclass dtable updating mechanism.
8 years ago
Jason Barmparesos 682717b08d Clang++ provides its own exception types on Linux. (#68)
Fix type of `__cxa_allocate_exception` with recent libsupc++.

Recent versions of GNU libsupc++ provide a definition of `__cxa_allocate_exception` that has a `noexcept` qualifier.  This is sensible (if allocating an exception throws an exception, then something is badly wrong) but it not what the ABI spec says.  We provide our own definition of this, which must match another if provided.

This wouldn't normally be a problem, but recent libstdc++ headers appear to leak libsupc++ headers into the namespace, so we're seeing these definitions even without explicitly including any C++ ABI-related headers.
8 years ago
David Chisnall 314a4167ca Remove low memory profile.
This hasn't been tested for a long time and probably doesn't work.
8 years ago
David Chisnall 14889c540f Bump cmake minimum version.
Fixes #51
8 years ago
David Chisnall f91fb2e745 Checkpoint more work on new ABI.
We're now using a new class and category structure and auto-upgrading the old ones.  Other changes:

- The Ivar structure now points to the ivar offset variable, so we can more easily find it.
- Categories can now add properties.
8 years ago
David Chisnall 76e7d4b07f Merge branch 'master' into newabi 8 years ago
David Chisnall 587cf3f27b Another try at making CMake work. 8 years ago
David Chisnall bb78abb662 Fix copy and paste type. 8 years ago
David Chisnall 7832765112 Improve detection of libsupc++ 8 years ago
David Chisnall dc9b8313a4 Rework C++ library detection.
macOS ships with libc++abi, which doesn't provide the hooks required
for interop, so this was causing all of the tests to fail to link in
the Travis macOS test.  We're now correctly detecting that it won't
work on macOS and disabling those tests.
8 years ago
David Chisnall fefb333b01 Remove the separate libobjcxx.
If we don't find a separate dynamically linkable C++ runtime, then
depend on the C++ standard library implementation.
8 years ago
David Chisnall a54272c1ab Merge origin/master into newabi (using imerge) 8 years ago
Daniel Ferreira 1593ac04af Add objc-class.h to objc headers
Some applications still include the old objc-class.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
9 years ago
davidchisnall e285ba83a9 Merge pull request #36 from theiostream/block-headers
build: add compatibility symlink for block headers

Fixes #34
9 years ago
Daniel Ferreira a9aba57e7c build: add compatibility symlink for block headers
On FreeBSD and OSX, the block runtime functions are defined on a Block.h
and a Block_private.h headers on the include path as opposed to
libobjc2's objc/blocks_runtime.h and objc/blocks_private.h respectively.

This commit amends libobjc2's install routine to create the
FreeBSD-style headers as symlinks to the ones provided by libobjc2 for
improved compatibility.
9 years ago
Daniel Ferreira a3e1a0d3ed Add objc-runtime.h to objc headers
Some applications still include the old objc-runtime.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
9 years ago