This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] support: don't pass to resolv_test_start a big struct by value




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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]