Skip to content

Commit 99e614a

Browse files
committed
macho/load_commands: support new load commands from macOS 15.4
1 parent 46ea9c5 commit 99e614a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/macho/load_commands.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ module LoadCommands
6666
(LC_REQ_DYLD | 0x34) => :LC_DYLD_CHAINED_FIXUPS,
6767
(LC_REQ_DYLD | 0x35) => :LC_FILESET_ENTRY,
6868
0x36 => :LC_ATOM_INFO,
69+
0x37 => :LC_FUNCTION_VARIANTS,
70+
0x38 => :LC_FUNCTION_VARIANT_FIXUPS,
71+
0x39 => :LC_TARGET_TRIPLE,
6972
}.freeze
7073

7174
# association of symbol representations to load command constants
@@ -155,6 +158,9 @@ module LoadCommands
155158
:LC_DYLD_CHAINED_FIXUPS => "LinkeditDataCommand",
156159
:LC_FILESET_ENTRY => "FilesetEntryCommand",
157160
:LC_ATOM_INFO => "LinkeditDataCommand",
161+
:LC_FUNCTION_VARIANTS => "LinkeditDataCommand",
162+
:LC_FUNCTION_VARIANT_FIXUPS => "LinkeditDataCommand",
163+
:LC_TARGET_TRIPLE => "TargetTripleCommand",
158164
}.freeze
159165

160166
# association of segment name symbols to names
@@ -1053,11 +1059,26 @@ def to_h
10531059
end
10541060
end
10551061

1062+
# A load command containing the target triple used when compiling the binary.
1063+
# Corresponds to LC_TARGET_TRIPLE.
1064+
class TargetTripleCommand < LoadCommand
1065+
# @return [LCStr] the target triple used when compiling the binary
1066+
field :triple, :lcstr, :to_s => true
1067+
1068+
# @return [Hash] a hash representation of this {RpathCommand}
1069+
def to_h
1070+
{
1071+
"triple" => triple.to_h,
1072+
}.merge super
1073+
end
1074+
end
1075+
10561076
# A load command representing the offsets and sizes of a blob of data in
10571077
# the __LINKEDIT segment. Corresponds to LC_CODE_SIGNATURE,
10581078
# LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS, LC_DATA_IN_CODE,
10591079
# LC_DYLIB_CODE_SIGN_DRS, LC_LINKER_OPTIMIZATION_HINT, LC_DYLD_EXPORTS_TRIE,
1060-
# LC_DYLD_CHAINED_FIXUPS, or LC_ATOM_INFO.
1080+
# LC_DYLD_CHAINED_FIXUPS, LC_ATOM_INFO, LC_FUNCTION_VARIANTS,
1081+
# or LC_FUNCTION_VARIANT_FIXUPS.
10611082
class LinkeditDataCommand < LoadCommand
10621083
# @return [Integer] offset to the data in the __LINKEDIT segment
10631084
field :dataoff, :uint32

0 commit comments

Comments
 (0)