This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Sync libiberty with gcc
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: Pedro Alves <alves dot ped at gmail dot com>
- Cc: gdb-patches at sourceware dot org, Binutils Development <binutils at sourceware dot org>
- Date: Sat, 11 Oct 2014 10:07:55 +0100
- Subject: Re: [PATCH] Sync libiberty with gcc
- Authentication-results: sourceware.org; auth=none
- References: <CABOHX+fvzPGoKSc6d_0xhQvhO5VHXUqM1ZSqmgSdAQzmPj-ZDA at mail dot gmail dot com> <5437F31F dot 4090601 at gmail dot com>
On 10 October 2014 15:54, Pedro Alves <alves.ped@gmail.com> wrote:
> On 09/29/2014 07:42 PM, Iain Buclaw wrote:
>> This patch to syncs libiberty with upstream gcc.
>>
>> Largest change here is the addition of demangling dlang symbols, which
>> means following this will be the removal of dlang demangling on gdb's
>> side.
>
> Thank Iain. Please go ahead and push.
>
>>
>> -- Iain.
>>
>>
>> libiberty/
>> 2014-09-26 Jason Merrill <jason@redhat.com>
>>
>> * cp-demangle.c (d_substitution): Handle abi tags on abbreviation.
>>
>> 2014-09-26 Max Ostapenko <m.ostapenko@partner.samsung.com>
>>
>> * pex-common.h (struct pex_funcs): Add new parameter for
>> open_write field.
>> * pex-unix.c (pex_unix_open_write): Add support for new parameter.
>> * pex-djgpp.c (pex_djgpp_open_write): Likewise.
>> * pex-win32.c (pex_win32_open_write): Likewise.
>> * pex-common.c (pex_run_in_environment): Likewise.
>>
>> 2014-09-23 Iain Buclaw <ibuclaw@gdcproject.org>
>>
>> * Makefile.in (CFILES): Add d-demangle.c.
>> (REQUIRED_OFILES): Add d-demangle.o.
>> * cplus-dem.c (libiberty_demanglers): Add dlang_demangling case.
>> (cplus_demangle): Likewise.
>> * d-demangle.c: New file.
>> * testsuite/Makefile.in (really-check): Add check-d-demangle.
>> * testsuite/d-demangle-expected: New file.
>>
>> 2014-09-19 Ian Lance Taylor <iant@google.com>
>>
>> * simple-object-elf.c (simple_object_elf_write_ehdr): Correctly
>> handle objects with more than SHN_LORESERVE sections.
>> (simple_object_elf_write_shdr): Add sh_link parameter.
>> (simple_object_elf_write_to_file): Correctly handle objects with
>> more than SHN_LORESERVE sections.
>>
>> 2014-08-29 Andrew Burgess <aburgess@broadcom.com>
>>
>> * cp-demangle.c (d_dump): Only access field from s_fixed part of
>> the union for DEMANGLE_COMPONENT_FIXED_TYPE.
>> (d_count_templates_scopes): Likewise.
>>
>> 2014-08-13 Gary Benson <gbenson@redhat.com>
>>
>> * testsuite/demangler-fuzzer.c: New file.
>> * testsuite/Makefile.in (fuzz-demangler): New rule.
>> (demangler-fuzzer): Likewise.
>> (mostlyclean): Clean up demangler fuzzer.
>> ---
>>
>
>
> Thanks,
> Pedro Alves
Thanks Pedro.
Just FYI - forgot to include the patch to the headers, changelog below.
-- Iain
include/
2014-09-26 Max Ostapenko <m.ostapenko@partner.samsung.com>
* libiberty.h (PEX_STDOUT_APPEND): New flag.
(PEX_STDERR_APPEND): Likewise.
2014-09-23 Iain Buclaw <ibuclaw@gdcproject.org>
* demangle.h (DMGL_DLANG): New macro.
(DMGL_STYLE_MASK): Add DMGL_DLANG.
(demangling_styles): Add dlang_demangling.
(DLANG_DEMANGLING_STYLE_STRING): New macro.
(DLANG_DEMANGLING): New macro.
(dlang_demangle): New prototype.
2014-09-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* longlong.h: Add __udiv_w_sdiv prototype.
---
diff --git a/include/demangle.h b/include/demangle.h
index bbad71b..d2a6731 100644
--- a/include/demangle.h
+++ b/include/demangle.h
@@ -63,9 +63,10 @@ extern "C" {
#define DMGL_EDG (1 << 13)
#define DMGL_GNU_V3 (1 << 14)
#define DMGL_GNAT (1 << 15)
+#define DMGL_DLANG (1 << 16)
/* If none of these are set, use 'current_demangling_style' as the default. */
-#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)
+#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG)
/* Enumeration of possible demangling styles.
@@ -87,7 +88,8 @@ extern enum demangling_styles
edg_demangling = DMGL_EDG,
gnu_v3_demangling = DMGL_GNU_V3,
java_demangling = DMGL_JAVA,
- gnat_demangling = DMGL_GNAT
+ gnat_demangling = DMGL_GNAT,
+ dlang_demangling = DMGL_DLANG
} current_demangling_style;
/* Define string names for the various demangling styles. */
@@ -102,6 +104,7 @@ extern enum demangling_styles
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
#define JAVA_DEMANGLING_STYLE_STRING "java"
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
+#define DLANG_DEMANGLING_STYLE_STRING "dlang"
/* Some macros to test what demangling style is active. */
@@ -115,6 +118,7 @@ extern enum demangling_styles
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
+#define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG)
/* Provide information about the available demangle styles. This code is
pulled from gdb into libiberty because it is useful to binutils also. */
@@ -169,6 +173,9 @@ java_demangle_v3 (const char *mangled);
char *
ada_demangle (const char *mangled, int options);
+extern char *
+dlang_demangle (const char *mangled, int options);
+
enum gnu_v3_ctor_kinds {
gnu_v3_complete_object_ctor = 1,
gnu_v3_base_object_ctor,
diff --git a/include/libiberty.h b/include/libiberty.h
index 78c42eb..bcc1f9a 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -106,7 +106,10 @@ extern int countargv (char**);
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */
#if !HAVE_DECL_BASENAME
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
#else
/* Do not allow basename to be used if there is no prototype seen. We
@@ -442,6 +445,11 @@ extern struct pex_obj *pex_init (int flags, const char *pname,
on Unix. */
#define PEX_BINARY_ERROR 0x80
+/* Append stdout to existing file instead of truncating it. */
+#define PEX_STDOUT_APPEND 0x100
+
+/* Thes same as PEX_STDOUT_APPEND, but for STDERR. */
+#define PEX_STDERR_APPEND 0x200
/* Execute one program. Returns NULL on success. On error returns an
error string (typically just the name of a system call); the error
@@ -633,6 +641,10 @@ extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
#endif
+#if defined (HAVE_DECL_STRNLEN) && !HAVE_DECL_STRNLEN
+extern size_t strnlen (const char *, size_t);
+#endif
+
#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
/* Compare version strings. */
extern int strverscmp (const char *, const char *);
diff --git a/include/longlong.h b/include/longlong.h
index 31f88cb..42c68dd 100644
--- a/include/longlong.h
+++ b/include/longlong.h
@@ -1687,7 +1687,8 @@ extern UHItype __stormy16_count_leading_zeros (UHItype);
#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)
#define udiv_qrnnd(q, r, nh, nl, d) \
do { \
- USItype __r; \
+ extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype); \
+ UWtype __r; \
(q) = __udiv_w_sdiv (&__r, nh, nl, d); \
(r) = __r; \
} while (0)