1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

[yaml2obj][MachO] Rename PayloadString to Content

The new name is conciser and matches yaml2obj ELF & DWARF.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D106759
This commit is contained in:
Fangrui Song 2021-07-26 09:04:51 -07:00
parent fa9a368e39
commit f0aeef47e5
25 changed files with 77 additions and 77 deletions

View File

@ -76,7 +76,7 @@ struct LoadCommand {
std::vector<Section> Sections;
std::vector<MachO::build_tool_version> Tools;
std::vector<llvm::yaml::Hex8> PayloadBytes;
std::string PayloadString;
std::string Content;
uint64_t ZeroPadBytes;
};

View File

@ -155,9 +155,9 @@ size_t writeLoadCommandData<MachO::segment_command_64>(
size_t writePayloadString(MachOYAML::LoadCommand &LC, raw_ostream &OS) {
size_t BytesWritten = 0;
if (!LC.PayloadString.empty()) {
OS.write(LC.PayloadString.c_str(), LC.PayloadString.length());
BytesWritten = LC.PayloadString.length();
if (!LC.Content.empty()) {
OS.write(LC.Content.c_str(), LC.Content.length());
BytesWritten = LC.Content.length();
}
return BytesWritten;
}

View File

@ -218,19 +218,19 @@ void mapLoadCommandData<MachO::segment_command_64>(
template <>
void mapLoadCommandData<MachO::dylib_command>(
IO &IO, MachOYAML::LoadCommand &LoadCommand) {
IO.mapOptional("PayloadString", LoadCommand.PayloadString);
IO.mapOptional("Content", LoadCommand.Content);
}
template <>
void mapLoadCommandData<MachO::rpath_command>(
IO &IO, MachOYAML::LoadCommand &LoadCommand) {
IO.mapOptional("PayloadString", LoadCommand.PayloadString);
IO.mapOptional("Content", LoadCommand.Content);
}
template <>
void mapLoadCommandData<MachO::dylinker_command>(
IO &IO, MachOYAML::LoadCommand &LoadCommand) {
IO.mapOptional("PayloadString", LoadCommand.PayloadString);
IO.mapOptional("Content", LoadCommand.Content);
}
template <>

View File

@ -14,7 +14,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_LOAD_DYLIB
cmdsize: 48
@ -23,7 +23,7 @@ LoadCommands:
timestamp: 2
current_version: 7864576
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 56
@ -32,7 +32,7 @@ LoadCommands:
timestamp: 2
current_version: 80349697
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
...
@ -40,7 +40,7 @@ LoadCommands:
#CHECK: - cmd: LC_LOAD_DYLINKER
#CHECK: cmdsize: 32
#CHECK: name: 12
#CHECK: PayloadString: '/usr/lib/dyld'
#CHECK: Content: '/usr/lib/dyld'
#CHECK: ZeroPadBytes: 7
#CHECK: - cmd: LC_LOAD_DYLIB
#CHECK: cmdsize: 48
@ -49,7 +49,7 @@ LoadCommands:
#CHECK: timestamp: 2
#CHECK: current_version: 7864576
#CHECK: compatibility_version: 65536
#CHECK: PayloadString: '/usr/lib/libc++.1.dylib'
#CHECK: Content: '/usr/lib/libc++.1.dylib'
#CHECK: ZeroPadBytes: 1
#CHECK: - cmd: LC_LOAD_DYLIB
#CHECK: cmdsize: 56
@ -58,5 +58,5 @@ LoadCommands:
#CHECK: timestamp: 2
#CHECK: current_version: 80349697
#CHECK: compatibility_version: 65536
#CHECK: PayloadString: '/usr/lib/libSystem.B.dylib'
#CHECK: Content: '/usr/lib/libSystem.B.dylib'
#CHECK: ZeroPadBytes: 6

View File

@ -96,7 +96,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -119,7 +119,7 @@ LoadCommands:
timestamp: 2
current_version: 7864576
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 56
@ -128,7 +128,7 @@ LoadCommands:
timestamp: 2
current_version: 80349697
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -95,7 +95,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 28
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 3
- cmd: LC_UUID
cmdsize: 24
@ -118,7 +118,7 @@ LoadCommands:
timestamp: 2
current_version: 7864576
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 52
@ -127,7 +127,7 @@ LoadCommands:
timestamp: 2
current_version: 80349697
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 2
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -96,7 +96,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -119,7 +119,7 @@ LoadCommands:
timestamp: 2
current_version: 7864576
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 56
@ -128,7 +128,7 @@ LoadCommands:
timestamp: 2
current_version: 80349697
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -98,7 +98,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -121,7 +121,7 @@ LoadCommands:
timestamp: 2
current_version: 7864576
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 56
@ -130,7 +130,7 @@ LoadCommands:
timestamp: 2
current_version: 80349697
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -111,7 +111,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -134,7 +134,7 @@ LoadCommands:
timestamp: 2
current_version: 81985536
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -109,7 +109,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 28
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 3
- cmd: LC_UUID
cmdsize: 24
@ -132,7 +132,7 @@ LoadCommands:
timestamp: 2
current_version: 81985536
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 2
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -180,7 +180,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: /usr/lib/dyld
Content: /usr/lib/dyld
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -208,7 +208,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -263,7 +263,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 28
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 3
- cmd: LC_UUID
cmdsize: 24
@ -291,7 +291,7 @@ LoadCommands:
timestamp: 2
current_version: 26216708
compatibility_version: 65536
PayloadString: '/usr/lib/libc++.1.dylib'
Content: '/usr/lib/libc++.1.dylib'
ZeroPadBytes: 1
- cmd: LC_LOAD_DYLIB
cmdsize: 68
@ -300,7 +300,7 @@ LoadCommands:
timestamp: 2
current_version: 0
compatibility_version: 0
PayloadString: '@rpath/MobileConfig.framework/MobileConfig'
Content: '@rpath/MobileConfig.framework/MobileConfig'
ZeroPadBytes: 2
- cmd: LC_LOAD_DYLIB
cmdsize: 84
@ -309,7 +309,7 @@ LoadCommands:
timestamp: 2
current_version: 102895360
compatibility_version: 19660800
PayloadString: '/System/Library/Frameworks/Foundation.framework/Foundation'
Content: '/System/Library/Frameworks/Foundation.framework/Foundation'
ZeroPadBytes: 2
- cmd: LC_LOAD_DYLIB
cmdsize: 76
@ -318,7 +318,7 @@ LoadCommands:
timestamp: 2
current_version: 917504
compatibility_version: 65536
PayloadString: '/System/Library/Frameworks/MapKit.framework/MapKit'
Content: '/System/Library/Frameworks/MapKit.framework/MapKit'
ZeroPadBytes: 2
- cmd: LC_LOAD_DYLIB
cmdsize: 84
@ -327,7 +327,7 @@ LoadCommands:
timestamp: 2
current_version: 68352
compatibility_version: 66048
PayloadString: '/System/Library/Frameworks/QuartzCore.framework/QuartzCore'
Content: '/System/Library/Frameworks/QuartzCore.framework/QuartzCore'
ZeroPadBytes: 2
- cmd: LC_LOAD_DYLIB
cmdsize: 76
@ -336,7 +336,7 @@ LoadCommands:
timestamp: 2
current_version: 3997696000
compatibility_version: 65536
PayloadString: '/System/Library/Frameworks/UIKit.framework/UIKit'
Content: '/System/Library/Frameworks/UIKit.framework/UIKit'
ZeroPadBytes: 4
- cmd: LC_LOAD_DYLIB
cmdsize: 52
@ -345,7 +345,7 @@ LoadCommands:
timestamp: 2
current_version: 14942208
compatibility_version: 65536
PayloadString: '/usr/lib/libobjc.A.dylib'
Content: '/usr/lib/libobjc.A.dylib'
ZeroPadBytes: 4
- cmd: LC_LOAD_DYLIB
cmdsize: 52
@ -354,7 +354,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 2
- cmd: LC_LOAD_DYLIB
cmdsize: 92
@ -363,17 +363,17 @@ LoadCommands:
timestamp: 2
current_version: 102895360
compatibility_version: 9830400
PayloadString: '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
Content: '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
ZeroPadBytes: 2
- cmd: LC_RPATH
cmdsize: 28
path: 12
PayloadString: '/usr/lib/swift'
Content: '/usr/lib/swift'
ZeroPadBytes: 2
- cmd: LC_RPATH
cmdsize: 40
path: 12
PayloadString: '@executable_path/Frameworks'
Content: '@executable_path/Frameworks'
ZeroPadBytes: 1
- cmd: LC_DATA_IN_CODE
cmdsize: 16

View File

@ -144,7 +144,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -172,7 +172,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -152,7 +152,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -184,7 +184,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -96,7 +96,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/dylib/LOAD'
Content: '/usr/dylib/LOAD'
- cmd: LC_LOAD_WEAK_DYLIB
cmdsize: 40
dylib:
@ -104,4 +104,4 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/dylib/WEAK'
Content: '/usr/dylib/WEAK'

View File

@ -71,20 +71,20 @@ LoadCommands:
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_a/.'
Content: '@executable_a/.'
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_b/.'
Content: '@executable_b/.'
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_c/.'
Content: '@executable_c/.'
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_d/.'
Content: '@executable_d/.'
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_e/.'
Content: '@executable_e/.'

View File

@ -45,7 +45,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/A'
Content: '/usr/lib/A'
# RUN: yaml2obj %s --docnum=2 -o %t

View File

@ -127,16 +127,16 @@ LoadCommands:
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_a/.'
Content: '@executable_a/.'
- cmd: LC_RPATH
cmdsize: 40
path: 12
PayloadString: '@executable_short_test/.'
Content: '@executable_short_test/.'
- cmd: LC_RPATH
cmdsize: 40
path: 12
PayloadString: '@executable_long_test/.'
Content: '@executable_long_test/.'
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_d/.'
Content: '@executable_d/.'

View File

@ -20,6 +20,6 @@ LoadCommands:
timestamp: 2
current_version: 65536
compatibility_version: 65536
PayloadString: '/System/Library/Frameworks/Network.framework/Network'
Content: '/System/Library/Frameworks/Network.framework/Network'
ZeroPadBytes: 4
...

View File

@ -112,7 +112,7 @@ LoadCommands:
- cmd: LC_RPATH
cmdsize: 32
path: 12
PayloadString: '@executable_a/.'
Content: '@executable_a/.'
- cmd: LC_DYLD_INFO_ONLY
cmdsize: 48
rebase_off: 0
@ -143,7 +143,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -175,7 +175,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_DYSYMTAB
cmdsize: 80

View File

@ -154,7 +154,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 28
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 3
- cmd: LC_UUID
cmdsize: 24
@ -182,7 +182,7 @@ LoadCommands:
timestamp: 2
current_version: 83951616
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 2
- cmd: LC_FUNCTION_STARTS
cmdsize: 16
@ -366,7 +366,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -400,7 +400,7 @@ LoadCommands:
timestamp: 2
current_version: 83951616
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16
@ -583,7 +583,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 28
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 3
- cmd: LC_UUID
cmdsize: 24
@ -616,7 +616,7 @@ LoadCommands:
timestamp: 2
current_version: 83951616
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 2
- cmd: LC_FUNCTION_STARTS
cmdsize: 16
@ -800,7 +800,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -828,7 +828,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -169,7 +169,7 @@ LoadCommands:
- cmd: LC_LOAD_DYLINKER
cmdsize: 32
name: 12
PayloadString: '/usr/lib/dyld'
Content: '/usr/lib/dyld'
ZeroPadBytes: 7
- cmd: LC_UUID
cmdsize: 24
@ -197,7 +197,7 @@ LoadCommands:
timestamp: 2
current_version: 82115073
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -23,4 +23,4 @@ LoadCommands:
timestamp: 2
current_version: 81985536
compatibility_version: 65536
PayloadString: /usr/lib/libSystem.B.dylib
Content: /usr/lib/libSystem.B.dylib

View File

@ -52,7 +52,7 @@ LoadCommands:
timestamp: 1
current_version: 65536
compatibility_version: 65536
PayloadString: macho-no-exports.dylib
Content: macho-no-exports.dylib
ZeroPadBytes: 2
- cmd: LC_DYLD_INFO_ONLY
cmdsize: 48
@ -109,7 +109,7 @@ LoadCommands:
timestamp: 2
current_version: 79495168
compatibility_version: 65536
PayloadString: '/usr/lib/libSystem.B.dylib'
Content: '/usr/lib/libSystem.B.dylib'
ZeroPadBytes: 6
- cmd: LC_FUNCTION_STARTS
cmdsize: 16

View File

@ -226,7 +226,7 @@ readString(MachOYAML::LoadCommand &LC,
auto Start = LoadCmd.Ptr + sizeof(StructType);
auto MaxSize = LoadCmd.C.cmdsize - sizeof(StructType);
auto Size = strnlen(Start, MaxSize);
LC.PayloadString = StringRef(Start, Size).str();
LC.Content = StringRef(Start, Size).str();
return Start + Size;
}