Ryan Oliver wrote:
Greetings folks

In regards to previous conversations on this list and a desire to post something that is not considered "idle speculation" find attached a build recipe for creating a multilib cross-toolchain that neither misuses -B/foo/lib nor uses the untolerably
heinous and evil STARTFILE_PREFIX_SPEC.

This is only part 1, the initial cross-toolchain

Find attached compiler test output for both 32bit and 64bit

Note that nothing strays outside of the sandbox (not includes, not library search paths) Also note the search paths in the linker scripts (especially the 64bit build)

-m32 and -m64 switches dont require any help from misusing -B/foo/lib to find the startfiles and the library searches are sane

Now have to move the whole lot over to a 64 bit machine to test the rest

Best Regards
[R]


[r...@hal build]# /u2/lfs/host-tools/bin/x86_64-pc-linux-gnu-gcc -m32 -v 
-Wl,-verbose foo.c
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../combined/configure --with-sysroot=/u2/lfs 
--prefix=/u2/lfs/host-tools --target=x86_64-pc-linux-gnu 
--with-local-prefix=/tools --without-headers --with-newlib --disable-nls 
--disable-shared --disable-decimal-float --disable-libgomp --disable-libmudflap 
--disable-libssp --disable-threads --enable-languages=c --enable-64-bit-bfd 
--with-lib-path=/tools/lib
Thread model: single
gcc version 4.3.2 (GCC) 
COLLECT_GCC_OPTIONS='-m32' '-v' '-mtune=generic'
 /u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v 
-imultilib 32 foo.c -quiet -dumpbase foo.c -m32 -mtune=generic -auxbase foo 
-version -o /tmp/ccZCzFfH.s
ignoring nonexistent directory 
"/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /u2/lfs/tools/include
 /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include
 /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed
End of search list.
GNU C (GCC) version 4.3.2 (x86_64-pc-linux-gnu)
        compiled by GNU C version 3.2, GMP version 4.2.3, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113018
Compiler executable checksum: 5c3738550443876bc9c9144b3fa96546
foo.c: In function 'main':
foo.c:2: warning: incompatible implicit declaration of built-in function 
'printf'
COLLECT_GCC_OPTIONS='-m32' '-v' '-mtune=generic'
 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/as
 -v -V -Qy --32 -o /tmp/cc8LvBui.o /tmp/ccZCzFfH.s
GNU assembler version 2.19 (x86_64-pc-linux-gnu) using BFD version (GNU 
Binutils) 2.19
COMPILER_PATH=/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/:/u2/lfs/tools/lib/../lib/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/:/u2/lfs/tools/lib/
COLLECT_GCC_OPTIONS='-m32' '-v' '-mtune=generic'
 /u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/collect2 
--sysroot=/u2/lfs --eh-frame-hdr -m elf_i386 -dynamic-linker 
/tools/lib/ld-linux.so.2 /u2/lfs/tools/lib/../lib/crt1.o 
/u2/lfs/tools/lib/../lib/crti.o 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib
 -L/u2/lfs/tools/lib/../lib 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib
 -L/u2/lfs/tools/lib -verbose /tmp/cc8LvBui.o -lgcc -lc -lgcc 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o 
