Ryan Oliver wrote:
#====================================================================
# OK, how to build yourself out ch6
#--------------------------------------------------------------------
# install linux headers
# Build glibc 32 and 64 as per cross-lfs
# Toolchain adjustment
#
# Perform the standard specs edit to readjust the dynamic linker
# and cpp search path
#
# You have a couple of options on how to repoint the linker to pickup the
# new startfiles in /usr/lib
#
# IF creating a specs file in the standard location under
# /tools/lib/gcc/x86_64-pc-linux-gnu/4.2.3 you can
#
# a) set LIBRARY_PATH=/lib:/usr/lib or
# LPATH=/lib:/usr/lib
# in the environment
# b) Edit md_startfile_prefix*
# c) Edit startfile_prefix_spec
#
# If using the -specs switch to specify specs in a non-standard location
# set LIBRARY_PATH=/lib:/usr/lib or LPATH=/lib:/usr/lib in the
environment
#
# It doesn't hurt to keep LIBRARY_PATH set if you forget to unset it
later
#
OK, attached is the compiler output immediately after the glibc build,
prior to any toolchain re-adjustment
For demonstration purposes I am not modifying the specs. I am manually
setting dynamic linker, and overriding ld's inbuilt linker script
default search path with -rpath-link (which basically sets the path to
find library dependencies required at link time which are not
explicitly defined on the compiler command line... such as ld-linux.so.2).
command lines used to generate the output are
32bit:
LIBRARY_PATH=/usr/lib:/lib \
/tools/bin/gcc -v -m32 -isystem /usr/include -Wl,-rpath-link,/lib64:/lib
-Wl,-dynamic-linker,/lib/ld-linux.so.2 -Wl,-verbose foo.c
64bit:
LIBRARY_PATH=/usr/lib:/lib \
/tools/bin/gcc -v -m64 -isystem /usr/include -Wl,-rpath-link,/lib64:/lib
-Wl,-dynamic-linker,/lib64/ld-linux-x86-64.so.2 -Wl,-verbose foo.c
Note that setting -Wl,-rpath-link,/lib64:/lib effectively makes it so
you dont have to install an adjusted linker.
Also note that the LIBRARY_PATH environment variable correctly alters
the startfile search path and is expanded by the multilib spec
Frankly you can avoid the whole adjustment process if you want a really
"pure separation" between ch5 and ch6 (not that I am recommending that)
Anyhow, thus ends the toolchain build demonstration
QED
[R]
r...@rei:/u2/build# LIBRARY_PATH=/usr/lib:/lib /tools/bin/gcc -v -m32 -isystem
/usr/include -Wl,-rpath-link,/lib64:/lib -Wl,-dynamic-linker,/lib/ld-linux.so.2
-Wl,-verbose foo.c
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../native-toolchain/configure --prefix=/tools
--target=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --with-local-prefix=/tools --disable-nls
--enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99
--enable-long-long --enable-threads=posix --enable-64-bit-bfd
--with-lib-path=/tools/lib
Thread model: posix
gcc version 4.3.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-m32' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v
-imultilib 32 -iprefix /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/
-isystem /usr/include foo.c -quiet -dumpbase foo.c -m32 -mtune=generic -auxbase
foo -version -o /tmp/ccyBjJCZ.s
ignoring nonexistent directory
"/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include"
ignoring duplicate directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed"
ignoring nonexistent directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed
/tools/include
End of search list.
GNU C (GCC) version 4.3.2 (x86_64-pc-linux-gnu)
compiled by GNU C version 4.3.2, GMP version 4.2.3, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128427
Compiler executable checksum: 072007c4adee2ff414f18049e179ccb2
foo.c: In function 'main':
foo.c:2: warning: incompatible implicit declaration of built-in function
'printf'
COLLECT_GCC_OPTIONS='-v' '-m32' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/as
-v -V -Qy --32 -o /tmp/cckTHZoN.o /tmp/ccyBjJCZ.s
GNU assembler version 2.19 (x86_64-pc-linux-gnu) using BFD version (GNU
Binutils) 2.19
COMPILER_PATH=/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/tools/bin/../libexec/gcc/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/:/usr/lib/../lib/:/lib/../lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib/:/tools/lib/../lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/tools/bin/../lib/gcc/:/usr/lib/:/lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../:/tools/lib/
COLLECT_GCC_OPTIONS='-v' '-m32' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /tools/lib/ld-linux.so.2
/usr/lib/../lib/crt1.o /usr/lib/../lib/crti.o
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32 -L/usr/lib/../lib
-L/lib/../lib
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib
-L/tools/lib/../lib -L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2
-L/u2/lfs/tools/bin/../lib/gcc
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../.. -L/tools/lib
-rpath-link /lib64:/lib -dynamic-linker /lib/ld-linux.so.2 -verbose
/tmp/cckTHZoN.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
-lgcc_s --no-as-needed
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o
/usr/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/i386-pc-linux-gnu/lib"); 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 /usr/lib/../lib/crt1.o succeeded
/usr/lib/../lib/crt1.o
attempt to open /usr/lib/../lib/crti.o succeeded
/usr/lib/../lib/crti.o
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o succeeded
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtbegin.o
attempt to open /tmp/cckTHZoN.o succeeded
/tmp/cckTHZoN.o
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.a succeeded
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc_s.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc_s.a failed
attempt to open /usr/lib/../lib/libgcc_s.so failed
attempt to open /usr/lib/../lib/libgcc_s.a failed
attempt to open /lib/../lib/libgcc_s.so failed
attempt to open /lib/../lib/libgcc_s.a failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libgcc_s.so
failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libgcc_s.a
failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib/libgcc_s.so
succeeded
-lgcc_s
(/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib/libgcc_s.so)
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libc.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libc.a failed
attempt to open /usr/lib/../lib/libc.so succeeded
opened script file /usr/lib/../lib/libc.so
opened script file /usr/lib/../lib/libc.so
attempt to open /lib/libc.so.6 succeeded
/lib/libc.so.6
attempt to open /usr/lib/libc_nonshared.a succeeded
(/usr/lib/libc_nonshared.a)elf-init.oS
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc.a succeeded
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc_s.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/libgcc_s.a failed
attempt to open /usr/lib/../lib/libgcc_s.so failed
attempt to open /usr/lib/../lib/libgcc_s.a failed
attempt to open /lib/../lib/libgcc_s.so failed
attempt to open /lib/../lib/libgcc_s.a failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libgcc_s.so
failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/../lib/libgcc_s.a
failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib/libgcc_s.so
succeeded
-lgcc_s
(/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib/libgcc_s.so)
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o succeeded
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/32/crtend.o
attempt to open /usr/lib/../lib/crtn.o succeeded
/usr/lib/../lib/crtn.o
ld-linux.so.2 needed by /lib/libc.so.6
found ld-linux.so.2 at /lib/ld-linux.so.2
r...@rei:/u2/build# readelf -l a.out
Elf file type is EXEC (Executable file)
Entry point 0x80482a0
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 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x08048000 0x08048000 0x004a8 0x004a8 R E 0x1000
LOAD 0x0004a8 0x080494a8 0x080494a8 0x000fc 0x00104 RW 0x1000
DYNAMIC 0x0004bc 0x080494bc 0x080494bc 0x000c8 0x000c8 RW 0x4
NOTE 0x000128 0x08048128 0x08048128 0x00020 0x00020 R 0x4
GNU_STACK 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...@rei:/u2/build# LIBRARY_PATH=/usr/lib:/lib /tools/bin/gcc -v -m64 -isystem
/usr/include -Wl,-rpath-link,/lib64:/lib
-Wl,-dynamic-linker,/lib64/ld-linux-x86-64.so.2 -Wl,-verbose foo.c
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../native-toolchain/configure --prefix=/tools
--target=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --with-local-prefix=/tools --disable-nls
--enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99
--enable-long-long --enable-threads=posix --enable-64-bit-bfd
--with-lib-path=/tools/lib
Thread model: posix
gcc version 4.3.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-m64' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v
-iprefix /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/ -isystem
/usr/include foo.c -quiet -dumpbase foo.c -m64 -mtune=generic -auxbase foo
-version -o /tmp/ccrJZGuc.s
ignoring nonexistent directory
"/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include"
ignoring duplicate directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed"
ignoring nonexistent directory
"/u2/lfs/tools/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/include-fixed
/tools/include
End of search list.
GNU C (GCC) version 4.3.2 (x86_64-pc-linux-gnu)
compiled by GNU C version 4.3.2, GMP version 4.2.3, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128427
Compiler executable checksum: 072007c4adee2ff414f18049e179ccb2
foo.c: In function 'main':
foo.c:2: warning: incompatible implicit declaration of built-in function
'printf'
COLLECT_GCC_OPTIONS='-v' '-m64' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/as
-v -V -Qy --64 -o /tmp/ccmluPfd.o /tmp/ccrJZGuc.s
GNU assembler version 2.19 (x86_64-pc-linux-gnu) using BFD version (GNU
Binutils) 2.19
COMPILER_PATH=/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/tools/bin/../libexec/gcc/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/:/u2/lfs/tools/bin/../lib/gcc/:/usr/lib/../lib64/:/lib/../lib64/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/:/tools/lib/../lib64/:/usr/lib/:/lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib/:/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../:/tools/lib/
COLLECT_GCC_OPTIONS='-v' '-m64' '-isystem' '/usr/include' '-mtune=generic'
/u2/lfs/tools/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.3.2/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /tools/lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2
-L/u2/lfs/tools/bin/../lib/gcc -L/usr/lib/../lib64 -L/lib/../lib64
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64
-L/tools/lib/../lib64
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/lib
-L/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../.. -L/tools/lib
-rpath-link /lib64:/lib -dynamic-linker /lib64/ld-linux-x86-64.so.2 -verbose
/tmp/ccmluPfd.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
-lgcc_s --no-as-needed
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o
/usr/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("/tools/x86_64-pc-linux-gnu/lib64"); SEARCH_DIR("/tools/lib64");
SEARCH_DIR("/tools/x86_64-pc-linux-gnu/lib"); 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 /usr/lib/../lib64/crt1.o succeeded
/usr/lib/../lib64/crt1.o
attempt to open /usr/lib/../lib64/crti.o succeeded
/usr/lib/../lib64/crti.o
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o succeeded
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtbegin.o
attempt to open /tmp/ccmluPfd.o succeeded
/tmp/ccmluPfd.o
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.so failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.a
succeeded
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc_s.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc_s.a failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libgcc_s.so failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libgcc_s.a failed
attempt to open /usr/lib/../lib64/libgcc_s.so failed
attempt to open /usr/lib/../lib64/libgcc_s.a failed
attempt to open /lib/../lib64/libgcc_s.so failed
attempt to open /lib/../lib64/libgcc_s.a failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libgcc_s.so
succeeded
-lgcc_s
(/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libgcc_s.so)
attempt to open /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libc.so
failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libc.a
failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libc.so failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libc.a failed
attempt to open /usr/lib/../lib64/libc.so succeeded
opened script file /usr/lib/../lib64/libc.so
opened script file /usr/lib/../lib64/libc.so
attempt to open /lib64/libc.so.6 succeeded
/lib64/libc.so.6
attempt to open /usr/lib64/libc_nonshared.a succeeded
(/usr/lib64/libc_nonshared.a)elf-init.oS
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.so failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc.a
succeeded
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc_s.so failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/libgcc_s.a failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libgcc_s.so failed
attempt to open /u2/lfs/tools/bin/../lib/gcc/libgcc_s.a failed
attempt to open /usr/lib/../lib64/libgcc_s.so failed
attempt to open /usr/lib/../lib64/libgcc_s.a failed
attempt to open /lib/../lib64/libgcc_s.so failed
attempt to open /lib/../lib64/libgcc_s.a failed
attempt to open
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libgcc_s.so
succeeded
-lgcc_s
(/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../lib64/libgcc_s.so)
attempt to open /u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o
succeeded
/u2/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/4.3.2/crtend.o
attempt to open /usr/lib/../lib64/crtn.o succeeded
/usr/lib/../lib64/crtn.o
ld-linux-x86-64.so.2 needed by /lib64/libc.so.6
found ld-linux-x86-64.so.2 at /lib64/ld-linux-x86-64.so.2
r...@rei:/u2/build# readelf -l a.out
Elf file type is EXEC (Executable file)
Entry point 0x4003c0
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
0x000000000000001c 0x000000000000001c R 1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
0x000000000000067c 0x000000000000067c R E 200000
LOAD 0x0000000000000680 0x0000000000600680 0x0000000000600680
0x00000000000001f8 0x0000000000000208 RW 200000
DYNAMIC 0x00000000000006a8 0x00000000006006a8 0x00000000006006a8
0x0000000000000190 0x0000000000000190 RW 8
NOTE 0x000000000000021c 0x000000000040021c 0x000000000040021c
0x0000000000000020 0x0000000000000020 R 4
GNU_EH_FRAME 0x00000000000005c0 0x00000000004005c0 0x00000000004005c0
0x0000000000000024 0x0000000000000024 R 4
GNU_STACK 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