freebsd-dev/gnu/gnu2bmake/gcc-2.6.0.patch

514 lines
17 KiB
Diff
Raw Normal View History

I have removed the "ljo-Fortran" stuff. It doesn't belong in cc. /phk
From kralizec.zeta.org.au!bde Sat Jul 30 22:53:11 1994
Return-Path: <bde@kralizec.zeta.org.au>
Received: from warrane.connect.com.au by tfs.com (smail3.1.28.1) with SMTP
id m0qUTpa-0003wvC; Sat, 30 Jul 94 22:53 PDT
Received: from kralizec.zeta.org.au by warrane.connect.com.au with SMTP id AA24021
(5.67b8/IDA-1.5 for <phk@TFS.COM>); Sun, 31 Jul 1994 15:51:38 +1000
Received: (from bde@localhost) by kralizec.zeta.org.au (8.6.9/8.6.9) id PAA00298 for phk@TFS.COM; Sun, 31 Jul 1994 15:51:11 +1000
Date: Sun, 31 Jul 1994 15:51:11 +1000
From: Bruce Evans <bde@kralizec.zeta.org.au>
Message-Id: <199407310551.PAA00298@kralizec.zeta.org.au>
To: phk@tfs.com
Subject: Re: gcc-2.6.0, diff netbsd/freebsd
---
>> I've compiled nothing else with 2.6.0, but it bootstraps fine on my
>> 1.1R system. What's the problem with stddef.h? I haven't had any
>> troubles here with that file.
>Probably nothing serious, but I already has it on my list.
Here are the diffs for my port of gcc-2.6.0. FreeBSD-1.1.5 and 4.4lite
have an amazing number of bugs in involving namespace pollution from the
runetype stuff. rune_t should never have been in <stddef.h>. <ctype.h>
does not compile if _ANSI_SOURCE is defined ...
Bruce
Makefile.in:
Rip out debugging stuff from libgcc.a the same as FreeBSD does.
final.c:
o If NO_PROFILE_DATA is defined, don't waste space for unused
profile data.
config/i386/freebsd.h:
o Define specs together near the start.
o For -p and -pg, put -Bstatic in LINK_SPEC instead of in LIB_SPEC
so that it gets seen early enough when other libraries are used.
o Update wchar_t stuff. `wchar_t foo[] = "123";' is broken in
FreeBSD-1.1.5 because wchar_t was changed without changing gcc.
I guess nothing actually uses wchar_t :-).
o FUNCTION_PROFILER: don't waste space and time for unused profile
data and pointer to it. Compatible with FreeBSD-1.x.
o FUNCTION_PROFILER_EPILOGUE: for accurate profiling if there's
a readable clock. Incompatible with FreeBSD-1.x (hide it with
#if 0, or add a dummy mexitcount to the user mcount file and
a real mexitexit to the kernel mcount file). Need a -mflag for
this. Want more profiling stuff (profile before function
prologue...) from osfrose.h.
o Fixed white space in "svr4" stuff. Actually it's osfrose stuff.
Formatting now matches osfrose.h.
config/i386/i386.c:
o Fix bugs: profiling may use the pic register. Need a macro for
this - it is machine-dependent. It is already fixed in osfrose.h
by not using the functions in i386.c.
o Support FUNCTION_PROFILER_EPILOGUE. Avoiding the use of the pic
register is even more complicated for the epilogue than for the
prologue. We don't attempt to. See osfrose.h for the prologue.
config/i386/i386.h:
o Avoid average 1.2% code bloat caused by stupid register allocation.
ginclude/stdarg.h, ginclude/varargs.h:
o Handle Net/2 _VA_LIST_ and 4.4lite _BSD_VA_LIST_ right.
ginclude/stddef.h:
o Handle Net/2 _WCHAR_T_ and 4.4lite _BSD_WCHAR_T_ less wrongly than
before. Copy FreeBSD-1.1.5/4.4lite rune_t brokenness. Remove
extra underscores in _GCC_*_T_ which stopped the Net/2 _PTRDIFF_T_,
_SIZE_T_ and _WCHAR_T_ from being undefined. Still need to
handle the 4.4lite _BSD_PTRDIFF_T_ and _BSD_SIZE_T_. They are too
hard to handle using ifdefs anyway. stddef.h takes 227 lines to
define only 3 ANSI typedefs, 1 bogus typedef and 2 ANSI macros.
diff -rc2 gcc-2.6.0/orig/Makefile.in gcc-2.6.0/Makefile.in
*** gcc-2.6.0/orig/Makefile.in Thu Jul 14 08:46:54 1994
--- gcc-2.6.0/Makefile.in Sun Jul 17 05:36:06 1994
***************
*** 212,216 ****
# we use this here because that should be enough, and also
# so that -g1 will be tested.
! LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
# Additional options to use when compiling libgcc2.a.
--- 213,217 ----
# we use this here because that should be enough, and also
# so that -g1 will be tested.
! LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) # -g1
# Additional options to use when compiling libgcc2.a.
***************
*** 714,717 ****
--- 716,720 ----
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
mv libgcc1.o $${name}.o; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
rm -f $${name}.o; \
***************
*** 733,736 ****
--- 736,740 ----
$(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
***************
*** 794,797 ****
--- 798,802 ----
$(srcdir)/libgcc2.c -o $${name}.o; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
rm -f $${name}.o; \
***************
*** 813,816 ****
--- 818,822 ----
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
rm -f $${name}.[so]; \
diff -rc2 gcc-2.6.0/orig/final.c gcc-2.6.0/final.c
*** gcc-2.6.0/orig/final.c Wed Jul 13 11:30:52 1994
--- gcc-2.6.0/final.c Sun Jul 17 05:49:35 1994
***************
*** 954,965 ****
--- 954,969 ----
FILE *file;
{
+ #ifndef NO_PROFILE_DATA
int align = MIN (BIGGEST_ALIGNMENT, POINTER_SIZE);
+ #endif /* not NO_PROFILE_DATA */
int sval = current_function_returns_struct;
int cxt = current_function_needs_context;
+ #ifndef NO_PROFILE_DATA
data_section ();
ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no);
assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
+ #endif /* not NO_PROFILE_DATA */
text_section ();
diff -rc2 gcc-2.6.0/config/i386/orig/freebsd.h gcc-2.6.0/config/i386/freebsd.h
*** gcc-2.6.0/config/i386/orig/freebsd.h Fri Jul 15 02:55:14 1994
--- gcc-2.6.0/config/i386/freebsd.h Sun Jul 17 07:33:20 1994
***************
*** 40,46 ****
--- 40,52 ----
}
+ #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
+
/* Like the default, except no -lg. */
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+ #define LINK_SPEC \
+ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
+ %{p:-Bstatic} %{pg:-Bstatic} %{Z}"
+
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
***************
*** 50,77 ****
#undef WCHAR_TYPE
! #define WCHAR_TYPE "short unsigned int"
! #define WCHAR_UNSIGNED 1
#undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE 16
#define HAVE_ATEXIT
! /* Redefine this to use %eax instead of %edx. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
! { \
! fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
! LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
! } \
else \
! { \
! fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall mcount\n"); \
! } \
}
--- 56,89 ----
#undef WCHAR_TYPE
! #define WCHAR_TYPE "int"
! #define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE BITS_PER_WORD
#define HAVE_ATEXIT
! /* Tell final.c that we don't need a label passed to mcount. */
!
! #define NO_PROFILE_DATA
!
! /* Redefine this to not pass an unused label in %edx. */
!
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
! fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
! else \
! fprintf (FILE, "\tcall mcount\n"); \
! }
!
! #define FUNCTION_PROFILER_EPILOGUE(FILE) \
! { \
! if (flag_pic) \
! fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n"); \
else \
! fprintf (FILE, "\tcall mexitcount\n"); \
}
***************
*** 170,174 ****
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
! size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
--- 182,186 ----
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
! size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
***************
*** 184,202 ****
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
! #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
! do { \
! char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
! if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
! && ! AT_END && TOP_LEVEL \
! && DECL_INITIAL (DECL) == error_mark_node \
! && !size_directive_output) \
! { \
! fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
! assemble_name (FILE, name); \
! fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
! } \
} while (0)
-
/* This is how to declare the size of a function. */
--- 196,213 ----
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
! #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
! do { \
! char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
! if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
! && ! AT_END && TOP_LEVEL \
! && DECL_INITIAL (DECL) == error_mark_node \
! && !size_directive_output) \
! { \
! fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
! assemble_name (FILE, name); \
! fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
! } \
} while (0)
/* This is how to declare the size of a function. */
***************
*** 219,226 ****
} \
} while (0)
-
- #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
- #define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
/* This section copied from i386/osfrose.h */
--- 230,233 ----
diff -rc2 gcc-2.6.0/config/i386/orig/i386.c gcc-2.6.0/config/i386/i386.c
*** gcc-2.6.0/config/i386/orig/i386.c Tue Apr 12 21:40:35 1994
--- gcc-2.6.0/config/i386/i386.c Sun Jul 17 06:10:00 1994
***************
*** 860,864 ****
rtx xops[4];
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool);
xops[0] = stack_pointer_rtx;
--- 860,865 ----
rtx xops[4];
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool
! || profile_flag || profile_block_flag);
xops[0] = stack_pointer_rtx;
***************
*** 921,926 ****
int reglimit = (frame_pointer_needed
? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
! int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool);
#ifdef NON_SAVING_SETJMP
--- 922,935 ----
int reglimit = (frame_pointer_needed
? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
!
! #ifdef FUNCTION_PROFILER_EPILOGUE
! if (profile_flag)
! return 0;
! #endif
!
! if (flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool
! || profile_flag || profile_block_flag))
! return 0;
#ifdef NON_SAVING_SETJMP
***************
*** 933,938 ****
for (regno = reglimit - 1; regno >= 0; regno--)
! if ((regs_ever_live[regno] && ! call_used_regs[regno])
! || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
nregs++;
--- 942,946 ----
for (regno = reglimit - 1; regno >= 0; regno--)
! if (regs_ever_live[regno] && ! call_used_regs[regno])
nregs++;
***************
*** 955,958 ****
--- 963,971 ----
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
|| current_function_uses_const_pool);
+
+ #ifdef FUNCTION_PROFILER_EPILOGUE
+ if (profile_flag)
+ FUNCTION_PROFILER_EPILOGUE (file);
+ #endif
/* Compute the number of registers to pop */
diff -rc2 gcc-2.6.0/config/i386/orig/i386.h gcc-2.6.0/config/i386/i386.h
*** gcc-2.6.0/config/i386/orig/i386.h Thu Jun 16 20:36:13 1994
--- gcc-2.6.0/config/i386/i386.h Mon Jul 18 19:18:59 1994
***************
*** 267,272 ****
#define REG_ALLOC_ORDER \
! /*dx,cx,ax,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
! { 1, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
/* Macro to conditionally modify fixed_regs/call_used_regs. */
--- 267,272 ----
#define REG_ALLOC_ORDER \
! /*ax,cx,dx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
! { 0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
/* Macro to conditionally modify fixed_regs/call_used_regs. */
diff -rc2 gcc-2.6.0/ginclude/orig/stdarg.h gcc-2.6.0/ginclude/stdarg.h
*** gcc-2.6.0/ginclude/orig/stdarg.h Sat Jul 9 12:04:08 1994
--- gcc-2.6.0/ginclude/stdarg.h Mon Jul 18 01:32:16 1994
***************
*** 44,47 ****
--- 44,56 ----
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
+ #if defined (__FreeBSD__)
+ /* This is the correct way to handle all BSD NET2 and BSD 4.4 systems. */
+ #include <machine/ansi.h>
+ #ifdef _BSD_VA_LIST_
+ typedef _BSD_VA_LIST_ __gnuc_va_list;
+ #else
+ typedef _VA_LIST_ __gnuc_va_list;
+ #endif
+ #else
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
typedef char *__gnuc_va_list;
***************
*** 50,53 ****
--- 59,63 ----
#endif
#endif
+ #endif
/* Define the standard macros for the user,
***************
*** 113,118 ****
--- 123,133 ----
#endif
+ #if 0
+ /* BSD 4.4 actually spells the name _BSD_VA_LIST_ and requires it to be
+ * defined and usable in place of va_list when the latter name is not
+ * allowed (e.g., in stdio.h - see above). */
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
+ #endif
#endif
diff -rc2 gcc-2.6.0/ginclude/orig/stddef.h gcc-2.6.0/ginclude/stddef.h
*** gcc-2.6.0/ginclude/orig/stddef.h Tue Apr 26 04:13:05 1994
--- gcc-2.6.0/ginclude/stddef.h Sun Jul 17 21:52:12 1994
***************
*** 36,40 ****
#define _PTRDIFF_T
#endif
! #ifndef _WCHAR_T_
#define _WCHAR_T
#endif
--- 36,40 ----
#define _PTRDIFF_T
#endif
! #if ! defined (_WCHAR_T_) && ! defined (_BSD_WCHAR_T_)
#define _WCHAR_T
#endif
***************
*** 173,176 ****
--- 173,179 ----
#define __WCHAR_TYPE__ int
#endif
+ #if defined (_ANSI_H_) && defined (_BSD_RUNE_T_)
+ typedef _BSD_RUNE_T_ rune_t; /* WRONG */
+ #endif
typedef __WCHAR_TYPE__ wchar_t;
#endif
***************
*** 189,200 ****
are already defined. */
#ifdef _ANSI_H_
! #ifdef _GCC_PTRDIFF_T_
#undef _PTRDIFF_T_
#endif
! #ifdef _GCC_SIZE_T_
#undef _SIZE_T_
#endif
! #ifdef _GCC_WCHAR_T_
#undef _WCHAR_T_
#endif
#endif /* _ANSI_H_ */
--- 192,204 ----
are already defined. */
#ifdef _ANSI_H_
! #ifdef _GCC_PTRDIFF_T
#undef _PTRDIFF_T_
#endif
! #ifdef _GCC_SIZE_T
#undef _SIZE_T_
#endif
! #ifdef _GCC_WCHAR_T
#undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
#endif
#endif /* _ANSI_H_ */
diff -rc2 gcc-2.6.0/ginclude/orig/varargs.h gcc-2.6.0/ginclude/varargs.h
*** gcc-2.6.0/ginclude/orig/varargs.h Sat Jul 9 12:04:13 1994
--- gcc-2.6.0/ginclude/varargs.h Mon Jul 18 01:32:02 1994
***************
*** 76,79 ****
--- 76,88 ----
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
+ #if defined (__FreeBSD__)
+ /* This is the correct way to handle all BSD NET2 and BSD 4.4 systems. */
+ #include <machine/ansi.h>
+ #ifdef _BSD_VA_LIST_
+ typedef _BSD_VA_LIST_ __gnuc_va_list;
+ #else
+ typedef _VA_LIST_ __gnuc_va_list;
+ #endif
+ #else
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
typedef char *__gnuc_va_list;
***************
*** 82,85 ****
--- 91,95 ----
#endif
#endif
+ #endif
#define va_start(AP) AP=(char *) &__builtin_va_alist
***************
*** 171,175 ****
--- 181,190 ----
/* The next BSD release (if there is one) wants this symbol to be
undefined instead of _VA_LIST_. */
+ #if 0
+ /* BSD 4.4 actually spells the name _BSD_VA_LIST_ and requires it to be
+ * defined and usable in place of va_list when the latter name is not
+ * allowed (e.g., in stdio.h - see ginclude/stdarg.h). */
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
+ #endif
#endif