summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/WinLinkDriverTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* COFF: Remove the old COFF linker and make link an alias to link2.Rui Ueyama2015-08-061-728/+0
| | | | | | It's time to remove old COFF linker because the new one is now complete. llvm-svn: 244226
* Revert r234649 "PECOFF: Use C++11 braced init list to make Version objects."Nico Weber2015-04-111-10/+10
| | | | | | | | | | | | | | This doesn't compile with MSVC 2013: include\lld/ReaderWriter/PECOFFLinkingContext.h(356) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented include\lld/ReaderWriter/PECOFFLinkingContext.h(357) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented llvm-svn: 234676
* PECOFF: Use C++11 braced init list to make Version objects.Rui Ueyama2015-04-101-10/+10
| | | | llvm-svn: 234649
* PECOFF: allow more than one /alternatename for the same symbol.Rui Ueyama2015-02-261-3/+7
| | | | | | | | | | | Previously we have a string -> string map to keep the weak alias symbol mapping. Naturally we can't define more than one weak alias with that data structure. This patch is to allow multiple aliases for the same symbol by changing the map type to string -> set of string map. llvm-svn: 230702
* Unittest: Do s/_context/_ctx/g.Rui Ueyama2015-02-101-132/+132
| | | | llvm-svn: 228750
* [PECOFF] Remove an InputElement placeholder for the entry name.Rui Ueyama2015-01-151-21/+21
| | | | llvm-svn: 226133
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-151-4/+3
| | | | | | | | The original commit had an issue with Mac OS dylib files. It didn't handle fat binary dylib files correctly. This patch includes a fix. A test for that case has already been committed in r225764. llvm-svn: 226123
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-141-3/+4
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-131-4/+3
| | | | llvm-svn: 225764
* Re-commit r223330: Rewrite InputGraph's GroupRui Ueyama2014-12-101-13/+13
| | | | llvm-svn: 223867
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-041-13/+13
| | | | | | | | This reverts commit r223330 because it broke Darwin and ELF linkers in a way that we couldn't have caught with the existing test cases. llvm-svn: 223373
* Rewrite InputGraph's GroupRui Ueyama2014-12-041-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to reduce the excessive abstraction from the InputGraph. We found that even a simple thing, such as sorting input files (Mach-O) or adding a new file to the input file list (PE/COFF), is nearly impossible with the InputGraph abstraction, because it hides too much information behind it. As a result, we invented complex interactions between components (e.g. notifyProgress() mechanism) and tricky code to work around that limitation. There were many occasions that we needed to write awkward code. This patch is a first step to make it cleaner. As a first step, this removes Group class from the InputGraph. The grouping feature is now directly handled by the Resolver. notifyProgress is removed since we no longer need that. I could have cleaned it up even more, but in order to keep the patch minimum, I focused on Group. SimpleFileNode class, a container of File objects, is now limited to have only one File. We shold have done this earlier. We used to allow putting multiple File objects to FileNode. Although SimpleFileNode usually has only one file, the Driver class actually used that capability. I modified the Driver class a bit, so that one FileNode is created for each input File. We should now probably remove SimpleFileNode and directly store File objects to the InputGraph in some way, because a container that can contain only one object is useless. This is a TODO. Mach-O input files are now sorted before they are passe to the Resolver. DarwinInputGraph class is no longer needed, so removed. PECOFF still has hacky code to add a new file to the input file list. This will be cleaned up in another patch. llvm-svn: 223330
* [PECOFF] Ignore /maxilkfile option.Rui Ueyama2014-11-251-1/+2
| | | | | | | | | | .ilk file is a file for incremental linking. We don't create nor use that file. /MAXILKFILE is an undocumented option to specify the maximum size of the .ilk file, IIUC. We should just ignore the option. llvm-svn: 222777
* [PECOFF] Create an empty PDB file if debug option is enabled.Rui Ueyama2014-11-251-5/+13
| | | | | | | | | | | | | | | | There are many build files in the wild that depend on the fact that link.exe produces a PDB file if /DEBUG option is given. They fail if the file is not created. This patch is to make LLD create an empty (dummy) file to satisfy such build targets. This doesn't do anything other than "touching" the file. If a target depends on the content of the PDB file, this workaround is no help, of course. Otherwise this patch should help build some stuff. llvm-svn: 222773
* [PECOFF] Enable dead-stripping even if /debug option is given.Rui Ueyama2014-11-201-1/+1
| | | | | | | | | | | | | | | | | | /debug makes MSVC link.exe to not remove unused sections from the resulting executable. We did the same thing before. However, I realized that the removal of associative section depends on the dead-stripping pass in LLD, so we cannot disable that. Or LLD may produce slightly broken executables that have too much data in it (which could result in nasty subtle bugs). This patch is a temporary measure to create correct executable. Currently /debug does not have any real effect for LLD anyway. I'll improve associative section handling in another patch, so that they are removed from output without depending on the dead-stripping pass. llvm-svn: 222483
* [PECOFF] Fix /nodefaultlib option.Rui Ueyama2014-10-231-0/+9
| | | | | | | /nodefaultlib argument is a path name, so that needs to be compared case-insensitive way. Also the ".lib" extension should be ignored. llvm-svn: 220508
* Sort include files according to convention.Shankar Easwaran2014-10-181-2/+0
| | | | llvm-svn: 220131
* [PECOFF] Remember DLL names given with /delayload option.Rui Ueyama2014-10-081-1/+13
| | | | | | This is a step toward full support of /delayload. llvm-svn: 219344
* [PECOFF] Simplify /machine option handlingRui Ueyama2014-09-241-0/+5
| | | | | | | | /machine:ebc was previously recognized but rejected. Unknown architecture names were handled differently but eventually rejected too. We don't need to distinguish them. llvm-svn: 218344
* [PECOFF] Change export table type.Rui Ueyama2014-09-241-21/+17
| | | | | | | | | This patch changes the type of export table set from std::set to std::vector. The new code is slightly inefficient, but because export table elements are actually mutable, std::vector is better here. No functionality change. llvm-svn: 218343
* [PECOFF] Fix duplicate /export optionsRui Ueyama2014-09-231-2/+2
| | | | | | | | | If two or more /export options are given for the same symbol, we should always print a warning message and use the first one regardless of other parameters. Previously there was a case that the first parameter is not used. llvm-svn: 218342
* Driver: accept /machine:arm for Windows linkerSaleem Abdulrasool2014-09-191-3/+2
| | | | | | | | | Accept /machine:arm as an argument. This is changed to support ARM NT. Although there is no way to differentiate between ARM (Windows CE) and ARM NT (Windows on ARM), since LLVM currently only supports Windows on ARM, simply take /machine:arm to mean Windows on ARM. llvm-svn: 218105
* [PECOFF] Fix /profile option.Rui Ueyama2014-08-111-2/+2
| | | | | | | /profile implies /fixed:no -- so we had to *enable* base relocations rather than disabling it. llvm-svn: 215389
* [PECOFF] Add /profile command line option.Rui Ueyama2014-07-251-0/+11
| | | | llvm-svn: 213984
* [PECOFF] Add the entry point file at the right place.Rui Ueyama2014-07-231-19/+19
| | | | | | | | | The entry point file needs to be processed after all other object files and before all .lib files. It was processed after .lib files. That caused an issue that the entry point function was not resolved from the standard library files. llvm-svn: 213804
* [PECOFF] Fix entry point functions selectionRui Ueyama2014-07-231-25/+1
| | | | | | | | | | | | | | | | | | | | | On Windows there are four "main" functions -- main, wmain, WinMain, or wWinMain. Their parameter types are diffferent. The standard library provides four different entry functions (i.e. {w,}{WinMain,main}CRTStartup) for them. You need to use the right entry routine for your "main" function. If you give an /entry option, the specified name is used unconditionally. Otherwise, the linker needs to select the right one based on user-supplied entry point function. This can be done after the linker reads all the input files. This patch moves the code to determine the entry point function from the driver to a virtual input file. It also implements the correct logic for the entry point function selection. llvm-svn: 213713
* [PECOFF] Invoke cvtres.exe in the driver.Rui Ueyama2014-07-101-19/+0
| | | | | | | | | | | | | | | | | Previously we invoked cvtres.exe for each compiled Windows resource file. The generated files were then concatenated and embedded to the executable. That was not the correct way to merge compiled Windows resource files. If you just concatenate generated files, only the first file would be recognized and the rest would be ignored as trailing garbage. The right way to merge them is to call cvtres.exe with multiple input files. In this patch we do that in the Windows driver. llvm-svn: 212763
* [PECOFF] Add /IMPLIB command line option.Rui Ueyama2014-04-251-0/+10
| | | | | | This option is to override the default import file path. llvm-svn: 207175
* [PECOFF] Better handling of /OPT option.Rui Ueyama2014-04-221-0/+19
| | | | | | | | | | | Previously LLD would fail if /OPT:icf, /OPT:lbr or such are specified, because these command line flags would be handled as unknown ones. We rather want LLD to ignore these known but yet-to-be-implemented options for now. Added tests for the driver as well. llvm-svn: 206863
* [PECOFF] Win64 DLL entry function name is _DllMainCRTStartup.Rui Ueyama2014-04-181-0/+10
| | | | | | Unlike Win32/x86, it has no "@12" suffix. llvm-svn: 206648
* [PECOFF] Ignore /ignore option.Rui Ueyama2014-04-181-2/+2
| | | | | | | | /ignore:<number> is a linker option to disable warning specified by the number. We ignore the option because it does not make sense for LLD. llvm-svn: 206636
* [PECOFF] Support /manifestuac:NO.Rui Ueyama2014-04-181-0/+6
| | | | | | | If the value for /manifestuac is "NO", LLD will create a manifest XM file but won't emit <trustinfo> element. llvm-svn: 206633
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-271-3/+1
| | | | llvm-svn: 204982
* Remove extra semicolon for -Wpedantic.Simon Atanasyan2014-03-191-7/+7
| | | | llvm-svn: 204224
* [PECOFF] Fix link order.Rui Ueyama2014-03-141-5/+4
| | | | | | | | | | | | | | | | LLD fails to link symbol "_main" if the symbol is in a library file and the library file is given as a bare argument (i.e. not with /defaultlib option). It's because library files given as bare arguments are processed before other libraries given with /defaultlib, so when Linker finds msvcrtd needs a definition for "_main", the file providing the main function has already been processed and skipped. Linker don't revisit libraries if it's not given with /defaultlib. To fix it this patch change the way of command line handling; files end with ".lib" are treated as if they are given with /defaultlib. I don't believe it's 100% correct behavior but it's better than before. llvm-svn: 203892
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-061-1/+1
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* [PECOFF] Driver support for /SAFESEH option.Rui Ueyama2014-02-211-0/+16
| | | | | | | | | | | | | | | Syntactically /SAFESEH is a boolean flag -- you can pass /SAFESEH or /SAFESEH:no. The meaning of /SAFESEH is as follows. - If /SAFESEH is specified, the linker will produce an executable with SEH table. If any input files are not compatible with SEH, it's an error. - If /SAFESEH:no is specified, the linker will not emit SEH table even if all input files are compatible with SEH. - If no option is specified, the linker emits SEH table if all input files are compatible with SEH. llvm-svn: 201895
* [PECOFF] Accept /machine:x64 option.Rui Ueyama2014-01-241-3/+8
| | | | | | | This is the first patch to support PE32+ format, which is the image format to use 64 bit address space on Windows/x86-64. llvm-svn: 200029
* [PECOFF] Simplify: Replace two-value enum with bool.Rui Ueyama2014-01-061-2/+2
| | | | llvm-svn: 198634
* Use scoped enum.Rui Ueyama2014-01-031-2/+2
| | | | llvm-svn: 198396
* temporary commitRui Ueyama2013-12-281-1/+1
| | | | llvm-svn: 198103
* [PECOFF] Use std::set to store export symbol descriptors.Rui Ueyama2013-12-281-17/+22
| | | | | | | Each export symbol descriptor has unique name attribute, so std::set is better container than std::vector for it. No functionality change. llvm-svn: 198102
* Use EXPECT_EQ in unit tests.Rui Ueyama2013-12-251-2/+2
| | | | llvm-svn: 197999
* [PECOFF] Use the first definition of an export if specified multiple times.Rui Ueyama2013-12-251-1/+11
| | | | | | | If the same symbol is specified multiple times as arguments of /export, the first definition should be used. llvm-svn: 197998
* [PECOFF] Fix /export option in the .drectve section.Rui Ueyama2013-12-241-3/+3
| | | | | | | /EXPORT option has slightly different semantics if it appears in the .drectve section. This patch implements it. llvm-svn: 197970
* [PECOFF] Assign default export ordinals in LinkingContext::verify().Rui Ueyama2013-12-201-1/+1
| | | | | | | | | | | | | | | Default ordinals were assigned in EdataPass, and the assigned values were then discarded in the pass. No code other than EdataPass would not be able to get all of the information about ordinals. That's not ideal since I'm writing code to emit an Import Library file, which also needs ordinals. This is a patch to move the code to assign default ordinals from EdataPass to LinkingContext::verify(), so that assigned ordinals will be available anywhere. No functionality change. llvm-svn: 197797
* [PECOFF] Add a check for duplicate export ordinals.Rui Ueyama2013-12-161-0/+5
| | | | llvm-svn: 197373
* [PECOFF] Export ordinal must be in the range 1 through 65535.Rui Ueyama2013-12-161-0/+8
| | | | llvm-svn: 197365
* [PECOFF] Parse /export optional arguments.Rui Ueyama2013-12-131-4/+24
| | | | | | | /EXPORT command line option can take an ordinal, NONAME flag, and DATA flag. This patch is to parse these optional arguments. llvm-svn: 197217
* [PECOFF] Parse /dll command line option.Rui Ueyama2013-12-121-0/+3
| | | | llvm-svn: 197123
OpenPOWER on IntegriCloud