summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify handleAnonymousVersion even more.Rui Ueyama2016-11-171-5/+2
| | | | | | | | | | | | | | We used to create a vector contantaining all version definitions with wildcards because doing that was efficient. All patterns were compiled to a regexp and matched against symbol names. Because a regexp can be converted to a DFA, matching against union of patterns is as cheap as matching against one patter. We are no longer converting them to regexp. Our own glob pattern handler doesn't do such optimization. Therefore, creating a vector no longer makes sense. llvm-svn: 287196
* Simplify. NFC.Rui Ueyama2016-11-171-6/+3
| | | | llvm-svn: 287192
* Split scanVersionScript. NFC.Rui Ueyama2016-11-171-32/+32
| | | | llvm-svn: 287191
* [ELF] - Separate locals list from versions.George Rimar2016-11-161-11/+8
| | | | | | | | | This change separates all versioned locals to be a separate list in config, that was suggested by Rafael and simplifies the logic a bit. Differential revision: https://reviews.llvm.org/D26754 llvm-svn: 287132
* Don't error if __tls_get_addr is defined.Rafael Espindola2016-11-161-1/+2
| | | | | | | Turns out some systems do define it. Not producing an error in this case matches gold and bfd. llvm-svn: 287125
* [ELF] - Added support for extern "c++" local symbols in version script.George Rimar2016-11-161-18/+18
| | | | | | | | | Previously we did not support them, patch implements this functionality Differential revision: https://reviews.llvm.org/D26604 llvm-svn: 287124
* [ELF] Add Section() to expression objectEugene Leviant2016-11-161-1/+2
| | | | | | | | | This allows making symbols containing ADDR(section) synthetic, and defining synthetic symbols outside SECTIONS block. Differential revision: https://reviews.llvm.org/D25441 llvm-svn: 287090
* Refactor symbol version assignmnt code.Rui Ueyama2016-11-151-54/+53
| | | | | | | | | | | | | | | | The code to handle symbol versions is getting tricky and hard to understand, so it is probably time to simplify it. This patch does the following. - Add `DemangledSyms` variable to SymbolTable so that we don't need to pass it around to findDemangled. - Define `initDemangledSyms` to initialize the variable lazily. - hasExternCpp is removed because we no longer have to initialize the map eagerly. - scanScriptVersion is split. - Comments are updated. llvm-svn: 287002
* Rename variables of type SymbolVersion.Rui Ueyama2016-11-151-21/+21
| | | | | | | In this file, `sym` was used for both SymbolBody and SymbolVersion although the two are completely different. llvm-svn: 286992
* [ELF] - Better diagnostic for relative relocation to an absolute value error.George Rimar2016-11-151-8/+9
| | | | | | | | | | | | | | Patch adds a filename to that error message. I faced next error when debugged one of FreeBSD port: error: relocation R_X86_64_PLT32 cannot refer to absolute symbol __tls_get_addr error message was poor and this patch improves it to show the locations of symbol declaration and using. Differential revision: https://reviews.llvm.org/D26508 llvm-svn: 286940
* [ELF] - Fix mistype. NFC.George Rimar2016-11-141-1/+1
| | | | llvm-svn: 286801
* [ELF] - Add support for locals list in version script.George Rimar2016-11-121-14/+23
| | | | | | | | | | | | | | | | | | | Previously we did not support anything except "local: *", patch changes that. Actually GNU rules of proccessing wildcards are more complex than that (http://www.airs.com/blog/archives/300): There are 2 iteration for wildcards, at first iteration "*" wildcards are ignored and handled at second iteration. Since we previously decided not to implement such complex rules, I suggest solution that is implemented in this patch. So for "local: *" case nothing changes, but if we have wildcarded locals, they are processed before wildcarded globals. This should fix several FreeBSD ports, one of them is jpeg-turbo-1.5.1 and currently blocks about 5k of ports. Differential revision: https://reviews.llvm.org/D26395 llvm-svn: 286713
* Mirror the llvm changes that split Bitcode/ReaderWriter.hTeresa Johnson2016-11-111-1/+0
| | | | | | | | | | | The change in D26502 splits ReaderWriter.h, which contains the APIs into both the BitReader and BitWriter libraries, into BitcodeReader.h and BitcodeWriter.h. Change lld uses to the appropriate split header, removing it completely in one case where it wasn't needed. llvm-svn: 286568
* Remove an overloaded function to simplify.Rui Ueyama2016-11-091-10/+4
| | | | | | | This version of addRegular is almost identical to the other except it lacked "size" parameter. llvm-svn: 286416
* Make OutputSectionBase a class instead of class template.Rafael Espindola2016-11-091-2/+1
| | | | | | | | The disadvantage is that we use uint64_t instad of uint32_t for some value in 32 bit files. The advantage is a substantially simpler code, faster builds and less code duplication. llvm-svn: 286414
* Simplify getLocation() function.Rui Ueyama2016-11-081-2/+2
| | | | | | | | All tests pass without the first parameter, so I guess we don't need it. Differential Revision: https://reviews.llvm.org/D26411 llvm-svn: 286287
* Rename a function to avoid function overloading. NFC.Rui Ueyama2016-11-081-5/+5
| | | | llvm-svn: 286282
* [ELF] Better error reporting for duplicate symbolEugene Leviant2016-11-081-7/+26
| | | | | | Differential revision: https://reviews.llvm.org/D26397 llvm-svn: 286244
* [ELF][MIPS] N32 ABI supportSimon Atanasyan2016-11-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | In short the patch introduces support for linking object file conform MIPS N32 ABI [1]. This ABI is similar to N64 ABI but uses 32-bit pointer size. The most non-trivial requirement of this ABI is one more relocation packing format. N64 ABI puts multiple relocation type into the single relocation record. The N32 ABI uses series of successive relocations with the same offset for this purpose. In this patch, new function `mergeMipsN32RelTypes` handle this case and "convert" N32 relocation to the N64 relocation so the rest of the code keep unchanged. For now, linker does not support series of relocations applied to sections without SHF_ALLOC bit. Probably later I will add the support or insert some sort of assert into the `relocateNonAlloc` routine to catch this case. [1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf Differential revision: https://reviews.llvm.org/D26298 llvm-svn: 286052
* Add [<chars>] to the glob matcher to eliminate use of llvm::Regex.Rui Ueyama2016-11-031-8/+8
| | | | | | | | | | | | | Previously, it didn't support the character class, so we couldn't eliminate the use fo llvm::Regex. Now that it is supported, we can remove compileGlobPattern, which converts a glob pattern to a regex. This patch contains optimization for exact/prefix/suffix matches. Differential Revision: https://reviews.llvm.org/D26284 llvm-svn: 285949
* [ELF] - Check that .dynsym is present in DSO if SHT_GNU_versym section is.George Rimar2016-11-021-1/+1
| | | | | | | | | | | | | | | When we have SHT_GNU_versym section, it is should be associated with symbol table section. Usually (and in out implementation) it is .dynsym. In case when .dynsym is absent (due to broken object for example), lld crashes in parseVerdefs() when accesses null pointer: Versym = reinterpret_cast<const Elf_Versym *>(this->ELFObj.base() + VersymSec->sh_offset) + this->Symtab->sh_info; DIfferential revision: https://reviews.llvm.org/D25553 llvm-svn: 285796
* Consolidate BumpPtrAllocators.Rui Ueyama2016-10-281-7/+6
| | | | | | | | | | | Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
* Don't create a dummy ELF to process a binary file.Rafael Espindola2016-10-271-5/+8
| | | | | | | Now that it is easy to create input section and symbols, this is simple. llvm-svn: 285322
* Have on addRegular forward to another. NFC.Rafael Espindola2016-10-261-13/+14
| | | | | | Another step in making it easier to create symbols without an ELf_Sym. llvm-svn: 285241
* Move a helper function that doesn't depend on a class out of the class.Rui Ueyama2016-10-261-9/+7
| | | | llvm-svn: 285220
* Define a helper function to demangle symbols.Rui Ueyama2016-10-261-5/+2
| | | | llvm-svn: 285219
* Reduce the number of allocators.Rafael Espindola2016-10-261-4/+4
| | | | | | | | | | We used to have one allocator per file, which reduces the advantage of using an allocator in the first place. This is a small speed up is most cases. The largest speedup was in 1.014X in chromium no-gc. The largest slowdown was scylla at 1.003X. llvm-svn: 285205
* Use a CachedHashString for comdats too.Rafael Espindola2016-10-211-1/+1
| | | | | | | We were already using it in the larger sets/maps. This provides about 1% speedup in linking xul and chromium. llvm-svn: 284862
* [ELF] - Applied clang format. NFC.George Rimar2016-10-201-2/+1
| | | | llvm-svn: 284705
* Use CachedHashStringRef instead of CachedHash<StringRef>.Justin Lebar2016-10-181-3/+4
| | | | | | | | | | | | | | Summary: This uses one less word on 64-bit platforms, so should be a strict improvement. This change also lets us get rid of llvm::CachedHash. Reviewers: rafael, timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25646 llvm-svn: 284502
* [ThinLTO] Avoid archive member collisions.Davide Italiano2016-10-121-3/+3
| | | | | | | | This fixes PR30665. Differential Revision: https://reviews.llvm.org/D25495 llvm-svn: 284034
* Rename warning -> warn.Rui Ueyama2016-09-291-5/+5
| | | | | | It's better because it's a verb. llvm-svn: 282763
* [ELF/LTO] Switch to the new resolution-based API.Davide Italiano2016-09-291-26/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D24492 llvm-svn: 282656
* Recommit r281318 "[ELF] - Versionscript: support mangled symbols with the ↵George Rimar2016-09-151-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | | same name." Previouly bot was failing: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/413/steps/test-stage1-compiler/logs/stdio Fixed possible segfault, so commit should bix the buildbot. Initial commit message: This is PR30312. Info from bug page: Both of these symbols demangle to abc::abc(): _ZN3abcC1Ev _ZN3abcC2Ev (These would be abc's complete object constructor and base object constructor, respectively.) however with "abc::abc()" in the version script only one of the two receives the symbol version. Patch fixes that. It uses testcase created by Ed Maste (D24306). Differential revision: https://reviews.llvm.org/D24336 llvm-svn: 281605
* Simplify InputFile ownership management.Rui Ueyama2016-09-141-31/+22
| | | | | | | | | | | | | | | | | | | | Previously, all input files were owned by the symbol table. Files were created at various places, such as the Driver, the lazy symbols, or the bitcode compiler, and the ownership of new files was transferred to the symbol table using std::unique_ptr. All input files were then free'd when the symbol table is freed which is on program exit. I think we don't have to transfer ownership just to free all instance at once on exit. In this patch, all instances are automatically collected to a vector and freed on exit. In this way, we no longer have to use std::unique_ptr. Differential Revision: https://reviews.llvm.org/D24493 llvm-svn: 281425
* revert: [ELF] - Versionscript: support mangled symbols with the same name.George Rimar2016-09-131-20/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Something broked BBots: 281318 failed on step 9: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/413 r281317 built step 9 green: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/415 Initial revision commits were: This is PR30312. Info from bug page: Both of these symbols demangle to abc::abc(): _ZN3abcC1Ev _ZN3abcC2Ev (These would be abc's complete object constructor and base object constructor, respectively.) however with "abc::abc()" in the version script only one of the two receives the symbol version. Patch fixes that. It uses testcase created by Ed Maste (D24306). Differential revision: https://reviews.llvm.org/D24336 llvm-svn: 281411
* Split scanVersionScript. NFC.Rui Ueyama2016-09-131-20/+25
| | | | llvm-svn: 281393
* Add comments.Rui Ueyama2016-09-131-0/+3
| | | | llvm-svn: 281388
* [ELF] - Versionscript: support mangled symbols with the same name.George Rimar2016-09-131-13/+20
| | | | | | | | | | | | | | | | | This is PR30312. Info from bug page: Both of these symbols demangle to abc::abc(): _ZN3abcC1Ev _ZN3abcC2Ev (These would be abc's complete object constructor and base object constructor, respectively.) however with "abc::abc()" in the version script only one of the two receives the symbol version. Patch fixes that. It uses testcase created by Ed Maste (D24306). Differential revision: https://reviews.llvm.org/D24336 llvm-svn: 281318
* [ELF] Fix memory leak in BinaryFile handling.Michael J. Spencer2016-09-101-0/+1
| | | | llvm-svn: 281129
* [ELF] Add support for -b binaryMichael J. Spencer2016-09-091-0/+6
| | | | | | | | | | Implemented by building an ELF file in memory. elf, default, and binary match gold behavior. Differential Revision: https://reviews.llvm.org/D24060 llvm-svn: 281108
* Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed code that was not checked before on windows for me, because of testcases that are disabled on that platform atm. Inital commit message: "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards." Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281049
* Revert r281045, it broke BB.George Rimar2016-09-091-2/+3
| | | | | | | Broken BB: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27211 llvm-svn: 281046
* Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed code that was not checked by testcases that are disabled on windows. Inital commit message: "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards." Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281045
* [ELF] - Revert r281038 to see if that unbreaks build bot.George Rimar2016-09-091-2/+3
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19703 llvm-svn: 281041
* [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281038
* Handle globs in global symbol names.Rafael Espindola2016-09-081-1/+13
| | | | | | Fixes pr28775. llvm-svn: 280947
* Update comments.Rui Ueyama2016-09-021-24/+31
| | | | llvm-svn: 280548
* [ELF] - Use std::regex instead of hand written logic in elf::globMatch()George Rimar2016-09-021-11/+9
| | | | | | | | | | Use std::regex instead of hand written matcher. Patch based on code and ideas of Rui Ueyama. Differential revision: https://reviews.llvm.org/D23829 llvm-svn: 280544
* Remove redundant argument. NFC.Rafael Espindola2016-08-311-16/+13
| | | | llvm-svn: 280243
OpenPOWER on IntegriCloud