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]

Sync include & libiberty with gcc


I've just pushed 3 patches to bring libiberty and necessary include
files into line with the recent pushes to gcc's copies of these files.

For the record these are

memory leak in argv.c:
https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01609.html

alignment for ubsan in md5.c:
https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00019.html

new function in splay-tree.c:
https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01547.html

>From 7db40ccc75128f1d78b1f1c14e4d99f76c5047f3 Mon Sep 17 00:00:00 2001
From: edlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 28 May 2018 18:21:23 +0000
Subject: [PATCH] include: 2018-05-28  Bernd Edlinger 
 <bernd.edlinger@hotmail.de>

include:
        * splay-tree.h (splay_tree_compare_strings,
        splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.c (splay_tree_compare_strings,
        splay_tree_delete_pointers): New utility functions.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850 138bc75d-0d04-0410-961f-82ee72b054a4
---
 include/ChangeLog      |  5 +++++
 include/splay-tree.h   |  4 +++-
 libiberty/ChangeLog    |  5 +++++
 libiberty/splay-tree.c | 19 +++++++++++++++++++
 10 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/include/ChangeLog b/include/ChangeLog
index 854b58a..7b4aaed 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* splay-tree.h (splay_tree_compare_strings,
+	splay_tree_delete_pointers): Declare new utility functions.
+
 2018-05-21  Peter Bergner  <bergner@vnet.ibm.com.com>
 
 	* opcode/ppc.h (PPC_OPERAND_FAKE): Delete macro.
diff --git a/include/splay-tree.h b/include/splay-tree.h
index b63612c..fc94fb7 100644
--- a/include/splay-tree.h
+++ b/include/splay-tree.h
@@ -147,7 +147,9 @@ extern splay_tree_node splay_tree_max (splay_tree);
 extern splay_tree_node splay_tree_min (splay_tree);
 extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
 extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
-extern int splay_tree_compare_pointers (splay_tree_key,	splay_tree_key);
+extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
+extern int splay_tree_compare_strings (splay_tree_key, splay_tree_key);
+extern void splay_tree_delete_pointers (splay_tree_value);
 
 #ifdef __cplusplus
 }
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index b249226..19c6269 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* splay-tree.c (splay_tree_compare_strings,
+	splay_tree_delete_pointers): New utility functions.
+
 2018-05-10  Martin Liska  <mliska@suse.cz>
 
 	PR bootstrap/64914
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
index 23d22a8..d3be4aa 100644
--- a/libiberty/splay-tree.c
+++ b/libiberty/splay-tree.c
@@ -31,6 +31,9 @@ Boston, MA 02110-1301, USA.  */
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 #include <stdio.h>
 
@@ -590,3 +593,19 @@ splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
   else 
     return 0;
 }
+
+/* Splay-tree comparison function, treating the keys as strings.  */
+
+int
+splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
+{
+  return strcmp ((char *) k1, (char *) k2);
+}
+
+/* Splay-tree delete function, simply using free.  */
+
+void
+splay_tree_delete_pointers (splay_tree_value value)
+{
+  free ((void *) value);
+}
-- 
2.7.4

>From 71d41dcc0fd7bd7e287839fc8dbdd7d047501c56 Mon Sep 17 00:00:00 2001
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 30 Apr 2018 18:00:49 +0000
Subject: [PATCH]        * argv.c (expandargv): Fix memory leak for expanded   
      arguments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libiberty/ChangeLog | 4 ++++
 libiberty/argv.c    | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 742b2fa..a116d37 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-30  Daniel van Gerpen  <daniel@vangerpen.de>
+
+	* argv.c (expandargv): Fix memory leak for copied argv.
+
 2018-04-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	PR lto/81968
diff --git a/libiberty/argv.c b/libiberty/argv.c
index 4f66c89..8ead947 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -455,6 +455,8 @@ expandargv (int *argcp, char ***argvp)
       file_argc = 0;
       while (file_argv[file_argc])
 	++file_argc;
+      /* Free the original option's memory.  */
+      free ((*argvp)[i]);
       /* Now, insert FILE_ARGV into ARGV.  The "+1" below handles the
 	 NULL terminator at the end of ARGV.  */ 
       *argvp = ((char **) 
-- 
2.7.4

>From f7eadf51a8cd6e94ba33cd0b5b2a5063145859d6 Mon Sep 17 00:00:00 2001
From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 10 May 2018 10:15:42 +0000
Subject: [PATCH] Improve boostrap-ubsan config (PR bootstrap/64914).

2018-05-10  Martin Liska  <mliska@suse.cz>

	PR bootstrap/64914
	* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260112 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libiberty/ChangeLog       | 5 +++++
 libiberty/md5.c           | 2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index a116d37..b249226 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-10  Martin Liska  <mliska@suse.cz>
+
+	PR bootstrap/64914
+	* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.
+
 2018-04-30  Daniel van Gerpen  <daniel@vangerpen.de>
 
 	* argv.c (expandargv): Fix memory leak for copied argv.
diff --git a/libiberty/md5.c b/libiberty/md5.c
index f106d22..4dd5186a 100644
--- a/libiberty/md5.c
+++ b/libiberty/md5.c
@@ -231,7 +231,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
   /* Process available complete blocks.  */
   if (len > 64)
     {
-#if !_STRING_ARCH_unaligned
+#if !_STRING_ARCH_unaligned || defined UBSAN_BOOTSTRAP
 /* To check alignment gcc has an appropriate operator.  Other
    compilers don't.  */
 # if __GNUC__ >= 2
-- 
2.7.4


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