comparison ticoff/reloc.c @ 82:c20dc315a9d4

tiobjd: beginning of reloc handling
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 26 Mar 2014 06:00:07 +0000
parents
children e650fdc743fe
comparison
equal deleted inserted replaced
81:192da19c7506 82:c20dc315a9d4
1 /*
2 * Handling of relocation records
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include "filestruct.h"
9 #include "intstruct.h"
10 #include "globals.h"
11
12 extern unsigned get_u16(), get_u32();
13
14 cmd_rawrel()
15 {
16 unsigned n, m;
17 struct internal_scnhdr *sec;
18 struct external_reloc *rel;
19
20 get_int_section_table();
21 for (n = 0; n < nsections; n++) {
22 sec = sections + n;
23 if (!sec->nreloc)
24 continue;
25 printf("%s:\n\n", sec->name);
26 rel = (struct external_reloc *)(filemap + sec->reloc_offset);
27 printf("Location SymIndex Rsvd Type\n");
28 for (m = 0; m < sec->nreloc; m++, rel++)
29 printf("%08X %08X %04X %04X\n",
30 get_u32(rel->r_vaddr), get_u32(rel->r_symndx),
31 get_u16(rel->r_reserved), get_u16(rel->r_type));
32 putchar('\n');
33 }
34 exit(0);
35 }