Commit Graph

659 Commits

Author SHA1 Message Date
Mark de Wever
17b0d90e20 [libunwind] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: #libunwind, mstorsjo

Differential Revision: https://reviews.llvm.org/D152100
2023-06-05 17:42:37 +02:00
Mark de Wever
cbaa3597aa Reland "[CMake] Bumps minimum version to 3.20.0.
This reverts commit d763c6e5e2.

Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.

d763c6e5e2 reverted the reviews

D144509 [CMake] Bumps minimum version to 3.20.0.

This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

D150532 [OpenMP] Compile assembly files as ASM, not C

Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.

Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.

Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.

D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump

The build uses other mechanism to select the runtime.

Fixes #62719

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D151344
2023-05-27 12:51:21 +02:00
Tobias Hieta
7bfaa0f09d
[NFC][Py Reformat] Reformat python files in libcxx/libcxxabi
This is an ongoing series of commits that are reformatting our
Python code.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: #libc, kwk, Mordante

Differential Revision: https://reviews.llvm.org/D150763
2023-05-25 11:15:34 +02:00
Nico Weber
d763c6e5e2 Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit 65429b9af6.

Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards.

Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C"

This reverts commit 4072c8aee4.

Also reverts fix attempt  "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump"

This reverts commit 7d47dac5f8.
2023-05-17 10:53:33 -04:00
Mark de Wever
65429b9af6 Reland "[CMake] Bumps minimum version to 3.20.0."
The owner of the last two failing buildbots updated CMake.

This reverts commit e8e8707b4a.
2023-05-13 11:42:25 +02:00
Feng Wang
f56ea14c29 [libunwind] Unwind through Linux riscv sigreturn trampoline
Similar to D90898 (Linux AArch64) and D124765 (SystemZ).

On an Arch Linux RISC-V (riscv64gc), the following code

```
#define _GNU_SOURCE
#include <dlfcn.h>
#include <libunwind.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

static void handler(int signo) {
  unw_context_t context;
  unw_cursor_t cursor;
  unw_getcontext(&context);
  unw_init_local(&cursor, &context);
  unw_word_t pc, sp;
  do {
    unw_get_reg(&cursor, UNW_REG_IP, &pc);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf("pc=0x%016zx sp=0x%016zx", (size_t)pc, (size_t)sp);
    Dl_info info = {};
    if (dladdr((void *)pc, &info))
      printf(" %s:%s", info.dli_fname, info.dli_sname ? info.dli_sname : "");
    puts("");
  } while (unw_step(&cursor) > 0);
  exit(0);
}

int main() {
  signal(SIGUSR1, handler);
  raise(SIGUSR1);
  return 1;
}
```

linked with `-Wl,--export-dynamic` gives an output like
```
pc=0x0000000000010a82 sp=0x00007fffd8a0b910 ./b:
pc=0x00007fffa7e77800 sp=0x00007fffd8a0c520 linux-vdso.so.1:__vdso_rt_sigreturn
pc=0x00007fffa7d73bee sp=0x00007fffd8a0c960 /usr/lib/libc.so.6:
pc=0x00007fffa7d3ed66 sp=0x00007fffd8a0c9b0 /usr/lib/libc.so.6:gsignal
pc=0x0000000000010a3c sp=0x00007fffd8a0c9c0 ./b:main
pc=0x00007fffa7d2f1d4 sp=0x00007fffd8a0c9e0 /usr/lib/libc.so.6:
pc=0x00007fffa7d2f27c sp=0x00007fffd8a0cb10 /usr/lib/libc.so.6:__libc_start_main
pc=0x00000000000109a0 sp=0x00007fffd8a0cb60 ./b:_start
```

Co-Authored-By: Fangrui Song <i@maskray.me>

Reviewed By: #libunwind, MaskRay

Differential Revision: https://reviews.llvm.org/D148499
2023-05-06 11:17:02 -07:00
Mark de Wever
e8e8707b4a Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
Unfortunatly not all buildbots are updated.

