i386-c required by cc1plus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey!

I'm just working on porting GCC 4.4.1 to interix (SUA). i'm getting to
stage2 by now, but am hit by an unexpected problem:

I'm getting this:

c-pragma.o(.text+0x1f30):c-pragma.c: undefined reference to
`_ix86_register_pragmas'
c-cppbuiltin.o(.text+0x248c):c-cppbuiltin.c: undefined reference to
`_ix86_target_macros'

while trying to link cc1plus-dummy. could it be, that CXX_C_OBJS in
gcc/cp/Make-lang.in is missing i386-c.o (or better $(C_TARGET_OBJS))? Or
am i missing something else here?

my platforms does not allow unresolved externals, so.... :(

Adding $(C_TARGET_OBJS) to CXX_C_OBJS in gcc/cp/Make-lang.in fixes the
problem of course - i've just successfully bootstrapped gcc-4.4.1, now
starting to test and tweak the patch...

while we're at it, could you please take a quick look at what i have so
far, and wether that would be good enough, to (finally) make it into the
 official sources...? after all, the initial interix patches exist since
quite some while now. This patch is however a more-or-less-rewrite from
scratch. (Additionally to this patch, some "*interix3*" files can be
removed from the source tree - i would include those hunks in a final
patch if it'd be accepted by you guys ;)).

Cheers, Markus
diff -ruN gcc-4.4.1.orig/config/mh-interix gcc-4.4.1/config/mh-interix
--- gcc-4.4.1.orig/config/mh-interix	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/config/mh-interix	2009-09-24 17:11:12 +0200
@@ -1,7 +1,7 @@
-# The shell may not be in /bin. 
-SHELL = sh
+BOOT_CFLAGS       = -g -O2 -D_ALL_SOURCE -D_REENTRANT
+CFLAGS_FOR_BUILD  = -g -O2 -D_ALL_SOURCE -D_REENTRANT
+CFLAGS            = -g -O2 -D_ALL_SOURCE -D_REENTRANT
 
 # We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be
 # built without debugging information
-
 LIBGCC2_DEBUG_CFLAGS=
diff -ruN gcc-4.4.1.orig/config/mt-interix gcc-4.4.1/config/mt-interix
--- gcc-4.4.1.orig/config/mt-interix	1970-01-01 01:00:00 +0100
+++ gcc-4.4.1/config/mt-interix	2009-09-24 17:11:12 +0200
@@ -0,0 +1 @@
+CPPFLAGS_FOR_TARGET = -D_ALL_SOURCE -D_REENTRANT
diff -ruN gcc-4.4.1.orig/configure.ac gcc-4.4.1/configure.ac
--- gcc-4.4.1.orig/configure.ac	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/configure.ac	2009-09-24 17:11:12 +0200
@@ -1058,6 +1058,9 @@
     host_makefile_frag="config/mh-mingw"
     ;;
   *-interix*)
+	# We definitely don't want cc on interix, since this uses the native
+	# Visual Studio tools, and doesn't work if those are missing.
+	tentative_cc=gcc
     host_makefile_frag="config/mh-interix"
     ;;
   vax-*-ultrix2*)
@@ -2043,6 +2046,9 @@
   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
     target_makefile_frag="config/mt-gnu"
     ;;
+  *-*-interix*)
+    target_makefile_frag="config/mt-interix"
+    ;;
   *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
     # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm 
     # commands to handle both 32-bit and 64-bit objects.  These flags are
diff -ruN gcc-4.4.1.orig/gcc/config/i386/i386-interix.h gcc-4.4.1/gcc/config/i386/i386-interix.h
--- gcc-4.4.1.orig/gcc/config/i386/i386-interix.h	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/gcc/config/i386/i386-interix.h	2009-09-24 17:11:12 +0200
@@ -43,7 +43,7 @@
     MASK_ALIGN_DOUBLE | MASK_MS_BITFIELD_LAYOUT)
 
 #undef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT_i486
+#define TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT_pentiumpro
 
 #define WCHAR_TYPE_SIZE 16
 #define WCHAR_TYPE "short unsigned int"
