[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mklibs patch for SPARC64



This patch fixes a problem using mklibs for SPARC64.  The psABI for this 
platform involves undefined, null-name symbols of type STT_SPARC_REGISTER 
describing how registers are used by objects, which are not of any use to 
mklibs (which cannot handle unnamed symbols in the output of 
mklibs-readelf).

Index: src/mklibs-readelf/main.cpp
===================================================================
--- src/mklibs-readelf/main.cpp	(revision 55961)
+++ src/mklibs-readelf/main.cpp	(working copy)
@@ -82,15 +82,18 @@
   }
 }
 
-static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section)
+static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section, uint16_t machine)
 {
   for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
   {
     const Elf::symbol *symbol = *it;
     uint8_t bind = symbol->get_bind ();
     uint16_t shndx = symbol->get_shndx ();
+    uint8_t type = symbol->get_type ();
     if (shndx != SHN_UNDEF)
       continue;
+    if (machine == EM_SPARCV9 && type == STT_SPARC_REGISTER)
+      continue;
     if (bind == STB_GLOBAL || bind == STB_WEAK)
       std::cout <<
         symbol->get_name_string () << ' ' <<
@@ -125,7 +128,8 @@
       process_symbols_provided (file->get_section_DYNSYM ());
       break;
     case COMMAND_PRINT_SYMBOLS_UNDEFINED:
-      process_symbols_undefined (file->get_section_DYNSYM ());
+      process_symbols_undefined (file->get_section_DYNSYM (),
+				 file->get_machine ());
       break;
   }
 }

-- 
Joseph S. Myers
joseph@codesourcery.com


Reply to: