Re: asm prob (fwd)

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Wed Dec 02 1998 - 20:06:14 EST


 An addendum to the problem in i386/common.h:

Forwarded message:
>From law@hurl.cygnus.com Wed Dec 2 18:01:39 1998
To: Godmar Back <gback@cs.utah.edu>
Subject: Re: asm prob
Reply-To: law@cygnus.com
In-reply-to: Your message of Wed, 02 Dec 1998 16:04:00 MST.
             <199812022304.QAA10783@sal.cs.utah.edu>
Date: Wed, 02 Dec 1998 17:59:47 -0700
Message-ID: <11237.912646787@hurl.cygnus.com>
From: Jeffrey A Law <law@hurl.cygnus.com>

  In message <199812022304.QAA10783@sal.cs.utah.edu>you write:
>
> Here's an asm problem you might or might not know about:
>
> It happens on Linux and FreeBSD 3.0 with ELF support and gcc -fPIC.
> Basically, the following two things collide:
>
> + destructive use of %ebx in an asm macro.
>
> + use of %ebx to hold the jump offset or something for shared lib.
>
> Normally, gcc will save %ebx at function entry and restore it upon
> return. In between, it expects to be able to use it.
>
> It expects to be able to use it even after an asm macro that
> has "ebx" in the list of trashed registers.
>
> That seems wrong to me. What do you think?
You can not successfully set/clobber a register in an asm when the register
is fixed. Any asm that tries is broken. -fPIC/-fpic make %ebx fixed I
believe.

Most ports would abort if you tried that. For lots of dumb reasons the x86
port does not abort and may silently generate code which loses -- unless
you're using the egcs snapshots which should detect this error and complain
at compile time that the asm is bogus.

jeff


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:04 EDT