ruby-yasm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +37 -21
- data/lib/yasm/program.rb +23 -45
- data/lib/yasm/task.rb +31 -39
- data/lib/yasm/version.rb +1 -1
- data/ruby-yasm.gemspec +73 -0
- data/spec/program_spec.rb +0 -12
- data/spec/spec_helper.rb +1 -1
- data/spec/task_spec.rb +0 -112
- metadata +66 -80
- data.tar.gz.sig +0 -0
- data/History.rdoc +0 -4
- data/Manifest.txt +0 -17
- data/README.rdoc +0 -85
- data/lib/yasm/yasm.rb +0 -142
- data/tasks/spec.rb +0 -10
- data/tasks/yard.rb +0 -13
- metadata.gz.sig +0 -0
data/.gitignore
ADDED
data/.specopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format specdoc
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title 'Ruby YASM Documentation' --protected --files ChangeLog.md,LICENSE.txt
|
data/ChangeLog.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2009-2010 Hal Brodigan
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# ruby-yasm
|
2
|
+
|
3
|
+
* [github.com/sophsec/ruby-yasm](http://github.com/sophsec/ruby-yasm/)
|
4
|
+
* [github.com/sophsec/ruby-yasm/issues](http://github.com/sophsec/ruby-yasm/issues)
|
5
|
+
* [www.tortall.net/projects/yasm](http://www.tortall.net/projects/yasm/)
|
6
|
+
* [www.sophsec.com](http://www.sophsec.com/)
|
7
|
+
* Postmodern (postmodern.mod3 at gmail.com)
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
A Ruby interface to YASM.
|
12
|
+
|
13
|
+
YASM is a complete rewrite of the NASM assembler, YASM currently supports
|
14
|
+
the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes,
|
15
|
+
outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32,
|
16
|
+
and Win64 object formats, and generates source debugging information in
|
17
|
+
STABS, DWARF 2, and CodeView 8 formats.
|
18
|
+
|
19
|
+
## Features
|
20
|
+
|
21
|
+
* Supports all of the `yasm` command-line options.
|
22
|
+
|
23
|
+
## Examples
|
24
|
+
|
25
|
+
Assemble a binary file:
|
26
|
+
|
27
|
+
YASM::Program.assemble do |yasm|
|
28
|
+
yasm.syntax = :gas
|
29
|
+
yasm.file = 'hello_world.S'
|
30
|
+
yasm.output = 'hello_world.o'
|
31
|
+
end
|
32
|
+
|
33
|
+
Assemble amd64 assembly, in GAS syntax, into an ELF64 file with
|
34
|
+
debugging information:
|
35
|
+
|
36
|
+
YASM::Program.assemble do |yasm|
|
37
|
+
yasm.target! :amd64
|
38
|
+
|
39
|
+
yasm.syntax = :gas
|
40
|
+
yasm.file = 'hello_world.S'
|
41
|
+
|
42
|
+
yasm.output = 'hello_world.o'
|
43
|
+
yasm.output_format = :elf64
|
44
|
+
yasm.debug_format = :stabs
|
45
|
+
end
|
46
|
+
|
47
|
+
## Requirements
|
48
|
+
|
49
|
+
* [yasm](http://www.tortall.net/projects/yasm/) >= 0.8.0.
|
50
|
+
* [rprogram](http://rprogram.rubyforge.org/) >= 0.1.8.
|
51
|
+
|
52
|
+
## Install
|
53
|
+
|
54
|
+
$ sudo gem install ruby-yasm
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
See {file:LICENSE.txt} for license information.
|
59
|
+
|
data/Rakefile
CHANGED
@@ -1,27 +1,43 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require './tasks/spec.rb'
|
7
|
-
require './tasks/yard.rb'
|
2
|
+
require 'rake'
|
3
|
+
require './lib/yasm/version.rb'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = 'ruby-yasm'
|
9
|
+
gem.version = YASM::VERSION
|
10
|
+
gem.summary = %Q{A Ruby interface to YASM.}
|
11
|
+
gem.description = %Q{A Ruby interface to YASM.}
|
12
|
+
gem.email = 'postmodern.mod3@gmail.com'
|
13
|
+
gem.homepage = 'http://github.com/sophsec/ruby-yasm'
|
14
|
+
gem.authors = ['Postmodern']
|
15
|
+
gem.add_dependency 'rprogram', '~> 0.1.8'
|
16
|
+
gem.add_development_dependency 'rspec', '~> 1.3.0'
|
17
|
+
gem.add_development_dependency 'yard', '~> 0.5.3'
|
18
|
+
gem.has_rdoc = 'yard'
|
19
|
+
end
|
20
|
+
Jeweler::GemcutterTasks.new
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
23
|
+
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
]
|
25
|
+
require 'spec/rake/spectask'
|
26
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
27
|
+
spec.libs += ['lib', 'spec']
|
28
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
spec.spec_opts = ['--options', '.specopts']
|
30
|
+
end
|
18
31
|
|
19
|
-
|
20
|
-
|
21
|
-
['yard', '>=0.5.2']
|
22
|
-
]
|
32
|
+
task :spec => :check_dependencies
|
33
|
+
task :default => :spec
|
23
34
|
|
24
|
-
|
25
|
-
|
35
|
+
begin
|
36
|
+
require 'yard'
|
26
37
|
|
27
|
-
|
38
|
+
YARD::Rake::YardocTask.new
|
39
|
+
rescue LoadError
|
40
|
+
task :yard do
|
41
|
+
abort "YARD is not available. In order to run yard, you must: gem install yard"
|
42
|
+
end
|
43
|
+
end
|
data/lib/yasm/program.rb
CHANGED
@@ -9,7 +9,7 @@ module YASM
|
|
9
9
|
name_program 'yasm'
|
10
10
|
|
11
11
|
#
|
12
|
-
# Finds the
|
12
|
+
# Finds the `yasm` program and assembles a file.
|
13
13
|
#
|
14
14
|
# @param [Hash{Symbol => Object}] options
|
15
15
|
# Additional options for yasm.
|
@@ -24,29 +24,20 @@ module YASM
|
|
24
24
|
# @return [Boolean]
|
25
25
|
# Specifies whether the command exited normally.
|
26
26
|
#
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
27
|
+
# @example
|
28
|
+
# Program.assemble(:parser => :gas, :output => 'code.o', :file => 'code.S')
|
31
29
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# @param [Hash{Symbol => Object}] options
|
36
|
-
# Additional options for yasm.
|
30
|
+
# @example
|
31
|
+
# Program.assemble do |yasm|
|
32
|
+
# yasm.target! :x86
|
37
33
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
34
|
+
# yasm.syntax = :gas
|
35
|
+
# yasm.file = 'code.S'
|
36
|
+
# yasm.output = 'code.o'
|
37
|
+
# end
|
41
38
|
#
|
42
|
-
|
43
|
-
|
44
|
-
#
|
45
|
-
# @return [TempFile]
|
46
|
-
# The temporary file containing the assembled object code.
|
47
|
-
#
|
48
|
-
def self.assemble_temp(options={},&block)
|
49
|
-
self.find().assemble(options,&block)
|
39
|
+
def Program.assemble(options={},&block)
|
40
|
+
Program.find().assemble(options,&block)
|
50
41
|
end
|
51
42
|
|
52
43
|
#
|
@@ -65,33 +56,20 @@ module YASM
|
|
65
56
|
# @return [Boolean]
|
66
57
|
# Specifies whether the command exited normally.
|
67
58
|
#
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Assembles an assembly file and writes the output to a temporary file.
|
74
|
-
#
|
75
|
-
# @param [Hash{Symbol => Object}] options
|
76
|
-
# Additional options for yasm.
|
77
|
-
#
|
78
|
-
# @yield [task]
|
79
|
-
# If a block is given, it will be passed a task object used to
|
80
|
-
# specify options for yasm.
|
59
|
+
# @example
|
60
|
+
# Program.assemble(:parser => :gas, :output => 'code.o', :file => 'code.S')
|
81
61
|
#
|
82
|
-
# @
|
83
|
-
#
|
62
|
+
# @example
|
63
|
+
# Program.assemble do |yasm|
|
64
|
+
# yasm.target! :x86
|
84
65
|
#
|
85
|
-
#
|
86
|
-
#
|
66
|
+
# yasm.syntax = :gas
|
67
|
+
# yasm.file = 'code.S'
|
68
|
+
# yasm.output = 'code.o'
|
69
|
+
# end
|
87
70
|
#
|
88
|
-
def
|
89
|
-
|
90
|
-
task.output = Tempfile.new('yasm').path
|
91
|
-
|
92
|
-
if run_task(task)
|
93
|
-
return task.output
|
94
|
-
end
|
71
|
+
def assemble(options={},&block)
|
72
|
+
run_task(Task.new(options,&block))
|
95
73
|
end
|
96
74
|
|
97
75
|
end
|
data/lib/yasm/task.rb
CHANGED
@@ -1,43 +1,41 @@
|
|
1
|
-
require 'yasm/yasm'
|
2
|
-
|
3
1
|
require 'rprogram/task'
|
4
2
|
|
5
3
|
module YASM
|
6
4
|
#
|
7
|
-
#
|
5
|
+
# ## YASM options:
|
8
6
|
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
7
|
+
# * `--version` - `yasm.version`
|
8
|
+
# * `--license` - `yasm.license`
|
9
|
+
# * `--help` - `yasm.help`
|
12
10
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
11
|
+
# * `--arch` - `yasm.arch`
|
12
|
+
# * `--parser` - `yasm.parser`
|
13
|
+
# * `--preproc` - `yasm.preprocessor`
|
14
|
+
# * `--oformat` - `yasm.output_format`
|
15
|
+
# * `--dformat` - `yasm.debug_format`
|
16
|
+
# * `--lformat` - `yasm.list_format`
|
19
17
|
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
18
|
+
# * `--list` - `yasm.list_file`
|
19
|
+
# * `--objfile` - `yasm.output`
|
20
|
+
# * `--mapfile` - `yasm.map_file`
|
23
21
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
22
|
+
# * `--machine` - `yasm.machine`
|
23
|
+
# * `--force-strict` - `yasm.force_strict`
|
24
|
+
# * `-w` - `yasm.inhibit_warnings`
|
25
|
+
# * `-W` - `yasm.toggle_warnings`
|
26
|
+
# * `-M` - `yasm.gen_makefile_deps`
|
27
|
+
# * `-E` - `yasm.redirect_errors_to`
|
28
|
+
# * `-e` - `yasm.redirect_errors`
|
29
|
+
# * `--preproc-only` - `yasm.preprocessor_only`
|
30
|
+
# * `-I` - `yasm.include`
|
31
|
+
# * `-P` - `yasm.pre_include`
|
32
|
+
# * `-D` - `yasm.define`
|
33
|
+
# * `-U` - `yasm.undefine`
|
34
|
+
# * `-X` - `yasm.message_style`
|
35
|
+
# * `--prefix` - `yasm.prefix`
|
36
|
+
# * `--suffix` - `yasm.suffix`
|
39
37
|
#
|
40
|
-
#
|
38
|
+
# * `file` - `yasm.file`
|
41
39
|
#
|
42
40
|
class Task < RProgram::Task
|
43
41
|
|
@@ -119,16 +117,10 @@ module YASM
|
|
119
117
|
super(options,&block)
|
120
118
|
|
121
119
|
self.target!(target) if target
|
122
|
-
|
123
|
-
self.parser ||= YASM.parser
|
124
|
-
self.arch ||= YASM.arch
|
125
|
-
self.machine ||= YASM.machine
|
126
|
-
self.debug_format ||= YASM.debug_format
|
127
|
-
self.output_format ||= YASM.output_format
|
128
120
|
end
|
129
121
|
|
130
122
|
#
|
131
|
-
# Sets the YASM
|
123
|
+
# Sets the YASM `arch` and `machine`.
|
132
124
|
#
|
133
125
|
# @param [String, Symbol] name
|
134
126
|
# The target name.
|
@@ -137,7 +129,7 @@ module YASM
|
|
137
129
|
# The specified target is unknown.
|
138
130
|
#
|
139
131
|
# @return [true]
|
140
|
-
# The YASM
|
132
|
+
# The YASM `arch` and `machine` options were set successfully.
|
141
133
|
#
|
142
134
|
# @example
|
143
135
|
# yasm.target! :amd64
|
data/lib/yasm/version.rb
CHANGED
data/ruby-yasm.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ruby-yasm}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Postmodern"]
|
12
|
+
s.date = %q{2010-04-15}
|
13
|
+
s.description = %q{A Ruby interface to YASM.}
|
14
|
+
s.email = %q{postmodern.mod3@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"ChangeLog.md",
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
".specopts",
|
23
|
+
".yardopts",
|
24
|
+
"ChangeLog.md",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"lib/yasm.rb",
|
29
|
+
"lib/yasm/program.rb",
|
30
|
+
"lib/yasm/task.rb",
|
31
|
+
"lib/yasm/version.rb",
|
32
|
+
"ruby-yasm.gemspec",
|
33
|
+
"spec/helpers/files.rb",
|
34
|
+
"spec/helpers/files/gas.S",
|
35
|
+
"spec/program_spec.rb",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"spec/task_spec.rb",
|
38
|
+
"spec/yasm_spec.rb"
|
39
|
+
]
|
40
|
+
s.has_rdoc = %q{yard}
|
41
|
+
s.homepage = %q{http://github.com/sophsec/ruby-yasm}
|
42
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.3.6}
|
45
|
+
s.summary = %q{A Ruby interface to YASM.}
|
46
|
+
s.test_files = [
|
47
|
+
"spec/spec_helper.rb",
|
48
|
+
"spec/yasm_spec.rb",
|
49
|
+
"spec/helpers/files.rb",
|
50
|
+
"spec/program_spec.rb",
|
51
|
+
"spec/task_spec.rb"
|
52
|
+
]
|
53
|
+
|
54
|
+
if s.respond_to? :specification_version then
|
55
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
56
|
+
s.specification_version = 3
|
57
|
+
|
58
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_runtime_dependency(%q<rprogram>, ["~> 0.1.8"])
|
60
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
|
61
|
+
s.add_development_dependency(%q<yard>, ["~> 0.5.3"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<rprogram>, ["~> 0.1.8"])
|
64
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
65
|
+
s.add_dependency(%q<yard>, ["~> 0.5.3"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<rprogram>, ["~> 0.1.8"])
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
70
|
+
s.add_dependency(%q<yard>, ["~> 0.5.3"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
data/spec/program_spec.rb
CHANGED
@@ -23,16 +23,4 @@ describe Program do
|
|
23
23
|
|
24
24
|
File.size(file).should > 0
|
25
25
|
end
|
26
|
-
|
27
|
-
it "should assemble a file, and write the output to a temporary file" do
|
28
|
-
file = @yasm.assemble_temp do |yasm|
|
29
|
-
yasm.target! :x86
|
30
|
-
|
31
|
-
yasm.syntax = :gas
|
32
|
-
yasm.file = assembly_file('gas')
|
33
|
-
end
|
34
|
-
|
35
|
-
file.should_not be_nil
|
36
|
-
File.size(file).should > 0
|
37
|
-
end
|
38
26
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/task_spec.rb
CHANGED
@@ -10,118 +10,6 @@ describe Task do
|
|
10
10
|
task.machine.should == :amd64
|
11
11
|
end
|
12
12
|
|
13
|
-
describe "default" do
|
14
|
-
describe "parser" do
|
15
|
-
before(:all) do
|
16
|
-
@old_parser = YASM.parser
|
17
|
-
|
18
|
-
YASM.parser = :tasm
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a default parser value" do
|
22
|
-
task = Task.new
|
23
|
-
task.parser.should == :tasm
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should allow overriding the default parser" do
|
27
|
-
task = Task.new(:parser => :gas)
|
28
|
-
task.parser.should == :gas
|
29
|
-
end
|
30
|
-
|
31
|
-
after(:all) do
|
32
|
-
YASM.parser = @old_parser
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "arch" do
|
37
|
-
before(:all) do
|
38
|
-
@old_arch = YASM.arch
|
39
|
-
|
40
|
-
YASM.arch = :lc3b
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have a default arch value" do
|
44
|
-
task = Task.new
|
45
|
-
task.arch.should == :lc3b
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should allow overriding the default arch" do
|
49
|
-
task = Task.new(:arch => :x86)
|
50
|
-
task.arch.should == :x86
|
51
|
-
end
|
52
|
-
|
53
|
-
after(:all) do
|
54
|
-
YASM.arch = @old_arch
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "machine" do
|
59
|
-
before(:all) do
|
60
|
-
@old_machine = YASM.machine
|
61
|
-
|
62
|
-
YASM.machine = :amd64
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should have a default machine value" do
|
66
|
-
task = Task.new
|
67
|
-
task.machine.should == :amd64
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should allow overriding the default machine" do
|
71
|
-
task = Task.new(:machine => :x86)
|
72
|
-
task.machine.should == :x86
|
73
|
-
end
|
74
|
-
|
75
|
-
after(:all) do
|
76
|
-
YASM.machine = @old_machine
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "debug_format" do
|
81
|
-
before(:all) do
|
82
|
-
@old_debug_format = YASM.debug_format
|
83
|
-
|
84
|
-
YASM.debug_format = :stabs
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should have a default debug_format value" do
|
88
|
-
task = Task.new
|
89
|
-
task.debug_format.should == :stabs
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should allow overriding the default debug_format" do
|
93
|
-
task = Task.new(:debug_format => :null)
|
94
|
-
task.debug_format.should == :null
|
95
|
-
end
|
96
|
-
|
97
|
-
after(:all) do
|
98
|
-
YASM.debug_format = @old_debug_format
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "output_format" do
|
103
|
-
before(:all) do
|
104
|
-
@old_output_format = YASM.output_format
|
105
|
-
|
106
|
-
YASM.output_format = :elf64
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should have a default output_format value" do
|
110
|
-
task = Task.new
|
111
|
-
task.output_format.should == :elf64
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should allow overriding the default output_format" do
|
115
|
-
task = Task.new(:output_format => :bin)
|
116
|
-
task.output_format.should == :bin
|
117
|
-
end
|
118
|
-
|
119
|
-
after(:all) do
|
120
|
-
YASM.output_format = @old_output_format
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
13
|
describe "target!" do
|
126
14
|
it "should return true for valid targets" do
|
127
15
|
task = Task.new
|
metadata
CHANGED
@@ -1,140 +1,126 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-yasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Postmodern
|
8
13
|
autorequire:
|
9
14
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
- |
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
|
14
|
-
bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
15
|
-
ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
|
16
|
-
BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
|
17
|
-
CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
18
|
-
1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
|
19
|
-
mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
|
20
|
-
W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
|
21
|
-
7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
|
22
|
-
+Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
|
23
|
-
T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
|
24
|
-
sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
|
25
|
-
ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
|
26
|
-
xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
|
27
|
-
cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
|
28
|
-
GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
|
29
|
-
/fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
|
30
|
-
pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
|
31
|
-
-----END CERTIFICATE-----
|
15
|
+
cert_chain: []
|
32
16
|
|
33
|
-
date:
|
17
|
+
date: 2010-04-15 00:00:00 -07:00
|
34
18
|
default_executable:
|
35
19
|
dependencies:
|
36
20
|
- !ruby/object:Gem::Dependency
|
37
21
|
name: rprogram
|
38
|
-
|
39
|
-
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
41
24
|
requirements:
|
42
|
-
- -
|
25
|
+
- - ~>
|
43
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 1
|
30
|
+
- 8
|
44
31
|
version: 0.1.8
|
45
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
46
34
|
- !ruby/object:Gem::Dependency
|
47
35
|
name: rspec
|
48
|
-
|
49
|
-
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
51
38
|
requirements:
|
52
|
-
- -
|
39
|
+
- - ~>
|
53
40
|
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 3
|
44
|
+
- 0
|
45
|
+
version: 1.3.0
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
56
48
|
- !ruby/object:Gem::Dependency
|
57
49
|
name: yard
|
58
|
-
|
59
|
-
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
61
52
|
requirements:
|
62
|
-
- -
|
53
|
+
- - ~>
|
63
54
|
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
|
66
|
-
-
|
67
|
-
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 5
|
58
|
+
- 3
|
59
|
+
version: 0.5.3
|
68
60
|
type: :development
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 2.4.0
|
75
|
-
version:
|
76
|
-
description: |-
|
77
|
-
A Ruby interface to YASM.
|
78
|
-
|
79
|
-
YASM is a complete rewrite of the NASM assembler, YASM currently supports
|
80
|
-
the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes,
|
81
|
-
outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32,
|
82
|
-
and Win64 object formats, and generates source debugging information in
|
83
|
-
STABS, DWARF 2, and CodeView 8 formats.
|
84
|
-
email:
|
85
|
-
- postmodern.mod3@gmail.com
|
61
|
+
version_requirements: *id003
|
62
|
+
description: A Ruby interface to YASM.
|
63
|
+
email: postmodern.mod3@gmail.com
|
86
64
|
executables: []
|
87
65
|
|
88
66
|
extensions: []
|
89
67
|
|
90
68
|
extra_rdoc_files:
|
91
|
-
-
|
69
|
+
- ChangeLog.md
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
92
72
|
files:
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
73
|
+
- .gitignore
|
74
|
+
- .specopts
|
75
|
+
- .yardopts
|
76
|
+
- ChangeLog.md
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
96
79
|
- Rakefile
|
97
80
|
- lib/yasm.rb
|
98
|
-
- lib/yasm/task.rb
|
99
81
|
- lib/yasm/program.rb
|
100
|
-
- lib/yasm/
|
82
|
+
- lib/yasm/task.rb
|
101
83
|
- lib/yasm/version.rb
|
102
|
-
-
|
103
|
-
- tasks/yard.rb
|
104
|
-
- spec/spec_helper.rb
|
84
|
+
- ruby-yasm.gemspec
|
105
85
|
- spec/helpers/files.rb
|
106
86
|
- spec/helpers/files/gas.S
|
107
|
-
- spec/task_spec.rb
|
108
87
|
- spec/program_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
- spec/task_spec.rb
|
109
90
|
- spec/yasm_spec.rb
|
110
91
|
has_rdoc: yard
|
111
|
-
homepage: http://
|
92
|
+
homepage: http://github.com/sophsec/ruby-yasm
|
112
93
|
licenses: []
|
113
94
|
|
114
95
|
post_install_message:
|
115
96
|
rdoc_options:
|
116
|
-
- --
|
117
|
-
- README.rdoc
|
97
|
+
- --charset=UTF-8
|
118
98
|
require_paths:
|
119
99
|
- lib
|
120
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
101
|
requirements:
|
122
102
|
- - ">="
|
123
103
|
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 0
|
124
106
|
version: "0"
|
125
|
-
version:
|
126
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
108
|
requirements:
|
128
109
|
- - ">="
|
129
110
|
- !ruby/object:Gem::Version
|
111
|
+
segments:
|
112
|
+
- 0
|
130
113
|
version: "0"
|
131
|
-
version:
|
132
114
|
requirements: []
|
133
115
|
|
134
|
-
rubyforge_project:
|
135
|
-
rubygems_version: 1.3.
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.3.6
|
136
118
|
signing_key:
|
137
119
|
specification_version: 3
|
138
|
-
summary: A Ruby interface to YASM
|
139
|
-
test_files:
|
140
|
-
|
120
|
+
summary: A Ruby interface to YASM.
|
121
|
+
test_files:
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- spec/yasm_spec.rb
|
124
|
+
- spec/helpers/files.rb
|
125
|
+
- spec/program_spec.rb
|
126
|
+
- spec/task_spec.rb
|
data.tar.gz.sig
DELETED
Binary file
|
data/History.rdoc
DELETED
data/Manifest.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
History.rdoc
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
lib/yasm.rb
|
6
|
-
lib/yasm/task.rb
|
7
|
-
lib/yasm/program.rb
|
8
|
-
lib/yasm/yasm.rb
|
9
|
-
lib/yasm/version.rb
|
10
|
-
tasks/spec.rb
|
11
|
-
tasks/yard.rb
|
12
|
-
spec/spec_helper.rb
|
13
|
-
spec/helpers/files.rb
|
14
|
-
spec/helpers/files/gas.S
|
15
|
-
spec/task_spec.rb
|
16
|
-
spec/program_spec.rb
|
17
|
-
spec/yasm_spec.rb
|
data/README.rdoc
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
= ruby-yasm
|
2
|
-
|
3
|
-
* http://www.tortall.net/projects/yasm/
|
4
|
-
* http://www.sophsec.com/
|
5
|
-
* Postmodern (postmodern.mod3 at gmail.com)
|
6
|
-
|
7
|
-
== DESCRIPTION:
|
8
|
-
|
9
|
-
A Ruby interface to YASM.
|
10
|
-
|
11
|
-
YASM is a complete rewrite of the NASM assembler, YASM currently supports
|
12
|
-
the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes,
|
13
|
-
outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32,
|
14
|
-
and Win64 object formats, and generates source debugging information in
|
15
|
-
STABS, DWARF 2, and CodeView 8 formats.
|
16
|
-
|
17
|
-
== FEATURES:
|
18
|
-
|
19
|
-
* Supports all of the +yasm+ command-line options.
|
20
|
-
|
21
|
-
== EXAMPLES:
|
22
|
-
|
23
|
-
* Assemble a binary file:
|
24
|
-
|
25
|
-
YASM::Program.assemble do |yasm|
|
26
|
-
yasm.syntax = :gas
|
27
|
-
yasm.file = 'hello_world.S'
|
28
|
-
yasm.output = 'hello_world.o'
|
29
|
-
end
|
30
|
-
|
31
|
-
* Assemble a binary file, and write the output to a temporary file:
|
32
|
-
|
33
|
-
YASM::Program.assemble_temp do |yasm|
|
34
|
-
yasm.syntax = :gas
|
35
|
-
yasm.file = 'hello_world.S'
|
36
|
-
end
|
37
|
-
# => "/tmp/yasm.3386.0"
|
38
|
-
|
39
|
-
* Assemble amd64 assembly, in GAS syntax, into an ELF64 file with
|
40
|
-
debugging information:
|
41
|
-
|
42
|
-
YASM::Program.assemble do |yasm|
|
43
|
-
yasm.target! :amd64
|
44
|
-
|
45
|
-
yasm.syntax = :gas
|
46
|
-
yasm.file = 'hello_world.S'
|
47
|
-
|
48
|
-
yasm.output = 'hello_world.o'
|
49
|
-
yasm.output_format = :elf64
|
50
|
-
yasm.debug_format = :stabs
|
51
|
-
end
|
52
|
-
|
53
|
-
== REQUIREMENTS:
|
54
|
-
|
55
|
-
* {yasm}[http://www.tortall.net/projects/yasm/] >= 0.8.0.
|
56
|
-
* {rprogram}[http://rprogram.rubyforge.org/] >= 0.1.8.
|
57
|
-
|
58
|
-
== INSTALL:
|
59
|
-
|
60
|
-
$ sudo gem install ruby-yasm
|
61
|
-
|
62
|
-
== LICENSE:
|
63
|
-
|
64
|
-
(The MIT License)
|
65
|
-
|
66
|
-
Copyright (c) 2009 Hal Brodigan
|
67
|
-
|
68
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
69
|
-
a copy of this software and associated documentation files (the
|
70
|
-
'Software'), to deal in the Software without restriction, including
|
71
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
72
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
73
|
-
permit persons to whom the Software is furnished to do so, subject to
|
74
|
-
the following conditions:
|
75
|
-
|
76
|
-
The above copyright notice and this permission notice shall be
|
77
|
-
included in all copies or substantial portions of the Software.
|
78
|
-
|
79
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
80
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
81
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
82
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
83
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
84
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
85
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/yasm/yasm.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
module YASM
|
2
|
-
@@yasm_parser = nil
|
3
|
-
@@yasm_arch = nil
|
4
|
-
@@yasm_machine = nil
|
5
|
-
@@yasm_debug_format = nil
|
6
|
-
@@yasm_output_format = nil
|
7
|
-
|
8
|
-
#
|
9
|
-
# The default YASM parser to use.
|
10
|
-
#
|
11
|
-
# @return [Symbol]
|
12
|
-
# The YASM parser.
|
13
|
-
#
|
14
|
-
def YASM.parser
|
15
|
-
@@yasm_parser
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# Sets the default YASM parser to use.
|
20
|
-
#
|
21
|
-
# @param [Symbol, String] new_parser
|
22
|
-
# The new YASM parser to use.
|
23
|
-
#
|
24
|
-
# @return [Symbol]
|
25
|
-
# The new YASM parser to use.
|
26
|
-
#
|
27
|
-
def YASM.parser=(new_parser)
|
28
|
-
@@yasm_parser = if new_parser.nil?
|
29
|
-
nil
|
30
|
-
else
|
31
|
-
new_parser.to_sym
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# The default YASM architecture to assemble for.
|
37
|
-
#
|
38
|
-
# @return [Symbol]
|
39
|
-
# The YASM architecture.
|
40
|
-
#
|
41
|
-
def YASM.arch
|
42
|
-
@@yasm_arch
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Sets the default YASM architecture to assemble for.
|
47
|
-
#
|
48
|
-
# @param [Symbol, String] new_arch
|
49
|
-
# The new YASM architecture to assemble for.
|
50
|
-
#
|
51
|
-
# @return [Symbol]
|
52
|
-
# The new YASM architecture to assemble for.
|
53
|
-
#
|
54
|
-
def YASM.arch=(new_arch)
|
55
|
-
if new_arch.nil?
|
56
|
-
@@yasm_arch = nil
|
57
|
-
else
|
58
|
-
@@yasm_arch = new_arch.to_sym
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# The default YASM machine to assemble for.
|
64
|
-
#
|
65
|
-
# @return [Symbol]
|
66
|
-
# The YASM machine.
|
67
|
-
#
|
68
|
-
def YASM.machine
|
69
|
-
@@yasm_machine ||= nil
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Sets the default YASM machine to assemble for.
|
74
|
-
#
|
75
|
-
# @param [Symbol, String] new_machine
|
76
|
-
# The new YASM machine to assemble for.
|
77
|
-
#
|
78
|
-
# @return [Symbol]
|
79
|
-
# The new YASM machine to assemble for.
|
80
|
-
#
|
81
|
-
def YASM.machine=(new_machine)
|
82
|
-
@@yasm_machine = if new_machine.nil?
|
83
|
-
nil
|
84
|
-
else
|
85
|
-
new_machine.to_sym
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
#
|
90
|
-
# The default YASM debugging format to use.
|
91
|
-
#
|
92
|
-
# @return [Symbol]
|
93
|
-
# The YASM debugging format.
|
94
|
-
#
|
95
|
-
def YASM.debug_format
|
96
|
-
@@yasm_debug_format
|
97
|
-
end
|
98
|
-
|
99
|
-
#
|
100
|
-
# Sets the default YASM debugging format to use.
|
101
|
-
#
|
102
|
-
# @param [Symbol, String] new_format
|
103
|
-
# The new YASM debugging format to use.
|
104
|
-
#
|
105
|
-
# @return [Symbol]
|
106
|
-
# The new YASM debugging format to use.
|
107
|
-
#
|
108
|
-
def YASM.debug_format=(new_format)
|
109
|
-
@@yasm_debug_format = if new_format.nil?
|
110
|
-
nil
|
111
|
-
else
|
112
|
-
new_format.to_sym
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
#
|
117
|
-
# The default YASM output format to use.
|
118
|
-
#
|
119
|
-
# @return [Symbol]
|
120
|
-
# The YASM output format.
|
121
|
-
#
|
122
|
-
def YASM.output_format
|
123
|
-
@@yasm_output_format
|
124
|
-
end
|
125
|
-
|
126
|
-
#
|
127
|
-
# Sets the default YASM output format to use.
|
128
|
-
#
|
129
|
-
# @param [Symbol, String] new_format
|
130
|
-
# The new YASM output format to use.
|
131
|
-
#
|
132
|
-
# @return [Symbol]
|
133
|
-
# The new YASM output format to use.
|
134
|
-
#
|
135
|
-
def YASM.output_format=(new_format)
|
136
|
-
@@yasm_output_format = if new_format.nil?
|
137
|
-
nil
|
138
|
-
else
|
139
|
-
new_format.to_sym
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
data/tasks/spec.rb
DELETED
data/tasks/yard.rb
DELETED
metadata.gz.sig
DELETED
Binary file
|