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: Sergey Korshunoff
Subject: Re: [Tinycc-devel] tips? define asm symbol as global if it is extern in C
Date: Mon, 18 May 2015 16:39:36 +0300

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;
+                    }
+                }
                 /* new label */
                 asm_new_label(s1, opcode, 0);
                 next();



reply via email to

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