Commit Graph

1097 Commits

Author SHA1 Message Date
Eric Fiselier 229db36474 [libc++] Make __shared_weak_count vtable consistent across all build configurations
This patch ensures that __shared_weak_count provides a consistent vtable
regardless of if RTTI is enabled or if we are targeting a static or shared
libc++ build.

This patch is technically ABI breaking, but only for a very specific
configuration that no vendor should be shipping.

Note that _LIBCPP_BUILD_STATIC is not normally defined when building
libc++.a, but instead it must be manually provided by the user or the
__config_site.

Differential Revision: https://reviews.llvm.org/D32838
2020-10-20 08:19:43 -04:00
Louis Dionne 9b40ee8eb0 [libc++] Define new/delete in libc++abi only by default
Previously, we would define new/delete in both libc++ and libc++abi.
Not only does this cause code bloat, but also it's technically an ODR
violation since we don't know which operator will be selected. Furthermore,
since those are weak definitions, we should strive to have as few of them
as possible (to improve load times).

My preferred choice would have been to put the operators in libc++ only
by default, however that would create a circular dependency between
libc++ and libc++abi, which GNU linkers don't handle.

Folks who want to ship new/delete in libc++ instead of libc++abi are
free to do so by turning on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS at
CMake configure time.

On Apple platforms, this shouldn't be an ABI break because we re-export
the new/delete symbols from libc++abi. This change actually makes libc++
behave closer to the system libc++ shipped on Apple platforms.

On other platforms, this is an ABI break for people linking against libc++
but not libc++abi. However, vendors have been consulted in D68269 and no
objection was raised. Furthermore, the definitions can be controlled to
appear in libc++ instead with the CMake option.

Differential Revision: https://reviews.llvm.org/D68269
2020-10-19 11:35:01 -04:00
Simon Tatham bcb7b87706 [libcxxabi] Fix printf formats in a test.
This is the libcxxabi counterpart of D89545, and would have been part
of that patch if I'd spotted it soon enough (oops). One test in
libcxxabi is using the `%lu` printf format to refer to `size_t`, which
should be `%zu`.

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D89547
2020-10-16 13:59:11 +01:00
Dominik Montada 8c03fdf34a [libcxxabi,libunwind] support running tests in standalone mode
Remove check for standalone and shared library mode in libcxxabi to
allow including tests in said mode. This check prevented running the
tests in standalone mode with static libraries, which is the case for
baremetal targets.

Fix check-unwind target trying to use a non-existent llvm-lit executable
in standalone mode. Copy the HandleOutOfTreeLLVM logic from libcxxabi to
libunwind in order to make the tests work in standalone mode.

Reviewed By: ldionne, #libc_abi, #libc

Differential Revision: https://reviews.llvm.org/D86540
2020-10-14 09:10:20 +02:00
Louis Dionne cc69d211d0 [libc++/abi] Clean up uses of <iostream> in the test suite
We used <iostream> in several places where we don't actually need the
full power of <iostream>, and where using basic `std::printf` is enough.
This is better, since `std::printf` can be supported on systems that don't
have a notion of locales, while <iostream> can't.
2020-10-13 20:25:33 -04:00
Raphael Isemann 6b7a49bb43 Fix all the CMake code that can only handle -stdlib= but not --stdlib=
There are several places in LLVM's CMake setup that try to remove the
`stdlib=...` flag from the CMake flags. All this code however only considered
the `-stdlib=` variant of the flag but not the alternative spelling with a
double dash. This causes that when one adds `--stdlib=...` to the user-provided
CMake flags that this gets transformed into just `-` which ends up causing the
build system to think it should read the source from stdin (which then lead to
very confusing build errors).

This just adds the alternative spelling before the`-stdlib=` variant in all
these places

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D87133
2020-10-13 16:05:21 +02:00
Louis Dionne 504bc07d1a [runtimes] Use int main(int, char**) consistently in tests
This is needed when running the tests in Freestanding mode, where main()
isn't treated specially. In Freestanding, main() doesn't get mangled as
extern "C", so whatever runtime we're using fails to find the entry point.

