Subject: gcc 3.3.1 fixes
To: None <tech-toolchain@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sh3
Date: 07/30/2003 14:38:49
--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi, folks.
I'm trying to build hpcsh with the new gcc 3.3.1. Can someone please
review the changes I had to do. Some comments:
1. NO_PROFILE_COUNTERS - not tested it yet (will launch a test build in
a minute). Currently gcc generates -pg code like:
main:
.data
.align 2
.LP4:
.long 0
.text
mov.l .LP4,r1
mova .LP4r,r0
jmp @r1
nop
.align 2
.LP4: .long __mcount
.LP4r:
where the first .LP4 is emitted for the profile counter (that's
what NO_PROFILE_COUNTERS turns off), and the second one - by the
code in gcc/gcc/config/sh/netbsd-elf.h
2. const in ASM_OUTPUT_LABELREF - w/out it the build dies with
"discard qualifiers" warning/error.
3. the rest is the RETURN_ADDR_RTX changes (done after alpha and mmix).
The problem is that get_hard_reg_initial_val() is not declared
where RETURN_ADDR_RTX is used, resulting in pointer/integer type
mismatch in conditional expression.
I've almost successfully completed the hpcsh build (MKPROFILE=no) with
the last two changes in my tree. The only problem was:
/nb/src/gnu/dist/gcc/gcc/function.c: In function `assign_parms':
/nb/src/gnu/dist/gcc/gcc/function.c:4740: warning: `and' of mutually exclusive equal-tests is always 0
Which I fail to understand, as the only && in that condition seems to
be TARGET_SHMEDIA that expands to:
(target_flags & SH5_BIT) && !(target_flags & SH1_BIT)
Thanks.
SY, Uwe
--
uwe@ptc.spbu.ru | Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen
--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gcc3-sh3.diff"
Index: netbsd-elf.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/config/sh/netbsd-elf.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 netbsd-elf.h
--- netbsd-elf.h 2003/07/23 02:41:57 1.1.1.1
+++ netbsd-elf.h 2003/07/30 10:19:03
@@ -96,6 +96,11 @@ Boston, MA 02111-1307, USA. */
(TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+/* Output assembler code to FILE to call the profiler. */
+
+#undef NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS
+
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(STREAM,LABELNO) \
do \
Index: sh-protos.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/config/sh/sh-protos.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sh-protos.h
--- sh-protos.h 2003/07/23 02:41:57 1.1.1.1
+++ sh-protos.h 2003/07/30 10:19:03
@@ -49,6 +49,7 @@ extern rtx legitimize_pic_address PARAMS
extern int nonpic_symbol_mentioned_p PARAMS ((rtx));
extern void emit_sf_insn PARAMS ((rtx));
extern void emit_df_insn PARAMS ((rtx));
+extern rtx sh_return_addr_rtx PARAMS ((int, rtx));
extern void print_operand_address PARAMS ((FILE *, rtx));
extern void print_operand PARAMS ((FILE *, rtx, int));
extern void output_pic_addr_const PARAMS ((FILE *, rtx));
Index: sh.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sh.c
--- sh.c 2003/07/23 02:41:57 1.1.1.1
+++ sh.c 2003/07/30 10:19:07
@@ -4490,6 +4490,21 @@ rounded_frame_size (pushed)
return ((size + pushed + align - 1) & -align) - pushed;
}
+
+/* RETURN_ADDR_RTX. */
+
+rtx
+sh_return_addr_rtx (count, frame)
+ int count;
+ rtx frame ATTRIBUTE_UNUSED;
+{
+ if (count != 0)
+ return const0_rtx;
+
+ return get_hard_reg_initial_val (Pmode,
+ TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG);
+}
+
/* Choose a call-clobbered target-branch register that remains
unchanged along the whole function. We set it up as the return
value in the prologue. */
Index: sh.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sh.h
--- sh.h 2003/07/23 02:41:58 1.1.1.1
+++ sh.h 2003/07/30 10:19:09
@@ -2139,10 +2139,7 @@ while (0)
FRAMEADDR is already the frame pointer of the COUNT frame, so we
can ignore COUNT. */
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
- (((COUNT) == 0) \
- ? get_hard_reg_initial_val (Pmode, TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG) \
- : (rtx) 0)
+#define RETURN_ADDR_RTX(COUNT, FRAME) sh_return_addr_rtx ((COUNT), (FRAME))
/* A C expression whose value is RTL representing the location of the
incoming return address at the beginning of any function, before the
@@ -2989,7 +2986,7 @@ while (0)
#define ASM_OUTPUT_LABELREF(FILE, NAME) \
do \
{ \
- char * lname; \
+ const char * lname; \
\
STRIP_DATALABEL_ENCODING (lname, (NAME)); \
if (lname[0] == '*') \
--wRRV7LY7NUeQGEoC--