public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bo Thorsen <bo@suse.de>
To: <gcc@gcc.gnu.org>
Subject: LINK_SPEC question
Date: Tue, 26 Feb 2002 03:11:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0202261056460.24134-100000@Macintyre.suse.de> (raw)

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

             reply	other threads:[~2002-02-26  9:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-26  3:11 Bo Thorsen [this message]
2002-02-26  9:52 ` Richard Henderson
2002-02-26 10:12   ` Bo Thorsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0202261056460.24134-100000@Macintyre.suse.de \
    --to=bo@suse.de \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).