This reverts commit ffb807ab53.
2023-05-06 17:03:56 +02:00
Mark de Wever
ffb807ab53 Reland "[CMake] Bumps minimum version to 3.20.0."
All build bots should be updated now.

This reverts commit 44d38022ab.
2023-05-06 11:43:02 +02:00
Martin Storsjö
ba3bddb6f4 [libcxx] [test] Prepend to PATH instead of overriding it
On Windows, the PATH env variable is used for locating dynamically
linked librarys, akin to LD_LIBRARY_PATH on Linux.

The tests that run with a dynamically linked libc++ used "--env
PATH=%{lib}" in the test config. This had the unfortunate side effect
of making other tools from PATH unavailable during the runtime of the
tests; in particular, it caused the "executor-has-no-bash" flag to be
set for all those Windows test configs (with the clang-cl static config
being the only one lacking it).

Thus, this increases the number of tests actually included in the
clang-cl dll and all mingw test configs by 9 tests.

The clang-cl static test configuration has been executing those tests
since the "--env PATH=%{lib}" was removed from that test config in
e78223e79e. (For mingw we haven't had a
need to split the test config between shared and static, which means
that the mingw static test config previously ran with --env PATH
needlessly.)

This increases the test coverage for patches like D146398 which
can't be executed in the executor-has-no-bash configs.

Change the default value of the arg.env to an empty array; when we do
pass values to the option, they get passed as an array of strings,
so make sure the variable behaves consistently when no arguments
have been passed.

