Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2003 21:09:15 +0300 (EEST)
From:      Miika Komu <mkomu@niksula.hut.fi>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/50651: gcc33 does not compile on FreeBSD 5.0
Message-ID:  <Pine.GSO.4.44.0304062105380.168-100000@kekkonen.cs.hut.fi>
Resent-Message-ID: <200304061810.h36IA5Qe063389@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         50651
>Category:       ports
>Synopsis:       gcc33 does not compile on FreeBSD 5.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 06 11:10:04 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Miika Komu
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD adamo 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Tue Mar 25 23:29:14 EET 2003 mkomu@adamo:/usr/obj/usr/src/sys/MYKERNEL i386

AMD Duron 650 MHz


>Description:


gcc33 does not compile in the ports because the patch files are not
up-to-date and they are rejected. The Makefile is not correct either.

>How-To-Repeat:

Install a FreeBSD5.0 and try "make" in /usr/ports/lang/gcc33. This is the first
error encountered:

Invalid configuration `FreeBSD-portbld-freebsd5.0': machine `FreeBSD-portbld' not recognized
Invalid configuration `FreeBSD-portbld-freebsd5.0': machine `FreeBSD-portbld' not recognized
Unrecognized host system name FreeBSD-portbld-freebsd5.0.

The rest of the errors are about the patches in gcc33/files: patch-ad,
patch-af and patch-ar. They are out-dated and they are rejected.

>Fix:



I am not a FreeBSD guru and I can only show a work-around for the
Makefile trouble:

.if ${PORTOBJFORMAT} == "aout"
#CONFIGURE_TARGET=       ${ARCH}-portbld-freebsdaout${OSREL}
#CONFIGURE_TARGET=      i386-portbld-freebsd5.0
.else
#CONFIGURE_TARGET=       ${ARCH}-portbld-freebsd${OSREL}
CONFIGURE_TARGET=      i386-portbld-freebsd5.0
.endif

This work-around is only for i386. I don't understand why the ARCH is
expanded to FreeBSD in my FreeBSD5.0.

I made new patch files to replace the ones that did not compile. I
cannot verify the quality of the new patch files, maybe some should
check them first out before committing them to CVS. Note that the new
patches should replace the originals, so they are not patches to
patches.

******** patch-ad: *********

--- gcc/config/i386/freebsd-aout.h.orig	Fri Nov 15 16:57:11 2002
+++ gcc/config/i386/freebsd-aout.h	Sun Apr  6 10:36:03 2003
@@ -77,14 +77,6 @@
 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms.  */
 #define DWARF2_UNWIND_INFO 0

-/* Don't default to pcc-struct-return, because in FreeBSD we prefer the
-   superior nature of the older gcc way.  */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Ensure we the configuration knows our system correctly so we can link with
-   libraries compiled with the native cc.  */
-#undef NO_DOLLAR_IN_LABEL
-
 /* i386 freebsd still uses old binutils that don't insert nops by default
    when the .align directive demands to insert extra space in the text
    segment.  */
@@ -94,6 +86,21 @@

 /* Profiling routines, partially copied from i386/osfrose.h.  */

+/* Tell final.c that we don't need a label passed to mcount.  */
+#define NO_PROFILE_DATA
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO)
+{									\
+  if (flag_pic)								\
+    {									\
+      fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");			\
+    }									\
+  else									\
+    {									\
+      fprintf (FILE, "\tcall mcount\n");				\
+    }									\
+}
+
 #undef MCOUNT_NAME
 #define MCOUNT_NAME "mcount"
 #undef PROFILE_COUNT_REGISTER
@@ -112,6 +119,7 @@

 #define TYPE_ASM_OP	"\t.type\t"
 #define SIZE_ASM_OP	"\t.size\t"
+#define SET_ASM_OP	"\t.set\t"

 /* The following macro defines the format used to output the second
    operand of the .type assembler directive.  Different svr4 assemblers
@@ -121,6 +129,12 @@

 #define TYPE_OPERAND_FMT	"@%s"

+#define HANDLE_SYSV_PRAGMA	1
+
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+	do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+	fputc ('\n', FILE); } while (0)
+
 /* Write the extra assembler code needed to declare a function's result.
    Most svr4 assemblers don't require any special declaration of the
    result value, but there are exceptions.  */
@@ -209,6 +223,8 @@
 #define STARTFILE_SPEC  \
   "%{shared:c++rt0.o%s} \
    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
+
+#define MD_STARTFILE_PREFIX "/usr/lib/aout/"

 /* Define this so we can compile MS code for use with WINE.  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP

******* patch-af *****************

--- gcc/config/i386/freebsd.h.orig	Fri Nov 15 16:57:11 2002
+++ gcc/config/i386/freebsd.h	Sun Apr  6 11:11:02 2003
@@ -60,6 +60,14 @@

 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+#undef  CC1_SPEC
+#define CC1_SPEC "\
+  %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
+  %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
+
+#undef  ASM_SPEC
+#define ASM_SPEC	"%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"

 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
    the magical crtbegin.o file (see crtstuff.c) which provides part
@@ -68,11 +76,18 @@

 #undef	STARTFILE_SPEC
 #define STARTFILE_SPEC \
-  "%{!shared: \
-     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
-		       %{!p:%{profile:gcrt1.o%s} \
-			 %{!profile:crt1.o%s}}}} \
-   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+  "%{maout: %{shared:c++rt0.o%s} \
+    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}} \
+  %{!maout: \
+    %{!shared: \
+      %{pg:gcrt1.o%s} \
+      %{!pg:%{p:gcrt1.o%s} \
+	    %{!p:%{profile:gcrt1.o%s} \
+		 %{!profile:crt1.o%s}}}} \
+    crti.o%s \
+    %{!shared:crtbegin.o%s} \
+    %{shared:crtbeginS.o%s} \
+   }"

 /* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
    the magical crtend.o file (see crtstuff.c) which provides part of
@@ -82,7 +97,7 @@

 #undef	ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+  "%{!maout: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"

 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
    for the special GCC options -static and -shared, which allow us to


****** patch-ar ****************


--- gcc/config/freebsd-spec.h.orig	Wed Mar 12 04:38:01 2003
+++ gcc/config/freebsd-spec.h	Sun Apr  6 11:11:03 2003
@@ -80,7 +80,10 @@
 #define FBSD_CPP_SPEC "							\
   %(cpp_cpu)								\
   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
-  %{posix:-D_POSIX_SOURCE}"
+  %{posix:-D_POSIX_SOURCE}						\
+  %{!maout: -D__ELF__}							\
+  %{munderscores: -D__UNDERSCORES__}					\
+  %{maout: %{!mno-underscores: -D__UNDERSCORES__}}"

 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
    the magical crtbegin.o file (see crtstuff.c) which provides part

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.44.0304062105380.168-100000>