| author | |
| committer | |
| log | 54e470f9361a0bd9d141f2ff9cd4168fbdd7c16f |
| tree | 7742f4c8d20073a6ee346116110eda63468a4b55 |
| parent | c9474faa4e6cfd6480c1bd24216c26f4320e3c29 |
| signature |
15 files changed, 253 insertions(+), 79 deletions(-)
deps/lld/COFF/Driver.cpp+56-58| ... | @@ -116,6 +116,19 @@ static std::future<MBErrPair> createFutureForFile(std::string Path) { | ... | @@ -116,6 +116,19 @@ static std::future<MBErrPair> createFutureForFile(std::string Path) { |
| 116 | }); | 116 | }); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | // Symbol names are mangled by prepending "_" on x86. | ||
| 120 | static StringRef mangle(StringRef Sym) { | ||
| 121 | assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN); | ||
| 122 | if (Config->Machine == I386) | ||
| 123 | return Saver.save("_" + Sym); | ||
| 124 | return Sym; | ||
| 125 | } | ||
| 126 | |||
| 127 | static bool findUnderscoreMangle(StringRef Sym) { | ||
| 128 | StringRef Entry = Symtab->findMangle(mangle(Sym)); | ||
| 129 | return !Entry.empty() && !isa<Undefined>(Symtab->find(Entry)); | ||
| 130 | } | ||
| 131 | |||
| 119 | MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> MB) { | 132 | MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> MB) { |
| 120 | MemoryBufferRef MBRef = *MB; | 133 | MemoryBufferRef MBRef = *MB; |
| 121 | make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take ownership | 134 | make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take ownership |
| ... | @@ -407,54 +420,38 @@ Symbol *LinkerDriver::addUndefined(StringRef Name) { | ... | @@ -407,54 +420,38 @@ Symbol *LinkerDriver::addUndefined(StringRef Name) { |
| 407 | return B; | 420 | return B; |
| 408 | } | 421 | } |
| 409 | 422 | ||
| 410 | // Symbol names are mangled by appending "_" prefix on x86. | ||
| 411 | StringRef LinkerDriver::mangle(StringRef Sym) { | ||
| 412 | assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN); | ||
| 413 | if (Config->Machine == I386) | ||
| 414 | return Saver.save("_" + Sym); | ||
| 415 | return Sym; | ||
| 416 | } | ||
| 417 | |||
| 418 | // Windows specific -- find default entry point name. | 423 | // Windows specific -- find default entry point name. |
| 419 | // | 424 | // |
| 420 | // There are four different entry point functions for Windows executables, | 425 | // There are four different entry point functions for Windows executables, |
| 421 | // each of which corresponds to a user-defined "main" function. This function | 426 | // each of which corresponds to a user-defined "main" function. This function |
| 422 | // infers an entry point from a user-defined "main" function. | 427 | // infers an entry point from a user-defined "main" function. |
| 423 | StringRef LinkerDriver::findDefaultEntry() { | 428 | StringRef LinkerDriver::findDefaultEntry() { |
| 429 | assert(Config->Subsystem != IMAGE_SUBSYSTEM_UNKNOWN && | ||
| 430 | "must handle /subsystem before calling this"); | ||
| 431 | |||
| 424 | // As a special case, if /nodefaultlib is given, we directly look for an | 432 | // As a special case, if /nodefaultlib is given, we directly look for an |
| 425 | // entry point. This is because, if no default library is linked, users | 433 | // entry point. This is because, if no default library is linked, users |
| 426 | // need to define an entry point instead of a "main". | 434 | // need to define an entry point instead of a "main". |
| 427 | if (Config->NoDefaultLibAll) { | 435 | bool FindMain = !Config->NoDefaultLibAll; |
| 428 | for (StringRef S : {"mainCRTStartup", "wmainCRTStartup", | 436 | if (Config->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) { |
| 429 | "WinMainCRTStartup", "wWinMainCRTStartup"}) { | 437 | if (findUnderscoreMangle(FindMain ? "WinMain" : "WinMainCRTStartup")) |
| 430 | StringRef Entry = Symtab->findMangle(S); | 438 | return mangle("WinMainCRTStartup"); |
| 431 | if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry))) | 439 | if (findUnderscoreMangle(FindMain ? "wWinMain" : "wWinMainCRTStartup")) |
| 432 | return mangle(S); | 440 | return mangle("wWinMainCRTStartup"); |
| 433 | } | ||
| 434 | return ""; | ||
| 435 | } | ||
| 436 | |||
| 437 | // User-defined main functions and their corresponding entry points. | ||
| 438 | static const char *Entries[][2] = { | ||
| 439 | {"main", "mainCRTStartup"}, | ||
| 440 | {"wmain", "wmainCRTStartup"}, | ||
| 441 | {"WinMain", "WinMainCRTStartup"}, | ||
| 442 | {"wWinMain", "wWinMainCRTStartup"}, | ||
| 443 | }; | ||
| 444 | for (auto E : Entries) { | ||
| 445 | StringRef Entry = Symtab->findMangle(mangle(E[0])); | ||
| 446 | if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry))) | ||
| 447 | return mangle(E[1]); | ||
| 448 | } | 441 | } |
| 442 | if (findUnderscoreMangle(FindMain ? "main" : "mainCRTStartup")) | ||
| 443 | return mangle("mainCRTStartup"); | ||
| 444 | if (findUnderscoreMangle(FindMain ? "wmain" : "wmainCRTStartup")) | ||
| 445 | return mangle("wmainCRTStartup"); | ||
| 449 | return ""; | 446 | return ""; |
| 450 | } | 447 | } |
| 451 | 448 | ||
| 452 | WindowsSubsystem LinkerDriver::inferSubsystem() { | 449 | WindowsSubsystem LinkerDriver::inferSubsystem() { |
| 453 | if (Config->DLL) | 450 | if (Config->DLL) |
| 454 | return IMAGE_SUBSYSTEM_WINDOWS_GUI; | 451 | return IMAGE_SUBSYSTEM_WINDOWS_GUI; |
| 455 | if (Symtab->findUnderscore("main") || Symtab->findUnderscore("wmain")) | 452 | if (findUnderscoreMangle("main") || findUnderscoreMangle("wmain")) |
| 456 | return IMAGE_SUBSYSTEM_WINDOWS_CUI; | 453 | return IMAGE_SUBSYSTEM_WINDOWS_CUI; |
| 457 | if (Symtab->findUnderscore("WinMain") || Symtab->findUnderscore("wWinMain")) | 454 | if (findUnderscoreMangle("WinMain") || findUnderscoreMangle("wWinMain")) |
| 458 | return IMAGE_SUBSYSTEM_WINDOWS_GUI; | 455 | return IMAGE_SUBSYSTEM_WINDOWS_GUI; |
| 459 | return IMAGE_SUBSYSTEM_UNKNOWN; | 456 | return IMAGE_SUBSYSTEM_UNKNOWN; |
| 460 | } | 457 | } |
| ... | @@ -1335,25 +1332,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { | ... | @@ -1335,25 +1332,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { |
| 1335 | error("/dynamicbase:no is not compatible with " + | 1332 | error("/dynamicbase:no is not compatible with " + |
| 1336 | machineToStr(Config->Machine)); | 1333 | machineToStr(Config->Machine)); |
| 1337 | 1334 | ||
| 1338 | // Handle /entry and /dll | ||
| 1339 | if (auto *Arg = Args.getLastArg(OPT_entry)) { | ||
| 1340 | Config->Entry = addUndefined(mangle(Arg->getValue())); | ||
| 1341 | } else if (!Config->Entry && !Config->NoEntry) { | ||
| 1342 | if (Args.hasArg(OPT_dll)) { | ||
| 1343 | StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12" | ||
| 1344 | : "_DllMainCRTStartup"; | ||
| 1345 | Config->Entry = addUndefined(S); | ||
| 1346 | } else { | ||
| 1347 | // Windows specific -- If entry point name is not given, we need to | ||
| 1348 | // infer that from user-defined entry name. | ||
| 1349 | StringRef S = findDefaultEntry(); | ||
| 1350 | if (S.empty()) | ||
| 1351 | fatal("entry point must be defined"); | ||
| 1352 | Config->Entry = addUndefined(S); | ||
| 1353 | log("Entry name inferred: " + S); | ||
| 1354 | } | ||
| 1355 | } | ||
| 1356 | |||
| 1357 | // Handle /export | 1335 | // Handle /export |
| 1358 | for (auto *Arg : Args.filtered(OPT_export)) { | 1336 | for (auto *Arg : Args.filtered(OPT_export)) { |
| 1359 | Export E = parseExport(Arg->getValue()); | 1337 | Export E = parseExport(Arg->getValue()); |
| ... | @@ -1379,6 +1357,34 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { | ... | @@ -1379,6 +1357,34 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { |
| 1379 | return; | 1357 | return; |
| 1380 | } | 1358 | } |
| 1381 | 1359 | ||
| 1360 | // Windows specific -- if no /subsystem is given, we need to infer | ||
| 1361 | // that from entry point name. Must happen before /entry handling, | ||
| 1362 | // and after the early return when just writing an import library. | ||
| 1363 | if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) { | ||
| 1364 | Config->Subsystem = inferSubsystem(); | ||
| 1365 | if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) | ||
| 1366 | fatal("subsystem must be defined"); | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | // Handle /entry and /dll | ||
| 1370 | if (auto *Arg = Args.getLastArg(OPT_entry)) { | ||
| 1371 | Config->Entry = addUndefined(mangle(Arg->getValue())); | ||
| 1372 | } else if (!Config->Entry && !Config->NoEntry) { | ||
| 1373 | if (Args.hasArg(OPT_dll)) { | ||
| 1374 | StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12" | ||
| 1375 | : "_DllMainCRTStartup"; | ||
| 1376 | Config->Entry = addUndefined(S); | ||
| 1377 | } else { | ||
| 1378 | // Windows specific -- If entry point name is not given, we need to | ||
| 1379 | // infer that from user-defined entry name. | ||
| 1380 | StringRef S = findDefaultEntry(); | ||
| 1381 | if (S.empty()) | ||
| 1382 | fatal("entry point must be defined"); | ||
| 1383 | Config->Entry = addUndefined(S); | ||
| 1384 | log("Entry name inferred: " + S); | ||
| 1385 | } | ||
| 1386 | } | ||
| 1387 | |||
| 1382 | // Handle /delayload | 1388 | // Handle /delayload |
| 1383 | for (auto *Arg : Args.filtered(OPT_delayload)) { | 1389 | for (auto *Arg : Args.filtered(OPT_delayload)) { |
| 1384 | Config->DelayLoads.insert(StringRef(Arg->getValue()).lower()); | 1390 | Config->DelayLoads.insert(StringRef(Arg->getValue()).lower()); |
| ... | @@ -1491,14 +1497,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { | ... | @@ -1491,14 +1497,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { |
| 1491 | if (errorCount()) | 1497 | if (errorCount()) |
| 1492 | return; | 1498 | return; |
| 1493 | 1499 | ||
| 1494 | // Windows specific -- if no /subsystem is given, we need to infer | ||
| 1495 | // that from entry point name. | ||
| 1496 | if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) { | ||
| 1497 | Config->Subsystem = inferSubsystem(); | ||
| 1498 | if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) | ||
| 1499 | fatal("subsystem must be defined"); | ||
| 1500 | } | ||
| 1501 | |||
| 1502 | // Handle /safeseh. | 1500 | // Handle /safeseh. |
| 1503 | if (Args.hasFlag(OPT_safeseh, OPT_safeseh_no, false)) { | 1501 | if (Args.hasFlag(OPT_safeseh, OPT_safeseh_no, false)) { |
| 1504 | for (ObjFile *File : ObjFile::Instances) | 1502 | for (ObjFile *File : ObjFile::Instances) |
deps/lld/COFF/Driver.h-1| ... | @@ -103,7 +103,6 @@ private: | ... | @@ -103,7 +103,6 @@ private: |
| 103 | std::set<std::string> VisitedLibs; | 103 | std::set<std::string> VisitedLibs; |
| 104 | 104 | ||
| 105 | Symbol *addUndefined(StringRef Sym); | 105 | Symbol *addUndefined(StringRef Sym); |
| 106 | StringRef mangle(StringRef Sym); | ||
| 107 | 106 | ||
| 108 | // Windows specific -- "main" is not the only main function in Windows. | 107 | // Windows specific -- "main" is not the only main function in Windows. |
| 109 | // You can choose one from these four -- {w,}{WinMain,main}. | 108 | // You can choose one from these four -- {w,}{WinMain,main}. |
deps/lld/docs/ReleaseNotes.rst+10-12| ... | @@ -5,18 +5,13 @@ LLD 7.0.0 Release Notes | ... | @@ -5,18 +5,13 @@ LLD 7.0.0 Release Notes |
| 5 | .. contents:: | 5 | .. contents:: |
| 6 | :local: | 6 | :local: |
| 7 | 7 | ||
| 8 | .. warning:: | ||
| 9 | These are in-progress notes for the upcoming LLVM 7.0.0 release. | ||
| 10 | Release notes for previous releases can be found on | ||
| 11 | `the Download Page <http://releases.llvm.org/download.html>`_. | ||
| 12 | |||
| 13 | Introduction | 8 | Introduction |
| 14 | ============ | 9 | ============ |
| 15 | 10 | ||
| 16 | This document contains the release notes for the lld linker, release 7.0.0. | 11 | This document contains the release notes for the lld linker, release 7.0.0. |
| 17 | Here we describe the status of lld, including major improvements | 12 | Here we describe the status of lld, including major improvements |
| 18 | from the previous release. All lld releases may be downloaded | 13 | from the previous release. All lld releases may be downloaded |
| 19 | from the `LLVM releases web site <http://llvm.org/releases/>`_. | 14 | from the `LLVM releases web site <https://llvm.org/releases/>`_. |
| 20 | 15 | ||
| 21 | Non-comprehensive list of changes in this release | 16 | Non-comprehensive list of changes in this release |
| 22 | ================================================= | 17 | ================================================= |
| ... | @@ -24,7 +19,15 @@ Non-comprehensive list of changes in this release | ... | @@ -24,7 +19,15 @@ Non-comprehensive list of changes in this release |
| 24 | ELF Improvements | 19 | ELF Improvements |
| 25 | ---------------- | 20 | ---------------- |
| 26 | 21 | ||
| 27 | * Item 1. | 22 | * lld is now able to overcome MIPS GOT entries number limitation |
| 23 | and generate multi-GOT if necessary. | ||
| 24 | |||
| 25 | * lld is now able to produce MIPS position-independent executable (PIE). | ||
| 26 | |||
| 27 | * Fixed MIPS TLS GOT entries for local symbols in shared libraries. | ||
| 28 | |||
| 29 | * Fixed calculation of MIPS GP relative relocations | ||
| 30 | in case of relocatable output. | ||
| 28 | 31 | ||
| 29 | COFF Improvements | 32 | COFF Improvements |
| 30 | ----------------- | 33 | ----------------- |
| ... | @@ -36,8 +39,3 @@ COFF Improvements | ... | @@ -36,8 +39,3 @@ COFF Improvements |
| 36 | * Added support for outputting PDB debug info for MinGW targets. | 39 | * Added support for outputting PDB debug info for MinGW targets. |
| 37 | 40 | ||
| 38 | * Improved compatibility of output binaries with GNU binutils objcopy/strip. | 41 | * Improved compatibility of output binaries with GNU binutils objcopy/strip. |
| 39 | |||
| 40 | MachO Improvements | ||
| 41 | ------------------ | ||
| 42 | |||
| 43 | * Item 1. |
deps/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp+1| ... | @@ -621,6 +621,7 @@ void ArchHandler_x86_64::applyFixupFinal( | ... | @@ -621,6 +621,7 @@ void ArchHandler_x86_64::applyFixupFinal( |
| 621 | // Fall into llvm_unreachable(). | 621 | // Fall into llvm_unreachable(). |
| 622 | break; | 622 | break; |
| 623 | } | 623 | } |
| 624 | llvm_unreachable("invalid x86_64 Reference Kind"); | ||
| 624 | } | 625 | } |
| 625 | 626 | ||
| 626 | void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref, | 627 | void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref, |
deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h+4-5| ... | @@ -186,11 +186,10 @@ packRelocation(const Relocation &r, bool swap, bool isBigEndian) { | ... | @@ -186,11 +186,10 @@ packRelocation(const Relocation &r, bool swap, bool isBigEndian) { |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | inline StringRef getString16(const char s[16]) { | 188 | inline StringRef getString16(const char s[16]) { |
| 189 | StringRef x = s; | 189 | // The StringRef(const char *) constructor passes the const char * to |
| 190 | if ( x.size() > 16 ) | 190 | // strlen(), so we can't use this constructor here, because if there is no |
| 191 | return x.substr(0, 16); | 191 | // null terminator in s, then strlen() will read past the end of the array. |
| 192 | else | 192 | return StringRef(s, strnlen(s, 16)); |
| 193 | return x; | ||
| 194 | } | 193 | } |
| 195 | 194 | ||
| 196 | inline void setString16(StringRef str, char s[16]) { | 195 | inline void setString16(StringRef str, char s[16]) { |
deps/lld/test/COFF/entry-inference3.test+7-3| ... | @@ -1,5 +1,9 @@ | ... | @@ -1,5 +1,9 @@ |
| 1 | # RUN: yaml2obj < %s > %t.obj | 1 | # RUN: sed -e s/ENTRYNAME/mainCRTStartup/ %s | yaml2obj > %t.obj |
| 2 | # RUN: not lld-link /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1 | 2 | # RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1 |
| 3 | # RUN: FileCheck %s < %t.log | ||
| 4 | |||
| 5 | # RUN: sed -e s/ENTRYNAME/?mainCRTStartup@@YAHXZ/ %s | yaml2obj > %t.obj | ||
| 6 | # RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1 | ||
| 3 | # RUN: FileCheck %s < %t.log | 7 | # RUN: FileCheck %s < %t.log |
| 4 | 8 | ||
| 5 | # CHECK: Entry name inferred: mainCRTStartup | 9 | # CHECK: Entry name inferred: mainCRTStartup |
| ... | @@ -26,7 +30,7 @@ symbols: | ... | @@ -26,7 +30,7 @@ symbols: |
| 26 | NumberOfLinenumbers: 0 | 30 | NumberOfLinenumbers: 0 |
| 27 | CheckSum: 0 | 31 | CheckSum: 0 |
| 28 | Number: 0 | 32 | Number: 0 |
| 29 | - Name: mainCRTStartup | 33 | - Name: "ENTRYNAME" |
| 30 | Value: 0 | 34 | Value: 0 |
| 31 | SectionNumber: 1 | 35 | SectionNumber: 1 |
| 32 | SimpleType: IMAGE_SYM_TYPE_NULL | 36 | SimpleType: IMAGE_SYM_TYPE_NULL |
deps/lld/test/COFF/entry-inference332.test created+39| ... | @@ -0,0 +1,39 @@ | ||
| 1 | # RUN: sed -e s/ENTRYNAME/_mainCRTStartup/ %s | yaml2obj > %t.obj | ||
| 2 | # RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1 | ||
| 3 | # RUN: FileCheck %s < %t.log | ||
| 4 | |||
| 5 | # RUN: sed -e s/ENTRYNAME/?mainCRTStartup@@YAHXZ/ %s | yaml2obj > %t.obj | ||
| 6 | # RUN: lld-link /subsystem:console /out:%t.exe %t.obj /verbose /nodefaultlib > %t.log 2>&1 | ||
| 7 | # RUN: FileCheck %s < %t.log | ||
| 8 | |||
| 9 | # CHECK: Entry name inferred: _mainCRTStartup | ||
| 10 | |||
| 11 | --- !COFF | ||
| 12 | header: | ||
| 13 | Machine: IMAGE_FILE_MACHINE_I386 | ||
| 14 | Characteristics: [] | ||
| 15 | sections: | ||
| 16 | - Name: .text | ||
| 17 | Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] | ||
| 18 | Alignment: 4 | ||
| 19 | SectionData: B82A000000C3 | ||
| 20 | symbols: | ||
| 21 | - Name: .text | ||
| 22 | Value: 0 | ||
| 23 | SectionNumber: 1 | ||
| 24 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 25 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 26 | StorageClass: IMAGE_SYM_CLASS_STATIC | ||
| 27 | SectionDefinition: | ||
| 28 | Length: 6 | ||
| 29 | NumberOfRelocations: 0 | ||
| 30 | NumberOfLinenumbers: 0 | ||
| 31 | CheckSum: 0 | ||
| 32 | Number: 0 | ||
| 33 | - Name: "ENTRYNAME" | ||
| 34 | Value: 0 | ||
| 35 | SectionNumber: 1 | ||
| 36 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 37 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 38 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 39 | ... | ||
deps/lld/test/COFF/entry-inference4.test created+56| ... | @@ -0,0 +1,56 @@ | ||
| 1 | # RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj | ||
| 2 | # RUN: not lld-link /subsystem:windows /out:%t.exe %t.obj > %t.log 2>&1 | ||
| 3 | # RUN: FileCheck -check-prefix=WINMAIN %s < %t.log | ||
| 4 | |||
| 5 | # RUN: sed 's/ENTRY1/wWinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj | ||
| 6 | # RUN: not lld-link /subsystem:windows /out:%t.exe %t.obj > %t.log 2>&1 | ||
| 7 | # RUN: FileCheck -check-prefix=WWINMAIN %s < %t.log | ||
| 8 | |||
| 9 | # RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/main/' %s | yaml2obj > %t.obj | ||
| 10 | # RUN: not lld-link /subsystem:console /out:%t.exe %t.obj > %t.log 2>&1 | ||
| 11 | # RUN: FileCheck -check-prefix=MAIN %s < %t.log | ||
| 12 | |||
| 13 | # RUN: sed 's/ENTRY1/WinMain/;s/ENTRY2/wmain/' %s | yaml2obj > %t.obj | ||
| 14 | # RUN: not lld-link /subsystem:console /out:%t.exe %t.obj > %t.log 2>&1 | ||
| 15 | # RUN: FileCheck -check-prefix=WMAIN %s < %t.log | ||
| 16 | |||
| 17 | # MAIN: error: <root>: undefined symbol: mainCRTStartup | ||
| 18 | # WMAIN: error: <root>: undefined symbol: wmainCRTStartup | ||
| 19 | # WINMAIN: error: <root>: undefined symbol: WinMainCRTStartup | ||
| 20 | # WWINMAIN: error: <root>: undefined symbol: wWinMainCRTStartup | ||
| 21 | |||
| 22 | --- !COFF | ||
| 23 | header: | ||
| 24 | Machine: IMAGE_FILE_MACHINE_AMD64 | ||
| 25 | Characteristics: [] | ||
| 26 | sections: | ||
| 27 | - Name: .text | ||
| 28 | Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] | ||
| 29 | Alignment: 4 | ||
| 30 | SectionData: B82A000000C3 | ||
| 31 | symbols: | ||
| 32 | - Name: .text | ||
| 33 | Value: 0 | ||
| 34 | SectionNumber: 1 | ||
| 35 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 36 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 37 | StorageClass: IMAGE_SYM_CLASS_STATIC | ||
| 38 | SectionDefinition: | ||
| 39 | Length: 6 | ||
| 40 | NumberOfRelocations: 0 | ||
| 41 | NumberOfLinenumbers: 0 | ||
| 42 | CheckSum: 0 | ||
| 43 | Number: 0 | ||
| 44 | - Name: ENTRY1 | ||
| 45 | Value: 0 | ||
| 46 | SectionNumber: 1 | ||
| 47 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 48 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 49 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 50 | - Name: ENTRY2 | ||
| 51 | Value: 0 | ||
| 52 | SectionNumber: 1 | ||
| 53 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 54 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 55 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 56 | ... | ||
deps/lld/test/COFF/guardcf-align.s+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | # REQUIRES: x86 | ||
| 1 | # RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t.obj %s | 2 | # RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t.obj %s |
| 2 | # RUN: yaml2obj < %p/Inputs/guardcf-align-foobar.yaml \ | 3 | # RUN: yaml2obj < %p/Inputs/guardcf-align-foobar.yaml \ |
| 3 | # RUN: > %T/guardcf-align-foobar.obj | 4 | # RUN: > %T/guardcf-align-foobar.obj |
deps/lld/test/COFF/subsystem-inference32.test created+74| ... | @@ -0,0 +1,74 @@ | ||
| 1 | # RUN: sed -e s/ENTRYNAME/_main/ %s | yaml2obj > %t.obj | ||
| 2 | # RUN: lld-link /out:%t.exe %t.obj | ||
| 3 | # RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=MAIN %s | ||
| 4 | |||
| 5 | # RUN: sed s/ENTRYNAME/_wmain/ %s | yaml2obj > %t.obj | ||
| 6 | # RUN: lld-link /out:%t.exe %t.obj | ||
| 7 | # RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WMAIN %s | ||
| 8 | |||
| 9 | # RUN: sed s/ENTRYNAME/_WinMain@16/ %s | yaml2obj > %t.obj | ||
| 10 | # RUN: lld-link /out:%t.exe %t.obj | ||
| 11 | # RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WINMAIN %s | ||
| 12 | |||
| 13 | # RUN: sed s/ENTRYNAME/_wWinMain@16/ %s | yaml2obj > %t.obj | ||
| 14 | # RUN: lld-link /out:%t.exe %t.obj | ||
| 15 | # RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WWINMAIN %s | ||
| 16 | |||
| 17 | # MAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI | ||
| 18 | # WMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI | ||
| 19 | # WINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI | ||
| 20 | # WWINMAIN: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI | ||
| 21 | |||
| 22 | --- !COFF | ||
| 23 | header: | ||
| 24 | Machine: IMAGE_FILE_MACHINE_I386 | ||
| 25 | Characteristics: [] | ||
| 26 | sections: | ||
| 27 | - Name: .text | ||
| 28 | Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] | ||
| 29 | Alignment: 4 | ||
| 30 | SectionData: B82A000000C3 | ||
| 31 | symbols: | ||
| 32 | - Name: .text | ||
| 33 | Value: 0 | ||
| 34 | SectionNumber: 1 | ||
| 35 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 36 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 37 | StorageClass: IMAGE_SYM_CLASS_STATIC | ||
| 38 | SectionDefinition: | ||
| 39 | Length: 6 | ||
| 40 | NumberOfRelocations: 0 | ||
| 41 | NumberOfLinenumbers: 0 | ||
| 42 | CheckSum: 0 | ||
| 43 | Number: 0 | ||
| 44 | - Name: ENTRYNAME | ||
| 45 | Value: 0 | ||
| 46 | SectionNumber: 1 | ||
| 47 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 48 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 49 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 50 | - Name: _mainCRTStartup | ||
| 51 | Value: 0 | ||
| 52 | SectionNumber: 1 | ||
| 53 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 54 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 55 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 56 | - Name: _wmainCRTStartup | ||
| 57 | Value: 0 | ||
| 58 | SectionNumber: 1 | ||
| 59 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 60 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 61 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 62 | - Name: _WinMainCRTStartup | ||
| 63 | Value: 0 | ||
| 64 | SectionNumber: 1 | ||
| 65 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 66 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 67 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 68 | - Name: _wWinMainCRTStartup | ||
| 69 | Value: 0 | ||
| 70 | SectionNumber: 1 | ||
| 71 | SimpleType: IMAGE_SYM_TYPE_NULL | ||
| 72 | ComplexType: IMAGE_SYM_DTYPE_NULL | ||
| 73 | StorageClass: IMAGE_SYM_CLASS_EXTERNAL | ||
| 74 | ... | ||
deps/lld/test/ELF/icf13.s+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | # REQUIRES: x86 | ||
| 1 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 |
| 2 | # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | 3 | # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s |
| 3 | 4 |
deps/lld/test/ELF/icf15.s+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | # REQUIRES: x86 | ||
| 1 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 |
| 2 | # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | 3 | # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s |
| 3 | 4 |
deps/lld/test/ELF/icf16.s+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | # REQUIRES: x86 | ||
| 1 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 |
| 2 | # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | 3 | # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s |
| 3 | 4 |
deps/lld/test/ELF/icf17.s+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | # REQUIRES: x86 | ||
| 1 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 |
| 2 | # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | 3 | # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s |
| 3 | 4 |
deps/lld/test/ELF/lto/libcall-archive.ll+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | ; REQUIRES: x86 | ||
| 1 | ; RUN: rm -f %t.a | 2 | ; RUN: rm -f %t.a |
| 2 | ; RUN: llvm-as -o %t.o %s | 3 | ; RUN: llvm-as -o %t.o %s |
| 3 | ; RUN: llvm-as -o %t2.o %S/Inputs/libcall-archive.ll | 4 | ; RUN: llvm-as -o %t2.o %S/Inputs/libcall-archive.ll |