/u2/lfs/tools/lib/../lib/crtn.o
GNU ld (GNU Binutils) 2.19
  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("=/tools/lib");
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
  .interp         : { *(.interp) }
  .note.gnu.build-id : { *(.note.gnu.build-id) }
  .hash           : { *(.hash) }
  .gnu.hash       : { *(.gnu.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
    }
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
    }
  .rel.plt        : { *(.rel.plt) }
  .rela.plt       : { *(.rela.plt) }
  .init           :
  {
    KEEP (*(.init))
  } =0x90909090
  .plt            : { *(.plt) }
  .text           :
  {
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
  } =0x90909090
  .fini           :
  {
    KEEP (*(.fini))
  } =0x90909090
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .eh_frame_hdr : { *(.eh_frame_hdr) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
(CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), 
CONSTANT (COMMONPAGESIZE));
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  /* Thread Local Storage sections  */
  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .preinit_array     :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
  }
  .init_array     :
  {
     PROVIDE_HIDDEN (__init_array_start = .);
     KEEP (*(SORT(.init_array.*)))
     KEEP (*(.init_array))
     PROVIDE_HIDDEN (__init_array_end = .);
  }
  .fini_array     :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(.fini_array))
    KEEP (*(SORT(.fini_array.*)))
    PROVIDE_HIDDEN (__fini_array_end = .);
  }
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    /* We don't want to include the .ctor section from
       the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*crtbegin?.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  }
  .jcr            : { KEEP (*(.jcr)) }
  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
*(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
  .dynamic        : { *(.dynamic) }
  .got            : { *(.got) }
  . = DATA_SEGMENT_RELRO_END (12, .);
  .got.plt        : { *(.got.plt) }
  .data           :
  {
    *(.data .data.* .gnu.linkonce.d.*)
    SORT(CONSTRUCTORS)
  }
  .data1          : { *(.data1) }
  _edata = .; PROVIDE (edata = .);
  __bss_start = .;
  .bss            :
  {
   *(.dynbss)
   *(.bss .bss.* .gnu.linkonce.b.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.
      FIXME: Why do we need it? When there is no .bss section, we don't
      pad the .data section.  */
   . = ALIGN(. != 0 ? 32 / 8 : 1);
  }
  . = ALIGN(32 / 8);
  . = ALIGN(32 / 8);
  _end = .; PROVIDE (end = .);
  . = DATA_SEGMENT_END (.);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
  /* DWARF 3 */
  .debug_pubtypes 0 : { *(.debug_pubtypes) }
  .debug_ranges   0 : { *(.debug_ranges) }
  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
}


==================================================
attempt to open /u2/lfs/tools/lib/../lib/crt1.o succeeded
/u2/lfs/tools/lib/../lib/crt1.o
attempt to open /u2/lfs/tools/lib/../lib/crti.o succeeded
/u2/lfs/tools/lib/../lib/crti.o
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o succeeded
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o
attempt to open /tmp/cc8LvBui.o succeeded
/tmp/cc8LvBui.o
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.so failed
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.a succeeded
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libc.so 
failed
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libc.a 
failed
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libc.so
 failed
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libc.a
 failed
attempt to open /u2/lfs/tools/lib/../lib/libc.so succeeded
opened script file /u2/lfs/tools/lib/../lib/libc.so
opened script file /u2/lfs/tools/lib/../lib/libc.so
attempt to open /u2/lfs/tools/lib/libc.so.6 succeeded
/tools/lib/libc.so.6 (/u2/lfs/tools/lib/libc.so.6)
attempt to open /u2/lfs/tools/lib/libc_nonshared.a succeeded
(/u2/lfs/tools/lib/libc_nonshared.a)elf-init.oS
attempt to open /u2/lfs/tools/lib/ld-linux.so.2 succeeded
/tools/lib/ld-linux.so.2 (/u2/lfs/tools/lib/ld-linux.so.2)
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.so failed
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.a succeeded
attempt to open 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o succeeded
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o
attempt to open /u2/lfs/tools/lib/../lib/crtn.o succeeded
/u2/lfs/tools/lib/../lib/crtn.o
ld-linux.so.2 needed by /u2/lfs/tools/lib/libc.so.6
found ld-linux.so.2 at /u2/lfs/tools/lib/ld-linux.so.2

[r...@hal build]# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x8048360
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00019 0x00019 R   0x1
      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x00538 0x00538 R E 0x1000
  LOAD           0x000538 0x08049538 0x08049538 0x00108 0x00128 RW  0x1000
  DYNAMIC        0x00054c 0x0804954c 0x0804954c 0x000c8 0x000c8 RW  0x4
  NOTE           0x000130 0x08048130 0x08048130 0x00020 0x00020 R   0x4
  LOOS+474e551   0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame 
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag 
   06     
[r...@hal build]# /u2/lfs/host-tools/bin/x86_64-pc-linux-gnu-gcc -m64 -v 
-Wl,-verbose foo.c
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../combined/configure --with-sysroot=/u2/lfs 
--prefix=/u2/lfs/host-tools --target=x86_64-pc-linux-gnu 
--with-local-prefix=/tools --without-headers --with-newlib --disable-nls 
--disable-shared --disable-decimal-float --disable-libgomp --disable-libmudflap 
--disable-libssp --disable-threads --enable-languages=c --enable-64-bit-bfd 
--with-lib-path=/tools/lib
Thread model: single
gcc version 4.3.2 (GCC) 
COLLECT_GCC_OPTIONS='-m64' '-v' '-mtune=generic'
 /u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v foo.c 
