* Makefile.in (SFILES): Add cp-names.y.
[deliverable/binutils-gdb.git] / bfd / nlm32-alpha.c
index 7f74b52c0a41844e199f69d11f0923299ecd5065..3bf597b17870fd3619fc6447c9e3bde27194d308 100644 (file)
@@ -1,5 +1,6 @@
 /* Support for 32-bit Alpha NLM (NetWare Loadable Module)
-   Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -40,7 +41,7 @@ static bfd_boolean nlm_alpha_write_prefix
 static bfd_boolean nlm_alpha_read_reloc
   PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
 static bfd_boolean nlm_alpha_mangle_relocs
-  PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type));
+  PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type));
 static bfd_boolean nlm_alpha_read_import
   PARAMS ((bfd *, nlmNAME(symbol_type) *));
 static bfd_boolean nlm_alpha_write_import
@@ -96,6 +97,8 @@ nlm_alpha_write_prefix (abfd)
   return TRUE;
 }
 \f
+#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1)
+
 /* How to process the various reloc types.  */
 
 static reloc_howto_type nlm32_alpha_howto_table[] =
@@ -143,8 +146,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
         0,                     /* special_function */
         "REFQUAD",             /* name */
         TRUE,                  /* partial_inplace */
-        0xffffffffffffffff,    /* src_mask */
-        0xffffffffffffffff,    /* dst_mask */
+        ONES (64),             /* src_mask */
+        ONES (64),             /* dst_mask */
         FALSE),                /* pcrel_offset */
 
   /* A 32 bit GP relative offset.  This is just like REFLONG except
@@ -303,8 +306,8 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
         0,                     /* special_function */
         "SREL64",              /* name */
         TRUE,                  /* partial_inplace */
-        0xffffffffffffffff,    /* src_mask */
-        0xffffffffffffffff,    /* dst_mask */
+        ONES (64),             /* src_mask */
+        ONES (64),             /* dst_mask */
         FALSE),                /* pcrel_offset */
 
   /* Push a value on the reloc evaluation stack.  */
@@ -335,7 +338,7 @@ static reloc_howto_type nlm32_alpha_howto_table[] =
         "OP_STORE",            /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
-        0xffffffffffffffff,    /* dst_mask */
+        ONES (64),             /* dst_mask */
         FALSE),                /* pcrel_offset */
 
   /* Subtract the reloc address from the value on the top of the
@@ -487,7 +490,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
      or .data section.  R_NW_RELOC relocs don't really have a section,
      so we put them in .text.  */
   if (r_type == ALPHA_R_NW_RELOC
-      || r_vaddr < bfd_section_size (abfd, code_sec))
+      || r_vaddr < code_sec->size)
     {
       *secp = code_sec;
       rel->address = r_vaddr;
@@ -495,7 +498,7 @@ nlm_alpha_read_reloc (abfd, sym, secp, rel)
   else
     {
       *secp = data_sec;
-      rel->address = r_vaddr - bfd_section_size (abfd, code_sec);
+      rel->address = r_vaddr - code_sec->size;
     }
 
   /* We must adjust the addend based on the type.  */
@@ -605,7 +608,7 @@ static bfd_boolean
 nlm_alpha_mangle_relocs (abfd, sec, data, offset, count)
      bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec ATTRIBUTE_UNUSED;
-     PTR data ATTRIBUTE_UNUSED;
+     const PTR data ATTRIBUTE_UNUSED;
      bfd_vma offset ATTRIBUTE_UNUSED;
      bfd_size_type count ATTRIBUTE_UNUSED;
 {
@@ -686,9 +689,7 @@ nlm_alpha_write_import (abfd, sec, rel)
     {
       r_vaddr = bfd_get_section_vma (abfd, sec) + rel->address;
       if ((sec->flags & SEC_CODE) == 0)
-       r_vaddr += bfd_section_size (abfd,
-                                    bfd_get_section_by_name (abfd,
-                                                             NLM_CODE_NAME));
+       r_vaddr += bfd_get_section_by_name (abfd, NLM_CODE_NAME) -> size;
       if (bfd_is_und_section (bfd_get_section (sym)))
        {
          r_extern = 1;
@@ -788,7 +789,7 @@ nlm_alpha_set_public_section (abfd, sym)
 
   code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
   data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
-  if (sym->symbol.value < bfd_section_size (abfd, code_sec))
+  if (sym->symbol.value < code_sec->size)
     {
       sym->symbol.section = code_sec;
       sym->symbol.flags |= BSF_FUNCTION;
@@ -796,9 +797,9 @@ nlm_alpha_set_public_section (abfd, sym)
   else
     {
       sym->symbol.section = data_sec;
-      sym->symbol.value -= bfd_section_size (abfd, code_sec);
+      sym->symbol.value -= code_sec->size;
       /* The data segment had better be aligned.  */
-      BFD_ASSERT ((bfd_section_size (abfd, code_sec) & 0xf) == 0);
+      BFD_ASSERT ((code_sec->size & 0xf) == 0);
     }
   return TRUE;
 }
This page took 0.027657 seconds and 4 git commands to generate.