public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld big trouble.
@ 2009-09-02 13:48 Dave Korn
  2009-09-02 14:02 ` Dave Korn
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dave Korn @ 2009-09-02 13:48 UTC (permalink / raw)
  To: binutils


    Hi gang,

  Here's ld's toplevel from ldlang.c:

> void
> lang_process (void)
> {
>   [ ... ]
>   if (! link_info.relocatable)
>     {
>       asection *found;
>       [ ... ]
>       /* Look for a text section and set the readonly attribute in it.  */
>       found = bfd_get_section_by_name (link_info.output_bfd, ".text");
> 
>       if (found != NULL)
> 	{
> 	  if (config.text_read_only)
> 	    found->flags |= SEC_READONLY;
> 	  else
> 	    found->flags &= ~SEC_READONLY;
> 	}
>     }
>   [ ... ] 

  Why only ".text" here, and not a more general match for (e.g.) ".text.*"?
GCC's partitioning options generate sections with names like ".text.unlikely",
or ".text.cold" and ".text.hot".  Shouldn't these text sections be governed by
the same text_read_only flag?  It breaks auto-import on PE platforms, because
that requires that all text sections (well, all that have fixup imports
anyway) be writable.

  The answer to these questions tells me whether to use a more general string
matcher across all sections here, or whether to do special processing in the
ldemul_before_allocation() hooks in the PE/PE+ emulations.  However the
"text_read_only" member appears to have been added without being mentioned in
a ChangeLog, and nor is it commented where declared, so I'm reluctant to
attempt to divine its intended semantics.  I'm off to go and spend some time
digging through the mailing lists and cvs history, but I thought I'd leave
this here while I get on with that in case anyone has a definitive word to say
about it.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-09-02 23:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 13:48 ld big trouble Dave Korn
2009-09-02 14:02 ` Dave Korn
2009-09-02 14:09 ` Kai Tietz
2009-09-02 14:39   ` Dave Korn
2009-09-02 14:46 ` Alan Modra
2009-09-02 15:37   ` Dave Korn
2009-09-02 16:06     ` Andreas Schwab
2009-09-02 23:22     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).