summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-05-23 21:03:35 +0000
committerNick Clifton <nickc@redhat.com>2000-05-23 21:03:35 +0000
commite4ace1a8dec977f6b54490b942992b052750044c (patch)
treeaba603b0114a749cc6c7d1513fd252b1a1c4f4bb /ld
parentd10bc4a159df0df943bf7966089f2d3fd517bfad (diff)
downloadbinutils-redhat-e4ace1a8dec977f6b54490b942992b052750044c.tar.gz
When deciding if ".text" section should be read-only, don't forget to reset
SEC_READONLY because it could be already set.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldmain.c21
2 files changed, 17 insertions, 10 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 801de43428..f0f2b6b851 100644
--- a/ld/ChangeLog
+++ b/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:
diff --git a/ld/ldmain.c b/ld/ldmain.c
index cfdbdd7a80..73725949d2 100644
--- a/ld/ldmain.c
+++ b/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;