[PATCH] D14382: [ELF2] - Basic implementation of -r/--relocatable

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 14:01:50 PST 2015


On Tue, Nov 17, 2015 at 5:57 PM, Ed Maste via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> On 5 November 2015 at 18:13, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> > Just FYI even in FreeBSD this is not very high priority. -r is used
> > only for OpenPAM and another few modules that we can (easily)
> > disabled.
>
> We can disable the openpam_static build, but then we won't have the
> static openpam library. Although it's a little odd, we do rely on -r's
> functionality.
>
> In normal operation pam is usually accessed as a set of shared objects
> that are loaded based on a configuration file, but we also build a
> static library with all of the modules included. Symbols from the
> individual modules are not directly referenced. Instead we use a
> linker set, and a function iterates over the set to locate the desired
> "module" based on a string match. The build uses -r to link the search
> routine and all of the modules into a single .o which is subsequently
> built into the ar archive. We could replace this with an archive
> containing the individual module objects, but this would then require
> consumers to link with --whole-archive.
>
> This may well be an esoteric use case (along with crunchgen) that we
> don't feel the need to support in LLD, but I suspect there are some
> similar uses of -r in the wild.
>

Thanks for the info. I saw some need for -r, and I agree that this is just
one case and there would be other use cases in the wild. At the same time,
I feel like they do that way since the linker supports that feature, which
could have been done in a different way. They could update the code to
remove dependency to the -r functionality. (I'm happy to contribute such
patch to a project that uses -r.) It is much harder to remove a feature
than adding, so I'd want to be conservative now.

It sounds like OpenPAM static build could be updated so that it does not
use -r, couldn't it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151118/14e06eec/attachment.html>


More information about the llvm-commits mailing list