|
From: | Nick Clifton |
Subject: | Re: [Bug gas/1568] New: COFF code section should be read only |
Date: | Fri, 28 Oct 2005 11:35:53 +0100 |
User-agent: | Mozilla Thunderbird 1.0 (X11/20041206) |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |