curry.backends.cxx.elf module
A reader of the dynamic section of an ELF shared object: the names it
needs (DT_NEEDED), its own name (DT_SONAME) and its search paths
(DT_RPATH, DT_RUNPATH). It reads what readelf -d prints for
those tags, without the binutils.
The loader of the C++ backend reads the needed names of an object before it
opens the object: a compiled module names the objects of its imports by
their SONAMEs (see toolchain.soname), and the modules must be loaded
before the dynamic linker looks for the names. The tests read the SONAME
and the needed names of a compiled module.
The reader finds the dynamic section through the program headers
(PT_DYNAMIC), as the dynamic linker does, and the strings through the
loadable segment that maps the string table. So it reads an object whose
section headers were stripped (strip --strip-section-headers), which
the dynamic linker still loads. It reads the header, the program headers
and the two sections with seeks, not the whole file.
The reader handles the 64-bit format of either byte order, which is what the C++ compiler writes on the platforms Sprite supports.
- class curry.backends.cxx.elf.DynamicSection(needed, soname, rpath, runpath)[source]
Bases:
objectThe string entries of the dynamic section of a shared object.
- curry.backends.cxx.elf.read_dynamic(filename)[source]
Reads the dynamic section of the shared object
filename. Returns a DynamicSection.- Raises:
ValueError – the file is not a 64-bit ELF file, or has no dynamic section (a relocatable or a static object), or is truncated.
OSError – the file cannot be read.