[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Re: Updates for x86_64

From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Re: Updates for x86_64
Date: Wed, 25 Aug 2010 00:25:10 -0300

2010/8/24 Paulo Cesar Pereira de Andrade <address@hidden>:

 Sorry for the comments about undefined behavior. And worse about the fact
that I dumbed down in patch7. It is indeed an issue of stack alignment, just
that patch7 did not correct it, and it worked up to patch6 because printf only
on integers did not rely on stack alignment. This was caused because the
test routine in args.tst did receive an odd number of arguments, i.e. would
match the C prototype:
void test(signed char c, unsigned char uc, short s, unsigned short us,
int i, unsigned int ui, long l, unsigned long ul,
void *p,
float f, double d);

 Now the attached patch, to replace previous patch7 corrects the issue, and
it no longer crashes on x86_64 for any of the test cases.

 Of course args.tst is bogus if it prints an error message, because it may
overwrite an register, for example, if float test fails, it calls
printf with the
values, and after that, calls jit_getarg_d, but the second register would
have been already overwritten (only an issue when passing arguments
in registers).

>> Patch6 extends the features in patch5 to support any number of
>> integer and float arguments.
>> But there is still some issue that patch6 does not properly
>> correct, and the test case
>> will if checking any float argument. It will not fail if run
>> under valgrind, or if I call a function other then printf. Either
>> way, it corrects
> Patch7 as expected does not correct this issue, but should also
> be better added, as it ensures the stack is 16 bytes aligned.
> Please review.

 I can remake patch6 to include patch7 if required, but that probably would
just make patch6 harder to understand, but I really need up to it in the
lightning used in the test tool, so that it can call printf to report errors...

 To reproduce the tests with the testing tool:

$ svn co lightning-test
$ cd lightning-test
$ ./ --disable-debug
$ make CFLAGS="-O0 -g3"

 This assumes you have lightning in the proper place, otherwise, try something

$ mkdir include
$ ln -sf <somewhere>/lightning.h include
$ ln -sf <somewhere>/lightning include

and add -Iinclude to CFLAGS. This is required because I did choose to use
lightning as the binary name :-) and cannot have a directory/link with that

 After that, to run a test, it is just like:
$ ./lightning hello.tst
$ ./lightning args.tst   # <- the problematic one :-)


Attachment: 0007-Ensure-stack-is-aligned-at-16-bytes-when-pushing-ext.patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]