This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using the asm suffix


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]