This is the mail archive of the gcc-help@gcc.gnu.org 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]

Re: gcc option re choice of ld?


On Aug 10, 2001, pkurpis@keck.hawaii.edu (Peter Kurpis) wrote:

>> From aoliva@redhat.com Fri Aug 10 10:42:48 2001

> Thanks, Alexandre!  A couple of questions...

>> On Aug  8, 2001, pkurpis@keck.hawaii.edu (Peter Kurpis) wrote:
>> 
>> > gcc --use-different-ld=/usr/ccs/bin/ld
>> 
>> Nope, and that's, in part, because GCC passes different options to the
>> linker depending on whether it is the bundled linker or GNU ld.
>> 
>> IIRC, this is hopefully not the case on Solaris, 

> I think you're right here:  I think on Solaris, the usual Solaris options
> are used (e.g. -R instead of -rpath).  They are in my case, anyway.

Err...  GCC never issues -R/-rpath options by itself.

> (1)  collect2  simply runs  ld , correct?  (What special purpose does it serve?
>     Why not simply run  ld  from  gcc  without the intervening  collect2 ?) 

On some platforms, collect2 generates code to call the global
constructors for each object file and compiles it too.  Also, if
you're compiling C++ with -frepo, it is collect2 that determines which
templates to instantiate in each object file, re-runs the compiler to
do the right instantiations, and then runs the linker.  I don't recall
whether it does anything else on Solaris.

> (2) As the only name-space collisions between the subprograms called by gcc and
>     the programs in  /usr/ccs/bin  are  as  and  ld , could I skip the first
>     two steps of your general solution, and just

> 	gcc -B/usr/ccs/bin/ ...

I wouldn't do that, since this might result in skipping collect2, with
unknown results.  Also, it may run /usr/ccs/bin/as too in case
anything has to be assembled, which may not be what you want.  That's
why I recommend the other solution.

>     ?  Or are the source formats for the two assemblers incompatible (i.e. if  gcc
>     was configured for the GNU  as )?

IIRC, on Solaris there are incompatibilities in some flags passed to
the assembler, which is why I recommend the other solution.  Recent
versions of GNU as don't require the modified assembler flags, and I
think GCC detects the need for them, so perhaps -B/usr/ccs/bin/ would
work for you.  Just give it a try, and if it fails in some odd way,
try it the way I suggested :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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