diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-12-02 11:26:07 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-12-02 11:26:07 +0800 |
commit | 9440e4b9fa1c6d76f3c8e11e0887218c9894bf4b (patch) | |
tree | 940d9ee8e703936e48ba43c40d3e3488c54a30f7 /scripts/sortextable.c | |
parent | 4eed929a29a419e367b75ff5e4ab3800d4ce35dd (diff) | |
parent | a5e9874fc9e05e8471bfd58cabd75a3432d38ba6 (diff) |
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-16.12-rt
Diffstat (limited to 'scripts/sortextable.c')
-rw-r--r-- | scripts/sortextable.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/sortextable.c b/scripts/sortextable.c index 1052d4834a44..4dd16a72a2ef 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c @@ -205,6 +205,35 @@ static int compare_relative_table(const void *a, const void *b) return 0; } +static void x86_sort_relative_table(char *extab_image, int image_size) +{ + int i; + + i = 0; + while (i < image_size) { + uint32_t *loc = (uint32_t *)(extab_image + i); + + w(r(loc) + i, loc); + w(r(loc + 1) + i + 4, loc + 1); + w(r(loc + 2) + i + 8, loc + 2); + + i += sizeof(uint32_t) * 3; + } + + qsort(extab_image, image_size / 12, 12, compare_relative_table); + + i = 0; + while (i < image_size) { + uint32_t *loc = (uint32_t *)(extab_image + i); + + w(r(loc) - i, loc); + w(r(loc + 1) - (i + 4), loc + 1); + w(r(loc + 2) - (i + 8), loc + 2); + + i += sizeof(uint32_t) * 3; + } +} + static void sort_relative_table(char *extab_image, int image_size) { int i; @@ -277,6 +306,9 @@ do_file(char const *const fname) break; case EM_386: case EM_X86_64: + custom_sort = x86_sort_relative_table; + break; + case EM_S390: custom_sort = sort_relative_table; break; |