This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: crosstool switching to /lib + /usr/lib ?


"Kai Ruottu" <karuottu@mbnet.fi> wrote:

> Daniel Kegel <dank@kegel.com> wrote:
> > it looks like supporting x86_64 means using --with-sysroot,
>
>  The '-rpath-link' required for the '32' multilib is of course a nuisance
> when the 64-bit default libs will be found automagically... Hmmm, maybe I
> should have the 'ld-linux.so.2' symlinked to the 'lib64' (to the default
> $prefix/$target/lib) too in order to fix this, the $prefix/$target/lib will
> be scanned for the 'dynamic linker' in the 64-bit case...

 The new symlink didn't help and when looking at the linking phase with the
'-verbose' option (giving '-Wl,-verbose' on compile command line), it told
what the reason is:

---------------------- clip --------------------------------------
GNU ld version 2.14.90.0.7 20031029
  Supported emulations:
   elf_x86_64
   elf_i386
   i386linux
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
              "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/local/i386-linux-gnu/lib");
---------------------- clip --------------------------------------

ie. there is this wrong SEARCH_DIR("..."), so 'ld' has this bug...
If it would be the same as in the 64-bit case and the 'ld-linux.so.2'
could be found there, then things could work. So another alternative
could have been to use an external link script in the '-m32' case
(to have a '-T elf_i386.ld%s' or something added to the '*endfile'
spec) and then get with '-verbose' :

---------------------- clip --------------------------------------
GNU ld version 2.14.90.0.7 20031029
  Supported emulations:
   elf_x86_64
   elf_i386
   i386linux
opened script file /usr/local/x86_64-linux-gnu/lib/elf_i386.ld
using external linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
              "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/local/x86_64-linux-gnu/lib/32");
---------------------- clip --------------------------------------

and it then would work in this default non-static case... What this
could cause in the '-static' case is unclear.

 But when I removed the '-T elf_i386.ld%s' and tried again in order
to get the first output from '-verbose', it suddenly found the
'ld-linux.so.2' automatically via the new symlink:

---------------------- clip --------------------------------------
GNU ld version 2.14.90.0.7 20031029
  Supported emulations:
   elf_x86_64
   elf_i386
   i386linux
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
              "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/local/i386-linux-gnu/lib");

<snip>

/usr/local/lib/gcc-lib/x86_64-linux-gnu/3.3.2/32/crtend.o
attempt to open /usr/local/x86_64-linux-gnu/lib/32/crtn.o succeeded
/usr/local/x86_64-linux-gnu/lib/32/crtn.o
ld-linux.so.2 needed by /usr/local/x86_64-linux-gnu/lib/32/libc.so.6
found ld-linux.so.2 at /home2/usr/local/x86_64-linux-gnu/bin/../lib/ld-linux.so.
2
---------------------- clip --------------------------------------

 I cannot explain this magic at all. First definitely not found and
then suddenly found... Sunspots or something maybe causing all this?
Anyway the situation is now that neither the '-rpath-link', nor using
a fixed link script is needed with '-m32'.

 Feel free to do your own empirical research...

Cheers, Kai


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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