Add support to GDB for the Renesas rl78 architecture.
[external/binutils.git] / gas / config / obj-macho.c
index 988b098..f4706ab 100644 (file)
@@ -434,7 +434,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
   symbolS *sym = NULL;
   unsigned int align = 0;
   unsigned int specified_mask = 0;
-  offsetT size;
+  offsetT size = 0;
 
 #ifdef md_flush_pending_output
   md_flush_pending_output ();
@@ -1630,14 +1630,18 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec,
              
              for (isym = list, n = 0; isym != NULL; isym = isym->next, n++)
                {
+                 sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
                  /* Array is init to NULL & NULL signals a local symbol
                     If the section is lazy-bound, we need to keep the
-                    reference to the symbol, since dyld can override.  */
-                 if (S_IS_LOCAL (isym->sym) && ! lazy)
+                    reference to the symbol, since dyld can override.
+                    
+                    Absolute symbols are handled specially.  */
+                 if (sym->symbol.section == bfd_abs_section_ptr)
+                   ms->indirect_syms[n] = sym;
+                 else if (S_IS_LOCAL (isym->sym) && ! lazy)
                    ;
                  else
                    {
-                     sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
                      if (sym == NULL)
                        ;
                      /* If the symbols is external ...  */
@@ -1675,6 +1679,23 @@ obj_mach_o_frob_file_after_relocs (void)
   bfd_map_over_sections (stdoutput, obj_mach_o_set_indirect_symbols, (char *) 0);
 }
 
+/* Reverse relocations order to make ld happy.  */
+
+void
+obj_mach_o_reorder_section_relocs (asection *sec, arelent **rels, unsigned int n)
+{
+  unsigned int i;
+  unsigned int max = n / 2;
+
+  for (i = 0; i < max; i++)
+    {
+      arelent *r = rels[i];
+      rels[i] = rels[n - i - 1];
+      rels[n - i - 1] = r;
+    }
+  bfd_set_reloc (stdoutput, sec, rels, n);
+}
+
 /* Support stabs for mach-o.  */
 
 void