diff options
Diffstat (limited to 'meta/packages/binutils/files/objdump_fix.patch')
-rw-r--r-- | meta/packages/binutils/files/objdump_fix.patch | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/meta/packages/binutils/files/objdump_fix.patch b/meta/packages/binutils/files/objdump_fix.patch new file mode 100644 index 0000000000..90ad732c06 --- /dev/null +++ b/meta/packages/binutils/files/objdump_fix.patch | |||
@@ -0,0 +1,134 @@ | |||
1 | From binutils-return-38148-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com Tue Feb 22 19:24:15 2005 | ||
2 | Return-Path: <binutils-return-38148-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com> | ||
3 | Delivered-To: listarch-binutils at sources dot redhat dot com | ||
4 | Received: (qmail 4446 invoked by alias); 22 Feb 2005 19:24:15 -0000 | ||
5 | Mailing-List: contact binutils-help at sources dot redhat dot com; run by ezmlm | ||
6 | Precedence: bulk | ||
7 | List-Subscribe: <mailto:binutils-subscribe at sources dot redhat dot com> | ||
8 | List-Archive: <http://sources.redhat.com/ml/binutils/> | ||
9 | List-Post: <mailto:binutils at sources dot redhat dot com> | ||
10 | List-Help: <mailto:binutils-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs> | ||
11 | Sender: binutils-owner at sources dot redhat dot com | ||
12 | Delivered-To: mailing list binutils at sources dot redhat dot com | ||
13 | Received: (qmail 4401 invoked from network); 22 Feb 2005 19:24:08 -0000 | ||
14 | Received: from unknown (HELO bgo1smout1.broadpark.no) (217.13.4.94) | ||
15 | by sourceware dot org with SMTP; 22 Feb 2005 19:24:08 -0000 | ||
16 | Received: from bgo1sminn1.broadpark.no ([217.13.4.93]) | ||
17 | by bgo1smout1 dot broadpark dot no | ||
18 | (Sun Java System Messaging Server 6 dot 1 HotFix 0 dot 05 (built Oct 21 2004)) | ||
19 | with ESMTP id <0ICB007QZUZCC0C0 at bgo1smout1 dot broadpark dot no> for | ||
20 | binutils at sources dot redhat dot com; Tue, 22 Feb 2005 20:18:48 +0100 (CET) | ||
21 | Received: from [127.0.0.1] ([80.202.165.9]) by bgo1sminn1.broadpark.no | ||
22 | (Sun Java System Messaging Server 6 dot 1 HotFix 0 dot 05 (built Oct 21 2004)) | ||
23 | with ESMTP id <0ICB006NCVBVHE21 at bgo1sminn1 dot broadpark dot no> for | ||
24 | binutils at sources dot redhat dot com; Tue, 22 Feb 2005 20:26:20 +0100 (CET) | ||
25 | Date: Tue, 22 Feb 2005 20:24:08 +0100 | ||
26 | From: =?ISO-8859-1?Q?Stig_Petter_Olsr=F8d?= <stigpo at users dot sourceforge dot net> | ||
27 | Subject: [PATCH] objdump relocation fixes for ARM disassembly | ||
28 | To: binutils at sources dot redhat dot com | ||
29 | Message-id: <421B86D8.8080604@users.sourceforge.net> | ||
30 | MIME-version: 1.0 | ||
31 | Content-type: text/plain; charset=ISO-8859-1; format=flowed | ||
32 | Content-transfer-encoding: 7BIT | ||
33 | User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) | ||
34 | |||
35 | Hello, | ||
36 | |||
37 | objdump disassembly did not relocate correctly for the ARM processor. It seems | ||
38 | that the test for triggering the INSN_HAS_RELOC flag was void (one test killed the other, | ||
39 | since octets would always be zero) and all relocations would thus fail. I changed the test | ||
40 | so the flag is set when we are about to disassemble an insn that the current relocation | ||
41 | entry points to. I also changed objdump_print_addr to use the current relocation entry if | ||
42 | the insn has such an entry. This causes the symbol printed to be correct for both external | ||
43 | symbols (from the undefined section) and local symbols. | ||
44 | |||
45 | This has only been tested for the ARM processor, but I don't think it should break other | ||
46 | DISASSEMBLER_NEEDS_RELOCS processors either. | ||
47 | |||
48 | |||
49 | binutils/ | ||
50 | |||
51 | 2005-02-22 Stig Petter Olsroed <stigpo@users.sourceforge.net> | ||
52 | |||
53 | * objdump.c (disassemble_bytes): Fixed relocation check for | ||
54 | DISASSEMBLER_NEEDS_RELOCS platforms to properly trigger the | ||
55 | INSN_HAS_RELOC flag. Set the current relocation entry in | ||
56 | objdump_disasm_info to allow printing the proper symbol. | ||
57 | (objdump_print_addr): Use the relocation entry in | ||
58 | objdump_disasm_info to lookup the correct symbol for | ||
59 | DISASSEMBLER_NEEDS_RELOCS platforms. | ||
60 | |||
61 | --- 1/binutils/objdump.c 2005-02-22 01:50:06.000000000 +0100 | ||
62 | +++ 2/binutils/objdump.c 2005-02-22 14:27:33.066960900 +0100 | ||
63 | @@ -128,6 +128,7 @@ | ||
64 | arelent ** dynrelbuf; | ||
65 | long dynrelcount; | ||
66 | disassembler_ftype disassemble_fn; | ||
67 | + arelent * reloc; | ||
68 | }; | ||
69 | |||
70 | /* Architecture to disassemble for, or default if NULL. */ | ||
71 | @@ -852,6 +853,8 @@ | ||
72 | { | ||
73 | struct objdump_disasm_info *aux; | ||
74 | asymbol *sym; | ||
75 | + arelent *q; | ||
76 | + int skip_find = 0; | ||
77 | |||
78 | if (sorted_symcount < 1) | ||
79 | { | ||
80 | @@ -861,6 +864,22 @@ | ||
81 | } | ||
82 | |||
83 | aux = (struct objdump_disasm_info *) info->application_data; | ||
84 | + | ||
85 | + q = aux->reloc; | ||
86 | + if (q != NULL) | ||
87 | + { | ||
88 | + if (q->sym_ptr_ptr != NULL && *q->sym_ptr_ptr != NULL) | ||
89 | + { | ||
90 | + /* Adjust the vma to the reloc */ | ||
91 | + vma += bfd_asymbol_value (*q->sym_ptr_ptr); | ||
92 | + if (bfd_is_und_section (bfd_get_section (*q->sym_ptr_ptr))) | ||
93 | + { | ||
94 | + skip_find = 1; | ||
95 | + sym = *q->sym_ptr_ptr; | ||
96 | + } | ||
97 | + } | ||
98 | + } | ||
99 | + if (!skip_find) | ||
100 | sym = find_symbol_for_address (vma, info, NULL); | ||
101 | objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, | ||
102 | skip_zeroes); | ||
103 | @@ -1350,16 +1369,22 @@ | ||
104 | info->bytes_per_chunk = 0; | ||
105 | |||
106 | #ifdef DISASSEMBLER_NEEDS_RELOCS | ||
107 | - /* FIXME: This is wrong. It tests the number of octets | ||
108 | - in the last instruction, not the current one. */ | ||
109 | - if (*relppp < relppend | ||
110 | - && (**relppp)->address >= rel_offset + addr_offset | ||
111 | - && ((**relppp)->address | ||
112 | - < rel_offset + addr_offset + octets / opb)) | ||
113 | + /* Check if the current relocation entry applies to the | ||
114 | + instruction we are about to disassemble. | ||
115 | + This works for ARM at least. | ||
116 | + */ | ||
117 | + if ((*relppp) < relppend | ||
118 | + && ((**relppp)->address == rel_offset + addr_offset)) | ||
119 | + { | ||
120 | info->flags = INSN_HAS_RELOC; | ||
121 | + aux->reloc = **relppp; | ||
122 | + } | ||
123 | else | ||
124 | #endif | ||
125 | + { | ||
126 | info->flags = 0; | ||
127 | + aux->reloc = NULL; | ||
128 | + } | ||
129 | |||
130 | octets = (*disassemble_fn) (section->vma + addr_offset, info); | ||
131 | info->fprintf_func = (fprintf_ftype) fprintf; | ||
132 | |||
133 | |||
134 | |||