tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tips? define asm symbol as global if it is extern in


From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] tips? define asm symbol as global if it is extern in C
Date: Mon, 18 May 2015 21:59:10 +0800
User-agent: K-9 Mail for Android

On May 18, 2015 9:39:36 PM GMT+08:00, Sergey Korshunoff <address@hidden> wrote:
> Hi all,
> there is a patch for the problem. Any suggestions?
> 
> diff -urN tinycc.old/tccasm.c tinycc/tccasm.c
> --- tinycc.old/tccasm.c 2015-05-18 12:30:24.000000000 +0300
> +++ tinycc/tccasm.c     2015-05-18 16:28:03.000000000 +0300
> @@ -779,6 +779,16 @@
>              opcode = tok;
>              next();
>              if (tok == ':') {
> +                /* handle "extern void vide(void); __asm__("vide:
> ret");" as
> +                "__asm__("globl vide\nvide: ret");" */
> +                Sym *sym = sym_find(opcode);
> +                if (sym && (sym->type.t & VT_EXTERN)) {
> +                    sym = label_find(opcode);
> +                    if (!sym) {
> +                        sym = label_push(&s1->asm_labels, opcode, 0);
> +                        sym->type.t = VT_VOID;
> +                    }

The else should throw an error for trying to redefine the symbol.

> +                }
>                  /* new label */
>                  asm_new_label(s1, opcode, 0);

Shouldn't this be part of a else for the outer if?

>                  next();

Ok otherwise.

Tom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]