HomePhabricator

Improve readability and correctness of the OS specific libunwind bits.

Description

Improve readability and correctness of the OS specific libunwind bits.

All of the access to __exidx_*, dl_iterate_phdr(), etc. is specific to
the findUnwindSections() function. Right now all of the includes and
declarations related to them are scattered throughout the source file.
For example, for <link.h>, we have a full list of operating systems
guarding the #include, even though the code that uses dl_iterate_phdr()
miraculously doesn't use the same list.

Change the code so that findUnwindSections() is preceded by a block of
#ifdefs that share the same structure as the function itself. First
comes all of the macOS specific bits, followed by bare-metal ARM,
followed by ELF EHABI + DWARF.

This actually allows us to build a copy of libunwind without any
specific ifdefs for NetBSD, CloudABI, etc. It likely also unbreaks the
build of libunwind on FreeBSD/armv6, though I can't confirm.

Reviewed by: compnerd
Differential Revision: https://reviews.llvm.org/D30696

Details

Committed
edMar 7 2017, 10:15 AM
Reviewer
compnerd
Differential Revision
D30696: Improve readability and correctness of the OS specific libunwind bits.
Parents
rL297173: Fix test and add missing return for llvm-lto2 error case
Branches
Unknown
Tags
Unknown