[PATCH] gas: deprecate .vtable_entry and .vtable_inherit

Richard Earnshaw rearnsha@arm.com
Thu Jun 11 13:50:13 GMT 2026


These ELF directives were a GNU extension to support the C++ ABI
that was in use before the introduction of the generic C++ ABI in
GCC-3.0.  They're obsolete now and many newer targets simply
do not provide the back-end support for them.

Flag them as deprecated in the NEWS file, and remove the documentation
for them.  Warn (once) if the directive is used in a source file.
---
 gas/NEWS             |  6 ++++++
 gas/config/obj-elf.c | 16 ++++++++++++++++
 gas/doc/as.texi      |  8 ++++++++
 3 files changed, 30 insertions(+)

diff --git a/gas/NEWS b/gas/NEWS
index e384d1135c0..bcbc575cbc0 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,4 +1,10 @@
 -*- text -*-
+Changes in 2.47:
+
+* The legacy .vtable_entry and .vtable_inherit directives that were
+  needed for versions of gcc prior to gcc-3.0 (when the generic C++
+  ABI was adopted) are now considered obsolete.  They are now deprecated
+  and will be removed in a future release.
 
 Changes in 2.46:
 
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 09a224147e9..6850cab1902 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2019,6 +2019,14 @@ obj_elf_get_vtable_inherit (void)
 void
 obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
 {
+  static bool warned = false;
+
+  if (!warned)
+    {
+      warned = true;
+      as_warn(".vtable_inherit has been deprecated");
+    }
+
   (void) obj_elf_get_vtable_inherit ();
 }
 
@@ -2061,6 +2069,14 @@ obj_elf_get_vtable_entry (void)
 void
 obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
 {
+  static bool warned = false;
+
+  if (!warned)
+    {
+      warned = true;
+      as_warn("'.vtable_entry' has been deprecated");
+    }
+
   (void) obj_elf_get_vtable_entry ();
 }
 
diff --git a/gas/doc/as.texi b/gas/doc/as.texi
index 5c80a3100dc..3c4d20bd7d4 100644
--- a/gas/doc/as.texi
+++ b/gas/doc/as.texi
@@ -4724,8 +4724,11 @@ Some machine configurations provide additional directives.
 
 @ifset ELF
 * Version::                     @code{.version "@var{string}"}
+@ignore
 * VTableEntry::                 @code{.vtable_entry @var{table}, @var{offset}}
 * VTableInherit::               @code{.vtable_inherit @var{child}, @var{parent}}
+@end ignore
+
 @end ifset
 
 * Warnif::			@code{.warnif @var{expression}}
@@ -7796,7 +7799,11 @@ This directive creates a @code{.note} section and places into it an ELF
 formatted note of type NT_VERSION.  The note's name is set to @code{string}.
 @end ifset
 
+@ignore
 @ifset ELF
+@c .vtable_entry and .vtable_inherit were for the C++ implementation
+@c that predated the generic C++ ABI.  They're obsolete now, so
+@c don't include them in the documentation.
 @node VTableEntry
 @section @code{.vtable_entry @var{table}, @var{offset}}
 
@@ -7813,6 +7820,7 @@ This directive finds the symbol @code{child} and finds or creates the symbol
 parent whose addend is the value of the child symbol.  As a special case the
 parent name of @code{0} is treated as referring to the @code{*ABS*} section.
 @end ifset
+@end ignore
 
 @node Warnif
 @section @code{.warnif "@var{expression}"}
-- 
2.43.0



More information about the Binutils mailing list