One way to solve this problem is to define a symbol alias from __Z4mainiPPc
to _main, however this requires all definitions of main() to have the same
mangling. Hence this commit.
2020-10-08 14:28:13 -04:00
Louis Dionne d5a6da84a3 [libc++/abi] Revert "[libc++] Move the weak symbols list to libc++abi"
This reverts commit c7d4aa711a. I am still investigating the issue,
but it looks like that commit has an interaction with ld64 that causes
new/delete weak re-exports not to work properly anymore. This is weird
because this commit did not touch the exports of new/delete -- I am
still investigating.
2020-10-05 11:42:13 -04:00
Louis Dionne c7d4aa711a [libc++] Move the weak symbols list to libc++abi
Those symbols are exported from libc++abi in the first place, so it
makes more sense to have them there.
2020-10-02 09:22:23 -04:00
Louis Dionne 8654a0f8bb [libc++] Don't re-export new/delete from libc++abi when they are defined in libc++
This is a temporary workaround until the new/delete situation is made
better (i.e. we don't include new/delete in both libc++ and libc++abi
by default).
2020-10-01 13:31:55 -04:00
Louis Dionne 4f13b99929 [libc++] Simplify how we re-export symbols from libc++abi
Instead of managing two copies of the symbol lists, reuse the same list
in libc++abi and libc++.

Differential Revision: https://reviews.llvm.org/D88623
2020-10-01 08:30:27 -04:00
Louis Dionne f9e70fa546 [libc++] Rename the -fno-rtti Lit feature to just no-rtti
This is consistent to the way we name other Lit features, and it removes
the possibility for confusing the Lit feature with the actual compiler
flag.
2020-09-29 16:29:44 -04:00
Louis Dionne d0667562e1 [libc++] Fix some test failures in unusual configurations 2020-09-29 16:22:56 -04:00
Louis Dionne da104444fa [libc++] Allow building without threads in standalone builds
Setting _LIBCPP_HAS_NO_THREADS is needed when building libcxxabi without
threads in standalone mode. This is useful when target WASM. Otherwise,
you get an error like "No thread API" when building libcxxabi.

It would be better to link against a properly-configured libc++ headers
CMake target when building libc++abi instead, but we don't generate such
targets yet.

Thanks to Matthew Bauer for the patch.

Differential Revision: https://reviews.llvm.org/D60743
2020-09-15 08:44:48 -04:00
Louis Dionne 8bd0dc5bfe [libc++abi] Do not declare __cxa_finalize and __cxa_atexit in <cxxabi.h>
These functions are not defined by libc++abi, so they don't belong in <cxxabi.h>.

Differential Revision: https://reviews.llvm.org/D75795
2020-09-14 20:10:29 -04:00
Louis Dionne ec46cfefe8 [libcxx] Simplify back-deployment testing
The needs of back-deployment testing currently require two different
ways of running the test suite: one based on the deployment target,
and one based on the target triple. Since the triple includes all the
information we need, it's better to have just one way of doing things.

Furthermore, `--param platform=XXX` is also supersedded by using the
target triple. Previously, this parameter would serve the purpose of
controling XFAILs for availability markup errors, however it is possible
to achieve the same thing by using with_system_cxx_lib only and using
.verify.cpp tests instead, as explained in the documentation changes.

The motivation for this change is twofold:
1. This part of the Lit config has always been really confusing and
   complicated, and it has been a source of bugs in the past. I have
   simplified it iteratively in the past, but the complexity is still
   there.
2. The deployment-target detection started failing in weird ways in
   recent Clangs, breaking our CI. Instead of band-aid patching the
   issue, I decided to remove the complexity altogether by using target
   triples even on Apple platforms.

A follow-up to this commit will bring the test suite in line with
the recommended way of handling availability markup tests.
2020-09-10 08:17:26 -04:00
Elliott Hughes 96a979c0c2 Fix test for D77924.
The trailing 'L' was missing in the expectation.

Differential Revision: https://reviews.llvm.org/D86321
2020-08-24 15:32:58 -07:00
Elliott Hughes a7d0b7a786 ld128 demangle: allow space for 'L' suffix.
Summary:
Caught by HWASAN on arm64 Android (which uses ld128 for long double). This
was running the existing fuzzer.

The specific minimized fuzz input to reproduce this is:

  __cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);

Reviewers: eugenis, srhines, #libc_abi!

Subscribers: kristof.beyls, danielkiss, libcxx-commits

Tags: #libc_abi

Differential Revision: https://reviews.llvm.org/D77924
2020-08-18 16:14:05 -07:00
Aditya Kumar d54f5979bb Add cold attribute to one time construction APIs
_cxa_guard_acquire is used for only one purpose,
namely guarding local static variable initialization,
and since that purpose is definitionally cold,
it should be attributed as cold

Reviewed By: ldionne

Reviewers: mclow.lists, ldionne, jfb, yfeldblum

