bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/1568] COFF code section should be read only


From: nickc at redhat dot com
Subject: [Bug gas/1568] COFF code section should be read only
Date: 28 Oct 2005 10:34:48 -0000

------- Additional Comments From nickc at redhat dot com  2005-10-28 10:34 
-------
Subject: Re:  New: COFF code section should be read only

Hi Vahur,

> To create object files which are link-compatible with MS Visual C, the "x" 
> flag 
> in .section directive should also set read only flag in COFF section. 
> Otherwise 
> MS linker will complain about multiple segments with different attributes and 
> in fact will not merge such section with other code sections.
> I tracked down the problem to the function obj_coff_section in file 
> config/obj-
> coff.c where line
> case 'x': flags |= SEC_CODE | SEC_LOAD; break;
> should be changed to 
> case 'x': flags |= SEC_CODE | SEC_LOAD | SEC_READONLY; break;
> 
> Read/write code sections are possible then by specifying "wx" as section 
> attributes.

Except that the "w" flag will be processed first, clearing the readonly 
bit and then the "x" flag will be processed, setting it.  In order to 
obtain read/write code sections you would need to use "xw" as the flags.

I agree that it makes sense to have code sections marked as readonly be 
default, but I am worried that making this change would break other 
tools which rely upon the current behaviour.  Still if we make the "w" 
flag behave as you originally suggested it might be OK.

Please could you try out the uploaded patch and see if it resolves the 
problem for you ?

Cheers
   Nick

gas/ChangeLog
2005-10-28  Nick Clifton  <address@hidden>

        PR binutils/1568
        * config/obj-coff.c (obj_coff_section): Set readonly flag with the
        'x' attribute.  Remember the actions of the 'w' and 'n' attributes
        and do not allow the 'x','s' or 'd' attributes to change them.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1568

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]