pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg_install fails when archivers/xz is installed

On Thu 30 Jul 2020 at 08:10:43 -0400, Greg Troxel wrote:
> Rhialto <> writes:
> > I haven't checked any relevant ELF standards yet, but I wonder how
> > difficult it would be to add such a thing.
[ full path names of shared libraries as dependencies, instead of just
  their soname ]
> Good question; let us know what you figure out.

Wikipedia led me to (version 1.2, May 1995) as a spec.

This contains:

page 2-10:

| DT_NEEDED	This element holds the string table offset of a
| 		null-terminated string, giving the name of a needed
| 		library. The offset is an index into the table recorded
| 		in the DT_STRTAB entry. See "Shared Object
| 		Dependencies'' for more information about these names.
| 		The dynamic array may contain multiple entries with this
| 		type. These entries' relative order is significant,
| 		though their relation to entries of other types is not.

page 2-12:

| Shared Object Dependencies
| When the link editor processes an archive library,  it extracts library
| members and copies them into the output object file.  These statically
| linked services are available during execution without involving the
| dynamic linker. Shared objects also provide services, and the dynamic
| linker must attach the proper shared object files to the process image
| for execution. Thus executable and shared object files describe their
| specific dependencies.
| When the dynamic linker creates the memory segments for an object file,
| the dependencies (recorded in  DT_NEEDED entries of the dynamic
| structure) tell what shared objects are needed to supply the program's
| services. By repeatedly connecting referenced shared objects and their
| dependencies, the dynamic linker builds a complete process image. When
| resolving symbolic references, the dynamic linker examines the symbol
| tables with a breadth-first search. That is, it first looks at the
| symbol table of the executable program itself, then at the symbol tables
| of the DT_NEEDED entries (in order), then at the second level DT_NEEDED
| entries, and so on. Shared object files must be readable by the process;
| other permissions are not required.
| NOTE.	Even when a shared object is referenced multiple times in the
| 	dependency list, the dynamic linker will connect the object only
| 	once to the process.
| Names in the dependency list are copies either of the DT_SONAME strings
| or the path names of the shared objects used to build the object file.
| For example, if the link editor builds an executable file using one
| shared object with a DT_SONAME entry of lib1 and another shared object
| library with the path name /usr/lib/lib2, the executable file will
| contain lib1 and /usr/lib/lib2 in its dependency list.If a shared object
| name has one or more slash (/) characters anywhere in the name, such as
| /usr/lib/lib2 above or directory/file, the dynamic linker uses that
| string directly as the path name.  If the name has no slashes, such as
| lib1 above, three facilities specify shared object path searching, with
| the following precedence.

The part I undercareted doesn't just not forbid, but explictly allows,
(full) path names of shared libraries as DT_NEEDED strings. There is no
(other) source given for the "dependency list" than the DT_NEEDED
entries. The paragraph after that reinforces this once more.

It also means that our tooling doesn't make use of this. In at least one
real life project, I'm linking explicitly with
/usr/pkg/lib/, and /usr/pkg/lib/ but
the DT_NEEDED entry in the end result doesn't reflect this.

Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"

Attachment: signature.asc
Description: PGP signature

Home | Main Index | Thread Index | Old Index