sorttable.c (60dd57c7479418e2bc902143eb46a2fdcfeecbbb) sorttable.c (d6e2cc56477538255160ed02fdb11b0da60356cc)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * sorttable.c: Sort the kernel's table
4 *
5 * Added ORC unwind tables sort support and other updates:
6 * Copyright (C) 1999-2019 Alibaba Group Holding Limited. by:
7 * Shile Zhang <shile.zhang@linux.alibaba.com>
8 *

--- 217 unchanged lines hidden (view full) ---

226 i = 0;
227 while (i < image_size) {
228 uint32_t *loc = (uint32_t *)(extab_image + i);
229 w(r(loc) - i, loc);
230 i += 4;
231 }
232}
233
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * sorttable.c: Sort the kernel's table
4 *
5 * Added ORC unwind tables sort support and other updates:
6 * Copyright (C) 1999-2019 Alibaba Group Holding Limited. by:
7 * Shile Zhang <shile.zhang@linux.alibaba.com>
8 *

--- 217 unchanged lines hidden (view full) ---

226 i = 0;
227 while (i < image_size) {
228 uint32_t *loc = (uint32_t *)(extab_image + i);
229 w(r(loc) - i, loc);
230 i += 4;
231 }
232}
233
234static void arm64_sort_relative_table(char *extab_image, int image_size)
235{
236 int i = 0;
237
238 while (i < image_size) {
239 uint32_t *loc = (uint32_t *)(extab_image + i);
240
241 w(r(loc) + i, loc);
242 w(r(loc + 1) + i + 4, loc + 1);
243 /* Don't touch the fixup type or data */
244
245 i += sizeof(uint32_t) * 3;
246 }
247
248 qsort(extab_image, image_size / 12, 12, compare_relative_table);
249
250 i = 0;
251 while (i < image_size) {
252 uint32_t *loc = (uint32_t *)(extab_image + i);
253
254 w(r(loc) - i, loc);
255 w(r(loc + 1) - (i + 4), loc + 1);
256 /* Don't touch the fixup type or data */
257
258 i += sizeof(uint32_t) * 3;
259 }
260}
261
234static void x86_sort_relative_table(char *extab_image, int image_size)
235{
236 int i = 0;
237
238 while (i < image_size) {
239 uint32_t *loc = (uint32_t *)(extab_image + i);
240
241 w(r(loc) + i, loc);

--- 96 unchanged lines hidden (view full) ---

338 case EM_386:
339 case EM_X86_64:
340 custom_sort = x86_sort_relative_table;
341 break;
342 case EM_S390:
343 custom_sort = s390_sort_relative_table;
344 break;
345 case EM_AARCH64:
262static void x86_sort_relative_table(char *extab_image, int image_size)
263{
264 int i = 0;
265
266 while (i < image_size) {
267 uint32_t *loc = (uint32_t *)(extab_image + i);
268
269 w(r(loc) + i, loc);

--- 96 unchanged lines hidden (view full) ---

366 case EM_386:
367 case EM_X86_64:
368 custom_sort = x86_sort_relative_table;
369 break;
370 case EM_S390:
371 custom_sort = s390_sort_relative_table;
372 break;
373 case EM_AARCH64:
374 custom_sort = arm64_sort_relative_table;
375 break;
346 case EM_PARISC:
347 case EM_PPC:
348 case EM_PPC64:
349 custom_sort = sort_relative_table;
350 break;
351 case EM_ARCOMPACT:
352 case EM_ARCV2:
353 case EM_ARM:

--- 70 unchanged lines hidden ---
376 case EM_PARISC:
377 case EM_PPC:
378 case EM_PPC64:
379 custom_sort = sort_relative_table;
380 break;
381 case EM_ARCOMPACT:
382 case EM_ARCV2:
383 case EM_ARM:

--- 70 unchanged lines hidden ---