aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2016-10-05 15:21:40 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2016-10-05 09:21:40 -0600
commit73e1414cb829d02baef1bf241d4bdf3805f6f724 (patch)
tree5f4fbd30346870c8eac86f2d6908619cb5dc3b0f
parent9563bfcdb4f236f218be52f8ff05bcd6527cac28 (diff)
downloadgcc-73e1414cb829d02baef1bf241d4bdf3805f6f724.zip
gcc-73e1414cb829d02baef1bf241d4bdf3805f6f724.tar.gz
gcc-73e1414cb829d02baef1bf241d4bdf3805f6f724.tar.bz2
PR bootstrap/77819 - undefined reference to gnu_libc_printf_pointer_format with uClibc
gcc/ChangeLog: PR bootstrap/77819 * config/linux.h (TARGET_PRINTF_POINTER_FORMAT): Define macro. * config/linux.c (gnu_libc_printf_pointer_format): Remove. * targhooks.c [DEFAULT_LIBC == LIBC_UCLIBC) && SINGLE_LIBC] (default_printf_pointer_format): Define function. * targhooks.c (linux_printf_pointer_format): Define new function. * targhooks.h (linux_printf_pointer_format): Declare. (gnu_libc_printf_pointer_format): Remove declaration. From-SVN: r240793
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/linux.c16
-rw-r--r--gcc/config/linux.h5
-rw-r--r--gcc/targhooks.c16
-rw-r--r--gcc/targhooks.h2
5 files changed, 31 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b4dc9c..2b56878 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2016-10-05 Martin Sebor <msebor@redhat.com>
+
+ PR bootstrap/77819
+ * config/linux.h (TARGET_PRINTF_POINTER_FORMAT): Define macro.
+ * config/linux.c (gnu_libc_printf_pointer_format): Remove.
+ * targhooks.c [DEFAULT_LIBC == LIBC_UCLIBC) && SINGLE_LIBC]
+ (default_printf_pointer_format): Define function.
+ * targhooks.c (linux_printf_pointer_format): Define new function.
+ * targhooks.h (linux_printf_pointer_format): Declare.
+ (gnu_libc_printf_pointer_format): Remove declaration.
+
2016-10-05 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* fold-const.c (native_encode_real): Fix logic for selecting offset
diff --git a/gcc/config/linux.c b/gcc/config/linux.c
index 9aac38b..a393d3b 100644
--- a/gcc/config/linux.c
+++ b/gcc/config/linux.c
@@ -24,9 +24,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "linux-protos.h"
-#undef TARGET_PRINTF_POINTER_FORMAT
-#define TARGET_PRINTF_POINTER_FORMAT gnu_libc_printf_pointer_format
-
bool
linux_libc_has_function (enum function_class fn_class)
{
@@ -40,16 +37,3 @@ linux_libc_has_function (enum function_class fn_class)
return false;
}
-
-/* Glibc formats pointers as if by "%zx" except for the null pointer
- which outputs "(nil)". It ignores the pound ('#') format flag but
- interprets the space and plus flags the same as in the integer
- directive. */
-
-const char*
-gnu_libc_printf_pointer_format (tree arg, const char **flags)
-{
- *flags = " +";
-
- return arg && integer_zerop (arg) ? "(nil)" : "%#zx";
-}
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 3ff005b..7211da2 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -209,6 +209,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
-/* The format string to which "%p" corresponds. */
+/* The format string to which "%p" corresponds (same in Glibc and
+ uClibc. */
#undef TARGET_PRINTF_POINTER_FORMAT
-#define TARGET_PRINTF_POINTER_FORMAT gnu_libc_printf_pointer_format
+#define TARGET_PRINTF_POINTER_FORMAT linux_printf_pointer_format
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index d75650f..c7977be 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1523,6 +1523,22 @@ default_printf_pointer_format (tree, const char **flags)
return "%zx";
}
+/* For Glibc and uClibc targets also define the hook here because
+ otherwise it would have to be duplicated in each target's .c file
+ (such as in bfin/bfin.c and c6x/c6x.c, etc.)
+ Glibc and uClibc format pointers as if by "%zx" except for the null
+ pointer which outputs "(nil)". It ignores the pound ('#') format
+ flag but interprets the space and plus flags the same as in the integer
+ directive. */
+
+const char*
+linux_printf_pointer_format (tree arg, const char **flags)
+{
+ *flags = " +";
+
+ return arg && integer_zerop (arg) ? "(nil)" : "%#zx";
+}
+
tree
default_builtin_tm_load_store (tree ARG_UNUSED (type))
{
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 3356f0a..afb1c00 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -192,7 +192,7 @@ extern bool no_c99_libc_has_function (enum function_class);
extern bool gnu_libc_has_function (enum function_class);
extern const char* default_printf_pointer_format (tree, const char **);
-extern const char* gnu_libc_printf_pointer_format (tree, const char **);
+extern const char* linux_printf_pointer_format (tree, const char **);
extern const char* solaris_printf_pointer_format (tree, const char **);
extern tree default_builtin_tm_load_store (tree);