From owner-freebsd-sparc Sun Dec 27 11:15:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA24307 for freebsd-sparc-outgoing; Sun, 27 Dec 1998 11:15:32 -0800 (PST) (envelope-from owner-freebsd-sparc@FreeBSD.ORG) Received: from ns2.sminter.com.ar (ns2.sminter.com.ar [200.10.100.11]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA24302 for ; Sun, 27 Dec 1998 11:15:28 -0800 (PST) (envelope-from Recabarren!fpscha@ns2.sminter.com.ar) Received: (from uucp@localhost) by ns2.sminter.com.ar (8.8.5/8.8.4) id QAA24211; Sun, 27 Dec 1998 16:13:12 -0300 (GMT) >Received: (from fpscha@localhost) by localhost.schapachnik.com.ar (8.8.8/8.8.5) id BAA00291; Sun, 27 Dec 1998 01:47:49 -0300 (ART) From: "Fernando P. Schapachnik" Message-Id: <199812270447.BAA00291@localhost.schapachnik.com.ar> Subject: Re: Cross compiled code In-Reply-To: from Alfred Perlstein at "Dec 22, 98 09:45:37 am" To: bright@hotjobs.com (Alfred Perlstein) Date: Sun, 27 Dec 1998 01:47:49 -0300 (ART) Cc: paipai@tin.it, freebsd-sparc@FreeBSD.ORG Reply-To: fpscha@schapachnik.com.ar X-OS: FreeBSD 2.2.6 - http://www.freebsd.org X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org En un mensaje anterior Alfred Perlstein escribió: > > ----- the original program prova.c (c code) ------- > > > > > > main(){ > > int a,b; > > > > a = 10; > > b = 20 + a; > > } > > > > -------------------------------------------- > > > > compiled with xgcc -S > > > > -------------------------------------------- > > .file "prova.c" > > .section ".text" > > .align 4 > > .global main > > .type main,#function > > .proc 04 > > main: > > !#PROLOGUE# 0 > > save %sp,-208,%sp ! adjust stack fram > > !#PROLOGUE# 1 > > mov 10,%o0 ! a = 10 > > st %o0,[%fp+2027] ! this looks fishy 2027 looks a bit high(*) > > ld [%fp+2027],%o0 ! fishy (*) > > add %o0,20,%o1 ! a + 20 -> > > st %o1,[%fp+2023] ! fishy (*) The compiler is saving a and b in memory because they are atomic variables and it's asumming something like "every atomic variable must reside in memory, except when explicitly stated register". You should try compiling with -O. Regards and happy new year! > > .LL1: > > return %i7+8 > > nop > > .LLfe1: > > .size main,.LLfe1-main > > .ident "GCC: (GNU) egcs-2.91.60 19981201 (egcs-1.1.1 release)" > > > > --------------------------------------------------------------- Fernando P. Schapachnik fernando@schapachnik.com.ar /-------------------------------------------\ | Atención: Mensaje generado en entorno | | libre de productos MicroChot. | | No contiene HTML, adjuntos en Worst, | | ni basura similar. Leer con tranquilidad. | \-------------------------------------------/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message