This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Simulator question about argc/argv
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Steve Ellcey <sellcey at mips dot com>
- Cc: gdb at gcc dot gnu dot org
- Date: Fri, 31 May 2013 09:50:26 -0700
- Subject: Re: Simulator question about argc/argv
- References: <e51642e8-9972-421d-be36-5bcaec133fe3 at BAMAIL02 dot ba dot imgtec dot org>
On Fri, May 31, 2013 at 9:47 AM, Steve Ellcey <sellcey@mips.com> wrote:
>
> Some new tests have been added to the GCC testsuite (cilk tests) that
> check the value of argc and they expect it to be 1 if there are no
> arguments to the test program (and there are none) but I am getting 0
> when I run the tests under the gnu simulator. Does anyone know why
> this is? I don't know if this is specific to my target (mips-mti-elf)
> or a general simulator problem. Perhaps it is related to my linker
> script? The mips-mti-elf target is built with newlib. Could someone
> else who uses the gnu simulator and newlib try this. It works fine for
> me under the qemu simulator.
>
> % cat x.c
> #include <stdio.h>
> int main(int argc, char **argv)
> {
> printf("%d\n", argc);
> return 0;
> }
>
> % mips-mti-elf-gcc x.c -Tmti32.ld -o x
> % mips-mti-elf-run ./x
> 0
> % mips-mti-elf-run ./x 99
> 0
I get a similar thing on both of Cavium's internal simulators (MIPS64
and AARCH64) when running with bare metal. I normally just go and fix
the testcase not to depend on argc.
Thanks,
Andrew
>
> Steve Ellcey
> sellcey@mips.com
>