This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: [ebuddington@mail.wesleyan.edu: cccp.c::print_help() not called.]


On Sun, Apr 02, 2000 at 01:53:01AM -0500, Eric R. Buddington wrote:
> On Sat, 1 Apr 2000, Zack Weinberg wrote:
> 
> > There is no -u option; you must mean -undef.  Except that that doesn't
> > do what it's documented to do...
> > 
> > $ /work/inst/bin/cpp -undef -dM /dev/null
> > #define __i386__ 1
> > #define __tune_pentiumpro__ 1
> > #define i386 1
> > #define __i386 1
> 
> Probably not important at this point, but my cpp recognizes a -u option,
> which does something useful:
...
> bash-2.02$ cpp -u -dM /dev/null
> # 1 "/dev/null"

Yeah, but it doesn't do what you think it does.  Watch:

$ cpp --version
2.95.2
$ cpp -dM /dev/null -u
cpp: argument to `-u' is missing

You thought it was undefining symbols because the -dM got eaten, so it
didn't print anything - but you would never have seen `# 1 "/dev/null"'
in -dM mode.

It turns out that -u is passed to the linker.  From man ld:

       -u sym Forces sym to be entered in the output file as an
              undefined symbol.  This may, for example, trigger
              linking of additional modules from standard libraries.
              -u may be repeated with different option arguments to
              enter additional undefined symbols.

And no, the 'cpp' wrapper won't ever run the linker, but it recognizes
the option anyway.

zw

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