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] = 0x1c020 00441e48      [0x1] = 0x1c000 00441e50      [0x2] = 0x2bd80 00441e58      [0x3] = 0x2c780 00441e60      [0x4] = 0x2ef50 00441e68      [0x5] = 0x32690 00441e70      [0x6] = 0x34410 00441e78      [0x7] = 0x38620 00441e80      [0x8] = 0x3a600 00441e88      [0x9] = 0x3d430 00441e90      [0xa] = 0x3d530 00441e98  } .fini_array section ended  {0x441e40-0x441e98} .init_array section started  {0x441e98-0x441f08} 00441e98  void (* init_array[0xe])() = 00441e98  { 00441e98      [0x0] = 0x1c30c 00441ea0      [0x1] = 0x1c650 00441ea8      [0x2] = 0x246f0 00441eb0      [0x3] = 0x284c0 00441eb8      [0x4] = 0x29810 00441ec0      [0x5] = 0x2bd70 00441ec8      [0x6] = 0x2c770 00441ed0      [0x7] = 0x2ef40 00441ed8      [0x8] = 0x32680 00441ee0      [0x9] = 0x34400 00441ee8      [0xa] = 0x38610 00441ef0      [0xb] = 0x3a5f0 00441ef8      [0xc] = 0x3d3a0 00441f00      [0xd] = 0x3d4a0 00441f08  } .init_array section ended  {0x441e98-0x441f08}
.fini_array section started  {0x441e40-0x441e98} 00441e40  void (* fini_array[0xb])() = 00441e40  { 00441e40      void (* fini_array)() = __on_dlclose_late 00441e48      void (* data_441e48)() = __on_dlclose 00441e50      void (* data_441e50)() = fib_lookup_exit 00441e58      void (* data_441e58)() = ctrl_exit 00441e60      void (* data_441e60)() = addr_exit 00441e68      void (* data_441e68)() = link_exit 00441e70      void (* data_441e70)() = macsec_exit 00441e78      void (* data_441e78)() = vlan_exit 00441e80      void (* data_441e80)() = route_exit 00441e88      void (* data_441e88)() = release_routing_table_names 00441e90      void (* data_441e90)() = release_proto_names 00441e98  } .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_atomics 00441ea0      void (* data_441ea0)() = __init_cpu_features 00441ea8      void (* data_441ea8)() = init_msg_size 00441eb0      void (* data_441eb0)() = init_default_cb 00441eb8      void (* data_441eb8)() = nl_debug_init 00441ec0      void (* data_441ec0)() = fib_lookup_init 00441ec8      void (* data_441ec8)() = ctrl_init 00441ed0      void (* data_441ed0)() = addr_init 00441ed8      void (* data_441ed8)() = link_init 00441ee0      void (* data_441ee0)() = macsec_init 00441ee8      void (* data_441ee8)() = vlan_init 00441ef0      void (* data_441ef0)() = route_init 00441ef8      void (* data_441ef8)() = init_routing_table_names 00441f00      void (* data_441f00)() = init_proto_names 00441f08  } .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 = 0x0 00421028  void* data_421028 = android::Choreographer::~Choreographer() 00421030  void* data_421030 = android::Choreographer::~Choreographer() 00421038  void* data_421038 = 0x0 00421040  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}