-quiet -dumpbase foo.c -m64 -mtune=generic -auxbase foo -version -o 
/tmp/cc8w1deQ.s
ignoring nonexistent directory 
"/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /u2/lfs/tools/include
 /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include
 /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed
End of search list.
GNU C (GCC) version 4.3.2 (x86_64-pc-linux-gnu)
        compiled by GNU C version 3.2, GMP version 4.2.3, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113018
Compiler executable checksum: 5c3738550443876bc9c9144b3fa96546
foo.c: In function 'main':
foo.c:2: warning: incompatible implicit declaration of built-in function 
'printf'
COLLECT_GCC_OPTIONS='-m64' '-v' '-mtune=generic'
 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/as
 -v -V -Qy --64 -o /tmp/ccG8AJgy.o /tmp/cc8w1deQ.s
GNU assembler version 2.19 (x86_64-pc-linux-gnu) using BFD version (GNU 
Binutils) 2.19
COMPILER_PATH=/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/tools/lib/../lib64/:/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/:/u2/lfs/tools/lib/
COLLECT_GCC_OPTIONS='-m64' '-v' '-mtune=generic'
 /u2/lfs/host-tools/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/collect2 
--sysroot=/u2/lfs --eh-frame-hdr -m elf_x86_64 -dynamic-linker 
/tools/lib64/ld-linux-x86-64.so.2 /u2/lfs/tools/lib/../lib64/crt1.o 
/u2/lfs/tools/lib/../lib64/crti.o 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2 
-L/u2/lfs/tools/lib/../lib64 
-L/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib
 -L/u2/lfs/tools/lib -verbose /tmp/ccG8AJgy.o -lgcc -lc -lgcc 
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o 
/u2/lfs/tools/lib/../lib64/crtn.o
GNU ld (GNU Binutils) 2.19
  Supported emulations:
   elf_x86_64
   elf_i386
   i386linux
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
              "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SEARCH_DIR("/u2/lfs/host-tools/x86_64-pc-linux-gnu/lib64"); 
SEARCH_DIR("=/tools/lib64"); SEARCH_DIR("=/tools/lib");
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  PROVIDE (__executable_start = 0x400000); . = 0x400000 + SIZEOF_HEADERS;
  .interp         : { *(.interp) }
  .note.gnu.build-id : { *(.note.gnu.build-id) }
  .hash           : { *(.hash) }
  .gnu.hash       : { *(.gnu.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
      *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*)
      *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*)
      *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*)
    }
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
      *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
      *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
      *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
    }
  .rel.plt        : { *(.rel.plt) }
  .rela.plt       : { *(.rela.plt) }
  .init           :
  {
    KEEP (*(.init))
  } =0x90909090
  .plt            : { *(.plt) }
  .text           :
  {
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
  } =0x90909090
  .fini           :
  {
    KEEP (*(.fini))
  } =0x90909090
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .eh_frame_hdr : { *(.eh_frame_hdr) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
(CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), 
CONSTANT (COMMONPAGESIZE));
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  /* Thread Local Storage sections  */
  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .preinit_array     :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
  }
  .init_array     :
  {
     PROVIDE_HIDDEN (__init_array_start = .);
     KEEP (*(SORT(.init_array.*)))
     KEEP (*(.init_array))
     PROVIDE_HIDDEN (__init_array_end = .);
  }
  .fini_array     :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(.fini_array))
    KEEP (*(SORT(.fini_array.*)))
    PROVIDE_HIDDEN (__fini_array_end = .);
  }
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    /* We don't want to include the .ctor section from
       the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*crtbegin?.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  }
  .jcr            : { KEEP (*(.jcr)) }
  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
*(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
  .dynamic        : { *(.dynamic) }
  .got            : { *(.got) }
  . = DATA_SEGMENT_RELRO_END (24, .);
  .got.plt        : { *(.got.plt) }
  .data           :
  {
    *(.data .data.* .gnu.linkonce.d.*)
    SORT(CONSTRUCTORS)
  }
  .data1          : { *(.data1) }
  _edata = .; PROVIDE (edata = .);
  __bss_start = .;
  .bss            :
  {
   *(.dynbss)
   *(.bss .bss.* .gnu.linkonce.b.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.
      FIXME: Why do we need it? When there is no .bss section, we don't
      pad the .data section.  */
   . = ALIGN(. != 0 ? 64 / 8 : 1);
  }
  .lbss   :
  {
    *(.dynlbss)
    *(.lbss .lbss.* .gnu.linkonce.lb.*)
    *(LARGE_COMMON)
  }
  . = ALIGN(64 / 8);
  .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) 
