This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should MIPS .eh_frame be writable?


Richard Sandiford wrote:

>> I think it's bad if GAS marks a section as read-only when it should
>> know that it's not.  Shouldn't GAS check that it's really generating a
>> read-only frame before setting the read-only bit?
> 
> GAS doesn't know for sure, because the linker can turn absolute
> relocations into PC-relative ones.  That's how we get rid of all
> the object-local relocations on MIPS, even though the original
> code uses absolute addresses.

The linker, then, can know for sure.  The result of the current
situation is that a linker script using ONLY_IF_RO with .eh_frame
sections will end up with .eh_frame sections in the text segment, even
when there are outstanding relocations against the section.  That seems
bad.  (The good outcome is the one where the loader blows up; the bad
outcome is the one in which all your programs end up needing relocation
of the text section and you don't realize it.)

I'd suggest having GAS mark the sections read-write, and having the
linker treat them as read-only if it can eliminate the relocations.

> In summary, I think this is genuinely a GCC bug.  When using .cfi_*
> directives, it should take account of the fact that GAS will mark
> the .eh_frame section read-only.

Would you please CC: me on the patch when you put that together?

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]