24 Commits

Author SHA1 Message Date
Rui Ueyama 5bed6388df Simplify ScriptParser.
- Rename currentBuffer -> getCurrentMB to start it with verb.
 - Simplify containsString.
 - Add llvm_unreachable at end of getCurrentMB.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 04:36:54 +00:00
Rui Ueyama 27d84a81e8 Do not name a variable Ret which is not a return value.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 04:36:51 +00:00
Rui Ueyama 49c036c231 Make get{Line,Column}Number members of StringParser.
This patch also renames currentLocation getCurrentLocation.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 04:36:49 +00:00
Rui Ueyama e9c562a6d4 Split getPos into getLineNumber and getColumnNumber.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-01 03:56:27 +00:00
Eugene Leviant bbd5d323bf [ELF] Print file:line for 'undefined section' errors
Differential revision: https://reviews.llvm.org/D27108


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 09:58:04 +00:00
Eugene Leviant 91d98a530b [ELF] Better error reporting for linker scripts
Differential revision: https://reviews.llvm.org/D26795


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 15:49:56 +00:00
Rui Ueyama 5a6632b7a8 Simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@284806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 04:52:13 +00:00
Justin Bogner ad1d98ccfe ELF: Implement skip() as (void)next()
Thanks to Rafael for pointing out the simplification.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@284407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:40:35 +00:00
Rui Ueyama 2113acd799 Rename skip(StringRef) -> consume(StringRef).
skip() and skip(StringRef) were overloaded functions that
have different semantics. This patch rename one of the functions
to avoid function overloading.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@284396 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 16:01:53 +00:00
Justin Bogner a2529b657d ELF: Add a skip() overload to ignore any token
Most functions that return StringRef should check their return values,
so I'm planning on marking StringRef [[nodiscard]]. This requires
splitting up functions like next() that are sometimes just used for
side effects.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@284363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 06:21:13 +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 d4a96c3e5a Revert r281045, it broke BB.
Broken BB:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27211

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


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@281045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 13:58:07 +00:00
George Rimar d3c4e449ec [ELF] - Revert r281038 to see if that unbreaks build bot.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19703

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@281041 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 12:56:55 +00:00
George Rimar b11530a9a2 [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@281038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-09 12:22:28 +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
Rui Ueyama 70f95d5eb9 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@280423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-01 22:48:05 +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
George Rimar e73cb9be29 [ELF] - Do not crash on unclosed quote (") in scripts.
Found that during investigation of FreeBsd scripts.
Unclosed quote just crashed lld.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@273398 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 11:39:16 +00:00
Rafael Espindola dbcaecf406 Add support for # comments.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@272892 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 13:29:48 +00:00
George Rimar 0234fb4428 [ELF] - Implemented comparsion operators for linkerscript.
Patch adds support of <,>,!=,==,>=,<= operators.

Differential revision: http://reviews.llvm.org/D19419

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@267382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 08:14:41 +00:00
Rui Ueyama 1b66b9a608 Use ScriptParserBase features to parse linker script expressions.
Previously, we have re-implemented utility functions such as `expect`
or `next` in LinkerScript.cpp. This patch reuses the existing
implementation that is in ScriptParser.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@267255 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 00:04:03 +00:00
Simon Atanasyan f0a3f99780 [ELF] Include Twine.h header to restore LLD build after r266524. NFC
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@266527 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 10:58:45 +00:00
Adhemerval Zanella 646a64159f [lld] [ELF] Add ScriptParserBase class
This patch add a base script tokenizer class to decouple parsing from
linker script handling.  The idea is to use this base class on dynamic
list parsing (--dynamic-list option). No functionality added.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@265600 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 20:59:11 +00:00