This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ld: Use libiberty ISDIGIT in linker test plugin


Someone with better linker/autotool/library knowledge than me should
probably check that I am doing the right thing with the Makefile
changes.

---

Use libiberty ISDIGIT function istead of the standard c-library isdigit
function when building the linker test plugin.

ld/ChangeLog:

	* Makefile.am (libldtestplug_la_LDFLAGS): Add libibery library.
	* Makefile.in: Regenerate.
	* testplug.c: Use 'safe-ctype.h' not 'ctype.h'.
	(record_read_length): Use ISDIGIT instead of isdigit.
---
 ld/ChangeLog   | 7 +++++++
 ld/Makefile.am | 2 +-
 ld/Makefile.in | 2 +-
 ld/testplug.c  | 4 ++--
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ld/Makefile.am b/ld/Makefile.am
index 16d95bc..ad4ab50 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -2147,7 +2147,7 @@ noinst_LTLIBRARIES = libldtestplug.la libldtestplug2.la \
 		     libldtestplug3.la libldtestplug4.la
 libldtestplug_la_SOURCES = testplug.c
 libldtestplug_la_CFLAGS= -g -O2
-libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere
+libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere -L../libiberty -liberty
 libldtestplug2_la_SOURCES = testplug2.c
 libldtestplug2_la_CFLAGS= -g -O2
 libldtestplug2_la_LDFLAGS = -no-undefined -rpath /nowhere
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 1ce019a..791ebe9 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -985,7 +985,7 @@ ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $
 
 @ENABLE_PLUGINS_TRUE@libldtestplug_la_SOURCES = testplug.c
 @ENABLE_PLUGINS_TRUE@libldtestplug_la_CFLAGS = -g -O2
-@ENABLE_PLUGINS_TRUE@libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere
+@ENABLE_PLUGINS_TRUE@libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere -L../libiberty -liberty
 @ENABLE_PLUGINS_TRUE@libldtestplug2_la_SOURCES = testplug2.c
 @ENABLE_PLUGINS_TRUE@libldtestplug2_la_CFLAGS = -g -O2
 @ENABLE_PLUGINS_TRUE@libldtestplug2_la_LDFLAGS = -no-undefined -rpath /nowhere
diff --git a/ld/testplug.c b/ld/testplug.c
index 684fc41..db30ec3 100644
--- a/ld/testplug.c
+++ b/ld/testplug.c
@@ -24,7 +24,7 @@
 /* For ARRAY_SIZE macro only - we don't link the library itself.  */
 #include "libiberty.h"
 
-#include <ctype.h> /* For isdigit.  */
+#include "safe-ctype.h" /* For ISDIGIT.  */
 
 extern enum ld_plugin_status onload (struct ld_plugin_tv *tv);
 static enum ld_plugin_status onclaim_file (const struct ld_plugin_input_file *file,
@@ -172,7 +172,7 @@ record_read_length (const char *length)
   const char *tmp;
 
   tmp = length;
-  while (*tmp != '\0' && isdigit (*tmp))
+  while (*tmp != '\0' && ISDIGIT (*tmp))
     ++tmp;
   if (*tmp != '\0' || *length == '\0')
     {
-- 
2.5.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]