[lld] r240922 - COFF: Fix logic to find default entry name or subsystem.
Rui Ueyama
ruiu at google.com
Sun Jun 28 18:03:54 PDT 2015
Author: ruiu
Date: Sun Jun 28 20:03:53 2015
New Revision: 240922
URL: http://llvm.org/viewvc/llvm-project?rev=240922&view=rev
Log:
COFF: Fix logic to find default entry name or subsystem.
The previous logic to find default entry name or subsystem does not
seem correct (i.e. was not compatible with MSVC linker). Previously,
default entry name was inferred from CRT functions and user-defined
entry functions. Subsystem was inferred from CRT functions.
Default entry name and subsystem are now inferred based on the
following table. Note that we no longer use CRT functions to infer
them.
Entry name Subsystem
main mainCRTStartup console
wmain wmainCRTStartup console
WinMain WinMainCRTStartup windows
wWinMain wWinMainCRTStartup windows
Removed:
lld/trunk/test/COFF/Inputs/common.yaml
Modified:
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/Driver.h
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/SymbolTable.h
lld/trunk/test/COFF/Inputs/icf1.yaml
lld/trunk/test/COFF/Inputs/icf2.yaml
lld/trunk/test/COFF/Inputs/icf3.yaml
lld/trunk/test/COFF/Inputs/icf4.yaml
lld/trunk/test/COFF/Inputs/icf5.yaml
lld/trunk/test/COFF/Inputs/import.yaml
lld/trunk/test/COFF/Inputs/include1a.yaml
lld/trunk/test/COFF/Inputs/ret42.yaml
lld/trunk/test/COFF/alternatename.test
lld/trunk/test/COFF/base.test
lld/trunk/test/COFF/baserel.test
lld/trunk/test/COFF/common.test
lld/trunk/test/COFF/dll.test
lld/trunk/test/COFF/entrylib.ll
lld/trunk/test/COFF/filetype.test
lld/trunk/test/COFF/force.test
lld/trunk/test/COFF/heap.test
lld/trunk/test/COFF/icf.test
lld/trunk/test/COFF/include.test
lld/trunk/test/COFF/include2.test
lld/trunk/test/COFF/internal.test
lld/trunk/test/COFF/linkenv.test
lld/trunk/test/COFF/lldmap.test
lld/trunk/test/COFF/locally-imported.test
lld/trunk/test/COFF/long-section-name.test
lld/trunk/test/COFF/manifest.test
lld/trunk/test/COFF/opt.test
lld/trunk/test/COFF/options.test
lld/trunk/test/COFF/order.test
lld/trunk/test/COFF/out.test
lld/trunk/test/COFF/resource.test
lld/trunk/test/COFF/responsefile.test
lld/trunk/test/COFF/stack.test
lld/trunk/test/COFF/subsystem-inference.test
lld/trunk/test/COFF/unwind.test
lld/trunk/test/COFF/version.test
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Sun Jun 28 20:03:53 2015
@@ -207,15 +207,30 @@ void LinkerDriver::addUndefined(StringRe
Config->GCRoots.insert(Sym);
}
-static WindowsSubsystem inferSubsystem() {
+// Windows specific -- find default entry point name.
+StringRef LinkerDriver::findDefaultEntry() {
+ // User-defined main functions and their corresponding entry points.
+ static const char *Entries[][2] = {
+ {"main", "mainCRTStartup"},
+ {"wmain", "wmainCRTStartup"},
+ {"WinMain", "WinMainCRTStartup"},
+ {"wWinMain", "wWinMainCRTStartup"},
+ };
+ for (auto E : Entries) {
+ if (Symtab.findLazy(E[0]))
+ return E[1];
+ }
+ return "";
+}
+
+WindowsSubsystem LinkerDriver::inferSubsystem() {
if (Config->DLL)
return IMAGE_SUBSYSTEM_WINDOWS_GUI;
- return StringSwitch<WindowsSubsystem>(Config->EntryName)
- .Case("mainCRTStartup", IMAGE_SUBSYSTEM_WINDOWS_CUI)
- .Case("wmainCRTStartup", IMAGE_SUBSYSTEM_WINDOWS_CUI)
- .Case("WinMainCRTStartup", IMAGE_SUBSYSTEM_WINDOWS_GUI)
- .Case("wWinMainCRTStartup", IMAGE_SUBSYSTEM_WINDOWS_GUI)
- .Default(IMAGE_SUBSYSTEM_UNKNOWN);
+ if (Symtab.find("main") || Symtab.find("wmain"))
+ return IMAGE_SUBSYSTEM_WINDOWS_CUI;
+ if (Symtab.find("WinMain") || Symtab.find("wWinMain"))
+ return IMAGE_SUBSYSTEM_WINDOWS_GUI;
+ return IMAGE_SUBSYSTEM_UNKNOWN;
}
bool LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
@@ -522,6 +537,18 @@ bool LinkerDriver::link(llvm::ArrayRef<c
return false;
}
+ // Windows specific -- If entry point name is not given, we need to
+ // infer that from user-defined entry name.
+ if (Config->EntryName.empty() && !Config->NoEntry) {
+ StringRef S = findDefaultEntry();
+ if (S.empty()) {
+ llvm::errs() << "entry point must be defined\n";
+ return false;
+ }
+ Config->EntryName = S;
+ addUndefined(S);
+ }
+
// Resolve auxiliary symbols until converge.
// (Trying to resolve a symbol may trigger a Lazy symbol to load a new file.
// A new file may contain a directive section to add new command line options.
@@ -545,19 +572,6 @@ bool LinkerDriver::link(llvm::ArrayRef<c
}
}
- // Windows specific -- If entry point name is not given, we need to
- // infer that from user-defined entry name. The symbol table takes
- // care of details.
- if (Config->EntryName.empty() && !Config->NoEntry) {
- auto EntryOrErr = Symtab.findDefaultEntry();
- if (auto EC = EntryOrErr.getError()) {
- llvm::errs() << EC.message() << "\n";
- return false;
- }
- Config->EntryName = EntryOrErr.get();
- addUndefined(Config->EntryName);
- }
-
if (auto EC = Symtab.run()) {
llvm::errs() << EC.message() << "\n";
return false;
Modified: lld/trunk/COFF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.h?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.h (original)
+++ lld/trunk/COFF/Driver.h Sun Jun 28 20:03:53 2015
@@ -94,6 +94,16 @@ private:
void addUndefined(StringRef Sym);
+ // Windows specific -- "main" is not the only main function in Windows.
+ // You can choose one from these four -- {w,}{WinMain,main}.
+ // There are four different entry point functions for them,
+ // {w,}{WinMain,main}CRTStartup, respectively. The linker needs to
+ // choose the right one depending on which "main" function is defined.
+ // This function looks up the symbol table and resolve corresponding
+ // entry point name.
+ StringRef findDefaultEntry();
+ WindowsSubsystem inferSubsystem();
+
// Driver is the owner of all opened files.
// InputFiles have MemoryBufferRefs to them.
std::vector<std::unique_ptr<MemoryBuffer>> OwningMBs;
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Sun Jun 28 20:03:53 2015
@@ -174,6 +174,25 @@ Defined *SymbolTable::find(StringRef Nam
return nullptr;
}
+// Find a given symbol. If a lazy symbol is found,
+// resolve that before returning.
+Defined *SymbolTable::findLazy(StringRef Name) {
+ auto It = Symtab.find(Name);
+ if (It == Symtab.end())
+ return nullptr;
+ Symbol *Sym = It->second;
+ if (auto *B = dyn_cast<Defined>(Sym->Body))
+ return B;
+ if (auto *B = dyn_cast<Lazy>(Sym->Body)) {
+ if (addMemberFile(B))
+ return nullptr;
+ if (run())
+ return nullptr;
+ return cast<Defined>(Sym->Body);
+ }
+ return nullptr;
+}
+
// Find a given symbol or its mangled symbol.
std::pair<StringRef, Symbol *> SymbolTable::findMangled(StringRef S) {
auto It = Symtab.find(S);
@@ -196,41 +215,6 @@ std::pair<StringRef, Symbol *> SymbolTab
return std::make_pair(S, nullptr);
}
-std::error_code SymbolTable::resolveLazy(StringRef Name) {
- auto It = Symtab.find(Name);
- if (It == Symtab.end())
- return std::error_code();
- if (auto *B = dyn_cast<Lazy>(It->second->Body)) {
- if (auto EC = addMemberFile(B))
- return EC;
- return run();
- }
- return std::error_code();
-}
-
-// Windows specific -- Link default entry point name.
-ErrorOr<StringRef> SymbolTable::findDefaultEntry() {
- // User-defined main functions and their corresponding entry points.
- static const char *Entries[][2] = {
- {"main", "mainCRTStartup"},
- {"wmain", "wmainCRTStartup"},
- {"WinMain", "WinMainCRTStartup"},
- {"wWinMain", "wWinMainCRTStartup"},
- };
- for (auto E : Entries) {
- resolveLazy(E[1]);
- if (find(E[1]))
- return StringRef(E[1]);
- if (!find(E[0]))
- continue;
- if (auto EC = resolve(new (Alloc) Undefined(E[1])))
- return EC;
- return StringRef(E[1]);
- }
- llvm::errs() << "entry point must be defined\n";
- return make_error_code(LLDError::InvalidOption);
-}
-
std::error_code SymbolTable::addUndefined(StringRef Name) {
return resolve(new (Alloc) Undefined(Name));
}
@@ -248,7 +232,10 @@ std::error_code SymbolTable::rename(Stri
SymbolBody *Body = new (Alloc) Undefined(To);
if (auto EC = resolve(Body))
return EC;
- Sym->Body = Body->getReplacement();
+ SymbolBody *Repl = Body->getReplacement();
+ if (isa<Undefined>(Repl))
+ return std::error_code();
+ Sym->Body = Repl;
Body->setBackref(Sym);
++Version;
return std::error_code();
Modified: lld/trunk/COFF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.h (original)
+++ lld/trunk/COFF/SymbolTable.h Sun Jun 28 20:03:53 2015
@@ -51,21 +51,13 @@ public:
// mechanisms to allow aliases, a name can be resolved to a
// different symbol). Returns a nullptr if not found.
Defined *find(StringRef Name);
+ Defined *findLazy(StringRef Name);
// Find a symbol assuming that Name is a function name.
// Not only a given string but its mangled names (in MSVC C++ manner)
// will be searched.
std::pair<StringRef, Symbol *> findMangled(StringRef Name);
- // Windows specific -- `main` is not the only main function in Windows.
- // You can choose one from these four -- {w,}{WinMain,main}.
- // There are four different entry point functions for them,
- // {w,}{WinMain,main}CRTStartup, respectively. The linker needs to
- // choose the right one depending on which `main` function is defined.
- // This function looks up the symbol table and resolve corresponding
- // entry point name.
- ErrorOr<StringRef> findDefaultEntry();
-
// Print a layout map to OS.
void printMap(llvm::raw_ostream &OS);
@@ -92,7 +84,6 @@ public:
private:
std::error_code resolve(SymbolBody *Body);
- std::error_code resolveLazy(StringRef Name);
std::error_code addMemberFile(Lazy *Body);
ErrorOr<ObjectFile *> createLTOObject(llvm::LTOCodeGenerator *CG);
Removed: lld/trunk/test/COFF/Inputs/common.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/common.yaml?rev=240921&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/common.yaml (original)
+++ lld/trunk/test/COFF/Inputs/common.yaml (removed)
@@ -1,91 +0,0 @@
----
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: []
-sections:
- - Name: .text
- Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
- Alignment: 4
- SectionData: b800000000b800000000b800000000b800000000b800000000
- Relocations:
- - VirtualAddress: 1
- SymbolName: bssdata4
- Type: IMAGE_REL_AMD64_ADDR32
- - VirtualAddress: 6
- SymbolName: bsspad1
- Type: IMAGE_REL_AMD64_ADDR32
- - VirtualAddress: 11
- SymbolName: bssdata64
- Type: IMAGE_REL_AMD64_ADDR32
- - VirtualAddress: 16
- SymbolName: bsspad2
- Type: IMAGE_REL_AMD64_ADDR32
- - VirtualAddress: 21
- SymbolName: bssdata16
- Type: IMAGE_REL_AMD64_ADDR32
- - Name: .data
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
- Alignment: 4
- SectionData: 03000000
-symbols:
- - Name: .text
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 0
- NumberOfRelocations: 5
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: .data
- Value: 0
- SectionNumber: 2
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_STATIC
- SectionDefinition:
- Length: 4
- NumberOfRelocations: 0
- NumberOfLinenumbers: 0
- CheckSum: 0
- Number: 0
- - Name: mainCRTStartup
- Value: 0
- SectionNumber: 1
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_FUNCTION
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: bssdata4
- Value: 4
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: bsspad1
- Value: 1
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: bssdata64
- Value: 64
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: bsspad2
- Value: 1
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: bssdata16
- Value: 16
- SectionNumber: 0
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-...
Modified: lld/trunk/test/COFF/Inputs/icf1.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf1.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf1.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf1.yaml Sun Jun 28 20:03:53 2015
@@ -29,7 +29,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/Inputs/icf2.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf2.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf2.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf2.yaml Sun Jun 28 20:03:53 2015
@@ -25,7 +25,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- # icf2 is identical with mainCRTStartup
+ # icf2 is identical with main
- Name: icf2
Value: 0
SectionNumber: 1
Modified: lld/trunk/test/COFF/Inputs/icf3.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf3.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf3.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf3.yaml Sun Jun 28 20:03:53 2015
@@ -25,7 +25,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- # icf3 is *not* identical with mainCRTStartup because its relocation is different
+ # icf3 is *not* identical with main because its relocation is different
- Name: icf3
Value: 0
SectionNumber: 1
Modified: lld/trunk/test/COFF/Inputs/icf4.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf4.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf4.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf4.yaml Sun Jun 28 20:03:53 2015
@@ -25,7 +25,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- # icf4 is *not* identical with mainCRTStartup because it has an associative section
+ # icf4 is *not* identical with main because it has an associative section
- Name: icf4
Value: 0
SectionNumber: 1
Modified: lld/trunk/test/COFF/Inputs/icf5.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/icf5.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/icf5.yaml (original)
+++ lld/trunk/test/COFF/Inputs/icf5.yaml Sun Jun 28 20:03:53 2015
@@ -21,7 +21,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- # icf5 is *not* identical with its symbol value is different
+ # icf5 is *not* identical with main because its symbol value is different
- Name: icf5
Value: 5
SectionNumber: 1
Modified: lld/trunk/test/COFF/Inputs/import.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/import.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/import.yaml (original)
+++ lld/trunk/test/COFF/Inputs/import.yaml Sun Jun 28 20:03:53 2015
@@ -20,7 +20,7 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/Inputs/include1a.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/include1a.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/include1a.yaml (original)
+++ lld/trunk/test/COFF/Inputs/include1a.yaml Sun Jun 28 20:03:53 2015
@@ -24,7 +24,7 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/Inputs/ret42.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/ret42.yaml?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/Inputs/ret42.yaml (original)
+++ lld/trunk/test/COFF/Inputs/ret42.yaml Sun Jun 28 20:03:53 2015
@@ -36,7 +36,7 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/alternatename.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/alternatename.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/alternatename.test (original)
+++ lld/trunk/test/COFF/alternatename.test Sun Jun 28 20:03:53 2015
@@ -1,9 +1,9 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
# RUN: lld -flavor link2 /entry:foo /subsystem:console \
-# RUN: /alternatename:foo=mainCRTStartup /out:%t.exe %t.obj
+# RUN: /alternatename:foo=main /out:%t.exe %t.obj
# RUN: lld -flavor link2 /entry:foo /subsystem:console \
-# RUN: /alternatename:foo=mainCRTStartup \
-# RUN: /alternatename:foo=mainCRTStartup \
+# RUN: /alternatename:foo=main \
+# RUN: /alternatename:foo=main \
# RUN: /alternatename:nosuchsym1=nosuchsym2 \
# RUN: /out:%t.exe %t.obj
@@ -26,7 +26,7 @@ sections:
- Name: .drectve
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
Alignment: 2147483648
- SectionData: 2f616c7465726e6174656e616d653a666f6f3d6d61696e4352545374617274757000 # /alternatename:foo=mainCRTStartup
+ SectionData: 2f616c7465726e6174656e616d653a666f6f3d6d61696e00 # /alternatename:foo=main
symbols:
- Name: '.text$mn'
Value: 0
@@ -52,7 +52,7 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/base.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/base.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/base.test (original)
+++ lld/trunk/test/COFF/base.test Sun Jun 28 20:03:53 2015
@@ -1,11 +1,11 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=DEFAULT %s
DEFAULT: ImageBase: 0x140000000
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /base:0x280000000
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /base:0x280000000
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=BASE %s
BASE: ImageBase: 0x280000000
Modified: lld/trunk/test/COFF/baserel.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/baserel.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/baserel.test (original)
+++ lld/trunk/test/COFF/baserel.test Sun Jun 28 20:03:53 2015
@@ -1,9 +1,9 @@
# RUN: yaml2obj < %s > %t.obj
#
-# RUN: lld -flavor link2 /out:%t.exe %t.obj %p/Inputs/std64.lib
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck %s -check-prefix=BASEREL
#
-# RUN: lld -flavor link2 /out:%t.exe /fixed %t.obj %p/Inputs/std64.lib
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /fixed %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck %s -check-prefix=NOBASEREL
#
# BASEREL: BaseReloc [
@@ -43,11 +43,11 @@
# NOBASEREL: BaseReloc [
# NOBASEREL-NEXT: ]
#
-# RUN: lld -flavor link2 /out:%t.exe %t.obj %p/Inputs/std64.lib
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj -file-headers -sections %t.exe | FileCheck %s \
# RUN: --check-prefix=BASEREL-HEADER
#
-# RN: lld -flavor link2 /out:%t.exe /fixed %t.obj %p/Inputs/std64.lib
+# RN: lld -flavor link2 /out:%t.exe /entry:main /fixed %t.obj %p/Inputs/std64.lib
# RN: llvm-readobj -file-headers %t.exe | FileCheck %s \
# RN: --check-prefix=NOBASEREL-HEADER
#
@@ -188,7 +188,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/common.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/common.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/common.test (original)
+++ lld/trunk/test/COFF/common.test Sun Jun 28 20:03:53 2015
@@ -1,10 +1,102 @@
-# RUN: yaml2obj %p/Inputs/common.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj %t.obj
+# RUN: yaml2obj %s > %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj %t.obj
# RUN: llvm-objdump -d %t.exe | FileCheck %s
# Operands of B8 (MOV EAX) are common symbols
-CHECK: 3000: b8 00 10 00 40
-CHECK: 3005: b8 04 10 00 40
-CHECK: 300a: b8 20 10 00 40
-CHECK: 300f: b8 60 10 00 40
-CHECK: 3014: b8 80 10 00 40
+# CHECK: 3000: b8 00 10 00 40
+# CHECK: 3005: b8 04 10 00 40
+# CHECK: 300a: b8 20 10 00 40
+# CHECK: 300f: b8 60 10 00 40
+# CHECK: 3014: b8 80 10 00 40
+
+---
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: []
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: b800000000b800000000b800000000b800000000b800000000
+ Relocations:
+ - VirtualAddress: 1
+ SymbolName: bssdata4
+ Type: IMAGE_REL_AMD64_ADDR32
+ - VirtualAddress: 6
+ SymbolName: bsspad1
+ Type: IMAGE_REL_AMD64_ADDR32
+ - VirtualAddress: 11
+ SymbolName: bssdata64
+ Type: IMAGE_REL_AMD64_ADDR32
+ - VirtualAddress: 16
+ SymbolName: bsspad2
+ Type: IMAGE_REL_AMD64_ADDR32
+ - VirtualAddress: 21
+ SymbolName: bssdata16
+ Type: IMAGE_REL_AMD64_ADDR32
+ - Name: .data
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 4
+ SectionData: 03000000
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 0
+ NumberOfRelocations: 5
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: .data
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 4
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: main
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bssdata4
+ Value: 4
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bsspad1
+ Value: 1
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bssdata64
+ Value: 64
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bsspad2
+ Value: 1
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: bssdata16
+ Value: 16
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
Modified: lld/trunk/test/COFF/dll.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/dll.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/dll.test (original)
+++ lld/trunk/test/COFF/dll.test Sun Jun 28 20:03:53 2015
@@ -27,15 +27,15 @@ EXPORT-LTO-NEXT: 2 0x1020 expor
EXPORT-LTO-NEXT: 3 0x1030 exportfn3
# RUN: yaml2obj < %p/Inputs/import.yaml > %t2.obj
-# RUN: lld -flavor link2 /out:%t2.exe %t2.obj %t.lib
+# RUN: lld -flavor link2 /out:%t2.exe /entry:main %t2.obj %t.lib
# RUN: llvm-readobj -coff-imports %t2.exe | FileCheck -check-prefix=IMPORT %s
# RUN: lld -flavor link2 /out:%t.dll /dll %t.obj /implib:%t2.lib \
# RUN: /export:exportfn1 /export:exportfn2
-# RUN: lld -flavor link2 /out:%t2.exe %t2.obj %t2.lib
+# RUN: lld -flavor link2 /out:%t2.exe /entry:main %t2.obj %t2.lib
# RUN: llvm-readobj -coff-imports %t2.exe | FileCheck -check-prefix=IMPORT %s
-# RUN: lld -flavor link2 /out:%t2.lto.exe %t2.obj %t.lto.lib
+# RUN: lld -flavor link2 /out:%t2.lto.exe /entry:main %t2.obj %t.lto.lib
# RUN: llvm-readobj -coff-imports %t2.lto.exe | FileCheck -check-prefix=IMPORT %s
IMPORT: Symbol: exportfn1
Modified: lld/trunk/test/COFF/entrylib.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/entrylib.ll?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/entrylib.ll (original)
+++ lld/trunk/test/COFF/entrylib.ll Sun Jun 28 20:03:53 2015
@@ -1,11 +1,11 @@
; RUN: llvm-as -o %t.obj %s
; RUN: rm -f %t.lib
; RUN: llvm-ar cru %t.lib %t.obj
-; RUN: lld -flavor link2 /out:%t.exe %t.lib
+; RUN: lld -flavor link2 /out:%t.exe /entry:main %t.lib
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
-define i32 @mainCRTStartup() {
+define i32 @main() {
ret i32 0
}
Modified: lld/trunk/test/COFF/filetype.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/filetype.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/filetype.test (original)
+++ lld/trunk/test/COFF/filetype.test Sun Jun 28 20:03:53 2015
@@ -1,4 +1,4 @@
# Make sure input file type is detected by file magic and not by extension.
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.lib
-# RUN: lld -flavor link2 /out:%t.exe %t.lib
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.lib
Modified: lld/trunk/test/COFF/force.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/force.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/force.test (original)
+++ lld/trunk/test/COFF/force.test Sun Jun 28 20:03:53 2015
@@ -1,7 +1,7 @@
# RUN: yaml2obj < %s > %t.obj
-# RUN: not lld -flavor link2 /out:%t.exe %t.obj >& %t.log
+# RUN: not lld -flavor link2 /out:%t.exe /entry:main %t.obj >& %t.log
# RUN: FileCheck %s < %t.log
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /force >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /force >& %t.log
# RUN: FileCheck %s < %t.log
# CHECK: undefined symbol: foo
@@ -28,7 +28,7 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/heap.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/heap.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/heap.test (original)
+++ lld/trunk/test/COFF/heap.test Sun Jun 28 20:03:53 2015
@@ -1,24 +1,24 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=DEFAULT %s
DEFAULT: SizeOfHeapReserve: 1048576
DEFAULT: SizeOfHeapCommit: 4096
-# RUN: lld -flavor link2 /out:%t.exe /heap:0x3000 %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /heap:0x3000 %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s
# RUN: echo "HEAPSIZE 12288" > %t.def
-# RUN: lld -flavor link2 /out:%t.exe /def:%t.def %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /def:%t.def %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s
CHECK1: SizeOfHeapReserve: 12288
CHECK1: SizeOfHeapCommit: 4096
-# RUN: lld -flavor link2 /out:%t.exe /heap:0x5000,0x3000 %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /heap:0x5000,0x3000 %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
# RUN: echo "HEAPSIZE 20480,12288" > %t.def
-# RUN: lld -flavor link2 /out:%t.exe /def:%t.def %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /def:%t.def %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
CHECK2: SizeOfHeapReserve: 20480
Modified: lld/trunk/test/COFF/icf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/icf.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/icf.test (original)
+++ lld/trunk/test/COFF/icf.test Sun Jun 28 20:03:53 2015
@@ -4,12 +4,13 @@
# RUN: yaml2obj < %p/Inputs/icf4.yaml > %t4.obj
# RUN: yaml2obj < %p/Inputs/icf5.yaml > %t5.obj
#
-# RUN: lld -flavor link2 /out:%t.exe %t1.obj %t2.obj %t3.obj %t4.obj %t5.obj \
+# RUN: lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: %t1.obj %t2.obj %t3.obj %t4.obj %t5.obj \
# RUN: /opt:lldicf /include:icf2 /include:icf3 /include:icf4 /include:icf5 \
# RUN: /verbose >& %t.log
# RUN: FileCheck %s < %t.log
-CHECK-NOT: Replaced mainCRTStartup
+CHECK-NOT: Replaced main
CHECK: Replaced icf2
CHECK-NOT: Replaced icf3
CHECK-NOT: Replaced icf4
Modified: lld/trunk/test/COFF/include.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/include.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/include.test (original)
+++ lld/trunk/test/COFF/include.test Sun Jun 28 20:03:53 2015
@@ -1,11 +1,11 @@
# RUN: yaml2obj < %s > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /verbose >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /verbose >& %t.log
### FileCheck doesn't like empty input, so write something.
# RUN: echo dummy >> %t.log
# RUN: FileCheck -check-prefix=CHECK1 %s < %t.log
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /verbose /include:unused >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /verbose /include:unused >& %t.log
# RUN: echo dummy >> %t.log
# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
@@ -62,7 +62,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/include2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/include2.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/include2.test (original)
+++ lld/trunk/test/COFF/include2.test Sun Jun 28 20:03:53 2015
@@ -4,7 +4,7 @@
# RUN: rm -f %t2.lib %t3.lib
# RUN: llvm-ar cru %t2.lib %t2.obj
# RUN: llvm-ar cru %t3.lib %t3.obj
-# RUN: lld -flavor link2 /out:%t.exe %t1.obj %t2.lib %t3.lib /verbose >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t1.obj %t2.lib %t3.lib /verbose >& %t.log
# RUN: FileCheck %s < %t.log
CHECK: include2.test.tmp1.obj
Modified: lld/trunk/test/COFF/internal.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/internal.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/internal.test (original)
+++ lld/trunk/test/COFF/internal.test Sun Jun 28 20:03:53 2015
@@ -3,7 +3,7 @@
# RUN: yaml2obj < %s > %t1.obj
# RUN: yaml2obj < %s > %t2.obj
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t3.obj
-# RUN: lld -flavor link2 /out:%t.exe %t1.obj %t2.obj %t3.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t1.obj %t2.obj %t3.obj
---
header:
Modified: lld/trunk/test/COFF/linkenv.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/linkenv.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/linkenv.test (original)
+++ lld/trunk/test/COFF/linkenv.test Sun Jun 28 20:03:53 2015
@@ -1,6 +1,4 @@
-# RUN: env LINK="-help -foo" lld -flavor link2 > %t1.log 2> %t2.log
-# RUN: FileCheck -check-prefix=STDOUT %s < %t1.log
-# RUN: FileCheck -check-prefix=STDERR %s < %t2.log
+# RUN: env LINK=-help lld -flavor link2 > %t.log
+# RUN: FileCheck %s < %t.log
-STDOUT: OVERVIEW: LLVM Linker
-STDERR: unknown argument: -foo
+CHECK: OVERVIEW: LLVM Linker
Modified: lld/trunk/test/COFF/lldmap.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/lldmap.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/lldmap.test (original)
+++ lld/trunk/test/COFF/lldmap.test Sun Jun 28 20:03:53 2015
@@ -1,8 +1,8 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe /lldmap:%t.map %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /lldmap:%t.map %t.obj
# RUN: FileCheck %s < %t.map
# CHECK: .obj:
# CHECK-NEXT: 140001000 .text$mn
# CHECK-NEXT: 140001000 .data
-# CHECK-NEXT: 140001000 mainCRTStartup
+# CHECK-NEXT: 140001000 main
Modified: lld/trunk/test/COFF/locally-imported.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/locally-imported.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/locally-imported.test (original)
+++ lld/trunk/test/COFF/locally-imported.test Sun Jun 28 20:03:53 2015
@@ -1,5 +1,5 @@
# RUN: yaml2obj < %s > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-objdump -s %t.exe | FileCheck %s
# CHECK: Contents of section .text:
@@ -19,7 +19,7 @@ sections:
SectionData: 00000000
Relocations:
- VirtualAddress: 0
- SymbolName: __imp_mainCRTStartup
+ SymbolName: __imp_main
Type: IMAGE_REL_AMD64_ADDR32NB
symbols:
- Name: .text
@@ -35,13 +35,13 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: mainCRTStartup
+ - Name: main
Value: 4
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: __imp_mainCRTStartup
+ - Name: __imp_main
Value: 0
SectionNumber: 0
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/long-section-name.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/long-section-name.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/long-section-name.test (original)
+++ lld/trunk/test/COFF/long-section-name.test Sun Jun 28 20:03:53 2015
@@ -1,7 +1,10 @@
# RUN: yaml2obj < %s > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -sections %t.exe | FileCheck %s
+# CHECK: Name: .data_long_section_name
+# CHECK: Name: .text_long_section_name
+
---
header:
Machine: IMAGE_FILE_MACHINE_AMD64
@@ -46,13 +49,10 @@ symbols:
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
...
-
-# CHECK: Name: .data_long_section_name
-# CHECK: Name: .text_long_section_name
Modified: lld/trunk/test/COFF/manifest.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/manifest.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/manifest.test (original)
+++ lld/trunk/test/COFF/manifest.test Sun Jun 28 20:03:53 2015
@@ -1,6 +1,6 @@
# RUN: yaml2obj %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: FileCheck -check-prefix=MANIFEST %s < %t.exe.manifest
MANIFEST: <?xml version="1.0" standalone="yes"?>
@@ -15,7 +15,8 @@ MANIFEST: </security>
MANIFEST: </trustInfo>
MANIFEST: </assembly>
-# RUN: lld -flavor link2 /out:%t.exe /manifestuac:"level='requireAdministrator' uiAccess='true'" %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: /manifestuac:"level='requireAdministrator' uiAccess='true'" %t.obj
# RUN: FileCheck -check-prefix=UAC %s < %t.exe.manifest
UAC: <?xml version="1.0" standalone="yes"?>
@@ -30,7 +31,8 @@ UAC: </security>
UAC: </trustInfo>
UAC: </assembly>
-# RUN: lld -flavor link2 /out:%t.exe /manifestdependency:"foo='bar'" %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: /manifestdependency:"foo='bar'" %t.obj
# RUN: FileCheck -check-prefix=DEPENDENCY %s < %t.exe.manifest
DEPENDENCY: <?xml version="1.0" standalone="yes"?>
@@ -50,7 +52,7 @@ DEPENDENCY: </dependentAssembly>
DEPENDENCY: </dependency>
DEPENDENCY: </assembly>
-# RUN: lld -flavor link2 /out:%t.exe /manifestuac:no %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /manifestuac:no %t.obj
# RUN: FileCheck -check-prefix=NOUAC %s < %t.exe.manifest
NOUAC: <?xml version="1.0" standalone="yes"?>
Modified: lld/trunk/test/COFF/opt.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/opt.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/opt.test (original)
+++ lld/trunk/test/COFF/opt.test Sun Jun 28 20:03:53 2015
@@ -1,11 +1,13 @@
# RUN: yaml2obj < %s > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /verbose >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj \
+# RUN: /verbose >& %t.log
### FileCheck doesn't like empty input, so write something.
# RUN: echo dummy >> %t.log
# RUN: FileCheck -check-prefix=CHECK1 %s < %t.log
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /verbose /opt:noref >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj \
+# RUN: /verbose /opt:noref >& %t.log
# RUN: echo dummy >> %t.log
# RUN: FileCheck -check-prefix=CHECK2 %s < %t.log
@@ -52,7 +54,7 @@ symbols:
CheckSum: 0
Number: 0
Selection: IMAGE_COMDAT_SELECT_ANY
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/options.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/options.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/options.test (original)
+++ lld/trunk/test/COFF/options.test Sun Jun 28 20:03:53 2015
@@ -1,51 +1,51 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=BIND %s
-# RUN: lld -flavor link2 /allowbind /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /allowbind /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=BIND %s
BIND-NOT: IMAGE_DLL_CHARACTERISTICS_NO_BIND
-# RUN: lld -flavor link2 /allowbind:no /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /allowbind:no /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NOBIND %s
NOBIND: IMAGE_DLL_CHARACTERISTICS_NO_BIND
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=ISO %s
-# RUN: lld -flavor link2 /allowisolation /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /allowisolation /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=ISO %s
ISO-NOT: IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION
-# RUN: lld -flavor link2 /allowisolation:no /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /allowisolation:no /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NOISO %s
NOISO: IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=ENT %s
-# RUN: lld -flavor link2 /highentropyva /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /highentropyva %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=ENT %s
ENT: IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
-# RUN: lld -flavor link2 /highentropyva:no /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /highentropyva:no /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NOENT %s
NOENT-NOT: IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
-# RUN: lld -flavor link2 %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NXCOMPAT %s
-# RUN: lld -flavor link2 /nxcompat %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /nxcompat %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NXCOMPAT %s
NXCOMPAT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT
-# RUN: lld -flavor link2 /nxcompat:no /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /nxcompat:no /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NONXCOMPAT %s
NONXCOMPAT-NOT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT
-# RUN: lld -flavor link2 %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=TSAWARE %s
-# RUN: lld -flavor link2 /tsaware %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /tsaware %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=TSAWARE %s
TSAWARE: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
-# RUN: lld -flavor link2 /tsaware:no /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /tsaware:no /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NOTSAWARE %s
NOTSAWARE-NOT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
Modified: lld/trunk/test/COFF/order.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/order.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/order.test (original)
+++ lld/trunk/test/COFF/order.test Sun Jun 28 20:03:53 2015
@@ -4,7 +4,8 @@
# RUN: rm -f %t2.lib %t3.lib
# RUN: llvm-ar cru %t2.lib %t2.obj
# RUN: llvm-ar cru %t3.lib %t3.obj
-# RUN: lld -flavor link2 /out:%t.exe %t1.obj %t2.lib %t3.obj %t3.lib /verbose >& %t.log
+# RUN: lld -flavor link2 /out:%t.exe /entry:main \
+# RUN: %t1.obj %t2.lib %t3.obj %t3.lib /verbose >& %t.log
# RUN: FileCheck %s < %t.log
CHECK: order.test.tmp1.obj
Modified: lld/trunk/test/COFF/out.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/out.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/out.test (original)
+++ lld/trunk/test/COFF/out.test Sun Jun 28 20:03:53 2015
@@ -5,9 +5,9 @@
# RUN: cp %t.obj %T/out/tmp/out2
# RUN: cp %t.obj %T/out/tmp/out3.xyz
-# RUN: lld -flavor link2 %T/out/out1.obj
-# RUN: lld -flavor link2 %T/out/tmp/out2
-# RUN: lld -flavor link2 %T/out/tmp/out3.xyz
+# RUN: lld -flavor link2 /entry:main %T/out/out1.obj
+# RUN: lld -flavor link2 /entry:main %T/out/tmp/out2
+# RUN: lld -flavor link2 /entry:main %T/out/tmp/out3.xyz
# RUN: llvm-readobj out1.exe | FileCheck %s
# RUN: llvm-readobj out2.exe | FileCheck %s
Modified: lld/trunk/test/COFF/resource.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/resource.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/resource.test (original)
+++ lld/trunk/test/COFF/resource.test Sun Jun 28 20:03:53 2015
@@ -1,7 +1,7 @@
# REQUIRES: winres
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj %p/Inputs/resource.res
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj %p/Inputs/resource.res
# Check if the binary contains UTF-16LE string "Hello" copied from resource.res.
# RUN: FileCheck --check-prefix=EXE %s < %t.exe
Modified: lld/trunk/test/COFF/responsefile.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/responsefile.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/responsefile.test (original)
+++ lld/trunk/test/COFF/responsefile.test Sun Jun 28 20:03:53 2015
@@ -1,6 +1,6 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: echo /out:%t.exe %t.obj > %t.rsp
+# RUN: echo /out:%t.exe /entry:main %t.obj > %t.rsp
# RUN: lld -flavor link2 @%t.rsp /heap:0x3000
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
Modified: lld/trunk/test/COFF/stack.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/stack.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/stack.test (original)
+++ lld/trunk/test/COFF/stack.test Sun Jun 28 20:03:53 2015
@@ -1,24 +1,24 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=DEFAULT %s
DEFAULT: SizeOfStackReserve: 1048576
DEFAULT: SizeOfStackCommit: 4096
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /stack:0x3000
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /stack:0x3000
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s
# RUN: echo "STACKSIZE 12288" > %t.def
-# RUN: lld -flavor link2 /out:%t.exe /def:%t.def %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /def:%t.def %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s
CHECK1: SizeOfStackReserve: 12288
CHECK1: SizeOfStackCommit: 4096
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /stack:0x5000,0x3000
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /stack:0x5000,0x3000
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
# RUN: echo "STACKSIZE 20480,12288" > %t.def
-# RUN: lld -flavor link2 /out:%t.exe /def:%t.def %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main /def:%t.def %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
CHECK2: SizeOfStackReserve: 20480
Modified: lld/trunk/test/COFF/subsystem-inference.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/subsystem-inference.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/subsystem-inference.test (original)
+++ lld/trunk/test/COFF/subsystem-inference.test Sun Jun 28 20:03:53 2015
@@ -1,16 +1,16 @@
-# RUN: sed -e s/ENTRYNAME/mainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: sed -e s/ENTRYNAME/main/ %s | yaml2obj > %t.obj
# RUN: lld -flavor link2 /out:%t.exe %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=MAIN %s
-# RUN: sed s/ENTRYNAME/wmainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj
# RUN: lld -flavor link2 /out:%t.exe %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WMAIN %s
-# RUN: sed s/ENTRYNAME/WinMainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: sed s/ENTRYNAME/WinMain/ %s | yaml2obj > %t.obj
# RUN: lld -flavor link2 /out:%t.exe %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WINMAIN %s
-# RUN: sed s/ENTRYNAME/wWinMainCRTStartup/ %s | yaml2obj > %t.obj
+# RUN: sed s/ENTRYNAME/wWinMain/ %s | yaml2obj > %t.obj
# RUN: lld -flavor link2 /out:%t.exe %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=WWINMAIN %s
@@ -45,6 +45,30 @@ symbols:
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: mainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: wmainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: WinMainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: wWinMainCRTStartup
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
...
Modified: lld/trunk/test/COFF/unwind.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/unwind.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/unwind.test (original)
+++ lld/trunk/test/COFF/unwind.test Sun Jun 28 20:03:53 2015
@@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj
#
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=HEADER %s
# RUN: llvm-objdump -unwind-info %t.exe | FileCheck -check-prefix=UNWIND %s
#
@@ -183,7 +183,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: mainCRTStartup
+ - Name: main
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
Modified: lld/trunk/test/COFF/version.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/version.test?rev=240922&r1=240921&r2=240922&view=diff
==============================================================================
--- lld/trunk/test/COFF/version.test (original)
+++ lld/trunk/test/COFF/version.test Sun Jun 28 20:03:53 2015
@@ -1,18 +1,18 @@
# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
-# RUN: lld -flavor link2 /out:%t.exe %t.obj
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=DEFAULT %s
DEFAULT: MajorImageVersion: 0
DEFAULT: MinorImageVersion: 0
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /version:11
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /version:11
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s
CHECK1: MajorImageVersion: 11
CHECK1: MinorImageVersion: 0
-# RUN: lld -flavor link2 /out:%t.exe %t.obj /version:11.22
+# RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj /version:11.22
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=CHECK2 %s
CHECK2: MajorImageVersion: 11
More information about the llvm-commits
mailing list