This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Make sunrpc more lazy binding (or prelinking) friendly


Hi!

sunrpc puts abort into its xp_ops. This results in 6 more non-relative
relocations than necessary (and usually 6 conflicts with prelinking, since
it is pretty common that main binary calls abort() somewhere and thus has a PLT
entry for abort which those function pointers in sunrpc need to resolve to).
Glibc already calls abort () in many other places, so wrapping that into
small static wrapper functions IMHO helps to lazy binding too - they will be
just R_*_RELATIVE relocated at startup and if ever someone calls that, who
cares about speed.

2001-07-23  Jakub Jelinek  <jakub@redhat.com>

	* sunrpc/svc_tcp.c (svctcp_rendezvous_abort): New.
	(svctcp_rendezvous_op): Use it.
	* sunrpc/svc_unix.c (svcunix_rendezvous_abort): New.
	(svcunix_rendezvous_op): Use it.

--- libc/sunrpc/svc_tcp.c.jj	Mon Mar 26 10:02:34 2001
+++ libc/sunrpc/svc_tcp.c	Mon Jul 23 13:04:50 2001
@@ -81,14 +81,23 @@ static const struct xp_ops svctcp_op =
  */
 static bool_t rendezvous_request (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat rendezvous_stat (SVCXPRT *);
+static void svctcp_rendezvous_abort (void);
+
+/* This function makes sure abort() relocation goes through PLT
+   and thus can be lazy bound.  */
+static void
+svctcp_rendezvous_abort (void)
+{
+  abort ();
+};
 
 static const struct xp_ops svctcp_rendezvous_op =
 {
   rendezvous_request,
   rendezvous_stat,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort,
-  (bool_t (*) (SVCXPRT *, struct rpc_msg *)) abort,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svctcp_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort,
   svctcp_destroy
 };
 
--- libc/sunrpc/svc_unix.c.jj	Mon Mar 26 10:02:34 2001
+++ libc/sunrpc/svc_unix.c	Mon Jul 23 13:05:49 2001
@@ -74,14 +74,23 @@ static const struct xp_ops svcunix_op =
  */
 static bool_t rendezvous_request (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat rendezvous_stat (SVCXPRT *);
+static void svcunix_rendezvous_abort (void);
+
+/* This function makes sure abort() relocation goes through PLT
+   and thus can be lazy bound.  */
+static void
+svcunix_rendezvous_abort (void)
+{
+  abort ();
+};
 
 static const struct xp_ops svcunix_rendezvous_op =
 {
   rendezvous_request,
   rendezvous_stat,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort,
-  (bool_t (*) (SVCXPRT *, struct rpc_msg *)) abort,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svcunix_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort,
   svcunix_destroy
 };
 

	Jakub


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