This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Remove libio C++ vtable definitions
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 5 Sep 2012 00:25:07 +0000
- Subject: Remove libio C++ vtable definitions
_G_config.h has various definitions relating to C++ vtables, a relic
of when libio was used in libstdc++ (it was removed from there in
2003). These are no longer relevant, and code in libio relating to
building as C++ is generally no longer relevant.
This patch removes _G_NAMES_HAVE_UNDERSCORE,
_G_VTABLE_LABEL_HAS_LENGTH, _G_VTABLE_LABEL_PREFIX and
_G_VTABLE_LABEL_PREFIX_ID. The first was completely unused; the
others weren't used (beyond in the definition of an unused macro)
unless __cplusplus was defined in libioP.h; this patch removes the
dead code from libioP.h.
There remains _G_USING_THUNKS in this set of definitions in
_G_config.h. That one is used, but I think the right thing to do is
to eliminate the conditionals and make libio unconditionally use the
case where _G_USING_THUNKS is defined. The other case is only used
with the sysdeps/generic version of the header, not the sysdeps/gnu or
sysdeps/mach/hurd versions - that is, no current port uses it and it
is not well-tested. (GNU/KFreeBSD, as in Debian, defines
_G_USING_THUNKS in its version of _G_config.h so no issues would be
caused for that port by its removal either.)
Tested x86_64.
2012-09-05 Joseph Myers <joseph@codesourcery.com>
* libio/libioP.h [__GNUC__] (VTABLE_LABEL): Remove.
[!builtinbuf_vtable && __cplusplus] (builtinbuf_vtable): Likewise.
* sysdeps/generic/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
(_G_VTABLE_LABEL_PREFIX): Likewise.
(_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
* sysdeps/gnu/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
(_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
(_G_VTABLE_LABEL_PREFIX): Likewise.
(_G_VTABLE_LABEL_PREFIX_ID): Likewise.
* sysdeps/mach/hurd/_G_config.h (_G_NAMES_HAVE_UNDERSCORE): Remove.
(_G_VTABLE_LABEL_HAS_LENGTH): Likewise.
(_G_VTABLE_LABEL_PREFIX): Likewise.
(_G_VTABLE_LABEL_PREFIX_ID): Likewise.
diff --git a/libio/libioP.h b/libio/libioP.h
index aa2b3bf..c8dbac5 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -862,30 +862,6 @@ extern int _IO_vscanf (const char *, _IO_va_list) __THROW;
# endif
#endif
-/* VTABLE_LABEL defines NAME as of the CLASS class.
- CNLENGTH is strlen(#CLASS). */
-#ifdef __GNUC__
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
-# else
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
-# endif
-#endif /* __GNUC__ */
-
-#if !defined(builtinbuf_vtable) && defined(__cplusplus)
-# ifdef __GNUC__
-VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
-# else
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
-# else
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
-# endif
-# endif
-#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
-
#define _IO_va_start(args, last) va_start(args, last)
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index 6f75682..769b10f 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -77,9 +77,4 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
-/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_PREFIX "_vt."
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
-
#endif /* _G_config.h */
diff --git a/sysdeps/gnu/_G_config.h b/sysdeps/gnu/_G_config.h
index 9d6e23b..478dbe1 100644
--- a/sysdeps/gnu/_G_config.h
+++ b/sysdeps/gnu/_G_config.h
@@ -84,10 +84,6 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
#define _G_USING_THUNKS 1
-#define _G_VTABLE_LABEL_PREFIX "__vt_"
-#define _G_VTABLE_LABEL_PREFIX_ID __vt_
#endif /* _G_config.h */
diff --git a/sysdeps/mach/hurd/_G_config.h b/sysdeps/mach/hurd/_G_config.h
index 9ecd4aa..2f683d4 100644
--- a/sysdeps/mach/hurd/_G_config.h
+++ b/sysdeps/mach/hurd/_G_config.h
@@ -83,10 +83,6 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_BUFSIZ 8192
/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
#define _G_USING_THUNKS 1
-#define _G_VTABLE_LABEL_PREFIX "__vt_"
-#define _G_VTABLE_LABEL_PREFIX_ID __vt_
#endif /* _G_config.h */
--
Joseph S. Myers
joseph@codesourcery.com