Do not change an existing section's attributes if a flags argument isn't
present. Warn if the new attributes don't match the section's current attributes.
This commit is contained in:
parent
fbe1e41fe2
commit
c99004323d
|
@ -1,3 +1,12 @@
|
||||||
|
2000-06-29 Mark Elbrecht <snowball3@bigfoot.com>
|
||||||
|
|
||||||
|
* config/obj-coff.c (obj_coff_setcion) [BFD_ASSEMBLER]: If the
|
||||||
|
flags argument is not present, don't change an existing section's
|
||||||
|
section's attributes. If the flags argument is present, warn if the
|
||||||
|
attributes don't match the section's current attributes. When
|
||||||
|
long section names are supported, set SEC_LINK_ONCE and
|
||||||
|
SEC_LINK_DUPLICATES_DISCARD for a new .gnu.linkonce section.
|
||||||
|
|
||||||
Thu Jun 29 21:30:00 2000 Hans-Peter Nilsson <hp@axis.com>
|
Thu Jun 29 21:30:00 2000 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
* config/obj-aout.c (obj_aout_type): Do not ignore for undefined
|
* config/obj-aout.c (obj_aout_type): Do not ignore for undefined
|
||||||
|
|
|
@ -652,7 +652,7 @@ static void
|
||||||
obj_coff_endef (ignore)
|
obj_coff_endef (ignore)
|
||||||
int ignore ATTRIBUTE_UNUSED;
|
int ignore ATTRIBUTE_UNUSED;
|
||||||
{
|
{
|
||||||
symbolS *symbolP;
|
symbolS *symbolP = NULL;
|
||||||
|
|
||||||
/* DIM BUG FIX sac@cygnus.com */
|
/* DIM BUG FIX sac@cygnus.com */
|
||||||
dim_index = 0;
|
dim_index = 0;
|
||||||
|
@ -1353,7 +1353,7 @@ obj_coff_section (ignore)
|
||||||
char c;
|
char c;
|
||||||
char *name;
|
char *name;
|
||||||
unsigned int exp;
|
unsigned int exp;
|
||||||
flagword flags;
|
flagword flags, oldflags;
|
||||||
asection *sec;
|
asection *sec;
|
||||||
|
|
||||||
if (flag_mri)
|
if (flag_mri)
|
||||||
|
@ -1375,7 +1375,7 @@ obj_coff_section (ignore)
|
||||||
SKIP_WHITESPACE ();
|
SKIP_WHITESPACE ();
|
||||||
|
|
||||||
exp = 0;
|
exp = 0;
|
||||||
flags = SEC_LOAD;
|
flags = SEC_NO_FLAGS;
|
||||||
|
|
||||||
if (*input_line_pointer == ',')
|
if (*input_line_pointer == ',')
|
||||||
{
|
{
|
||||||
|
@ -1420,18 +1420,35 @@ obj_coff_section (ignore)
|
||||||
|
|
||||||
sec = subseg_new (name, (subsegT) exp);
|
sec = subseg_new (name, (subsegT) exp);
|
||||||
|
|
||||||
if (flags != SEC_NO_FLAGS)
|
oldflags = bfd_get_section_flags (stdoutput, sec);
|
||||||
|
if (oldflags == SEC_NO_FLAGS)
|
||||||
{
|
{
|
||||||
flagword oldflags;
|
/* Set section flags for a new section just created by subseg_new.
|
||||||
|
Provide a default if no flags were parsed. */
|
||||||
oldflags = bfd_get_section_flags (stdoutput, sec);
|
if (flags == SEC_NO_FLAGS)
|
||||||
oldflags &= SEC_LINK_ONCE | SEC_LINK_DUPLICATES;
|
flags = SEC_LOAD;
|
||||||
flags |= oldflags;
|
|
||||||
|
#ifdef COFF_LONG_SECTION_NAMES
|
||||||
|
/* Add SEC_LINK_ONCE and SEC_LINK_DUPLICATES_DISCARD to .gnu.linkonce
|
||||||
|
sections so adjust_reloc_syms in write.c will correctly handle
|
||||||
|
relocs which refer to non-local symbols in these sections. */
|
||||||
|
if (strncmp (name, ".gnu.linkonce", sizeof(".gnu.linkonce") - 1) == 0)
|
||||||
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (! bfd_set_section_flags (stdoutput, sec, flags))
|
if (! bfd_set_section_flags (stdoutput, sec, flags))
|
||||||
as_warn (_("error setting flags for \"%s\": %s"),
|
as_warn (_("error setting flags for \"%s\": %s"),
|
||||||
bfd_section_name (stdoutput, sec),
|
bfd_section_name (stdoutput, sec),
|
||||||
bfd_errmsg (bfd_get_error ()));
|
bfd_errmsg (bfd_get_error ()));
|
||||||
|
}
|
||||||
|
else if (flags != SEC_NO_FLAGS)
|
||||||
|
{
|
||||||
|
/* This section's attributes have already been set. Warn if the
|
||||||
|
attributes don't match. */
|
||||||
|
flagword matchflags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
|
||||||
|
| SEC_DATA | SEC_SHARED;
|
||||||
|
if ((flags ^ oldflags) & matchflags)
|
||||||
|
as_warn (_("Ignoring changed section attributes for %s"), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
demand_empty_rest_of_line ();
|
demand_empty_rest_of_line ();
|
||||||
|
|
Loading…
Reference in New Issue