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: Get rid of underscore.c


Hi Zack,

> I think that only one of binutils and gcc should provide c++filt.
> I put cxxfilt.c in gcc because that was convenient for the goal of
> the patch I was developing at the time; also, the information about
> the presence or absence of a leading underscore on symbols is
> readily available in gcc, where in binutils you have to have a
> kludge with config.bfd or else link c++filt against libbfd.
> 
> However, it is arguably more natural for it to be part of binutils,
> and documentation for it exists in binutils but not in gcc.  I can
> provide an alternate patch to that effect, if someone will suggest
> what to do about the leading underscore issue.  (The whole point of
> this exercise has been to get rid of underscore.c.)

Well I think that there are several possible ways the binutils cxxfilt
could handle underscores:

  1. Go back to the way that things were using the
     config.bfd/underscore.c kludge.

  2. Ignore them.  Just initialise the strip_underscore variable to
     zero and allow the user to use the --strip-underscores command
     line switch if their particular target prepends them and they
     find them distracting.

  3. Add some heuristics to cxxfilt.c to guess whether underscores are
     prefixed.  For example a first pass could check all the symbols
     in the file (or maybe the first 100 symbols).  If they all start
     with an underscore then the program could guess that an
     underscore prefix is being used.

Option 1 has the advantage of conforming to the "If it works, don't
fix it" rule.  Option 2 is the simplest and just avoids the problem
entirely.  Options 3 might work for most files but I am sure that
there are situations where it will break.  (eg Mixed assembler and C++
sources).

Personally I prefer options 1.  Cxxfilt was working before - why
change it now ?

Cheers
        Nick


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