This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Ignore thread local symbols when generating dbx debug info
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: wilson at specifixinc dot com
- Date: Sat, 29 Dec 2007 12:44:53 -0500 (EST)
- Subject: [patch] Ignore thread local symbols when generating dbx debug info
The enclosed patch fixes PR libgomp/31510. When emulated TLS support
was added, no thought was given as to how to handle dbx debug information.
As a result, we have undefined symbols being referenced in the dbx
debug information.
The enclosed patch is an attempt to fix this. Here I just ignore
the TLS symbols. It might be possible to actually generate correct
variable names, although I don't know if gdb would understand them.
Tested on hppa2.0w-hp-hpux11.11 with no regressions.
Ok for trunk?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2007-12-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR libgomp/31510
* dbxout.c (dbxout_symbol_location): Don't mention thread local
variables and symbols which have a thread local address if the target
doesn't have TLS support.
Index: dbxout.c
===================================================================
--- dbxout.c (revision 131213)
+++ dbxout.c (working copy)
@@ -2816,6 +2816,11 @@
int number = 0;
int regno = -1;
+ if (!targetm.have_tls
+ && TREE_CODE (decl) == VAR_DECL
+ && DECL_THREAD_LOCAL_P (decl))
+ return 0;
+
/* Don't mention a variable at all
if it was completely optimized into nothingness.
@@ -3030,6 +3035,26 @@
want us to ignore this variable. */
return 0;
+ /* Ignore thread local addresses if target dosen't have TLS. */
+ if (!targetm.have_tls && addr)
+ {
+ rtx tmp;
+
+ if (GET_CODE (addr) == SYMBOL_REF)
+ tmp = addr;
+ else if (GET_CODE (addr) == PLUS
+ && GET_CODE (XEXP (addr, 0)) == SYMBOL_REF)
+ tmp = XEXP (addr, 0);
+ else
+ tmp = NULL;
+
+ if (tmp
+ && SYMBOL_REF_DECL (tmp)
+ && TREE_CODE (SYMBOL_REF_DECL (tmp)) == VAR_DECL
+ && DECL_THREAD_LOCAL_P (SYMBOL_REF_DECL (tmp)))
+ return 0;
+ }
+
/* Ok, start a symtab entry and output the variable name. */
emit_pending_bincls_if_required ();
FORCE_TEXT;