This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dwarf branch now builds and runs against gcc 4.6


Hi,

Since gcc 4.6 was just released (and fedora rawhide already packages it
as system compiler) Petr and I (well mostly Petr) hacked the dwarf
branch into submission to get the dwarf branch to compile and run
against it.

One patch was for a strange compile issue, we don't fully understand,
since the new code should be exactly the same as the old one. But the
fix was simple once found. The other was a bug in that we relied on a
particular initialization order of the option global, which is now made
explicit. Both in the attached patch and committed to the dwarf branch.

Cheers,

Mark
commit 4b63527e857a148e21e3ed5073a491a103970fee
Author: Mark Wielaard <mjw@redhat.com>
Date:   Fri Apr 1 15:59:27 2011 +0200

    dwarflint: Turn global_opts into a static initializer function.
    
    Trick to make sure the static options are always initialized
    before access (it is used from various global initializers).

diff --git a/dwarflint/option.cc b/dwarflint/option.cc
index 420493e..d87d22f 100644
--- a/dwarflint/option.cc
+++ b/dwarflint/option.cc
@@ -92,7 +92,7 @@ argppp &
 argppp::inst ()
 {
   static argppp my
-    (global_opts, dwarflint::main_registrar ()->get_descriptors ());
+    (global_opts (), dwarflint::main_registrar ()->get_descriptors ());
   return my;
 }
 
@@ -165,7 +165,7 @@ void
 argppp::parse (int argc, char **argv, unsigned flags, int *remaining)
 {
   assert (!_m_inited);
-  argp_parse (&_m_argp, argc, argv, flags, remaining, &global_opts);
+  argp_parse (&_m_argp, argc, argv, flags, remaining, &global_opts ());
 }
 
 void
@@ -209,4 +209,12 @@ option_common::option_common (char const *description,
   , _m_seen (false)
 {}
 
-options global_opts;
+// Trick to make sure the static options are always initialized
+// before access (it is used from various global initializers.
+
+options &
+global_opts ()
+{
+  static options inst;
+  return inst;
+}
diff --git a/dwarflint/option.hh b/dwarflint/option.hh
index 8016811..7afe10c 100644
--- a/dwarflint/option.hh
+++ b/dwarflint/option.hh
@@ -218,7 +218,7 @@ typedef xoption<void> void_option;
 typedef xoption<std::string> string_option;
 typedef xoption<unsigned> unsigned_option;
 
-extern options global_opts;
+options & global_opts ();
 
 template<class OPT>
 struct global_opt
@@ -228,7 +228,7 @@ struct global_opt
   global_opt (Args const&... args)
     : OPT (args...)
   {
-    global_opts.add (this);
+    global_opts ().add (this);
   }
 };
 

commit 77602d3ec71b95eb84faf2de4f4058ca13f6b2dc
Author: Petr Machata <pmachata@redhat.com>
Date:   Fri Apr 1 14:38:07 2011 +0200

    dwarflint: Work around a GCC compilation problem

diff --git a/dwarflint/check_debug_pub.cc b/dwarflint/check_debug_pub.cc
index 568db43..0f18e68 100644
--- a/dwarflint/check_debug_pub.cc
+++ b/dwarflint/check_debug_pub.cc
@@ -89,7 +89,8 @@ check_debug_pub<sec_id>::check_pub_structural ()
 
   while (!read_ctx_eof (&ctx))
     {
-      struct where where = WHERE (_m_sec->sect.id, NULL);
+      enum section_id sid = _m_sec->sect.id;
+      struct where where = WHERE (sid, NULL);
       where_reset_1 (&where, read_ctx_get_offset (&ctx));
       const unsigned char *set_begin = ctx.ptr;
 
@@ -219,7 +220,8 @@ check_debug_pub<sec_id>::check_pub_structural ()
 	  while (c);
 	}
 
-	struct where wh = WHERE (_m_sec->sect.id, NULL);
+	sid = _m_sec->sect.id;
+	struct where wh = WHERE (sid, NULL);
 	if (sub_ctx.ptr != sub_ctx.end)
 	  {
 	    uint64_t off_start, off_end;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]