summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Expand auto to improve code readability.Rui Ueyama2013-09-241-1/+1
| | | | llvm-svn: 191272
* [PECOFF] Use macro for the repeating pattern of the Driver code.Rui Ueyama2013-09-242-42/+20
| | | | llvm-svn: 191271
* [PECOFF] Remove redundant comments.Rui Ueyama2013-09-241-23/+12
| | | | llvm-svn: 191270
* [PECOFF] Ignore /pdb option.Rui Ueyama2013-09-241-2/+2
| | | | llvm-svn: 191269
* [PECOFF] Ignore /debug option.Rui Ueyama2013-09-242-0/+8
| | | | llvm-svn: 191268
* [PECOFF] Add /nodefaultlib command line option.Rui Ueyama2013-09-242-7/+27
| | | | llvm-svn: 191254
* [PECOFF] Do not allow space to separate command line option and its value.Rui Ueyama2013-09-231-24/+19
| | | | | | | | | | | | | | | We used to support both Windows and Unix style command line options. In Windows style, an option and its value are separated by ":" (colon). In Unix, separator is a space. Accepting both styles were convenient, but we can no longer allow Unix style because I found that can be ambiguous. For example, /nodefaultlib option takes an optional argument. In Windows style it's going to be something like "/nodefaultlib:foo". There's no ambiguity what "foo" means. However, if the option is "/nodefaultlib foo", "foo" can be interpreted either an optional argument for "/nodefaultlib" or an input file "foo.obj". We should just stop accepting the non-standard command line style. llvm-svn: 191247
* [PECOFF] Ignore /delay and /delayload options.Rui Ueyama2013-09-231-0/+8
| | | | | | | | | | | | | | | | These options are to enable DLL delay loading. If enabled, DLL is loaded at run time by a helper routine when a function in the DLL is actually called for the first time, instead of making the Windows loader to load all DLLs at startup time. This should shorten startup delay if an executable have many imported symbols. The linker needs to create a "delayed import table" and link delayimp.lib in which helper functions are defined to support the feature. For now, we just ignore the options, so that the linker does not complain when it sees these options. We want to support them in the future. llvm-svn: 191232
* [PECOFF] Add /allowisolation command line option.Rui Ueyama2013-09-233-0/+13
| | | | llvm-svn: 191227
* [PECOFF] Add /allowbind command line option.Rui Ueyama2013-09-233-0/+13
| | | | llvm-svn: 191224
* [PECOFF] Simplify WinLinkOptions.td.Rui Ueyama2013-09-232-20/+17
| | | | llvm-svn: 191223
* [lld][PECOFF] Fix data directory entry RVA of base relocations sectionRon Ofir2013-09-232-6/+9
| | | | | | | | | | | | | | | | | | | Summary: This patch changes WriterPECOFF to actually write down the address instead of ignoring it. Also, it changes the order of adding the BaseReloc chunk as otherwise the address wasn't set yet. I think a better way of doing it would be to change DataDirectoryAtom to create a Reference instead of using a number, and to change IdataPass accordingly, but I'm not sure how to do that. Reviewers: ruiu Reviewed By: ruiu CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1743 llvm-svn: 191220
* [PECOFF] Add /align command line option.Rui Ueyama2013-09-234-1/+21
| | | | llvm-svn: 191218
* Whitespace and extra parentheses.Rui Ueyama2013-09-232-3/+3
| | | | llvm-svn: 191217
* [lld][PECOFF] Calculate SizeOfHeaders field instead of using a hard-coded valueRon Ofir2013-09-231-4/+10
| | | | | | | | | | | | | | Summary: This patch changes WritePECOFF to calculate the value of the SizeOfHeaders PE header field instead of just using 512. Reviewers: rui314, ruiu Reviewed By: ruiu CC: llvm-commits, ruiu Differential Revision: http://llvm-reviews.chandlerc.com/D1708 llvm-svn: 191212
* [lld][ELF] Remove invalid commentShankar Easwaran2013-09-231-3/+1
| | | | llvm-svn: 191207
* [lld][LinkingContext][ELF] Allow different output file types.Shankar Easwaran2013-09-237-26/+48
| | | | | | | | | | This adds an option --output-filetype that can be set to either YAML/Native(case insensitive). The linker would create the outputs associated with the type specified by the user. Changes all the tests to use the new option. llvm-svn: 191183
* [lld][WinLink] Fix typoRon Ofir2013-09-201-2/+2
| | | | llvm-svn: 191079
* Fallback to the default stringize function to show some meaningful error ↵Rui Ueyama2013-09-201-8/+3
| | | | | | | | | | message. GNU LD driver only understood no_such_file_or_directory error and was showing just "Unknown Error" for any other type of error. With this patch, the driver now prints file name and error message string by default. llvm-svn: 191070
* [PECOFF] Ignore /incremental option.Rui Ueyama2013-09-201-0/+2
| | | | | | | | | /incremental is an option to enable incremental linking. We will eventually want to implement the feature for better performance, but in the meantime, we want to just ignore the option so that the linker does not output unknown option error when it sees /incremental option. llvm-svn: 191063
* Remove extraneous parentheses.Rui Ueyama2013-09-201-1/+1
| | | | llvm-svn: 191061
* [PECOFF] Ignore /errorReport command line option.Rui Ueyama2013-09-191-3/+8
| | | | | | | | /errorReport is a command line option to let the linker to report internal linker error information to Microsoft. For LLD that option doesn't make any sense, so it just ignores the option. llvm-svn: 191044
* [lld][ELF][Hexagon] Cleanup unused dataShankar Easwaran2013-09-192-3551/+595
| | | | | | | | Cleanup structure members that are not being used. Also clang-format it. llvm-svn: 191038
* [lld][ELF] Group command line options for better usageShankar Easwaran2013-09-191-97/+202
| | | | llvm-svn: 191033
* [lld][ELF] Support non alloc sections in the Writer.Shankar Easwaran2013-09-196-45/+96
| | | | | | | | | This also makes it support debugging executables built with lld. Initial patch done by Bigcheese. This is only a revised patch to have the functionality in the Writer. llvm-svn: 191032
* [PECOFF][Driver] Support /version command line optionRui Ueyama2013-09-193-10/+33
| | | | llvm-svn: 190986
* [PECOFF] Fix the order of the Import Table entries.Rui Ueyama2013-09-191-5/+13
| | | | | | Test is coming after submitting http://llvm-reviews.chandlerc.com/D1719. llvm-svn: 190983
* [PECOFF] Fix base relocation block alignmentRui Ueyama2013-09-181-2/+5
| | | | | | | | | | | Base relocation block should be aligned on a 32-bit boundary. While the PECOFF spec mentions only aligning the blocks, and not padding them, link.exe seems to add an extra IMAGE_REL_I386_ABSOLUTE entry (just a zeroed WORD) in order to pad the blocks. Patch by Ron Ofir. llvm-svn: 190951
* [PECOFF] Make helper functions private.Rui Ueyama2013-09-181-21/+21
| | | | llvm-svn: 190949
* [lld][YAML] RefNameResolver : add only if name/refname is not emptyShankar Easwaran2013-09-171-3/+3
| | | | llvm-svn: 190903
* [lld][ELF] Assign sectionChoice properly to ELF atomsShankar Easwaran2013-09-173-36/+54
| | | | | | | | | This sets the sectionChoice property for DefinedAtoms. The output section name is derived by the property of the atom. This also decreases native file size. Adds a test. llvm-svn: 190840
* [PECOFF] Take into account all sections when setting size fields in the PE ↵Rui Ueyama2013-09-161-3/+28
| | | | | | | | | | | | | | | header This patch changes lld to go through all sections while calculating the size for SizeOfCode, SizeOfInitializedData and SizeOfUninitializedData fields in the PE header, instead of using only a small set of hard-coded sections. This only really changes SizeOfInitializedData which didn't include .reloc section before this patch. Patch by Ron Ofir. llvm-svn: 190799
* [PECOFF] Add DISCARDABLE characteristic to .reloc sectionRui Ueyama2013-09-161-1/+2
| | | | | | | | | This patch sets the IMAGE_SCN_MEM_DISCARDABLE characteristic to the base relocations section in order to match MS PECOFF specification. Patch by Ron Ofir. llvm-svn: 190798
* [PECOFF] Use a dummy file as an "input file" for Idata atoms.Rui Ueyama2013-09-152-14/+31
| | | | llvm-svn: 190772
* Output soname.Joerg Sonnenberger2013-09-142-0/+11
| | | | llvm-svn: 190758
* If .bss doesn't exist, set _end/end based on .data.Joerg Sonnenberger2013-09-141-0/+4
| | | | llvm-svn: 190753
* Add _end symbol for dynamic libraries. At least brk/sbrk in libc onJoerg Sonnenberger2013-09-141-4/+29
| | | | | | NetBSD need it. llvm-svn: 190752
* Revert "[PECOFF] Allocate storage for .drective in the reader ..."Rui Ueyama2013-09-132-10/+9
| | | | | | This reverts r189881 because that patch caused dangling StringRefs. llvm-svn: 190725
* [PECOFF] Fix alignment bug.Rui Ueyama2013-09-131-6/+8
| | | | | | | | | | | | | | There was a bug that if a section has an alignment requirement and there are multiple symbols at offset 0 in the section, only the last atom at offset 0 would be aligned properly. That bug would move only the last symbol to an alignment boundary, leaving other symbols unaligned, although they should be at the same location. That caused a mysterious SEGV error of the resultant executable. With this patch, we manage all symbols at the same location properly, rather than keeping the last one. llvm-svn: 190724
* [PECOFF] Fix atom default alignment.Rui Ueyama2013-09-131-3/+3
| | | | | | | | Alignment(1) does not mean that the atom should be aligned on a 1 byte boundary but on a 2^1 boundary. So, atoms without any specific alignment requirements should have Alignment(0). llvm-svn: 190723
* [lld][ELF] Handle multiple weak symbolsShankar Easwaran2013-09-131-7/+6
| | | | | | | | | | | | This handles multiple weak symbols which appear back to back. This fix is needed which otherwise will lead to symbols getting initialized to arbitrary values. There was a constructor/destructor test that really triggered this to be fixed on X86_64. Adds a test. llvm-svn: 190658
* [PECOFF] Handle weak external symbols.Rui Ueyama2013-09-123-12/+68
| | | | | | Used the fallback mechanism to implement COFF weak external symbols. llvm-svn: 190633
* [PECOFF] Add a field for machine type to PECOFFLinkingContext.Rui Ueyama2013-09-123-5/+21
| | | | | | | | | So that we can determine what the target architecture is. Adding this field does not mean that we are going to support non-i386 architectures soon; there are many things to do to support them, and I'm focusing on i386 now. But this is the first step toward multi architecture support. llvm-svn: 190627
* Add a fallback mechanism for undefined atom.Rui Ueyama2013-09-125-9/+43
| | | | | | | | | | | | | | | | | In COFF, an undefined symbol can have up to one alternative name. If a symbol is resolved by its regular name, then it's linked normally. If a symbol is not found in any input files, all references to the regular name are resolved using the alternative name. If the alternative name is not found, it's a link error. This mechanism is called "weak externals". To support this mechanism, I added a new member function fallback() to undefined atom. If an undefined atom has the second name, fallback() returns a new undefined atom that should be used instead of the original one to resolve undefines. If it does not have the second name, the function returns nullptr. Differential Revision: http://llvm-reviews.chandlerc.com/D1550 llvm-svn: 190625
* [lld][LayoutPass] change comments to reflect the sort orderShankar Easwaran2013-09-121-4/+5
| | | | llvm-svn: 190612
* [lld][ELF] Fix vaddr of the first sectionShankar Easwaran2013-09-124-2/+7
| | | | | | The first section in the output was not aligned to the alignment of the section. llvm-svn: 190610
* [lld][ELF] Fix the readonly section order.Shankar Easwaran2013-09-121-0/+4
| | | | | | | This associates rodata and sections which just have the SHF_ALLOC flag to be set to typeConstant. llvm-svn: 190609
* [lld][LayoutPass] Order the atoms that are in the same chainShankar Easwaran2013-09-121-20/+9
| | | | | | | | | | | We need to order atoms that exist in the same chain. This is to make sure that the command line order is preserved when we emit the atoms to the output file. Credits: BigCheese for finding the bug. Adds a test which otherwise would fail. llvm-svn: 190608
* Remove hard-coded leading underscore from entry symbol.Rui Ueyama2013-09-121-3/+3
| | | | llvm-svn: 190586
* Do not hard code the leading underscore.Rui Ueyama2013-09-121-11/+15
| | | | | | | | Mangling scheme varies on platform, and prepending an underscore is valid only on 32-bit x86. Added a method to mangle name to PECOFFLinkingContext and use it to avoid hard coding mangled names. llvm-svn: 190585
OpenPOWER on IntegriCloud