--- ./gdb/xcoffread.c_org	2013-04-02 17:52:55 +0600
+++ ./gdb/xcoffread.c	2013-04-03 14:55:54 +0600
@@ -592,7 +592,7 @@ static struct partial_symtab *this_symta
 static void
 process_linenos (CORE_ADDR start, CORE_ADDR end)
 {
-  int offset, ii;
+  int offset, ii, jj;
   file_ptr max_offset =
     ((struct coff_symfile_info *) this_symtab_psymtab->objfile
      ->deprecated_sym_private)->max_lineno_offset;
@@ -689,10 +689,22 @@ process_linenos (CORE_ADDR start, CORE_A
 
       lv = main_subfile.line_vector;
 
+      /* xlc compiled binaries have one less entry in the line table.
+         So the function entry lines marked as line number equal to 0 will be
+         retained in the line table with line numbers equal to its succeeding
+         line table entry. */
+
+      lineTb = lv;
+      for (jj = 0; jj < lineTb->nitems; jj++)
+        {
+          if (lineTb->item[jj].line == 0 && (lineTb->item[jj].pc != lineTb->item[jj+1].pc))
+                    lineTb->item[jj].line = lineTb->item[jj+1].line;
+        }
+
       /* Line numbers are not necessarily ordered.  xlc compilation will
          put static function to the end.  */
 
-      lineTb = arrange_linetable (lv);
+      lineTb = arrange_linetable (lineTb);
       if (lv == lineTb)
 	{
 	  current_subfile->line_vector = (struct linetable *)
@@ -721,10 +733,22 @@ process_linenos (CORE_ADDR start, CORE_A
 
 	  lv = (inclTable[ii].subfile)->line_vector;
 
+          /* xlc compiled binaries have one less entry in the line table.
+             So the function entry lines marked as line number equal to 0 will be
+             retained in the line table with line numbers equal to its succeeding
+             line table entry. */
+
+          lineTb = lv;
+          for (jj = 0; jj < lineTb->nitems; jj++)
+            {
+              if (lineTb->item[jj].line == 0 && (lineTb->item[jj].pc != lineTb->item[jj+1].pc))
+                    lineTb->item[jj].line = lineTb->item[jj+1].line;
+            }
+
 	  /* Line numbers are not necessarily ordered.  xlc compilation will
 	     put static function to the end.  */
 
-	  lineTb = arrange_linetable (lv);
+	  lineTb = arrange_linetable (lineTb);
 
 	  push_subfile ();
 
@@ -1006,7 +1030,7 @@ read_xcoff_symtab (struct partial_symtab
   unsigned int max_symnum;
   int just_started = 1;
   int depth = 0;
-  int fcn_start_addr = 0;
+  file_ptr fcn_start_addr = 0;
 
   struct coff_symbol fcn_stab_saved = { 0 };
 
@@ -1014,7 +1038,7 @@ read_xcoff_symtab (struct partial_symtab
   union internal_auxent fcn_aux_saved = main_aux;
   struct context_stack *new;
 
-  char *filestring = " _start_ ";	/* Name of the current file.  */
+  char *filestring = pst -> filename;	/* Name of the current file.  */
 
   const char *last_csect_name;	/* Last seen csect's name.  */
 
@@ -1108,7 +1132,8 @@ read_xcoff_symtab (struct partial_symtab
       }
 
       /* if symbol name starts with ".$" or "$", ignore it.  */
-      if (cs->c_name[0] == '$'
+      /* We also need to skip symbols starting with @FIX, which are used for TOC reference */
+      if (cs->c_name[0] == '$' || !strncmp(cs->c_name, "@FIX", 4)
 	  || (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
 	continue;
 
@@ -1128,8 +1153,7 @@ read_xcoff_symtab (struct partial_symtab
 	  /* Done with all files, everything from here on is globals.  */
 	}
 
-      if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT)
-	  && cs->c_naux == 1)
+      if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT))
 	{
 	  /* Dealing with a symbol with a csect entry.  */
 
@@ -1140,8 +1164,25 @@ read_xcoff_symtab (struct partial_symtab
 #define	CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
 
 	  /* Convert the auxent to something we can access.  */
-	  bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
-				0, cs->c_naux, &main_aux);
+             /* xcoff can have more than 1 auxent */
+             if (cs->c_naux > 1)
+               {
+                 if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
+                  {
+                   bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
+                   0, cs->c_naux, &main_aux);
+                   goto function_entry_point;
+                  }
+            else
+                 bfd_coff_swap_aux_in (abfd,
+                                        raw_auxptr + ((coff_data (abfd)->local_symesz) * (cs->c_naux - 1)),
+                                        cs->c_type, cs->c_sclass, cs->c_naux - 1, cs->c_naux, &main_aux);
+               }
+             else if (cs->c_naux == 1)
+                 bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
+                                       0, cs->c_naux, &main_aux);
+             else
+                continue ;
 
 	  switch (CSECT_SMTYP (&main_aux))
 	    {
