This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: ld -r breakage
- To: Jakub Jelinek <jakub at redhat dot com>
- Subject: Re: ld -r breakage
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Mon, 12 Jun 2000 19:45:21 +1000 (EST)
- cc: binutils at sourceware dot cygnus dot com
On Mon, 12 Jun 2000, Jakub Jelinek wrote:
> ld -r no longer preserves SEC_READONLY attribute for some sections.
I suspect it's this patch (presumably for correct -N operation)
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.
This will fix it
2000-06-12 Alan Modra <alan@linuxcare.com.au>
* ldmain.c (main): Only change .text SEC_READONLY for final link.
Index: ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.7
diff -u -p -r1.7 ldmain.c
--- ldmain.c 2000/05/26 13:11:57 1.7
+++ ldmain.c 2000/06/12 09:40:03
@@ -349,17 +349,18 @@ main (argc, argv)
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)
+ {
+ 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;
--
Linuxcare. Support for the Revolution.