Absolute paths horror in gcc

Bo Thorsen bo@sonofthor.dk
Mon Mar 18 04:08:00 GMT 2002


I've been looking at the problem with hardcoded paths to link files in gcc. 
The problem is this (config/i386/linux64.h):

#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
  "%{m32:%{!shared: \
       %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
       %{!p:%{profile:gcrt1.o%s} %{!profile:crt1.o%s}}}} \
     crti.o%s %{static:crtbeginT.o%s}\
     %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}} \
   %{!m32:%{!shared: \
       %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} \
       %{!p:%{profile:/usr/lib64/gcrt1.o%s} 
%{!profile:/usr/lib64/crt1.o%s}}}}\
     /usr/lib64/crti.o%s %{static:crtbeginT.o%s} \
     %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}}"

#undef  ENDFILE_SPEC
#define ENDFILE_SPEC "\
  %{m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s} \
  %{!m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s}"

The problem is that gcc doesn't have the infrastructure needed to make it 
look in two different places for the crt files.

So, I was thinking that when someone is compiling on x86-64, I'd guess that 
he was compiling for 64 bit most of the times. So why not change the problem 
to be on the 32 bit side? Make the 64 bit default and the 32 bit ones have 
hardcoded paths. This should also make crosscompilation be easier again 
(right now it needs links from /usr/lib64/crtX.o to the files' real location).

Comments please.

Bo.

-- 

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



More information about the Gcc mailing list