aboutsummaryrefslogtreecommitdiff
path: root/ld/ldmain.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-06-15 09:09:13 +0000
committerAlan Modra <amodra@gmail.com>2000-06-15 09:09:13 +0000
commitc7c544834a8924af95a2cf8e269ea198cc9dfe25 (patch)
treefb3514d1405097270c40dba36a488dbfe38feacb /ld/ldmain.c
parent5f8e8eb64ac77ae035cc3f59656655764e5846cd (diff)
downloadgdb-c7c544834a8924af95a2cf8e269ea198cc9dfe25.zip
gdb-c7c544834a8924af95a2cf8e269ea198cc9dfe25.tar.gz
gdb-c7c544834a8924af95a2cf8e269ea198cc9dfe25.tar.bz2
Correctly set SEC_READONLY for .text section.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r--ld/ldmain.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 48f35ef..9cb55ed 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -348,18 +348,19 @@ main (argc, argv)
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions */
- /* Look for a text section and switch the readonly attribute in it. */
- {
- asection * found = bfd_get_section_by_name (output_bfd, ".text");
+ if (! link_info.relocateable)
+ {
+ /* 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 (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;