This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using the asm suffix
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: David Wohlferd <dw at LimeGreenSocks dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Mon, 17 Aug 2015 05:41:14 -0500
- Subject: Re: Using the asm suffix
- Authentication-results: sourceware.org; auth=none
- References: <55D139F4 dot 7060109 at LimeGreenSocks dot com>
On Sun, Aug 16, 2015 at 06:33:40PM -0700, David Wohlferd wrote:
> On systems where an underscore is normally prepended to the name of a C
> -function or variable, this feature allows you to define names for the
> +variable, this feature allows you to define names for the
> linker that do not start with an underscore.
Why remove this?
> It does not make sense to use this feature with a non-static local
> variable since such variables do not have assembler names. If you are
> trying to put the variable in a particular register, see @ref{Explicit
> -Reg Vars}. GCC presently accepts such code with a warning, but will
> -probably be changed to issue an error, rather than a warning, in the
> -future.
> +Reg Vars}.
And this?
> +To specify the assember name for functions, write a declaration for the
^ typo
> +function before its definition and put @code{asm} there, like this:
> +
> @smallexample
> -extern func () asm ("FUNC");
> -
> -func (x, y)
> - int x, y;
> -/* @r{@dots{}} */
> +extern int func (int x, int y) asm ("MYFUNC");
> +
> +int func (int x, int y)
> +@{
> + /* @r{@dots{}} */
> @end smallexample
If you want to modernise the code, drop "extern" as well? :-)
> -Also, you must not use a
> -register name; that would produce completely invalid assembler code. GCC
> -does not as yet have the ability to store static variables in registers.
> -Perhaps that will be added.
And why remove these?
Segher