ARM: Don't emit R_ARM_NONE relocations to compact unwinding decoders in .ARM.exidx...
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 8 Nov 2019 19:03:34 +0000 (11:03 -0800)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 12 Nov 2019 18:52:59 +0000 (10:52 -0800)
commit1549b4699a84838c3969590dc4f757b72f39f40d
tree4adaa1fa3fc6a6fbede49f969480e3db38f8cb0e
parentceb72d07b004af9c428c4a3c73a98ea97d49a713
ARM: Don't emit R_ARM_NONE relocations to compact unwinding decoders in .ARM.exidx on Android.

These relocations are specified by the ARM EHABI (section 6.3). As I understand
it, their purpose is to accommodate unwinder implementations that wish to
reduce code size by placing the implementations of the compact unwinding
decoders in a separate translation unit, and using extern weak symbols to
refer to them from the main unwinder implementation, so that they are only
linked when something in the binary needs them in order to unwind.

However, neither of the unwinders used on Android (libgcc, LLVM libunwind)
use this technique, and in fact emitting these relocations ends up being
counterproductive to code size because they cause a copy of the unwinder
to be statically linked into most binaries, regardless of whether it is
actually needed. Furthermore, these relocations create circular dependencies
(between libc and the unwinder) in cases where the unwinder is dynamically
linked and libc contains compact unwind info.

Therefore, deviate from the EHABI here and stop emitting these relocations
on Android.

Differential Revision: https://reviews.llvm.org/D70027
llvm/include/llvm/MC/MCELFStreamer.h
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
llvm/test/MC/ARM/eh-compact-pr0.s