Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement filter library support (-F / --filter) #33113

Closed
emaste opened this issue Jul 13, 2017 · 6 comments
Closed

Implement filter library support (-F / --filter) #33113

emaste opened this issue Jul 13, 2017 · 6 comments
Labels
bugzilla Issues migrated from bugzilla lld:ELF

Comments

@emaste
Copy link
Member

emaste commented Jul 13, 2017

Bugzilla Link 33766
Resolution FIXED
Resolved on Jul 19, 2017 00:07
Version unspecified
OS FreeBSD
Blocks #23588

Extended Description

FreeBSD recently added a dummy libdl as a filter library (https://reviews.freebsd.org/rS320872) to ease porting of software from Linux, which expects -ldl to work, and we'd like to support -F/--filter with lld (and presumably -f/--auxiliary also).

Filter library details are here: https://docs.oracle.com/cd/E19683-01/817-3677/chapter4-31738/index.html

Using the FreeBSD change as an example, to produce a filter library we add -F,libc.so.7. The primary effect is that the resulting shared object gains a DT_FILTER entry:

Dynamic section at offset 0xd30 contains 25 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libc.so.7]
0x000000000000000e (SONAME) Library soname: [libdl.so.1]
0x000000007fffffff (FILTER) Filter library: [libc.so.7]

When the runtime loader encounters this it uses the named filtee library (libc.so.7) to resolve symbols from the filter library.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 13, 2017

and we'd like to support -F/--filter with
lld (and presumably -f/--auxiliary also).

Patch implementing -F/--filter is https://reviews.llvm.org/D35352,
and we already provide support for -f/--auxiliary.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 13, 2017

BTW, does freebsd support Instruction Set Specific Shared Objects?

https://docs.oracle.com/cd/E19683-01/817-3677/6mj8mbtd5/index.html

@emaste
Copy link
Member Author

emaste commented Jul 16, 2017

BTW, does freebsd support Instruction Set Specific Shared Objects?

We do not have support today - our rtld does not expand $ISALIST.

Kostik will implement it for completeness if we can find a canonical list of possible values somewhere, but in practice GNU ifunc is much more likely to be the approach taken for this kind of use case.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 17, 2017

BTW, does freebsd support Instruction Set Specific Shared Objects?

We do not have support today - our rtld does not expand $ISALIST.

Kostik will implement it for completeness if we can find a canonical list of
possible values somewhere, but in practice GNU ifunc is much more likely to
be the approach taken for this kind of use case.

Because of the popularity of linux?

I quite like the ISALIST idea. It is less flexible in theory, but should allow the support of non lazy binding too, which is pretty much impossible with ifunc.

@emaste
Copy link
Member Author

emaste commented Jul 18, 2017

Because of the popularity of linux?

Primarily because it seems cumbersome to have a half dozen or so individual filter libs, and because AFAICT $ISALIST hasn't been updated in several years, so there's a bunch of additional work that seemingly needs to be done to define appropriate recent microarch entries.

In practice we'd use this for things like a small handful of optimized string routines.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 19, 2017

r308167

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld:ELF
Projects
None yet
Development

No branches or pull requests

2 participants