|
27 | 27 | #undef uint_t
|
28 | 28 | #undef _r
|
29 | 29 | #undef etype
|
| 30 | +#undef ehdr_shoff |
| 31 | +#undef ehdr_shentsize |
| 32 | +#undef ehdr_shstrndx |
| 33 | +#undef ehdr_shnum |
30 | 34 |
|
31 | 35 | #ifdef SORTTABLE_64
|
32 | 36 | # define extable_ent_size 16
|
|
39 | 43 | # define uint_t uint64_t
|
40 | 44 | # define _r r8
|
41 | 45 | # define etype e64
|
| 46 | +# define ehdr_shoff ehdr64_shoff |
| 47 | +# define ehdr_shentsize ehdr64_shentsize |
| 48 | +# define ehdr_shstrndx ehdr64_shstrndx |
| 49 | +# define ehdr_shnum ehdr64_shnum |
42 | 50 | #else
|
43 | 51 | # define extable_ent_size 8
|
44 | 52 | # define compare_extable compare_extable_32
|
|
50 | 58 | # define uint_t uint32_t
|
51 | 59 | # define _r r
|
52 | 60 | # define etype e32
|
| 61 | +# define ehdr_shoff ehdr32_shoff |
| 62 | +# define ehdr_shentsize ehdr32_shentsize |
| 63 | +# define ehdr_shstrndx ehdr32_shstrndx |
| 64 | +# define ehdr_shnum ehdr32_shnum |
53 | 65 | #endif
|
54 | 66 |
|
55 | 67 | #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED)
|
@@ -250,16 +262,16 @@ static int do_sort(Elf_Ehdr *ehdr,
|
250 | 262 | unsigned int orc_num_entries = 0;
|
251 | 263 | #endif
|
252 | 264 |
|
253 |
| - shdr_start = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->etype.e_shoff)); |
254 |
| - shentsize = r2(&ehdr->etype.e_shentsize); |
| 265 | + shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr)); |
| 266 | + shentsize = ehdr_shentsize(ehdr); |
255 | 267 |
|
256 |
| - shstrndx = r2(&ehdr->etype.e_shstrndx); |
| 268 | + shstrndx = ehdr_shstrndx(ehdr); |
257 | 269 | if (shstrndx == SHN_XINDEX)
|
258 | 270 | shstrndx = r(&shdr_start->etype.sh_link);
|
259 | 271 | string_sec = get_index(shdr_start, shentsize, shstrndx);
|
260 | 272 | secstrings = (const char *)ehdr + _r(&string_sec->etype.sh_offset);
|
261 | 273 |
|
262 |
| - shnum = r2(&ehdr->etype.e_shnum); |
| 274 | + shnum = ehdr_shnum(ehdr); |
263 | 275 | if (shnum == SHN_UNDEF)
|
264 | 276 | shnum = _r(&shdr_start->etype.sh_size);
|
265 | 277 |
|
|
0 commit comments