Differential Revision: https://reviews.llvm.org/D85873
2020-08-13 09:28:04 -07:00
Louis Dionne d0ad9e93ce [libc++abi] Make sure we use a 32 bit guard on 32 bit Aarch64 2020-08-04 15:12:03 -04:00
Louis Dionne aae2ff645b [libc++abi] Also build the static archive with C++17
The dylib and the static archive should really be built using the same
Standard, it was just an oversight.
2020-07-23 12:40:19 -04:00
Louis Dionne e3650dc979 [libc++abi] Build the dylib with C++17, like for libc++ 2020-07-23 11:35:41 -04:00
Logan Smith 77e0e9e17d Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.

Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 17:50:19 -07:00
Logan Smith 97a0f80c46 Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
This reverts commit 388c9fb1af.
2020-07-22 15:07:01 -07:00
Logan Smith 388c9fb1af Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.
Using add_compile_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 14:19:34 -07:00
Louis Dionne 16779f8084 [libc++] Add static_assert to make sure rate limiter doesn't use locks
We want to be sure that atomic<size_t> is always lock-free, or the code
will be much slower than expected (and could even conceivably fail if
the lock implementation somehow calls back into libc++abi).
2020-07-22 14:49:50 -04:00
Louis Dionne afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Hans Wennborg 3eec657825 Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8.
This reverts commit 81d68ad27b.
This reverts commit a361aa5249.
This reverts commit fa42b7cf29.
This reverts commit 955f87f947.
This reverts commit 8b16e45f66.
This reverts commit 308a127a38.
This reverts commit 274b6b0c7a.
This reverts commit 1c7037a2a5.
2020-07-22 20:23:58 +02:00
Logan Smith 8b16e45f66 Enable -Wsuggest-override in the LLVM build
This patch adds Clang's new (and GCC's old) -Wsuggest-override to the warning flags for the LLVM build. The warning is a stronger form of -Winconsistent-missing-override which warns _everywhere_ that override is missing, not just in places where it's inconsistent within a class.

Some directories in the monorepo need the warning disabled for compatibility's, or sanity's, sake; in particular, libcxx/libcxxabi, and any code implementing or interoperating with googletest, googlemock, or google benchmark (which do not themselves use override). This patch adds -Wno-suggest-override to the relevant CMakeLists.txt's to accomplish this.

Differential Revision: https://reviews.llvm.org/D84126
2020-07-20 12:32:47 -07:00
Nico Weber 1afd889d0b [gn build] Make sync_source_lists_from_cmake handle one-line sources lines
sync_source_lists_from_cmake now also looks for source files in
`sources += [ "foo.cc" ]` lines, which allows us to remove most
`# Make `gn format` not collapse this` comments.

(sync_source_lists_from_cmake doesn't look for `foo_headers += [...]`
still, so the comment is still needed in two places for that.)

No intentional behavior change.
2020-07-17 11:53:42 -04:00
Louis Dionne fc9865c4a7 [libc++abi] Temporarily disable test on Apple to fix the CI
This test has been failing on some SDKs for a long time because we lack
a proper way of identifying the SDK version in Lit. Until that is possible,
mark the test as unsupported on Apple to restore the CI.
2020-07-16 15:41:55 -04:00
Louis Dionne ff0d4367bf [runtimes] Move the enable_rtti Lit parameter to the DSL 2020-07-16 12:56:00 -04:00
Louis Dionne 3f05a4853e [libc++abi] NFC: Fix indentation 2020-07-16 12:42:43 -04:00
Louis Dionne 0f03626fbf [runtimes][NFC] Remove unused or unnecessary CMake variables 2020-07-16 10:47:08 -04:00
Richard Smith b03f1756fb [demangler] More properly save and restore the template parameter state
when parsing an encoding.
2020-07-09 21:12:51 -07:00
Richard Smith 553dbb6d7b [demangler] Don't allow the template parameters from the <encoding> in a
<local-name> to leak out into later parts of the name.

This caused us to fail to demangle certain constructs involving generic
lambdas.
2020-07-09 20:38:19 -07:00
Louis Dionne 6f69318c72 [runtimes] Allow passing Lit parameters through CMake
This allows passing parameters to the test suites without using
LLVM_LIT_ARGS. The problem is that we sometimes want to set some
Lit arguments on the CMake command line, but the Lit parameters in
a CMake cache file. If the only knob to do that is LLVM_LIT_ARGS,
the command-line entry overrides the cache one, and the parameters
set by the cache are ignored.

This fixes a current issue with the build bots that they completely
ignore the 'std' param set by Lit, because other Lit arguments are
provided via LLVM_LIT_ARGS on the CMake command-line.
2020-07-09 12:45:00 -04:00
Louis Dionne 71d88cebfb [libc++/libc++abi] Automatically detect whether exceptions are enabled
Instead of detecting it automatically (in libc++) and relying on
_LIBCXXABI_NO_EXCEPTIONS being set explicitly (in libc++abi), always
detect whether exceptions are enabled automatically.

This commit also removes support for specifying -D_LIBCPP_NO_EXCEPTIONS
and -D_LIBCXXABI_NO_EXCEPTIONS explicitly -- those should just be inferred
from using -fno-exceptions (or an equivalent flag).

