Commit Graph

447 Commits

Author SHA1 Message Date
Saleem Abdulrasool 8d5ab875f6 fallback_malloc: silence conversion warning (NFC)
This silences some conversion warnings from GCC 4.9.2.  Simply casting the RHS
doesn't seem to be sufficient to silence the warning.  Convert the operation
equal operator usage to calculation and assignment.

llvm-svn: 238945
2015-06-03 17:25:35 +00:00
Saleem Abdulrasool fcdcf1b1e9 fallback_malloc: silence qual-cast warning (NFC)
This silences a GCC 4.9.2 qual-cast warning in the fallback_malloc codepath.
NFC.

llvm-svn: 238944
2015-06-03 17:25:33 +00:00
Marshall Clow 604de5c256 Implement uncaught_exceptions() to get a count, rather than a bool. Update the libc++abi version. Reviewed as http://reviews.llvm.org/D10067
llvm-svn: 238827
2015-06-02 13:03:17 +00:00
Logan Chien bbb4b1ca25 libcxx: Switch to use __gnu_unwind_frame() for libunwind.
As a step to fix libunwind unw_step(), a new function
__gnu_unwind_frame() has been introduced to libunwind, and it is
required to use this function so that some libunwind internal data
structure can be updated properly.

llvm-svn: 238561
2015-05-29 15:34:24 +00:00
Chaoren Lin 3abb86da62 Make sure !empty() before calling String::front().
Reviewers: howard.hinnant

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D9954

llvm-svn: 238263
2015-05-26 23:14:26 +00:00
Anton Korobeynikov 1af9c7b9d4 LIBCXXABI_LIBUNWIND_INCLUDES is already set before calling find_path, and find_path will not update it.
So cmake will throw error "include_directories given empty-string as include directory". 
Use other variable name for the include path and do not find the default libunwind.h in the system path.

http://reviews.llvm.org/D9641

Patch by Jingyi Wei!

llvm-svn: 236936
2015-05-09 21:03:01 +00:00
Anton Korobeynikov 396441c873 Typos
llvm-svn: 236889
2015-05-08 18:14:14 +00:00
Anton Korobeynikov d3b50dce40 Fix "TODO" and provide the configure-time options to find libunwind.
This is done the same way as we're looking for libc++

llvm-svn: 236874
2015-05-08 16:10:11 +00:00
Eric Fiselier 65ace9daa3 Disallow conversions from function pointers to void*.
Function pointers and member function pointers cannot be converted to void*.
libc++abi incorrectly allows this conversion for function pointers.

Review URL: http://reviews.llvm.org/D8811

llvm-svn: 236299
2015-05-01 01:49:37 +00:00
Eric Fiselier 9429684cce Fix syntax error in CMake created when a variable is not defined.
llvm-svn: 236115
2015-04-29 15:53:03 +00:00
Saleem Abdulrasool 03b487bf19 libc++abi: work around layering violation
This papers over a layering violation currently between libc++abi and libunwind.
It reaches into the sources to get the declaration of an ABI defined function.
This should allow the ARM buildbot to continue building libc++abi again.

llvm-svn: 235965
2015-04-28 02:52:47 +00:00
Saleem Abdulrasool e5f6e2b671 libc++abi: try harder to force the LLVM unwinder on ARM
Attempting to default the option to ON for ARM doesnt seem to work.  Force the
check lower and perform the check at the two sites that matter: the CPPFLAGS
definition and the header search path setup.

llvm-svn: 235964
2015-04-28 02:09:53 +00:00
Saleem Abdulrasool fd8a75d730 libc++abi: enable LLVM unwinder by default for ARM
libc++abi uses EHABI extensions, which are only part of the LLVM unwinder.  When
targeting ARM by default, enable the use of the LLVM unwinder.  Hopefully this
will fix the ARM native bot

llvm-svn: 235904
2015-04-27 18:19:33 +00:00
Saleem Abdulrasool 7c5d5ac831 libc++abi: remove unused variable
The externC variable was set but unused.  This constantly flagged a warning from
gcc.  Replace it with a comment until such a time that we need it.

llvm-svn: 235830
2015-04-27 02:21:57 +00:00
Saleem Abdulrasool a49aa027c1 libc++abi: clear up some -Wqual-cast warnings
Cleans up cast qualifier warnings identified by GCC 4.9.2.

