Method: Elf::File#is_compatible
- Defined in:
- lib/elf/file.rb
#is_compatible(other) ⇒ Object
Checks whether two ELF files are compatible one with the other for linking
This function has to check whether two ELF files can be linked together (either at build time or at load time), and thus checks for class, encoding, versioning, ABI and machine type.
Note that it explicitly does not check for ELF file type since you can link different type of files together, like an Executable with a Dynamic library.
373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/elf/file.rb', line 373 def is_compatible(other) raise TypeError.new("wrong argument type #{other.class} (expected Elf::File)") unless other.is_a? Elf::File compatible_abi = (@abi.linux_compatible? && other.abi.linux_compatible?) \ || ([@abi, @abi_version] == [other.abi, other.abi_version]) @elf_class == other.elf_class and @data_encoding == other.data_encoding and @version == other.version and @machine == other.machine and compatible_abi end |