From 581bc4de55b720e9d4b53d7ca6297d0f07b622ca Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 8 Aug 1996 22:26:12 +0000 Subject: [PATCH] Fix for G++ not knowing whether a vtable will be private or public when the TOC reference is updated From-SVN: r12605 --- gcc/config/rs6000/rs6000.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 00ec109f87f..33a544c22ea 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4128,7 +4128,23 @@ output_toc (file, x, labelno) fputs ("[TC],", file); } - output_addr_const (file, x); + + /* Currently C++ toc references to vtables can be emitted before it + is decided whether the vtable is public or private. If this is + the case, then the linker will eventually complain that there is + a TOC reference to an unknown section. Thus, for vtables only, + we emit the TOC reference to reference the symbol and not the + section. */ + if (!strncmp ("_vt.", real_name, 4)) + { + RS6000_OUTPUT_BASENAME (file, real_name); + if (offset < 0) + fprintf (file, "%d", offset); + else if (offset > 0) + fprintf (file, "+%d", offset); + } + else + output_addr_const (file, x); putc ('\n', file); } -- 2.30.2