]> git.pld-linux.org Git - packages/binutils.git/blame - binutils-mips-relocs.patch
This commit was manufactured by cvs2git to create branch 'AC-branch'.
[packages/binutils.git] / binutils-mips-relocs.patch
CommitLineData
48cc5ecd 1From binutils-return-33437-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com Wed May 05 17:45:08 2004
2Return-Path: <binutils-return-33437-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com>
3Delivered-To: listarch-binutils at sources dot redhat dot com
4Received: (qmail 20913 invoked by alias); 5 May 2004 17:45:08 -0000
5Mailing-List: contact binutils-help at sources dot redhat dot com; run by ezmlm
6Precedence: bulk
7List-Subscribe: <mailto:binutils-subscribe at sources dot redhat dot com>
8List-Archive: <http://sources.redhat.com/ml/binutils/>
9List-Post: <mailto:binutils at sources dot redhat dot com>
10List-Help: <mailto:binutils-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
11Sender: binutils-owner at sources dot redhat dot com
12Delivered-To: mailing list binutils at sources dot redhat dot com
13Received: (qmail 20904 invoked from network); 5 May 2004 17:45:05 -0000
14Received: from unknown (HELO dmz.algor.co.uk) (62.254.210.145)
15 by sources dot redhat dot com with SMTP; 5 May 2004 17:45:05 -0000
16Received: from alg158.algor.co.uk ([62.254.210.158] helo=olympia.mips.com)
17 by dmz dot algor dot co dot uk with esmtp (Exim 3 dot 35 #1 (Debian))
18 id 1BLQgU-0007Tz-00; Wed, 05 May 2004 18:59:54 +0100
19Received: from stockwell.mips.com ([192.168.192.238])
20 by olympia dot mips dot com with esmtp (Exim 3 dot 36 #1 (Debian))
21 id 1BLQRk-0004Mi-00; Wed, 05 May 2004 18:44:40 +0100
22Subject: Re: [mips patch RFC] removal of gas embedded-pic support code
23From: David Ung <davidu at mips dot com>
24To: cgd at broadcom dot com, ica2_ts at csv dot ica dot uni-stuttgart dot de, binutils at sources dot redhat dot com
25Content-Type: text/plain
26Organization: MIPS Technologies UK
27Message-Id: <1083779079.31797.223.camel@stockwell.mips.com>
28Mime-Version: 1.0
29Date: Wed, 05 May 2004 18:44:40 +0100
30Content-Transfer-Encoding: 7bit
31X-MTUK-Scanner: Found to be clean
32X-MTUK-SpamCheck: not spam, SpamAssassin (score=-4.833, required 4, AWL,
33 BAYES_00)
34
35>At Thu, 29 Apr 2004 02:46:46 +0000 (UTC), "Thiemo Seufer" wrote:
36>> I think it is ok.
37>
38>Thanks for looking it over.
39>
40>I've checked it in. I *really* hope it really doesn't break
41>anything. 8-)
42>
43>
44>chris
45
46Chris,
47
48woops. your recent patch seem to have broke building of the compiler on
49linux. The problem occurs when building for libgcc/./_divdi3.o
50
51gas fails with:
52Error: operation combines symbols in different segments
53
54as it is trying to assemble this piece of .s code generated from gcc.
55
56 .section .eh_frame,"aw",@progbits
57$Lframe1:
58 .4byte $LECIE1-$LSCIE1
59$LSCIE1:
60 .4byte 0x0
61 .byte 0x1
62 .ascii "zR\000"
63 .uleb128 0x1
64 .sleb128 4
65 .byte 0x1f
66 .uleb128 0x1
67 .byte 0x1b
68 .byte 0xc
69 .uleb128 0x1d
70 .uleb128 0x0
71 .align 2
72$LECIE1:
73$LSFDE1:
74 .4byte $LEFDE1-$LASFDE1
75$LASFDE1:
76 .4byte $LASFDE1-$Lframe1
77 .4byte $LFB42-. **
78 .4byte $LFE42-$LFB42
79 .uleb128 0x0
80
81** $LFB42 is from the text section of divdi3.
82
83I've reverted back the necessary changes to your patch, so that it now
84works with the above.
85
86David.
87
88
89
90Index: gas/ChangeLog
91===================================================================
92RCS file: /cvsroot/gcc/src-cvs/src/gas/ChangeLog,v
93retrieving revision 1.2114
94diff -u -r1.2114 ChangeLog
95--- gas/ChangeLog 29 Apr 2004 05:14:20 -0000 1.2114
96+++ gas/ChangeLog 5 May 2004 17:38:51 -0000
97@@ -1,0 +1,6 @@
98+2004-05-05 David Ung <davidu@mips.com>
99+
100+ * config/tc-mips.c (md_apply_fix3): Revert last change.
101+ (tc_gen_reloc): Put back pc rel handling.
102+ * config/tc-mips.h: Defines DIFF_EXPR_OK.
103+
104Index: gas/config/tc-mips.c
105===================================================================
106RCS file: /cvsroot/gcc/src-cvs/src/gas/config/tc-mips.c,v
107retrieving revision 1.263
108diff -u -r1.263 tc-mips.c
109--- gas/config/tc-mips.c.orig 2004-11-22 21:33:32.000000000 +0100
110+++ gas/config/tc-mips.c 2004-11-23 23:59:24.000000000 +0100
111@@ -10932,8 +10932,6 @@
112
113 buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where);
114
115- assert (! fixP->fx_pcrel);
116-
117 /* Don't treat parts of a composite relocation as done. There are two
118 reasons for this:
119
120@@ -10944,7 +10942,7 @@
121 constants. The easiest way of dealing with the pathological
122 exceptions is to generate a relocation against STN_UNDEF and
123 leave everything up to the linker. */
124- if (fixP->fx_addsy == NULL && fixP->fx_tcbit == 0)
125+ if (fixP->fx_addsy == NULL && (! fixP->fx_pcrel) && fixP->fx_tcbit == 0)
126 fixP->fx_done = 1;
127
128 switch (fixP->fx_r_type)
129@@ -12800,8 +12798,27 @@
130 *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
131 reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
132
133- assert (! fixp->fx_pcrel);
134- reloc->addend = fixp->fx_addnumber;
135+ if (fixp->fx_pcrel)
136+ {
137+ bfd_vma pcrel_address;
138+
139+ pcrel_address = reloc->address;
140+
141+ if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
142+ {
143+ /* At this point, fx_addnumber is "symbol offset - pcrel_address".
144+ Relocations want only the symbol offset. */
145+ reloc->addend = fixp->fx_addnumber + pcrel_address;
146+ }
147+ else
148+ {
149+ /* A gruesome hack which is a result of the gruesome gas reloc
150+ handling. */
151+ reloc->addend = pcrel_address;
152+ }
153+ }
154+ else
155+ reloc->addend = fixp->fx_addnumber;
156
157 /* Since the old MIPS ELF ABI uses Rel instead of Rela, encode the vtable
158 entry to be used in the relocation's section offset. */
159@@ -12812,6 +12829,34 @@
160 }
161
162 code = fixp->fx_r_type;
163+ if (fixp->fx_pcrel)
164+ {
165+ switch (code)
166+ {
167+ case BFD_RELOC_8:
168+ code = BFD_RELOC_8_PCREL;
169+ break;
170+ case BFD_RELOC_16:
171+ code = BFD_RELOC_16_PCREL;
172+ break;
173+ case BFD_RELOC_32:
174+ code = BFD_RELOC_32_PCREL;
175+ break;
176+ case BFD_RELOC_64:
177+ code = BFD_RELOC_64_PCREL;
178+ break;
179+ case BFD_RELOC_8_PCREL:
180+ case BFD_RELOC_16_PCREL:
181+ case BFD_RELOC_32_PCREL:
182+ case BFD_RELOC_64_PCREL:
183+ case BFD_RELOC_16_PCREL_S2:
184+ break;
185+ default:
186+ as_bad_where (fixp->fx_file, fixp->fx_line,
187+ _("Cannot make %s relocation PC relative"),
188+ bfd_get_reloc_code_name (code));
189+ }
190+ }
191
192 /* To support a PC relative reloc, we used a Cygnus extension.
193 We check for that here to make sure that we don't let such a
194Index: gas/config/tc-mips.h
195===================================================================
196RCS file: /cvsroot/gcc/src-cvs/src/gas/config/tc-mips.h,v
197retrieving revision 1.35
198diff -u -r1.35 tc-mips.h
199--- gas/config/tc-mips.h 29 Apr 2004 05:14:22 -0000 1.35
200+++ gas/config/tc-mips.h 5 May 2004 17:38:51 -0000
201@@ -58,6 +58,10 @@
202
203 #define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
204
205+/* We permit PC relative difference expressions when generating
206+ embedded PIC code. */
207+#define DIFF_EXPR_OK
208+
209 /* Tell assembler that we have an itbl_mips.h header file to include. */
210 #define HAVE_ITBL_CPU
211
This page took 0.062787 seconds and 4 git commands to generate.