From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12102 invoked by alias); 23 Jun 2006 17:21:21 -0000 Received: (qmail 12086 invoked by uid 22791); 23 Jun 2006 17:21:19 -0000 X-Spam-Check-By: sourceware.org Received: from mail56.messagelabs.com (HELO mail56.messagelabs.com) (193.109.254.67) by sourceware.org (qpsmtpd/0.31) with SMTP; Fri, 23 Jun 2006 17:21:12 +0000 X-VirusChecked: Checked X-Env-Sender: David.CARTER-HITCHIN@rbos.com X-Msg-Ref: server-12.tower-56.messagelabs.com!1151083269!119930572!1 X-StarScan-Version: 5.5.10.7; banners=-,-,- Received: (qmail 7305 invoked from network); 23 Jun 2006 17:21:09 -0000 Received: from unknown (HELO lon9014xns-c-smtp.fm.rbsgrp.net) (147.114.226.190) by server-12.tower-56.messagelabs.com with SMTP; 23 Jun 2006 17:21:09 -0000 Received: from lonms00907.fm.rbsgrp.net ([147.114.196.191]) by lon9014xns-c-smtp.fm.rbsgrp.net with ESMTP; 23 Jun 2006 18:21:09 +0100 X-IronPort-AV: i="4.06,169,1149462000"; d="scan'208"; a="7419337:sNHT2028235650" X-RBS-Disclaimer: True Received: by lonms00907.fm.rbsgrp.net with Internet Mail Service (5.5.2657.72) id ; Fri, 23 Jun 2006 18:21:08 +0100 Message-ID: <3B4C77997DD0254B86D3C9454476B6BC057A94@lonms00812.fm.rbsgrp.net> From: "CARTER-HITCHIN, David, GBM" To: "'H. J. Lu'" Cc: "'binutils@sourceware.org'" Subject: RE: Compiling and linking 32 bit code on a 64 machine (AMD Optero n) Date: Fri, 23 Jun 2006 17:28:00 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00361.txt.bz2 Hi, > Please post it here. Here is is: []-> uname -a Linux lon3315xus 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:46:36 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux []-> cat /etc/redhat-release Red Hat Enterprise Linux AS release 3 (Taroon Update 7) []-> g++ -v Reading specs from /apps/IRDtools/pkgs/pd/gcc/3.4.1/p4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.1/s pecs Configured with: /usr/local/build/gcc-3.4.1/configure --prefix=/opt/GDStools/pkgs/pd/gcc/3.4.1/p4 --enable-threads --enable-languages=c,c++ Thread model: posix gcc version 3.4.1 [lon3315xus]-> ld --version GNU ld version 2.16 Copyright 2005 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. []-> cat hello.cpp #include int main () { std::cout << "hello, world\n"; } []-> cat Makefile hello: hello.o g++ -Wl,--verbose -Wl,-L,/usr/lib -Wl,--format,elf32-i386 -Wl,-m,elf_i386 -o hello -L/apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6 /32 -L/usr/lib hello.o: g++ -fPIC -Wall -Werror -Wno-sign-compare -march=i386 -m32 -c hello.cpp -o hello.o make > output 2>&1 cat output g++ -Wl,--verbose -Wl,-L,/usr/lib -Wl,--format,elf32-i386 -Wl,-m,elf_i386 -o hello -L/apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6 /32 -L/usr/lib GNU ld version 2.16 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("/apps/IRDtools/pkgs/pd/binutils/2.16-opteron/i386-unknown-linux- gnu/lib"); SEARCH_DIR("/apps/IRDtools/pkgs/pd/binutils/2.16-opteron/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); /* Do we need any of these for elf? __DYNAMIC = 0; */ SECTIONS { /* Read-only sections, merged into text segment: */ PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.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.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.*) KEEP (*(.text.*personality*)) /* .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 { KEEP (*(.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 (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); /* Exception handling */ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } /* Thread Local Storage sections */ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } /* Ensure the __preinit_array_start label is properly aligned. We could instead move the label definition inside the section, but the linker would then create the section even if it turns out to be empty, which isn't pretty. */ . = ALIGN(32 / 8); PROVIDE (__preinit_array_start = .); .preinit_array : { KEEP (*(.preinit_array)) } PROVIDE (__preinit_array_end = .); PROVIDE (__init_array_start = .); .init_array : { KEEP (*(.init_array)) } PROVIDE (__init_array_end = .); PROVIDE (__fini_array_start = .); .fini_array : { KEEP (*(.fini_array)) } PROVIDE (__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)) /* We don't want to include the .ctor section from 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 ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } .dtors : { KEEP (*crtbegin*.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } .jcr : { KEEP (*(.jcr)) } .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } .dynamic : { *(.dynamic) } .got : { *(.got) } . = DATA_SEGMENT_RELRO_END (12, .); .got.plt : { *(.got.plt) } .data : { *(.data .data.* .gnu.linkonce.d.*) KEEP (*(.gnu.linkonce.d.*personality*)) 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. */ . = 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) } /DISCARD/ : { *(.note.GNU-stack) } } ================================================== 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 /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/c rtbegin.o succeeded /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/c rtbegin.o attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc.so failed attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc.a succeeded attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc_eh.so failed attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc_eh.a succeeded attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libc.so failed attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libc.a failed att/apps/IRDtools/pkgs/pd/binutils/2.16-opteron/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/../lib64/crt1.o' is incompatible with i386 output /apps/IRDtools/pkgs/pd/binutils/2.16-opteron/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/../lib64/crti.o' is incompatible with i386 output /apps/IRDtools/pkgs/pd/binutils/2.16-opteron/bin/ld: warning: i386:x86-64 architecture of input file `/apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/ crtbegin.o' is incompatible with i386 output /apps/IRDtools/pkgs/pd/binutils/2.16-opteron/bin/ld: warning: i386:x86-64 architecture of input file `/apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/ crtend.o' is incompatible with i386 output /apps/IRDtools/pkgs/pd/binutils/2.16-opteron/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/../lib64/crtn.o' is incompatible with i386 output /usr/lib/../lib64/crt1.o: In function `_start': : undefined reference to `main' empt to open /usr/lib/libc.so succeeded opened script file /usr/lib/libc.so opened script file /usr/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 /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc.so failed attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc.a succeeded attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc_eh.so failed attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/3 2/libgcc_eh.a succeeded attempt to open /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/c rtend.o succeeded /apps/IRDtools/pkgs/pd/gcc/3.4.6/o1/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/c rtend.o attempt to open /usr/lib/../lib64/crtn.o succeeded /usr/lib/../lib64/crtn.o ld-linux.so.2 needed by /lib/libc.so.6 found ld-linux.so.2 at /lib/ld-linux.so.2 collect2: ld returned 1 exit status make: *** [hello] Error 1 What is odd is that it is accessing /usr/lib64 from /usr/lib/../lib64. Perhaps this is a clue as to what is going wrong? Thanks, David. *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorized and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbos.com http://www.rbsmarkets.com ***********************************************************************************