This is the mail archive of the 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]
Other format: [Raw text]

LINK_SPEC question


I have a question about how collect2 gets it's arguments.

I have set LINK_SPEC to this:

#undef	LINK_SPEC
#define LINK_SPEC "%{!m32:-m doesnnotworkelf_x86_64 -Y P,/usr/lib64} \
  %{m32:-m elf_i386} \
  %{shared:-shared} \
  %{!shared: \
    %{!static: \
      %{rdynamic:-export-dynamic} \
      %{m32:%{!dynamic-linker:-dynamic-linker /lib/}}} \
 /lib64/}}}\ %{static:-static}}"

And this can be shown when running "gcc -dumpspecs":

%{!m32:-m doesnotworkelf_x86_64 -Y P,/usr/lib64} %{m32:-m elf_i386}
      %{m32:%{!dynamic-linker:-dynamic-linker /lib/}}}

But when collect2 is run, it does this:

/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/collect2 -m elf_x86_64
-dynamic-linker /lib64/ crt1.o crti.o
-L/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1 /tmp/ccey0qwF.o -lgcc -lc -lgcc
/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/crtend.o crtn.o

Related to this, I have tried to make the crt files have hardcoded paths like
sparc64 (for the same reason), but this also fails. I have set this:

#define STARTFILE_SPEC32 \
  "%{!shared: \
     %{pg:gcrt1.o} %{!pg:%{p:gcrt1.o} \
		       %{!p:%{profile:gcrt1.o} \
			 %{!profile:crt1.o}}}} \
   crti.o %{static:crtbeginT.o}\
   %{!static:%{!shared:crtbegin.o} %{shared:crtbeginS.o}}"

#define STARTFILE_SPEC64 \
  "%{!shared: \
     %{pg:/usr/lib64/gcrt1.o} %{!pg:%{p:/usr/lib64/gcrt1.o} \
		       %{!p:%{profile:/usr/lib64/gcrt1.o} \
			 %{!profile:/usr/lib64/crt1.o}}}} \


%{m32:" STARTFILE_SPEC32 "} \
%{!m32:" STARTFILE_SPEC64 "}"

And as you can see from the output, collect2 tries to call the linker without
these paths. And of course it's in gcc -dumpspecs.

The specs here are set in linux64.h, which is the last of the spec files:

	tm_file="${tm_file} i386/att.h dbxelf.h elfos.h svr4.h linux.h \
		 i386/x86-64.h i386/linux64.h"
	tmake_file="t-slibgcc-elf-ver t-linux i386/t-crtstuff i386/t-linux64"

Any ideas?



     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark

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