Relocations

This analyzer enhances support for binaries that use recent relocation formats not recognized by BinaryNinja (e.g. DT_ANDROID_RELA, DT_RELR).

For instance, here is a LIEF-based processing of DT_ANDROID_RELA relocations:

.fini_array section started  {0x441e40-0x441e98}00441e40  void (* fini_array[0xb])() =00441e40  {00441e40      [0x0] = 0x1c02000441e48      [0x1] = 0x1c00000441e50      [0x2] = 0x2bd8000441e58      [0x3] = 0x2c78000441e60      [0x4] = 0x2ef5000441e68      [0x5] = 0x3269000441e70      [0x6] = 0x3441000441e78      [0x7] = 0x3862000441e80      [0x8] = 0x3a60000441e88      [0x9] = 0x3d43000441e90      [0xa] = 0x3d53000441e98  }.fini_array section ended  {0x441e40-0x441e98}.init_array section started  {0x441e98-0x441f08}00441e98  void (* init_array[0xe])() =00441e98  {00441e98      [0x0] = 0x1c30c00441ea0      [0x1] = 0x1c65000441ea8      [0x2] = 0x246f000441eb0      [0x3] = 0x284c000441eb8      [0x4] = 0x2981000441ec0      [0x5] = 0x2bd7000441ec8      [0x6] = 0x2c77000441ed0      [0x7] = 0x2ef4000441ed8      [0x8] = 0x3268000441ee0      [0x9] = 0x3440000441ee8      [0xa] = 0x3861000441ef0      [0xb] = 0x3a5f000441ef8      [0xc] = 0x3d3a000441f00      [0xd] = 0x3d4a000441f08  }.init_array section ended  {0x441e98-0x441f08}
.fini_array section started  {0x441e40-0x441e98}00441e40  void (* fini_array[0xb])() =00441e40  {00441e40      void (* fini_array)() = __on_dlclose_late00441e48      void (* data_441e48)() = __on_dlclose00441e50      void (* data_441e50)() = fib_lookup_exit00441e58      void (* data_441e58)() = ctrl_exit00441e60      void (* data_441e60)() = addr_exit00441e68      void (* data_441e68)() = link_exit00441e70      void (* data_441e70)() = macsec_exit00441e78      void (* data_441e78)() = vlan_exit00441e80      void (* data_441e80)() = route_exit00441e88      void (* data_441e88)() = release_routing_table_names00441e90      void (* data_441e90)() = release_proto_names00441e98  }.fini_array section ended  {0x441e40-0x441e98}.init_array section started  {0x441e98-0x441f08}00441e98  void (* init_array[0xe])() =00441e98  {00441e98      void (* init_array)() = init_have_lse_atomics00441ea0      void (* data_441ea0)() = __init_cpu_features00441ea8      void (* data_441ea8)() = init_msg_size00441eb0      void (* data_441eb0)() = init_default_cb00441eb8      void (* data_441eb8)() = nl_debug_init00441ec0      void (* data_441ec0)() = fib_lookup_init00441ec8      void (* data_441ec8)() = ctrl_init00441ed0      void (* data_441ed0)() = addr_init00441ed8      void (* data_441ed8)() = link_init00441ee0      void (* data_441ee0)() = macsec_init00441ee8      void (* data_441ee8)() = vlan_init00441ef0      void (* data_441ef0)() = route_init00441ef8      void (* data_441ef8)() = init_routing_table_names00441f00      void (* data_441f00)() = init_proto_names00441f08  }.init_array section ended  {0x441e98-0x441f08}

Here is one for DT_RELR relocations:

.data.rel.ro (PROGBITS) section started  {0x421010-0x422310}00421020  00 00 00 00 00 00 00 00 6c 2c 01 00 00 00 00 00  ........l,......00421030  98 2c 01 00 00 00 00 00 00 00 00 00 00 00 00 00  .,..............00421040  d4 28 01 00 00 00 00 00 fc 2a 01 00 00 00 00 00  .(.......*......00421050  fc 2a 01 00 00 00 00 00 00 2b 01 00 00 00 00 00  .*.......+......00421060  60 00 00 00 00 00 00 00 d8 ff ff ff ff ff ff ff  `...............00421070  00 00 00 00 00 00 00 00 cc 2c 01 00 00 00 00 00  .........,......00421080  fc 2c 01 00 00 00 00 00 78 2b 01 00 00 00 00 00  .,......x+......00421090  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................data.rel.ro (PROGBITS) section ended  {0x421010-0x422310}
.data.rel.ro (PROGBITS) section started  {0x421010-0x422310}00421020  void* data_421038 = 0x000421028  void* data_421028 = android::Choreographer::~Choreographer()00421030  void* data_421030 = android::Choreographer::~Choreographer()00421038  void* data_421038 = 0x000421040  void* data_421040 = android::Choreographer::dispatchVsync(int64_t, uint64_t, uint32_t)00421048  void* data_421048 = android::Choreographer::dispatchHotplug(int64_t, uint64_t, bool)00421050  void* data_421050 = android::Choreographer::dispatchHotplug(int64_t, uint64_t, bool)00421058  void* data_421058 = android::Choreographer::handleMessage(android::Message const&).data.rel.ro (PROGBITS) section ended  {0x421010-0x422310}