public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Bogus position independent code(PIC) emitted for ColdFire v4e
@ 2002-12-06 10:35 Peter Barada
  2002-12-06 11:38 ` Richard Henderson
  2002-12-06 12:46 ` Peter Barada
  0 siblings, 2 replies; 18+ messages in thread
From: Peter Barada @ 2002-12-06 10:35 UTC (permalink / raw)
  To: gcc; +Cc: Peter.Barada, peter


>Unfortunately ColdFire v4e can't handle the addressing mode of the
>instruction at 0x80000108 since that requires a 32 bit offset.
>I need to modify the compiler to generate PIC code for that
>instruction to look like:
>
>	 move.l  #0x18,%r
>	 move.l  (%a5,%r),%a0
>
>where '%r' is a temporary register.  I've started looking at
>legitimize_pic_address, (gcc/config/m68k/m68k.c) and my eyes starte to
>glaze over.  The leading comment indicates that the "compiler loads
>the address of foo into a register".  Is this legitimize_pic_address,
>or somewhere else that does this (say movsi)?

I started looking at brute-forcing a change in legitimize_pic_address
to force the symbol into the temp register and then adding %a5 on top
of it. This brought me to how the operand is printed.  for m68k if
flag_pic is on, then any reference that includes %a5 has @GOT appended
automatically.  Unfortunatley if I split the symbol off and place it
in a register, I need a way to get '@GOT' added to it in print_operand
I've looked at how i386 does it, and I'm not too keen on introducing
UNSPEC wrappers around the RTX for the symbol(and how much other m68k
specific RTL manitipluation code needs to know about the UNSPEC).  I
looked at the cris port, and saw that it uses ENCODE_SECTION_INFO and
some helper functions to mark the symbol as being in GOT. 

Should I use ENCODE_SECTION_INFO for m68k/ColdFire, or bite the bullet
and go the UNSPEC route?

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Bogus position independent code(PIC) emitted for ColdFire v4e
@ 2002-12-06  8:10 Peter Barada
  2002-12-06  8:15 ` Andreas Schwab
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Barada @ 2002-12-06  8:10 UTC (permalink / raw)
  To: gcc; +Cc: Peter.Barada, peter


I'm in the midst of bringin up a Linux kernel for a ColdFire v4e, and
I've just fallen into the rathole of dealing with PIC code.

Near the beggining of the init process, 'call_gmon_start' is called,
and its code currently looks like:

800000f8 <call_gmon_start>:
800000f8:	4e56 0000      	linkw %fp,#0
800000fc:	2f0d           	movel %a5,%sp@-
800000fe:	2a7c 0005 c830 	moveal #378928,%a5
80000104:	4bfb d8fa      	lea %pc@(80000100 <call_gmon_start+0x8>,%a5:l),%a5
80000108:	2075 0170 0000 	moveal %a5@(00000018),%a0
8000010e:	0018 
80000110:	4a88           	tstl %a0

Unfortunately ColdFire v4e can't handle the addressing mode of the
instruction at 0x80000108 since that requires a 32 bit offset.
I need to modify the compiler to generate PIC code for that
instruction to look like:

	 move.l  #0x18,%r
	 move.l  (%a5,%r),%a0

where '%r' is a temporary register.  I've started looking at
legitimize_pic_address, (gcc/config/m68k/m68k.c) and my eyes starte to
glaze over.  The leading comment indicates that the "compiler loads
the address of foo into a register".  Is this legitimize_pic_address,
or somewhere else that does this (say movsi)?

Could someone explain the comment "If we need more than one register,
we lose."

Where can I find a reference to how dynamic linking/PIC are supposed
to work(the general overview)?

Any suggestions on the best(or any!) way to emit working PIC for
ColdFire v4e would be most appreciated.

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2002-12-12 19:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-06 10:35 Bogus position independent code(PIC) emitted for ColdFire v4e Peter Barada
2002-12-06 11:38 ` Richard Henderson
2002-12-06 11:44   ` Peter Barada
2002-12-06 15:33     ` Richard Henderson
2002-12-06 17:59       ` Peter Barada
2002-12-07 13:35         ` Richard Henderson
2002-12-07 14:51           ` Peter Barada
2002-12-08  1:26             ` Richard Henderson
2002-12-11  6:23               ` Peter Barada
2002-12-09 11:01                 ` Richard Henderson
2002-12-11 23:35   ` Hans-Peter Nilsson
2002-12-12  0:17     ` Richard Henderson
2002-12-12 11:59       ` Hans-Peter Nilsson
2002-12-06 12:46 ` Peter Barada
2002-12-06 15:18   ` Peter Barada
  -- strict thread matches above, loose matches on Subject: below --
2002-12-06  8:10 Peter Barada
2002-12-06  8:15 ` Andreas Schwab
2002-12-06  8:33   ` Peter Barada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).