my Avira anti virus detects two virus in those files [ Oxide.exe , co2.exe ].
... the Anti-Virus attacks, when the newly compiled program is being stored to a PE file, prior to embedding of icons and other resources.
Roland,
Using windres.exe from the GCC distribution to precompile the icon, version info, and manifest resources into an .o file and then linking it with your TCC .o files effectively eliminates false alarms issued by low-end AV software.
Apparently GCC is also on the exclusion list of most AV software -- something that's a paid service that the volunteer TCC dev team cannot afford.
I really have no interest to explore any further.
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@set CC=gcc -m64 -Os -s -fno-strict-aliasing
@goto tools
:tools
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a
tiny_impdef libtcc.dll -o libtcc/libtcc.def
:copy_std_includes
copy ..\include\*.h include
copy ..\tcclib.h include
copy ..\tests\libtcc_test.c examples
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o
unsigned long ulPolynomial = 0x04c11db7;
register int i;
for (i = 0; i <= 0xff; i++) {
crc32_table[i] = reflect(i, 8) << 24;
register int j;
for (j = 0; j < 8; j++)
crc32_table[i] =
(crc32_table[i] << 1) ^ (crc32_table[i] & (1 << 31) ? ulPolynomial : 0);
crc32_table[i] = reflect(crc32_table[i], 32);
}
}
unsigned long ulPolynomial = 0x04c11db7;
register int i;
for (i = 0; i <= 0xff; i++) {
crc32_table[i] = reflect(i, 8) << 24;
register int j;
for (j = 0; j < 8; j++)
crc32_table[i] =
(crc32_table[i] << 1) ^ (crc32_table[i] & (1 << 31) ? ulPolynomial : 0);
}
crc32_table[i] = reflect(crc32_table[i], 32);
}
int reflect(int r,n)
{
xor edx,edx
mov cl,n
.ri
dec cl
jl fwd ni
mov eax,r
and eax,1
jz fwd nd
mov eax,1
shl eax,cl
or edx,eax
.nd
shr r,1
jmp ri
.ni
mov eax,edx
return
}
'print hex ( reflect (0x2,32), 8)
'http://wiki.osdev.org/CRC32
'https://www.lammertbies.nl/comm/info/crc-calculation.html
int t[0x100]
void init_crc32_table(int*t)
{
int a,i,j
% Polynomial = 0x04c11db7
for i=0 to 255
t=reflect(i,8)
t=t<<24
for j=0 to 7
a=t and 0x80000000
t=t<<1
if a then t xor= Polynomial
next
t = reflect(t, 32)
@t+=4
next
}
init_crc32_table t
'def v +", "+mid(hex(t[%1],8),-8)
'print "crctable... " v 0 v 1 v 2 v 255
int crc32(sys p,le)
{
byte b at p
int v
byte i
int crc=0xffffffff
while le
le--
i=crc xor b
v=t[i]
crc=(crc>>8) xor v
@b++
end while
return not(crc)
}
'string s="A" 'crc32 should be: D3D99E8B
'string s="a" 'crc32 should be: E8B7BE43
string s="123456789" 'crc32 should be: CBF43926
print hex crc32 strptr s, len s
'CRC-32
=======
'http://wiki.osdev.org/CRC32
'https://www.lammertbies.nl/comm/info/crc-calculation.html
int crc32_table[0x100]
'
void init_crc32_table()
{
% Polynomial = 0x04c11db7
addr esi,crc32_table
xor edi,edi
.ri
cmp edi,255
jg ni
'
'reflect8
mov ecx,8
xor eax,eax
mov edx,edi
.rf8
shl dl,1
rcr eax,1
dec ecx
jg rf8
'
mov ecx,8
.rj
dec ecx
jl fwd nj
shl eax,1
jnc rj
xor eax,Polynomial
jmp rj
.nj
'
'reflect32
mov ecx,32
mov edx,eax
xor eax,eax
'
.rf32
shl edx,1
rcr eax,1
dec ecx
jg rf32
'
mov [esi],eax
add esi,4
inc edi
jmp ri
.ni
}
init_crc32_table
int crc32(sys p,le)
{
mov ecx,le
mov esi,p
mov eax,0xffffffff
addr edi,crc32_table
.ri
dec ecx
jl fwd xi
mov edx,eax
xor dl,[esi]
and edx,0xff
shr eax,8
xor eax,[edi+edx*4]
inc esi
jmp ri
.xi
not eax
return
'
}
'tests
'string s="A" 'crc32 should be: D3D99E8B
'string s="a" 'crc32 should be: E8B7BE43
'string s="123456789" 'crc32 should be: CBF43926
'print hex crc32 strptr s, len s
// gcc -masm=intel asmtest.c
//
// http://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax
// http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
// http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
#include <stdio.h>
int main(int argc, char *argv[])
{
int a=0;
int b=101;
int c=102;
// a=b+c
asm
(
"mov eax, %1;"
"add eax, %2;"
"mov %0, eax;"
: "=m" (a) // output
: "m" (b), "m" (c) // operands "m" from memory : "r" load to register first
// : "eax","ecx" // clobbered registers
);
printf("a = %d\n", a);
printf("b = %d\n", b);
printf("c = %d\n", c);
return 0;
};