Commit Graph

906 Commits

Author SHA1 Message Date
Steven Wu
f2a436058f [libcxxabi] Insert padding in __cxa_exception struct for compatibility
Summary:
Preserve the old ABI for __cxa_exception and __cxa_dependent_exception
on 64 bit platforms or ARM_EHABI platforms.

After r276215, libunwind in llvm-project labels _Unwind_Exception to be
double word aligned. That change implictly adds a padding before
unwindHeader field in __cxa_exception and __cxa_dependent_exception.
Preserve the same negative offsets in those struct by moving the padding
to the beginning of the field.

The assumption here is that if the ABI is not aware of the padding before
unwindHeader and put the referenceCount/primaryException in there, no padding
should exist before unwindHeader.

Reviewers: EricWF, mclow.lists, ldionne, jroelofs, dexonsmith, rjmccall, compnerd, phosek, ahatanak

Reviewed By: rjmccall

Subscribers: hans, smeenai, kristof.beyls, christof, jkorous, ributzka, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D72543
2020-01-30 10:03:22 -08:00
Shoaib Meenai
076da521f3 [libcxx] Link against android_support when needed
libc++ on Android needs to be linked against libandroid_support on API
levels less than 21 to provide needed functions that aren't in the libc
on those platforms (e.g. posix_memalign for libcxxabi). libc++ from the
NDK is a linker script that pulls in libandroid_support, but for
building libc++ itself, we need to explicitly add libandroid_support as
a dependency. Moreover, libc++ headers reference the functions provided
by libandroid_support, so it needs to be added as a public dependency.

Differential Revision: https://reviews.llvm.org/D73516
2020-01-28 14:36:24 -08:00
Kazuaki Ishizaki
dac7cda3a8 [libcxxabi] NFC: Fix trivial typos in comments
Reviewers: EricWF, mclow.lists, Jim

Reviewed By: Jim

Subscribers: mgorny, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D72151
2020-01-22 11:36:31 +08:00
Krzysztof Parzyszek
020041d99b Update spelling of {analyze,insert,remove}Branch in strings and comments
These names have been changed from CamelCase to camelCase, but there were
many places (comments mostly) that still used the old names.

This change is NFC.
2020-01-21 10:15:38 -06:00
Eric Fiselier
d15fad2653 [libc++][libc++abi] Fix or suppress failing tests in single-threaded
builds.

Fix a libc++abi test that was incorrectly checking for threading
primitives even when threading was disabled.

Additionally, temporarily XFAIL some module tests that fail because
the <atomic> header is unsupported but still built as a part of the
std module.

To properly address this libc++ would either need to produce a different
module.modulemap for single-threaded configurations, or it would need
to make the <atomic> header not hard-error and instead be empty
for single-threaded configurations
2020-01-19 21:49:14 -05:00
Erik Pilkington
183b5d38d7 [demangle] Copy back some NFC commits from LLVM 2020-01-09 10:27:24 -08:00
Sergej Jaskiewicz
fb76c7934d [libcxxabi] Allow tests to link with static libc++abi/libc++ even if the shared version is present
Summary:
Right now the only way to force libc++abi tests to link with the static version of libc++abi is to set `LIBCXXABI_ENABLE_SHARED` to `OFF`. However, this doesn't work when libc++abi is built as standalone project because of [this](54c5224203/libcxxabi/CMakeLists.txt (L503-L519)).

This change allows specifying the version of the library for tests to link with.

This is useful for remote testing, for example, with `SSHExecutor`, where we _have_ to link with libc++abi statically.

Two new CMake options are introduced here: `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI` and `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX`. They can be set to `OFF` to tell the test utility to link tests with the static libraries.

It shouldn't break anything, because the default values of these options are set such that the test utility will behave the same way.

Reviewers: EricWF, mclow.lists, phosek, mehdi_amini, ldionne, jroelofs, bcraig

Subscribers: mgorny, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D71894
2020-01-09 19:01:57 +03:00
Eric Fiselier
a9245e4f86 [libc++abi] Fix non-constant initialization of default terminate
handlers.
2019-12-11 20:32:14 -05:00
Petr Hosek
1aa1702381 [libcxx{,abi}] Don't link libpthread and libdl on Fuchsia
These are a part of the libc so linking these explicitly isn't necessary
and embedding these as deplibs causes link time error.

This issues was introduced in a9b5fff which changed how we emit deplibs.

