summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* s/vector/std::vector/Rui Ueyama2014-06-021-22/+21
| | | | llvm-svn: 210014
* Simplify markLive().Rui Ueyama2014-06-021-6/+5
| | | | | | | | Reference::target() never returns a nullptr, so NULL check is not needed and is more harmful than doing nothing. No functionality change. llvm-svn: 210008
* [Mips] Implement .{ctors,dtors}.<priority> sections ordering.Simon Atanasyan2014-06-015-0/+119
| | | | | | | | | | | | | Arrange .ctors/.dtors sections in the following order: .ctors from crtbegin.o or crtbegin?.o .ctors from regular object files .ctors.* (sorted) from regular object files .ctors from crtend.o or crtend?.o This order is specific for MIPS traget. For example, on X86 the .ctors.* sections are merged into the .init_array section. llvm-svn: 209987
* There is no std::errc:success, remove the llvm one.Rafael Espindola2014-05-311-5/+5
| | | | llvm-svn: 209958
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-3134-102/+102
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209948
* [mach-o] Add support for custom sectionsNick Kledzik2014-05-304-12/+111
| | | | llvm-svn: 209928
* [ELF] Fix incorrect sorting of .init_array / .fini_array sections.Simon Atanasyan2014-05-301-15/+29
| | | | | | | | | | | | | | | | | | | | | | The main problem is in the predicate passed to the `std::stable_sort()`. This predicate always returns false if **both** section's names do not start with `.init_array` or `.fini_array` prefixes. In short, it does not define a strict weak orderng. Suppose we have the following sections: .A .init_array.1 .init_array.2 The predicate states that: not .init_array.1 < .A not .A < .init_array.2 but .init_array.1 < .init_array.2 !!! The second problem is that `.init_array` section without number should go last in the list. Not it has the lowest priority '0' and goes first. The patch fixes both of the problems. llvm-svn: 209875
* [mach-o] Wire up mach-o binary reader to reader registryNick Kledzik2014-05-301-0/+48
| | | | llvm-svn: 209868
* [mach-0] Add support for parsing compact unwind info sectionNick Kledzik2014-05-292-0/+28
| | | | llvm-svn: 209865
* [mach-o] Add support for parsing __eh_frame section. Generalize support for ↵Nick Kledzik2014-05-292-21/+107
| | | | | | whether symbols in a section are ignored or illegal llvm-svn: 209858
* [mach-o] Add support for parsing CFString sectionsNick Kledzik2014-05-292-25/+67
| | | | llvm-svn: 209844
* [Mips] Do not mix _gp and _gp_disp symbols in relocation handling.Simon Atanasyan2014-05-282-14/+22
| | | | | | No functional changes. llvm-svn: 209709
* [mach-o] Add support for parsing of weak-def symbolsNick Kledzik2014-05-281-2/+4
| | | | llvm-svn: 209707
* [mach-o] Support parsing of non-lazy-pointer sectionsNick Kledzik2014-05-285-22/+101
| | | | llvm-svn: 209704
* [mach-o] Add support for initializers and terminators in object filesNick Kledzik2014-05-273-2/+52
| | | | llvm-svn: 209700
* [mach-o] Add checks that string literals in object files are zero terminatedNick Kledzik2014-05-271-0/+15
| | | | llvm-svn: 209685
* [mach-o] Add support for reading utf16 string literal sectionsNick Kledzik2014-05-272-0/+20
| | | | llvm-svn: 209684
* Add make_dynamic_error_code().Nick Kledzik2014-05-272-3/+70
| | | | | | | | | | | This is a short-term fix to allow lld Readers to return error messages with dynamic content. The long term fix will be to enhance ErrorOr<> to work with errors other than error_code. Or to change the interface to Readers to pass down a diagnostics object through which all error messages are written. llvm-svn: 209681
* [Mips] Handle relocations against __gnu_local_gp symbol.Simon Atanasyan2014-05-271-0/+2
| | | | llvm-svn: 209644
* [Mips] Do not count global GOT entries using the separate variable. UseSimon Atanasyan2014-05-261-10/+4
| | | | | | size of global GOT entries map for that. llvm-svn: 209616
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-15/+6
| | | | | | perform calculations for R_MIPS_GOT16 and R_MIPS_CALL16 relocations. llvm-svn: 209594
* [Mips] Factor out the code assign a value to the absolute atom into theSimon Atanasyan2014-05-251-11/+9
| | | | | | separate function. llvm-svn: 209593
* [Mips] Factor out the code create Mips specific runtime file intoSimon Atanasyan2014-05-253-28/+13
| | | | | | the MipsELFWriters member function. llvm-svn: 209592
* [Mips] Remove unused class member declaration.Simon Atanasyan2014-05-251-3/+0
| | | | llvm-svn: 209591
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-18/+8
| | | | | | perform similar calculations. llvm-svn: 209590
* [Mips] Handle R_MIPS_TLS_TPREL_HI16 / R_MIPS_TLS_TPREL_LO16 relocations.Simon Atanasyan2014-05-244-20/+64
| | | | llvm-svn: 209582
* Use short identifier.Rui Ueyama2014-05-231-7/+7
| | | | llvm-svn: 209497
* [PECOFF] Make a separate pass for /alternatename symbols.Rui Ueyama2014-05-231-27/+44
| | | | | | | | | | | | | | | | | | | | | | | /alternatename is a command line option to define a weak alias. You can use it as /alternatename:foo=bar to define "foo" as a weak alias for "bar". Because it's a command line option, the weak alias mapping is in the LinkingContext object, and not in a object file being read. Previously, we looked up the mapping each time we read a new symbol from a file, to check if there is a weak alias defined for the symbol. That's not wrong, but had made function signature's a bit complicated -- we had to pass the mapping object to many functions. Now their parameter lists are much cleaner. This also has another (unrealized) benefit. parseFile() now read a file and then add alias symbols to the file. In the first pass a LinkingContext object is not used at all. That should make it easy to read files from archive files speculatively, as the first pass is free from side effect. llvm-svn: 209486
* Move alias symbols from ELFLinkingContext to LinkingContext.Rui Ueyama2014-05-222-77/+22
| | | | | | | | | | Alias symbols are SimpleDefinedAtoms and are platform neutral. They don't have to belong ELF. This patch is to make it available to all platforms. No functionality change intended. Differential Revision: http://reviews.llvm.org/D3862 llvm-svn: 209475
* [mach-o] Fix so that mach-o semantic errors return an error rather than assertNick Kledzik2014-05-222-8/+15
| | | | llvm-svn: 209469
* [mach-o] parse literal sections into atomsNick Kledzik2014-05-222-3/+69
| | | | llvm-svn: 209379
* Simplify nullptr check.Rui Ueyama2014-05-221-7/+4
| | | | llvm-svn: 209357
* [PECOFF] Fix unsafe memory access.Rui Ueyama2014-05-211-3/+5
| | | | llvm-svn: 209323
* [PECOFF] Check for a Characteristics field of a .debug section.Rui Ueyama2014-05-211-1/+3
| | | | llvm-svn: 209317
* [Mips] Simplify handling of R_MIPS_LO16 / R_MIPS_HI16 relocationsSimon Atanasyan2014-05-211-8/+8
| | | | | | against _gp_disp symbol. llvm-svn: 209315
* [PECOFF] Discard .debug sections.Rui Ueyama2014-05-211-0/+7
| | | | llvm-svn: 209274
* [PECOFF] Make COFFObjectReader thread-safe.Rui Ueyama2014-05-211-0/+3
| | | | llvm-svn: 209271
* [PECOFF] Acquire mutex before accessing shared objects.Rui Ueyama2014-05-201-0/+1
| | | | | | | | | | | addResolvableSymbols() queues input files, and readAllSymbols() reads from them. In practice it's currently safe because they are called from a single thread. But it's not guaranteed. Also, acquiring the same mutex is needed not to see inconsistent memory contents that is allowed in the C++ memory model. llvm-svn: 209254
* [PECOFF] Do not use anonymous namespace in a header.Rui Ueyama2014-05-201-6/+6
| | | | llvm-svn: 209243
* Fix typosAlp Toker2014-05-202-2/+2
| | | | llvm-svn: 209213
* [Mips] Show warning if the linker cannot find a pair for a R_MIPS_HI16Simon Atanasyan2014-05-191-4/+6
| | | | | | | relocation. In fact this case violates ABI but sometimes compilers might produce such code. llvm-svn: 209153
* [Mips] Fix calculation of initial GOT entry value when this entry isSimon Atanasyan2014-05-171-1/+1
| | | | | | referenced by a local symbol. llvm-svn: 209063
* [mach-o] Add support for zero-fill sections.Nick Kledzik2014-05-154-14/+58
| | | | llvm-svn: 208928
* [mach-o] Add support and test cases for parsing tentative definitionsNick Kledzik2014-05-156-4/+76
| | | | llvm-svn: 208919
* [PECOFF] Read files lazily.Rui Ueyama2014-05-141-9/+20
| | | | | | | | ExportedSymbolRenameFile is not always used. In most cases we don't need to read given files at all. So lazy load would help. This doesn't change the meaining of the program. llvm-svn: 208818
* Add -print_atoms options to DarwinLdDriver which dumps final state of all ↵Nick Kledzik2014-05-144-3/+14
| | | | | | atoms in yaml llvm-svn: 208813
* Fix regression introduced in r205566.Rui Ueyama2014-05-142-21/+28
| | | | | | | | | | | | | | | In r205566, I made a change to Resolver so that Resolver revisit only archive files in --start-group and --end-group pair. That's not correct, as it also has to revisit DSO files. This patch is to fix the issue. Added a test to demonstrate the fix. I confirmed that it succeeded before r205566, failed after r205566, and is ok with this patch. Differential Revision: http://reviews.llvm.org/D3734 llvm-svn: 208797
* [PECOFF] Find symbols with @number suffix for dllexported symbolsRui Ueyama2014-05-142-1/+133
| | | | | | | | | | | | | | | | | | | | As written in the comment in this patch, symbol names specified with /export option is resolved in a special way; for /export:foo, linker finds a foo@<number> symbol if such symbols exists. On Windows, a function in stdcall calling convention is mangled with a leading underscore and following "@" and numbers. This name mangling is kind of automatic, so you can sometimes omit _ and @number when specifying a symbol. /export option is that case. Previously, if a file in an archive file foo.lib provides a symbol _fn@8, and /export:fn is specified, LLD failed to resolve the symbol. It only tried to find _fn, and failed to find _fn@8. With this patch, _fn@8 will be searched on the second iteration. Differential Revision: http://reviews.llvm.org/D3736 llvm-svn: 208754
* Add observers to Input GraphRui Ueyama2014-05-142-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to add observers to an Input Graph, so that files returned from an Input Graph can be examined before they are passed to Resolver. To implement some PE/COFF features we need to know all the symbols that *can* be solved, including ones in archive files that are not yet to be read. Currently, Resolver only maintains a set of symbols that are already read. It has no knowledge on symbols in skipped files in an archive file. There are many ways to implement that. I chose to apply the observer pattern here because it seems most non-intrusive. We don't want to mess up Resolver with architecture specific features. Even in PE/COFF, the feature that needs this mechanism is minor. So I chose not to modify Resolver, but add a hook to Input Graph. Differential Revision: http://reviews.llvm.org/D3735 llvm-svn: 208753
* [ELF] Emit DT_TEXTREL dynamic table flag.Simon Atanasyan2014-05-131-0/+16
| | | | | | | | | | | | | | If one or more dynamic relocation might modify a read-only section, dynamic table should contain DT_TEXTREL tag. The patch introduces new `RelocationTable::canModifyReadonlySection()` method. This method checks through the relocations to see if any modifies a read-only section. The DynamicTable class calls this method and emits the DT_TEXTREL tag if necessary. The patch reviewed by Rui Ueyama and Shankar Easwaran. llvm-svn: 208670
OpenPOWER on IntegriCloud