This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bogus position independent code(PIC) emitted for ColdFire v4e
My my attempt to understand how INDIRECTABLE_1_ADRESS_P is affected
for PIC, I made the following change to m68k.h:
#if 1
#define INDIRECTABLE_1_ADDRESS_P(X) m68k_indirectable_1_address_p(X)
#else
#define INDIRECTABLE_1_ADDRESS_P(X) \
((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
|| LEGITIMATE_BASE_REG_P (X) \
|| ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
&& LEGITIMATE_BASE_REG_P (XEXP (X, 0))) \
|| (GET_CODE (X) == PLUS \
&& LEGITIMATE_BASE_REG_P (XEXP (X, 0)) \
&& GET_CODE (XEXP (X, 1)) == CONST_INT \
&& (TARGET_68020 \
|| ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)) \
|| (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
&& flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF) \
|| (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
&& flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF))
#endif
And added the following function to m68k.c:
int m68k_indirectable_1_address_p(X)
rtx X;
{
if ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X)))
|| (LEGITIMATE_BASE_REG_P (X))
|| ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)
&& LEGITIMATE_BASE_REG_P (XEXP (X, 0)))
|| (GET_CODE (X) == PLUS
&& LEGITIMATE_BASE_REG_P (XEXP (X, 0))
&& GET_CODE (XEXP (X, 1)) == CONST_INT
&& (TARGET_68020
|| ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))
|| (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx
&& flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)
|| (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx
&& flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF))
return !0;
return 0;
}
As well as the appropriate prototype to m68k-protos.h:
extern int m68k_indirectable_1_address_p PARAMS ((rtx));
And configured with:
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/configure --with-gcc-version-trigger=/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/version.c --host=i686-pc-linux-gnu --target=m68k-linux --prefix=/home/mylocal/cf-linux --enable-languages=c --with-local-prefix=/home/mylocal/cf-linux/m68k-linux --without-headers --with-newlib --disable-shared --disable-threads --verbose
It blew up while building with:
/home/pbarada/work/cvs-wavemark/cross-linux-tools/obj/cf-linux/m68k-linux/gcc-bootstrap/gcc/xgcc -B/home/pbarada/work/cvs-wavemark/cross-linux-tools/obj/cf-linux/m68k-linux/gcc-bootstrap/gcc/ -B/home/mylocal/cf-linux/m68k-linux/bin/ -B/home/mylocal/cf-linux/m68k-linux/lib/ -isystem /home/mylocal/cf-linux/m68k-linux/include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -fPIC -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc -I/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/. -I/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/config -I/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/../include -fexceptions -c /home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde-glibc.c -o libgcc/./unwind-dw2-fde-glibc.o
In file included from /home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde-glibc.c:47:
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-pe.h: In function `size_of_encoded_value':
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-pe.h:76: warning: implicit declaration of function `abort'
In file included from /home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde-glibc.c:298:
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde.c: In function `get_cie_encoding':
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde.c:271: warning: implicit declaration of function `strlen'
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde.c: In function `init_object':
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde.c:924: unrecognizable insn:
(insn 839 501 503 (set (reg:SI 0 %d0)
(mem/s:SI (plus:SI (mem:SI (plus:SI (reg/f:SI 14 %a6)
(const_int -20 [0xffffffec])) [33 v2 S4 A8])
(const_int 4 [0x4])) [4 <variable>.count+0 S4 A16])) -1 (nil)
(nil))
/home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.2/gcc/unwind-dw2-fde.c:924: Internal compiler error in extract_insn, at recog.c:2148
Please submit a full bug report,
I'm *really* confused here. I can't see how converting a macro into a
function can cause this type of failure. If I put
INDIRECTABLE_1_ADDRESS_P back as a macro, then everthing
builds. Really weird.
I'm using:
[pbarada: ~/work/cvs-wavemark/cross-linux-tools/obj/cf-linux/m68k-linux/gcc-bootstrap] > gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
To build the cross compiler. Are there known bugs in RedHat's 2.96?
I'm attempting to build gcc-3.2.1 and will then try this experiment
again.
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)