:
  {
    *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
  }
  .ldata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
  {
    *(.ldata .ldata.* .gnu.linkonce.l.*)
    . = ALIGN(. != 0 ? 64 / 8 : 1);
  }
  . = ALIGN(64 / 8);
  _end = .; PROVIDE (end = .);
  . = DATA_SEGMENT_END (.);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
  /* DWARF 3 */
  .debug_pubtypes 0 : { *(.debug_pubtypes) }
  .debug_ranges   0 : { *(.debug_ranges) }
  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
}


==================================================
attempt to open /u2/lfs/tools/lib/../lib64/crt1.o succeeded
/u2/lfs/tools/lib/../lib64/crt1.o
attempt to open /u2/lfs/tools/lib/../lib64/crti.o succeeded
/u2/lfs/tools/lib/../lib64/crti.o
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o 
succeeded
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o
attempt to open /tmp/ccG8AJgy.o succeeded
/tmp/ccG8AJgy.o
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.so 
failed
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.a 
succeeded
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libc.so 
failed
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libc.a 
failed
attempt to open /u2/lfs/tools/lib/../lib64/libc.so succeeded
opened script file /u2/lfs/tools/lib/../lib64/libc.so
opened script file /u2/lfs/tools/lib/../lib64/libc.so
attempt to open /u2/lfs/tools/lib64/libc.so.6 succeeded
/tools/lib64/libc.so.6 (/u2/lfs/tools/lib64/libc.so.6)
attempt to open /u2/lfs/tools/lib64/libc_nonshared.a succeeded
(/u2/lfs/tools/lib64/libc_nonshared.a)elf-init.oS
attempt to open /u2/lfs/tools/lib64/ld-linux-x86-64.so.2 succeeded
/tools/lib64/ld-linux-x86-64.so.2 (/u2/lfs/tools/lib64/ld-linux-x86-64.so.2)
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.so 
failed
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.a 
succeeded
attempt to open /u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o 
succeeded
/u2/lfs/host-tools/lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o
attempt to open /u2/lfs/tools/lib/../lib64/crtn.o succeeded
/u2/lfs/tools/lib/../lib64/crtn.o
ld-linux-x86-64.so.2 needed by /u2/lfs/tools/lib64/libc.so.6
found ld-linux-x86-64.so.2 at /u2/lfs/tools/lib64/ld-linux-x86-64.so.2

[r...@hal build]# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x4003d0
There are 8 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000001c0 0x00000000000001c0  R E    8
  INTERP         0x0000000000000200 0x0000000000400200 0x0000000000400200
                 0x0000000000000022 0x0000000000000022  R      1
      [Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x00000000000006ac 0x00000000000006ac  R E    200000
  LOAD           0x00000000000006b0 0x00000000006006b0 0x00000000006006b0
                 0x00000000000001f8 0x0000000000000260  RW     200000
  DYNAMIC        0x00000000000006d8 0x00000000006006d8 0x00000000006006d8
                 0x0000000000000190 0x0000000000000190  RW     8
  NOTE           0x0000000000000224 0x0000000000400224 0x0000000000400224
                 0x0000000000000020 0x0000000000000020  R      4
  GNU_EH_FRAME   0x00000000000005f0 0x00000000004005f0 0x00000000004005f0
                 0x0000000000000024 0x0000000000000024  R      4
  LOOS+474e551   0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr 
.eh_frame 
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag 
   06     .eh_frame_hdr 
   07     
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to