Hello,

A couple of comments below.

On Mon, 18 May 2015, Nick Clifton wrote:
>       val |= ~0 << loaded;            // Generates warning
>       val |= (unsigned) ~0 << loaded; // Does not warn

To reduce verbosity, '~0u' can be used here instead of a cast.

>     * GCC supports a new option: -fno-plt
> 
>       When compiling position independent code this tells the compiler
>       not to use PLT for external function calls.  Instead the address
>       is loaded from the GOT and then branched to directly.  This
>       leads to more efficient code by eliminating PLT stubs and
>       exposing GOT load to optimizations.
> 
>       Not all architectures support this option, and some other
>       optimization features, such as lazy binding, may disable it.

The last paragraph looks confusing to be on both points.  '-fno-plt' is
implemented as a transformation during TreeSSA-to-RTL expansion, so it works
in a machine-independent manner; it's a no-op only if the target has no way to
turn on '-fPIC'.  Is that what you meant?

Second, lazy binding is not an optimization feature of GCC (it's implemented
as part of (e.g. glibc's) dynamic linker), so it's not quite right to say that
-fno-plt would be disabled by it.  Text I've added to the documentation says:

    Lazy binding requires PLT: with -fno-plt all external symbols are resolved
    at load time.

Thus, for code compiled with -fno-plt the dynamic linker would not be able to
perform lazy binding (even if it was otherwise possible, e.g. -z now -z relro
weren't in effect, and profitable, i.e. the library was not already prelinked).

Alexander

Reply via email to