@@ -61,7 +61,8 @@
     {									\
 	builtin_define ("__INTERIX");					\
 	builtin_define ("__OPENNT");					\
-	builtin_define ("_M_IX86=300");					\
+	builtin_define ("_ALL_SOURCE");					\
+	builtin_define ("_M_IX86=600");					\
 	builtin_define ("_X86_=1");					\
 	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
 	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
@@ -81,14 +82,9 @@
   while (0)
 
 #undef CPP_SPEC
-/* Write out the correct language type definition for the header files.  
-   Unless we have assembler language, write out the symbols for C.
-   mieee is an Alpha specific variant.  Cross pollination a bad idea.
-   */
-#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
--isystem %$INTERIX_ROOT/usr/include"
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
 
-#define TARGET_VERSION fprintf (stderr, " (i386 Interix)");
+#define TARGET_VERSION fprintf (stderr, " (i686 Interix)");
 
 /* The global __fltused is necessary to cause the printf/scanf routines
    for outputting/inputting floating point numbers to be loaded.  Since this
@@ -245,6 +241,11 @@
    And if the user tries to set the flag for objc, give an error
    so he has some clue.  */
 
+/* Disable the pic flag if it has been enabled, since on interix, all
+ * code is PIC by default. Older versions of this code emitted a warning,
+ * but there -fPIC is passed quite often to GCC by default, so don't spit
+ * around, and pollute output. */
+
 #undef  SUBTARGET_OVERRIDE_OPTIONS
 #define SUBTARGET_OVERRIDE_OPTIONS					\
 do {									\
@@ -257,6 +258,10 @@
 	}								\
       target_flags &= ~MASK_MS_BITFIELD_LAYOUT;				\
     }									\
+    if(flag_pic)							\
+    {									\
+      flag_pic = 0;							\
+    }									\
 } while (0)
 
 #define EH_FRAME_IN_DATA_SECTION
@@ -272,6 +277,17 @@
    ld -r (specifically -rU).  */
 #define CTOR_LISTS_DEFINED_EXTERNALLY 1
 
+/* Max allowed section alignment specified by the PECOFF specs */
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT (8192 * 8)
+
+#undef BIGGEST_FIELD_ALIGNMENT
+#define BIGGEST_FIELD_ALIGNMENT 64
+
+#undef PCC_BITFIELD_TYPE_MATTERS
+#define PCC_BITFIELD_TYPE_MATTERS 1
+#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
+
 #define SET_ASM_OP	"\t.set\t"
 /* Output a definition (implements alias) */
 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
@@ -285,6 +301,28 @@
     }									\
 while (0)
 
+#define ASM_WEAKEN_LABEL(FILE, NAME)					\
+do									\
+{									\
+    fprintf(FILE, "/* .weak ");						\
+    assemble_name (FILE, NAME);						\
+    fprintf(FILE, " (not supported on interix) */\n");			\
+} while (0)
+
+#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)			\
+do									\
+{									\
+    if(DECL_WEAK(DECL)) {						\
+	fprintf(FILE, "\t.alias\t");					\
+    } else {								\
+	fprintf(FILE, SET_ASM_OP);					\
+    }									\
+    assemble_name(FILE, IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(DECL)));	\
+    fprintf(FILE, ", ");						\
+    assemble_name(FILE, IDENTIFIER_POINTER(TARGET));			\
+    fprintf(FILE, "\n");						\
+} while (0)
+
 #define HOST_PTR_AS_INT unsigned long
 
 #define PCC_BITFIELD_TYPE_MATTERS 1
@@ -329,11 +367,6 @@
 #undef  TARGET_STRIP_NAME_ENCODING
 #define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
 
-#if 0	
-/* Turn this back on when the linker is updated to handle grouped
-   .data$ sections correctly. See corresponding note in i386/interix.c. 
-   MK.  */
-
 /* Interix uses explicit import from shared libraries.  */
 #define MULTIPLE_SYMBOL_SPACES 1
 
@@ -342,7 +375,6 @@
 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
 
 #define SUPPORTS_ONE_ONLY 1
