[PATCH 2/5] support: don't pass to resolv_test_start a big struct by value
Konstantin Kharlamov
hi-angel@yandex.ru
Mon Mar 25 10:33:00 GMT 2019
On Пн, Mar 25, 2019 at 11:33:28, Florian Weimer <fw@deneb.enyo.de>
wrote:
> * Konstantin Kharlamov:
>
>> diff --git a/support/resolv_test.h b/support/resolv_test.h
>> index c9e48205ab..880330ad5c 100644
>> --- a/support/resolv_test.h
>> +++ b/support/resolv_test.h
>> @@ -116,7 +116,7 @@ void resolv_test_init (void);
>> needed. As a side effect, NSS is reconfigured to use nss_dns
>> only
>> for aplicable databases, and the process may enter a network
>> namespace for better isolation. */
>> -struct resolv_test *resolv_test_start (struct
>> resolv_redirect_config);
>> +struct resolv_test *resolv_test_start (const struct
>> resolv_redirect_config*);
>
> This patch would adjusting all the tests that call resolv_test_start,
> and these changes are missing from the patch. It is unclear how this
> change would be an improvement because most tests call
> resolv_test_start exactly once and the parameter object is never used
> again. Passing a pointer requires writing the argument object to the
> stack *and* supplying its address to resolv_test_start, which requires
> more work. (Maybe some targets have more optimized code for struct
> initialization than passing many zero arguments, but that's a GCC
> issue which will eventually be fixed.)
Wow, are you saying that in the assembly the address that gets passed
to resolve_test_start() would be not the address of struct, but instead
an address of an addres on a stack that is an address of the struct…?
That doesn't sound right, is that some calling convention? I've never
heard of this.
More information about the Libc-alpha
mailing list