summaryrefslogtreecommitdiff
path: root/scripts/sorttable.c
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2022-01-05 19:14:31 -0800
committerPalmer Dabbelt <palmer@rivosinc.com>2022-01-05 19:15:10 -0800
commit1f77ed9422cbc41e1a5d17654b7e527a4a23b665 (patch)
tree7a54ac220f5f6a1d7591539e68d736e64010b2c5 /scripts/sorttable.c
parentdacef016c088f8f69fe1e6e5feab3543df3dab83 (diff)
parenta2ceb8c4efce97a9392084f45c072b0ec8e36701 (diff)
downloadlinux-1f77ed9422cbc41e1a5d17654b7e527a4a23b665.tar.gz
linux-1f77ed9422cbc41e1a5d17654b7e527a4a23b665.tar.bz2
linux-1f77ed9422cbc41e1a5d17654b7e527a4a23b665.zip
riscv: switch to relative extable and other improvements
Similar as other architectures such as arm64, x86 and so on, use offsets relative to the exception table entry values rather than absolute addresses for both the exception locationand the fixup. And recently, arm64 and x86 remove anonymous out-of-line fixups, we want to acchieve the same result.
Diffstat (limited to 'scripts/sorttable.c')
-rw-r--r--scripts/sorttable.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index b7c2ad71f9cf..82b162b3941b 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -231,7 +231,7 @@ static void sort_relative_table(char *extab_image, int image_size)
}
}
-static void arm64_sort_relative_table(char *extab_image, int image_size)
+static void sort_relative_table_with_data(char *extab_image, int image_size)
{
int i = 0;
@@ -259,34 +259,6 @@ static void arm64_sort_relative_table(char *extab_image, int image_size)
}
}
-static void x86_sort_relative_table(char *extab_image, int image_size)
-{
- int 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);
- /* Don't touch the fixup type */
-
- 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);
- /* Don't touch the fixup type */
-
- i += sizeof(uint32_t) * 3;
- }
-}
-
static void s390_sort_relative_table(char *extab_image, int image_size)
{
int i;
@@ -364,15 +336,14 @@ static int do_file(char const *const fname, void *addr)
switch (r2(&ehdr->e_machine)) {
case EM_386:
+ case EM_AARCH64:
+ case EM_RISCV:
case EM_X86_64:
- custom_sort = x86_sort_relative_table;
+ custom_sort = sort_relative_table_with_data;
break;
case EM_S390:
custom_sort = s390_sort_relative_table;
break;
- case EM_AARCH64:
- custom_sort = arm64_sort_relative_table;
- break;
case EM_PARISC:
case EM_PPC:
case EM_PPC64:
@@ -383,7 +354,6 @@ static int do_file(char const *const fname, void *addr)
case EM_ARM:
case EM_MICROBLAZE:
case EM_MIPS:
- case EM_RISCV:
case EM_XTENSA:
break;
default: