-Xlinker option partially eaten by collect2?

Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
Thu Sep 30 12:31:00 GMT 1999


System: alpha-dec-osf4.0f
gcc version: 2.95.1
scenario:

I need to pass the option `-oldstyle_liblookup' to the system linker.  If
I do something like

	export CC='cc -Wl,-oldstyle_liblookup'
	export CFLAGS='-std -g -I/some/dir/include'
	export LDFAGS='-L/some/dir/lib'
	./configure

with the vendor compiler, it works.  If I try something similar with gcc:

	export CC='gcc -Wl,-oldstyle_liblookup'
	export CFLAGS='-ansi -pedantic -Wall -g -I/some/dir/include'
	export LDFAGS='-L/some/dir/lib'
	./configure

or

	export CC='gcc'
	export CFLAGS='-ansi -pedantic -Wall -g -I/some/dir/include'
	export LDFAGS='-Wl,-oldstyle_liblookup -L/some/dir/lib'
	./configure

or

	export CC='gcc'
	export CFLAGS='-ansi -pedantic -Wall -g -I/some/dir/include'
	export LDFAGS='-Xlinker -oldstyle_liblookup -L/some/dir/lib'
	./configure

it doesn't.  The following shows up in `config.log':

configure:1041: checking whether the C compiler (gcc -ansi -pedantic -g -Wall -I
/local/BerkeleyDB/include -I/local/include -I/local/gnu/include -Xlinker -oldsty
le_liblookup -L/local/BerkeleyDB/lib -L/local/lib -L/local/gnu/lib) works
configure:1057: gcc -o conftest -ansi -pedantic -g -Wall -I/local/BerkeleyDB/inc
lude -I/local/include -I/local/gnu/include  -I/local/BerkeleyDB/include -I/local
/include -I/local/gnu/include -Xlinker -oldstyle_liblookup -L/local/BerkeleyDB/l
ib -L/local/lib -L/local/gnu/lib conftest.c  1>&5
configure:1054: warning: return-type defaults to `int'
collect2: ldstyle_liblookup: cannot open as COFF file
configure: failed program was:

#line 1052 "configure"
#include "confdefs.h"

main(){return(0);}




The thing to notice is that `collect2' is complaining about 
`ldstyle_liblookup'.  It appears that `collect2' is interpreting
-oldstyle_liblookup as `-o' followed by a filename.

This means that the `-Wl,option' and `-Xlinker option' flags are not doing
what they're intended to do -- there's no way to get this linker-specific
flag to the system linker, because collect2 is interpreting it.

I don't know if this problem can be fixed by augmenting the specs file, but
I'm not sure I have a clear understanding of that file anyway, so I haven't
tried it.  It's my impression that doing that would be a work-around
anyway, as it seems like it really is a problem with -Xlinker and -Wl, not
doing what they're intended to do.

Please let me know if I can provide further information or assistance.

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


More information about the Gcc-bugs mailing list