llvm-svn: 235829
2015-04-27 02:21:55 +00:00
Saleem Abdulrasool 91aef804b1 libc++abi: silence some warnings
Cleans up the -Wundef warning caused by the use of the __LITTLE_ENDIAN__ macro.
Instead use `__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__`.  `__BYTE_ORDER__` is
defined by GCC since 4.2 and by clang.  This avoids the undef case where a macro
may be undefined.  This has previously caught real errors in libunwind.

llvm-svn: 235828
2015-04-27 02:21:52 +00:00
Saleem Abdulrasool a121d08ff8 libc++abi: remove build infrastructure for unwind
This removes the libunwind build infrastructure as libunwind is gaining its own
CMakeLists.txt.  The removal must occur first due to the multiple definitions of
the same target.

llvm-svn: 235794
2015-04-25 01:46:29 +00:00
Saleem Abdulrasool ac18e0639f libc++abi: move tests back
These are apparently related to libc++'s unwind personality handler and not
unwind core.  Move them back to the correct location.

llvm-svn: 235765
2015-04-24 20:20:54 +00:00
Saleem Abdulrasool a01b1afad4 libc++abi: remove the duplicated unwind content
The unwinder has been moved into its own project setup at
http://svn.llvm.org/projects/libunwind/trunk.  This simply removes the now
duplicated content.  This move was previously discussed on llvmdev at [1].

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html

llvm-svn: 235759
2015-04-24 19:40:31 +00:00
Reid Kleckner fa990f0338 Declare __cxa_new_handler as extern "C", or it declares a new variable
Reverts change from r219012 to fix ABI incompatibility. Let's not worry
about the GCC warning here.

llvm-svn: 235013
2015-04-15 15:35:56 +00:00
Eric Fiselier b6030b9dbf [libcxxabi] Disallow Base to Derived conversions for catching pointers to members.
Summary:
I accidentally implemented the 4.11 [conv.mem] conversions for libc++abi in a recent patch. @majnemer pointed out that 5.13 [except.handle] only allows the pointer conversions in 4.10 and not those is 4.11. This patch no longer allows the following example code:

```c++
struct A {};
struct B : public A {};

int main() {
  try {
    throw (int A::*)0;
  } catch (int B::*) {
    // exception caught here.
  }
}
```

Reviewers: mclow.lists, jroelofs, majnemer

Reviewed By: majnemer

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D8845

llvm-svn: 234254
2015-04-06 23:03:01 +00:00
Eric Fiselier 1b00fc5d81 [libcxxabi] Fix multi-level pointer conversions and pointer to member conversion detection.
Summary:
Currently there are bugs in out detection of multi-level pointer conversions and pointer to member conversions. This patch fixes the following issues.

* Allow multi-level pointers with different nested qualifiers.
* Allow multi-level mixed pointers to objects and pointers to members with different nested qualifiers.
* Allow conversions from `int Base::*` to `int Derived::*` but only for non-nested pointers.

There is still some work that needs to be done to clean this patch up but I want to get some input on it.
Open questions:

* Does `__pointer_to_member_type_info::can_catch(...)` need to adjust the pointer if a base to derived conversion is performed?


Reviewers: danalbert, compnerd, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8758

llvm-svn: 233984
2015-04-02 23:26:37 +00:00
Eric Fiselier 0e90f3ff9a Revert r228351 - Dont install header files.
llvm-svn: 233781
2015-04-01 02:56:13 +00:00
Ed Schouten 25a624e43d Also use dl_iterate_phdr() on CloudABI.
The unwinder now works on CloudABI. All exception-related libc++ tests
now pass.

This change was actually part of D8169, which also adds support for
FreeBSD. That, however, still requires some more polishing.

llvm-svn: 233676
2015-03-31 07:59:53 +00:00
Ed Schouten d0c480b04c Don't print debugging messages to stdout.
There is some debugging code in cxa_demangle.cpp that prints messages on
stdout. In general this is not safe, as the program itself may use
stdout to write its output. Change this code to write to stderr.

Differential Revision:	http://reviews.llvm.org/D8167