-#endif /* 0 */
 
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_pe_asm_named_section
@@ -359,4 +391,4 @@
 
 #define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
 	(TYPE_MODE (TYPE) == BLKmode \
-	 || (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 8 ))
\ No newline at end of file
+	 || (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 8 ))
diff -ruN gcc-4.4.1.orig/gcc/config/i386/t-interix gcc-4.4.1/gcc/config/i386/t-interix
--- gcc-4.4.1.orig/gcc/config/i386/t-interix	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/gcc/config/i386/t-interix	2009-09-24 17:11:12 +0200
@@ -5,3 +5,13 @@
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c
+
+winnt-cxx.o: $(srcdir)/config/i386/winnt-cxx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
+  $(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt-cxx.c
+
+winnt-stubs.o: $(srcdir)/config/i386/winnt-stubs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
+  $(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
+	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt-stubs.c
diff -ruN gcc-4.4.1.orig/gcc/config/interix.h gcc-4.4.1/gcc/config/interix.h
--- gcc-4.4.1.orig/gcc/config/interix.h	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/gcc/config/interix.h	2009-09-24 17:11:12 +0200
@@ -25,19 +25,13 @@
 /* POSIX/Uni-thread only for now.  Look at the winnt version
 for windows/multi thread */
 
-/* We need multiple -lc -lcpsx because they mutually refer;
-   that should go away someday */
-
 #undef LIB_SPEC
 #define LIB_SPEC "\
- %{!shared:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \
- %$INTERIX_ROOT/usr/lib/psxdll2.a \
+ %{!shared:%{!dynamic:-lc -lpsxdll \
  }} \
- %{!G:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \
- %$INTERIX_ROOT/usr/lib/psxdll2.a \
+ %{!G:%{!dynamic:-lc -lpsxdll \
  }} \
- %{dynamic:-lc %$INTERIX_ROOT/usr/lib/psxdll.a \
- %$INTERIX_ROOT/usr/lib/psxdll2.a \
+ %{dynamic:-lc -lpsxdll \
  } \
  %{v}"
 
@@ -58,6 +52,12 @@
 #define STARTFILE_SPEC  \
   "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}"
 
+/* also search /usr/lib/x86/ for libraries (and before /usr/lib/, etc.), so
+ * that the x64 versiosn of SUA work with the x86 targeting GCC */
+#undef STARTFILE_PREFIX_SPEC
+#define STARTFILE_PREFIX_SPEC \
+  "/usr/lib/x86/ /usr/lib/ /lib/"
+
 #undef WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR)					\
  ((DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
diff -ruN gcc-4.4.1.orig/gcc/config.gcc gcc-4.4.1/gcc/config.gcc
--- gcc-4.4.1.orig/gcc/config.gcc	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/gcc/config.gcc	2009-09-24 17:11:13 +0200
@@ -1301,10 +1301,11 @@
 			;;
 	esac
 	;;
-i[34567]86-*-interix3*)
-	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/i386-interix.h i386/i386-interix3.h interix.h interix3.h"
+i[34567]86-*-interix*)
+	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/i386-interix.h interix.h"
 	tmake_file="${tmake_file} i386/t-interix"
-	extra_objs=winnt.o
+	extra_objs="winnt.o winnt-stubs.o"
+	cxx_target_objs="winnt-cxx.o"
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
 	if test x$enable_threads = xyes ; then
 		thread_file='posix'
diff -ruN gcc-4.4.1.orig/gcc/cp/Make-lang.in gcc-4.4.1/gcc/cp/Make-lang.in
--- gcc-4.4.1.orig/gcc/cp/Make-lang.in	2009-09-25 08:15:13 +0200
+++ gcc-4.4.1/gcc/cp/Make-lang.in	2009-09-25 09:13:33 +0200
@@ -73,7 +73,7 @@
 CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
 	c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
 	incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
-	c-gimplify.o c-omp.o tree-inline.o
+	c-gimplify.o c-omp.o tree-inline.o $(C_TARGET_OBJS)
 
 # Language-specific object files for C++ and Objective C++.
 CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
diff -ruN gcc-4.4.1.orig/gcc/ginclude/stddef.h gcc-4.4.1/gcc/ginclude/stddef.h
--- gcc-4.4.1.orig/gcc/ginclude/stddef.h	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/gcc/ginclude/stddef.h	2009-09-24 17:11:12 +0200
@@ -135,6 +135,7 @@
 #ifndef _BSD_PTRDIFF_T_
 #ifndef ___int_ptrdiff_t_h
 #ifndef _GCC_PTRDIFF_T
+#ifndef _PTRDIFF_T_DEFINED
 #define _PTRDIFF_T
 #define _T_PTRDIFF_
 #define _T_PTRDIFF
@@ -143,10 +144,12 @@
 #define _BSD_PTRDIFF_T_
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
+#define _PTRDIFF_T_DEFINED
 #ifndef __PTRDIFF_TYPE__
 #define __PTRDIFF_TYPE__ long int
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* _PTRDIFF_T_DEFINED */
 #endif /* _GCC_PTRDIFF_T */
 #endif /* ___int_ptrdiff_t_h */
 #endif /* _BSD_PTRDIFF_T_ */
diff -ruN gcc-4.4.1.orig/libgcc/config.host gcc-4.4.1/libgcc/config.host
--- gcc-4.4.1.orig/libgcc/config.host	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/libgcc/config.host	2009-09-24 17:11:12 +0200
@@ -339,7 +339,7 @@
 	;;
 x86_64-*-mingw*)
 	;;
-i[34567]86-*-interix3*)
+i[34567]86-*-interix*)
 	;;
 ia64*-*-elf*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
diff -ruN gcc-4.4.1.orig/libmudflap/configure.ac gcc-4.4.1/libmudflap/configure.ac
--- gcc-4.4.1.orig/libmudflap/configure.ac	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/libmudflap/configure.ac	2009-09-24 17:11:12 +0200
@@ -245,7 +245,7 @@
 # Check for the name of the symbol used for the entry point.
 AC_CACHE_CHECK([for the name of the symbol used for the entry point],
   [mudflap_cv_entry_point], [
-for name in _start __start unknown; do
+for name in _start __start _mainCRTStartup unknown; do
   AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char $name@<:@@:>@;], [$name@<:@0@:>@ = 0;])],
 		 [break])
 done
