Class: MachO::RpathCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::RpathCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command representing an rpath, which specifies a path that should be added to the current run path used to find @rpath prefixed dylibs. Corresponds to LC_RPATH.
Constant Summary collapse
- FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"L=3".freeze
- SIZEOF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
12
Instance Attribute Summary collapse
-
#path ⇒ MachO::LoadCommand::LCStr
readonly
The path to add to the run path as an LCStr.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, path) ⇒ RpathCommand
constructor
private
A new instance of RpathCommand.
-
#serialize(context) ⇒ String
private
The serialized fields of the load command.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, path) ⇒ RpathCommand
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RpathCommand.
936 937 938 939 |
# File 'lib/macho/load_commands.rb', line 936 def initialize(view, cmd, cmdsize, path) super(view, cmd, cmdsize) @path = LCStr.new(self, path) end |
Instance Attribute Details
#path ⇒ MachO::LoadCommand::LCStr (readonly)
Returns the path to add to the run path as an LCStr.
925 926 927 |
# File 'lib/macho/load_commands.rb', line 925 def path @path end |
Instance Method Details
#serialize(context) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the serialized fields of the load command.
944 945 946 947 948 949 |
# File 'lib/macho/load_commands.rb', line 944 def serialize(context) format = Utils.specialize_format(FORMAT, context.endianness) string_payload, string_offsets = Utils.pack_strings(SIZEOF, context.alignment, :path => path.to_s) cmdsize = SIZEOF + string_payload.bytesize [cmd, cmdsize, string_offsets[:path]].pack(format) + string_payload end |