LinkAgainstFinder 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/workspace.xml +7 -1
- data/exe/linkAgainstFinder +2 -2
- data/lib/LinkAgainstFinder.rb +30 -19
- data/lib/LinkAgainstFinder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71d62c0650b379e0b4125f35ef67042ece04132cd9cb32a058f471f652c99c6
|
4
|
+
data.tar.gz: 3c59c5e5c3243da079a144021abea26d0808faeb67f98f40afedfb2065091c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb5729689553f096975853ede7593a9e30ddadab016c2b9ca812abd4bac67eb5e2542c7c25e09204b4ae33a4335e6d139adcda61fd4bb03f89ebe8abb895bcff
|
7
|
+
data.tar.gz: e1b072bec22d31cd28fbe269544a9c4acbb8145dbdb0cd56872c2a63e9f9a963079d67d5c4443aa61c8354eac43e8e36dc868426618301d3f3ce49f2c5008453
|
data/.idea/workspace.xml
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
<component name="ChangeListManager">
|
4
4
|
<list default="true" id="efc6ee81-c3ff-495b-b1aa-0b001b799fa0" name="Default Changelist" comment="">
|
5
5
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6
|
+
<change beforePath="$PROJECT_DIR$/exe/linkAgainstFinder" beforeDir="false" afterPath="$PROJECT_DIR$/exe/linkAgainstFinder" afterDir="false" />
|
7
|
+
<change beforePath="$PROJECT_DIR$/lib/LinkAgainstFinder.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/LinkAgainstFinder.rb" afterDir="false" />
|
8
|
+
<change beforePath="$PROJECT_DIR$/lib/LinkAgainstFinder/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/LinkAgainstFinder/version.rb" afterDir="false" />
|
6
9
|
</list>
|
7
10
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
8
11
|
<option name="SHOW_DIALOG" value="false" />
|
@@ -79,6 +82,7 @@
|
|
79
82
|
<option name="presentableId" value="Default" />
|
80
83
|
<updated>1572519494008</updated>
|
81
84
|
<workItem from="1572519495052" duration="8944000" />
|
85
|
+
<workItem from="1572754070238" duration="229000" />
|
82
86
|
</task>
|
83
87
|
<servers />
|
84
88
|
</component>
|
@@ -90,7 +94,9 @@
|
|
90
94
|
<map>
|
91
95
|
<entry key="MAIN">
|
92
96
|
<value>
|
93
|
-
<State
|
97
|
+
<State>
|
98
|
+
<option name="COLUMN_ORDER" />
|
99
|
+
</State>
|
94
100
|
</value>
|
95
101
|
</entry>
|
96
102
|
</map>
|
data/exe/linkAgainstFinder
CHANGED
@@ -7,6 +7,6 @@ path = ARGV[0]
|
|
7
7
|
Dir.chdir(path) unless path.nil?
|
8
8
|
|
9
9
|
files = Dir.glob('**/*.a')
|
10
|
-
finder = LinkAgainstFinder::Finder.new
|
11
|
-
libs = finder.
|
10
|
+
finder = LinkAgainstFinder::Finder.new
|
11
|
+
libs = finder.calculateEachOtherDependencyRelations(files)
|
12
12
|
puts libs
|
data/lib/LinkAgainstFinder.rb
CHANGED
@@ -5,44 +5,55 @@ module LinkAgainstFinder
|
|
5
5
|
|
6
6
|
class Finder
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
public
|
9
|
+
# @return [Lib]
|
10
|
+
def calculateEachOtherDependencyRelations(binaries)
|
11
|
+
calculateDependencyRelations(binaries, binaries)
|
10
12
|
end
|
11
13
|
|
12
|
-
public
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
attr_accessor :symbolTable
|
17
|
-
attr_accessor :dependencies
|
15
|
+
# @return [Lib]
|
16
|
+
def calculateDependencyRelations(targetBins, potentialBins)
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
TEXT
|
24
|
-
end
|
25
|
-
end
|
18
|
+
cache = {}
|
19
|
+
generate_lib = Proc.new do |path|
|
20
|
+
lib = cache[path]
|
21
|
+
next lib unless lib.nil?
|
26
22
|
|
27
|
-
def calculateDepedencyRelations
|
28
|
-
libs = @all_binary_paths.map do |path|
|
29
23
|
lib = Lib.new
|
30
24
|
lib.path = path
|
31
25
|
lib.symbolTable = Objdump.new(path).getSymbolTable
|
32
26
|
lib.dependencies = Set.new
|
27
|
+
cache[path] = lib
|
33
28
|
lib
|
34
29
|
end
|
35
30
|
|
36
|
-
|
31
|
+
targets = targetBins.map(&generate_lib)
|
32
|
+
potentials = potentialBins.map(&generate_lib)
|
33
|
+
|
34
|
+
targets.each do |lib|
|
37
35
|
lib.symbolTable.externalSymbols.each do |symbol|
|
38
|
-
dep =
|
36
|
+
dep = potentials.find do |otherLib|
|
39
37
|
otherLib.symbolTable.internalSymbols.include?(symbol)
|
40
38
|
end
|
41
39
|
lib.dependencies.add(dep) unless dep.nil?
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
|
-
return
|
43
|
+
return targets
|
44
|
+
end
|
45
|
+
|
46
|
+
class Lib
|
47
|
+
attr_accessor :path
|
48
|
+
attr_accessor :symbolTable
|
49
|
+
attr_accessor :dependencies
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
<<-TEXT
|
53
|
+
#{path}:
|
54
|
+
#{dependencies.map{|l| "-> #{l.path}"}.join("\n")}
|
55
|
+
TEXT
|
56
|
+
end
|
46
57
|
end
|
47
58
|
|
48
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: LinkAgainstFinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|