Commit Graph

20 Commits

Author SHA1 Message Date
Davide Italiano bbea939b9d [ELF] __cxa_demangle is now called itaniumDemangle. Update.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@292182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17 01:59:13 +00:00
Rui Ueyama dcb317a748 Use ArrayRef instead of const std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290213 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-20 23:17:00 +00:00
Rui Ueyama fd845d1320 Move GlobPattern class from LLD to llvm/Support.
GlobPattern is a class to handle glob pattern matching. Currently
only LLD is using that, but technically that feature is not specific
to linkers, so in this patch I move that file to LLVM.

Differential Revision: https://reviews.llvm.org/D27969

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290212 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-20 23:09:09 +00:00
Rui Ueyama 8247002b65 Fix a bug that the glob pattern parser falls in an infinite loop for invalid patterns.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290160 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-20 03:12:28 +00:00
Michal Gorny 328fe6fd50 Remove unnecessary llvm/Config/config.h includes
Remove the includes of <llvm/Config/config.h> private LLVM header.
The relevant files seem not to use any definitions from that file,
and it is not available when building against installed LLVM.

The use in lib/ReaderWriter/MachO/MachOLinkingContext.cpp originates
from rL218718, and the use in ELF/Strings.cpp from rL274804 (where it
was moved from Symbols.cpp). In both cases, they were added as a part of
demangling support, and they provided HAVE_CXXABI_H.

Since we are now using the LLVM demangler library instead, the code was
removed and the includes and no longer necessary.

Differential Revision: https://reviews.llvm.org/D27757

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@289707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14 20:53:57 +00:00
Rui Ueyama f5511eb6d6 Make demangle() return None instead of "" if a given string is not a mangled symbol.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 23:17:05 +00:00
Rui Ueyama a2caa8e66e Introduce StringRefZ class to represent null-terminated strings.
StringRefZ is a class to represent a null-terminated string. String
length is computed lazily, so it's more efficient than StringRef to
represent strings in string table.

The motivation of defining this new class is to merge functions
that only differ in string types; we have many constructors that takes
`const char *` or `StringRef`. With StringRefZ, we can merge them.

Differential Revision: https://reviews.llvm.org/D27037

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:05:04 +00:00
Rui Ueyama f491592224 Define toString(const SymbolBody &) and remove maybeDemangle instead.
Differential Revision: https://reviews.llvm.org/D27065

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287899 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 20:24:18 +00:00
Rui Ueyama 9cf7928016 Add [<chars>] to the glob matcher to eliminate use of llvm::Regex.
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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@285949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-03 17:57:38 +00:00
Eugene Leviant 936ddf90cd Use globMatch() instead of llvm::regex in linker scripts
This can speed up lld up to 5 times when linking applications 
with large number of sections and using linker script.

Differential revision: https://reviews.llvm.org/D26241


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@285895 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-03 10:54:58 +00:00
Rui Ueyama 52a3f0022c Define a helper function to demangle symbols.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@285219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-26 18:28:06 +00:00
George Rimar 5f67cc1eb6 [ELF] - Linkerscript: implemented SORT_BY_INIT_PRIORITY.
This is PR30386,

SORT_BY_INIT_PRIORITY is a keyword can be used to sort sections by numerical value of the
GCC init_priority attribute encoded in the section name.

Differential revision: https://reviews.llvm.org/D24611

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@281646 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15 19:15:12 +00:00
George Rimar defb226bdc Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.
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


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@281049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 14:35:36 +00:00
George Rimar 2c24a30b7a [ELF] - Fix for: PR29093 - version script does not support [chars] wildcards
GNU ld supports [chars] wildcards in version scripts, to match a single instance of any of the chars.
Here is an extern example from libstdc++'s version script in FreeBSD:

extern "C++"
{
...

std::locale::_[T-Za-z]*;                                                                                                       
std::[A-Zm]*;                                                            
std::n[^u]*;                                                             
std::nu[^m]*;                                                            
std::num[^e]*;
...

}

Patch adds support for scripts above. This is PR29093.

Differential revision: https://reviews.llvm.org/D23803


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@280799 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 10:19:44 +00:00
Rafael Espindola e8be913959 Use the demangler in llvm.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@280733 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06 19:17:14 +00:00
Rui Ueyama 512b194953 Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@280548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 22:15:08 +00:00
George Rimar 21494d03f7 [ELF] - Use std::regex instead of hand written logic in elf::globMatch()
Use std::regex instead of hand written matcher.

Patch based on code and ideas of Rui Ueyama.

Differential revision: https://reviews.llvm.org/D23829

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@280544 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 21:17:20 +00:00
Rui Ueyama cf64318b9a Move demangle() from Symbols.cpp to Strings.cpp.
Symbols.cpp contains functions to handle ELF symbols.
demangle() function is essentially a function to work on a
string rather than on an ELF symbol. So Strings.cpp is a
better place to put that function.

This change also make demangle to demangle symbols unconditionally.
Previously, it demangled symbols only when Config->Demangle is true.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@274804 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07 23:04:15 +00:00
Rui Ueyama cbe9851d30 Move isValidCIdentifier to Strings.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@274112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 09:08:02 +00:00
Rui Ueyama 918a54e2b2 Create Strings.cpp and move string manipulation functions to that file.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@274109 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 08:01:32 +00:00