diff options
author | Nick Clifton <nickc@redhat.com> | 2000-05-23 21:03:35 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2000-05-23 21:03:35 +0000 |
commit | 1f0df59a2728f37b246fb21e3c8ae4890044af24 (patch) | |
tree | 91a0d91c20a2b581d96de3501ae63e5efb84f2ee /ld/ldmain.c | |
parent | 863e0fe46a35751d8873ad26cc6177346807998d (diff) | |
download | gdb-1f0df59a2728f37b246fb21e3c8ae4890044af24.zip gdb-1f0df59a2728f37b246fb21e3c8ae4890044af24.tar.gz gdb-1f0df59a2728f37b246fb21e3c8ae4890044af24.tar.bz2 |
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/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index cfdbdd7..7372594 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; |