Allowing both -D_FOO_NO_EXCEPTIONS to be provided explicitly and trying
to detect it automatically is just confusing, especially since we did
specify it explicitly when building libc++abi. We should have only one
way to detect whether exceptions are enabled, but it should be robust.
2020-07-03 14:58:09 -04:00
Louis Dionne c2547f1554 [libc++abi] Remove unused include of <sys/types.h>
I ran into an error while trying to build libc++abi for a platform that
doesn't have <sys/types.h>. I couldn't find what <sys/types.h> was used
for in the header, so I think it's fine to remove it.

Differential Revision: https://reviews.llvm.org/D82810
2020-06-30 12:13:28 -04:00
Louis Dionne 9c795481e2 [libc++abi] Remove empty source file cxa_unexpected.cpp 2020-06-30 11:18:26 -04:00
Louis Dionne 70f6389257 [runtimes] Rename newformat to just format, now that the old format has been removed 2020-06-30 10:10:30 -04:00
Louis Dionne 5d83880885 [runtimes] Remove the ability to select the old libc++ testing format
As announced on libcxx-dev at [1], the old libc++ testing format is being
removed in favour of the new one. Follow-up commits will clean up the
code that is dead after the removal of this option.

[1]: http://lists.llvm.org/pipermail/libcxx-dev/2020-June/000885.html
2020-06-29 14:07:41 -04:00
Louis Dionne befd8f82fe [libc++abi] Fix build failure in abort_message.cpp when vasprintf isn't provided 2020-06-26 11:50:05 -04:00
Louis Dionne b68904d954 [libc++abi] NFCI: Minor refactoring of abort_message()
Remove small code duplication and add comments explaining why we do things
in a given order.
2020-06-25 14:48:26 -04:00
Louis Dionne 33c9c10d18 [libc++abi] Allow specifying custom Lit config files
This is the libc++abi counterpart of 0c66af970c.
2020-06-25 12:15:15 -04:00
Louis Dionne 62c1750ea9 [libc++abi] Allow code-signing executables when running the tests 2020-06-23 09:03:22 -04:00
Louis Dionne e54828ad47 [libc++abi] Ensure custom libc++ header paths are honoured during libc++abi build
This is necessary for standalone builds where the libc++ in use has a
custom configuration set up inside __config_site -- one needs to build
libc++abi against the installed headers of libc++ (which are properly
configured) instead of the ones inside libcxx/include.

See https://reviews.llvm.org/rGe619e9d#927848 for details.
2020-06-15 13:22:51 -04:00
Louis Dionne 96e6cbbf94 [libc++] Allow specifying arbitrary custom executors with the new format
The integration between CMake and executor selection in the new format
wasn't very flexible -- only the default executor and SSH executors were
supported.

This patch makes it possible to specify arbitrary executors with the new
format. With the new testing format, a custom executor is just a script
that gets called with a command-line to execute, and some arguments like
--env, --codesign_identity and --execdir. As such, the default executor
is just run.py.

Remote execution with the SSH executor can be achived by specifying
LIBCXX_EXECUTOR="<path-to-ssh.py> --host <host>". Similarly, arbitrary
scripts can be provided.
2020-06-11 16:24:29 -04:00
Louis Dionne e619e9d5f5 [libc++abi] Simplify the logic for finding libc++ from libc++abi
Since we have the monorepo, libc++abi's build requires a sibling checkout
of the libc++ sources. Hence, the logic for finding libc++ can be greatly
simplified.
2020-06-11 15:08:01 -04:00
Louis Dionne 1fc5010d6b [libc++] Consider everything inside %T to be a dependency of each test
Instead of passing file dependencies individually, assume that the
whole content of the unique test directory is a dependency. This
simplifies the test harness significantly, by making %T the directory
that contains everything required to run a test. This also removes the
need for the %{file_dependencies} substitution, which is removed by this
patch.

Furthermore, this patch also changes the harness to execute tests locally
inside %T, so as to avoid creating a separate directory for no purpose.
2020-06-10 22:38:05 -04:00
Louis Dionne e6d94f4bd2 [libc++abi] Replace LIBCXXABI_HAS_NO_EXCEPTIONS by TEST_HAS_NO_EXCEPTIONS
This clarifies the difference between test for exception support in
libc++abi tests and support for exceptions built into libc++abi.
This also removes the rather confusing similarity between the
_LIBCXXABI_NO_EXCEPTIONS and LIBCXXABI_HAS_NO_EXCEPTIONS macros.

