This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: relaxation segv
- To: Richard Henderson <rth at redhat dot com>
- Subject: Re: relaxation segv
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Sun, 11 Mar 2001 23:14:28 +1100 (EST)
- cc: binutils at sources dot redhat dot com
On Sun, 11 Mar 2001, Richard Henderson wrote:
> If a relaxation expresion involves differences between symbols
> in a different section, then we need to relax the sections in
> the proper order. Moreover, there can be loops in the dependancy
> graph that require us to re-run relaxation on a section.
It's worse than that, actually. Try this little gem involving only
symbols in one section:
.text
Z0:
jz Z9
Z1:
Z2:
.org (Z2 - Z0 + 4) + .
Z5:
.space 0x7e, 0x90
Z9:
After assembly
orgbug2.o: file format elf32-i386
Disassembly of section .text:
00000000 <Z0>:
0: 0f 84 7e 00 00 00 je 84 <Z9>
00000002 <Z2>:
2: 7e 00 jle 4 <Z2+0x2>
...
00000006 <Z1>:
6: 90 nop
7: 90 nop
[snip]
Note the "interesting" values of Z1 and Z2. Changing the `+ 4' and
`0x7e' to other values results in various other "interesting" behaviour.
I believe all of these problems are due to a fundamentally broken method
of symbol resolution where expressions are involved. One thought I had
about this a long time ago, and never followed up, is to not set
sy_resolved on expression symbols during relaxation. More importantly,
don't set sy_resolved on the components of an expression as it's really
premature setting of sy_resolved that's causing your testcase failure.
Alan Modra
--
Linuxcare