Differential Revision: https://reviews.llvm.org/D148324
2023-04-27 19:25:59 +03:00
Fangrui Song
bda5f77f96 [test] Simplify libunwind REQUIRES 2023-04-23 14:58:46 -07:00
Martin Storsjö
f6320f5e0e [libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
We only initialize a few fields in DISPATCHER_CONTEXT - don't leave
the rest in an uninitialized state; make sure the whole struct is
in a deterministic state.

This makes nondeterministic failures deterministic, for some cases
relating to forced unwinding on aarch64/arm (which requires filling
in parsing of the xdata for finding the exception handler and LSDA).

Differential Revision: https://reviews.llvm.org/D148660
2023-04-22 22:47:45 +03:00
Martin Storsjö
ba9b2cdb9c [libunwind] [SEH] Add debug logging in __libunwind_seh_personality
Differential Revision: https://reviews.llvm.org/D148659
2023-04-19 23:05:48 +03:00
Louis Dionne
1ae57fed88 [libunwind] Remove the legacy Unwind_AppleExtras.cpp
Unwind_AppleExtras.cpp contained annotations telling the linker that
some symbols are not available on some very old platforms. However,
those platforms are not supported anymore, so the annotations are not
used.

Why remove this? In addition to cleaning up the code base, this also
removes the possibility of implementing those annotations incorrectly
(which was the case previously), which could lead to important symbols
being hidden when they should have been visible.

Differential Revision: https://reviews.llvm.org/D148445
2023-04-18 12:03:06 +00:00
Mark de Wever
44d38022ab Revert "Revert "Revert "[CMake] Bumps minimum version to 3.20.0."""
This reverts commit 1ef4c3c859.

Two buildbots still haven't been updated.
2023-04-15 20:12:24 +02:00
Mark de Wever
1ef4c3c859 Revert "Revert "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit 92523a35a8.

Reland to see whether CIs are updated.
2023-04-15 13:12:04 +02:00
Louis Dionne
ca4fb46318 [libunwind] Sync Unwind_AppleExtras.cpp with downstream version
Both had diverged in a few ways, so this brings them both back in sync.

Differential Revision: https://reviews.llvm.org/D148351
2023-04-15 10:37:28 +01:00
Martin Storsjö
ebae5622d1 [libunwind] [SEH] Initialize _msContext with RtlCaptureContext
When we initialize the UnwindCursor (unw_cursor_t) based on
an existing Registers object (unw_context_t), we only initialize
a subset of the class.

Fill the struct properly for the current thread with RtlCaptureContext,
followed by overwriting of the subset of registers that we do have
available in the Registers class.

One might think that it's enough to initialize specifically the
registers that we signal availability for with ContextFlags,
however in practice, that's not enough.

This fixes crashes when restoring the context via RtlRestoreContext
(via UnwindCursor::jumpto), via __unw_resume.

Differential Revision: https://reviews.llvm.org/D147636
2023-04-13 12:03:35 +03:00
Martin Storsjö
5b9d969e7c [libunwind] [SEH] Allow setting/getting the register UNW_X86_64_RIP
This fixes libunwind_01.pass.cpp for x86_64 Windows.

Differential Revision: https://reviews.llvm.org/D147635
2023-04-13 12:03:35 +03:00
Martin Storsjö
a2ef896a96 [libcxxabi, libunwind] [test] Place output from tests under a 'test' subdir
Previously, all the output from the tests were placed directly in
the build directory. The tests produce a couple directories named
`__config_{exec,cache,src}__` which are easy to distinguish, and
the output from the individual tests were placed directly in a
directory named `Output`.

This is the same change as
736c6e246f, but for the libcxxabi
and libunwind test suites.

Differential Revision: https://reviews.llvm.org/D147628
2023-04-11 00:13:33 +03:00
Martin Storsjö
11ed806e7f [libunwind] [test] Mark the signal_frame test as unsupported on Windows
Mark it as unsupported on x86_64, arm and aarch64. On i686, DWARF
is used as the default unwinding format, and there, the CFI
directives are supported.

Differential Revision: https://reviews.llvm.org/D147858
2023-04-11 00:00:30 +03:00
Martin Storsjö
66632e8798 [libunwind] [SEH] Handle ExceptionContinueExecution in forced unwinding
This fixes the libcxxabi test force_unwind3.pass.cpp when run on native
Windows.

When unwinding past the main thread function into the system functions
that brought up the thread, we can hit functions whose personality
functions return ExceptionContinueExecution (instead of the regular
ExceptionContinueSearch). Interpret this as a signal to stop the
unwind.

Curiously, in this case, it does return ExceptionContinueSearch if
running within a debugger.

Differential Revision: https://reviews.llvm.org/D147739
2023-04-11 00:00:30 +03:00
Martin Storsjö
87ca04033c [libunwind] [SEH] Sync LSDA and handler between unw_proc_info_t and DISPATCHER_CONTEXT
For normal C++ unwinding, we get _dispContext initialized by the
prepopulated DISPATCHER_CONTEXT in _GCC_specific_handler, which
we set with __unw_seh_set_disp_ctx.

When doing force unwinding, we step and populate the unw_proc_info_t
struct _info with getInfoFromSEH, but when we execute the handler
via the __libunwind_seh_personality wrapper function, we execute
the handler set in DISPATCHER_CONTEXT.

Whenever updating these fields in either _info or _dispContext,
sync them to the other one too.

This fixes one aspect of the libcxxabi force_unwind*.pass.cpp tests on
x86_64.

Differential Revision: https://reviews.llvm.org/D147637
2023-04-11 00:00:30 +03:00
Martin Storsjö
55abdef3da [libunwind] Increase the external value of _LIBUNWIND_CURSOR_SIZE for SEH/x86_64
For x86_64 Windows targets (that use SEH), _LIBUNWIND_CURSOR_SIZE
is 204; this fixes corruption in test cases that include libunwind.h
without manually defining _LIBUNWIND_IS_NATIVE_ONLY.

If the libunwind.h header is included without defining
_LIBUNWIND_IS_NATIVE_ONLY (like in the libunwind test cases), the
sizes are set to accommodate the maximum possible cursors and
contexts.

(Alternatively, __libunwind_config.h should be changed to default
to native unwinding unless cross unwinding has been requested.
Cross unwinding isn't implemented as far as I know anyway.)

Differential Revision: https://reviews.llvm.org/D147634
2023-04-11 00:00:30 +03:00
Weining Lu
ff0aabf14d [libunwind][LoongArch] Restore $r1 before $r4 in jumpto
$ra should be restored before $a0, otherwise the baseaddress ($a0) would
be destroyed. See file `UnwindRegistersSave.S` for reference.

This also makes libcxx and libcxxabi regtest pass for the `-DLIBCXXABI_USE_LLVM_UNWINDER=ON` build.

Reviewed By: MaskRay, xen0n, #libunwind

Differential Revision: https://reviews.llvm.org/D147372
2023-04-07 13:42:23 +08:00
zhanglimin
366c5474a3 [libunwind][test] Add test to check for unw_resume()
This is here for local unwinding, which unw_resume() restores
the machine state and then directly resumes execution in the
target stack frame.

Reviewed By: wangleiat

Differential Revision: https://reviews.llvm.org/D147371
2023-04-07 13:42:23 +08:00
Martin Storsjö
b25e989e68 [libunwind] [test] Add a mingw specific test config file
This matches how it is done for libcxx and libcxxabi.

Differential Revision: https://reviews.llvm.org/D147633
2023-04-06 11:07:41 +03:00
Martin Storsjö
a33d5a9939 [libunwind] Fflush stderr after each log message
In most configs, stderr is line buffered by default, but in some
cases on Windows (running in git bash, or running in Wine) stderr
can end up fully buffered.

See 2ec75a0869 for a similar change
for the output from lit itself.

This has no effect on libunwind when the log messages aren't enabled
via the environment variables.

Differential Revision: https://reviews.llvm.org/D147632
2023-04-06 11:07:41 +03:00
Martin Storsjö
a017aefeac [libunwind] Fix a typo in a debug log message. NFC.
This typo (unw_step instead of unw_get_proc_info) has been around since
the initial public commit of libunwind.

Differential Revision: https://reviews.llvm.org/D147631
2023-04-06 11:07:41 +03:00
Martin Storsjö
16857c4a30 [libcxxabi, libunwind] [test] Quote the python path properly for LIB*_EXECUTOR
This is the same as c218c80c73,
but for libcxxabi and libunwind.

This fixes running tests on Windows with Python installed in
e.g. "C:\Program Files\Python38".

Differential Revision: https://reviews.llvm.org/D147629
2023-04-06 11:07:41 +03:00
Martin Storsjö
d080b5f173 [libunwind] Fix a case of inconsistent indentation. NFC. 2023-04-05 19:23:18 +03:00
Louis Dionne
ed61d6a466 [libc++] Use the stdlib=<LIB> Lit feature instead of use_system_cxx_lib
The use_system_cxx_lib Lit feature was only used for back-deployment
testing. However, one immense hole in that setup was that we didn't
have a proper way to test Apple's own libc++ outside of back-deployment,
which was embodied by the fact that we needed to define _LIBCPP_DISABLE_AVAILABILITY
when testing (see change in libcxx/utils/libcxx/test/params.py).

This led to the apple-system testing configuration not checking for
availability markup, which is obviously quite bad since the library
we ship actually has availability markup.

Using stdlib=<VENDOR>-libc++ instead to encode back-deployment restrictions
on tests is simpler and it makes it possible to naturally support tests
such as availability markup checking even in the tip-of-trunk Apple-libc++
configuration.

Differential Revision: https://reviews.llvm.org/D146366
2023-03-30 06:57:56 -04:00
Ian Anderson
1187d8a62b [libunwind][Modules] Add unwind_arm_ehabi.h and unwind_itanium.h to the unwind module)
Add unwind_arm_ehabi.h and unwind_itanium.h to the unwind module and use angle includes to include them.

Reviewed By: ldionne, #libunwind

Differential Revision: https://reviews.llvm.org/D144323
2023-03-20 15:13:14 -07:00
Mark de Wever
d0398d3593 Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit a72165e5df.

Some buildbots have not been updated yet.
2023-03-18 20:32:43 +01:00
Mark de Wever
a72165e5df Reland "[CMake] Bumps minimum version to 3.20.0."
This reverts commit 92523a35a8.

Test whether all CI runners are updated.
2023-03-18 13:33:42 +01:00
Xi Ruoyao
5d276380b0 [libunwind][AArch64] Unbreak building with GNU assembler
GNU assembler mandates armv8.5-a for memtag instructions. Maybe
we should remove this restriction in GNU assembler, but let's work
around it for current GNU Binutils releases.

Differential Revision: https://reviews.llvm.org/D146109
2023-03-17 09:28:20 +01:00
Nikolas Klauser
a7aade1f36 [runtimes] Synchronize warnings flags between libc++/libc++abi/libunwind
This mostly keeps the same warning flags. The most important exceptions are `-Wpedantic` and `-Wconversion`, which are now removed from libc++abi and libunwind.

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

Spies: mikhail.ramalho, phosek, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144252
2023-03-17 00:40:59 +01:00
Kito Cheng
9b488ace17 [libunwind][RISC-V] Rewrite testcase with C as possible.
Fix #60472

The testcase is writen in all inline asm but it seems not well
maintained for the CFI directive, of cause we can fix that, but this
patch also contain another issue is it use s0 and s1 without
store/restore.

This patch proposed another way to testing that, use inline asm to
generate dummy def and use, so compiler will generate store/restore for
the vector register, and then generate the CFI directives.

Also check __riscv_vector as the testcase guard, because the testcase
will read vlenb which is only available when V or zve* extensions is
present.

Reviewed By: MaskRay, asb, #libunwind

Differential Revision: https://reviews.llvm.org/D145225
2023-03-15 17:30:16 +08:00
Mark de Wever
92523a35a8 Revert "[CMake] Bumps minimum version to 3.20.0."
Some build bots have not been updated to the new minimal CMake version.
Reverting for now and ping the buildbot owners.

This reverts commit 44c6b905f8.
2023-03-04 18:28:13 +01:00
Mark de Wever
44c6b905f8 [CMake] Bumps minimum version to 3.20.0.
This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

Reviewed By: mehdi_amini, MaskRay, ChuanqiXu, to268, thieta, tschuett, phosek, #libunwind, #libc_vendors, #libc, #libc_abi, sivachandra, philnik, zibi

Differential Revision: https://reviews.llvm.org/D144509
2023-03-04 12:40:57 +01:00
Petr Hosek
24d144571d Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
This reverts commit efae3174f0 since
it broke the standalone Flang build.
2023-02-22 17:32:07 +00:00
Petr Hosek
efae3174f0 [CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These have the same purposes but two different implementations.
llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects
flags used both for compilation and linking which is problematic because
some flags may be link-only and trigger unused argument warning when set
during compilation. llvm_check_linker_flag does not have this issue so
we chose it as the prevailaing implementation.

Differential Revision: https://reviews.llvm.org/D143052
2023-02-22 04:24:49 +00:00
Nikolas Klauser
141471a0cb [runtimes] Remove unused functions from Handle{Libcxx,Libunwind}Flags.cmake
Reviewed By: phosek, #libunwind, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144400
2023-02-22 00:38:44 +01:00
Nikolas Klauser
d0e95fec65 [runtimes] Remove add_target_flags* functions and use add_flags* instead
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144398
2023-02-21 13:16:44 +01:00
Nikolas Klauser
0af67d167d [runtimes] Move common functions from Handle{Libcxx,Libcxxabi,Libunwind}Flags.cmake to runtimes/cmake/Modules/HandleFlags.cmake
Reviewed By: phosek, #libunwind, #libc, #libc_abi

Spies: arichardson, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144395
2023-02-21 13:15:25 +01:00
Nemanja Ivanovic
372820bf57 [libunwind][PowerPC] Fix saving/restoring VSX registers on LE systems
Currently, libunwind just uses stxvd2x/lxvd2x to save/restore
VSX registers respectively. This puts the registers in
doubleword-reversed order into memory on little endian systems.
If both the save and restore are done the same way, this
isn't a problem. However if the unwinder is just restoring
a callee-saved register, it will restore it in the wrong
order (since function prologues save them in the correct order).
This patch adds the necessary swaps before the saves and after
the restores.

Differential revision: https://reviews.llvm.org/D137599
2023-02-16 13:37:58 -05:00
Louis Dionne
cafb1c1cb2 [runtimes] Remove duplicate imports of libcxx.test.config 2023-02-14 17:28:22 -05:00
Louis Dionne
33d0d1e36f [runtimes] Rename newconfig.py to config.py -- it's not new anymore
Differential Revision: https://reviews.llvm.org/D144031
2023-02-14 17:21:34 -05:00
Lang Hames
0751fc68b9 [libunwind] On Darwin, add a callback-based lookup scheme for JIT'd unwind info.
This commit adds support for a new callback-based lookup scheme for unwind
info that was inspired by the `_dyld_find_unwind_info_sections` SPI that
libunwind uses to find unwind-info in non-JIT'd frames. From
llvm-project/libunwind/src/AddressSpace.hpp:

```
struct dyld_unwind_sections {
  const struct mach_header*   mh;
  const void*                 dwarf_section;
  uintptr_t                   dwarf_section_length;
  const void*                 compact_unwind_section;
  uintptr_t                   compact_unwind_section_length;
};

extern bool _dyld_find_unwind_sections(void *, dyld_unwind_sections *);
```

During unwinding libunwind calls `_dyld_find_unwind_sections` to both find
unwind section addresses and identify the subarchitecture for frames (via the
MachO-header pointed to by the mh field).

This commit introduces two new libunwind SPI functions:

```
struct unw_dynamic_unwind_sections {
  unw_word_t dso_base;
  unw_word_t dwarf_section;
  size_t     dwarf_section_length;
  unw_word_t compact_unwind_section;
  size_t     compact_unwind_section_length;
};

typedef int (*unw_find_dynamic_unwind_sections)(
    unw_word_t addr, struct unw_dynamic_unwind_sections *info);

// Returns UNW_ESUCCESS if successfully registered, UNW_EINVAL for duplicate
// registrations, and UNW_ENOMEM to indicate too many registrations.
extern int __unw_add_find_dynamic_unwind_sections(
    unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);

// Returns UNW_ESUCCESS if successfully deregistered, UNW_EINVAL to indicate
// no such registration.
extern int __unw_remove_find_dynamic_unwind_sections(
    unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
```

These can be used to register and deregister callbacks that have a similar
signature to `_dyld_find_unwind_sections`. During unwinding if
`_dyld_find_unwind_sections` returns false (indicating that no frame info
was found by dyld) then registered callbacks are run in registration order until
either the unwind info is found or the end of the list is reached.

With this commit, and by implementing the find-unwind-info callback in the ORC
runtime in LLVM, we (1) enable support for registering JIT'd compact-unwind info
with libunwind*, (2) provide a way to identify the subarchitecture for each frame
(by returning a pointer to a JIT'd MachO header), and (3) delegate tracking of
unwind info to the callback, which may be able to implement more efficient
address-based lookup than libunwind.

* JITLink does not process or register compact unwind info yet, so this patch
  does not fully enable compact unwind info in ORC, it simply provides some
  necessary plumbing. JITLink support for compact unwind should land some time
  in the LLVM 17 development cycle.

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D142176
2023-02-10 14:36:25 -08:00
Tom Stellard
603c286334 Bump the trunk major version to 17 2023-01-24 22:57:27 -08:00
Fahad Nayyar
226798f3aa [libunwind] Fixed an upcoming clang -Wsign-conversion warning
Fixing an upcoming clang warning (from https://reviews.llvm.org/D139114) in libunwind.

Differential Revision: https://reviews.llvm.org/D141515
2023-01-13 16:01:37 +00:00