This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
m68k PIC fixes
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Bernardo Innocenti <bernie at develer dot com>
- Date: Tue, 12 Apr 2005 10:53:47 -0400
- Subject: m68k PIC fixes
I accidentally built an m68k-elf toolchain with --enable-shared the other
day. It doesn't work; building the m68000 multilib, target-libiberty will
fail with an error about using bsr.l on a processor which does not support
it.
This happens because of the code I change in m68k_output_pic_call in the
patch below. Bernardo, you added this - does my change look right to you?
I also enabled multilib versions of crtbegin.o and crtend.o. In a clean
tree, only one copy is built instead of one per multilib, and that copy is
wrong for 68000 / ColdFire, because the assembler generates bsr.l for jbsr:
Disassembly of section .init:
00000000 <.init>:
0: 61ff 0000 0000 bsrl 2 <.init+0x2>
2: R_68K_PC32 .text+0x56
OK? I have only very limited ability to test this. Another change which
would probably be a good idea if anyone actually uses m68k-elf with PIC
would be building libgcc and crtstuff with -fPIC. But I don't want to make
that substantial of a change without a way to test it.
The problem was introduced, I think, between 3.3 and 3.4. Technically that
makes it a regression, but I don't think the 4.0 branch needs this if no one
noticed till now.
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-04-12 Daniel Jacobowitz <dan@codesourcery.com>
* config/m68k/m68k.c (m68k_output_pic_call): Don't use bsr.l for
!TARGET_68020.
* config/m68k/t-m68kelf (EXTRA_PARTS): Remove.
(EXTRA_MULTILIB_PARTS): Set.
Index: gcc/config/m68k/m68k.c
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.146
diff -u -p -r1.146 m68k.c
--- gcc/config/m68k/m68k.c 5 Apr 2005 01:59:57 -0000 1.146
+++ gcc/config/m68k/m68k.c 12 Apr 2005 14:20:10 -0000
@@ -963,7 +963,7 @@ m68k_output_pic_call(rtx dest)
*/
else if (TARGET_PCREL)
out = "bsr.l %o0";
- else if ((flag_pic == 1) || TARGET_68020)
+ else if (TARGET_68020)
#if defined(USE_GAS)
out = "bsr.l %0@PLTPC";
#else
Index: gcc/config/m68k/t-m68kelf
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/config/m68k/t-m68kelf,v
retrieving revision 1.6
diff -u -p -r1.6 t-m68kelf
--- gcc/config/m68k/t-m68kelf 21 Aug 2003 01:03:37 -0000 1.6
+++ gcc/config/m68k/t-m68kelf 12 Apr 2005 14:25:28 -0000
@@ -23,7 +23,6 @@ MULTILIB_EXCEPTIONS = m68000/msoft-float
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
-# from ../t-svr4
-EXTRA_PARTS=crtbegin.o crtend.o
+EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
# no pic for now
#CRTSTUFF_T_CFLAGS=-fpic