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 19:49:42 +0300

> If it helps to fix small bugs
It looks tcc have some serious bugs related to the compiled kernel:
negative numbers of the freed memory, traps when booting.

One of the problem:
  what size of the segment registers (%fs, %gs)
-       asm volatile("mov %%fs,%0":"=m" (prev->fs));
-       asm volatile("mov %%gs,%0":"=m" (prev->gs));
+       asm volatile("movw %%fs,%0":"=m" (prev->fs));
+       asm volatile("movw %%gs,%0":"=m" (prev->gs));
or
+       asm volatile("movl %%fs,%0":"=m" (prev->fs));
+       asm volatile("movl %%gs,%0":"=m" (prev->gs));

Related to the pp (or asm?):
SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \
-       "pushl $"#nr"-256\n\t" \
+       "pushl $"#nr" - 256\n\t" \

A .rept asm macro must be implemented:
+#if 0
        .rept NR_syscalls-(.-sys_call_table)/4
                .long SYMBOL_NAME(sys_ni_syscall)
        .endr
+#else
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
+        .long SYMBOL_NAME(sys_ni_syscall)
#endif
I don't shure that I can do this.

PS: I will try to mix gcc compiled *.o and tcc compiled *.o to find a
code which is miscompiled by tcc.



reply via email to

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