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

Meta objects should be bundle-able into the output binary #13

Open
stephenrkell opened this issue Mar 12, 2019 · 1 comment
Open

Meta objects should be bundle-able into the output binary #13

stephenrkell opened this issue Mar 12, 2019 · 1 comment

Comments

@stephenrkell
Copy link
Owner

Keeping metadata in a /usr/lib/meta hierarchy has its pros and cons. As an alternative, it should be possible to bundle the metadata with the output binary. I have prototyped some hacks which provide a basis for this, in my elftin repo (https://github.com/stephenrkell/elftin). More specifically, the "embed-loadable" example shows how to bundle an ELF file opaquely into a containing ELF file.

This embedded ELF file can itself be a loadable .so file... this is directly loadable so long as the ld.so supports dlopening from a file descriptor. Sadly glibc's ld.so doesn't expose this, but internally it more-or-less implements it; elftin also has some non-robust hacks that make this work on a particular build of the now-outdated glibc 2.19 (in the ldso-helper.c file). The way to make this more robust, over multiple versions of glibc, is to use reflection on the ld.so itself. We already generate metadata for the ld.so; it is probably possible to use that to obtain the entry points we need, instead of the hacky offset-based code in ldso-helper.c.

@stephenrkell
Copy link
Owner Author

I'm no longer sure this is a good idea. If bundled, the meta-DSO would become opaque to an attached debugger, because it cannot be identified by a path in the filesystem.

Perhaps the right approach is on-demand creation of missing meta-DSOs? This could use debuginfod (#75).

Also, remember the idea of never bundling uniqtypes or other metadata into base (non-meta) DSOs (in #69), instead having then depend on the meta-DSO, perhaps using weak references and a DT_USEFUL extension. Could allocsld rewrite DT_USEFUL into DT_NEEDED or something ignorable, according to whether the meta-DSO is findable-or-generable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant