Skip to contentSkip to conversation

tcg: __jit_debug_descriptor must *not* be static

PATCH New Jim Meyering 1 participant 1 message May 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/9 tcg: __jit_debug_descriptor must *not* be static

From: Jim Meyering <[email protected]>

Add comments so no one else will be tempted to reduce the scope of this global variable.

---

 tcg/tcg.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tcg/tcg.c +7 -3
index ab589c7..2793fa6 100644
@@ -2264,7 +2264,9 @@ void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
    (3) Call tcg_register_jit_int, with the constructed .debug_frame.
 */
 
-/* Begin GDB interface.  THE FOLLOWING MUST MATCH GDB DOCS.  */
+/* Begin GDB interface.  THE FOLLOWING MUST MATCH GDB DOCS:
+   http://sourceware.org/gdb/onlinedocs/gdb/Declarations.html
+*/
 typedef enum {
     JIT_NOACTION = 0,
     JIT_REGISTER_FN,
@@ -2291,8 +2293,10 @@ void __jit_debug_register_code(void)
     asm("");
 }
 
-/* Must statically initialize the version, because GDB may check
-   the version before we can set it.  */
+/* We must initialize the version this way, because GDB may check
+   the version before we can set it.  This declaration must have
+   external scope.  If it were "static", an aggressive compiler might
+   notice that we never read this symbol and remove it altogether. */
 struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
 
 /* End GDB interface.  */

--
1.7.10.2.552.gaa3bb87