Finally, TEST_HAS_NO_EXCEPTIONS is also detected automatically based
on -fno-exceptions, so it doesn't have to be specified explicitly
through Lit's compile_flags.
2020-06-09 16:13:17 -04:00
Louis Dionne 168681abce [libc++abi][libunwind] Don't override libc++'s handling of exception features
0e04342ae0 simplified exceptions-related configurations for libc++abi
and libunwind by reusing the logic in libc++. However, it missed the fact
that libc++abi and libunwind were overriding libc++'s handling of exceptions.

This commit removes special handling in libc++abi and libunwind to use
the logic in libc++, which is the right one.
2020-06-09 16:03:22 -04:00
Louis Dionne 0e04342ae0 [NFCI] Clean up exceptions related CMake and Lit options in libc++abi and libunwind
First, libc++abi doesn't need to add the no-exceptions Lit feature itself,
since that is already done in the config.py for libc++, which it reuses.
Specifically, config.enable_exceptions is set based on @LIBCXXABI_ENABLE_EXCEPTIONS@
in libc++abi's lit.cfg.in, and libc++'s config.py handles that correctly.

Secondly, libunwind's LIBUNWIND_ENABLE_EXCEPTIONS is never set (it's
probably a remnant of copy-pasting code between the runtime libraries),
so the library is always built with exceptions disabled (which makes
sense since it implements the runtime support for exceptions).
Conversely, the test suite is always run with exceptions enabled
(not sure why), but that is preserved by the default behavior of
libc++'s config.py.
2020-06-09 15:34:29 -04:00
Louis Dionne d520dfec3b [libc++abi] Properly fix XFAILs for exception alignment
Since <unwind.h> is in the SDK, not in /usr/include, the XFAILs must
be predicated on the compiler version (ideally even on the SDK version)
instead of the target system version.
2020-06-05 13:08:46 -04:00
Louis Dionne bf61891146 [libc++abi] Fix incorrect XFAILs for mis-aligned _Unwind_Exception on Apple
The problem mentioned in the XFAILs has been resolved in macosx10.15, so
the test is now XPASSing on that platform.

rdar://63640184
2020-06-03 10:08:15 -04:00
Louis Dionne 31cbe0f240 [libc++] Remove the c++98 Lit feature from the test suite
C++98 and C++03 are effectively aliases as far as Clang is concerned.
As such, allowing both std=c++98 and std=c++03 as Lit parameters is
just slightly confusing, but provides no value. It's similar to allowing
both std=c++17 and std=c++1z, which we don't do.

This was discovered because we had an internal bot that ran the test
suite under both c++98 AND c++03 -- one of which is redundant.

Differential Revision: https://reviews.llvm.org/D80926
2020-06-03 09:37:22 -04:00
Louis Dionne 6f6c8a2d96 [libc++abi] Make sure we link in CrashReporterClient.a when it's present
When building the system libc++abi for Apple, we use CrashReporterClient
to provide better crash logs when calling abort(). This is exemplified by
the fact that we test for the presence of <CrashReporterClient.h> in
abort_message.cpp.

However, we must link against CrashReporterClient.a in order to get that
functionality, otherwise we get a linking error.
2020-06-02 12:23:53 -04:00
Erik Pilkington 1c1fb350c5 [demangler] Support for 'this' expressions
llvm.org/PR45896
2020-05-13 22:28:51 -04:00
Erik Pilkington 15426b2161 [demangler] Fix demangling of enumerators with negative values
rdar://27527445
2020-05-13 14:32:08 -04:00
Louis Dionne 363393c4b3 [libc++abi] Adjust XFAIL on macOS for bug that was fixed in recent OSes 2020-05-12 17:00:03 -04:00
Louis Dionne e4512b5346 [libc++abi] NFC: Remove pragma mark in favor of normal comment 2020-05-05 13:20:46 -04:00
Louis Dionne 78769923fe [libc++abi] Add -Wno-unreachable-code when building test for throwing incomplete types
Slightly older Clangs seem to think they are more clever than they really
are, and they think the code can never be executed. The code can actually
be executed in case the exception runtime is mis-implemented, which is
exactly what this test is testing. This commit just disables the spurious
warning.
2020-05-01 15:29:40 -04:00
Shoaib Meenai cc259638cb [libcxx][libcxxabi][libunwind] Use libgcc on Android
Android doesn't have a libgcc_s and uses libgcc instead, so adjust the
build accordingly. This matches compiler-rt's build setup. libc++abi and
libunwind were already checking for libgcc but in a different context.
This change makes them search only for libgcc on Android now, but the
code to link against libgcc if it were present was already there.

Reviewed By: #libc, #libc_abi, #libunwind, rprichard, srhines

