[vms/committed] Make sections with fixups writable

Tristan Gingold gingold@adacore.com
Wed Aug 4 10:45:00 GMT 2010


Hi,

during loading, the image activator applies the fixup and therefore modifies the contents of some sections.  These sections must
be writable otherwise the writes will fail.  This patch ensures this behavior.

(Will be followed by another patch that fixes the rights).

Tristan.

bfd/
2010-08-04  Tristan Gingold  <gingold@adacore.com>

	* vms-alpha.c (alpha_vms_create_eisd_for_section): Make writable
	sections with relocs.
	(alpha_vms_add_fixup_lp): Set SEC_RELOC flag.
	(alpha_vms_add_fixup_ca): Ditto.
	(alpha_vms_add_fixup_qr): Ditto.
	Add comments.

Index: vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.34
diff -c -r1.34 vms-alpha.c
*** vms-alpha.c	4 Aug 2010 08:44:07 -0000	1.34
--- vms-alpha.c	4 Aug 2010 10:05:34 -0000
***************
*** 2904,2909 ****
--- 2904,2913 ----
    else if (!(sec->flags & SEC_READONLY))
      eisd->u.eisd.flags |= EISD__M_WRT | EISD__M_CRF;
  
+   /* If relocations or fixup will be applied, make this isect writeable.  */
+   if (sec->flags & SEC_RELOC)
+     eisd->u.eisd.flags |= EISD__M_WRT | EISD__M_CRF;
+ 
    if (!(sec->flags & SEC_LOAD))
      {
        eisd->u.eisd.flags |= EISD__M_DZRO;
***************
*** 8017,8024 ****
--- 8021,8031 ----
    sl->has_fixups = TRUE;
    VEC_APPEND_EL (sl->lp, bfd_vma,
                   sect->output_section->vma + sect->output_offset + offset);
+   sect->output_section->flags |= SEC_RELOC;
  }
  
+ /* Add a code address fixup at address SECT + OFFSET to SHLIB. */
+ 
  static void
  alpha_vms_add_fixup_ca (struct bfd_link_info *info, bfd *src, bfd *shlib)
  {
***************
*** 8031,8038 ****
--- 8038,8048 ----
    sl->has_fixups = TRUE;
    VEC_APPEND_EL (sl->ca, bfd_vma,
                   sect->output_section->vma + sect->output_offset + offset);
+   sect->output_section->flags |= SEC_RELOC;
  }
  
+ /* Add a quad word relocation fixup at address SECT + OFFSET to SHLIB. */
+ 
  static void
  alpha_vms_add_fixup_qr (struct bfd_link_info *info, bfd *src,
                          bfd *shlib, bfd_vma vec)
***************
*** 8048,8053 ****
--- 8058,8064 ----
    r = VEC_APPEND (sl->qr, struct alpha_vms_vma_ref);
    r->vma = sect->output_section->vma + sect->output_offset + offset;
    r->ref = vec;
+   sect->output_section->flags |= SEC_RELOC;
  }
  
  static void
***************
*** 8055,8060 ****
--- 8066,8072 ----
                          unsigned int shr ATTRIBUTE_UNUSED,
                          bfd_vma vec ATTRIBUTE_UNUSED)
  {
+   /* Not yet supported.  */
    abort ();
  }
  



More information about the Binutils mailing list