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.
This commit is contained in:
parent
718c0ded1f
commit
422fee64f8
|
@ -1,3 +1,10 @@
|
||||||
|
2005-11-07 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2005-11-07 John Levon <levon@movementarian.org>
|
2005-11-07 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* config/tc-i386.h (tc_comment_chars): Define.
|
* config/tc-i386.h (tc_comment_chars): Define.
|
||||||
|
|
|
@ -1522,38 +1522,81 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED)
|
||||||
exp = get_absolute_expression ();
|
exp = get_absolute_expression ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++input_line_pointer;
|
unsigned char attr;
|
||||||
while (*input_line_pointer != '"'
|
int readonly_removed = 0;
|
||||||
&& ! is_end_of_line[(unsigned char) *input_line_pointer])
|
int load_removed = 0;
|
||||||
|
|
||||||
|
while (attr = *++input_line_pointer,
|
||||||
|
attr != '"'
|
||||||
|
&& ! is_end_of_line[attr])
|
||||||
{
|
{
|
||||||
switch (*input_line_pointer)
|
switch (attr)
|
||||||
{
|
{
|
||||||
case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break;
|
case 'b':
|
||||||
case 'n': flags &=~ SEC_LOAD; flags |= SEC_NEVER_LOAD; break;
|
/* Uninitialised data section. */
|
||||||
|
flags |= SEC_ALLOC;
|
||||||
|
flags &=~ SEC_LOAD;
|
||||||
|
break;
|
||||||
|
|
||||||
case 's': flags |= SEC_COFF_SHARED; /* Fall through. */
|
case 'n':
|
||||||
case 'd': flags |= SEC_DATA | SEC_LOAD; /* Fall through. */
|
/* Section not loaded. */
|
||||||
case 'w': flags &=~ SEC_READONLY; break;
|
flags &=~ SEC_LOAD;
|
||||||
|
flags |= SEC_NEVER_LOAD;
|
||||||
|
load_removed = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'a': break; /* For compatibility with ELF. */
|
case 's':
|
||||||
case 'x': flags |= SEC_CODE | SEC_LOAD; break;
|
/* Shared section. */
|
||||||
case 'r': flags |= SEC_DATA | SEC_LOAD | SEC_READONLY; break;
|
flags |= SEC_COFF_SHARED;
|
||||||
|
/* Fall through. */
|
||||||
|
case 'd':
|
||||||
|
/* Data section. */
|
||||||
|
flags |= SEC_DATA;
|
||||||
|
if (! load_removed)
|
||||||
|
flags |= SEC_LOAD;
|
||||||
|
flags &=~ SEC_READONLY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
/* Writable section. */
|
||||||
|
flags &=~ SEC_READONLY;
|
||||||
|
readonly_removed = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
/* Ignore. Here for compatibility with ELF. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'r': /* Read-only section. Implies a data section. */
|
||||||
|
readonly_removed = 0;
|
||||||
|
/* Fall through. */
|
||||||
|
case 'x': /* Executable section. */
|
||||||
|
/* If we are setting the 'x' attribute or if the 'r'
|
||||||
|
attribute is being used to restore the readonly status
|
||||||
|
of a code section (eg "wxr") then set the SEC_CODE flag,
|
||||||
|
otherwise set the SEC_DATA flag. */
|
||||||
|
flags |= (attr == 'x' || (flags & SEC_CODE) ? SEC_CODE : SEC_DATA);
|
||||||
|
if (! load_removed)
|
||||||
|
flags |= SEC_LOAD;
|
||||||
|
/* Note - the READONLY flag is set here, even for the 'x'
|
||||||
|
attrbiute in order to be compatible with the MSVC
|
||||||
|
linker. */
|
||||||
|
if (! readonly_removed)
|
||||||
|
flags |= SEC_READONLY;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'i': /* STYP_INFO */
|
case 'i': /* STYP_INFO */
|
||||||
case 'l': /* STYP_LIB */
|
case 'l': /* STYP_LIB */
|
||||||
case 'o': /* STYP_OVER */
|
case 'o': /* STYP_OVER */
|
||||||
as_warn (_("unsupported section attribute '%c'"),
|
as_warn (_("unsupported section attribute '%c'"), attr);
|
||||||
*input_line_pointer);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
as_warn (_("unknown section attribute '%c'"),
|
as_warn (_("unknown section attribute '%c'"), attr);
|
||||||
*input_line_pointer);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++input_line_pointer;
|
|
||||||
}
|
}
|
||||||
if (*input_line_pointer == '"')
|
if (attr == '"')
|
||||||
++input_line_pointer;
|
++input_line_pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue