mirror of
https://github.com/frida/tinycc
synced 2024-11-25 00:59:37 +03:00
da8c62f75d
win32/Makefile ("for cygwin") removed
- On cygwin, the normal ./configure && make can be used with either
cygwin's "GCC for Win32 Toolchain"
./configure --cross-prefix=i686-w64-mingw32-
or with an existing tcc:
./configure --cc=<old-tccdir>/tcc.exe
tcctest.c:
- exclude test_high_clobbers() on _WIN64 (does not work)
tests2/95_bitfield.c:
- use 'signed char' for ARM (where default 'char' is unsigned)
tests:
- remove -I "expr" diff option to allow tests with
busybox-diff.
libtcc.c, tcc.c:
- removed -iwithprefix option. It is supposed to be
combined with -iprefix which we don't have either.
tccgen.c:
- fix assignments and return of 'void', as in
void f() {
void *p, *q;
*p = *q:
return *p;
}
This appears to be allowed but should do nothing.
tcc.h, libtcc.c, tccpp.c:
- Revert "Introduce VIP sysinclude paths which are always searched first"
This reverts commit 1d5e386b0a
.
The patch was giving tcc's system includes priority over -I which
is not how it should be.
tccelf.c:
- add DT_TEXTREL tag only if text relocations are actually
used (which is likely not the case on x86_64)
- prepare_dynamic_rel(): avoid relocation of unresolved
(weak) symbols
tccrun.c:
- for HAVE_SELINUX, use two mappings to the same (real) file.
(it was so once except the RX mapping wasn't used at all).
tccpe.c:
- fix relocation constant used for x86_64 (by Andrei E. Warentin)
- #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
tccasm.c:
- keep forward asm labels static, otherwise they will endup
in dynsym eventually.
configure, Makefile:
- mingw32: respect ./configure options --bindir --docdir --libdir
- allow overriding tcc when building libtcc1.a and libtcc.def with
make XTCC=<tcc program to use>
- use $(wildcard ...) for install to allow installing just
a cross compiler for example
make cross-arm
make install
- use name <target>-libtcc1.a
build-tcc.bat:
- add options: -clean, -b bindir
76 lines
2.0 KiB
C
76 lines
2.0 KiB
C
//+---------------------------------------------------------------------------
|
|
|
|
// _UNICODE for tchar.h, UNICODE for API
|
|
#include <tchar.h>
|
|
|
|
#include <windows.h>
|
|
#include <stdlib.h>
|
|
|
|
#define __UNKNOWN_APP 0
|
|
#define __CONSOLE_APP 1
|
|
#define __GUI_APP 2
|
|
void __set_app_type(int);
|
|
void _controlfp(unsigned a, unsigned b);
|
|
|
|
#ifdef _UNICODE
|
|
#define __tgetmainargs __wgetmainargs
|
|
#define _twinstart _wwinstart
|
|
#define _runtwinmain _runwwinmain
|
|
int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
|
|
#else
|
|
#define __tgetmainargs __getmainargs
|
|
#define _twinstart _winstart
|
|
#define _runtwinmain _runwinmain
|
|
#endif
|
|
|
|
typedef struct { int newmode; } _startupinfo;
|
|
int __cdecl __tgetmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*);
|
|
|
|
static int go_winmain(TCHAR *arg1)
|
|
{
|
|
STARTUPINFO si;
|
|
_TCHAR *szCmd, *p;
|
|
int fShow;
|
|
|
|
GetStartupInfo(&si);
|
|
if (si.dwFlags & STARTF_USESHOWWINDOW)
|
|
fShow = si.wShowWindow;
|
|
else
|
|
fShow = SW_SHOWDEFAULT;
|
|
|
|
szCmd = NULL, p = GetCommandLine();
|
|
if (arg1)
|
|
szCmd = _tcsstr(p, arg1);
|
|
if (NULL == szCmd)
|
|
szCmd = _tcsdup(__T(""));
|
|
else if (szCmd > p && szCmd[-1] == __T('"'))
|
|
--szCmd;
|
|
#if defined __i386__ || defined __x86_64__
|
|
_controlfp(0x10000, 0x30000);
|
|
#endif
|
|
return _tWinMain(GetModuleHandle(NULL), NULL, szCmd, fShow);
|
|
}
|
|
|
|
int _twinstart(void)
|
|
{
|
|
__TRY__
|
|
_startupinfo start_info_con = {0};
|
|
__set_app_type(__GUI_APP);
|
|
__tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info_con);
|
|
exit(go_winmain(__argc > 1 ? __targv[1] : NULL));
|
|
}
|
|
|
|
int _runtwinmain(int argc, /* as tcc passed in */ char **argv)
|
|
{
|
|
#ifdef UNICODE
|
|
_startupinfo start_info = {0};
|
|
__tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info);
|
|
/* may be wrong when tcc has received wildcards (*.c) */
|
|
if (argc < __argc)
|
|
__targv += __argc - argc, __argc = argc;
|
|
#else
|
|
__argc = argc, __targv = argv;
|
|
#endif
|
|
return go_winmain(__argc > 1 ? __targv[1] : NULL);
|
|
}
|