This is the mail archive of the binutils@sources.redhat.com 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]
Other format: [Raw text]

Re: [Gcl-devel] Re: BFD relocations


On Tue, Jun 04, 2002 at 06:06:18PM -0400, Camm Maguire wrote:
> Greetings!
> 
> Daniel Jacobowitz <drow@mvista.com> writes:
> 
> > On Tue, Jun 04, 2002 at 05:33:57PM -0400, Camm Maguire wrote:
> > > Greetings. and thank you again for your reply!
> > > 
> > > In brief, I can relocate, but I get SIGILL on apparently correctly
> > > relocated code when trying to execute.
> > > 
> > > I would be very appreciative if you might save me the pain of
> > > searching through the kernel sources and brief me on what raises
> > > SIGILL on ppc.  I'm already aware of divide by zero, and of course an
> > > unknown opcode, but neither seems to be the case here.  Alignment?
> > 
> > Cache.  Are you explicitly flushing the data and instruction caches
> > over the entire loaded range?  If not, you absolutely should try that.
> > 
> 
> Thanks for this suggestion!  I'm afraid I'm a neophyte wrt cache
> flushing.  Is there a specific assembly instruction I should add, or
> do I flush via a read through the .text and .(s)data sections, or a
> copy to some distant memory? 

You need to do a dcbst (and an icbi for safety) on every cache line. 
That's every 32 bytes on a mainstream PPC processor (16 on the 8xx's
and 64 on the POWER4s).  Like:
  asm ("dcbst 0,%0\n\tsync\n\ticbi 0,%0\n\tsync\n\tisync"
	: : "r" (ptr) : "memory");
That's more paranoid than you need to be, I think, but should work.

> 
> Thanks again!
> 
> > > Detail:
> > > 
> > > gcl builds fine on ppc with bfd relocations, including gcl-tk.  When
> > > building maxima-5.6 with it, which involves loading several object
> > > files, I've gotten SIGILL in the following two places when executing
> > > code from kclmac.o:
> > > 
> > > objdump -d kclmac.o |head -40l
> > > 
> > > kclmac.o:     file format elf32-powerpc
> > > 
> > > Disassembly of section .text:
> > > 
> > > 00000000 <init_kclmac>:
> > > ->   0:	94 21 ff f0 	stwu	r1,-16(r1)
> > >    4:	7c 08 02 a6 	mflr	r0
> > >    8:	90 01 00 14 	stw	r0,20(r1)
> > >    c:	3c 60 00 00 	lis	r3,0
> > >   10:	38 63 00 00 	addi	r3,r3,0
> > >   14:	4c c6 31 82 	crclr	4*cr1+eq
> > >   18:	48 00 00 01 	bl	18 <init_kclmac+0x18>
> > >   1c:	80 01 00 14 	lwz	r0,20(r1)
> > > ->  20:	7c 08 03 a6 	mtlr	r0
> > >   24:	38 21 00 10 	addi	r1,r1,16
> > >   28:	4e 80 00 20 	blr
> > > 
> > > 0000002c <L1>:
> > >   2c:	94 21 ff e0 	stwu	r1,-32(r1)
> > >   30:	7c 08 02 a6 	mflr	r0
> > 
> > Those two spots are both apparently undistinguished, and 32 bytes
> > apart.  Coincidence?  I think not.
> > 
> > 
> > -- 
> > Daniel Jacobowitz                           Carnegie Mellon University
> > MontaVista Software                         Debian GNU/Linux Developer
> > 
> > 
> 
> -- 
> Camm Maguire			     			camm@enhanced.com
> ==========================================================================
> "The earth is but one country, and mankind its citizens."  --  Baha'u'llah
> 

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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