This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: relaxation segv

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:

        jz Z9
        .org (Z2 - Z0 + 4) + .
        .space 0x7e, 0x90

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    

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]