Fix long lines and replace macros with functions.
Change-Id: I4e1cab488d5b2c8e4289da617350a86e72a4ba12
This commit is contained in:
@@ -21,15 +21,10 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define RELOCATION_GROUPED_BY_INFO_FLAG 1
|
||||
#define RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG 2
|
||||
#define RELOCATION_GROUPED_BY_ADDEND_FLAG 4
|
||||
#define RELOCATION_GROUP_HAS_ADDEND_FLAG 8
|
||||
|
||||
#define RELOCATION_GROUPED_BY_INFO(flags) (((flags) & RELOCATION_GROUPED_BY_INFO_FLAG) != 0)
|
||||
#define RELOCATION_GROUPED_BY_OFFSET_DELTA(flags) (((flags) & RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG) != 0)
|
||||
#define RELOCATION_GROUPED_BY_ADDEND(flags) (((flags) & RELOCATION_GROUPED_BY_ADDEND_FLAG) != 0)
|
||||
#define RELOCATION_GROUP_HAS_ADDEND(flags) (((flags) & RELOCATION_GROUP_HAS_ADDEND_FLAG) != 0)
|
||||
const size_t RELOCATION_GROUPED_BY_INFO_FLAG = 1;
|
||||
const size_t RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG = 2;
|
||||
const size_t RELOCATION_GROUPED_BY_ADDEND_FLAG = 4;
|
||||
const size_t RELOCATION_GROUP_HAS_ADDEND_FLAG = 8;
|
||||
|
||||
class plain_reloc_iterator {
|
||||
#if defined(USE_RELA)
|
||||
@@ -89,18 +84,19 @@ class packed_reloc_iterator {
|
||||
}
|
||||
}
|
||||
|
||||
if (RELOCATION_GROUPED_BY_OFFSET_DELTA(group_flags_)) {
|
||||
if (is_relocation_grouped_by_offset_delta()) {
|
||||
reloc_.r_offset += group_r_offset_delta_;
|
||||
} else {
|
||||
reloc_.r_offset += decoder_.pop_front();
|
||||
}
|
||||
|
||||
if (!RELOCATION_GROUPED_BY_INFO(group_flags_)) {
|
||||
if (!is_relocation_grouped_by_info()) {
|
||||
reloc_.r_info = decoder_.pop_front();
|
||||
}
|
||||
|
||||
#if defined(USE_RELA)
|
||||
if (RELOCATION_GROUP_HAS_ADDEND(group_flags_) && !RELOCATION_GROUPED_BY_ADDEND(group_flags_)) {
|
||||
if (is_relocation_group_has_addend() &&
|
||||
!is_relocation_grouped_by_addend()) {
|
||||
reloc_.r_addend += decoder_.pop_front();
|
||||
}
|
||||
#endif
|
||||
@@ -115,22 +111,23 @@ class packed_reloc_iterator {
|
||||
group_size_ = decoder_.pop_front();
|
||||
group_flags_ = decoder_.pop_front();
|
||||
|
||||
if (RELOCATION_GROUPED_BY_OFFSET_DELTA(group_flags_)) {
|
||||
if (is_relocation_grouped_by_offset_delta()) {
|
||||
group_r_offset_delta_ = decoder_.pop_front();
|
||||
}
|
||||
|
||||
if (RELOCATION_GROUPED_BY_INFO(group_flags_)) {
|
||||
if (is_relocation_grouped_by_info()) {
|
||||
reloc_.r_info = decoder_.pop_front();
|
||||
}
|
||||
|
||||
if (RELOCATION_GROUP_HAS_ADDEND(group_flags_) && RELOCATION_GROUPED_BY_ADDEND(group_flags_)) {
|
||||
if (is_relocation_group_has_addend() &&
|
||||
is_relocation_grouped_by_addend()) {
|
||||
#if !defined(USE_RELA)
|
||||
// This platform does not support rela, and yet we have it encoded in android_rel section.
|
||||
DL_ERR("unexpected r_addend in android.rel section");
|
||||
return false;
|
||||
#else
|
||||
reloc_.r_addend += decoder_.pop_front();
|
||||
} else if (!RELOCATION_GROUP_HAS_ADDEND(group_flags_)) {
|
||||
} else if (!is_relocation_group_has_addend()) {
|
||||
reloc_.r_addend = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -139,6 +136,22 @@ class packed_reloc_iterator {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_relocation_grouped_by_info() {
|
||||
return (group_flags_ & RELOCATION_GROUPED_BY_INFO_FLAG) != 0;
|
||||
}
|
||||
|
||||
bool is_relocation_grouped_by_offset_delta() {
|
||||
return (group_flags_ & RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG) != 0;
|
||||
}
|
||||
|
||||
bool is_relocation_grouped_by_addend() {
|
||||
return (group_flags_ & RELOCATION_GROUPED_BY_ADDEND_FLAG) != 0;
|
||||
}
|
||||
|
||||
bool is_relocation_group_has_addend() {
|
||||
return (group_flags_ & RELOCATION_GROUP_HAS_ADDEND_FLAG) != 0;
|
||||
}
|
||||
|
||||
decoder_t decoder_;
|
||||
size_t relocation_count_;
|
||||
size_t group_size_;
|
||||
|
||||
Reference in New Issue
Block a user