This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch proposal - don't forget to turn SEC_READONLY off - fixes -N behavior


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;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]