This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
patch proposal - don't forget to turn SEC_READONLY off - fixes -N behavior
- To: <binutils at sourceware dot cygnus dot com>
- Subject: patch proposal - don't forget to turn SEC_READONLY off - fixes -N behavior
- From: "Igor Shevlyakov" <igor dot shevlyakov at windriver dot com>
- Date: Mon, 22 May 2000 21:53:09 -0700
- Cc: "Igor Shevlyakov" <igor at windriver dot com>
Hi folks,
I've met a case when -N switch is not working. For me it was combination of
ELF & partial linking. Problem was here because SEC_READONLY was only setted
when config.text_read_only is set. When -N at command line, we need to reset
it if it's already there.
So here it goes my patch
= ChangeLog ================================================
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.
= diff =====================================================
*** ldmain.c Mon May 22 19:48:31 2000
--- ldmain.c.new Mon May 22 19:48:03 2000
*************** main (argc, argv)
*** 348,363 ****
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)
! {
! found->flags |= SEC_READONLY;
! }
! }
if (link_info.relocateable)
output_bfd->flags &= ~EXEC_P;
--- 348,362 ----
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 (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;