From: Roy Smith on
If I've got a shared library, how can I tell if it was linked with the
-z interpose flag?
From: Roy Smith on
In article <slrnhu50ha.mon.dave(a)fly.srk.fer.hr>,
Drazen Kacar <dave(a)fly.srk.fer.hr> wrote:

> Roy Smith wrote:
> > If I've got a shared library, how can I tell if it was linked with the
> > -z interpose flag?
>
> dump -Lv library
>
> It should be listed in the output.


Cool, thanks.

[27] FLAGS_1 INTERPOSE

A little background on this. The Sun Studio 12 documentation says that
-Wl,-z,interpose should work on the cc command line, but this seems to
be broken. When I try it, I get:

CC: Warning: Option -Wl,-z,interpose passed to ld, if ld is invoked,
ignored otherwise
ld: fatal: option -z has illegal argument `,interpose'
ld: fatal: Flags processing errors

In Sun Studio 11, "-Wl,-z,interpose" seems to work as documented. In
12, you seem to need to do -Wl,-zinterpose".

When I change the cc command line to "-z interpose" (no -Wl), and truss
the build, I can see that ld gets called with "-zinterpose" as a single
argument. This wasn't what I expected from reading the ld man page (it
says "-z interpose", as two arguments).

The bottom line is I didn't have much confidence the interpose flag was
actually getting obeyed. Now I do. Thanks again.
From: Roy Smith on
In article <slrnhu5e6g.nlp.dave(a)fly.srk.fer.hr>,
Drazen Kacar <dave(a)fly.srk.fer.hr> wrote:

> Roy Smith wrote:
>
> > A little background on this. The Sun Studio 12 documentation says that
> > -Wl,-z,interpose should work on the cc command line, but this seems to
> > be broken. When I try it, I get:
> >
> > CC: Warning: Option -Wl,-z,interpose passed to ld, if ld is invoked,
> > ignored otherwise
>
> Is this "cc" (the C compiler) or "CC" (the C++ compiler)? CC didn't use
> -Wl flag, IIRC, but I don't know about Studio 12.

Hmmm. That could explain it. We (like many places) have a mongo
complicated build system which selects the "right" compiler for you. It
could have picked the wrong one. The fact that the error message says
CC instead of cc probably means it did :-)