This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

Re: Dwarf 2 section flags ?


On Thu, 20 Feb 2003, Elias Athanasopoulos wrote:

> On Fri, Feb 14, 2003 at 11:53:31AM -0600, Brian Ford wrote:
> > Shouldn't the Dwarf 2 section flags that gas creates include SEC_DEBUGGING
> > like the parallel stabs sections?  Here's a trivial patch.
>
> I think this is already done inside BFD; I don't know the exact place though.
> If you use objdump -h with the current gas (without your patch applied) you'll
> see that SEC_DEBUGGING is set to all the dwarf related sections.
>

Yes, most bfd targets do this via a strncmp of the section name with
".debug".  In my opinion, that is a gross hack.

In the case I am speaking of, gas is originating these debug sections and
absolutely setting the corresponding section flags to just SEC_READONLY.
Cleary it is wrong for gas to rely on the target bfd back end to detect via
the section name that these are debug sections and fix its inadaquate
section flags setting.  Moreover, the parallel stabs code does set these
flags appropriately.

I have been working on support for DWARF 2 debugging in Cygwin (PE COFF
format).  The PE maintainer agrees with me as shown by this comment from
coffcode.h line 507:

/* The PE version; see above for the general comments.  The non-PE
   case seems to be more guessing, and breaks PE format; specifically,
   .rdata is readonly, but it sure ain't text.  Really, all this
   should be set up properly in gas (or whatever assembler is in use),
   and honor whatever objcopy/strip, etc. sent us as input.  */

He outright refused to look at the section name at all when determining
the section flags to set.  I agree with him and am trying to make it work.

Unfortunately, since there is currently no equivalent to the .stab
directive for DWARF, and there is currently no way to set the
debugging flag via the assembly file for sections generated by the
compiler, I have to give in and use the section name comparison anyway.
But, it seems to me that we should be moving away from this, and this is
one simple place to do so.

Responses and opinions welcome.  Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


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