forked from OSchip/llvm-project
[lld/mac] Change load command order to be more like ld64
No meaningful behavior change. Makes diffing `otool -l` output a bit easier. Differential Revision: https://reviews.llvm.org/D106219
This commit is contained in:
parent
a2cc67eaf0
commit
bcbb3066ce
|
@ -690,10 +690,6 @@ template <class LP> void Writer::createLoadCommands() {
|
||||||
make<LCDysymtab>(symtabSection, indirectSymtabSection));
|
make<LCDysymtab>(symtabSection, indirectSymtabSection));
|
||||||
if (!config->umbrella.empty())
|
if (!config->umbrella.empty())
|
||||||
in.header->addLoadCommand(make<LCSubFramework>(config->umbrella));
|
in.header->addLoadCommand(make<LCSubFramework>(config->umbrella));
|
||||||
if (functionStartsSection)
|
|
||||||
in.header->addLoadCommand(make<LCFunctionStarts>(functionStartsSection));
|
|
||||||
if (dataInCodeSection)
|
|
||||||
in.header->addLoadCommand(make<LCDataInCode>(dataInCodeSection));
|
|
||||||
if (config->emitEncryptionInfo)
|
if (config->emitEncryptionInfo)
|
||||||
in.header->addLoadCommand(make<LCEncryptionInfo<LP>>());
|
in.header->addLoadCommand(make<LCEncryptionInfo<LP>>());
|
||||||
for (StringRef path : config->runtimePaths)
|
for (StringRef path : config->runtimePaths)
|
||||||
|
@ -702,7 +698,6 @@ template <class LP> void Writer::createLoadCommands() {
|
||||||
switch (config->outputType) {
|
switch (config->outputType) {
|
||||||
case MH_EXECUTE:
|
case MH_EXECUTE:
|
||||||
in.header->addLoadCommand(make<LCLoadDylinker>());
|
in.header->addLoadCommand(make<LCLoadDylinker>());
|
||||||
in.header->addLoadCommand(make<LCMain>());
|
|
||||||
break;
|
break;
|
||||||
case MH_DYLIB:
|
case MH_DYLIB:
|
||||||
in.header->addLoadCommand(make<LCDylib>(LC_ID_DYLIB, config->installName,
|
in.header->addLoadCommand(make<LCDylib>(LC_ID_DYLIB, config->installName,
|
||||||
|
@ -723,6 +718,10 @@ template <class LP> void Writer::createLoadCommands() {
|
||||||
else
|
else
|
||||||
in.header->addLoadCommand(make<LCMinVersion>(config->platformInfo));
|
in.header->addLoadCommand(make<LCMinVersion>(config->platformInfo));
|
||||||
|
|
||||||
|
// This is down here to match ld64's load command order.
|
||||||
|
if (config->outputType == MH_EXECUTE)
|
||||||
|
in.header->addLoadCommand(make<LCMain>());
|
||||||
|
|
||||||
int64_t dylibOrdinal = 1;
|
int64_t dylibOrdinal = 1;
|
||||||
DenseMap<StringRef, int64_t> ordinalForInstallName;
|
DenseMap<StringRef, int64_t> ordinalForInstallName;
|
||||||
for (InputFile *file : inputFiles) {
|
for (InputFile *file : inputFiles) {
|
||||||
|
@ -789,6 +788,10 @@ template <class LP> void Writer::createLoadCommands() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (functionStartsSection)
|
||||||
|
in.header->addLoadCommand(make<LCFunctionStarts>(functionStartsSection));
|
||||||
|
if (dataInCodeSection)
|
||||||
|
in.header->addLoadCommand(make<LCDataInCode>(dataInCodeSection));
|
||||||
if (codeSignatureSection)
|
if (codeSignatureSection)
|
||||||
in.header->addLoadCommand(make<LCCodeSignature>(codeSignatureSection));
|
in.header->addLoadCommand(make<LCCodeSignature>(codeSignatureSection));
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,13 @@
|
||||||
# COMMON: cmd LC_DYSYMTAB
|
# COMMON: cmd LC_DYSYMTAB
|
||||||
|
|
||||||
# EXEC: cmd LC_LOAD_DYLINKER
|
# EXEC: cmd LC_LOAD_DYLINKER
|
||||||
# EXEC: cmd LC_MAIN
|
|
||||||
# DYLIB: cmd LC_ID_DYLIB
|
# DYLIB: cmd LC_ID_DYLIB
|
||||||
|
|
||||||
# COMMON: cmd LC_UUID
|
# COMMON: cmd LC_UUID
|
||||||
# COMMON: cmd LC_BUILD_VERSION
|
# COMMON: cmd LC_BUILD_VERSION
|
||||||
|
|
||||||
|
# EXEC: cmd LC_MAIN
|
||||||
|
|
||||||
# COMMON: cmd LC_LOAD_DYLIB
|
# COMMON: cmd LC_LOAD_DYLIB
|
||||||
|
|
||||||
.section __TEXT,__cstring
|
.section __TEXT,__cstring
|
||||||
|
|
Loading…
Reference in New Issue