[kernel] r6307 - people/waldi/linux-kbuild-2.6/src/mod

Bastian Blank waldi at costa.debian.org
Tue Mar 28 12:14:46 UTC 2006


Author: waldi
Date: Tue Mar 28 12:14:45 2006
New Revision: 6307

Modified:
   people/waldi/linux-kbuild-2.6/src/mod/module.cpp
   people/waldi/linux-kbuild-2.6/src/mod/module.hpp
Log:
src/mod/module.cpp, src/mod/module.hpp: Really support ppc64 prefixed symbol names.


Modified: people/waldi/linux-kbuild-2.6/src/mod/module.cpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module.cpp	(original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module.cpp	Tue Mar 28 12:14:45 2006
@@ -173,9 +173,6 @@
     Elf::symbol *symbol = *it;
     std::string symname = symbol->get_name_string ();
 
-    if (symname[0] == '.')
-      symname.erase (0, 1);
-
     switch (symbol->get_shndx ())
     {
       case SHN_COMMON:
@@ -261,10 +258,9 @@
     "\n"
     "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"
     "\n"
-    "#undef unix\n" /* We have a module called "unix" */
     "struct module __this_module\n"
     "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"
-    " .name = __stringify(KBUILD_MODNAME),\n";
+    " .name = KBUILD_MODNAME,\n";
   if (has_init)
     out << " .init = init_module,\n";
   if (has_cleanup)
@@ -298,7 +294,7 @@
     "__attribute_used__\n"
     "__attribute__((section(\"__versions\"))) = {\n";
 
-  for (std::map<std::string, symbol_undefined>::const_iterator it = symbols_undefined.begin (); it != symbols_undefined.end (); ++it)
+  for (_symbols_undefined::const_iterator it = symbols_undefined.begin (); it != symbols_undefined.end (); ++it)
   {
     try
     {
@@ -394,7 +390,7 @@
   throw std::out_of_range ("Don't find module");
 }
 
-const module *modulelist::get_module_for_symbol (const std::string &name) const throw (std::out_of_range)
+const module *modulelist::get_module_for_symbol (const symbolname &name) const throw (std::out_of_range)
 {
   _symbols::const_iterator it = symbols_exported.find (name);
   if (it == symbols_exported.end ())
@@ -402,13 +398,13 @@
   return get_module (it->second);
 }
 
-const std::string &modulelist::get_module_name_short_for_symbol (const std::string &name) const throw (std::out_of_range)
+const std::string &modulelist::get_module_name_short_for_symbol (const symbolname &name) const throw (std::out_of_range)
 {
   const module *mod = get_module_for_symbol (name);
   return mod->get_name_short ();
 }
 
-const symbol_exported &modulelist::get_symbol (const std::string &name) const throw (std::out_of_range)
+const symbol_exported &modulelist::get_symbol (const symbolname &name) const throw (std::out_of_range)
 {
   const module *mod = get_module_for_symbol (name);
   std::map<std::string, symbol_exported>::const_iterator it = mod->get_symbols_exported ().find (name);
@@ -460,15 +456,15 @@
     it->second->write (*this, modversions);
 }
 
-symbol::symbol (const std::string &name) throw ()
+symbol::symbol (const symbolname &name) throw ()
 : name (name)
 { }
 
-symbol_exported::symbol_exported (const std::string &name) throw ()
+symbol_exported::symbol_exported (const symbolname &name) throw ()
 : symbol (name), crc_valid (false)
 { }
 
-symbol_exported::symbol_exported (const std::string &name, uint32_t crc) throw ()
+symbol_exported::symbol_exported (const symbolname &name, uint32_t crc) throw ()
 : symbol (name), crc (crc), crc_valid (true)
 { }
 
@@ -478,7 +474,7 @@
   crc_valid = true;
 }
 
-symbol_undefined::symbol_undefined (const std::string &name, bool weak) throw ()
+symbol_undefined::symbol_undefined (const symbolname &name, bool weak) throw ()
 : symbol (name), weak (weak)
 { }
 

Modified: people/waldi/linux-kbuild-2.6/src/mod/module.hpp
==============================================================================
--- people/waldi/linux-kbuild-2.6/src/mod/module.hpp	(original)
+++ people/waldi/linux-kbuild-2.6/src/mod/module.hpp	Tue Mar 28 12:14:45 2006
@@ -31,25 +31,28 @@
 namespace linuxkernel
 {
   class modulelist;
+  class symbolname;
   class symbol_exported;
   class symbol_undefined;
 
   class module
   {
     public:
+      typedef std::map<std::string, symbol_exported> _symbols_exported;
+
       module (const std::string &name) throw ();
 
       bool get_is_vmlinux () const throw () { return is_vmlinux; }
       const std::string &get_name () const throw () { return name; }
       const std::string &get_name_short () const throw () { return name_short; }
-      const std::map<std::string, symbol_exported> &get_symbols_exported () const throw () { return symbols_exported; }
+      const _symbols_exported &get_symbols_exported () const throw () { return symbols_exported; }
 
     protected:
       module (const std::string &filename, bool) throw ();
 
       std::string name, name_short;
       bool is_vmlinux;
-      std::map<std::string, symbol_exported> symbols_exported;
+      _symbols_exported symbols_exported;
 
       friend class modulelist;
   };
@@ -57,6 +60,8 @@
   class module_real : public module
   {
     public:
+      typedef std::map<std::string, symbol_undefined> _symbols_undefined;
+
       module_real (const std::string &filename, Elf::file *file) throw (std::runtime_error);
 
       const Elf::symbol *_get_symbol (const std::string &name) const throw ();
@@ -83,7 +88,7 @@
       void write_versions (std::ostream &, const modulelist &);
 
       std::map<std::string, std::string> modinfo;
-      std::map<std::string, symbol_undefined> symbols_undefined;
+      _symbols_undefined symbols_undefined;
       bool has_init;
       bool has_cleanup;
       Elf::section_type<Elf::section_type_SYMTAB> *symtab;
@@ -122,9 +127,9 @@
       const _modules_real &get_modules_real () const throw () { return modules_real; }
       const _modules_shadow &get_modules_shadow () const throw () { return modules_shadow; }
       const module *get_module (const std::string &name) const throw (std::out_of_range);
-      const module *get_module_for_symbol (const std::string &name) const throw (std::out_of_range);
-      const std::string &get_module_name_short_for_symbol (const std::string &name) const throw (std::out_of_range);
-      const symbol_exported &get_symbol (const std::string &name) const throw (std::out_of_range);
+      const module *get_module_for_symbol (const symbolname &name) const throw (std::out_of_range);
+      const std::string &get_module_name_short_for_symbol (const symbolname &name) const throw (std::out_of_range);
+      const symbol_exported &get_symbol (const symbolname &name) const throw (std::out_of_range);
       const _symbols &get_symbols_exported () const throw () { return symbols_exported; }
 
       void insert (module_real *) throw (std::runtime_error);
@@ -140,24 +145,42 @@
       _symbols symbols_exported;
   };
 
+  class symbolname : public std::string
+  {
+    public:
+      symbolname () throw () {}
+      symbolname (const std::string &name) throw ()
+      : std::string (name)
+      {
+        if (size () && at (0) == '.')
+          erase (0, 1);
+      }
+      symbolname (const char *name) throw ()
+      : std::string (name)
+      {
+        if (size () && at (0) == '.')
+          erase (0, 1);
+      }
+  };
+
   class symbol
   {
     public:
       symbol () throw () {}
-      symbol (const std::string &name) throw ();
+      symbol (const symbolname &name) throw ();
 
-      const std::string &get_name () const throw () { return name; }
+      const symbolname &get_name () const throw () { return name; }
 
     protected:
-      std::string name;
+      symbolname name;
   };
 
   class symbol_exported : public symbol
   {
     public:
       symbol_exported () throw () {}
-      symbol_exported (const std::string &name) throw ();
-      symbol_exported (const std::string &name, uint32_t) throw ();
+      symbol_exported (const symbolname &name) throw ();
+      symbol_exported (const symbolname &name, uint32_t) throw ();
 
       uint32_t get_crc () const throw () { return crc; }
       bool get_crc_valid () const throw () { return crc_valid; }
@@ -172,7 +195,7 @@
   {
     public:
       symbol_undefined () throw () {}
-      symbol_undefined (const std::string &name, bool weak) throw ();
+      symbol_undefined (const symbolname &name, bool weak) throw ();
 
     protected:
       bool weak;



More information about the Kernel-svn-changes mailing list