diff -ruN gcc-4.4.1.orig/libstdc++-v3/acinclude.m4 gcc-4.4.1/libstdc++-v3/acinclude.m4
--- gcc-4.4.1.orig/libstdc++-v3/acinclude.m4	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/libstdc++-v3/acinclude.m4	2009-09-24 17:11:12 +0200
@@ -179,6 +179,12 @@
   fi
   if test x"$ac_fdsections" = x"yes"; then
     SECTION_FLAGS='-ffunction-sections -fdata-sections'
+
+    # don't user function sections on interix - the resulting lib is not usable
+    # for some reason...
+    case "${target}" in
+    *-*-interix*)	SECTION_FLAGS='' ;;
+    esac
   fi
   AC_MSG_RESULT($ac_fdsections)
 
diff -ruN gcc-4.4.1.orig/libstdc++-v3/src/math_stubs_long_double.cc gcc-4.4.1/libstdc++-v3/src/math_stubs_long_double.cc
--- gcc-4.4.1.orig/libstdc++-v3/src/math_stubs_long_double.cc	2009-09-25 08:54:49 +0200
+++ gcc-4.4.1/libstdc++-v3/src/math_stubs_long_double.cc	2009-09-24 17:11:12 +0200
@@ -28,6 +28,18 @@
 // we use the following crude approximations. We keep saying that we'll do
 // better later, but never do.
 
+#ifdef fabsl
+#undef fabsl
+#endif
+
+#ifdef ceill
+#undef ceill
+#endif
+
+#ifdef floorl
+#undef floorl
+#endif
+
 extern "C" 
 {
 #ifndef _GLIBCXX_HAVE_FABSL

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux