FreeCalypso > hg > freecalypso-reveng
annotate objgrep/dumpmatch.c @ 405:f7df0f4d7d4f
tfo/find-is-hdr.c: print found offset in hex
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 18 Mar 2023 05:57:23 +0000 |
parents | 77cd647375e5 |
children |
rev | line source |
---|---|
171
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * objgrep: output on matches |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <stdio.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdint.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <stdlib.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <string.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include <strings.h> |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "intstruct.h" |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "coffconst.h" |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "globals.h" |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 extern unsigned get_u16(), get_u32(); |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 dump_symtab_on_match() |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 { |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 unsigned n; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 struct internal_syment *sym; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 printf("\nThis source section's symbols:\n\n"); |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 for (n = 0; n < nsymtab; n++) { |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 sym = symtab[n]; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 if (!sym) |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 continue; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 if (sym->section != grep_section) |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 continue; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 switch (sym->class) { |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 case C_EXT: |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 printf("%s = %08X\n", sym->name, |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 sym->value + match_offset); |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 continue; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 case C_STAT: |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 printf("%s:%s = %08X\n", objfilename, sym->name, |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 sym->value + match_offset); |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 continue; |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 } |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 } |
ddbfc1a1a811
objgrep: -s implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 } |
172
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
41 |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
42 static unsigned |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
43 arm_branch_reloc(location) |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
44 unsigned location; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
45 { |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
46 unsigned word, dest; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
47 |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
48 word = get_u32(binfilemap + location); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
49 dest = (word & 0x00FFFFFF) << 2; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
50 if (dest & 0x02000000) |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
51 dest |= 0xFC000000; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
52 dest += location + 8; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
53 return(dest); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
54 } |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
55 |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
56 static unsigned |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
57 thumb_bl_reloc(location) |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
58 unsigned location; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
59 { |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
60 unsigned ins1, ins2; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
61 unsigned dest; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
62 |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
63 ins1 = get_u16(binfilemap + location); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
64 ins2 = get_u16(binfilemap + location + 2); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
65 dest = ((ins1 & 0x7FF) << 12) | ((ins2 & 0x7FF) << 1); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
66 if (dest & 0x00400000) |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
67 dest |= 0xFF800000; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
68 dest += location + 4; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
69 return(dest); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
70 } |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
71 |
173
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
72 process_relocs_on_match() |
172
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
73 { |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
74 unsigned n, value; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
75 struct internal_reloc *rel; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
76 |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
77 for (n = 0, rel = relocs; n < grep_section->nreloc; n++, rel++) { |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
78 switch (rel->type) { |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
79 case RTYPE_LONG: |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
80 value = get_u32(binfilemap + match_offset + |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
81 rel->location); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
82 break; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
83 case RTYPE_ARM_B: |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
84 value = arm_branch_reloc(match_offset + rel->location); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
85 break; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
86 case RTYPE_THUMB_BL: |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
87 value = thumb_bl_reloc(match_offset + rel->location); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
88 break; |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
89 default: |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
90 fprintf(stderr, |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
91 "BUG in dump_relocs_on_match(): bad reloc type\n"); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
92 abort(); |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
93 } |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
94 value -= rel->addend; |
173
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
95 rel->symvalue = value; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
96 if (rel->secbase) { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
97 if (!rel->secbase->recov_flag) { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
98 rel->secbase->recov_flag = 1; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
99 rel->secbase->recov_addr = value; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
100 } else if (rel->secbase->recov_addr != value) |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
101 printf("Multiple addresses for %s:%s: %08X, %08X\n", |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
102 objfilename, rel->secbase->name, |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
103 rel->secbase->recov_addr, value); |
172
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
104 } |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
105 } |
452baa748747
objgrep: -r implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
171
diff
changeset
|
106 } |
173
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
107 |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
108 dump_ext_relocs_on_match() |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
109 { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
110 unsigned n; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
111 struct internal_reloc *rel; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
112 |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
113 printf("\nExternals deduced from relocs:\n\n"); |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
114 for (n = 0, rel = relocs; n < grep_section->nreloc; n++, rel++) |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
115 if (rel->extsym) |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
116 printf("%s = %08X\n", rel->extsym->name, rel->symvalue); |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
117 } |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
118 |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
119 dump_reloc_symtab_on_match() |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
120 { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
121 unsigned n; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
122 struct internal_syment *sym; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
123 |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
124 printf("\nThis module's symbols deduced from section relocs:\n\n"); |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
125 for (n = 0; n < nsymtab; n++) { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
126 sym = symtab[n]; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
127 if (!sym || !sym->section) |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
128 continue; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
129 if (!sym->section->recov_flag) |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
130 continue; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
131 switch (sym->class) { |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
132 case C_EXT: |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
133 printf("%s = %08X\n", sym->name, |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
134 sym->value + sym->section->recov_addr); |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
135 continue; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
136 case C_STAT: |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
137 printf("%s:%s = %08X\n", objfilename, sym->name, |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
138 sym->value + sym->section->recov_addr); |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
139 continue; |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
140 } |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
141 } |
77cd647375e5
objgrep -r: dump symbols in other sections recovered through relocs
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
172
diff
changeset
|
142 } |