This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Compiling and linking 32 bit code on a 64 machine (AMD Optero n)
- From: "H. J. Lu" <hjl at lucon dot org>
- To: "CARTER-HITCHIN, David, GBM" <David dot CARTER-HITCHIN at rbos dot com>
- Cc: "'binutils at sourceware dot org'" <binutils at sourceware dot org>
- Date: Fri, 23 Jun 2006 10:34:52 -0700
- Subject: Re: Compiling and linking 32 bit code on a 64 machine (AMD Optero n)
- References: <3B4C77997DD0254B86D3C9454476B6BC057A94@lonms00812.fm.rbsgrp.net>
On Fri, Jun 23, 2006 at 06:21:08PM +0100, CARTER-HITCHIN, David, GBM wrote:
> 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 <iostream>
>
> 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
>
Please use
g++ -Wl,--verbose -m32 -o hello hello.o
H.J.