Differential Revision: https://reviews.llvm.org/D71135
2019-12-06 11:15:15 -08:00
Michał Górny
a9b5fff591 [libcxx{,abi}] Emit deplibs only when detected by CMake
This is a followup to 35bc5276ca.  It fixes the dependent libs usage
in libcxx and libcxxabi to link pthread and rt libraries only if CMake
detects them, rather than based on explicit platform blacklist.

Differential Revision: https://reviews.llvm.org/D70888
2019-12-02 22:19:20 +01:00
Sam Clegg
4230fa9390 [libcxxabi] Prevent cmake from removing our explicit system C++ include paths
We build with `-nostdinc++` and add our own header path via
`LIBCXXABI_LIBCXX_INCLUDES`.  However cmake tried to be clever and if
`LIBCXXABI_LIBCXX_INCLUDES` happens to match the compilers system path
it will remove the `-I` flag meaning we can't access any C++ headers.

Ideally cmake would be able see that we are using `-nostdinc++` and
disable this behaviour.

Differential Revision: https://reviews.llvm.org/D69973
2019-11-12 10:08:40 -08:00
Erik Pilkington
af11f417fc [demangle] NFC: get rid of NodeOrString
This class was a bit overengineered, and was triggering some PVS warnings.
Instead, put strings into a NameType and let clients unconditionally treat it
as a Node.
2019-11-04 12:17:12 -08:00
Stephan T. Lavavej
2e4f1e112d [www] Change URLs to HTTPS.
This changes most URLs in llvm's html files to HTTPS. Most changes were
search-and-replace with manual verification; some changes were manual.
For a few URLs, the websites were performing redirects or had changed
their anchors; I fixed those up manually. This consistently uses the
official https://wg21.link redirector. This also strips trailing
whitespace and fixes a couple of typos.

Fixes D69363.

There are a very small number of dead links for which I don't know any
replacements (they are equally dead as HTTP or HTTPS):

https://llvm.org/cmds/llvm2cpp.html
https://llvm.org/devmtg/2010-11/videos/Grosser_Polly-desktop.mp4
https://llvm.org/devmtg/2010-11/videos/Grosser_Polly-mobile.mp4
https://llvm.org/devmtg/2011-11/videos/Grosser_PollyOptimizations-desktop.mov
https://llvm.org/devmtg/2011-11/videos/Grosser_PollyOptimizations-mobile.mp4
https://llvm.org/perf/db_default/v4/nts/22463
https://polly.llvm.org/documentation/memaccess.html
2019-10-24 13:25:15 -07:00
Richard Smith
a9727033fb P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of is_invocable that would internally conjure up a deprecated function type.
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings.

Reviewers: mclow.lists, EricWF

Subscribers: christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D68879

llvm-svn: 375307
2019-10-19 00:06:00 +00:00
Louis Dionne
be52ff9506 [libc++abi] Introduce a LIBCXXABI_LIBRARY_VERSION option
That option controls the 'VERSION' attribute of the libc++abi shared
library, which in turn controls the name of the actual dylib being
produced.

llvm-svn: 373949
2019-10-07 19:22:04 +00:00
Louis Dionne
d03068c3e1 [libc++abi] Do not define -Dcxxabi_shared_EXPORTS when building libc++abi
CMake sets adds that definition automatically, but we don't need
or use it.

llvm-svn: 373940
2019-10-07 18:55:15 +00:00
Louis Dionne
f385a38140 [libc++abi] Remove redundant link flags on Apple platforms
These flags are already set when we create the cxxabi_shared target
using the SOVERSION and VERSION target properties, and the install_name
was already being overriden to '@rpath/libc++abi.1.dylib' by CMake
because no 'CMAKE_INSTALL_NAME_DIR' option was specified. So this is
effectively a removal of dead code with no intended functionality change.

The only think we're losing here is that we used to link against
libSystem.B.dylib instead of libSystem.dylib when building libc++abi
for macOS 10.6 -- however, I strongly suspect nobody's building
libc++abi from source for that target anymore.

llvm-svn: 373934
2019-10-07 18:12:10 +00:00
Louis Dionne
ce452b1ca9 [libc++abi] Link against libSystem on Apple platforms
On Apple platforms, libSystem is an umbrella for all other system
libraries, and libpthread (and friends) are actually just symlinks
to libSystem.

llvm-svn: 373770
2019-10-04 18:32:46 +00:00
Louis Dionne
6f9459f7fe [libc++abi] Do not export some implementation-detail functions
Summary:
Those functions started being mistakenly exported from the libc++abi
shared library after commit r344152 in 2018. Removing these symbols is
technically an ABI break. However, they are not part of the C++ ABI,
they haven't ever been re-exported from libc++, and they are not
declared in any public header, so it's very unlikely that calls to
these functions exist out there. Also, the functions have reserved
names, so any impacted user would have to have tried really hard
being broken by this removal.

