This is the mail archive of the
mailing list for the binutils project.
[MIPS] Why is PT_DYNAMIC marked as PF_W (write)?
- From: Jack Carter <Jack dot Carter at imgtec dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Chris Dearman <Chris dot Dearman at imgtec dot com>
- Date: Tue, 11 Feb 2014 20:07:19 +0000
- Subject: [MIPS] Why is PT_DYNAMIC marked as PF_W (write)?
- Authentication-results: sourceware.org; auth=none
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.