From 862120bdbe9b36aa448b8372b120cd3dada51d14 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 18 Mar 2002 02:55:51 +0000 Subject: * ldmain.c (main): Move .text readonly flag fudges from here.. * ldlang.c (lang_process): ..to here. --- ld/ldlang.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ld/ldlang.c') diff --git a/ld/ldlang.c b/ld/ldlang.c index 4c4d8805195..b176f2d86cb 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4198,6 +4198,22 @@ lang_process () /* Find any sections not attached explicitly and handle them. */ lang_place_orphans (); + if (! link_info.relocateable) + { + /* Look for a text section and set 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; + } + } + + /* Do anything special before sizing sections. This is where ELF + and other back-ends size dynamic sections. */ ldemul_before_allocation (); /* We must record the program headers before we try to fix the -- cgit v1.2.1