Commit Graph

1238 Commits

Author SHA1 Message Date
Louis Dionne
a6e5563dfa [libc++][release] Do not force building the runtimes with -fPIC
There's a lot of history behind this, so here's a summary:

1. I stopped forcing -fPIC when building the runtimes in 30f305efe2,
   before the LLVM 9 release back in 2019.

2. Someone complained that libc++.a couldn't be used in shared libraries
   built without -fPIC (http://llvm.org/PR43604) since the LLVM 9 release.
   This had been caused by my removal of -fPIC when building libc++.a in (1).

3. I suggested two ways of fixing the issue, the first being to force
   -fPIC back unconditionally (http://llvm.org/D104328), and the second
   being to specify that option explicitly when building the LLVM release
   (http://llvm.org/D104327). We converged on the first solution.

4. I landed D104328, which forced building the runtimes with -fPIC.
   This was included in the LLVM 13.0 release.

5. People complained about that and requested that we be able to
   customize this setting (basically we should have done the second
   solution).

This patch makes it such that the LLVM release script will specifically
ask for building with -fPIC using CMAKE_POSITION_INDEPENDENT_CODE,
however by default the runtimes will not force that option onto users.

This patch has the unintended effect that Clang and the LLVM libraries
(not only the runtime ones like libc++) will also be built with -fPIC
in the release. It would be better if we could specify that -fPIC is to
be used only when building the runtimes, however this is left as a
future improvement. The release should probably be using a bootstrapping
build and passing those options to the stage that builds the runtimes
only, see https://reviews.llvm.org/D112748 for that change.

Differential Revision: https://reviews.llvm.org/D110261
2021-12-08 11:34:35 -05:00
Louis Dionne
dc1244dc4e [runtimes] Move WARNING to FATAL_ERROR for folks using FOO_BUILD_32_BITS 2021-12-01 12:57:30 -05:00
Louis Dionne
fa1c077b41 [runtimes] Remove support for GCC-style 32 bit multilib builds
This patch removes the ability to build the runtimes in the 32 bit
multilib configuration, i.e. using -m32. Instead of doing this, one
should cross-compile the runtimes for the appropriate target triple,
like we do for all other triples.

As it stands, -m32 has several issues, which all seem to be related to
the fact that it's not well supported by the operating systems that
libc++ support. The simplest path towards fixing this is to remove
support for the configuration, which is also the best course of action
if there is little interest for keeping that configuration. If there
is a desire to keep this configuration around, we'll need to do some
work to figure out the underlying issues and fix them.

Differential Revision: https://reviews.llvm.org/D114473
2021-12-01 12:57:01 -05:00
Daniel Kiss
632acec737 [libunwind][ARM] Handle end of stack during unwind
When unwind step reaches the end of the stack that means the force unwind should notify the stop function.
This is not an error, it could mean just the thread is cleaned up completely.

Reviewed By: #libunwind, mstorsjo

Differential Revision: https://reviews.llvm.org/D109856
2021-11-26 13:26:49 +01:00
Arthur O'Dwyer
401b76fdf2 [libc++] [test] Eliminate libcpp-no-noexcept-function-type and libcpp-no-structured-bindings.
At this point, every supported compiler that claims a -std=c++17 mode
should also support these features.

Differential Revision: https://reviews.llvm.org/D113436
2021-11-20 11:44:57 -05:00
Louis Dionne
eb8650a757 [runtimes][NFC] Remove filenames at the top of the license notice
We've stopped doing it in libc++ for a while now because these names
would end up rotting as we move things around and copy/paste stuff.
This cleans up all the existing files so as to stop the spreading
as people copy-paste headers around.
2021-11-17 16:30:52 -05:00
Louis Dionne
ea23cc7120 [libc++abi] Don't re-define _LIBCPP_HAS_NO_THREADS in single-threaded mode
Libc++ already defines the macro inside its __config_site header, so
libc++abi doesn't need to do it. Doing it just leads to -Wmacro-redefined
warnings when building libc++abi.
2021-11-17 10:59:39 -05:00
David Tenty
2b416b4647 [libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES
and to the new `runtimes` top level CMakeLists.txt since the old path is now deprecated. This requires a slight adjustment of the libcxxabi CMake, since there are required macro definitions we previously got via the `llvm/CMakeList.txt` path.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D113403
2021-11-09 16:04:10 -05:00
Daniel Kiss
c5c4bac6c0 Reland "[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M"
On Armv6-M the branch may not able to reach the _Unwind_Resume function because it's relocation(R_ARM_THM_JUMP11) is in -2048, 2047 range only.

Reviewed By: chill, stuij, lenary

Differential Revision: https://reviews.llvm.org/D113181
2021-11-09 12:53:53 +01:00
Vladimir Vereschaka
c0d22dd0e7 Revert "[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M"
This reverts commit 3255578ee1.

Failed buildbot's Armv7 builds:
https://lab.llvm.org/buildbot/#/builders/60/builds/5303
2021-11-05 21:01:03 -07:00
Daniel McIntosh
795ff77840 [libcxxabi] Fix NO_THREADS version of test_exception_storage.pass.cpp
`thread_code` returns param, which for NO_THREADS is going to be
`&thread_globals`. Thus, the return value will never be null. The test
was probably meant to check if `*thread_code(&thread_globals) == 0`.
However, to avoid the extra cast, and to bring the NO_THREADS version
more in line with the regular version of the test, this changes it to
check if thread_globals == 0 directly.

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D113048
2021-11-04 19:30:21 -04:00
Daniel Kiss
3255578ee1 [libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M
On Armv6-M the branch may not able to reach the _Unwind_Resume function because it's relocation(R_ARM_THM_JUMP11) is in -2048, 2047 range only.

Reviewed By: chill, stuij, lenary

Differential Revision: https://reviews.llvm.org/D113181
2021-11-04 16:29:39 +01:00
Louis Dionne
a55632a069 [libc++] Temporarily mark tests as UNSUPPORTED to get the CI green
After recent changes to the Docker image, all hell broke loose and the
CI started failing. This patch marks a few tests as unsupported until
we can figure out what the issues are and fix them.

In the future, it would be ideal if the nodes could pick up the Dockerfile
present in the revision being tested, which would allow us to test changes
to the Dockerfile in the CI, like we do for all other code changes.

Differential Revision: https://reviews.llvm.org/D112737
2021-10-28 16:30:42 -04:00
Daniel Kiss
d8075e8781 Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
This is relanding commit da1d1a0869 .
This patch additionally addresses failures found in buildbots & post review comments.

ARM EHABI[1] specifies the __cxa_end_cleanup to be called after cleanup.
It will call the UnwindResume.
__cxa_begin_cleanup will be called from libcxxabi while __cxa_end_cleanup is never called.
This will trigger a termination when a foreign exception is processed while UnwindResume is called
because the global state will be wrong due to the missing __cxa_end_cleanup call.

Additional test here: D109856
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#941compiler-helper-functions

Reviewed By: logan

Differential Revision: https://reviews.llvm.org/D111703
2021-10-28 21:45:09 +02:00
Daniel Kiss
66e03db814 Revert "Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume.""
This reverts commit b6420e575f.
2021-10-28 17:24:53 +02:00
Daniel Kiss
b6420e575f Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
This is relanding commit da1d1a0869 .
This patch additionally addresses failures found in buildbots & post review comments.

ARM EHABI[1] specifies the __cxa_end_cleanup to be called after cleanup.
It will call the UnwindResume.
__cxa_begin_cleanup will be called from libcxxabi while __cxa_end_cleanup is never called.
This will trigger a termination when a foreign exception is processed while UnwindResume is called
because the global state will be wrong due to the missing __cxa_end_cleanup call.

Additional test here: D109856
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#941compiler-helper-functions

Reviewed By: logan

Differential Revision: https://reviews.llvm.org/D111703
2021-10-28 16:49:19 +02:00
Petr Hosek
22acda48ff [CMake] Cache the compiler-rt library search results
There's a lot of duplicated calls to find various compiler-rt libraries
from build of runtime libraries like libunwind, libc++, libc++abi and
compiler-rt. The compiler-rt helper module already implemented caching
for results avoid repeated Clang invocations.

This change moves the compiler-rt implementation into a shared location
and reuses it from other runtimes to reduce duplication and speed up
the build.

Differential Revision: https://reviews.llvm.org/D88458
2021-10-27 17:53:03 -07:00
Daniel Kiss
894ddba1c9 Revert "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
This reverts commit da1d1a0869.
2021-10-27 14:29:35 +02:00
Daniel Kiss
da1d1a0869 [ARM] __cxa_end_cleanup should be called instead of _UnwindResume.
ARM EHABI[1] specifies the __cxa_end_cleanup to be called after cleanup.
It will call the UnwindResume.
__cxa_begin_cleanup will be called from libcxxabi while __cxa_end_cleanup is never called.
This will trigger a termination when a foreign exception is processed while UnwindResume is called
because the global state will be wrong due to the missing __cxa_end_cleanup call.

Additional test here: D109856
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#941compiler-helper-functions

Reviewed By: logan

Differential Revision: https://reviews.llvm.org/D111703
2021-10-27 10:40:00 +02:00
Luís Ferreira
2d77b272a8 [Demangle] Add prepend functionality to OutputString
Implement the functionallity of prepend, required by D demangler.
Please read discussion https://reviews.llvm.org/D111414 for context.
See also https://reviews.llvm.org/D111947 .

Reviewed By: dblaikie, Geod24

Differential Revision: https://reviews.llvm.org/D111948
2021-10-26 16:24:25 -07:00
David Blaikie
85bf221f20 Fix for OutputStream->OutputBuffer rename 2021-10-21 20:14:04 -07:00
Vitaly Buka
34c97d5ae3 [libcxxabi] Fix build after D111947 2021-10-21 18:35:12 -07:00
Luís Ferreira
2e97236aac [Demangle] Rename OutputStream to OutputString
This patch is a refactor to implement prepend afterwards. Since this changes a lot of files and to conform with guidelines, I will separate this from the implementation of prepend. Related to the discussion in https://reviews.llvm.org/D111414 , so please read it for more context.

Reviewed By: #libc_abi, dblaikie, ldionne

Differential Revision: https://reviews.llvm.org/D111947
2021-10-21 17:34:57 -07:00
Petr Hosek
ba4920e98e Revert "[CMake] Cache the compiler-rt library search results"
This reverts commit 0eed292fba, there
are compiler-rt build failures that appear to have been introduced
by this change.
2021-10-21 10:32:01 -07:00
Louis Dionne
72117f2ffe [runtimes] Properly handle the sysroot/triple/gcc-toolchain
In 395271a, I simplified how we handled the target triple for the
runtimes. However, in doing so, we stopped considering the default
in CMAKE_CXX_COMPILER_TARGET, so we'd use the LLVM_DEFAULT_TARGET_TRIPLE
(which is the host triple) even if CMAKE_CXX_COMPILER_TARGET was specified.
This commit fixes that problem and also refactors the code so that it's
easy to see what the default value is.

The fact that nobody seems to have been broken by this makes me think
that perhaps nobody is using CMAKE_CXX_COMPILER_TARGET to specify the
triple -- but it should still work.

Differential Revision: https://reviews.llvm.org/D111672
2021-10-21 10:06:11 -04:00
Louis Dionne
ff5050a3a4 [libc++abi] Guard include of <unistd.h> behind __has_include
This doesn't change anything on platforms that have <unistd.h>, but
it will allow this file to compile on platforms that do not.
2021-10-20 17:37:19 -04:00
Petr Hosek
0eed292fba [CMake] Cache the compiler-rt library search results
There's a lot of duplicated calls to find various compiler-rt libraries
from build of runtime libraries like libunwind, libc++, libc++abi and
compiler-rt. The compiler-rt helper module already implemented caching
for results avoid repeated Clang invocations.

This change moves the compiler-rt implementation into a shared location
and reuses it from other runtimes to reduce duplication and speed up
the build.

Differential Revision: https://reviews.llvm.org/D88458
2021-10-18 14:44:07 -07:00
David Tenty
228b3b729d [libc++][AIX] Add scripts and config for building with the libcxx CI infrastructure
This initial change adds the AIX configuration to run-buildbot, an AIX
CMake cache file, and appropriate compiler and linker flags for testing
AIX to the lit "from scratch" configuration files. Either of the 32-bit or 64-bit configurations
can be built by setting `OBJECT_MODE` in the build environment (as is
typical for AIX).

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D111244
2021-10-14 14:31:10 -04:00
Louis Dionne
d1e0f02e0b [libc++abi][ci] Add a from-scratch config for libc++abi on Apple/system
I came across an issue where since we build the library for Apple with
the install name directory being /usr/lib, which means that if we don't
run the tests with DYLD_LIBRARY_PATH, we'll end up loading the
system-provided libc++abi when running the tests. That wreaks havoc.

Instead of fixing it in the legacy config file, this commit introduces
an Apple libc++abi config file that does the right thing.

Differential Revision: https://reviews.llvm.org/D111279
2021-10-13 08:07:40 -04:00
Louis Dionne
df3de7647e [libc++abi] Change LIBCXXABI_NO_TIMER to LIBCXXABI_USE_TIMER
Instead of always defining LIBCXXABI_NO_TIMER to run the tests, only
define LIBCXXABI_USE_TIMER when we want to enable the timer. This makes
the libc++abi testing configuration simpler.

As a fly-by fix, remove the unused LIBUNWIND_NO_TIMER macro from libunwind.

Differential Revision: https://reviews.llvm.org/D111667
2021-10-13 08:02:31 -04:00
Louis Dionne
f6a74908a7 [runtimes] Add tests for vendor-specific properties
Vendors take libc++ and ship it in various ways. Some vendors might
ship it differently from what upstream LLVM does, i.e. the install
location might be different, some ABI properties might differ, etc.

In the past few years, I've come across several instances where
having a place to test some of these properties would have been
incredibly useful. I also just got bitten by the lack of tests
of that kind, so I'm adding some now.

The tests added by this commit for Apple platforms have numerous
TODOs that capture discrepancies between the upstream LLVM CMake
and the slightly-modified build we perform internally to produce
Apple's system libc++. In the future, the goal would be to upstream
all those differences so that it's possible to build a faithful
Apple system libc++ with the upstream LLVM sources only.

But this isn't only useful for Apple - this lays out the path for
any vendor being able to add their own checks (either upstream or
downstream) to libc++.

This is a re-application of 9892d1644f, which was reverted in 138dc27186
because it broke the build. The issue was that we didn't apply the required
changes to libunwind and our CI didn't notice it because we were not
running the libunwind tests. This has been fixed now, and we're running
the libunwind tests in CI now too.

Differential Revision: https://reviews.llvm.org/D110736
2021-10-07 15:46:20 -04:00
Louis Dionne
54a8a0d09a [runtimes] Allow FOO_TEST_CONFIG to be a relative path
That makes it possible to store that value in a CMake cache if needed.

Differential Revision: https://reviews.llvm.org/D110843
2021-10-05 19:45:50 -04:00
Louis Dionne
d9346f5255 [libc++abi] Mark __cxa_new_handler with _LIBCPP_SAFE_STATIC
For consistency with the other handlers, and because requiring constant
initialization whenever we can is a good thing.

Differential Revision: https://reviews.llvm.org/D110866
2021-10-05 14:29:32 -04:00
Tomasz Miąsko
c8c2b4629f [Demangle][Rust] Parse non-ASCII identifiers
Rust allows use of non-ASCII identifiers, which in Rust mangling scheme
are encoded using Punycode.

The encoding deviates from the standard by using an underscore as the
separator between ASCII part and a base-36 encoding of non-ASCII
characters (avoiding hypen-minus in the symbol name). Other than that,
the encoding follows the standard, and the decoder implemented here in
turn follows the one given in RFC 3492.

To avoid an extra intermediate memory allocation while decoding
Punycode, the interface of OutputStream is extended with an insert
method.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D104366
2021-10-01 22:08:32 +02:00
Louis Dionne
6714e1ce3b [libc++abi][NFCI] Consistently group new_handler, unexpected_handler and terminate_handler
Previously, the definitions of __cxa_terminate_handler and __cxa_unexpected_handler
(and their set_xxx_handler functions) were grouped together, but the
definition of __cxa_new_handler wasn't. This commit simply moves those
to the same file to treat all handlers consistently.
2021-09-30 14:15:30 -04:00
Haowei Wu
138dc27186 Revert "[libc++][libc++abi] Add tests for vendor-specific properties"
This reverts commit 9892d1644f, which
causes clang test failures in libcxx tests.
2021-09-30 11:03:59 -07:00
Louis Dionne
9892d1644f [libc++][libc++abi] Add tests for vendor-specific properties
Vendors take libc++ and ship it in various ways. Some vendors might
ship it differently from what upstream LLVM does, i.e. the install
location might be different, some ABI properties might differ, etc.

In the past few years, I've come across several instances where
having a place to test some of these properties would have been
incredibly useful. I also just got bitten by the lack of tests
of that kind, so I'm adding some now.

The tests added by this commit for Apple platforms have numerous
TODOs that capture discrepancies between the upstream LLVM CMake
and the slightly-modified build we perform internally to produce
Apple's system libc++. In the future, the goal would be to upstream
all those differences so that it's possible to build a faithful
Apple system libc++ with the upstream LLVM sources only.

But this isn't only useful for Apple - this lays out the path for
any vendor being able to add their own checks (either upstream or
downstream) to libc++.

Differential Revision: https://reviews.llvm.org/D110736
2021-09-29 17:22:37 -04:00
Pengfei Wang
1873f3be78 [demangle] Support for ISO/IEC TS 18661 binary floating point type
Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D105278
2021-09-23 11:02:58 +08:00
Louis Dionne
f8b1cc3657 [libc++abi] Remove unnecessary atomic_support.h header from libc++abi
The file was a duplicate of atomic_support.h in libc++. Since we now
require the libc++ sources in order to build libc++abi, it's OK to
remove this duplication.

Thanks to @chandlerc for noticing this.

Differential Revision: https://reviews.llvm.org/D110103
2021-09-21 19:55:21 -04:00
Nehal J Wani
1613ab8a4a [libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list
When `libcxx` or `libcxxabi` is built with `-DLLVM_USE_SANITIZER=MemoryWithOrigins`
**and** `-DLIBCXX[ABI]_USE_COMPILER_RT=ON`, all of the `LIBCXX[ABI]_SUPPORTS_*_FLAG`
checks fail, since the value of `CMAKE_REQUIRED_FLAGS` is not set correctly.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=51774

Reviewed By: #libc, #libc_abi, compnerd, ldionne

Differential Revision: https://reviews.llvm.org/D109342
2021-09-16 18:26:29 +02:00
Zhouyi Zhou
6e91666e28 [libcxxabi] NFC: fix incorrect indentation of braces
Some functions in cxa_exception_storage.cpp have incorrect indentation
of braces; fix them.
Original patch by Zhouyi Zhou <zhouzhouyi@gmail.com>

Also, remove a line of commented-out (and no-longer-possible-to-compile)
code. That thread-safe-static initialization of `init` was replaced
with the call to pthread_once directly above it, back in 2012.

Differential Revision: https://reviews.llvm.org/D109408
2021-09-11 13:43:12 -05:00
Martin Storsjö
c4e8a2136c [runtimes] Allow overriding where CMake installs RUNTIME type libraries (DLLs)
Differential Revision: https://reviews.llvm.org/D107892
2021-09-09 00:01:38 +03:00
Louis Dionne
d9eb6c7cf5 [libc++abi] Remove workarounds for missing -Wno-exceptions on older GCCs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97675 has now been resolved
in GCC 11, so we can remove those workarounds.

Differential Revision: https://reviews.llvm.org/D109188
2021-09-03 14:23:28 -04:00
Daniel Kiss
f5b997e6b7 [Unwind] Harmonise exception class for EHABI spec.
EHABI defines the exception class as char[8] instead of uint64_t [1].
For ABI compatibility the ABI the definition needs to be updated.

[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#82language-independent-unwinding-types-and-functions

Reviewed By: manojgupta, MaskRay, #libunwind

Differential Revision: https://reviews.llvm.org/D109047
2021-09-02 11:31:03 +02:00
Louis Dionne
a4cb5aefd5 [libc++] Remove some workarounds for unsupported GCC and Clang versions
There is a lot more we can do, in particular in <type_traits>, but this
removes some workarounds that were gated on checking a specific compiler
version.

Differential Revision: https://reviews.llvm.org/D108923
2021-09-01 10:57:14 -04:00
Xiang Xiao
ed4946fe20 [libc++abi] Avoid the warning: "__EXCEPTIONS" is not defined, evaluates to 0 [-Werror=undef]
Differential Revision: https://reviews.llvm.org/D108896
2021-08-30 13:34:28 -04:00
Kazushi (Jam) Marukawa
9d2740f331 [libc++abi] Apply simplify scan_eh_tab to SjLj
Previous "simplify scan_eh_tab" patch, https://reviews.llvm.org/D93190,
saves landingpad if and only if the target is not using SjLj exceptions.
However, the landingpad is used by SjLj exception handler also.  This
patch changes to set landingpad for both exception handlers.

Differential Revision: https://reviews.llvm.org/D108082
2021-08-24 16:51:53 -04:00
Louis Dionne
5425106e49 [libc++] Remove test-suite annotations for unsupported Clang versions
Differential Revision: https://reviews.llvm.org/D108471
2021-08-20 15:05:13 -04:00
Louis Dionne
3a244fcf29 [libc++] Remove more test-suite workarounds for unsupported GCC versions
Differential Revision: https://reviews.llvm.org/D108466
2021-08-20 13:26:43 -04:00
Daniel McIntosh
f6ba6c3976 [NFC][libcxxabi] Run clang-format on libcxxabi/src/cxa_guard_impl.h
I'm about to submit a change which involves re-writing most of
cxa_guard_impl.h. Running clang-format on the whole file first seems like a
good idea.

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D108231
2021-08-18 19:09:16 -04:00
Mikhail Borisov
f0fcd42495 [libc++abi] Fix possible infinite loop in itanium demangler
A libfuzzer run has discovered some inputs for which the demangler does
not terminate. When minimized, it looks like this: _Zcv1BIRT_EIS1_E

Deciphered:

_Z
cv    - conversion operator

      * result type
 1B   - "B"
 I    - template args begin
  R   - reference type              <.
   T_ - forward template reference   |  *
 E    - template args end            |  |
                                     |  |
      * parameter type               |  |
 I    - template args begin          |  |
  S1_ - substitution #1              * <'
 E    - template args end

The reason is: template-parameter refs in conversion operator result type
create forward-references, while substitutions are instantly resolved via
back-references. Together these can create a reference loop. It causes an
infinite loop in ReferenceType::collapse().

I see three possible ways to avoid these loops:

1. check if resolving a forward reference creates a loop and reject the
   invalid input (hard to traverse AST at this point)
2. check if a substitution contains a malicious forward reference and
   reject the invalid input (hard to traverse AST at this point;
   substitutions are quite common: may affect performance; hard to
   clearly detect loops at this point)
3. detect loops in ReferenceType::collapse() (cannot reject the input)

This patch implements (3) as seemingly the least-impact change. As a
side effect, such invalid input strings are not rejected and produce
garbage, however there are already similar guards in
`if (Printing) return;` checks.

Fixes https://llvm.org/PR51407

Differential Revision: https://reviews.llvm.org/D107712
2021-08-17 18:13:26 -04:00
Mikhail Borisov
db7c68d808 [libc++abi][NFC] Move PODSmallVector definition to the top of ItaniumDemangle.h
This change is needed to clean the non-relevant parts of diff
from https://reviews.llvm.org/D107712

Differential Revision: https://reviews.llvm.org/D107771
2021-08-17 18:07:30 -04:00
Louis Dionne
6900df37d2 [libc++] Remove Lit annotations for unsupported GCC versions from the test suite
Since we officially don't support several older compilers now, we can
drop a lot of the markup in the test suite. This helps keep the test
suite simple and makes sure that UNSUPPORTED annotations don't rot.

This is the first patch of a series that will remove annotations for
compilers that are now unsupported.

Differential Revision: https://reviews.llvm.org/D107787
2021-08-12 13:30:47 -04:00
Daniel Kiss
db126ae243 [Arm][Unwind][libc++abi] Add _Unwind_ForcedUnwind to EHABI.
_Unwind_ForcedUnwind is not mandated by the EHABI but for compatibilty
reasons adding so the interface to higher layers would be the same.
Dropping EHABI specific _Unwind_Stop_Fn definition since it is not defined by EHABI.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D89570
2021-08-11 10:15:53 +02:00
Louis Dionne
21c24ae902 [runtimes] Always build libc++, libc++abi and libunwind with -fPIC
Building the libraries with -fPIC ensures that we can link an executable
against the static libraries with -fPIE. Furthermore, there is apparently
basically no downside to building the libraries with position independent
code, since modern toolchains are sufficiently clever.

This commit enforces that we always build the runtime libraries with -fPIC.
This is another take on D104327, which instead makes the decision of whether
to build with -fPIC or not to the build script that drives the runtimes'
build.

Fixes http://llvm.org/PR43604.

Differential Revision: https://reviews.llvm.org/D104328
2021-07-27 14:19:05 -04:00
Louis Dionne
e95cd94f7e [libc++abi/unwind] NFC: Normalize how we set target properties
This is a NFC commit to normalize how we set target properties on the
various runtime targets. A follow-up patch is going to add new properties,
and I wanted that follow-up patch to be cleaner.
2021-07-26 16:38:05 -04:00
Stuart Brady
87039c048c [demangler] Fix demangling of 'half'
Demangle 'Dh' as 'half' (as per GCC), and not 'decimal16' (which doesn't
make sense, as there is no IEEE 754 decimal16 format).

The Itanium C++ ABI specification describes 'Dh' as:
> IEEE 754r half-precision floating point (16 bits)

(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin)

Reviewed By: ldionne, jyknight

Differential Revision: https://reviews.llvm.org/D103833
2021-07-19 21:21:34 +01:00
Louis Dionne
395271ad11 [runtimes] Simplify how we set the target triple
Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE,
use that variable directly to populate the various XXXX_TARGET_TRIPLE
variables in the runtimes.

This re-applies 77396bbc98 and 5099e01568, which were reverted in
850b57c5fb because they broke the build.

Differential Revision: https://reviews.llvm.org/D106009
2021-07-16 10:33:39 -04:00
Louis Dionne
851a335b1e [libc++] Add a job running GCC with C++11
This configuration is interesting because GCC has a different level of
strictness for some C++ rules. In particular, it implements the older
standards more stringently than Clang, which can help find places where
we are non-conforming (especially in the test suite).

Differential Revision: https://reviews.llvm.org/D105936
2021-07-15 22:13:03 -04:00
Louis Dionne
a59165b017 [runtimes] Don't try passing --target flags to GCC
When a target triple is specified in CMake via XXX_TARGET_TRIPLE, we tried
passing the --target=<...> flag to the compiler. However, not all compilers
support that flag (e.g. GCC, which is not a cross-compiler). As a result,
setting e.g. LIBCXX_TARGET_TRIPLE=<host-triple> would end up trying to
pass --target=<host-triple> to GCC, which breaks everything because the
flag isn't even supported.

This commit only adds `--target=<...>` & friends to the flags if it is
supported by the compiler.

One could argue that it's confusing to pass LIBCXX_TARGET_TRIPLE=<...>
and have it be ignored. That's correct, and one possibility would be
to assert that the requested triple is the same as the host triple when
we know the compiler is unable to cross-compile. However, note that this
is a pre-existing issue (setting the TARGET_TRIPLE variable never had an
influence on the flags passed to the compiler), and also fixing that is
starting to look like reimplementing a lot of CMake logic that is already
handled with CMAKE_CXX_COMPILER_TARGET.

Differential Revision: https://reviews.llvm.org/D106082
2021-07-15 16:52:02 -04:00
Louis Dionne
8fb47456a3 [libc++/abi] Fix broken Lit feature no-noexcept-function-type
The feature was always defined, which means that the two test cases
guarded by it were never run.

Differential Revision: https://reviews.llvm.org/D106062
2021-07-15 14:42:07 -04:00
Louis Dionne
0c3401c86e [runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite
add_lit_testsuite() takes Lit parameters passed to it and adds them
to the parameters used globally when running all test suites. That
means that a target like `check-all`, which ends up calling Lit on
the whole monorepo, will see the test parameters for all the individual
project's test suites.

So, for example, it would see `--param std=c++03` (from libc++abi), and
`--param std=c++03` (from libc++), and `--param whatever` (from another
project being tested at the same time). While always unclean, that works
when the parameters all agree. However, if the parameters share the same
name but have different values, only one of those two values will be used
and it will be incredibly confusing to understand why one of the test
suites is being run with the incorrect parameter value.

For that reason, this commit moves away from using add_lit_testsuite()'s
PARAM functionality, and serializes the parameter values for the runtimes
in the generated config.py file instead, which is local to the specific
test suite.

Differential Revision: https://reviews.llvm.org/D105991
2021-07-15 07:53:15 -04:00
Louis Dionne
850b57c5fb [runtimes] Bring back TARGET_TRIPLE
This commit reverts 5099e01568 and 77396bbc98, which broke the build
in various ways. I'm reverting until I can investigate, since that
change appears to be way more subtle than it seemed.
2021-07-14 15:15:22 -04:00
Louis Dionne
5099e01568 [runtimes] Inherit the TARGET_TRIPLE that may be set by LLVM 2021-07-14 14:29:29 -04:00
Louis Dionne
77396bbc98 [runtimes] NFCI: Drop intermediate CMake variable TARGET_TRIPLE
We might as well use the various XXX_TARGET_TRIPLE variables directly.
2021-07-14 10:49:28 -04:00
Louis Dionne
2a399e60b6 [libc++] Add a CI job for macOS on arm64 hardware 🥳
Differential Revision: https://reviews.llvm.org/D105848
2021-07-13 13:49:05 -04:00
John Ericson
1e03c37b97 Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all
This is a second attempt at D101497, which landed as
9a9bc76c0e but had to be reverted in
8cf7ddbdd4.

This issue was that in the case that `COMPILER_RT_INSTALL_PATH` is
empty, expressions like "${COMPILER_RT_INSTALL_PATH}/bin" evaluated to
"/bin" not "bin" as intended and as was originally.

One solution is to make `COMPILER_RT_INSTALL_PATH` always non-empty,
defaulting it to `CMAKE_INSTALL_PREFIX`. D99636 adopted that approach.
But, I think it is more ergonomic to allow those project-specific paths
to be relative the global ones. Also, making install paths absolute by
default inhibits the proper behavior of functions like
`GNUInstallDirs_get_absolute_install_dir` which make relative install
paths absolute in a more complicated way.

Given all this, I will define a function like the one asked for in
https://gitlab.kitware.com/cmake/cmake/-/issues/19568 (and needed for a
similar use-case).

---

Original message:

Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.

This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.

---

There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.

That last part should be the only behavior changes; everything else
should be a pure refactoring.

---

I added some documentation of these variables too. In particular, I
wanted to highlight the gotcha where `-DSomeCachePath=...` without the
`:PATH` will lead CMake to make the path absolute. See [1] for
discussion of the problem, and [2] for the brief official documentation
they added as a result.

[1]: https://cmake.org/pipermail/cmake/2015-March/060204.html

[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#options

In 38b2dec37e the problem was somewhat
misidentified and so `:STRING` was used, but `:PATH` is better as it
sets the correct type from the get-go.

---

D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.

Reviewed By: phosek, #libc_abi, #libunwind

Differential Revision: https://reviews.llvm.org/D105765
2021-07-13 15:21:41 +00:00
Louis Dionne
feef171f76 [libc++] NFC: Fix incorrect comments in CMake 2021-07-07 09:45:32 -04:00
Louis Dionne
f7d8754312 [runtimes] Move enable_32bit to the DSL
This is necessary for from-scratch configurations to support the 32-bit
mode of the test suite.

Differential Revision: https://reviews.llvm.org/D105435
2021-07-06 08:42:07 -04:00
Louis Dionne
c360553c15 [runtimes] Simplify how we specify XFAIL & friends based on the triple
Now that Lit supports regular expressions inside XFAIL & friends, it is
much easier to write Lit annotations based on the triple.

Differential Revision: https://reviews.llvm.org/D104747
2021-07-01 14:03:30 -04:00
Louis Dionne
58a230455b [libc++] Serialize Lit parameters to make them available to from-scratch configs
Before this patch, Lit parameters that were set as a result of CMake
options were not made available to from-scratch configs. This patch
serializes those parameters into the generated lit config file so that
they are available to all configs.

Differential Revision: https://reviews.llvm.org/D105047
2021-06-29 10:51:42 -04:00
Louis Dionne
ad6bee87e6 [libc++] NFCI: Remove unused Lit parameter sanitizer_library 2021-06-28 14:21:25 -04:00
Xing Xue
afd3607c8f [libc++abi][AIX] Enable calculating addresses with DW_EH_PE_datarel
Summary:
This patch enables calculating relative addresses with the DW_EH_PE_datarel encoding using a 'base' for AIX. After setting registers for jumping to the user code in gxx_personality_v0(), 'base' is cached in exception_header member catchTemp for use in __cxa_call_unexpected if ttypeIndex is less than 0 (exception spec).

Reviewed by: MaskRay, sfertile, compnerd, libc++abi

Differential Revision: https://reviews.llvm.org/D101298
2021-06-23 17:54:10 -04:00
Louis Dionne
4f194d0db7 [libc++] Promote GCC 11 to mandatory CI
Also, fix the last issue that prevented GCC 11 from passing the test
suite. Thanks to everyone else who fixed issues.

Differential Revision: https://reviews.llvm.org/D104315
2021-06-15 20:54:58 -04:00
Xing Xue
ecb68f1c8b [libc++abi] NFC: avoid a -Wunused-parameter warning
Summary:
A -Wunused-parameter warning was introduced by patch rG7f0244afa828 [libc++abi] NFC: adding a new parameter base to functions for calculating… (authored by xingxue). The unused parameter base will be used in a follow-on patch D101298. This patch is to avoid the warning before D101298 is landed.

Reviewers: ldionne, sfertile, compnerd, libc++abi

Reviewed by: ldionne

Differential Revision: https://reviews.llvm.org/D104235
2021-06-14 16:04:02 -04:00
Louis Dionne
a0ae3b0789 [libc++abi] Remove the LIBCXXABI_ENABLE_PIC option
Instead, people should be using CMAKE_POSITION_INDEPENDENT_CODE to control
whether they want to use PIC or not. We should try to avoid reinventing
the wheel whenever CMake natively supports something.

This makes libc++abi consistent with libc++ and libunwind.

Differential Revision: https://reviews.llvm.org/D103973
2021-06-10 12:26:31 -04:00
Xing Xue
7f0244afa8 [libc++abi] NFC: adding a new parameter base to functions for calculating addresses with relative encodings
Summary:
    This NFC patch adds a new parameter base to functions invoked by scan_eh_tab() for calculating the address of the encoding with a relative value. base defaults to 0. This is in preparation for the AIX implementation which uses the DW_EH_PE_datarel encoding.

    Reviewed by: MaskRay, sfertile, compnerd, libc++abi

    Differential Revision: https://reviews.llvm.org/D101545
2021-06-10 10:45:50 -04:00
Justin Lebar
c962491a41
Save/restore OuterTemplateParams in AbstractManglingParser::parseEncoding.
Previously we were only saving plain TemplateParams.

Differential Revision: https://reviews.llvm.org/D103996
2021-06-09 17:56:23 -07:00
Louis Dionne
875ff8e059 [libc++] Enable tests for the experimental library by default
This matches the fact that we build the experimental library by default.
Otherwise, by default we'd be building the library but not testing it,
which is inconsistent.

Differential Revision: https://reviews.llvm.org/D102109
2021-06-02 18:39:27 -04:00
Shoaib Meenai
a051bbb53f [libcxxabi] Use ASan interface header for declaration. NFC
This was changed from using the header to using a forward declaration in
c4600ccf89, since older versions of the header didn't declare the
function. At this point, it's been declared for ~3.5 years, and it
should be pretty safe to assume that we can rely on the ASan interface
header to provide a declaration instead of needing to write our own.

Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D103003
2021-05-25 13:07:13 -07:00
Shoaib Meenai
6c05f2dab3 [libcxxabi] Remove unnecessary define from build
Now that we're passing -D_LIBCPP_BUILDING_LIBRARY to the libc++abi
build, -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS is redundant
(fb3a00c327/libcxx/include/exception (L120-L121)
is the only use of _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS in
libc++, and that conditional also checks for _LIBCPP_BUILDING_LIBRARY).

Reviewed By: #libc_abi, phosek

Differential Revision: https://reviews.llvm.org/D102372
2021-05-20 16:56:05 -07:00
Louis Dionne
74d096e558 [libc++] Move handling of the target triple to the DSL
This fixes a long standing issue where the triple is not always set
consistently in all configurations. This change also moves the
back-deployment Lit features to using the proper target triple
instead of using something ad-hoc.

This will be necessary for using from scratch Lit configuration files
in both normal testing and back-deployment testing.

Differential Revision: https://reviews.llvm.org/D102012
2021-05-08 11:10:53 -04:00
Petr Hosek
ea12d779bc [libc++] Support per-target __config_site in per-target runtime build
When using the per-target runtime build, it may be desirable to have
different __config_site headers for each target where all targets cannot
share a single configuration.

The layout used for libc++ headers after this change is:

```
include/
  c++/
    v1/
      <libc++ headers except for __config_site>
  <target1>/
    c++/
      v1/
        __config_site
  <target2>/
    c++/
      v1/
        __config_site
  <other targets>
```

This is the most optimal layout since it avoids duplication, the only
headers that's per-target is __config_site, all other headers are
shared across targets. This also means that we no need two
-isystem flags: one for the target-agnostic headers and one for
the target specific headers.

Differential Revision: https://reviews.llvm.org/D89013
2021-04-28 14:27:16 -07:00
Tomasz Miąsko
1cea7ab4ba [demangler] Use standard semantics for StringView::substr
The StringView::substr now accepts a substring starting position and its
length instead of previous non-standard `from` & `to` positions.

All uses of two argument StringView::substr are in MicrosoftDemangler
and have 0 as a starting position, so no changes are necessary.

This also fixes a bug where attempting to extract a suffix with substr
(a `to` position equal to size) would return a substring without the
last character.

Fixing the issue should not introduce observable changes in the
demangler, since as currently used, a second argument to
StringView::substr is either: 1) a result of a successful call to
StringView::find and so necessarily smaller than size., or 2) in the
case of Demangler::demangleCharLiteral potentially equal to size, but
with demangler expecting more data to follow later on and failing either
way.

Reviewed By: #libc_abi, ldionne, erik.pilkington

Differential Revision: https://reviews.llvm.org/D100246
2021-04-25 13:56:41 +02:00
Petr Hosek
f749550cfe [libcxx] Stop using use c++ subdirectory for libc++ library
The new layout more closely matches the layout used by other compilers.
This is only used when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is enabled.

Differential Revision: https://reviews.llvm.org/D100869
2021-04-21 15:39:03 -07:00
Louis Dionne
4cd6ca102a [libc++] NFC: Normalize #endif // comment indentation 2021-04-20 12:03:32 -04:00
Louis Dionne
2da6ce60a5 [libc++abi] Adjust XFAIL for misaligned exception header on ARM
On ARM, the alignment has always been the right one, so this test never
fails.
2021-04-07 16:14:50 -04:00
Petr Hosek
96d8c6b571 [CMake] Remove {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_PREFIX
These variables were introduced during early work on the runtimes build
but were obsoleted by {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_LIBRARY_DIR.

Differential Revision: https://reviews.llvm.org/D99697
2021-04-01 10:13:07 -07:00
Louis Dionne
c06a8f9caa [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

Differential Revision: https://reviews.llvm.org/D97572
2021-03-30 14:06:11 -07:00
Petr Hosek
1687f2bbe2 [libcxxabi] Use cxx-headers target to consume libcxx headers
Rather than including libc++ include dir, use the cxx-headers target.

Differential Revision: https://reviews.llvm.org/D98367
2021-03-26 13:27:51 -07:00
Petr Hosek
74ed5124ba Revert "[libcxxabi] Use cxx-headers target to consume libcxx headers"
This reverts commit 72728e1280
which broke libcxxabi tests under the runtimes build.
2021-03-25 01:50:11 -07:00
jasonliu
158026301b [libc++][AIX] Initial patch to unblock the libc++ build on AIX
This path would unblock the build of libc++ library on AIX:
1. Add _AIX guard for _LIBCPP_HAS_THREAD_API_PTHREAD
2. Use uselocale to actually take the locale setting
   into account.
3. extract_mtime and extract_atime mod needed for AIX. As stat
   structure on AIX uses internal structure st_timespec to store
   time for binary compatibility reason. So we need to convert it
   back to timespec here.
4. Do not build cxa_thread_atexit.cpp for libcxxabi on AIX.

Differential Revision: https://reviews.llvm.org/D97558
2021-03-24 22:13:20 +00:00
Alex Orlov
876435c487 * Fix demangling of optional template-args for vendor extended type qualifier.
This fixes https://bugs.llvm.org/show_bug.cgi?id=48009 bug.

Reviewed By: erik.pilkington, krisb

Differential Revision: https://reviews.llvm.org/D98687
2021-03-24 10:21:32 +04:00
Petr Hosek
72728e1280 [libcxxabi] Use cxx-headers target to consume libcxx headers
Rather than including libc++ include dir, use the cxx-headers target.

Differential Revision: https://reviews.llvm.org/D98367
2021-03-23 12:25:30 -07:00
Markus Böck
6359049c35 [CMake][runtimes] Add file level dependency to merge_archives commands
Both libc++ and libc++abi have options of merging with another archive. In the case of libc++abi, libunwind can be merged into it and in the case of libc++, libc++abi can be merged into it.

This is realized using add_custom_command with POST_BUILD and the usage of the CMake generator expression TARGET_LINKER_FILE in the arguments. For such generator expressions CMake doc states: "This target-level dependency does NOT add a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled" [1]

This patch adds a DEPENDS argument to both add_custom_command invocations so that the archives also have a file-level dependency on the target they are merging with. That way, changes in say, libunwind source code, will be updated in the libc++abi and/or libc++ static libraries as well.

[1] https://cmake.org/cmake/help/v3.20/command/add_custom_command.html

Differential Revision: https://reviews.llvm.org/D98129
2021-03-18 18:51:10 +01:00
Petr Hosek
e1173c8794 [runtimes] Use add_lit_testsuite to register lit testsuites
The runtimes build uses variables set by add_lit_testsuite to collect
testsuites from all the runtimes.

Differential Revision: https://reviews.llvm.org/D97913
2021-03-05 10:37:21 -08:00
Markus Böck
05b3716ddb [libcxxabi] Add LIBCXXABI_HAS_WIN32_THREAD_API build option
A few files in libc++abi make use of libc++ headers and a few of those use threading primitives provided by libc++. Since libc++ has multiple threading APIs it may be necessary to override auto-detection.

This patch adds the LIBCXXABI_HAS_WIN32_THREAD_API which does roughly the same as LIBCXXABI_HAS_PTHREAD_API and the similarly named LIBCXX_HAS_WIN32_THREAD_API from libc++. Instead of using autodetection it will force the use of win32 threads instead of pthreads in headers included from libc++.

Without this patch, libc++abi may depend on pthreads if present on the users build environment, even if win32 threading was selected for libc++.

Differential revision: https://reviews.llvm.org/D98021
2021-03-05 15:30:13 +01:00
Louis Dionne
5601305fb3 [libc++/abi] Replace uses of _NOEXCEPT in src/ by noexcept
We always build the libraries in a Standard mode that supports noexcept,
so there's no need to use the _NOEXCEPT macro.

Differential Revision: https://reviews.llvm.org/D97700
2021-03-03 12:57:31 -05:00
Louis Dionne
60ba1fefab [libc++/abi] Allow running back-deployment testing against libc++abi
Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.

Also, add XFAIL markup to flag expected errors.

Differential Revision: https://reviews.llvm.org/D91069
2021-03-01 12:13:03 -05:00
Nico Weber
72b18a86e1 [libcxxabi] Fewer assumptions about path from libcxx to libcxxabi
This is useful for projects that pull in libcxx and libcxxabi and build
them using out-of-tree build files, but don't make them sibling
directories (or don't call the sibling directories libcxx and libcxxabi
for some reason).

Fixes PR49313.

Differential Revision: https://reviews.llvm.org/D97379
2021-02-26 09:10:18 -05:00
Patrick Oppenlander
26a0aeba61 [libc++abi] Add builtins to dynamic library link
Otherwise libc++abi.so fails to link on arm with undefined references to
some __aeabi_ builtins.

Differential Revision: https://reviews.llvm.org/D96574
2021-02-17 17:05:59 -05:00
Zbigniew Sarbinowski
5f9be2c3e3 [SystemZ][ZOS] Prefer -nostdlib++ as opposed to -nodefaultlibs when building c++ libraries
Let's use -nostdlib++ rather than -nodefaultlibs when building libc++/libc++abi/libunwind libraries. The default is -nostdlib++ if supported by a build compiler like it is the case with clang, otherwise -nodefaultlibs is used as before.

This change is needed to avoid additional changes at the link step and not to increase the maintenance costs. If clang with -nodefaultlibs is used all the libraries which are removed but required would have to be manually added in. This set of libraries are unique and will send out.

The propose change will allow to make the link step simple for other platforms as well.

Reviewed By: #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D95875
2021-02-16 18:42:14 +00:00
Vladimir Vereschaka
c40b83199f [libc++abi] Fix forced_unwind tests failures on ARM/EHABI targets.
Added __cxxabi_config.h includes to resolve _LIBCXXABI_ARM_EHABI and
proper building the forces_unwindX.cpp tests for the ARM/EHABI targets.

Differential Revision: https://reviews.llvm.org/D96378
2021-02-12 13:58:41 -08:00
Fangrui Song
a4fa667dee [libc++abi] Disable _Unwind_ForcedUnwind + exception tests for ARM EHABI
libunwind ARM EHABI does not support _Unwind_ForcedUnwind yet.
In addition, ARM EHABI makes `_Unwind_Exception` a typedef so
`struct _Unwind_Exception*` cannot be used.
2021-02-05 14:12:27 -08:00
Fangrui Song
81af8149d8 [test] Add basic _Unwind_ForcedUnwind + exception tests
Forced unwinding is like a foreign exception, which can be caught by `catch (...)` and rethrown.
If not rethrown, `__cxa_end_cath` will call `_Unwind_DeleteException` to destroy the object.

The behavior going through empty `throw()` and non-empty `throw(int)` is not
clear (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98785), so I do not add such
tests.

Differential Revision: https://reviews.llvm.org/D95200
2021-02-02 09:35:27 -08:00
xgupta
94fac81fcc [Branch-Rename] Fix some links
According to the [[ https://foundation.llvm.org/docs/branch-rename/ | status of branch rename ]], the master branch of the LLVM repository is removed on 28 Jan 2021.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D95766
2021-02-01 16:43:21 +05:30
James Y Knight
9c7aeaebb3 Itanium Mangling: Mangle __alignof__ differently than alignof.
The two operations have acted differently since Clang 8, but were
unfortunately mangled the same. The new mangling uses new "vendor
extended expression" syntax proposed in
https://github.com/itanium-cxx-abi/cxx-abi/issues/112

GCC had the same mangling problem, https://gcc.gnu.org/PR88115, and
will hopefully be switching to the same mangling as implemented here.

Additionally, fix the mangling of `__uuidof` to use the new extension
syntax, instead of its previous nonstandard special-case.

Adjusts the demangler accordingly.

Differential Revision: https://reviews.llvm.org/D93922
2021-01-27 16:46:51 -05:00
Marek Kurdej
5e7a93a954 [libc++] Set CMAKE_FOLDER. NFC.
* This variable populates the default value of FOLDER target property. It is used in some IDE's (e.g. MSVC) to group different targets together.
2021-01-25 09:51:16 +01:00
Fangrui Song
cfe9ccbddd [libc++abi] Simplify scan_eh_tab
1.
All `_URC_HANDLER_FOUND` return values need to set `landingPad`
and its value does not matter for `_URC_CONTINUE_UNWIND`. So we
can always set `landingPad` to unify code.

2.
For an exception specification (`ttypeIndex < 0`), we can check `_UA_FORCE_UNWIND` first.

3.
The so-called type 3 search (`actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`)
is actually conceptually wrong.  For a catch handler or an unmatched dynamic
exception specification, `_UA_HANDLER_FOUND` should be returned immediately.  It
still appeared to work because the `ttypeIndex==0` case would return
`_UA_HANDLER_FOUND` at a later time.

This patch fixes the conceptual error and simplifies the code by handling type 3
the same way as type 2 (which is also what libsupc++ does).
The only difference between phase 1 and phase 2 is what to do with a cleanup
(`actionEntry==0`, or a `ttypeIndex==0` is found in the action record chain):
phase 1 returns `_URC_CONTINUE_UNWIND` while phase 2 returns `_URC_HANDLER_FOUND`.

Reviewed By: #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D93190
2021-01-21 15:19:23 -08:00
Dan Albert
866d480fe0 [libc++abi] Add an option to avoid demangling in terminate.
We've been using this patch in Android so we can avoid including the
demangler in libc++.so. It comes with a rather large cost in RSS and
isn't commonly needed.

Reviewed By: #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D88189
2021-01-21 13:32:29 -08:00
Raul Tambre
480643a95c [CMake] Remove dead code setting policies to NEW
cmake_minimum_required(VERSION) calls cmake_policy(VERSION),
which sets all policies up to VERSION to NEW.
LLVM started requiring CMake 3.13 last year, so we can remove
a bunch of code setting policies prior to 3.13 to NEW as it
no longer has any effect.

Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D94374
2021-01-19 17:19:36 +02:00
Louis Dionne
bc556e5685 [libc++/abi] Re-remove unnecessary null pointer checks from operator delete
In 7cd67904f7, we removed the unnecessary nullptr checks from the libc++abi
definition of operator delete, but we forgot to update the definition in
libc++ (damn code duplication!). Then, in d4a1e03c5f, I synced the
definitions across libc++ and libc++abi, but I did it the wrong way around.
I re-added the if() checks to libc++abi instead of removing them from libc++.

In ef74f0fdc3, we re-removed the if() check from operator delete, but
only in libc++abi. This patch corrects this mess and removes it
consistently in libc++ and libc++abi.

Differential Revision: https://reviews.llvm.org/D93473
2021-01-08 17:03:50 -05:00
Fangrui Song
85f86e8a3c [libc++abi] Simplify __gxx_personality_v0
In three cases we call `scan_eh_tab` to parse LSDA:

* `actions & _UA_SEARCH_PHASE`
* `actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && !native_exception`
* `actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`

Check
`actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && native_exception` first,
then we can move three `scan_eh_tab` into one place.

Another simplification is that we can check whether the result of `scan_eh_tab`
is `_UA_CONTINUE_UNWIND` or `_UA_FATAL_PHASE1_ERROR` first. Then many of the
original checks will be dead and can thus be deleted.

Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D93186
2021-01-07 14:05:46 -08:00
Fangrui Song
ef74f0fdc3 [libc++abi] Remove redundant null pointer check in operator delete
Similar to D52401. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).

C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function

    If ptr is a null pointer, no action shall occur.

free on MSDN:

    If memblock is NULL, the pointer is ignored and free immediately returns.

Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D93339
2020-12-16 13:29:40 -08:00
Louis Dionne
d67e58f23a [libc++abi] Don't try calling __libcpp_aligned_free when aligned allocation is disabled
See https://reviews.llvm.org/rGa78aaa1ad512#962077 for details.
2020-12-01 17:45:14 -05:00
Leonard Chan
61aec69a65 [libcxxabi] Add macro for changing functions to support the relative vtables ABI
Under the relative vtables ABI, __dynamic_cast will not work since it assumes
the vtable pointer is 2 ptrdiff_ts away from the start of the vtable (8-byte
offset to top + 8-byte pointer to typeinfo) when it is actually 8 bytes away
(4-byte offset to top + 4-byte offset to typeinfo). This adjusts the logic under
__dynamic_cast and other areas vtable calculations are done to support this ABI
when it's used.

Differential Revision: https://reviews.llvm.org/D77606
2020-11-30 10:50:05 -08:00
Louis Dionne
564628014c [libc++] Introduce an indirection to create threads in the test suite
We create threads using std::thread in various places in the test suite.
However, the usual std::thread constructor may not work on all platforms,
e.g. on platforms where passing a stack size is required to create a thread.

This commit introduces a simple indirection that makes it easier to tweak
how threads are created inside the test suite on various platforms. Note
that tests that are purposefully calling std::thread's constructor directly
(e.g. because that is what they're testing) were not modified.
2020-11-27 11:54:19 -05:00
Bruce Mitchener
527a7fdfbd [libc++] Replace several uses of 0 by nullptr
Differential Revision: https://reviews.llvm.org/D43159
2020-11-27 10:00:21 -05:00
Marek Kurdej
5641b1dfdd [libc++] Mark a few more tests as unsupported on gcc-8/9.
This will fix remaining failures on gcc-9 buildbot: http://lab.llvm.org:8011/#/builders/101.
gcc-8 and gcc-9 do not support constexpr destructors nor constexpr allocation.

Fix gcc warnings: -Wconversion, -Wpragmas.
2020-11-26 12:40:50 +01:00
Marek Kurdej
dde0fcd7a7 [libc++] [libc++abi] Mark a few tests as unsupported/xfail on gcc-7/8/9.
This should make the builder http://lab.llvm.org:8011/#/builders/101/ happy.
It uses gcc-9 and not Tip-Of-Trunk as its name indicates BTW.
GCC-10 passes all these tests.

Fix gcc warnings: -Wsign-compare, -Wparentheses, -Wpragmas.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D92099
2020-11-26 08:59:52 +01:00
Louis Dionne
a78aaa1ad5 [libc++] Factor out common logic for calling aligned allocation
There were a couple of places where we needed to call the underlying
platform's aligned allocation/deallocation function. Instead of having
the same logic all over the place, extract the logic into a pair of
helper functions __libcpp_aligned_alloc and __libcpp_aligned_free.

The code in libcxxabi/src/fallback_malloc.cpp looks like it could be
simplified after this change -- I purposefully did not simplify it
further to keep this change as straightforward as possible, since it
is touching very important parts of the library.

Also, the changes in libcxx/src/new.cpp and libcxxabi/src/stdlib_new_delete.cpp
are basically the same -- I just kept both source files in sync.

The underlying reason for this refactoring is to make it easier to support
platforms that provide aligned allocation through C11's aligned_alloc
function instead of posix_memalign. After this change, we'll only have
to add support for that in a single place.

Differential Revision: https://reviews.llvm.org/D91379
2020-11-25 15:44:50 -05:00
Marek Kurdej
3b625060fc [libc++] [libc++abi] Use C++20 standard.
This change is needed to use char8_t when building libc++.
Using the same standard in libc++abi for coherence.

See https://reviews.llvm.org/D91517.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D91691
2020-11-22 15:57:25 +01:00
Richard Smith
bec968cbb3 Demangling support for class type non-type template parameter extensions.
The extensions in question are described in:
https://github.com/itanium-cxx-abi/cxx-abi/issues/47
https://github.com/itanium-cxx-abi/cxx-abi/issues/63

Differential Revision: https://reviews.llvm.org/D90003
2020-11-20 13:45:08 -08:00
Louis Dionne
a7b6574144 [libc++abi] Reuse libc++'s refstring.h header instead of copying it
This has been a long-standing TODO item, however we have now been requiring
a monorepo layout to build libc++ and libc++abi for a while now. Hence,
we can fix this code duplication issue now.

Note that it's still not super pretty to reach into libc++ to include
headers, but it's better than having duplicated code which can get out
of sync.
2020-11-11 16:58:32 -05:00
Louis Dionne
8d51969bd4 [runtimes] Avoid overwriting the rpath unconditionally
When building the runtimes, it's very important not to add rpaths unless
the user explicitly asks for them (the standard way being CMAKE_INSTALL_RPATH),
or to change the install name dir unless the user requests it (via
CMAKE_INSTALL_NAME_DIR).

llvm_setup_rpath() would override the install_name_dir of the runtimes
even if CMAKE_INSTALL_NAME_DIR was specified to something, which is wrong
and in fact even "dangerous" for the runtimes.

This issue was discovered when trying to build libc++ and libc++abi as
system libraries for Apple, where we set the install name dir to /usr/lib
explicitly. llvm_setup_rpath() would cause libc++ to have the wrong install
name dir, and for basically everything on the system to fail to load.
This was discovered just now because we previously used something closer
to a standalone build, where llvm_setup_rpath() wouldn't exist, and hence
not be used.

This is a revert of the following commits:

  libunwind: 3a667b9bd8
  libc++abi: 4877063e19
  libc++: 88434fe05f

Those added llvm_setup_rpath() for consistency, so it seems reasonable
to revert.

Differential Revision: https://reviews.llvm.org/D91099
2020-11-09 16:56:03 -05:00
Louis Dionne
c1887e3f15 Revert "Allow running back-deployment testing against libc++abi"
This reverts commit 4d79ef814a, which broke a few build bots.
I'm reverting until I have time to investigate.
2020-11-06 17:26:42 -05:00
Louis Dionne
4d79ef814a Allow running back-deployment testing against libc++abi
Summary:
Before this patch, we could only link against the back-deployment libc++abi
dylib. This patch allows linking against the just-built libc++abi, but
running against the back-deployment one -- just like we do for libc++.

Also, add XFAIL markup to flag expected errors.
2020-11-06 08:12:46 -05:00
Martin Storsjö
8a73aa8c4c [libcxx] [libcxxabi] Set flags for visibility when statically linking libcxxabi into libcxx for windows
Previously, these had to be set manually when building each of the
projects standalone, in order to get proper symbol visibility when
combining the two libraries.

Differential Revision: https://reviews.llvm.org/D90021
2020-11-03 17:13:48 +02:00
Martin Storsjö
9c30bafd59 [libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined
Various definitions from libcxx need to be set in the same way
as if building libcxx itself.

Differential Revision: https://reviews.llvm.org/D90476
2020-11-03 09:32:52 +02:00
Louis Dionne
1b2fa6e46e [libc++/libc++abi] Use Python3_EXECUTABLE consistently to run utilities 2020-11-02 11:07:31 -05:00
Louis Dionne
8d31392753 [libc++abi] Get rid of warnings when running the tests with GCC 2020-11-02 10:19:39 -05:00
Louis Dionne
b888463f8d [libc++abi] Make sure we can run the tests in Standalone mode
The tests would previously fail if the `python` executable wasn't found,
because we were missing the mandatory find_package.
2020-10-26 14:26:44 -04:00
Louis Dionne
2f8dd2687f [libc++] Refactor the run-buildbot script to make it more modular, and run the benchmarks
As a fly-by fix, unbreak the benchmarks on Apple platforms.

Differential Revision: https://reviews.llvm.org/D90043
2020-10-23 15:11:41 -04:00
Louis Dionne
48e4b0fd3a [runtimes] Revert the libc++ __config_site change
This is a massive revert of the following commits (from most revent to oldest):

	2b9b7b5775.
	529ac33197
	28270234f1
	69c2087283
	b5aa67446e
	5d796645d6

After checking-in the __config_site change, a lot of things started breaking
due to widespread reliance on various aspects of libc++'s build, notably the
fact that we can include the headers from the source tree, but also reliance
on various "internal" CMake variables used by the runtimes build and compiler-rt.

These were unintended consequences of the change, and after two days, we
still haven't restored all the bots to being green. Instead, now that I
understand what specific areas this will blow up in, I should be able to
chop up the patch into smaller ones that are easier to digest.

See https://reviews.llvm.org/D89041 for more details on this adventure.
2020-10-23 09:41:48 -04:00
Louis Dionne
529ac33197 [libc++abi] Fix the standalone build after the __config_site change
In 5d796645, we stopped looking at the LIBCXXABI_LIBCXX_INCLUDES variable,
which broke users of the Standalone build. This patch reinstates that
variable, however it must point to the *installed* path of the libc++
headers, not the libc++ headers in the source tree (which has always
been the case, but wasn't enforced before).

If LIBCXXABI_LIBCXX_INCLUDES points to the libc++ headers in the source
tree, the `__config_site` header will fail to be found.
2020-10-22 19:17:20 -04:00
Martin Storsjö
5449ea9f90 [libcxxabi] Define _LIBCXXABI_WEAK properly for mingw compilers
Copy over the compiler detection structure from libcxx, and set
_LIBCXXABI_WEAK like _LIBCPP_WEAK is set in libcxx.

This allows users to override operator new/delete, if using those
operators from libcxxabi instead of from libcxx.

Differential Revision: https://reviews.llvm.org/D89863
2020-10-22 09:00:57 +03:00
Louis Dionne
69c2087283 [libc++] Fix compiler-rt build by copying libc++ headers to <build>/include
This commit should really be named "Workaround external projects depending
on libc++ build system implementation details". It seems that the compiler-rt
build (and perhaps other projects) is relying on the fact that we copy libc++
and libc++abi headers to `<build-root>/include/c++/v1`. This was changed
by 5d796645, which moved the headers to `<build-root>/projects/libcxx/include/c++/v1`
and broke the compiler-rt build.

I'm committing this workaround to fix the compiler-rt build, but we should
remove reliance on implementation details like that. The correct way to
setup the compiler-rt build would be to "link" against the `cxx-headers`
target in CMake, or to run `install-cxx-headers` using an appropriate
installation prefix, and then manually add a `-I` path to that location.
2020-10-21 16:56:33 -04:00
Hafiz Abid Qadeer
272279a1c0 [libcxxabi] Stub out 'sleep' call when _LIBCXXABI_HAS_NO_THREADS is defined.
While running this test on a bare metal target, I got an error as 'sleep' was not available on that system. As 'sleep' call is not doing anything useful for cases when _LIBCXXABI_HAS_NO_THREADS is defined. This patch puts it under this check.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D89871
2020-10-21 20:56:24 +01:00
Louis Dionne
5d796645d6 [take 2] [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

This commit was originally applied in 1e46d1aa3 and reverted in eb60c487
because it broke the libc++abi and libunwind test suites. This has now
been fixed.

Differential Revision: https://reviews.llvm.org/D89041
2020-10-21 10:40:33 -04:00
Louis Dionne
eb60c48744 [libc++] Revert "Include <__config_site> from <__config>"
This temporarily reverts commit 1e46d1aa until I find a solution to fix
the libc++abi and libunwind test suites with that change.
2020-10-21 09:18:29 -04:00
Louis Dionne
1e46d1aa3f [libc++] Include <__config_site> from <__config>
Prior to this patch, we would generate a fancy <__config> header by
concatenating <__config_site> and <__config>. This complexifies the
build system and also increases the difference between what's tested
and what's actually installed.

This patch removes that complexity and instead simply installs <__config_site>
alongside the libc++ headers. <__config_site> is then included by <__config>,
which is much simpler. Doing this also opens the door to having different
<__config_site> headers depending on the target, which was impossible before.

It does change the workflow for testing header-only changes to libc++.
Previously, we would run `lit` against the headers in libcxx/include.
After this patch, we run it against a fake installation root of the
headers (containing a proper <__config_site> header). This makes use
closer to testing what we actually install, which is good, however it
does mean that we have to update that root before testing header changes.
Thus, we now need to run `ninja check-cxx-deps` before running `lit` by
hand.

Differential Revision: https://reviews.llvm.org/D89041
2020-10-21 08:46:57 -04:00
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