Several weeks ago I noticed that there were some testsuite fails in
bfin-uclinux-gcc-4.1 but not in bfin-linux-uclibc-gcc-4.1. Several of
those fails are resolved by these two patches. Mainly they include
common linux.h for bfin-uclinux target. They also remove redundant
macros from target files.

Committed.

Jie
	* config.gcc (tm_file): Add linux.h for bfin*-uclinux*.
	* config/bfin/linux.h (CPLUSPLUS_CPP_SPEC): Don't define.
	(CRT_CALL_STATIC_FUNCTION): Likewise.
	(NO_IMPLICIT_EXTERN_C): Likewise.
	(TARGET_OS_CPP_BUILTINS): Define as LINUX_TARGET_OS_CPP_BUILTINS.
	* config/bfin/elf.h (OBJECT_FORMAT_ELF): Don't define.
	* config/bfin/uclinux.h (CPLUSPLUS_CPP_SPEC): Don't define.
	(STARTFILE_SPEC): Remove mfdpic.
	(ENDFILE_SPEC): Don't define.
	(LIB_SPEC): Likewise.
	(CRT_CALL_STATIC_FUNCTION): Likewise.
	(NO_IMPLICIT_EXTERN_C): Likewise.
	(LINUX_TARGET_OS_CPP_BUILTINS): Likewise.
	(TARGET_OS_CPP_BUILTINS): Define as LINUX_TARGET_OS_CPP_BUILTINS.


Index: config.gcc
===================================================================
--- config.gcc	(revision 1567)
+++ config.gcc	(working copy)
@@ -757,7 +757,7 @@ bfin*-elf*)
         use_collect2=no
         ;;
 bfin*-uclinux*)
-	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/uclinux.h"
+	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h bfin/uclinux.h"
         tmake_file=bfin/t-bfin-uclinux
         use_collect2=no
         ;;
Index: config/bfin/linux.h
===================================================================
--- config/bfin/linux.h	(revision 1567)
+++ config/bfin/linux.h	(working copy)
@@ -2,31 +2,8 @@
 #define SUBTARGET_DRIVER_SELF_SPECS \
   "%{!mno-fdpic:-mfdpic}",
 