llvm-svn: 232716
2015-03-19 09:17:21 +00:00
Eric Fiselier cf74f5d20b Let libc++'s LIT configuration setup our linker paths and env.
llvm-svn: 232529
2015-03-17 19:45:21 +00:00
Eric Fiselier 4260252222 add option to tell LIT where to find the libc++ library when built out of tree
llvm-svn: 232518
2015-03-17 18:58:14 +00:00
Renato Golin fab3c735c3 Update copyright year to 2015.
llvm-svn: 232095
2015-03-12 20:13:54 +00:00
Eric Fiselier fe2f1f095f Remove unneeded const_cast in readPointerHelper. Pointed out by jroelofs
llvm-svn: 231852
2015-03-10 21:32:53 +00:00
Eric Fiselier e6cdf34116 [libcxx] Fix PR21580 - Undefined behavior in readEncodedPointer()
Summary: This patch fixes a bug in `readEncodedPointer()` where it would read from memory that was not suitably aligned. This patch fixes it by using memcpy.

Reviewers: danalbert, echristo, compnerd, mclow.lists

Reviewed By: compnerd, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8179

llvm-svn: 231839
2015-03-10 20:43:34 +00:00
Saleem Abdulrasool 762ff68a95 Unwind: define more interfaces more often
These are also part of the Unwind interfaces.  However, their implementation is
different in EHABI vs frame tables based exception handling.  Always provide a
definition.  This partially undoes a movement change from earlier to make the
handling a bit simpler rather than grouping the two implementations together.

llvm-svn: 231690
2015-03-09 19:35:12 +00:00
Saleem Abdulrasool d9e577933b Unwind: always define unwind APIs
These interfaces are not zero cost related, but rather generic unwind APIs used
by consumers of the Unwind library.  Always provide the definition as they are
needed for both Zero Cost and Frame Table based implementations.

llvm-svn: 231666
2015-03-09 16:46:43 +00:00
Saleem Abdulrasool a99e152e80 Unwind: remove unnecessary check
Linux/GNU on AArch64 EH ABI Level III is implemented using exception frame
tables as defined in LSB II.11.6.  The exception frame tables use the DWARF
Exception Header Encoding as described in LSB II.11.5.1.  We already defined the
appropriate definition _LIBUNWIND_SUPPORT_DWARF_UNWIND to enable this.

llvm-svn: 231580
2015-03-07 22:21:31 +00:00
Saleem Abdulrasool af7e539595 Unwind: tweak register handling for AArch64
AArch64 uses // as the comment character (although, Darwin uses ;).  However,
since we are using the C preprocessor on these files, // can be used as the
comment character across the board.

Tweak the platform guard to recognise __aarch64__ as well as __arm64__ for the
platform identifier.

llvm-svn: 231578
2015-03-07 21:36:08 +00:00
Nick Lewycky 5b2d125c92 Fix build with GCC:
- GCC doesn't support #pragma mark, only Apple GCC and clang. Wrap the pragma mark's in #if 0 to make gcc ignore them but xcode still see them.
 - Wrap a bunch of "#pragma clang" lines in #ifdef __clang__.
 - Pacify gcc's -Wparenthesis in a case where it's quite reasonable.

llvm-svn: 231344
2015-03-05 02:56:05 +00:00
Eric Fiselier 14dbeaadc1 [libcxxabi] Build both static and shared versions of libc++abi by default.
Summary:
This patch builds both static and shared versions of libc++abi by default. It adds/repurposes the following cmake options:
* `LIBCXXABI_ENABLE_SHARED`: Enable/disable building the shared library. (Previously using `OFF` would build the static library instead)
* `LIBCXXABI_ENABLE_STATIC`: Enable/disable building the static library.

This patch also re-purposes the CMake target `cxxabi` to be a meta-target for `cxxabi_shared` and `cxxabi_static`. This could potentially break other builds that depend on `cxxabi` being a library target. We will need to apply a patch to libc++'s CMake before committing this change. 

Running the tests is still only supported when the shared version is built. Support for running the tests against the static library will come in another patch.


Reviewers: jroelofs, mclow.lists, danalbert, compnerd

Reviewed By: danalbert, compnerd

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8013

llvm-svn: 231075
2015-03-03 15:59:09 +00:00
Saleem Abdulrasool 48205982a3 Unwind: make it build on Darwin again
The support for the LSB eh_frame_hdr extension was overzealous in trying to
include headers.  Be more careful to permit building on Darwin.

llvm-svn: 230837
2015-02-28 02:23:54 +00:00
Dan Albert 198d366fad Add .eh_frame_hdr search to Linux unwinder.
This improves the performance of unwinding on DWARF based targets. The
32-bit x86 support for scanning the full eh_frame
(CFI_Parser::findFDE) apparently does not work (at least not on
Linux). Since the eh_frame_hdr code delegates to that, this still
doesn't work for x86 Linux, but it has been tested on x86_64 Linux and
aarch64 Android.

llvm-svn: 230802
2015-02-27 22:21:07 +00:00
Jonathan Roelofs 0b57fc3147 Add remote testing support to the lit config
Now that the corresponding support in libcxx has landed (r230592), adding
support here is pretty simple.

llvm-svn: 230643
2015-02-26 15:55:01 +00:00
Saleem Abdulrasool bd04c44f48 Unwind: clean up some GCC warnings
This cleans up a set of -Wsign-conversion, -Wint-conversion, and -Wformat
warnings from GCC 4.9.2 on Linux.  NFC.

llvm-svn: 230606
2015-02-26 04:01:37 +00:00
Jonathan Roelofs ea163d9fa8 Add .fpu directives to ARM unwind save & restore functions.
TODO: The iwmmx register save & restore functions still need the same treatment.
      I didn't do that in this patch because the integrated assembler has a bug
      where it refuses to build them on -march=armv6-m, even with
         .march armv5t
         .arm
      in front of those functions.

This should fix PR22384.

http://reviews.llvm.org/D7258

llvm-svn: 230360
2015-02-24 20:09:29 +00:00
Eric Fiselier 64cfdfea5a Add temporary workaround for missing symbol __cxa_throw_bad_new_array_length on OS X.
llvm-svn: 230125
2015-02-21 04:30:36 +00:00
Sergey Dmitrouk 0aa66cf8f8 Do not add -fno-exceptions without -funwind-tables
Adding just -fno-exceptions breaks libunwind in quite mysterious way
when it's there, but exception handling doesn't work because of dummy
unwind tables.

Also as using exceptions implies references to symbols defined in
libcxx, abort build of libcxxabi as shared library if we have to keep
exceptions (when compiler supports -fno-exceptions, but not
-funwind-tables; one example would be a cross-compiler, in which case
testing for -funwind-tables flag by CMake actually requires libunwind to
be available before it's built).

llvm-svn: 229427
2015-02-16 19:51:06 +00:00
Jonathan Roelofs d76078f81b Moar post-commit review.
Apparently typing is hard.

llvm-svn: 229216
2015-02-14 02:02:56 +00:00
Jonathan Roelofs bb755d614a Address post-commit review comments
llvm-svn: 229207
2015-02-14 01:38:35 +00:00
Jonathan Roelofs c1d025fb61 Make the unwinder build on thumbv6-m with the integrated assembler.
http://reviews.llvm.org/D7630

llvm-svn: 229194
2015-02-14 00:21:03 +00:00
Saleem Abdulrasool 9dd5ca1fe8 unwind: always export unw_local_addr_space
It seems that the remote unwinder is entirely unused at this moment.
unw_local_addr_space was referencing sThisAddressSpace which use to be a static
in global namespace.  It has since then become a member variable of
LocalAddressSpace.  Update this definition and always export it (needed to
implement unw_get_proc_info_by_ip for ARM).

llvm-svn: 229133
2015-02-13 19:04:48 +00:00
Saleem Abdulrasool ebfe815f5c unwind: use sizeof() instead of hardcoded sizes
The statically allocated strings have a fixed size which can be computed using
the sizeof operator rather than duplicating the allocation size which can drift.
NFC.

llvm-svn: 229126
2015-02-13 17:36:11 +00:00
Ed Schouten 12dc2c4f3b Don't use bzero() and strcpy().
Instead of bzero(), we can simply use memset(). The strcpy() calls are
unneeded, as we can simply keep track of a pointer to the constant
strings we are copying.

Reviewed by:	Jonathan Roelofs

llvm-svn: 229074
2015-02-13 07:18:22 +00:00
Saleem Abdulrasool 3db633ab81 unwind: use explicit memcpy for register saving
Convert the register saving code to use an explicit memcpy rather than the
implicit memcpy from the assignment.  This avoids warnings from -Wcast-qual on
GCC and makes the code more explicit.  Furthermore, use sizeof to calculate the
offsets rather than adding magic numbers, improving legibility of the code.
NFC.

llvm-svn: 228904
2015-02-12 04:25:05 +00:00