Note that avoiding this kind of problem is exactly why we're now
controlling exported symbols explicitly with a textual list.

Also note that applying the hidden visibility attribute is necessary
because the list of exported symbols is only used on Apple platforms
for the time being.

Reviewers: phosek, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D68357

llvm-svn: 373602
2019-10-03 14:24:53 +00:00
Louis Dionne
c5d2746fbe [NFC][libc++abi] Convert stray tabs to spaces
llvm-svn: 373524
2019-10-02 20:45:06 +00:00
Louis Dionne
04501a22a0 [libc++abi] Remove uses of C++ headers when possible
This reduces the (circular) dependency of libc++abi on a C++ standard
library. Outside of the demangler which uses fancier C++ features, the
only C++ headers now required by libc++abi are pretty much <new> and
<exception>, and that's because libc++abi defines some types that are
declared in those headers.

llvm-svn: 373381
2019-10-01 18:43:02 +00:00
Louis Dionne
2cee0e2d97 [NFC][libc++abi] Remove trailing whitespace from sources
llvm-svn: 373379
2019-10-01 18:28:20 +00:00
Louis Dionne
a288695968 [libc++] Update link to Itanium C++ ABI documentation
llvm-svn: 373372
2019-10-01 18:14:27 +00:00
Louis Dionne
4ff35a8f0b [libc++abi] Remove redundant #include of <string.h>
<string.h> is always included, so we don't need the additional #include
only in the _WIN32 case.

llvm-svn: 373365
2019-10-01 17:53:17 +00:00
David Zarzycki
7568899b35 [Testing] unbreak after r372963
llvm-svn: 372967
2019-09-26 11:32:02 +00:00
Adhemerval Zanella
6023cf2234 [libcxxabi] Fix arm build failer with libgcc
Both arm32 armv7/armv8 bots which do not use compiler-rt are failing
to a linking issue:

[100%] Built target cxxabi_static
CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::OutputStream::writeUnsigned(unsigned long long, bool)':
/home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:55: undefined reference to `__aeabi_uldivmod'
/home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:56: undefined reference to `__aeabi_uldivmod'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

It seems after r371273 OutputStream is used more extensively and
is pulling OutputStream::writeUnsigned (which thus requires unsigned
integer module).

The straightfoward fix is to explicit link against libgcc if
compiler-rt is not used.

llvm-svn: 372921
2019-09-25 21:46:24 +00:00
Eric Fiselier
75c9eb5ab2 Update XFAIL list for new GCC versions
llvm-svn: 371881
2019-09-13 18:43:29 +00:00
Richard Smith
865697f9b9 Fix incorrect demangling of call operator of lambda with explicit
template parameters due to registering template parameters twice.

llvm-svn: 371469
2019-09-09 23:07:25 +00:00
Richard Smith
2ca7370183 Simplify demangler rule for lambda-expressions to match discussion on
cxx-abi list.

llvm-svn: 371462
2019-09-09 22:26:04 +00:00
Richard Smith
0e881b9f5d Synchronize LLVM's copy of libc++abi's demangler with the libc++abi
version after r371273.

Also fix a minor issue in r371273 that only surfaced after template
instantiation from LLVM's use of the demangler.

llvm-svn: 371274
2019-09-07 00:11:53 +00:00
Richard Smith
4bbe85c5d4 Implement demangling support for C++20 lambda expression extensions.
This implements demangling support for the mangling extensions specified
in https://github.com/itanium-cxx-abi/cxx-abi/pull/85, much of which is
implemented in Clang r359967 and r371004.

Specifically, this provides demangling for:

 * <template-param-decl> in <lambda-sig>
 * <template-param> with non-zero level
 * lambda-expression literals (not emitted by Clang yet)
 * nullptr literals
 * string literals

(The final two seem unrelated, but handling them was necessary in order
to disambiguate between lambda expressions and the other forms of
literal for which we have a type but no value.)

When demangling a <lambda-sig>, we form template parameters with no
corresponding argument, so we cannot substitute in the argument in the
demangling. Instead we invent synthetic names for the template
parameters (eg, '[]<typename $T>($T *x)').

