Browse Source

When deciding if ".text" section should be read-only, don't forget to reset

SEC_READONLY because it could be already set.
binutils-2_11-branch
Nick Clifton 27 years ago
parent
commit
1f0df59a27
  1. 6
      ld/ChangeLog
  2. 21
      ld/ldmain.c

6
ld/ChangeLog

@ -1,3 +1,9 @@
2000-05-22 Igor Shevlyakov <igor@windriver.com>
* ldmain.c (main): When deciding if ".text" section should be
read-only, don't forget to reset SEC_READONLY because it
could be already set.
2000-05-22 Thomas de Lellis <tdel@windriver.com>
* ld.1: Add documentation for new command line option:

21
ld/ldmain.c

@ -347,17 +347,18 @@ main (argc, argv)
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions */
if (config.text_read_only)
{
/* Look for a text section and mark the readonly attribute in it */
asection *found = bfd_get_section_by_name (output_bfd, ".text");
if (found != (asection *) NULL)
{
/* Look for a text section and switch the readonly attribute in it. */
{
asection * found = bfd_get_section_by_name (output_bfd, ".text");
if (found != (asection *) NULL)
{
if (config.text_read_only)
found->flags |= SEC_READONLY;
}
}
else
found->flags &= ~SEC_READONLY;
}
}
if (link_info.relocateable)
output_bfd->flags &= ~EXEC_P;

Loading…
Cancel
Save