Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Melzzzzz <mel@zzzzz.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: [clang] -Os invalid content of argc+argv |
| Date | 2015-09-04 01:53 +0200 |
| Organization | albasani.net |
| Message-ID | <20150904015342.411a46af@maxa-pc> (permalink) |
| References | <68a9e68b-dc3b-4c5e-8d01-bc91daaeb0f2@googlegroups.com> <20150903233124.38258cdb@maxa-pc> <lnbndjqda9.fsf@kst-u.example.com> |
On Thu, 03 Sep 2015 16:43:58 -0700 Keith Thompson <kst-u@mib.org> wrote: > Melzzzzz <mel@zzzzz.com> writes: > [...] > > I don't know about cygwin but argc/argv values are parsed with crt > > on Linux. That is if you link with c runtime and write main in > > assembler you get already parsed values eg Linux passes values on > > stack but crt parses them into rdi,rsi registers... > > Probably on cygwin compiler parses those values therefore bug. > > The command line is parsed by the shell, which then passes them to > your program using one of the exec*() functions. > > The compiler doesn't parse your program's command line arguments > (because they don't exist yet). It merely generates code that is able > to receive those arguments via the argc and argv parameters. > Hm, when I don't link with crt, rather make assembly executable independently, I don;t have argc,argv parameters as function arguments at all, rather they are laid down on stack... at least on x86-64 Linux... Of course shell parses command line but what I actually meant is that crt parses stack and forms argc,argv as standard function parameters (rdi->argc (first function parameter),rsi->argv (second function parameter).
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[clang] -Os invalid content of argc+argv m.labanowicz@gmail.com - 2015-09-03 13:28 -0700
Re: [clang] -Os invalid content of argc+argv Melzzzzz <mel@zzzzz.com> - 2015-09-03 23:31 +0200
Re: [clang] -Os invalid content of argc+argv Keith Thompson <kst-u@mib.org> - 2015-09-03 16:43 -0700
Re: [clang] -Os invalid content of argc+argv Melzzzzz <mel@zzzzz.com> - 2015-09-04 01:53 +0200
Re: [clang] -Os invalid content of argc+argv Philip Lantz <prl@canterey.us> - 2015-09-03 20:15 -0700
Re: [clang] -Os invalid content of argc+argv Keith Thompson <kst-u@mib.org> - 2015-09-04 09:15 -0700
Re: [clang] -Os invalid content of argc+argv m.labanowicz@gmail.com - 2015-09-04 10:33 -0700
Re: [clang] -Os invalid content of argc+argv Noob <root@127.0.0.1> - 2015-09-04 20:48 +0200
csiph-web