This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/17001] New: Linker option -Wl,foo,bar causes the driver to behave unintuitively for no input files
- From: "rmathew at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2004 13:34:52 -0000
- Subject: [Bug driver/17001] New: Linker option -Wl,foo,bar causes the driver to behave unintuitively for no input files
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The GCC driver allows linker options to be passed using the "-Wl," flag.
However, the way it is implemented results in an unintuitive behaviour
when no input files are present - the normal "no input files" message
is suppressed and the linker is invoked directly causing a link failure.
(I am seeing this behaviour in a few 3.x releases and not just the
3.5 mainline.)
As I understand it (from a reading of the manual), these options
are passed to the linker *when* it is invoked - when I specify no
input files, the linker should *not* be invoked.
Witness:
----------------------------------- 8< -----------------------------------
~ > $MYGCJ
gcj: no input files
~ > $MYGCJ -Wl,-rpath,/usr/local/lib
/usr/lib/crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
----------------------------------- 8< -----------------------------------
"Business Case":
----------------
I just build the mainline GCC without installing it.
To use, say, GCJ in such a situation, I define an alias like:
alias mygcj="$BUILD/gcc/gcj -B$BUILD/gcc/
-B/home/ranmath/src/gcc/build/i686-pc-linux-gnu/libjava/
-I$BUILD/i686-pc-linux-gnu/libjava/libgcj-3.5.0.jar
-L$BUILD/i686-pc-linux-gnu/libjava/.libs"
(where $BUILD is the folder where I built GCC)
So I can compile a normal Java program like:
mygcj --main=Hello Hello.java
However, the resulting binary needs the libgcj.so from
the build folder, so I can either use LD_LIBRARY_PATH
or use -rpath on the command line.
To save myself the trouble, I wanted to put:
-Wl,-rpath,$BUILD/i686-pc-linux-gnu/libjava/.libs
also in the above command line, but it causes the
compiler to behave weirdly (as noted above) when I
just say:
mygcj
The same problem is also present for a similarly
defined alias for g++ (of course, since the driver
is the same).
--
Summary: Linker option -Wl,foo,bar causes the driver to behave
unintuitively for no input files
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: driver
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmathew at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17001