Question about readelf output from shared library built with lld, gold, and bfd linkers

Tom Kacvinsky tkacvins@gmail.com
Mon Nov 21 15:33:16 GMT 2022


On Mon, Nov 21, 2022 at 10:17 AM Nick Clifton <nickc@redhat.com> wrote:

> Hi Tom,
>
> >> I assume that you have compared started up times when linking with "-z
> now"
> >> vs "-z lazy" ?
> >>
> >
> > I thought -z lazy was the default, and that if you wanted the equivalent
> of
> > LD_BIND_NOW=1 on the command line, then one would use -z now.
>
> It depends upon the environment.  In Fedora (and RHEL) "-z now" is the
> default.  The reason is program security - lazy binding means that an
> attacker might be able to alter the relocations before they are evaluated,
> allowing all kinds of unexpected things to happen.
>

Good to know.  I am using CentOS 7 with a built from source binutils (2.39)
as the system linker is too old to handle the DWARF5 debug symbols made
by GCC 12.1 (also built from source).  So the modification made by Fedora
and RHEL is custom to their distros, right?  If so, then I think that I am
using
-z lazy.

Also, a question: would -z combreloc make a difference with relocations at
startup?  I was just perusing the ld manual and ran across that.

Tom


More information about the Binutils mailing list