+2013-12-07 Maxim Kuvyrkov <maxim@kugelworks.com>
+
+ * config/bfin/uclinux.h, config/c6x/uclinux-elf.h,
+ * config/lm32/uclinux-elf.h, config/m68k/uclinux.h,
+ * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Move definitions
+ to linux.h.
+ * config/linux-android.h (TARGET_HAS_IFUNC_P): Move definition
+ to linux.h.
+ * config/linux.h (TARGET_LIBC_HAS_FUNCTION, TARGET_HAS_IFUNC_P):
+ Define appropriately for Linux and uClinux targets.
+
2013-12-07 Maxim Kuvyrkov <maxim@kugelworks.com>
* config/linux.c (linux_has_ifunc_p): Use correct test.
#undef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC (OPTION_BIONIC)
+#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
+/* This is a *uclinux* target. We don't define below macros to normal linux
+ versions, because doing so would require *uclinux* targets to include
+ linux.c, linux-protos.h, linux.opt, etc. We could, alternatively, add
+ these files to *uclinux* targets, but that would only pollute option list
+ (add -mglibc, etc.) without adding any useful support. */
+
+/* Define TARGET_LIBC_HAS_FUNCTION for *uclinux* targets to
+ no_c99_libc_has_function, because uclibc does not, normally, have
+ c99 runtime. If, in special cases, uclibc does have c99 runtime,
+ this should be defined to a new hook. Also please note that for targets
+ like *-linux-uclibc that similar check will also need to be added to
+ linux_libc_has_function. */
+# undef TARGET_LIBC_HAS_FUNCTION
+# define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
+#else /* !uClinux, i.e., normal Linux */
+
+/* IFUNCs are supportted by glibc, but not by uClibc or Bionic. */
+# undef TARGET_HAS_IFUNC_P
+# define TARGET_HAS_IFUNC_P linux_has_ifunc_p
+
/* Determine what functions are present at the runtime;
this includes full c99 runtime and sincos. */
-#undef TARGET_LIBC_HAS_FUNCTION
-#define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+# undef TARGET_LIBC_HAS_FUNCTION
+# define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+
+#endif
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
+/* Like the definition in gcc.c, but for purposes of uClinux, every link is
+ static. */
+#define MFWRAP_SPEC " %{fmudflap|fmudflapth: \
+ --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc\
+ --wrap=mmap --wrap=munmap --wrap=alloca\
+ %{fmudflapth: --wrap=pthread_create\
+}} %{fmudflap|fmudflapth: --wrap=main}"