-/* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
-#ifdef __BFIN_FDPIC__
-#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
-asm (SECTION_OP); \
-asm ("P3 = [SP + 20];\n\tcall " USER_LABEL_PREFIX #FUNC ";"); \
-asm (TEXT_SECTION_ASM_OP);
-#endif
-
-#define NO_IMPLICIT_EXTERN_C
-
 #undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-      LINUX_TARGET_OS_CPP_BUILTINS();		\
-      if (flag_pic)				\
-	{					\
-	  builtin_define ("__PIC__");		\
-	  builtin_define ("__pic__");		\
-	}					\
-    }						\
-  while (0)
+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC \
Index: config/bfin/elf.h
===================================================================
--- config/bfin/elf.h	(revision 1567)
+++ config/bfin/elf.h	(working copy)
@@ -1,5 +1,3 @@
-#define OBJECT_FORMAT_ELF
-
 #define LOCAL_LABEL_PREFIX "L$"
 
 #undef ASM_GENERATE_INTERNAL_LABEL
Index: config/bfin/uclinux.h
===================================================================
--- config/bfin/uclinux.h	(revision 1567)
+++ config/bfin/uclinux.h	(working copy)
@@ -1,48 +1,8 @@
-/* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC \
-  "%{!shared: %{pie:Scrt1%O%s;:crt1%O%s}} %{mfdpic:crtreloc%O%s} crti%O%s crtbegin%O%s crtlibid%O%s"
-
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "crtend%O%s crtn%O%s"
-
-#undef  LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} -lc"
-
-#ifdef __BFIN_FDPIC__
-#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
-asm (SECTION_OP); \
-asm ("P3 = [SP + 20];\n\tcall " USER_LABEL_PREFIX #FUNC ";"); \
-asm (TEXT_SECTION_ASM_OP);
-#endif
-
-#define NO_IMPLICIT_EXTERN_C
-
-#define LINUX_TARGET_OS_CPP_BUILTINS()				\
-    do {							\
-	builtin_define ("__gnu_linux__");			\
-	builtin_define_std ("linux");				\
-	builtin_define_std ("unix");				\
-	builtin_assert ("system=linux");			\
-	builtin_assert ("system=unix");				\
-	builtin_assert ("system=posix");			\
-    } while (0)
+  "%{!shared: %{pie:Scrt1%O%s;:crt1%O%s}} crti%O%s crtbegin%O%s crtlibid%O%s"
 
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-	LINUX_TARGET_OS_CPP_BUILTINS();		\
-	if (flag_pic)				\
-	  {					\
-	    builtin_define ("__PIC__");		\
-	    builtin_define ("__pic__");		\
-	  }					\
-    }						\
-  while (0)
+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
 
 #define SUBTARGET_FDPIC_NOT_SUPPORTED
 
	* config.gcc (tm_file): Add linux.h for bfin*-uclinux*.
	* config/bfin/linux.h (CPLUSPLUS_CPP_SPEC): Don't define.
	(CRT_CALL_STATIC_FUNCTION): Likewise.
	(NO_IMPLICIT_EXTERN_C): Likewise.
	(TARGET_OS_CPP_BUILTINS): Define as LINUX_TARGET_OS_CPP_BUILTINS.
	* config/bfin/elf.h (OBJECT_FORMAT_ELF): Don't define.
	* config/bfin/uclinux.h (CPLUSPLUS_CPP_SPEC): Don't define.
	(ENDFILE_SPEC): Don't define.
	(LIB_SPEC): Likewise.
	(CRT_CALL_STATIC_FUNCTION): Likewise.
	(NO_IMPLICIT_EXTERN_C): Likewise.
	(LINUX_TARGET_OS_CPP_BUILTINS): Likewise.
	(TARGET_OS_CPP_BUILTINS): Define as LINUX_TARGET_OS_CPP_BUILTINS.

Index: config.gcc
===================================================================
--- config.gcc	(revision 1567)
+++ config.gcc	(working copy)
@@ -1686,7 +1686,7 @@ bfin*-elf*)
         use_collect2=no
         ;;  
 bfin*-uclinux*)
-	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/uclinux.h bfin/linux-unwind.h"
+	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h bfin/uclinux.h bfin/linux-unwind.h"
         tmake_file=bfin/t-bfin-uclinux
         use_collect2=no
         ;;  
Index: config/bfin/linux.h
===================================================================
--- config/bfin/linux.h	(revision 1567)
+++ config/bfin/linux.h	(working copy)
@@ -2,31 +2,8 @@
 #define SUBTARGET_DRIVER_SELF_SPECS \
   "%{!mno-fdpic:-mfdpic}",
 
-/* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
-#ifdef __BFIN_FDPIC__
-#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
-asm (SECTION_OP); \
-asm ("P3 = [SP + 20];\n\tcall " USER_LABEL_PREFIX #FUNC ";"); \
-asm (TEXT_SECTION_ASM_OP);
-#endif
-
-#define NO_IMPLICIT_EXTERN_C
-
 #undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-      LINUX_TARGET_OS_CPP_BUILTINS();		\
-      if (flag_pic)				\
-	{					\
-	  builtin_define ("__PIC__");		\
-	  builtin_define ("__pic__");		\
-	}					\
-    }						\
-  while (0)
+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC \
Index: config/bfin/elf.h
===================================================================
--- config/bfin/elf.h	(revision 1567)
+++ config/bfin/elf.h	(working copy)
@@ -4,8 +4,6 @@
  */
 
 
-#define OBJECT_FORMAT_ELF
-
 #define LOCAL_LABEL_PREFIX "L$"
 
 #undef ASM_GENERATE_INTERNAL_LABEL
Index: config/bfin/uclinux.h
===================================================================
--- config/bfin/uclinux.h	(revision 1567)
+++ config/bfin/uclinux.h	(working copy)
@@ -3,49 +3,10 @@
  */
 
 /* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC \
   "%{!shared: %{pie:Scrt1%O%s;:crt1%O%s}} crti%O%s crtbegin%O%s crtlibid%O%s"
 
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "crtend%O%s crtn%O%s"
-
-#undef  LIB_SPEC
-#define LIB_SPEC "%{pthread:-lpthread} -lc"
-
-#ifdef __BFIN_FDPIC__
-#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
-asm (SECTION_OP); \
-asm ("P3 = [SP + 20];\n\tcall " USER_LABEL_PREFIX #FUNC ";"); \
-asm (TEXT_SECTION_ASM_OP);
-#endif
-
-#define NO_IMPLICIT_EXTERN_C
-
-#define LINUX_TARGET_OS_CPP_BUILTINS()				\
-    do {							\
-	builtin_define ("__gnu_linux__");			\
-	builtin_define_std ("linux");				\
-	builtin_define_std ("unix");				\
-	builtin_assert ("system=linux");			\
-	builtin_assert ("system=unix");				\
-	builtin_assert ("system=posix");			\
-    } while (0)
-
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-	LINUX_TARGET_OS_CPP_BUILTINS();		\
-	if (flag_pic)				\
-	  {					\
-	    builtin_define ("__PIC__");		\
-	    builtin_define ("__pic__");		\
-	  }					\
-    }						\
-  while (0)
+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
 
 #define SUBTARGET_FDPIC_NOT_SUPPORTED
_______________________________________________
Toolchain-devel mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/toolchain-devel

Reply via email to