llvm-svn: 371273
2019-09-06 23:53:21 +00:00
Louis Dionne
5a14c17221 Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory
llvm-svn: 369312
2019-08-19 23:51:26 +00:00
Fangrui Song
6897f99314 [libcxxabi] __cxa_guard_require: test guard byte with != 0 instead of == 1
llvm-svn: 369109
2019-08-16 13:54:44 +00:00
Sam Clegg
cee41ce223 [libcxxabi] Define _LIBCXXABI_GUARD_ABI_ARM on WebAssembly
This matches ItaniumCXXABI.cpp.

Fixes PR42680

Differential Revision: https://reviews.llvm.org/D64961

llvm-svn: 368783
2019-08-14 01:30:48 +00:00
Nico Weber
dd8580f437 small follow-up to r368604
llvm-svn: 368605
2019-08-12 19:19:29 +00:00
Nico Weber
086048df04 libcxxabi: Rename .hpp files to .h
LLVM uses .h as its extension for header files.

Differential Revision: https://reviews.llvm.org/D65981

llvm-svn: 368604
2019-08-12 19:11:23 +00:00
Benjamin Kramer
3bd2b51340 Remove outdated comment about clang not populating src2dst_offset
Clang has been setting this since r174293 (of 2013 vintage).

llvm-svn: 368580
2019-08-12 14:33:46 +00:00
Louis Dionne
df13b9393d [libc++abi] Fix tests when pstl is enabled
llvm-svn: 368286
2019-08-08 12:43:20 +00:00
Louis Dionne
0a06eb911b [libc++] Take 2: Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

The first attempt to commit this failed because it exposed a bug in the
tests for modules. Now that this has been fixed, it should be safe to
commit this.

Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

Differential Revision: https://reviews.llvm.org/D60480

llvm-svn: 367903
2019-08-05 18:29:14 +00:00
Yi Kong
d8bdb9225c [runtimes] Don't depend on libpthread on Android
r362048 added support for ELF dependent libraries, but broke Android
build since Android does not have libpthread. Remove the dependency on
the Android build.

Differential Revision: https://reviews.llvm.org/D65098

llvm-svn: 366734
2019-07-22 20:41:03 +00:00
Louis Dionne
a3c83b7511 Revert "[libc++] Integrate the PSTL into libc++"
This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

llvm-svn: 366603
2019-07-19 18:52:46 +00:00
Louis Dionne
910323e667 [libc++] Integrate the PSTL into libc++
Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

Differential Revision: https://reviews.llvm.org/D60480

llvm-svn: 366593
2019-07-19 17:02:42 +00:00
Petr Hosek
2e398f1895 [libcxxabi] Don't process exceptions in cxa_handlers when they're disabled
When exceptions are disabled, avoid their processing altogether.
This avoids pulling in the depenency on demangler significantly
reducing binary size when statically linking against libc++abi
built without exception support.

Differential Revision: https://reviews.llvm.org/D64191

llvm-svn: 365944
2019-07-12 19:10:59 +00:00
Erik Pilkington
9a6cef74d8 [demangle] Support for C++2a char8_t
llvm-svn: 364677
2019-06-28 19:54:19 +00:00
Louis Dionne
223df5b540 [libcxxabi] Use an explicit list to export symbols from the dylib
Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D63345

llvm-svn: 364586
2019-06-27 20:17:22 +00:00
Erik Pilkington
cf8c6cfcdc [demangle] Special case clang's creative mangling of __uuidof expressions.
llvm-svn: 363752
2019-06-18 23:34:09 +00:00
Louis Dionne
64fbefde6e [libcxxabi] Remove the unused buildit script
Summary: I'm pretty sure it's not used anymore, at least it isn't used at Apple.

Reviewers: EricWF, Bigcheese

Subscribers: christof, jkorous, dexonsmith, jfb, mstorsjo, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D63297

llvm-svn: 363737
2019-06-18 20:40:59 +00:00
Erik Pilkington
65831d0499 [demangle] Vendor extended types shouldn't be considered substitution candidates
llvm-svn: 362983
2019-06-10 21:02:39 +00:00
Petr Hosek
737de4d363 [libcxx] Use libtool when merging archives on Apple platforms
ar doesn't produce the correct results when used for linking static
archives on Apple platforms, so instead use libtool -static which is
the official way to build static archives on those platforms.

Differential Revision: https://reviews.llvm.org/D62770

llvm-svn: 362311
2019-06-02 01:14:31 +00:00
Petr Hosek
0528726a69 [libcxx][libcxxabi] Remove the unused CMake checks
These seemed to have been used in the past but were since removed
by the add_compile_flags_if_supported functions that combine these
these checks and adding the flag, but the original checks were never
removed.

Differential Revision: https://reviews.llvm.org/D62566

llvm-svn: 362058
2019-05-30 06:08:56 +00:00