[MIPS] Why is PT_DYNAMIC marked as PF_W (write)?

Jack Carter Jack.Carter@imgtec.com
Tue Feb 11 20:08:00 GMT 2014


It looks like the segment flag bits are hard coded to read write execute no matter where they are located. Why is this not a bug? This is for non-IRIX bits.

Traditionally the .dynamic section/segment resides in the text segment, but wherever it gets located the flags are hardcoded as below:

      if (m != NULL && IRIX_COMPAT (abfd) == ict_none)
    {
      /* For a normal mips executable the permissions for the PT_DYNAMIC
         segment are read, write and execute. We do that here since
         the code in elf.c sets only the read permission. This matters
         sometimes for the dynamic linker.  */
      if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
        {
          m->p_flags = PF_R | PF_W | PF_X;
          m->p_flags_valid = 1;
        }
    }

Are there special rules for segments that are not PT_LOAD? 

If this is obsolete for Mips, can I fix it to match the PT_LOAD segment it overlays? ;-)  The "This matters sometimes for the dynamic linker" is probably part of the answer, but I haven't found it yet. 

Thanks,

Jack



More information about the Binutils mailing list