Differential Revision: https://reviews.llvm.org/D78787
2020-04-30 15:42:32 -07:00
Louis Dionne e5291c4ae3 [libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc++abi
Instead of the ad-hoc #define _LIBCXX_DYNAMIC_FALLBACK, provide an option
to enable the setting when building libc++abi. Also use the occasion to
rename the option to something slightly more descriptive.

Note that in the future, it would be great to simply remove this option
altogether. However, in the meantime, it seems better to have it be an
official option than something ad-hoc.
2020-04-22 16:24:26 -04:00
Louis Dionne fee48910d8 [libc++abi] NFC: Use "" instead of <> to include __cxxabi_config.h
This is more consistent with how __cxxabi_config.h is included in other
files in libcxxabi/src.
2020-04-22 15:53:08 -04:00
Louis Dionne 8c61114c53 [libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

Differential Revision: https://reviews.llvm.org/D78370
2020-04-22 08:25:27 -04:00
Louis Dionne 58f32435e8 [libc++abi] Add a rate limiter when logging dynamic_cast errors
This upstreams a fix that Howard made a long time ago, where so many
errors would be logged that applications were becoming sluggish. With
this patch, the first three errors will be printed, and after that the
printing frequency decreases exponentially.

_LIBCXX_DYNAMIC_FALLBACK is only enabled on Apple platforms, so this
should be NFC for other platforms.

rdar://14996273

Differential Revision: https://reviews.llvm.org/D78330
2020-04-21 15:27:33 -04:00
Louis Dionne ecf313c01d [libc++] Fix the no-exceptions build of libc++ on Apple
We previously tried re-exporting symbols that didn't exist when
exceptions were disabled. Note that building libc++abi without
exceptions still doesn't work when linking against the default-provided
libSystem.dylib, because it transitively depends on libobjc.dylib,
and that requires __gxx_personality_v0. But building libc++abi
with exceptions and libc++ without exceptions does work.
2020-04-20 10:45:14 -04:00
Louis Dionne e1c67273d5 [libc++abi] NFC: Remove trailing whitespace 2020-04-17 10:07:18 -04:00
Xing Xue 4578fa8a1c [demangler] PPC and S390: Fix parsing of e-prefixed long double literals
Summary:
This patch is to fix the parsing of long double literals encoded with the e prefix on PowerPC and S390. For both PowerPC and S390, type code e is used for 64-bit long double literals and g is used for 128-bit long double literals. libcxxabi test case test_demangle.pass.cpp fails without the fix.

Authored by: xingxue-ibm

Reviewers: hubert.reinterpretcast, jasonliu, erik.pilkington, uweigand, mclow.li
sts, libc++abi

Reviewed by: hubert.reinterpretcast, erik.pilkington

Differential Revision: https://reviews.llvm.org/D74163
2020-04-15 09:59:06 -04:00
Louis Dionne 2eb8864be2 [libc++abi] Enable the new libc++ testing format by default
The new format should be equivalent to the old format, and it is now the
default format when running the libc++ tests. This commit changes the
libc++abi tests to use the new format by default too. If unexpected failures
are discovered, it should be fine to revert this commit until they are
addressed.

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.
2020-04-07 09:16:06 -04:00
Louis Dionne 8a42bf24ae [lit] Move the recursiveExpansionLimit setting to TestingConfig
The LitConfig is shared across the whole test suite. However, since
enabling recursive expansion can be a breaking change for some test
suites, it's important to confine the setting to test suites that
enable it explicitly.

Note that other issues were raised with the way recursiveExpansionLimit
operates. However, this commit simply moves the setting to the right
place -- the mechanism by which it works can be improved independently.

Differential Revision: https://reviews.llvm.org/D77415
2020-04-06 13:58:00 -04:00
Louis Dionne 80a2ddf65c [libc++] Add an alternative Lit test format
This new test format is simpler and more flexible. It creates Lit ShTests
on the fly that reuse existing substitutions (like %{cxx}) instead of
having complex logic in Python to run the tests. This has the benefit
that virtually no coding is required to customize how the test suite is
run -- one can achieve pretty much anything by defining the appropriate
substitutions in a simple lit.cfg file.

For example, in order to run the tests on an embedded device after
building with a specific SDK, one can set the %{cxx} and %{compile_flags}
substitutions to use that SDK, and the %{exec} substitution to the ssh.py
script currently used for .sh.cpp tests with a remote executor. Dealing with
the SSHExecutor becomes unnecessary, since all tests are treated like ShTests.

As a side effect of this design, configuration files for the test
suite can be as simple as:

	config.substitutions.append(('%{cxx}', '<path-to-compiler>'))
	config.substitutions.append(('%{compile_flags}', '<flags>'))
	config.substitutions.append(('%{link_flags}', '<flags>'))
	config.substitutions.append(('%{exec}', '<script-to-execute>'))

This should allow storing lit.cfg files for various configurations
directly in the repository instead of relying on complicated logic
in config.py to set up the right flags. I've found numerous problems
in that logic in the past years, and it seems like having simple and
explicit configuration files for the configurations we support is
going to solve most of these problems. Specifically, I am hoping to
store configuration files for testing other Standard Libraries in
the repository.

Improving the interaction with the test suite configuration is still a
work in progress, so for now this test format reuses the substitutions and
available features that are set up by the current config.py.

This new test format should support pretty much everything that the current
test format supports, however it will not be enabled by default at first to
make sure we're satisfied with it. For a short period of time, the new format
will require `--param=use_new_format=True` to be enabled, however it is a very
short term goal to replace the current testing format entirely and to simplify
the configuration accordingly.

Differential Revision: https://reviews.llvm.org/D77338
2020-04-03 11:35:27 -04:00
Louis Dionne c3b5c98e39 [libc++abi] NFC: Add link to review in workaround comment
To avoid wasting the valuable time of contributors, add a link to a
blocked review to document additional issues with the removal of some
GCC 4.9 workaround.
2020-04-02 13:20:23 -04:00
Sergej Jaskiewicz fee0026fc7 [libc++abi] Fix remote execution of .sh.cpp tests
This aims to fix test failures on the following buildbots:

- http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l
- http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64

Differential Revision: https://reviews.llvm.org/D77190
2020-04-01 10:09:07 -04:00
Louis Dionne c3ca11771e [libc++abi] Remove the old testit script
It's not used anymore, we use Lit as a test runner now (and have been
for a long time).
2020-03-31 11:53:58 -04:00
Louis Dionne 19aec8c904 Enforce that libc++ and libc++abi are built in a monorepo layout
We will soon start removing technical debt and sharing code between the
two directories, so this first step is meant to discover potential places
where the libraries are built outside of a monorepo layout. I imagine
this could happen as a remnant of the pre-monorepo setup.

This was discussed on the libcxx-dev mailing list and we got overall
consensus on the direction. All consumers of libc++ and libc++abi
should already be doing so through the monorepo, however it is
possible that we catch some stragglers with this patch, in which
case it may need to be reverted temporarily.

Differential Revision: https://reviews.llvm.org/D76102
2020-03-30 17:57:36 -04:00
Louis Dionne e9271a494f Remove legacy CMake targets for libcxx and libcxxabi
We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

This is a re-application of f383fb40b1, wich was reverted in 04d48111b
because the build bots had not been updated yet. The build bot configurations
have now been updated not to use the deprecated targets, and I verified
that they were using the non-deprecated targets, so we should be good
unless I missed a bot.

Differential Revision: https://reviews.llvm.org/D76104
2020-03-30 09:45:21 -04:00
Louis Dionne 08776defa5 [libc++/libc++abi] Properly delimit lit substitutions
lit is not very clever when it performs substitution on RUN lines. It
simply looks for a match anywhere in the line (without tokenization)
and replaces it by the expansion. This means that a RUN line containing
e.g. `-verify-ignore-unexpected=note` wouod be expanded to
`-verify-ignore-unexpected=<substitution for not>e`, which is
surprising and nonsensical.

It also means that something like `%compile_module` could be expanded
to `<substitution-for-%compile>_module` or to the correct substitution,
depending on the order in which substitutions are evaluated by lit.

To avoid such problems, it is a good habit to delimit custom substitutions
with some token. This commit does that for all substitutions used in the
libc++ and libc++abi test suites.
2020-03-27 10:27:38 -04:00
Louis Dionne abcb9bb742 [libc++abi] Remove unused lit feature 2020-03-26 13:14:51 -04:00
Louis Dionne 04d48111bf Revert "Remove legacy CMake targets for libcxx and libcxxabi"
This reverts commit f383fb40b. It looks like several of our build bots
are still using the legacy target names, so we'll change those before
we commit this change again.
2020-03-23 11:03:00 -04:00
Louis Dionne f383fb40b1 Remove legacy CMake targets for libcxx and libcxxabi
We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

There's no doubt this commit will break some CI systems, however the
fix is trivial.

Differential Revision: https://reviews.llvm.org/D76104
2020-03-23 10:51:23 -04:00
Louis Dionne b0f1a4e7df [libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h
Since the atomic_support.h header of libc++abi is considered technical
debt (since we should use libc++'s), it's better not to add new
definitions to it, which makes it diverge from the original libc++
header even more.

Differential Revision: https://reviews.llvm.org/D75950
2020-03-12 18:27:03 -04:00
Sergej Jaskiewicz 43252c1b17 [libcxxabi] Set LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX to ON if LIBCXX_ENABLE_SHARED is not defined
Differential Revision: https://reviews.llvm.org/D71894
2020-03-12 16:45:21 +03:00
Louis Dionne e6eb942ffa [libc++abi] NFC: Simplify extern C declaration
It seems to me that abort_message.h is always included in a C++ file, so
it's fine to assume that it's C++ code.

Differential Revision: https://reviews.llvm.org/D76027
2020-03-11 17:56:12 -04:00
Louis Dionne 0b017c85ca Revert "[libc++abi] Change __cxa_finalize return type to void"
This reverts commit fde9d33f7, which was not properly reviewed by a
libc++ or libc++abi code owner.
2020-03-10 18:11:58 -04:00
Ryan Prichard fde9d33f71 [libc++abi] Change __cxa_finalize return type to void
Summary:
The return type of __cxa_finalize is documented as void in the Itanium
C++ ABI, and it is void in various C libraries.

Reviewers: EricWF, ldionne, compnerd, mclow.lists, MaskRay

Reviewed By: MaskRay

Subscribers: MaskRay, dexonsmith, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75795
2020-03-10 14:47:48 -07:00
Louis Dionne 5d3d84b5cd [libc++abi] NFC: Fix typo in comment 2020-03-10 13:33:51 -04:00
Shoaib Meenai e34ddc09f4 [arcconfig] Delete subproject arcconfigs
From https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/:

> An .arcconfig file is a JSON file which you check into your project's root.

I've done some experimentation, and it looks like the subproject
.arcconfigs just get ignored, as the documentation says. Given that
we're fully on the monorepo now, it's safe to remove them.

Differential Revision: https://reviews.llvm.org/D74996
2020-02-24 16:20:36 -08:00
Martin Storsjö 09dc884eb2 [libcxxabi] Fix layout of __cxa_exception for win64
Win64 isn't LP64, it's LLP64, but there's no __LLP64__ predefined -
just check _WIN64 in addition to __LP64__.

This fixes compilation after static asserts about the struct layout
were added in f2a436058f.

Differential Revision: https://reviews.llvm.org/D73838
2020-02-03 09:55:02 +02:00
Alex Langford effa0bc868 [libc++abi] Bump PACKAGE_VERSION 2020-01-30 12:18:24 -08:00
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
Petr Hosek f1ddf431b5 [runtimes] Use -Wunknown-pragmas for the pragma check
This is a follow up to r362055, we need -Wunknown-pragmas otherwise
the check is going to succeed it the pragma isn't supported.

llvm-svn: 362057
2019-05-30 05:38:06 +00:00
Petr Hosek 789b7f0828 [runtimes] Check if pragma comment(lib, ...) is supported first
This fixes the issue introduced by r362048 where we always use
pragma comment(lib, ...) for dependent libraries when the compiler
is Clang, but older Clang versions don't support this pragma so
we need to check first if it's supported before using it.

llvm-svn: 362055
2019-05-30 04:40:21 +00:00
Petr Hosek 996e62eef7 [runtimes] Support ELF dependent libraries feature
As of r360984, LLD supports dependent libraries feature for ELF.
libunwind, libc++abi and libc++ have library dependencies: libdl librt
and libpthread, which means that when libunwind and libc++ are being
statically linked (using -static-libstdc++ flag), user has to manually
specify -ldl -lpthread which is onerous.

This change includes the lib pragma to specify the library dependencies
directly in the source that uses those libraries. This doesn't make any
difference when using linkers that don't support dependent libraries.
However, when using LLD that has dependent libraries feature, users no
longer have to manually specifying library dependencies when using
static linking, linker will pick the library automatically.

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

llvm-svn: 362048
2019-05-30 01:34:41 +00:00
Eric Fiselier 360ead7648 Update private_typeinfo's `is_equal` implementation after r361913
The libc++ typeinfo implementation is being improved to better
handle non-merged type names.

This patch takes advantage of that more correct behavior by delegating
to std::type_infos default operator== instead of doing pointer equality
ourselves.

However, libc++ still expects unique RTTI by default, and so we
should still fall back to strcmp when explicitly requested.

llvm-svn: 361916
2019-05-29 02:33:11 +00:00
Petr Hosek 81f433b48c [runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/$target/c++ and include/c++ directories, leaving resource directory
only for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 361432
2019-05-22 21:08:33 +00:00
Louis Dionne e92a9c99d6 [libcxxabi] Add a test for invalid assumptions on the alignment of exceptions
rdar://problem/49864414

llvm-svn: 361039
2019-05-17 14:53:29 +00:00
Eric Fiselier 583df63134 XFAIL test for new GCC version
llvm-svn: 360944
2019-05-16 21:53:33 +00:00
Nico Weber 7399ad3193 minor cmake formatting style fix
llvm-svn: 360142
2019-05-07 13:14:14 +00:00
Petr Hosek 6971a166d9 [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them
When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360004
2019-05-06 01:25:31 +00:00