[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Staging for -m32 option
From: |
grischka |
Subject: |
Re: [Tinycc-devel] Staging for -m32 option |
Date: |
Tue, 07 Dec 2010 02:08:01 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Henry Kroll wrote:
if (32 == atoi(optarg)) {/* -m32 */
#ifdef TCC_TARGET_X86_64
#ifdef TCC_TARGET_PE
#ifdef _WIN32
strcpy(arg,"tcc.exe");
sep='\\';
#else
strcpy(arg,"i386-win32-tcc");
#endif
#endif
What is the deal with this? Maybe there is one but I can't figure
it out. If we are on windows and if the current tcc produces
64bit PE code then "tcc -m32" should start "i386-win32-tcc.exe", no?
if(!(tcc=1+strrchr(argv[-1],sep)))
tcc=argv[-1];
Don't bother. Use:
tcc = tcc_basename(argv[-1]);
Note however that !(tcc=1+strrchr(argv[-1],sep)) is actually
never true because of the 1+ ;)
if (0<s->verbose) printf("%s->%s\n",tcc,arg);
Use two lines and more spaces (don't hate me)
if (0 < s->verbose)
printf("%s->%s\n", tcc, arg);
Then, I think it should prefix the the new program name with
the original path from argv[0]. Such that for example
"/home/gr/bin/tcc"
becomes
"/home/gr/bin/i386-tcc"
Also argv[0] for the new process should be arg:
argv[0] = arg.
In short:
const char *other_tcc;
char prog[4000], *basename;
... figure out correct 'other_tcc' here.
other_tcc = "whatever-tcc";
basename = tcc_basename(argv[0] = strcpy(prog, argv[0]));
strcpy(basename, other_tcc);
exit(execvp(arg,argv));/* launch 32 bit tcc */
execvp never returns on success. But it does on error. In which
case printing some message seems suitable:
execvp(prog, argv);
error("could not run %s", prog);
- [Tinycc-devel] Staging for -m32 option, Henry Kroll, 2010/12/05
- RE: [Tinycc-devel] Staging for -m32 option, Christian Jullien, 2010/12/06
- RE: [Tinycc-devel] Staging for -m32 option, Henry Kroll, 2010/12/06
- Re: [Tinycc-devel] Staging for -m32 option, grischka, 2010/12/06
- Re: [Tinycc-devel] Staging for -m32 option, Henry Kroll, 2010/12/06
- Re: [Tinycc-devel] Staging for -m32 option,
grischka <=
- Re: [Tinycc-devel] Staging for -m32 option, Henry Kroll, 2010/12/07
- Re: [Tinycc-devel] Staging for -m32 option, grischka, 2010/12/07
- Re: [Tinycc-devel] Staging for -m32 option, Henry Kroll, 2010/12/07