class LinkAgainstFinder::Finder

Public Instance Methods

calculateDependencyRelations(targetBins, potentialBins) click to toggle source

@return [Lib]

# File lib/LinkAgainstFinder.rb, line 25
def calculateDependencyRelations(targetBins, potentialBins)

  cache = {}
  generate_lib = Proc.new do |path|
    lib = cache[path]
    next lib unless lib.nil?

    lib = Lib.new
    lib.path = path
    lib.symbolTable = Objdump.new(path).getSymbolTable
    lib.dependencies = Set.new
    cache[path] = lib
    lib
  end

  targets = targetBins.map(&generate_lib)
  potentials = potentialBins.map(&generate_lib)

  targets.each do |lib|
    lib.symbolTable.externalSymbols.each do |symbol|
      dep = potentials.find do |otherLib|
        otherLib.symbolTable.internalSymbols.include?(symbol)
      end
      lib.dependencies.add(dep) unless dep.nil?
    end
  end

  return targets
end
calculateEachOtherDependencyRelations(binaries) click to toggle source

@return [Lib]

# File lib/LinkAgainstFinder.rb, line 19
def calculateEachOtherDependencyRelations(binaries)
  calculateDependencyRelations(binaries, binaries)
end