This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Fix wrong endianness check in Unwind-EHABI
ClosedPublic

Authored by speidy on May 13 2020, 5:13 AM.

Details

Reviewers
miyuki
mstorsjo
speidy
compnerd
Group Reviewers
Restricted Project
Summary

The ARM specific code was trying to determine endianness using the
__LITTLE_ENDIAN__ macro which is not guaranteed to be defined.
When not defined, it makes libunwind to build the big-endian code even
when the compiler builds for a little-endian target.

This issue leads libunwind to crash with SIGSEGV during stack unwinding when
it built for ARM by using musl-gcc toolchain (from http://musl.cc) and breaks exception
handling.

Switched into a more hermetic check which should also raise a
compile-time error in case endianness could not be determined.

Diff Detail

Event Timeline

speidy created this revision.May 13 2020, 5:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2020, 5:13 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
speidy edited the summary of this revision. (Show Details)May 13 2020, 5:13 AM
speidy edited the summary of this revision. (Show Details)May 13 2020, 5:18 AM
speidy edited the summary of this revision. (Show Details)
miyuki accepted this revision.May 13 2020, 5:29 AM
mstorsjo accepted this revision.May 13 2020, 10:31 AM
mstorsjo added a subscriber: mstorsjo.

LGTM

This revision is now accepted and ready to land.May 13 2020, 10:31 AM
speidy accepted this revision.May 27 2020, 12:42 AM

Can you merge?

compnerd accepted this revision.EditedMay 29 2020, 8:23 AM
compnerd added a subscriber: compnerd.

This seems fine with the minor thing that the original check was not incorrect, merely not as portable, __BYTE_ORDER__ is more portable.

compnerd closed this revision.May 29 2020, 8:29 AM

Merged as rG68c50708d1f2b9aee3f10ec710df0b1387f701e5.

Thanks for the portability fix!