This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/21055] Option -Wl,-wrap when no input file
- From: "wilson at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Apr 2005 20:09:20 -0000
- Subject: [Bug driver/21055] Option -Wl,-wrap when no input file
- References: <20050416104027.21055.bitmap@pan.homelinux.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From wilson at gcc dot gnu dot org 2005-04-19 20:09 -------
This is due to an internal implementation detail. The -Wl options are handled
by pretending that the argument to the -Wl option is an object file name. This
works because the only thing we do with object file names on the command line is
to pass them to the linker. Search gcc.c for "-Wl", and note that the code
increments n_infiles. Once n_infiles has been incremented, it is impossible for
the gcc driver to tell whether or not the user has specified any input files.
This is clearer without the other arguments.
aretha$ gcc
gcc: no input files
aretha$ gcc -Wl,-wrap
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../lib64/crt1.o(.text+0x21):
In function `_start':
../sysdeps/x86_64/elf/start.S:92: undefined reference to `main'
collect2: ld returned 1 exit status
The -Xlinker/-Xassembler/-Xpreprocessor options have the same problem.
Incidentally, -Xassembler/-Xpreprocessor can't possibly work, as they aren't
supposed to be passing options to the linker. It looks like they have never
worked. The original patch from Apple has the same bug. This probably deserves
another bug report.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21055