This is an archive of the discontinued LLVM Phabricator instance.

gn build: Support cross-compiling libunwind for Android.
ClosedPublic

Authored by pcc on Feb 11 2021, 4:42 PM.

Details

Summary
  • Usual cross-compilation fix: s/target_/current_/g
  • Define _LIBUNWIND_IS_NATIVE_ONLY to enable unwinding past functions with return pointer authentication.
  • Android needs two libunwind static libraries: one with symbols exported and one without. These both need to be in the same build tree so the libunwind_hermetic_static_library configuration option doesn't help here. Replace it with build rules that build both libraries.
  • Install the libraries in the location that Android expects them to be.

Diff Detail

Event Timeline

pcc created this revision.Feb 11 2021, 4:42 PM
pcc requested review of this revision.Feb 11 2021, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2021, 4:42 PM

The Android part of this change looks fine to me.

phosek accepted this revision.Feb 11 2021, 9:22 PM

LGTM

llvm/utils/gn/secondary/libunwind/src/BUILD.gn
63

I'd control this by an argument, for example libunwind_enable_cross_unwinding, rather than setting this unconditionally to match the CMake build.

This revision is now accepted and ready to land.Feb 11 2021, 9:22 PM
pcc added inline comments.Feb 11 2021, 9:45 PM
llvm/utils/gn/secondary/libunwind/src/BUILD.gn
63

Let's wait for a use case, as premature implementation of args may constrain ourselves in the future (e.g. I wouldn't have needed to remove libunwind_hermetic_static_library if it hadn't existed in the first place).

This revision was landed with ongoing or failed builds.Feb 11 2021, 9:47 PM
This revision was automatically updated to reflect the committed changes.