Patchwork ld.so: command argument "--preload"

login
register
mail settings
Submitter Michael Kerrisk (man-pages)
Date Feb. 26, 2019, 11:47 a.m.
Message ID <CALxWeYpeOOpRMEO9ScHoLCAAz2NsVkNU7d_vds2TfRoKmZffPQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/31594/
State New
Headers show

Comments

Michael Kerrisk (man-pages) - Feb. 26, 2019, 11:47 a.m.
I've added documentation for the --preload option to the ld.so(8)
manual page. Please let me know if I missed anything in the text
below.

       --preload list (since glibc 2.30)
              Preload the objects specified in list.  The objects in list
              are  delimited  by  colons or spaces.  The objects are pre‐
              loaded as explained in the description  of  the  LD_PRELOAD
              environment variable below.

              By  contrast with LD_PRELOAD, the --preload option provides
              a way to perform preloading for a single executable without
              affecting  preloading  performed  in any child process that
              executes a new program.
       ...
       LD_PRELOAD
       ...
              There are various methods of  specifying  libraries  to  be
              preloaded, and these are handled in the following order:

              (1) The LD_PRELOAD environment variable.

              (2) The  --preload  command-line  option  when invoking the
                  dynamic linker directly.

              (3) The /etc/ld.so.preload file (described below).

Thanks,

Michael
Florian Weimer - Feb. 26, 2019, noon
* Michael Kerrisk:

> I've added documentation for the --preload option to the ld.so(8)
> manual page. Please let me know if I missed anything in the text
> below.

Thanks, looks good to me.

Florian
Michael Kerrisk (man-pages) - Feb. 26, 2019, 12:12 p.m.
On Tue, 26 Feb 2019 at 13:01, Florian Weimer <fweimer@redhat.com> wrote:
>
> * Michael Kerrisk:
>
> > I've added documentation for the --preload option to the ld.so(8)
> > manual page. Please let me know if I missed anything in the text
> > below.
>
> Thanks, looks good to me.

Thanks for checking it over, Florian!

Cheers,

Michael
David Newall - Feb. 27, 2019, 1:18 a.m.
On 26/2/19 10:17 pm, Michael Kerrisk wrote:
> I've added documentation for the --preload option to the ld.so(8)
> manual page. Please let me know if I missed anything in the text
> below.

Perfect.
Michael Kerrisk (man-pages) - Feb. 27, 2019, 7:23 a.m.
On 2/27/19 2:18 AM, David Newall wrote:
> On 26/2/19 10:17 pm, Michael Kerrisk wrote:
>> I've added documentation for the --preload option to the ld.so(8)
>> manual page. Please let me know if I missed anything in the text
>> below.
> 
> Perfect.

Thanks for checking it over, David.

Cheers,

Michael

Patch

diff --git a/man8/ld.so.8 b/man8/ld.so.8
index 6271f23ed..cdc4f233d 100644
--- a/man8/ld.so.8
+++ b/man8/ld.so.8
@@ -192,6 +192,24 @@  are delimited by colons or spaces.
 .B \-\-list
 List all dependencies and how they are resolved.
 .TP
+.BR \-\-preload " \fIlist\fP (since glibc 2.30)"
+Preload the objects specified in
+.IR list .
+The objects in
+.I list
+are delimited by colons or spaces.
+The objects are preloaded as explained in the description of the
+.BR LD_PRELOAD
+environment variable below.
+.IP
+By contrast with
+.BR LD_PRELOAD ,
+the
+.BR \-\-preload
+option provides a way to perform preloading for a single executable
+without affecting preloading performed in any child process that executes
+a new program.
+.TP
 .B \-\-verify
 Verify that program is dynamically linked and this dynamic linker can handle
 it.
@@ -347,6 +365,23 @@  as described above in
 .\"
 .\" which will preload the libmod.so in 'lib' or 'lib64', using it
 .\" in preference to the version in '.'.
+.IP
+There are various methods of specifying libraries to be preloaded,
+and these are handled in the following order:
+.RS
+.IP (1) 4
+The
+.BR LD_PRELOAD
+environment variable.
+.IP (2)
+The
+.B \-\-preload
+command-line option when invoking the dynamic linker directly.
+.IP (3)
+The
+.I /etc/ld.so.preload
+file (described below).
+.RE
 .TP
 .BR LD_TRACE_LOADED_OBJECTS
 If set (to any value), causes the program to list its dynamic