* archive.c (_bfd_write_archive_contents): Revert June 1 change.
[deliverable/binutils-gdb.git] / bfd / coff-a29k.c
index 35e6ea353d7901124a6ac35579128c82aa1a1e54..fdcb430008d132e6904dcbe74b4463bc4ac840c9 100644 (file)
@@ -34,11 +34,16 @@ static bfd_reloc_status_type a29k_reloc
 static boolean coff_a29k_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
           struct internal_reloc *, struct internal_syment *, asection **));
+static boolean coff_a29k_adjust_symndx
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
+          struct internal_reloc *, boolean *));
+
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
 
 #define INSERT_HWORD(WORD,HWORD)       \
     (((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
 #define EXTRACT_HWORD(WORD) \
-    (((WORD) & 0x00ff0000) >> 8) | ((WORD)& 0xff)
+    ((((WORD) & 0x00ff0000) >> 8) | ((WORD)& 0xff))
 #define SIGN_EXTEND_HWORD(HWORD) \
     ((HWORD) & 0x8000 ? (HWORD)|0xffff0000 : (HWORD))
 
@@ -353,7 +358,10 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
       symndx = rel->r_symndx;
       loc = contents + rel->r_vaddr - input_section->vma;
 
-      h = obj_coff_sym_hashes (input_bfd)[symndx];
+      if (symndx == -1)
+       h = NULL;
+      else
+       h = obj_coff_sym_hashes (input_bfd)[symndx];
 
       sym = NULL;
       sec = NULL;
@@ -366,16 +374,22 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          if (h == NULL)
            {
-             sym = syms + symndx;
-             sec = sections[symndx];
-             val = (sec->output_section->vma
-                    + sec->output_offset
-                    + sym->n_value
-                    - sec->vma);
+             if (symndx == -1)
+               sec = bfd_abs_section_ptr;
+             else
+               {
+                 sym = syms + symndx;
+                 sec = sections[symndx];
+                 val = (sec->output_section->vma
+                        + sec->output_offset
+                        + sym->n_value
+                        - sec->vma);
+               }
            }
          else
            {
-             if (h->root.type == bfd_link_hash_defined)
+             if (h->root.type == bfd_link_hash_defined
+                 || h->root.type == bfd_link_hash_defweak)
                {
                  sec = h->root.u.def.section;
                  val = (h->root.u.def.value
@@ -497,7 +511,9 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
          const char *name;
          char buf[SYMNMLEN + 1];
 
-         if (h != NULL)
+         if (symndx == -1)
+           name = "*ABS*";
+         else if (h != NULL)
            name = h->root.root.string;
          else if (sym == NULL)
            name = "*unknown*";
@@ -524,6 +540,28 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
 
 #define coff_relocate_section coff_a29k_relocate_section
 
+/* We don't want to change the symndx of a R_IHCONST reloc, since it
+   is actually an addend, not a symbol index at all.  */
+
+/*ARGSUSED*/
+static boolean
+coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
+     bfd *obfd;
+     struct bfd_link_info *info;
+     bfd *ibfd;
+     asection *sec;
+     struct internal_reloc *irel;
+     boolean *adjustedp;
+{
+  if (irel->r_type == R_IHCONST)
+    *adjustedp = true;
+  else
+    *adjustedp = false;
+  return true;
+}
+
+#define coff_adjust_symndx coff_a29k_adjust_symndx
+
 #include "coffcode.h"
 
 const bfd_target a29kcoff_big_vec =
This page took 0.024355 seconds and 4 git commands to generate.