This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Link issue and other issues...


FX Coudert wrote:

> So maybe cygwin just doesn't support this option well? Can you try it
> on C code and tell us if it works?

It's not a Cygwin thing, it's that Win32/PE is a coff target and has a
leading underscore by default:

$ gcc -dM -E - </dev/null | grep USER_LABEL_PREFIX
#define __USER_LABEL_PREFIX__ _

And -fleading-underscore's only function seems to be to set the prefix
to "_" if it's currently empty, or make the prefix empty where it's
currently "_":

  user_label_prefix = USER_LABEL_PREFIX;
  if (flag_leading_underscore != -1)
    {
      /* If the default prefix is more complicated than "" or "_",
         issue a warning and ignore this option.  */
      if (user_label_prefix[0] == 0 ||
          (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
        {
          user_label_prefix = flag_leading_underscore ? "_" : "";
        }
      else
        warning ("-f%sleading-underscore not supported on this target
machine",
                 flag_leading_underscore ? "" : "no-");
    }

So, on linux where USER_LABEL_PREFIX is "", -fleading-underscore can add
one, but on PECOFF where it's already got one it's a no-op.

The problem that is confusing the OP is that the -C flag to nm tells it
to demangle, part of which is removing leading underscores!

$ g77 -ff90 -c foo.f

$ nm foo.o
00000000 b .bss
00000000 d .data
00000000 t .text
00000000 T _xyz_

$ nm -C foo.o
00000000 b .bss
00000000 d .data
00000000 t .text
00000000 T xyz_

Brian


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