Module: L::LD
- Defined in:
- lib/rub/l/ld.rb,
lib/rub/l/ld/linker/ld.rb,
lib/rub/l/ld/linker/gcc.rb,
lib/rub/l/ld/linker/clang.rb
Overview
#
This software is provided 'as-is', without any express or implied #
warranty. In no event will the authors be held liable for any damages #
arising from the use of this software. #
#
Permission is granted to anyone to use this software for any purpose, #
including commercial applications, and to alter it and redistribute it #
freely, subject to the following restrictions: #
#
1. The origin of this software must not be misrepresented; you must not #
claim that you wrote the original software. If you use this software in #
a product, an acknowledgment in the product documentation would be #
appreciated but is not required. #
#
2. Altered source versions must be plainly marked as such, and must not be #
misrepresented as being the original software. #
#
3. This notice may not be removed or altered from any source distribution. #
#
Defined Under Namespace
Modules: Linker, LinkerClang, LinkerGCC, LinkerLD Classes: LibraryArray
Class Method Summary collapse
-
.args ⇒ Array<String>
Default arguments to add to the linker command.
- .initialize_copy(s) ⇒ Object
-
.library_dirs ⇒ Array<Pathname>
A list of library search directories to be added to the default search path.
-
.link(src, libs, name, format: :exe) ⇒ Pathname
Link object files.
-
.linker ⇒ Linker
The linker being used.
-
.linkers ⇒ Hash{Symbol=>Linker}
All available linkers.
-
.optimize ⇒ Symbol
Default optimization level.
- .set_linker(name) ⇒ Object
-
.static ⇒ true, false
The default for static linking.
Class Method Details
.args ⇒ Array<String>
This adds raw arguments to the linker command and is a quick n’ easy way to reduce portability. If you can, use the other options provided by this class in order to maintain portability.
Default arguments to add to the linker command.
85 |
# File 'lib/rub/l/ld.rb', line 85 cattr_accessor :args |
.initialize_copy(s) ⇒ Object
249 250 251 252 253 |
# File 'lib/rub/l/ld.rb', line 249 def self.initialize_copy(s) super self.library_dirs = s.library_dirs.dup end |
.library_dirs ⇒ Array<Pathname>
A list of library search directories to be added to the default search path.
These paths are searched in order.
67 |
# File 'lib/rub/l/ld.rb', line 67 cattr_accessor :library_dirs |
.link(src, libs, name, format: :exe) ⇒ Pathname
Link object files.
235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/rub/l/ld.rb', line 235 def self.link(src, libs, name, format: :exe) src = R::Tool.make_set_paths src libs = R::Tool.make_set libs libfs = libs.map {|l| linker.find_lib(self, l) or raise "Can't find library #{l}."} out = linker.full_name name, format out = R::Env.out_dir + 'l/ld/' + C.unique_segment(src, libs, self) + out C::generator(src+libfs, linker.link_command(self, src, libs, out, format), out) out end |
.linkers ⇒ Hash{Symbol=>Linker}
All available linkers.
32 |
# File 'lib/rub/l/ld.rb', line 32 cattr_reader :linkers |
.optimize ⇒ Symbol
Default optimization level.
This takes one of four optimization levels. The actual optimization done is linker dependant. For example, some linker may not have any optimization so all levels will be equivalent.
One of the following:
:none
-
Perform no optimization. This should be fast and debuggable.
:some
-
Perform light optimization that is pretty fast.
:full
-
Perform a high level of optimization producing a fast binary. this may considerably slow down compilation.
:max
-
Perform all available optimizations. These may be experimental and very slow.
This value defaults to :full
if D:debug
is set, otherwise :none
.
58 |
# File 'lib/rub/l/ld.rb', line 58 cattr_accessor :optimize |
.set_linker(name) ⇒ Object
92 93 94 |
# File 'lib/rub/l/ld.rb', line 92 def self.set_linker(name) self.linker = linkers[name] end |
.static ⇒ true, false
The default for static linking.
If set to true shared libraries won’t be used. Defaults to false.
75 |
# File 'lib/rub/l/ld.rb', line 75 cattr_accessor :static |