LinkAgainstFinder 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 12b8fcc3ef7f74b4edc0911a0a41968908536dab274aabcf95d4d90fe57a4234
4
+ data.tar.gz: adf9bcd8e1b9887bc8b880ec2b86de5e49b9854adad5e89bfcc6efc27b4e3d36
5
+ SHA512:
6
+ metadata.gz: bc39ba0529c447c78bd963ab3fcac8a756efe9929e99bc817f1a821775cb05f4ed8dbd632abfc9549a2dcdaa9f54384f4d85d17c2d00af13153a39ae7a2e81b2
7
+ data.tar.gz: 5f21d9764308ee4ce56c698bb2fec7e00849a8034174c3883ce9b86e010830d6719481f7f1be37629bde0a8905ced20ab66776536b4cc0c4bef6f19d3047e8b3
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /bundler_cache/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build LinkAgainstFinder-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install LinkAgainstFinder-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install LinkAgainstFinder-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push LinkAgainstFinder-0.1.0.gem to Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <excludeFolder url="file://$MODULE_DIR$/bundler_cache/cache" />
9
+ </content>
10
+ <orderEntry type="inheritedJdk" />
11
+ <orderEntry type="sourceFolder" forTests="false" />
12
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.2, ruby-2.3.7-p456) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.3.7-p456) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.3.7-p456) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.3.7-p456) [gem]" level="application" />
16
+ </component>
17
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.3.7-p456" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/LinkAgainstFinder.iml" filepath="$PROJECT_DIR$/.idea/LinkAgainstFinder.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,102 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="efc6ee81-c3ff-495b-b1aa-0b001b799fa0" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+ </list>
7
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="Git.Settings">
14
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
+ </component>
16
+ <component name="ProjectId" id="1SxyMiDXZRp9T8wFRLQvrCss6wZ" />
17
+ <component name="ProjectLevelVcsManager">
18
+ <ConfirmationsSetting value="1" id="Add" />
19
+ </component>
20
+ <component name="PropertiesComponent">
21
+ <property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
22
+ <property name="WebServerToolWindowFactoryState" value="false" />
23
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
24
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
25
+ <property name="nodejs_package_manager_path" value="npm" />
26
+ <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
27
+ </component>
28
+ <component name="RecentsManager">
29
+ <key name="MoveFile.RECENT_KEYS">
30
+ <recent name="$PROJECT_DIR$/lib/LinkAgainstFinder" />
31
+ </key>
32
+ </component>
33
+ <component name="RunDashboard">
34
+ <option name="ruleStates">
35
+ <list>
36
+ <RuleState>
37
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
38
+ </RuleState>
39
+ <RuleState>
40
+ <option name="name" value="StatusDashboardGroupingRule" />
41
+ </RuleState>
42
+ </list>
43
+ </option>
44
+ </component>
45
+ <component name="RunManager">
46
+ <configuration name="console" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
47
+ <module name="LinkAgainstFinder" />
48
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
49
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/bin" />
50
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="true" />
51
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="ruby-2.6.4-p104" />
52
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
53
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
54
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
55
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
56
+ <COVERAGE_PATTERN ENABLED="true">
57
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
58
+ </COVERAGE_PATTERN>
59
+ </EXTENSION>
60
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/bin/linkAgainstFinder" />
61
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
62
+ <method v="2" />
63
+ </configuration>
64
+ <recent_temporary>
65
+ <list>
66
+ <item itemvalue="Ruby.console" />
67
+ </list>
68
+ </recent_temporary>
69
+ </component>
70
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
71
+ <component name="SvnConfiguration">
72
+ <configuration />
73
+ </component>
74
+ <component name="TaskManager">
75
+ <task active="true" id="Default" summary="Default task">
76
+ <changelist id="efc6ee81-c3ff-495b-b1aa-0b001b799fa0" name="Default Changelist" comment="" />
77
+ <created>1572519494008</created>
78
+ <option name="number" value="Default" />
79
+ <option name="presentableId" value="Default" />
80
+ <updated>1572519494008</updated>
81
+ <workItem from="1572519495052" duration="8944000" />
82
+ </task>
83
+ <servers />
84
+ </component>
85
+ <component name="TypeScriptGeneratedFilesManager">
86
+ <option name="version" value="1" />
87
+ </component>
88
+ <component name="Vcs.Log.Tabs.Properties">
89
+ <option name="TAB_STATES">
90
+ <map>
91
+ <entry key="MAIN">
92
+ <value>
93
+ <State />
94
+ </value>
95
+ </entry>
96
+ </map>
97
+ </option>
98
+ </component>
99
+ <component name="com.intellij.coverage.CoverageDataManagerImpl">
100
+ <SUITE FILE_PATH="coverage/LinkAgainstFinder@console.rcov" NAME="console Coverage Results" MODIFIED="1572579014904" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/bin" MODULE_NAME="LinkAgainstFinder" />
101
+ </component>
102
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.4
7
+ before_install: gem install bundler -v 2.0.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gaojiji@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in LinkAgainstFinder.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ LinkAgainstFinder (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.9.0)
12
+ rspec-core (~> 3.9.0)
13
+ rspec-expectations (~> 3.9.0)
14
+ rspec-mocks (~> 3.9.0)
15
+ rspec-core (3.9.0)
16
+ rspec-support (~> 3.9.0)
17
+ rspec-expectations (3.9.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.9.0)
20
+ rspec-mocks (3.9.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.9.0)
23
+ rspec-support (3.9.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ LinkAgainstFinder!
30
+ bundler (~> 2.0)
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 2.0.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Gao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "LinkAgainstFinder/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "LinkAgainstFinder"
7
+ spec.version = LinkAgainstFinder::VERSION
8
+ spec.authors = ["Gao"]
9
+ spec.email = ["gaojiji@gmail.com"]
10
+
11
+ spec.summary = %q{ find the link dependencies of a branch of .a files }
12
+ spec.description = %q{ Write a longer description or delete this line.}
13
+ spec.homepage = "http://xxx.org"
14
+ spec.license = "MIT"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "http://xxx.org"
18
+ spec.metadata["changelog_uri"] = "http://xxx.org."
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 2.0"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+
33
+ spec.required_ruby_version = '>= 2.6.0'
34
+
35
+ end
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # LinkAgainstFinder
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/LinkAgainstFinder`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'LinkAgainstFinder'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install LinkAgainstFinder
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/LinkAgainstFinder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the LinkAgainstFinder project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/LinkAgainstFinder/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "LinkAgainstFinder"
4
+ require 'yaml'
5
+
6
+ path = ARGV[0]
7
+ Dir.chdir(path) unless path.nil?
8
+
9
+ files = Dir.glob('**/*.a')
10
+ finder = LinkAgainstFinder::Finder.new(files)
11
+ libs = finder.calculateDepedencyRelations
12
+ puts libs
@@ -0,0 +1,44 @@
1
+ require 'pathname'
2
+ require 'set'
3
+
4
+ module LinkAgainstFinder
5
+ class Objdump
6
+
7
+ def initialize(binary_path)
8
+ self.binary_path = Pathname.new(binary_path)
9
+ raise "File not exist" unless self.binary_path.exist?
10
+ end
11
+
12
+ attr_accessor :binary_path
13
+
14
+ def getSymbolTable
15
+ output = `objdump -arch=arm64 -syms #{binary_path}`
16
+ parts = output.split("\n\n")
17
+ parts = parts.reject{|p| p.include?('file format')}
18
+ lines = parts.map{ |p| p.split("\n")[1..-1] }.flatten
19
+
20
+ externals = lines.select{|l|l.include?('*UND*')}
21
+ internals = lines.select{|l| !l.include?('*UND*')}
22
+
23
+ table = SymbolTable.new
24
+ table.internalSymbols = Set.new(internals.map do |l|
25
+ l.split("\t")[-1]
26
+ end)
27
+ table.externalSymbols = Set.new(externals.map do |l|
28
+ l.split("\t")[-1]
29
+ end).reject { |s| table.internalSymbols.include?(s) }
30
+ table.externalSymbols = Set.new(table.externalSymbols)
31
+
32
+ table
33
+ end
34
+
35
+ end
36
+
37
+ class Objdump
38
+
39
+ class SymbolTable
40
+ attr_accessor :internalSymbols # Array<String>
41
+ attr_accessor :externalSymbols # Array<String>
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module LinkAgainstFinder
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,52 @@
1
+ require "LinkAgainstFinder/version"
2
+ require 'LinkAgainstFinder/objdump'
3
+
4
+ module LinkAgainstFinder
5
+
6
+ class Finder
7
+
8
+ def initialize(all_binary_paths)
9
+ @all_binary_paths = all_binary_paths
10
+ end
11
+
12
+ public
13
+
14
+ class Lib
15
+ attr_accessor :path
16
+ attr_accessor :symbolTable
17
+ attr_accessor :dependencies
18
+
19
+ def to_s
20
+ <<-TEXT
21
+ #{path}:
22
+ #{dependencies.map{|l| "-> #{l.path}"}.join("\n")}
23
+ TEXT
24
+ end
25
+ end
26
+
27
+ def calculateDepedencyRelations
28
+ libs = @all_binary_paths.map do |path|
29
+ lib = Lib.new
30
+ lib.path = path
31
+ lib.symbolTable = Objdump.new(path).getSymbolTable
32
+ lib.dependencies = Set.new
33
+ lib
34
+ end
35
+
36
+ libs.each do |lib|
37
+ lib.symbolTable.externalSymbols.each do |symbol|
38
+ dep = libs.find do |otherLib|
39
+ otherLib.symbolTable.internalSymbols.include?(symbol)
40
+ end
41
+ lib.dependencies.add(dep) unless dep.nil?
42
+ end
43
+ end
44
+
45
+ return libs
46
+ end
47
+
48
+ end
49
+ end
50
+
51
+
52
+
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: LinkAgainstFinder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gao
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-11-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: " Write a longer description or delete this line."
56
+ email:
57
+ - gaojiji@gmail.com
58
+ executables:
59
+ - linkAgainstFinder
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".idea/.rakeTasks"
65
+ - ".idea/LinkAgainstFinder.iml"
66
+ - ".idea/misc.xml"
67
+ - ".idea/modules.xml"
68
+ - ".idea/vcs.xml"
69
+ - ".idea/workspace.xml"
70
+ - ".rspec"
71
+ - ".travis.yml"
72
+ - CODE_OF_CONDUCT.md
73
+ - Gemfile
74
+ - Gemfile.lock
75
+ - LICENSE.txt
76
+ - LinkAgainstFinder.gemspec
77
+ - README.md
78
+ - Rakefile
79
+ - exe/linkAgainstFinder
80
+ - lib/LinkAgainstFinder.rb
81
+ - lib/LinkAgainstFinder/objdump.rb
82
+ - lib/LinkAgainstFinder/version.rb
83
+ homepage: http://xxx.org
84
+ licenses:
85
+ - MIT
86
+ metadata:
87
+ homepage_uri: http://xxx.org
88
+ source_code_uri: http://xxx.org
89
+ changelog_uri: http://xxx.org.
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 2.6.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: find the link dependencies of a branch of .a files
109
+ test_files: []