public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* LINK_SPEC question
@ 2002-02-26  3:11 Bo Thorsen
  2002-02-26  9:52 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Bo Thorsen @ 2002-02-26  3:11 UTC (permalink / raw)
  To: gcc

Hi,

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/ld-linux.so.2}}} \
      %{!m32:%{!dynamic-linker:-dynamic-linker
 /lib64/ld-linux-x86-64.so.2}}}\ %{static:-static}}"

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

*link:
%{!m32:-m doesnotworkelf_x86_64 -Y P,/usr/lib64} %{m32:-m elf_i386}
  %{shared:-shared}
  %{!shared:
    %{!static:
      %{rdynamic:-export-dynamic}
      %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}}
      %{!m32:%{!dynamic-linker:-dynamic-linker/lib64/ld-linux-x86-64.so.2}}}
  %{static:-static}}

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/ld-linux-x86-64.so.2 crt1.o crti.o
/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/crtbegin.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}}}} \
   /usr/lib64/crti.o
%{static:/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/crtbeginT.o}\

%{!static:%{!shared:/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/crtbegin.o}
%{shared:/usr/lib64/gcc-lib/x86_64-unknown-linux/3.1/crtbeginS.o}}"

#undef  STARTFILE_SPEC
#define STARTFILE_SPEC "\
%{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:

config.gcc:
x86_64-*-linux*)
	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.

--

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LINK_SPEC question
  2002-02-26  3:11 LINK_SPEC question Bo Thorsen
@ 2002-02-26  9:52 ` Richard Henderson
  2002-02-26 10:12   ` Bo Thorsen
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2002-02-26  9:52 UTC (permalink / raw)
  To: Bo Thorsen; +Cc: gcc

On Tue, Feb 26, 2002 at 10:57:21AM +0100, Bo Thorsen wrote:
> I have set LINK_SPEC to this:
...
> And this can be shown when running "gcc -dumpspecs":
...
> But when collect2 is run, it does this:

Did you forget to "rm specs"?


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LINK_SPEC question
  2002-02-26  9:52 ` Richard Henderson
@ 2002-02-26 10:12   ` Bo Thorsen
  0 siblings, 0 replies; 3+ messages in thread
From: Bo Thorsen @ 2002-02-26 10:12 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc

On Tue, 26 Feb 2002, Richard Henderson wrote:

> On Tue, Feb 26, 2002 at 10:57:21AM +0100, Bo Thorsen wrote:
> > I have set LINK_SPEC to this:
> ...
> > And this can be shown when running "gcc -dumpspecs":
> ...
> > But when collect2 is run, it does this:
>
> Did you forget to "rm specs"?

No. I just figured out that I had to build the crosscompiler first, and
then build (with this crosscompiler) the compiler to run natively on the
hammer. I didn't know that specs was built by dumping the crosscompiler
specs, I expected that it was built along with the compiler.

This scheme works fine for "make bootstrap", but it is awkward for
crosscompilation. How about an entry on the "newbie projects" webpage for
a way to make the specs file directly?

Sorry for the newbie question. At least I learned something here.

Bo.

-- 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-26 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26  3:11 LINK_SPEC question Bo Thorsen
2002-02-26  9:52 ` Richard Henderson
2002-02-26 10:12   ` Bo Thorsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).