m68k patches
Hi,
Here are a few patches, which hopefully get us a big step closer to a
working compiler on m68k. There are only lightly tested (i.e. verified
they fix problem via cross compiler). I'm currently building a reduced
package with it (e.g. java has to wait...) and then I'll see what's left.
The gc patch is needed to get garbage collection working with
multithreaded apps, this one I tested separately with the libgc package,
where it finally passes the selftest.
The save_pic patch is needed to get any nontrivial exceptions working,
e.g. the gmp self test fails due to this, but I have to wait for the new
compiler for a final confirmation.
bye, Roman
#! /bin/sh -e
# All lines beginning with `# DPATCH:' are a description of the patch.
# DP: the thread suspend handler has to save all registers
# DP: reenable MPROTECT_VDB, it should work, otherwise it's probably a kernel bug
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# append the patch here and adjust the -p? flag in the patch calls.
---
boehm-gc/include/private/gcconfig.h | 2 +-
boehm-gc/pthread_stop_world.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: egcs/boehm-gc/include/private/gcconfig.h
===================================================================
--- egcs.orig/boehm-gc/include/private/gcconfig.h
+++ egcs/boehm-gc/include/private/gcconfig.h
@@ -668,7 +668,7 @@
# define USE_GENERIC_PUSH_REGS
# define USE_MMAP
/* We never got around to the assembly version. */
-/* # define MPROTECT_VDB - Reported to not work 9/17/01 */
+# define MPROTECT_VDB
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
Index: egcs/boehm-gc/pthread_stop_world.c
===================================================================
--- egcs.orig/boehm-gc/pthread_stop_world.c
+++ egcs/boehm-gc/pthread_stop_world.c
@@ -124,7 +124,7 @@ sem_t GC_suspend_ack_sem;
void GC_suspend_handler_inner(ptr_t sig_arg);
-#if defined(IA64) || defined(HP_PA)
+#if defined(IA64) || defined(HP_PA) || defined(M68K)
extern void GC_with_callee_saves_pushed();
void GC_suspend_handler(int sig)
#! /bin/sh -e
# All lines beginning with `# DPATCH:' are a description of the patch.
# DP: always use as fjcc pseudo op, we rely heavily on as
# DP: to generate the right size for the jump instructions
# DP: fixes #359281
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# append the patch here and adjust the -p? flag in the patch calls.
---
gcc/config/m68k/m68k.md | 92 ++++++++++++++----------------------------------
1 file changed, 28 insertions(+), 64 deletions(-)
Index: egcs/gcc/config/m68k/m68k.md
===================================================================
--- egcs.orig/gcc/config/m68k/m68k.md
+++ egcs/gcc/config/m68k/m68k.md
@@ -5782,10 +5782,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
- else
- OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
+ OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
})
(define_insn "bne"
@@ -5796,10 +5793,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
- else
- OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
+ OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
})
(define_insn "bgt"
@@ -5810,10 +5804,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbgt %l0", "fbgt %l0", 0);
- else
- OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
+ OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
})
(define_insn "bgtu"
@@ -5835,10 +5826,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jblt %l0", "fblt %l0", "jbmi %l0");
- else
- OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
+ OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
})
(define_insn "bltu"
@@ -5860,10 +5848,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbge %l0", "fbge %l0", "jbpl %l0");
- else
- OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
+ OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
})
(define_insn "bgeu"
@@ -5885,10 +5870,7 @@
(pc)))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jble %l0", "fble %l0", 0);
- else
- OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
+ OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
})
(define_insn "bleu"
@@ -5910,7 +5892,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbor %l0" : "fjor %l0";
+ return "fjor %l0";
})
(define_insn "bunordered"
@@ -5921,7 +5903,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbun %l0" : "fjun %l0";
+ return "fjun %l0";
})
(define_insn "buneq"
@@ -5932,7 +5914,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
+ return "fjueq %l0";
})
(define_insn "bunge"
@@ -5943,7 +5925,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
+ return "fjuge %l0";
})
(define_insn "bungt"
@@ -5954,7 +5936,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
+ return "fjugt %l0";
})
(define_insn "bunle"
@@ -5965,7 +5947,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbule %l0" : "fjule %l0";
+ return "fjule %l0";
})
(define_insn "bunlt"
@@ -5976,7 +5958,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbult %l0" : "fjult %l0";
+ return "fjult %l0";
})
(define_insn "bltgt"
@@ -5987,7 +5969,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
+ return "fjogl %l0";
})
;; Negated conditional jump instructions.
@@ -6000,10 +5982,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
- else
- OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
+ OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
})
(define_insn ""
@@ -6014,10 +5993,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
- else
- OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
+ OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
})
(define_insn ""
@@ -6028,10 +6004,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jble %l0", "fbngt %l0", 0);
- else
- OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
+ OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
})
(define_insn ""
@@ -6053,10 +6026,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbge %l0", "fbnlt %l0", "jbpl %l0");
- else
- OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
+ OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
})
(define_insn ""
@@ -6078,10 +6048,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jblt %l0", "fbnge %l0", "jbmi %l0");
- else
- OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
+ OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
})
(define_insn ""
@@ -6103,10 +6070,7 @@
(label_ref (match_operand 0 "" ""))))]
""
{
- if (MOTOROLA)
- OUTPUT_JUMP ("jbgt %l0", "fbnle %l0", 0);
- else
- OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
+ OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
})
(define_insn ""
@@ -6128,7 +6092,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbun %l0" : "fjun %l0";
+ return "fjun %l0";
})
(define_insn "*bunordered_rev"
@@ -6139,7 +6103,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbor %l0" : "fjor %l0";
+ return "fjor %l0";
})
(define_insn "*buneq_rev"
@@ -6150,7 +6114,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
+ return "fjogl %l0";
})
(define_insn "*bunge_rev"
@@ -6161,7 +6125,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
+ return "fjolt %l0";
})
(define_insn "*bunle_rev"
@@ -6172,7 +6136,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
+ return "fjogt %l0";
})
(define_insn "*bunlt_rev"
@@ -6183,7 +6147,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fboge %l0" : "fjoge %l0";
+ return "fjoge %l0";
})
(define_insn "*bltgt_rev"
@@ -6194,7 +6158,7 @@
"TARGET_68881"
{
gcc_assert (cc_prev_status.flags & CC_IN_68881);
- return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
+ return "fjueq %l0";
})
;; Unconditional and other jump instructions
#! /bin/sh -e
# All lines beginning with `# DPATCH:' are a description of the patch.
# DP: correctly save the pic register, when not done by reload()
# DP: (fixes _Unwind_RaiseException and thus exception handling)
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# append the patch here and adjust the -p? flag in the patch calls.
Index: egcs/gcc/config/m68k/m68k.c
===================================================================
--- egcs.orig/gcc/config/m68k/m68k.c 2006-08-05 04:42:49.000000000 +0200
+++ egcs/gcc/config/m68k/m68k.c 2006-08-05 04:21:21.000000000 +0200
@@ -472,7 +472,8 @@ m68k_save_reg (unsigned int regno, bool
{
if (flag_pic && regno == PIC_OFFSET_TABLE_REGNUM)
{
- if (current_function_uses_pic_offset_table)
+ if (current_function_uses_pic_offset_table ||
+ current_function_has_nonlocal_label)
return true;
if (!current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)
return true;
Reply to: